selectOrderDetailList.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div>
  3. <avue-crud :option="option" :table-loading="loading" :data="data" :search.sync="search" ref="crud"
  4. @refresh-change="refreshChange" @selection-change="selectionChange" @search-change="searchChange"
  5. @saveColumn="saveColumn" :page.sync="page" @on-load="onLoad">
  6. <template slot="costTypeSearch">
  7. <breakdown-select v-model="search.costType" :configuration="breakConfiguration"></breakdown-select>
  8. </template>
  9. <template slot="menuLeft">
  10. <el-tabs v-model="activeName" @tab-click="tabHandle">
  11. <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
  12. <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
  13. </el-tabs>
  14. </template>
  15. <template slot-scope="scope" slot="menu">
  16. <el-button type="text" icon="el-icon-edit" size="small" @click.stop="importStagList(scope.row, scope.index)"
  17. v-if="activeName == 'searchList'"
  18. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  19. </el-button>
  20. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="removeStagList(scope.row, scope.index)"
  21. v-else>移除
  22. </el-button>
  23. </template>
  24. </avue-crud>
  25. <div class="dialogButton">
  26. <span slot="footer" class="dialog-footer">
  27. <el-button @click="$emit('closeFun')">取 消</el-button>
  28. <el-button type="primary" @click="importProMent" :disabled="goodsListSave.length == 0">导入</el-button>
  29. </span>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import option from './config/mainLists.json'
  35. import {getListOrder, orderListBySettlement} from "@/api/financialManagement/paymentRequest";
  36. export default {
  37. name: "index",
  38. props: {
  39. billType: {
  40. type: String
  41. },
  42. flag: {
  43. type: Number
  44. },
  45. params: {
  46. type: Object
  47. },
  48. itemId: {
  49. type: String
  50. },
  51. closeFun: {
  52. type: Function
  53. }
  54. },
  55. data() {
  56. return {
  57. activeName: "searchList",
  58. option: option,
  59. loading: false,
  60. search: {},
  61. data: [],
  62. selectList: [],
  63. page: {
  64. pageSize: 20,
  65. pagerCount: 1,
  66. total: 0,
  67. pageSizes: [20, 200, 300, 500, 700, 1000]
  68. },
  69. breakConfiguration: {
  70. multipleChoices: false,
  71. multiple: false,
  72. disabled: false,
  73. searchShow: true,
  74. collapseTags: false,
  75. clearable: true,
  76. placeholder: '请点击右边按钮选择',
  77. dicData: []
  78. },
  79. goodsListShow: [],
  80. goodsListSave: []
  81. }
  82. },
  83. watch: {
  84. 'params.corpId'(newVal, oldVal) {
  85. console.log(newVal,87)
  86. if (newVal != oldVal) {
  87. this.onLoad(this.page, this.search)
  88. }
  89. },
  90. },
  91. async created() {
  92. // this.option = await this.getColumnData(this.getColumnName(281), option);
  93. },
  94. mounted() {
  95. this.onLoad(this.page,this.params)
  96. },
  97. methods: {
  98. importStagList(row, index) {
  99. // this.goodsListSave.push(row);
  100. this.$refs.crud.toggleSelection([row]);
  101. },
  102. removeStagList(row, index) {
  103. this.goodsListSave.splice(row.$index, 1);
  104. },
  105. // 标签页切换
  106. tabHandle(data) {
  107. if (data.name == "searchList") {
  108. this.goodsListSave = this.data;
  109. this.data = this.goodsListShow;
  110. this.page.total = this.page.totalTwo
  111. } else if (data.name == "importStaging") {
  112. this.goodsListShow = this.data;
  113. this.data = this.goodsListSave;
  114. this.page.totalTwo = this.page.total;
  115. this.page.total = 0;
  116. }
  117. },
  118. refreshChange() {
  119. this.onLoad(this.page);
  120. },
  121. searchChange(params, done) {
  122. if (params.createStart) {
  123. params.createStartDate = params.createStart[0]
  124. params.createEndDate = params.createStart[1]
  125. }
  126. this.onLoad(this.page, params);
  127. done()
  128. },
  129. selectionChange(row) {
  130. // this.selectList = row
  131. this.goodsListSave = row
  132. },
  133. onLoad(page, params) {
  134. if(params && params.rentStartDate ){
  135. params.createStartDate = params.rentStartDate[0] + " " + "00:00:00"?params.rentStartDate[0] + " " + "00:00:00":'';
  136. params.createEndDate = params.rentStartDate[1] + " " + "23:59:59"?params.rentStartDate[1] + " " + "23:59:59":'';
  137. this.$delete(params, 'rentStartDate')
  138. }
  139. this.loading = true;
  140. // 把老数据进行更新 从父组件调用的子组件方法
  141. if (params.customerId != this.params.customerId) {
  142. this.params = params
  143. }
  144. params = {
  145. // ...params,
  146. ...page,
  147. ...this.params
  148. }
  149. // ...this.params 使用之前的老数据 回请求之前的ID造成数据不对
  150. params.billType = this.billType
  151. if (this.$store.getters.userInfo.tenant_id === "673511") {
  152. params.type = "CMY"
  153. }
  154. params.flag = this.flag
  155. if (this.params.bsType == 'XS') {
  156. params.settlementType = 'd'
  157. }else {
  158. params.settlementType = 'c'
  159. }
  160. orderListBySettlement(page.currentPage, page.pageSize, params).then(res => {
  161. this.data = res.data.data.records
  162. this.page.total = res.data.data.total
  163. }).finally(() => {
  164. this.loading = false;
  165. })
  166. // getListOrder(page.currentPage, page.pageSize, params).then(res => {
  167. // console.log(res,155)
  168. // this.data = res.data.data.records
  169. // this.page.total = res.data.data.total
  170. // }).finally(() => {
  171. // this.loading = false;
  172. // })
  173. },
  174. importProMent() {
  175. this.$emit('importProMent', this.goodsListSave);
  176. },
  177. //列保存触发
  178. async saveColumn() {
  179. const inSave = await this.saveColumnData(
  180. this.getColumnName(281),
  181. this.option
  182. );
  183. if (inSave) {
  184. this.$message.success("保存成功");
  185. //关闭窗口
  186. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  187. }
  188. },
  189. }
  190. }
  191. </script>
  192. <style scoped></style>