list.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <a-card size="small" :bordered="false" class="warehouseAllocationList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" ref="searchForm" :model="queryParam" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="创建时间">
  9. <rangeDate ref="rangeDate" @change="dateChange" />
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="调出仓库">
  14. <a-select id="warehouseAllocation-basicInfo-outWarehouseSn" allowClear placeholder="请选择调出仓库" v-model="queryParam.outWarehouseSn">
  15. <a-select-option v-for="(item, index) in warehouseList" :key="index" :value="item.warehouseSn">{{ item.name }}</a-select-option>
  16. </a-select>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="调入仓库">
  21. <a-select id="warehouseAllocation-basicInfo-putWarehouseSn" allowClear placeholder="请选择调入仓库" v-model="queryParam.putWarehouseSn">
  22. <a-select-option v-for="(item, index) in warehouseList" :key="index" :value="item.warehouseSn">{{ item.name }}</a-select-option>
  23. </a-select>
  24. </a-form-item>
  25. </a-col>
  26. <template v-if="advanced">
  27. <a-col :md="6" :sm="24">
  28. <a-form-item label="业务状态">
  29. <v-select
  30. v-model="queryParam.state"
  31. ref="state"
  32. id="warehouseAllocationList-state"
  33. code="ALLOCATION_WAREHOUSE_STATE"
  34. placeholder="请选择业务状态"
  35. allowClear
  36. ></v-select>
  37. </a-form-item>
  38. </a-col>
  39. </template>
  40. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  41. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehouseAllocationList-refresh">查询</a-button>
  42. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="warehouseAllocationList-reset">重置</a-button>
  43. <a @click="advanced = !advanced" style="margin-left: 8px">
  44. {{ advanced ? '收起' : '展开' }}
  45. <a-icon :type="advanced ? 'up' : 'down'" />
  46. </a>
  47. </a-col>
  48. </a-row>
  49. </a-form>
  50. </div>
  51. <!-- 操作按钮 -->
  52. <div class="table-operator"><a-button id="warehouseAllocationList-add" type="primary" class="button-error" @click="openModal = true">新增</a-button></div>
  53. <!-- 列表 -->
  54. <s-table
  55. class="sTable"
  56. ref="table"
  57. size="default"
  58. :rowKey="record => record.id"
  59. :columns="columns"
  60. :data="loadData"
  61. :scroll="{ x: 1500, y: tableHeight }"
  62. bordered>
  63. <!-- 单号 -->
  64. <template slot="allocationWarehouseNo" slot-scope="text, record">
  65. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.allocationWarehouseNo }}</span>
  66. </template>
  67. <!-- 操作 -->
  68. <template slot="action" slot-scope="text, record">
  69. <a-button
  70. v-if="record.state == 'WAIT_AUDIT'"
  71. size="small"
  72. type="link"
  73. class="button-warning"
  74. @click="handleExamine(record)"
  75. id="warehouseAllocationList-examine-btn">
  76. 审核
  77. </a-button>
  78. <a-button
  79. v-if="(record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT')"
  80. size="small"
  81. type="link"
  82. class="button-info"
  83. @click="handleEdit(record)"
  84. id="warehouseAllocationList-edit-btn">
  85. 编辑
  86. </a-button>
  87. <a-button
  88. v-if="(record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT')"
  89. size="small"
  90. type="link"
  91. class="button-error"
  92. @click="handleDel(record)"
  93. id="warehouseAllocationList-del-btn">
  94. 删除
  95. </a-button>
  96. <span v-if="(record.state != 'WAIT_SUBMIT') && (record.state != 'WAIT_AUDIT')">--</span>
  97. </template>
  98. </s-table>
  99. <!-- 新增/编辑 -->
  100. <basic-info-modal :openModal="openModal" @ok="handleEdit" @close="openModal=false" />
  101. </a-card>
  102. </template>
  103. <script>
  104. import { allocWarehouseList, allocWarehouseAudit, allocWarehouseDel } from '@/api/allocWarehouse'
  105. import { warehouseAllList } from '@/api/warehouse.js'
  106. import { STable, VSelect } from '@/components'
  107. import basicInfoModal from './basicInfoModal.vue'
  108. import rangeDate from '@/views/common/rangeDate.vue'
  109. export default {
  110. components: { STable, VSelect, basicInfoModal, rangeDate },
  111. data () {
  112. return {
  113. advanced: false, // 高级搜索 展开/关闭
  114. tableHeight: 0,
  115. warehouseList: [], // 仓库列表
  116. queryParam: { // 查询条件
  117. beginDate: '',
  118. endDate: '',
  119. outWarehouseSn: undefined, // 调出仓库
  120. putWarehouseSn: undefined, // 调入仓库
  121. state: undefined // 审核状态
  122. },
  123. disabled: false, // 查询、重置按钮是否可操作
  124. columns: [
  125. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  126. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  127. { title: '单号', scopedSlots: { customRender: 'allocationWarehouseNo' }, align: 'center' },
  128. { title: '调出仓库', dataIndex: 'outWarehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  129. { title: '调入仓库', dataIndex: 'putWarehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  130. { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  131. { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  132. { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  133. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  134. { title: '业务状态', dataIndex: 'stateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  135. { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
  136. ],
  137. // 加载数据方法 必须为 Promise 对象
  138. loadData: parameter => {
  139. this.disabled = true
  140. if (this.tableHeight == 0) {
  141. this.tableHeight = window.innerHeight - 380
  142. }
  143. return allocWarehouseList(Object.assign(parameter, this.queryParam)).then(res => {
  144. const data = res.data
  145. const no = (data.pageNo - 1) * data.pageSize
  146. for (var i = 0; i < data.list.length; i++) {
  147. data.list[i].no = no + i + 1
  148. }
  149. this.disabled = false
  150. return data
  151. })
  152. },
  153. openModal: false // 新增编辑 弹框
  154. }
  155. },
  156. methods: {
  157. // 时间 change
  158. dateChange (date) {
  159. this.queryParam.beginDate = date[0]
  160. this.queryParam.endDate = date[1]
  161. },
  162. // 获取仓库列表
  163. getWarehouseList () {
  164. warehouseAllList({}).then(res => {
  165. if (res.status == 200) {
  166. this.warehouseList = res.data || []
  167. } else {
  168. this.warehouseList = []
  169. }
  170. })
  171. },
  172. // 重置
  173. resetSearchForm () {
  174. this.$refs.rangeDate.resetDate()
  175. this.queryParam.beginDate = ''
  176. this.queryParam.endDate = ''
  177. this.queryParam.outWarehouseSn = undefined
  178. this.queryParam.putWarehouseSn = undefined
  179. this.queryParam.state = undefined
  180. this.$refs.table.refresh(true)
  181. },
  182. // 删除
  183. handleDel (row) {
  184. const _this = this
  185. this.$confirm({
  186. title: '提示',
  187. content: '删除后不可恢复,确定要进行删除吗?',
  188. centered: true,
  189. onOk () {
  190. allocWarehouseDel({ id: row.id }).then(res => {
  191. if (res.status == 200) {
  192. _this.$message.success(res.message)
  193. _this.$refs.table.refresh()
  194. }
  195. })
  196. }
  197. })
  198. },
  199. // 审核
  200. handleExamine (row) {
  201. const _this = this
  202. this.$confirm({
  203. title: '提示',
  204. content: '确认要审核通过吗?',
  205. centered: true,
  206. onOk () {
  207. allocWarehouseAudit({ allocationWarehouseSn: row.allocationWarehouseSn }).then(res => {
  208. if (res.status == 200) {
  209. _this.$message.success(res.message)
  210. _this.$refs.table.refresh()
  211. }
  212. })
  213. }
  214. })
  215. },
  216. // 详情
  217. handleDetail (row) {
  218. this.$router.push({ path: `/allocationManagement/warehouseAllocation/detail/${row.allocationWarehouseSn}` })
  219. },
  220. // 新增/编辑
  221. handleEdit (row) {
  222. this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${row.id}/${row.allocationWarehouseSn}` })
  223. }
  224. },
  225. beforeRouteEnter (to, from, next) {
  226. next(vm => {
  227. vm.queryParam.outWarehouseSn = undefined
  228. vm.queryParam.putWarehouseSn = undefined
  229. vm.queryParam.state = undefined
  230. vm.queryParam.beginDate = ''
  231. vm.queryParam.endDate = ''
  232. vm.getWarehouseList()
  233. })
  234. }
  235. }
  236. </script>