list.vue 17 KB

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