list.vue 11 KB

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