list.vue 20 KB

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