list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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: 1600 }"
  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. <div slot="costTitle">
  125. <a-tooltip placement="top">
  126. <template slot="title">
  127. 如果收货客户名称不为空,则按照收货客户的价格级别计算得到。
  128. </template>
  129. <span style="margin-right: 5px;">实际总售价</span> <a-icon type="question-circle" />
  130. </a-tooltip>
  131. </div>
  132. <!-- 操作 -->
  133. <template slot="action" slot-scope="text, record">
  134. <a-button
  135. size="small"
  136. type="link"
  137. v-if="record.printStatus == 'NO_PRINT'&&record.voidFlag==0&&$hasPermissions('B_sendTypePrint')"
  138. class="button-warning"
  139. @click="handlePrint(record)"
  140. >发货分类打印</a-button>
  141. <a-button
  142. size="small"
  143. type="link"
  144. class="button-warning"
  145. v-else-if="record.printStatus == 'PRINT'&&$hasPermissions('B_stockPrintRecord')"
  146. @click="viewPrint(record)"
  147. >打印记录</a-button>
  148. <span v-else>--</span>
  149. </template>
  150. </s-table>
  151. <!-- 分类打印 -->
  152. <sendTypeModal ref="typePrint" :openModal="showTipModal" @ok="handlePrintOk" @close="showTipModal=false" />
  153. <!-- 打印记录 -->
  154. <recordModal ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
  155. </a-spin>
  156. </a-card>
  157. </div>
  158. </template>
  159. <script>
  160. import { commonMixin } from '@/utils/mixin'
  161. import rangeDate from '@/views/common/rangeDate.vue'
  162. import { STable, VSelect } from '@/components'
  163. import subarea from '@/views/common/subarea.js'
  164. import Area from '@/views/common/area.js'
  165. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  166. import sendTypeModal from '@/views/salesManagement/pushOrderManagement/sendTypeModal.vue'
  167. import recordModal from './recordModal.vue'
  168. import { dispatchlList, dispatchDetailPrint } from '@/api/dispatch'
  169. import { printFun } from '@/libs/JGPrint.js'
  170. export default {
  171. name: 'PushOrderManagementList',
  172. mixins: [commonMixin],
  173. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, sendTypeModal, recordModal, Area },
  174. data () {
  175. return {
  176. spinning: false,
  177. advanced: true, // 高级搜索 展开/关闭
  178. disabled: false, // 查询、重置按钮是否可操作
  179. tableHeight: 0,
  180. time: [],
  181. currentTab: 2,
  182. // 查询参数
  183. queryParam: {
  184. beginDate: '',
  185. endDate: '',
  186. buyerSn: undefined, // 客户名称
  187. receiverSn: undefined, // 收货客户名称
  188. salesBillNo: '', // 销售单号
  189. dispatchBillNo: '', // 备货单号
  190. billStatus: undefined, // 业务状态
  191. subareaSn: undefined,
  192. shippingAddrProvinceSn: undefined,
  193. voidFlag: undefined,
  194. printStatus: 'NO_PRINT'
  195. },
  196. showTipModal: false,
  197. showRecordModal: false,
  198. // 加载数据方法 必须为 Promise 对象
  199. loadData: parameter => {
  200. this.disabled = true
  201. this.spinning = true
  202. return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
  203. let data
  204. if (res.status == 200) {
  205. data = res.data
  206. const no = (data.pageNo - 1) * data.pageSize
  207. for (var i = 0; i < data.list.length; i++) {
  208. data.list[i].no = no + i + 1
  209. }
  210. this.disabled = false
  211. }
  212. this.spinning = false
  213. return data
  214. })
  215. }
  216. }
  217. },
  218. computed: {
  219. columns () {
  220. const arr = [
  221. { title: '序号', dataIndex: 'no', width: '60px', align: 'center' },
  222. { title: '创建时间', dataIndex: 'createDate', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
  223. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '120px', align: 'center' },
  224. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '120px', align: 'center' },
  225. { title: '发货编号', dataIndex: 'sendNo', width: '70px', align: 'center' },
  226. { title: '客户名称', dataIndex: 'buyerName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  227. { title: '收货客户名称', dataIndex: 'receiverName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  228. { title: '产品款数', dataIndex: 'totalCategory', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  229. { title: '产品数量', dataIndex: 'totalQty', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  230. // { slots: { title: 'costTitle' }, dataIndex: 'totalAmount', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  231. { title: '易损件售价', dataIndex: 'receiveYsjTotalAmount', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  232. { title: '电池售价', dataIndex: 'receiveDcTotalAmount', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  233. { title: '机油售价', dataIndex: 'receiveJyTotalAmount', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  234. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '70px', align: 'center', customRender: function (text) { return text || '--' } },
  235. { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '70px', align: 'center', customRender: function (text) { return text || '--' } },
  236. { title: '备货打印状态', dataIndex: 'printStatusDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  237. { title: '打印次数', dataIndex: 'stockUpPrintTimes', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  238. { title: '操作', scopedSlots: { customRender: 'action' }, width: '100px', align: 'center', fixed: 'right' }
  239. ]
  240. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  241. arr.splice(9, 0, { slots: { title: 'costTitle' }, dataIndex: 'totalAmount', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  242. }
  243. return arr
  244. }
  245. },
  246. methods: {
  247. changeTab (v) {
  248. this.currentTab = v
  249. this.resetSearchForm()
  250. },
  251. // 时间 change
  252. dateChange (date) {
  253. this.queryParam.beginDate = date[0]
  254. this.queryParam.endDate = date[1]
  255. },
  256. custChange (val) {
  257. this.queryParam.buyerSn = val.key
  258. },
  259. shcustChange (val) {
  260. this.queryParam.receiverSn = val.key
  261. },
  262. // 详情
  263. handleDetail (row, type) {
  264. if (type == 0) {
  265. this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn, type: 'pushOrder' } })
  266. } else {
  267. this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'pushOrder' } })
  268. }
  269. },
  270. // 发货分类打印
  271. handlePrint (row) {
  272. this.$refs.typePrint.setData(row, row.dispatchBillSn)
  273. this.showTipModal = true
  274. },
  275. // 发货分类打印
  276. handlePrintOk (obj, taskName, type) {
  277. const _this = this
  278. const params = {
  279. type: 'DISPATCH_BILL_TYPE',
  280. dispatchBillSn: obj.dispatchBillSn
  281. }
  282. _this.spinning = true
  283. printFun(dispatchDetailPrint, Object.assign(params, obj || {}), type, taskName, () => { _this.spinning = false })
  284. },
  285. // 打印记录
  286. viewPrint (row) {
  287. this.showRecordModal = true
  288. this.$refs.recordModal.setData(row, {
  289. billType: 'SETTLE_RECEIPT',
  290. billSn: row.accountReceiptSn
  291. })
  292. },
  293. // 重置
  294. resetSearchForm () {
  295. this.time = []
  296. this.$refs.rangeDate.resetDate(this.time)
  297. this.queryParam.beginDate = ''
  298. this.queryParam.endDate = ''
  299. this.queryParam.buyerSn = undefined
  300. this.queryParam.receiverSn = undefined
  301. this.$refs.dealerSubareaScopeList.resetForm()
  302. this.$refs.shbuyerName.resetForm()
  303. this.queryParam.salesBillNo = ''
  304. this.queryParam.dispatchBillNo = ''
  305. this.queryParam.billStatus = undefined
  306. this.queryParam.subareaSn = undefined
  307. this.queryParam.shippingAddrProvinceSn = undefined
  308. this.queryParam.voidFlag = undefined
  309. this.queryParam.printStatus = this.currentTab == 1 ? '' : 'NO_PRINT'
  310. this.$refs.table.refresh(true)
  311. },
  312. pageInit () {
  313. const _this = this
  314. this.$nextTick(() => { // 页面渲染完成后的回调
  315. _this.setTableH()
  316. })
  317. },
  318. setTableH () {
  319. const tableSearchH = this.$refs.tableSearch.offsetHeight
  320. this.tableHeight = window.innerHeight - tableSearchH - 250
  321. }
  322. },
  323. watch: {
  324. advanced (newValue, oldValue) {
  325. const _this = this
  326. this.$nextTick(() => { // 页面渲染完成后的回调
  327. _this.setTableH()
  328. })
  329. },
  330. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  331. this.setTableH()
  332. }
  333. },
  334. mounted () {
  335. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  336. this.pageInit()
  337. this.resetSearchForm()
  338. }
  339. },
  340. activated () {
  341. // 如果是新页签打开,则重置当前页面
  342. if (this.$store.state.app.isNewTab) {
  343. this.pageInit()
  344. this.resetSearchForm()
  345. }
  346. // 仅刷新列表,不重置页面
  347. if (this.$store.state.app.updateList) {
  348. this.pageInit()
  349. this.$refs.table.refresh()
  350. }
  351. },
  352. beforeRouteEnter (to, from, next) {
  353. next(vm => {})
  354. }
  355. }
  356. </script>
  357. <style lang="less">
  358. .stockPrint-wrap{
  359. .sTable{
  360. margin-top: 10px;
  361. }
  362. .ant-tabs-bar{
  363. margin:0;
  364. }
  365. }
  366. </style>