list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <div class="stockPrint-wrap">
  3. <div style="background-color: #fff;">
  4. <a-tabs v-model="currentTab" @change="changeTab">
  5. <a-tab-pane :key="1" tab="全部">
  6. </a-tab-pane>
  7. <a-tab-pane :key="2" tab="待打印">
  8. </a-tab-pane>
  9. </a-tabs>
  10. </div>
  11. <a-card style="margin-top: 5px;" size="small" :bordered="false">
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <!-- 搜索条件 -->
  14. <div ref="tableSearch" class="table-page-search-wrapper">
  15. <a-form layout="inline">
  16. <a-row :gutter="15">
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="创建时间">
  19. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="6" :sm="24">
  23. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  24. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="stockPrint-buyerName" @change="custChange" />
  25. </a-form-item>
  26. </a-col>
  27. <a-col :md="6" :sm="24">
  28. <a-form-item label="销售单号">
  29. <a-input id="stockPrint-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="24">
  33. <a-form-item label="备货单号">
  34. <a-input id="stockPrint-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  35. </a-form-item>
  36. </a-col>
  37. <template v-if="advanced">
  38. <a-col :md="6" :sm="24">
  39. <a-form-item label="收货客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  40. <dealerSubareaScopeList ref="shbuyerName" id="stockPrint-shbuyerName" @change="shcustChange" />
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="24">
  44. <a-form-item label="业务状态">
  45. <v-select
  46. v-model="queryParam.billStatus"
  47. ref="billStatus"
  48. id="stockPrint-billStatus"
  49. code="DISPATCH_BILL_STATUS"
  50. placeholder="请选择业务状态"
  51. allowClear></v-select>
  52. </a-form-item>
  53. </a-col>
  54. <a-col :md="6" :sm="24" v-if="currentTab == 1">
  55. <a-form-item label="单据状态">
  56. <v-select
  57. v-model="queryParam.voidFlag"
  58. ref="voidFlag"
  59. id="pushOrder-voidFlag"
  60. code="VOID_FLAG"
  61. placeholder="请选择单据状态"
  62. allowClear></v-select>
  63. </a-form-item>
  64. </a-col>
  65. <a-col :md="6" :sm="24" v-if="currentTab == 1">
  66. <a-form-item label="备货打印状态">
  67. <v-select
  68. v-model="queryParam.printStatus"
  69. ref="printStatus"
  70. id="pushOrder-printStatus"
  71. code="PRINT_STATUS"
  72. placeholder="请选择备货打印状态"
  73. allowClear></v-select>
  74. </a-form-item>
  75. </a-col>
  76. <a-col :md="6" :sm="24">
  77. <a-form-model-item label="所在区域">
  78. <subarea id="stockPrint-subarea" ref="subarea" @change="subareaChange"></subarea>
  79. </a-form-model-item>
  80. </a-col>
  81. <a-col :md="6" :sm="24">
  82. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  83. <Area id="stockPrint-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  84. </a-form-model-item>
  85. </a-col>
  86. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  87. <a-form-model-item label="仓库">
  88. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  89. </a-form-model-item>
  90. </a-col>
  91. </template>
  92. <a-col :md="5" :sm="24">
  93. <span class="table-page-search-submitButtons">
  94. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  95. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  96. <a @click="advanced=!advanced" style="margin-left: 8px">
  97. {{ advanced ? '收起' : '展开' }}
  98. <a-icon :type="advanced ? 'up' : 'down'"/>
  99. </a>
  100. </span>
  101. </a-col>
  102. </a-row>
  103. </a-form>
  104. </div>
  105. <!-- 列表 -->
  106. <s-table
  107. class="sTable fixPagination"
  108. ref="table"
  109. :style="{ height: tableHeight+84.5+'px' }"
  110. size="small"
  111. :rowKey="(record) => record.id"
  112. :columns="columns"
  113. :data="loadData"
  114. :scroll="{ y:tableHeight, x: 1600 }"
  115. :defaultLoadData="false"
  116. bordered>
  117. <!-- 销售单号 -->
  118. <template slot="salesBillNo" slot-scope="text, record">
  119. <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  120. <span v-else>{{ record.salesBillNo }}</span>
  121. </template>
  122. <!-- 备货单号 -->
  123. <template slot="dispatchBillNo" slot-scope="text, record">
  124. <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  125. <span v-else>{{ record.dispatchBillNo }}</span>
  126. </template>
  127. <!-- 发货说明 -->
  128. <template slot="explainInfo" slot-scope="text, record">
  129. <span v-if="record.explainInfo" class="link-bule" @click="handleExplainInfo(record)" :title="record.explainInfo">{{ record.explainInfo||'--' }}</span>
  130. <span v-else>--</span>
  131. </template>
  132. <!-- 备货打印状态 -->
  133. <template slot="printStatus" slot-scope="text, record">
  134. <span v-if="record.printStatus=='NO_PRINT'&&$hasPermissions('B_noPrintStatus')" class="link-bule" @click="handlePrintStatus(record)">{{ record.printStatusDictValue }}</span>
  135. <span v-else>{{ record.printStatusDictValue }}</span>
  136. </template>
  137. <div slot="costTitle">
  138. <a-tooltip placement="top">
  139. <template slot="title">
  140. 如果收货客户名称不为空,则按照收货客户级别的价格计算得到(总售价内容包括促销产品)。
  141. </template>
  142. <span style="margin-right: 5px;">实际总售价</span> <a-icon type="question-circle" />
  143. </a-tooltip>
  144. </div>
  145. <!-- 操作 -->
  146. <template slot="action" slot-scope="text, record">
  147. <a-button
  148. size="small"
  149. type="link"
  150. v-if="record.printStatus == 'NO_PRINT'&&record.voidFlag==0&&$hasPermissions('B_sendTypePrint')"
  151. class="button-warning"
  152. @click="handlePrint(record)"
  153. >发货分类打印</a-button>
  154. <a-button
  155. size="small"
  156. type="link"
  157. class="button-warning"
  158. v-else-if="record.printStatus == 'PRINT'&&$hasPermissions('B_stockPrintRecord')"
  159. @click="viewPrint(record)"
  160. >打印记录</a-button>
  161. <span v-else>--</span>
  162. </template>
  163. </s-table>
  164. <!-- 分类打印 -->
  165. <sendTypeModal v-drag ref="typePrint" :openModal="showTipModal" @ok="handlePrintOk" @close="showTipModal=false" />
  166. <!-- 打印记录 -->
  167. <recordModal v-drag ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
  168. <!-- 查看销售单或备货单详情 -->
  169. <commonModal
  170. :modalTit="detailType?'备货单详情':'销售单详情'"
  171. bodyPadding="10px"
  172. width="70%"
  173. :showFooter="false"
  174. :openModal="showDetailModal"
  175. @cancel="cancelDetail">
  176. <salesDetail v-if="detailType==0" ref="salesDetail" :bizSn="bizSn"></salesDetail>
  177. <dispatchDetail v-if="detailType==1" ref="dispatchDetail" :bizSn="bizSn"></dispatchDetail>
  178. </commonModal>
  179. <!-- 操作提示 -->
  180. <commonModal modalTit="操作提示" okText="暂不打印" :openModal="showPrintModal" @cancel="canselModal" @ok="updatePrintStatus">
  181. <div style="display:flex;flex-direction: column;align-items: center;">
  182. <div style="margin-bottom: 15px;font-size: 14px;">如需将打印状态回退至<strong>【暂不打印】</strong>,请点击下方按钮</div>
  183. <div style="line-height: 24px;">
  184. <div>备货单号:{{ tipData&&tipData.dispatchBillNo }}</div>
  185. <div>客户名称:{{ tipData&&tipData.buyerName }}</div>
  186. </div>
  187. </div>
  188. </commonModal>
  189. <!-- 发货说明 -->
  190. <explainInfoModal v-drag mode="view" :rowData="tipData" :openModal="showInfoModal" @close="canselModal"></explainInfoModal>
  191. </a-spin>
  192. </a-card>
  193. </div>
  194. </template>
  195. <script>
  196. import { commonMixin } from '@/utils/mixin'
  197. import rangeDate from '@/views/common/rangeDate.vue'
  198. import { STable, VSelect } from '@/components'
  199. import subarea from '@/views/common/subarea.js'
  200. import Area from '@/views/common/area.js'
  201. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  202. import sendTypeModal from './sendTypeModal.vue'
  203. import recordModal from './recordModal.vue'
  204. import commonModal from '@/views/common/commonModal.vue'
  205. import chooseWarehouse from '@/views/common/chooseWarehouse'
  206. import salesDetail from '@/views/salesManagement/salesQueryNew/detailAll.vue'
  207. import dispatchDetail from '@/views/salesManagement/pushOrderManagement/detail.vue'
  208. import explainInfoModal from '@/views/salesManagement/pushOrderManagement/explainInfoModal.vue'
  209. import { dispatchlList, dispatchDetailPrint, dispatchPrintStatus } from '@/api/dispatch'
  210. import { printBase64Fun } from '@/libs/JGPrint.js'
  211. export default {
  212. name: 'StockPrintList',
  213. mixins: [commonMixin],
  214. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, sendTypeModal, recordModal, Area, commonModal, salesDetail, dispatchDetail, explainInfoModal, chooseWarehouse },
  215. data () {
  216. return {
  217. spinning: false,
  218. advanced: true, // 高级搜索 展开/关闭
  219. disabled: false, // 查询、重置按钮是否可操作
  220. showDetailModal: false,
  221. detailType: 2,
  222. bizSn: null,
  223. tableHeight: 0,
  224. time: [],
  225. currentTab: 2,
  226. // 查询参数
  227. queryParam: {
  228. beginDate: '',
  229. endDate: '',
  230. buyerSn: undefined, // 客户名称
  231. receiverSn: undefined, // 收货客户名称
  232. salesBillNo: '', // 销售单号
  233. dispatchBillNo: '', // 备货单号
  234. billStatus: undefined, // 业务状态
  235. warehouseSn: undefined,
  236. subareaArea: {
  237. subareaSn: undefined,
  238. subareaAreaSn: undefined
  239. },
  240. shippingAddrProvinceSn: undefined,
  241. voidFlag: 0,
  242. printStatus: 'NO_PRINT'
  243. },
  244. showTipModal: false,
  245. showRecordModal: false,
  246. // 加载数据方法 必须为 Promise 对象
  247. loadData: parameter => {
  248. this.disabled = true
  249. this.spinning = true
  250. return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
  251. let data
  252. if (res.status == 200) {
  253. data = res.data
  254. const no = (data.pageNo - 1) * data.pageSize
  255. for (var i = 0; i < data.list.length; i++) {
  256. data.list[i].no = no + i + 1
  257. }
  258. this.disabled = false
  259. }
  260. this.spinning = false
  261. return data
  262. })
  263. },
  264. tipData: null,
  265. showPrintModal: false,
  266. showInfoModal: false
  267. }
  268. },
  269. computed: {
  270. columns () {
  271. const arr = [
  272. { title: '序号', dataIndex: 'no', width: '40px', align: 'center' },
  273. { title: '创建时间', dataIndex: 'createDate', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
  274. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '110px', align: 'center' },
  275. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '120px', align: 'center' },
  276. { title: '发货编号', dataIndex: 'sendNo', width: '40px', align: 'center', customRender: function (text) { return text || '--' } },
  277. { title: '发货说明', scopedSlots: { customRender: 'explainInfo' }, width: '80px', align: 'center', ellipsis: true },
  278. { title: '客户名称', dataIndex: 'buyerName', width: '130px', align: 'left', customRender: function (text) { return text || '--' } },
  279. { title: '收货客户名称', dataIndex: 'receiverName', width: '130px', align: 'left', customRender: function (text) { return text || '--' } },
  280. { title: '产品款数', dataIndex: 'totalCategory', width: '60px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  281. { title: '产品数量', dataIndex: 'totalQty', width: '60px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  282. { title: '仓库', dataIndex: 'warehouseName', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  283. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '60px', align: 'center', customRender: function (text) { return text || '--' } },
  284. { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '60px', align: 'center', customRender: function (text) { return text || '--' } },
  285. { title: '备货打印状态', width: '60px', align: 'center', scopedSlots: { customRender: 'printStatus' } },
  286. { title: '允许打印时间', dataIndex: 'allowPrintTime', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
  287. { title: '打印次数', dataIndex: 'stockUpPrintTimes', width: '40px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  288. { title: '操作', scopedSlots: { customRender: 'action' }, width: '80px', align: 'center', fixed: 'right' }
  289. ]
  290. if (this.$hasPermissions('M_stockPrintList_salesPrice')) { // 售价权限
  291. const ind = this.isShowWarehouse ? 10 : 9
  292. arr.splice(ind, 0, { slots: { title: 'costTitle' }, dataIndex: 'receiveTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  293. arr.splice(ind + 1, 0, { title: '易损件售价', dataIndex: 'receiveYsjTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  294. arr.splice(ind + 2, 0, { title: '电池售价', dataIndex: 'receiveDcTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  295. arr.splice(ind + 3, 0, { title: '机油售价', dataIndex: 'receiveJyTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  296. arr.splice(ind + 4, 0, { title: '轮胎售价', dataIndex: 'receiveLtTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  297. }
  298. return arr
  299. }
  300. },
  301. methods: {
  302. changeTab (v) {
  303. this.currentTab = v
  304. this.resetSearchForm()
  305. },
  306. // 时间 change
  307. dateChange (date) {
  308. this.queryParam.beginDate = date[0]
  309. this.queryParam.endDate = date[1]
  310. },
  311. custChange (val) {
  312. this.queryParam.buyerSn = val.key
  313. },
  314. shcustChange (val) {
  315. this.queryParam.receiverSn = val.key
  316. },
  317. handleDetail (row, type) {
  318. this.detailType = type
  319. this.bizSn = type == 0 ? row.salesBillSn : row.dispatchBillSn
  320. this.$store.state.app.curActionPermission = type == 0 ? 'B_salesDetail' : 'B_dispatchDetail'
  321. this.showDetailModal = true
  322. },
  323. cancelDetail () {
  324. this.showDetailModal = false
  325. this.detailType = 2
  326. this.bizSn = null
  327. this.$store.state.app.curActionPermission = ''
  328. },
  329. // 发货分类打印
  330. handlePrint (row) {
  331. this.$refs.typePrint.setData(row, row.dispatchBillSn)
  332. this.showTipModal = true
  333. },
  334. // 发货分类打印
  335. handlePrintOk (obj, taskName, type) {
  336. const _this = this
  337. const params = {
  338. type: 'DISPATCH_BILL_TYPE',
  339. dispatchBillSn: obj.dispatchBillSn
  340. }
  341. // 货位编号
  342. if (obj.orderBy) {
  343. params.type = params.type + '_STACK_PLACE'
  344. }
  345. // 原厂编码
  346. if (obj.origCode == 1) {
  347. params.type = params.type + '_ORIG_CODE'
  348. }
  349. // 装箱号
  350. if (obj.packNo == 1) {
  351. params.type = params.type + '_PACK_NUM'
  352. }
  353. _this.spinning = true
  354. printBase64Fun(
  355. dispatchDetailPrint,
  356. Object.assign(params, obj || {}),
  357. type,
  358. taskName,
  359. () => {
  360. _this.$store.state.app.curActionPermission = ''
  361. _this.$refs.table.refresh(true)
  362. _this.spinning = false
  363. },
  364. {
  365. billType: 'DISPATCH',
  366. billSn: params.dispatchBillSn,
  367. billNo: obj.dispatchBillNo,
  368. printType: taskName + '打印'
  369. })
  370. },
  371. // 打印记录
  372. viewPrint (row) {
  373. this.showRecordModal = true
  374. this.$refs.recordModal.setData(row, {
  375. billType: 'DISPATCH',
  376. billSn: row.dispatchBillSn
  377. })
  378. },
  379. // 允许备货打印
  380. handlePrintStatus (row) {
  381. this.tipData = row
  382. this.showPrintModal = true
  383. },
  384. canselModal () {
  385. this.tipData = null
  386. this.showPrintModal = false
  387. this.showInfoModal = false
  388. },
  389. updatePrintStatus () {
  390. dispatchPrintStatus({ dispatchBillSn: this.tipData.dispatchBillSn, printStatus: 'UNABLE_PRINT' }).then(res => {
  391. if (res.status == 200) {
  392. this.canselModal()
  393. this.$message.info(res.message)
  394. this.$refs.table.refresh()
  395. }
  396. })
  397. },
  398. // 查看发货说明
  399. handleExplainInfo (row) {
  400. this.tipData = row
  401. this.showInfoModal = true
  402. },
  403. subareaChange (val) {
  404. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  405. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  406. },
  407. // 重置
  408. resetSearchForm () {
  409. this.time = []
  410. this.$refs.rangeDate.resetDate(this.time)
  411. this.queryParam.beginDate = ''
  412. this.queryParam.endDate = ''
  413. this.queryParam.buyerSn = undefined
  414. this.queryParam.receiverSn = undefined
  415. this.$refs.dealerSubareaScopeList.resetForm()
  416. this.$refs.shbuyerName.resetForm()
  417. this.queryParam.salesBillNo = ''
  418. this.queryParam.dispatchBillNo = ''
  419. this.queryParam.billStatus = undefined
  420. this.queryParam.subareaArea.subareaSn = undefined
  421. this.queryParam.subareaArea.subareaAreaSn = undefined
  422. this.queryParam.shippingAddrProvinceSn = undefined
  423. this.queryParam.voidFlag = this.currentTab == 1 ? '' : '0'
  424. this.queryParam.warehouseSn = undefined
  425. this.queryParam.printStatus = this.currentTab == 1 ? '' : 'NO_PRINT'
  426. if (this.advanced) {
  427. this.$refs.subarea.clearData()
  428. }
  429. this.$refs.table.refresh(true)
  430. },
  431. pageInit () {
  432. const _this = this
  433. this.$nextTick(() => { // 页面渲染完成后的回调
  434. _this.setTableH()
  435. })
  436. },
  437. setTableH () {
  438. const tableSearchH = this.$refs.tableSearch.offsetHeight
  439. this.tableHeight = window.innerHeight - tableSearchH - 253
  440. }
  441. },
  442. watch: {
  443. advanced (newValue, oldValue) {
  444. const _this = this
  445. this.$nextTick(() => { // 页面渲染完成后的回调
  446. _this.setTableH()
  447. })
  448. },
  449. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  450. this.setTableH()
  451. }
  452. },
  453. mounted () {
  454. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  455. this.pageInit()
  456. this.resetSearchForm()
  457. }
  458. },
  459. activated () {
  460. // 如果是新页签打开,则重置当前页面
  461. if (this.$store.state.app.isNewTab) {
  462. this.pageInit()
  463. this.resetSearchForm()
  464. }
  465. // 仅刷新列表,不重置页面
  466. if (this.$store.state.app.updateList) {
  467. this.pageInit()
  468. this.$refs.table.refresh()
  469. }
  470. },
  471. beforeRouteEnter (to, from, next) {
  472. next(vm => {})
  473. }
  474. }
  475. </script>
  476. <style lang="less">
  477. .stockPrint-wrap{
  478. .sTable{
  479. margin-top: 10px;
  480. }
  481. .ant-tabs-bar{
  482. margin:0;
  483. }
  484. }
  485. </style>