list.vue 19 KB

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