purchase.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <div>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="data"
  6. ref="crud"
  7. @refresh-change="refreshChange"
  8. @selection-change="selectionChange"
  9. @search-change="searchChange"
  10. @saveColumn="saveColumn"
  11. :page.sync="page"
  12. @on-load="onLoad">
  13. </avue-crud>
  14. <div style="margin-left: 80%;padding: 15px">
  15. <span slot="footer" class="dialog-footer" >
  16. <el-button @click="closeFun">取 消</el-button>
  17. <el-button type="primary" @click="importProMent" :disabled="selectPromentList.length == 0">导入</el-button>
  18. </span>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import option from './config/purchase.json'
  24. import {getItemListByConditions} from "@/api/importTrade/purchase";
  25. export default {
  26. name: "index",
  27. props: {
  28. itemId: {
  29. type: String
  30. },
  31. closeFun: {
  32. type: Function
  33. }
  34. },
  35. data(){
  36. return {
  37. option:{},
  38. loading:false,
  39. data:[],
  40. selectPromentList:[],
  41. page: {
  42. pageSize: 10,
  43. pagerCount: 5,
  44. total: 0,
  45. },
  46. }
  47. },
  48. async created() {
  49. this.option = await this.getColumnData(this.getColumnName(45), option);
  50. },
  51. methods:{
  52. refreshChange(){
  53. this.onLoad(this.page);
  54. },
  55. searchChange(params,done){
  56. this.onLoad(this.page, params);
  57. done()
  58. },
  59. selectionChange(row){
  60. this.selectPromentList = row
  61. },
  62. onLoad(page, params = {}){
  63. this.loading = true;
  64. if (params.promentDate != undefined) {
  65. params.startDate = params.promentDate[0]+ " " + "00:00:00";
  66. params.endDate = params.promentDate[1] + " " + "23:59:59";
  67. this.$delete(params,'promentDate')
  68. }
  69. params.tradeType = "JK"
  70. getItemListByConditions(page.currentPage, page.pageSize,params).then(res=>{
  71. this.data = res.data.data.records
  72. this.page.total = res.data.data.total
  73. }).finally(()=>{
  74. this.loading = false;
  75. })
  76. },
  77. importProMent(){
  78. this.$emit('importProMent',this.selectPromentList);
  79. },
  80. //列保存触发
  81. async saveColumn() {
  82. const inSave = await this.saveColumnData(
  83. this.getColumnName(45),
  84. this.option
  85. );
  86. if (inSave) {
  87. this.$message.success("保存成功");
  88. //关闭窗口
  89. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  90. }
  91. },
  92. }
  93. }
  94. </script>
  95. <style scoped>
  96. </style>