list.vue 18 KB

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