list.vue 17 KB

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