list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <a-card size="small" :bordered="false" class="bulkWarehousingOrderList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @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. <a-input id="bulkWarehousingOrderList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="关联单号">
  15. <a-input id="bulkWarehousingOrderList-relationNo" v-model.trim="queryParam.relationNo" allowClear placeholder="请输入关联单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="入库单号">
  20. <a-input id="bulkWarehousingOrderList-sparePartsNo" v-model.trim="queryParam.sparePartsNo" allowClear placeholder="请输入入库单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="商户名称">
  25. <a-input id="bulkWarehousingOrderList-supplierName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入商户名称"/>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="金蝶单号">
  30. <a-input id="bulkWarehousingOrderList-kingdeeNo" v-model.trim="queryParam.kingdeeNo" allowClear placeholder="请输入金蝶单号"/>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="4" :sm="24">
  34. <a-form-item label="入库类型">
  35. <v-select
  36. v-model="queryParam.sparePartsType"
  37. ref="sparePartsType"
  38. id="bulkWarehousingOrderList-sparePartsType"
  39. code="SPARE_PARTS_TYPE"
  40. placeholder="请选择入库类型"
  41. allowClear></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="4" :sm="24" v-show="isShowWarehouse">
  45. <a-form-item label="入库仓库">
  46. <warehouse
  47. v-model="queryParam.warehouseSn"
  48. isPermission
  49. id="salesReturn-warehouseSn"
  50. placeholder="请选择退货仓库"
  51. />
  52. </a-form-item>
  53. </a-col>
  54. <a-col :md="4" :sm="24">
  55. <a-form-item label="状态">
  56. <v-select
  57. v-model="queryParam.state"
  58. ref="state"
  59. id="bulkWarehousingOrderList-state"
  60. code="SPARE_PARTS_STATE"
  61. placeholder="请选择状态"
  62. allowClear
  63. ></v-select>
  64. </a-form-item>
  65. </a-col>
  66. <a-col :md="6" :sm="24">
  67. <span class="table-page-search-submitButtons">
  68. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkWarehousingOrderList-refresh">查询</a-button>
  69. <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="bulkWarehousingOrderList-reset">重置</a-button>
  70. <a-button
  71. style="margin-left: 10px"
  72. v-if="$hasPermissions('B_sparePartsExport')"
  73. type="primary"
  74. class="button-warning"
  75. @click="handleExport"
  76. :disabled="disabled"
  77. :loading="exportLoading"
  78. >导出明细</a-button>
  79. </span>
  80. </a-col>
  81. </a-row>
  82. </a-form>
  83. </div>
  84. <!-- 操作按钮 -->
  85. <div class="table-operator">
  86. <a-button v-if="$hasPermissions('B_sparePartsNew')" id="bulkWarehousingOrderList-add" type="primary" class="button-error" @click="handleAdd">新增</a-button>
  87. <a-button
  88. v-if="$hasPermissions('B_sparePartsBatchAudit')"
  89. id="bulkWarehousingOrderList-batchAudit"
  90. type="primary"
  91. class="button-warning"
  92. :loading="loading"
  93. @click="handleBatchAudit"
  94. style="margin: 0 15px;">批量审核</a-button>
  95. <span style="margin-left: 8px">
  96. <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
  97. </span>
  98. </div>
  99. <!-- 列表 -->
  100. <s-table
  101. class="sTable fixPagination"
  102. ref="table"
  103. :style="{ height: tableHeight+84.5+'px' }"
  104. size="small"
  105. :rowKey="(record) => record.sparePartsSn"
  106. rowKeyName="sparePartsSn"
  107. :row-selection="$hasPermissions('B_sparePartsBatchAudit')?{ columnWidth: '4%', getCheckboxProps: record => ({ props: { disabled: record.state != 'WAIT_AUDIT' } }) }:null"
  108. @rowSelection="rowSelectionFun"
  109. :columns="columns"
  110. :data="loadData"
  111. :scroll="{ y: tableHeight }"
  112. :defaultLoadData="false"
  113. bordered>
  114. <!-- 入库单号 -->
  115. <template slot="sparePartsNo" slot-scope="text, record">
  116. <span v-if="$hasPermissions('B_sparePartsDetail')" class="link-bule" @click="handleDetail(record)">{{ record.sparePartsNo }}</span>
  117. <span v-else>{{ record.sparePartsNo }}</span>
  118. </template>
  119. <!-- 操作 -->
  120. <template slot="action" slot-scope="text, record">
  121. <a-button
  122. size="small"
  123. type="link"
  124. v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsAudit')"
  125. class="button-warning"
  126. @click="handleAudit(record)"
  127. id="allocateBillList-examine-btn">审核</a-button>
  128. <a-button
  129. size="small"
  130. type="link"
  131. v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsEdit')"
  132. @click="handleEdit(record)"
  133. class="button-info"
  134. id="bulkWarehousingOrderList-edit-btn">编辑</a-button>
  135. <a-button
  136. size="small"
  137. type="link"
  138. v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_sparePartsDel')"
  139. @click="handleDel(record)"
  140. class="button-error"
  141. id="bulkWarehousingOrderList-del-btn">删除</a-button>
  142. <span v-if="!(record.state == 'WAIT_AUDIT'&&($hasPermissions('B_sparePartsEdit') || $hasPermissions('B_sparePartsDel') || $hasPermissions('B_sparePartsAudit')))">--</span>
  143. </template>
  144. </s-table>
  145. </a-spin>
  146. <!-- 选择基本信息弹框 -->
  147. <basic-info-modal v-drag :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  148. <sparePartsDetailModal v-drag :openModal="openDetailModal" :itemSn="itemSn" @close="closeDetailModal" />
  149. <!-- 导出提示框 -->
  150. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  151. <!-- 审核不通过弹框 -->
  152. <auditNoPassModal v-drag ref="auditNoPassModal" :openModal="openAuditNoModal" @close="openAuditNoModal=false" />
  153. <batchAuditNoModal v-drag ref="batchAuditNoModal" :openModal="openBatchAuditNoModal" @close="openBatchAuditNoModal=false" @ok="hanldeAuditOk" />
  154. </a-card>
  155. </template>
  156. <script>
  157. import { commonMixin } from '@/utils/mixin'
  158. import { STable, VSelect } from '@/components'
  159. import basicInfoModal from './basicInfoModal.vue'
  160. import warehouse from '@/views/common/chooseWarehouse.js'
  161. import sparePartsDetailModal from './detailModal.vue'
  162. import reportModal from '@/views/common/reportModal.vue'
  163. import auditNoPassModal from './auditNoPassModal.vue'
  164. import batchAuditNoModal from './batchAuditNoModal.vue'
  165. import { hdExportExcel } from '@/libs/exportExcel'
  166. import { sparePartsList, sparePartsDelete, sparePartsAudit, sparePartsAuditVerify, sparePartsDetailExport } from '@/api/spareParts'
  167. export default {
  168. name: 'BulkWarehousingOrderList',
  169. mixins: [commonMixin],
  170. components: { STable, VSelect, basicInfoModal, sparePartsDetailModal, reportModal, auditNoPassModal, batchAuditNoModal, warehouse },
  171. data () {
  172. return {
  173. spinning: false,
  174. disabled: false, // 查询、重置按钮是否可操作
  175. openModal: false, // 基本信息弹框是否显示
  176. showExport: false,
  177. exportLoading: false,
  178. openAuditNoModal: false,
  179. openBatchAuditNoModal: false,
  180. tableHeight: 0,
  181. // 查询参数
  182. queryParam: {
  183. productCode: '',
  184. relationNo: '',
  185. state: undefined,
  186. sparePartsType: undefined,
  187. warehouseSn: undefined,
  188. sparePartsNo: '',
  189. supplierName: '',
  190. kingdeeNo: ''
  191. },
  192. loading: false,
  193. // 加载数据方法 必须为 Promise 对象
  194. loadData: parameter => {
  195. this.disabled = true
  196. this.spinning = true
  197. return sparePartsList(Object.assign(parameter, this.queryParam)).then(res => {
  198. let data
  199. if (res.status == 200) {
  200. data = res.data
  201. const no = (data.pageNo - 1) * data.pageSize
  202. for (var i = 0; i < data.list.length; i++) {
  203. data.list[i].no = no + i + 1
  204. }
  205. this.disabled = false
  206. }
  207. this.spinning = false
  208. return data
  209. })
  210. },
  211. openDetailModal: false,
  212. itemSn: null,
  213. rowSelectionInfo: null
  214. }
  215. },
  216. computed: {
  217. columns () {
  218. const arr = [
  219. { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  220. { title: '入库单号', scopedSlots: { customRender: 'sparePartsNo' }, width: '10%', align: 'center' },
  221. { title: '商户名称', dataIndex: 'supplierName', align: 'center', width: '12%', customRender: function (text) { return text || '--' }, ellipsis: true },
  222. { title: '入库数量', dataIndex: 'productTotalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  223. // { title: '入库成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  224. { title: '入库类型', dataIndex: 'sparePartsTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  225. // { title: '入库仓库', dataIndex: 'warehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  226. { title: '关联单号', dataIndex: 'relationNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  227. { title: '金蝶单号', dataIndex: 'kingdeeNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  228. { title: '状态', dataIndex: 'stateDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  229. { title: '备注', dataIndex: 'remark', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  230. { title: '操作', scopedSlots: { customRender: 'action' }, width: '9%', align: 'center' }
  231. ]
  232. if (this.isShowWarehouse) {
  233. arr.splice(6, 0, { title: '入库仓库', dataIndex: 'warehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
  234. }
  235. if (this.$hasPermissions('M_bulkWarehousingOrderList_costPrice')) { // 成本价权限
  236. arr.splice(4, 0, { title: '入库成本', dataIndex: 'productTotalCost', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  237. }
  238. return arr
  239. }
  240. },
  241. methods: {
  242. // 表格选中项
  243. rowSelectionFun (obj) {
  244. this.rowSelectionInfo = obj || null
  245. },
  246. // 导出
  247. handleExport () {
  248. const _this = this
  249. this.$store.state.app.curActionPermission = 'B_sparePartsExport'
  250. _this.exportLoading = true
  251. _this.spinning = true
  252. hdExportExcel(sparePartsDetailExport, _this.queryParam , '散件入库明细', function () {
  253. _this.exportLoading = false
  254. _this.spinning = false
  255. _this.showExport = true
  256. _this.$store.state.app.curActionPermission = ''
  257. })
  258. },
  259. // 新增
  260. handleAdd () {
  261. this.openModal = true
  262. },
  263. // 基本信息 保存
  264. handleOk (row) {
  265. this.$router.push({ path: `/purchasingManagement/bulkWarehousingOrder/add/${row.id}/${row.sparePartsSn}` })
  266. },
  267. // 编辑
  268. handleEdit (row) {
  269. this.$router.push({ path: `/purchasingManagement/bulkWarehousingOrder/edit/${row.id}/${row.sparePartsSn}` })
  270. },
  271. // 详情
  272. handleDetail (row) {
  273. if (!this.$hasPermissions('B_sparePartsDetail')) { return }
  274. this.itemSn = row.sparePartsSn
  275. this.openDetailModal = true
  276. },
  277. // 关闭弹框
  278. closeDetailModal () {
  279. this.itemSn = null
  280. this.openDetailModal = false
  281. },
  282. // 删除
  283. handleDel (row) {
  284. const _this = this
  285. this.$confirm({
  286. title: '提示',
  287. content: '删除后不可恢复,确定要进行删除吗?',
  288. centered: true,
  289. onOk () {
  290. _this.spinning = true
  291. sparePartsDelete({ sn: row.sparePartsSn }).then(res => {
  292. if (res.status == 200) {
  293. _this.$message.success(res.message)
  294. _this.$refs.table.refresh()
  295. _this.spinning = false
  296. } else {
  297. _this.spinning = false
  298. }
  299. })
  300. }
  301. })
  302. },
  303. // 重置
  304. resetSearchForm () {
  305. this.queryParam = {
  306. productCode: '',
  307. relationNo: '',
  308. state: undefined,
  309. sparePartsType: undefined,
  310. warehouseSn: undefined, // 仓库
  311. sparePartsNo: '',
  312. supplierName: '',
  313. kingdeeNo: ''
  314. }
  315. this.$refs.table.refresh(true)
  316. this.$refs.table.clearSelected()
  317. },
  318. // 单条审核
  319. handleAudit (row) {
  320. const _this = this
  321. this.$confirm({
  322. title: '提示',
  323. content: '确认要审核通过吗?',
  324. centered: true,
  325. onOk () {
  326. _this.spinning = true
  327. sparePartsAudit({ sn: row.sparePartsSn }).then(res => {
  328. if (res.status == 200) {
  329. if (res.data && res.data.sparePartsDetailList) {
  330. _this.$nextTick(() => {
  331. _this.openAuditNoModal = true
  332. _this.$refs.auditNoPassModal.setData(res.data.sparePartsDetailList)
  333. })
  334. } else {
  335. _this.hanldeAuditOk(res.message)
  336. }
  337. }
  338. _this.spinning = false
  339. })
  340. }
  341. })
  342. },
  343. // 批量审核
  344. handleBatchAudit () {
  345. const _this = this
  346. if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  347. this.$message.warning('请在列表勾选后再进行批量操作!')
  348. return
  349. }
  350. const snList = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
  351. _this.spinning = true
  352. sparePartsAuditVerify(snList).then(res => {
  353. if (res.status == 200 && res.data) {
  354. _this.$nextTick(() => {
  355. _this.openBatchAuditNoModal = true
  356. _this.$refs.batchAuditNoModal.getData(res.data)
  357. })
  358. }
  359. _this.spinning = false
  360. })
  361. },
  362. // 审核成功
  363. hanldeAuditOk (message) {
  364. this.$refs.table.clearSelected() // 清空表格选中项
  365. this.$message.success(message)
  366. this.$refs.table.refresh()
  367. },
  368. pageInit () {
  369. const _this = this
  370. this.$nextTick(() => { // 页面渲染完成后的回调
  371. _this.setTableH()
  372. })
  373. this.openModal = false
  374. this.openDetailModal = false
  375. this.itemSn = null
  376. this.rowSelectionInfo = null
  377. this.$refs.table.clearTable()
  378. },
  379. setTableH () {
  380. const tableSearchH = this.$refs.tableSearch.offsetHeight
  381. this.tableHeight = window.innerHeight - tableSearchH - 240
  382. }
  383. },
  384. watch: {
  385. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  386. this.setTableH()
  387. }
  388. },
  389. mounted () {
  390. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  391. this.pageInit()
  392. this.resetSearchForm()
  393. }
  394. },
  395. activated () {
  396. // 如果是新页签打开,则重置当前页面
  397. if (this.$store.state.app.isNewTab) {
  398. this.pageInit()
  399. this.resetSearchForm()
  400. }
  401. // 仅刷新列表,不重置页面
  402. if (this.$store.state.app.updateList) {
  403. this.pageInit()
  404. this.$refs.table.refresh()
  405. }
  406. },
  407. beforeRouteEnter (to, from, next) {
  408. next(vm => {})
  409. }
  410. }
  411. </script>
  412. <style lang="less">
  413. .bulkWarehousingOrderList-wrap{
  414. .active{
  415. color: #ed1c24;
  416. cursor: pointer;
  417. }
  418. .common{
  419. color: rgba(0, 0, 0);
  420. }
  421. }
  422. </style>