list.vue 16 KB

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