list.vue 19 KB

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