list.vue 18 KB

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