list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <div class="transfersPrintList-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" id="transfersPrintList-form" @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 id="transfersPrintList-time" 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="transfersPrintList-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. <a-input id="transfersPrintList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
  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="transfersPrintList-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="transfersPrintList-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" v-if="currentTab == 1">
  49. <a-form-item label="打印状态">
  50. <v-select
  51. v-model="queryParam.printState"
  52. ref="printState"
  53. id="transfersPrintList-printState"
  54. code="PRINT_STATUS"
  55. placeholder="请选择打印状态"
  56. allowClear
  57. ></v-select>
  58. </a-form-item>
  59. </a-col>
  60. <a-col :md="6" :sm="24">
  61. <a-form-item label="收货客户名称">
  62. <dealerSearchList id="transfersPrintList-receiver" ref="receiverSn" @change="custChange"/>
  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="transfersPrintList-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="transfersPrintList-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="transfersPrintList-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" id="transfersPrintList-bizUserSn" 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="transfersPrintList-refresh">查询</a-button>
  93. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="transfersPrintList-reset">重置</a-button>
  94. <a @click="advanced=!advanced" style="margin-left: 5px" id="transfersPrintList-advanced">
  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" id="transfersPrintList-tabs">
  105. <a-tab-pane :key="1" tab="全部" id="transfersPrintList-tabs1">
  106. </a-tab-pane>
  107. <a-tab-pane :key="2" tab="待打印" id="transfersPrintList-tabs2">
  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')" :id="'transfersPrintList-allocateNo'+record.id" 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'" :id="'transfersPrintList-printStatus'+record.id" 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="'transfersPrintList-printState-btn'+record.id">调拨分类打印</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="'transfersPrintList-printRecord-btn'+record.id">打印记录</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 { printBase64Fun } from '@/libs/JGPrint.js'
  201. // 组件
  202. import { STable, VSelect } from '@/components'
  203. import subarea from '@/views/common/subarea.js'
  204. import Area from '@/views/common/area.js'
  205. import rangeDate from '@/views/common/rangeDate.vue'
  206. import dealerSearchList from '@/views/common/dealerSearchList.vue'
  207. import printModal from '@/views/allocationManagement/transferOut/printModal.vue'
  208. import commonModal from '@/views/common/commonModal.vue'
  209. import warehouse from '@/views/common/chooseWarehouse.js'
  210. import customerService from '@/views/common/customerService'
  211. import allocationDetailModal from '@/views/allocationManagement/transferOut/detail.vue'
  212. import recordModal from './recordModal.vue'
  213. // 接口
  214. import { allocateBillList, allocateBillDetailPrint, updatePrintState } from '@/api/allocateBill'
  215. export default {
  216. name: 'TransfersPrintList',
  217. mixins: [commonMixin],
  218. components: { STable, VSelect, rangeDate, dealerSearchList, printModal, commonModal, recordModal, subarea, Area, allocationDetailModal, warehouse, customerService },
  219. data () {
  220. return {
  221. spinning: false,
  222. advanced: true, // 高级搜索 展开/关闭
  223. tableHeight: 0, // 表格高度
  224. disabled: false, // 查询、重置按钮是否可操作
  225. exportLoading: false, // 导出按钮加载状态
  226. itemData: null, // 当前行数据
  227. bizSn: '', // 调拨sn
  228. showRecordModal: false, // 打印记录弹窗
  229. showPrintModal: false, // 打印弹窗
  230. showDetailModal: false, // 调拨单详情弹窗
  231. // 创建时间默认值
  232. time: [
  233. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'), // 开始时间
  234. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')// 几位数使劲
  235. ],
  236. // 查询条件
  237. queryParam: {
  238. beginDate: getDate.getThreeMonthDays().starttime, // 开始时间
  239. endDate: getDate.getCurrMonthDays().endtime, // 结束时间
  240. targetName: '', // 调往对象
  241. state: undefined, // 业务状态
  242. allocateNo: '', // 调拨单号
  243. receiverSn: undefined, // 收货客户名称
  244. checkStatus: undefined, // 选中状态
  245. warehouseSn: undefined, // 调出仓库
  246. printState: 'NO_PRINT', // 打印状态
  247. subareaArea: {
  248. subareaSn: undefined, // 区域
  249. subareaAreaSn: undefined// 分区
  250. },
  251. shippingAddrProvinceSn: undefined, // 选中省份
  252. bizUserSn: undefined// 客服
  253. },
  254. currentTab: 2, // tabs默认值
  255. // 加载数据方法 必须为 Promise 对象
  256. loadData: parameter => {
  257. this.disabled = true
  258. this.spinning = true
  259. // 获取列表数据 有分页
  260. return allocateBillList(Object.assign(parameter, this.queryParam, { authWarehouseFlag: 1 })).then(res => {
  261. let data
  262. if (res.status == 200) {
  263. data = res.data
  264. // 计算表格序号
  265. const no = (data.pageNo - 1) * data.pageSize
  266. for (var i = 0; i < data.list.length; i++) {
  267. data.list[i].no = no + i + 1
  268. }
  269. this.disabled = false
  270. }
  271. this.spinning = false
  272. return data
  273. })
  274. },
  275. visibleAudit: false, // 审核弹窗
  276. openModal: false, // 打印弹框
  277. tipData: null// 操作提示回显数据
  278. }
  279. },
  280. computed: {
  281. // 表头
  282. columns () {
  283. const _this = this
  284. const arr = [
  285. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  286. { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  287. { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '8%' },
  288. { title: '调往对象', dataIndex: 'targetName', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
  289. { title: '发货编号', dataIndex: 'sendNo', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  290. { title: '发货说明', dataIndex: 'explainInfo', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  291. { title: '收货客户名称', dataIndex: 'receiverName', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
  292. { title: '总数量', dataIndex: 'totalQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  293. { title: '业务状态', dataIndex: 'stateDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  294. { title: '打印状态', scopedSlots: { customRender: 'printStatus' }, width: '5%', align: 'center' },
  295. { title: '允许打印时间', dataIndex: 'allowPrintTime', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  296. { title: '打印次数', dataIndex: 'printCount', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  297. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  298. ]
  299. if (this.isShowWarehouse) {
  300. arr.splice(4, 0, { title: '调出仓库', dataIndex: 'warehouseName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
  301. }
  302. if (this.$hasPermissions('M_transfersPrintList_salesPrice')) { // 售价权限
  303. arr.splice(9, 0, { slots: { title: 'costTitle' }, dataIndex: 'receiveTotalAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  304. arr.splice(10, 0, { title: '易损件售价', dataIndex: 'receiveYsjTotalAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  305. arr.splice(11, 0, { title: '电池售价', dataIndex: 'receiveDcTotalAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  306. arr.splice(12, 0, { title: '机油售价', dataIndex: 'receiveJyTotalAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  307. }
  308. return arr
  309. }
  310. },
  311. methods: {
  312. // 收货客户名称 change
  313. custChange (val) {
  314. if (val.row) {
  315. this.queryParam.receiverSn = val.row.dealerSn
  316. this.queryParam.receiverName = undefined
  317. } else {
  318. this.queryParam.receiverSn = undefined
  319. this.queryParam.receiverName = val.key
  320. }
  321. },
  322. // tabs事件
  323. changeTab (v) {
  324. this.currentTab = v
  325. this.resetSearchForm()
  326. },
  327. // 创建时间 change
  328. dateChange (date) {
  329. this.queryParam.beginDate = date[0]
  330. this.queryParam.endDate = date[1]
  331. },
  332. // 区域分区
  333. subareaChange (val) {
  334. this.queryParam.subareaArea = {
  335. subareaSn: val[0] ? val[0] : undefined,
  336. subareaAreaSn: val[1] ? val[1] : undefined
  337. }
  338. },
  339. // 重置
  340. resetSearchForm () {
  341. this.$refs.rangeDate.resetDate(this.time)
  342. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  343. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  344. this.queryParam.targetName = ''
  345. this.queryParam.state = undefined
  346. this.queryParam.allocateNo = ''
  347. this.queryParam.receiverName = ''
  348. this.queryParam.receiverSn = undefined
  349. this.queryParam.warehouseSn = undefined
  350. this.queryParam.bizUserSn = undefined
  351. this.queryParam.subareaArea.subareaSn = undefined
  352. this.queryParam.subareaArea.subareaAreaSn = undefined
  353. this.queryParam.shippingAddrProvinceSn = undefined
  354. this.$refs.receiverSn.resetForm()
  355. if (this.advanced) {
  356. this.$refs.subarea.clearData()
  357. }
  358. this.queryParam.printState = this.currentTab == 2 ? 'NO_PRINT' : undefined
  359. this.$refs.table.refresh(true)
  360. },
  361. // 分类打印
  362. handlePrint (row) {
  363. this.itemData = row
  364. this.openModal = true
  365. },
  366. // 打印记录
  367. handlePrintRecord (row) {
  368. this.showRecordModal = true
  369. this.$refs.recordModal.setData(row, {
  370. billType: 'ALLOCATE',
  371. billSn: row.allocateSn
  372. })
  373. },
  374. // 确定打印
  375. handleOk (objs) {
  376. const _this = this
  377. const params = JSON.parse(JSON.stringify(objs))
  378. delete params.type
  379. _this.$store.state.app.curActionPermission = 'B_transferOut_type_print'
  380. _this.spinning = true
  381. printBase64Fun(
  382. allocateBillDetailPrint,
  383. params,
  384. objs.isPreview ? 'preview' : 'print',
  385. '调拨分类',
  386. (res) => {
  387. _this.spinning = false
  388. _this.$store.state.app.curActionPermission = ''
  389. if (res && res.status == 200) {
  390. _this.$refs.table.refresh()
  391. _this.$message.info(res.message)
  392. }
  393. }, {
  394. billType: 'ALLOCATE',
  395. billSn: objs.allocateSn,
  396. billNo: objs.allocateNo,
  397. printType: '调拨分类打印'
  398. })
  399. },
  400. // 详情
  401. handleDetail (row) {
  402. this.$store.state.app.curActionPermission = 'M_transferOut_detail'
  403. this.bizSn = row.allocateSn
  404. this.showDetailModal = true
  405. },
  406. // 关闭详情弹窗
  407. cancelDetail () {
  408. this.showDetailModal = false
  409. this.$store.state.app.curActionPermission = ''
  410. this.bizSn = null
  411. },
  412. // 初始化
  413. pageInit () {
  414. const _this = this
  415. this.$nextTick(() => { // 页面渲染完成后的回调
  416. _this.setTableH()
  417. })
  418. this.openModal = false
  419. },
  420. // 计算表格高度
  421. setTableH () {
  422. const tableSearchH = this.$refs.tableSearch.offsetHeight
  423. this.tableHeight = window.innerHeight - tableSearchH - 266
  424. },
  425. // 状态打印弹窗
  426. editPrintStatus (item) {
  427. this.tipData = item
  428. this.$nextTick(() => {
  429. this.showPrintModal = true
  430. })
  431. },
  432. // 关闭操作提示弹窗
  433. canselModal () {
  434. this.showPrintModal = false
  435. this.resetSearchForm()
  436. },
  437. // 操作提示成功呢
  438. updatePrintStatus () {
  439. const _this = this
  440. _this.spinning = true
  441. const ajax_data = {
  442. allocateSn: _this.tipData.allocateSn,
  443. printState: 'UNABLE_PRINT'
  444. }
  445. updatePrintState(ajax_data).then(res => {
  446. if (res.status == 200) {
  447. _this.$message.success(res.message)
  448. _this.canselModal()
  449. }
  450. _this.spinning = false
  451. })
  452. }
  453. },
  454. watch: {
  455. // 展开关闭 监听表格高度变化
  456. advanced (newValue, oldValue) {
  457. const _this = this
  458. this.$nextTick(() => { // 页面渲染完成后的回调
  459. _this.setTableH()
  460. })
  461. },
  462. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  463. this.setTableH()
  464. }
  465. },
  466. mounted () {
  467. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  468. this.pageInit()
  469. this.resetSearchForm()
  470. }
  471. },
  472. activated () {
  473. // 如果是新页签打开,则重置当前页面
  474. if (this.$store.state.app.isNewTab) {
  475. this.pageInit()
  476. this.resetSearchForm()
  477. }
  478. // 仅刷新列表,不重置页面
  479. if (this.$store.state.app.updateList) {
  480. this.pageInit()
  481. this.$refs.table.refresh()
  482. }
  483. },
  484. beforeRouteEnter (to, from, next) {
  485. next(vm => {})
  486. }
  487. }
  488. </script>
  489. <style lang="less">
  490. .transfersPrintList-wrap{
  491. .ant-tabs-bar{
  492. margin: 0;
  493. }
  494. }
  495. </style>