list.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <a-card :bordered="false" class="satelliteWarehouseInventoryList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form-model
  6. id="satelliteWarehouseInventoryList-form"
  7. ref="ruleForm"
  8. :model="queryParam"
  9. :rules="rules"
  10. :labelCol="labelCol"
  11. :wrapperCol="wrapperCol"
  12. @keyup.enter.native="$refs.table.refresh(true)" >
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-model-item label="客户名称" prop="customer">
  16. <a-select
  17. placeholder="请选择客户"
  18. allowClear
  19. v-model="queryParam.customer"
  20. :showSearch="true"
  21. option-filter-prop="children"
  22. :filter-option="filterOption"
  23. >
  24. <a-select-option v-for="item in brandData" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
  25. </a-select>
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-model-item label="配件名称">
  30. <a-input id="satelliteWarehouseInventoryList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入配件名称" />
  31. </a-form-model-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-model-item label="配件编码">
  35. <a-input id="satelliteWarehouseInventoryList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品编码或产品原厂编码" />
  36. </a-form-model-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24">
  39. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="satelliteWarehouseInventoryList-refresh" style="margin-top: 4px">
  40. 查询
  41. </a-button>
  42. <a-button @click="resetSearchForm" :disabled="disabled" id="satelliteWarehouseInventoryList-reset" style="margin: 4px 0 0 8px">重置</a-button>
  43. </a-col>
  44. </a-row>
  45. </a-form-model>
  46. </div>
  47. <!-- 操作按钮 -->
  48. <div class="table-operator">
  49. <a-button id="satelliteWarehouseInventoryList-replenishment" type="primary" @click="handleReplenishment">
  50. 补货清单
  51. <span v-if="checkedList.length>0">({{checkedList.length}})</span>
  52. </a-button>
  53. </div>
  54. <!-- 列表 -->
  55. <s-table class="sTable" ref="table" size="default" :rowKey="record => record.id" :columns="columns" :data="loadData" bordered>
  56. <!-- 操作 -->
  57. <template slot="action" slot-scope="text, record">
  58. <a-button size="small" type="danger" v-if="checkedList.indexOf(record.id) != -1" @click="handleRemove(record)" id="satelliteWarehouseInventoryList-remove-btn">移出补货清单</a-button>
  59. <a-button size="small" type="primary" v-else @click="handleAdd(record)" id="satelliteWarehouseInventoryList-add-btn">加入补货单</a-button>
  60. </template>
  61. </s-table>
  62. <!-- 客户详情 -->
  63. <satellite-warehouse-inventory-add-modal :openModal="openModal" @close="closeModal" />
  64. </a-card>
  65. </template>
  66. <script>
  67. import moment from 'moment';
  68. // import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
  69. import { STable, VSelect } from '@/components';
  70. import satelliteWarehouseInventoryAddModal from './addModal.vue';
  71. export default {
  72. components: { STable, VSelect, satelliteWarehouseInventoryAddModal },
  73. data() {
  74. return {
  75. labelCol: { span: 8 },
  76. wrapperCol: { span: 16 },
  77. queryParam: {
  78. // 查询条件
  79. customer: undefined, // 客户名称
  80. bundleName: '', // 套餐名称
  81. itemName: '', // 服务名称
  82. brand: undefined // 产品品牌
  83. },
  84. rules: {
  85. customer: [{ required: true, message: '请输入客户名称', trigger: 'blur' }]
  86. },
  87. disabled: false, // 查询、重置按钮是否可操作
  88. brandData: [], // 产品品牌下拉数据
  89. columns: [
  90. { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
  91. { title: '客户名称', dataIndex: 'productName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  92. { title: '配件名称', dataIndex: 'productBrand', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  93. { title: '产品编码', dataIndex: 'productOldNum', align: 'center', customRender: function (text) { return text || '--' } },
  94. { title: '原厂编码', dataIndex: 'productType', align: 'center', customRender: function (text) { return text || '--' } },
  95. { title: '当前库存', dataIndex: 'inventoryNumss', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  96. { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
  97. ],
  98. // 加载数据方法 必须为 Promise 对象
  99. loadData: parameter => {
  100. this.disabled = true;
  101. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  102. // const data = res.data
  103. // const no = (data.pageNo - 1) * data.pageSize
  104. // for (var i = 0; i < data.list.length; i++) {
  105. // data.list[i].no = no + i + 1
  106. // }
  107. // this.disabled = false
  108. // return data
  109. // })
  110. const _this = this;
  111. return new Promise(function(resolve, reject) {
  112. const data = {
  113. pageNo: 1,
  114. pageSize: 10,
  115. list: [
  116. { id: '1', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', inventoryNumss: '0' },
  117. { id: '2', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', inventoryNumss: '0' },
  118. { id: '3', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', inventoryNumss: '0' },
  119. ]
  120. };
  121. const no = (data.pageNo - 1) * data.pageSize;
  122. for (var i = 0; i < data.list.length; i++) {
  123. data.list[i].no = no + i + 1;
  124. }
  125. _this.disabled = false;
  126. resolve(data);
  127. })
  128. },
  129. openModal: false, // 查看客户详情 弹框
  130. checkedList: [] // 加入补货单数据
  131. };
  132. },
  133. methods: {
  134. // 不可选日期
  135. disabledDate(date, dateStrings) {
  136. return date && date.valueOf() > Date.now()
  137. },
  138. // 查询
  139. handleSearch(){
  140. this.$refs.ruleForm.validate(valid => {
  141. if (valid) {
  142. this.$refs.table.refresh(true)
  143. } else {
  144. console.log('error submit!!');
  145. return false;
  146. }
  147. });
  148. },
  149. // 重置
  150. resetSearchForm() {
  151. this.queryParam.orderBundleNo = ''
  152. this.queryParam.orderBundle.custMobile = ''
  153. this.queryParam.bundleName = ''
  154. this.queryParam.itemName = ''
  155. this.oldTime = undefined
  156. this.newTime = undefined
  157. this.$refs.table.refresh(true)
  158. },
  159. // 补货清单
  160. handleReplenishment() {
  161. this.openModal = true
  162. },
  163. // 加入补货单
  164. handleAdd(row) {
  165. this.checkedList.indexOf(row.id) == -1 ? this.checkedList.push(row.id) : null
  166. },
  167. // 移出补货单
  168. handleRemove(row){
  169. this.checkedList.splice(this.checkedList.indexOf(row.id), 1)
  170. },
  171. // 关闭弹框
  172. closeModal() {
  173. this.openModal = false
  174. },
  175. filterOption(input, option) {
  176. return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  177. }
  178. }
  179. };
  180. </script>
  181. <style lang="less"></style>