list.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <a-card size="small" :bordered="false" class="allocateBillList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  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. <AllocateType id="allocateBillList-costTypeName" v-model="allocateTypeVal" :changeOnSelect="true" placeholder="请选择费用/调拨类型" @change="changeAllocatype"></AllocateType>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="收货客户名称">
  26. <dealerSearchList ref="receiverSn" @change="custChange" />
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="4" :sm="24">
  30. <a-form-item label="业务状态">
  31. <v-select
  32. v-model="queryParam.state"
  33. ref="state"
  34. id="allocateBillList-state"
  35. code="ALLOCATE_STATUS"
  36. placeholder="请选择业务状态"
  37. allowClear
  38. ></v-select>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="4" :sm="24">
  42. <a-form-item label="调拨单号">
  43. <a-input id="allocateBillList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="4" :sm="24">
  47. <a-form-item label="打印状态">
  48. <v-select
  49. v-model="queryParam.printState"
  50. ref="printState"
  51. id="allocateBillList-printState"
  52. code="PRINT_STATUS"
  53. placeholder="请选择打印状态"
  54. allowClear
  55. ></v-select>
  56. </a-form-item>
  57. </a-col>
  58. <a-col :md="4" :sm="24">
  59. <a-form-item label="对单状态">
  60. <v-select
  61. v-model="queryParam.checkStatus"
  62. ref="checkStatus"
  63. id="allocateBillList-checkStatus"
  64. code="CHECK_STATUS"
  65. placeholder="请选择对单状态"
  66. allowClear
  67. ></v-select>
  68. </a-form-item>
  69. </a-col>
  70. </template>
  71. <a-col :md="6" :sm="24">
  72. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="allocateBillList-refresh">查询</a-button>
  73. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocateBillList-reset">重置</a-button>
  74. <a-button
  75. style="margin-left: 5px"
  76. type="primary"
  77. class="button-warning"
  78. v-if="$hasPermissions('B_transferOut_export')"
  79. @click="handleExport"
  80. :disabled="disabled"
  81. :loading="exportLoading"
  82. id="allocateBillList-export">导出</a-button>
  83. <a @click="advanced=!advanced" style="margin-left: 5px">
  84. {{ advanced ? '收起' : '展开' }}
  85. <a-icon :type="advanced ? 'up' : 'down'"/>
  86. </a>
  87. </a-col>
  88. </a-row>
  89. </a-form>
  90. </div>
  91. <!-- 操作按钮 -->
  92. <div class="table-operator">
  93. <a-button v-if="$hasPermissions('B_transferOut_add')" id="allocateBillList-add" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  94. </div>
  95. <!-- 列表 -->
  96. <s-table
  97. class="sTable fixPagination"
  98. ref="table"
  99. :style="{ height: tableHeight+84.5+'px' }"
  100. size="small"
  101. :rowKey="(record) => record.id"
  102. :columns="columns"
  103. :data="loadData"
  104. :defaultLoadData="false"
  105. :scroll="{ y: tableHeight }"
  106. bordered>
  107. <!-- 单号 -->
  108. <template slot="allocateNo" slot-scope="text, record">
  109. <span v-if="$hasPermissions('M_transferOut_detail')" class="link-bule" @click="handleDetail(record)">{{ record.allocateNo }}</span>
  110. <span v-else>{{ record.allocateNo }}</span>
  111. </template>
  112. <!-- 起止时间 -->
  113. <template slot="promoDate" slot-scope="text, record">
  114. <span v-if="record.promoStartDate || record.promoEndDate">{{ record.promoStartDate }} ~ {{ record.promoEndDate }}</span>
  115. <span v-else>--</span>
  116. </template>
  117. <!-- 调拨类型 -->
  118. <template slot="allocateType" slot-scope="text, record">
  119. <div>
  120. <span v-if="record.allocateSortName">{{ record.allocateSortName }}</span>
  121. <span v-if="record.allocateSortName&&record.allocateTypeName">/</span>
  122. <span v-if="record.allocateTypeName">{{ record.allocateTypeName }}</span>
  123. </div>
  124. </template>
  125. <!-- 打印状态 -->
  126. <template slot="printStateWord" slot-scope="text, record">
  127. <span v-if="record.printState">
  128. <span v-if="record.printState=='NO_PRINT'||record.printState=='PRINT'">{{ record.printStateDictValue }}</span>
  129. <span @click="handlePrint(record)" class="link-bule" v-else>{{ record.printStateDictValue }}</span>
  130. </span>
  131. <span v-else>--</span>
  132. </template>
  133. <!-- 操作 -->
  134. <template slot="action" slot-scope="text, record">
  135. <!-- <a-button
  136. size="small"
  137. type="link"
  138. v-if="record.state == 'WAIT_AUDIT' && record.printState!='UNABLE_PRINT' && record.printState!='NO_PRINT' && $hasPermissions('B_tfo_yxPrint')"
  139. class="button-warning"
  140. @click="handleYxPrint(record)"
  141. id="allocateBillList-examine-btn">允许打印</a-button> -->
  142. <a-button
  143. size="small"
  144. type="link"
  145. v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_transferOut_audit')"
  146. class="button-warning"
  147. @click="handleExamine(record)"
  148. id="allocateBillList-examine-btn">审核</a-button>
  149. <a-button
  150. size="small"
  151. type="link"
  152. v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'AUDIT_REJECT')) && $hasPermissions('M_transferOut_edit')"
  153. class="button-info"
  154. @click="handleEdit(record)"
  155. id="allocateBillList-edit-btn">编辑</a-button>
  156. <a-button
  157. size="small"
  158. type="link"
  159. v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'AUDIT_REJECT')) && $hasPermissions('B_transferOut_del')"
  160. class="button-error"
  161. @click="handleDel(record)"
  162. id="allocateBillList-del-btn">删除</a-button>
  163. <span v-if="((record.state != 'WAIT_SUBMIT') && (record.state != 'WAIT_AUDIT') && (record.state != 'AUDIT_REJECT'))||(!$hasPermissions('B_transferOut_audit') && !$hasPermissions('M_transferOut_edit') && !$hasPermissions('B_transferOut_del'))">--</span>
  164. </template>
  165. </s-table>
  166. </a-spin>
  167. <!-- 新增 -->
  168. <basic-info-modal v-drag :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  169. <!-- 审核 -->
  170. <auditModal
  171. v-drag
  172. :openModal="visibleAudit"
  173. :spinning="spinningAudit"
  174. @close="visibleAudit=false"
  175. @ok="auditOrder('WAIT_OUT_WAREHOUSE')"
  176. @fail="auditOrder('AUDIT_REJECT')" />
  177. <!-- 打印状态 -->
  178. <printModal v-drag :show="printIsShow" :info="printInfo" @cancel="cancelModal"></printModal>
  179. </a-card>
  180. </template>
  181. <script>
  182. import { commonMixin } from '@/utils/mixin'
  183. import moment from 'moment'
  184. import getDate from '@/libs/getDate.js'
  185. import { STable, VSelect } from '@/components'
  186. import basicInfoModal from './basicInfoModal.vue'
  187. import rangeDate from '@/views/common/rangeDate.vue'
  188. import auditModal from '@/views/common/auditModal.vue'
  189. import dealerSearchList from '@/views/common/dealerSearchList.vue'
  190. import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport, allocateBillAblePrint } from '@/api/allocateBill'
  191. import AllocateType from '@/views/common/allocateType.js'
  192. import { hdExportExcel } from '@/libs/exportExcel'
  193. import printModal from './printStatusModal.vue'
  194. export default {
  195. name: 'TransferOutList',
  196. mixins: [commonMixin],
  197. components: { STable, VSelect, basicInfoModal, printModal, rangeDate, auditModal, AllocateType, dealerSearchList },
  198. data () {
  199. return {
  200. spinning: false,
  201. advanced: true, // 高级搜索 展开/关闭
  202. tableHeight: 0,
  203. time: [
  204. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  205. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  206. ],
  207. allocateTypeVal: [],
  208. queryParam: { // 查询条件
  209. beginDate: getDate.getThreeMonthDays().starttime,
  210. endDate: getDate.getCurrMonthDays().endtime,
  211. targetName: '', // 调往对象
  212. costTypeSn: undefined, // 费用类型
  213. allocateSortSn: undefined, // 调拨类型1
  214. allocateTypeSn: undefined, // 调拨类型2
  215. state: undefined, // 业务状态
  216. allocateNo: '', // 调拨单号
  217. receiverSn: undefined,
  218. checkStatus: undefined,
  219. printState: undefined
  220. },
  221. disabled: false, // 查询、重置按钮是否可操作
  222. exportLoading: false,
  223. printIsShow: false,
  224. // 加载数据方法 必须为 Promise 对象
  225. loadData: parameter => {
  226. this.disabled = true
  227. this.spinning = true
  228. return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
  229. let data
  230. if (res.status == 200) {
  231. data = res.data
  232. const no = (data.pageNo - 1) * data.pageSize
  233. for (var i = 0; i < data.list.length; i++) {
  234. data.list[i].no = no + i + 1
  235. }
  236. this.disabled = false
  237. }
  238. this.spinning = false
  239. return data
  240. })
  241. },
  242. visibleAudit: false,
  243. auditInfo: null,
  244. spinningAudit: false,
  245. openModal: false, // 新增编辑 弹框
  246. printInfo: null
  247. }
  248. },
  249. computed: {
  250. // dataIndex: 'printStateDictValue',
  251. columns () {
  252. const _this = this
  253. const arr = [
  254. { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
  255. { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  256. { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '13.5%' },
  257. { title: '起止时间', scopedSlots: { customRender: 'promoDate' }, align: 'center', width: '6%' },
  258. { title: '调往对象', dataIndex: 'targetName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  259. { title: '客户类型', dataIndex: 'dealerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  260. { title: '发货编号', dataIndex: 'sendNo', width: '6%', align: 'center', customRender: function (text) { return text || '--'} },
  261. { title: '发货说明', dataIndex: 'remarks', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  262. { title: '收货客户名称', dataIndex: 'receiverName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  263. { title: '总数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  264. // { title: '总售价', dataIndex: 'totalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  265. { title: '审核时间', dataIndex: 'auditTime', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  266. { title: '费用类型', dataIndex: 'costTypeName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  267. { title: '调拨类型', scopedSlots: { customRender: 'allocateType' }, width: '6%', align: 'center' },
  268. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  269. { title: '打印状态', scopedSlots: { customRender: 'printStateWord' }, width: '6%', align: 'center' },
  270. { title: '打印次数', dataIndex: 'printCount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  271. { title: '对单状态', dataIndex: 'checkStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  272. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  273. ]
  274. if (this.$hasPermissions('M_transferOutList_costPrice')) { // 成本价权限
  275. arr.splice(8, 0, { title: '总成本', dataIndex: 'totalCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  276. }
  277. if (this.$hasPermissions('M_transferOutList_salesPrice')) { // 售价权限
  278. const ind = this.$hasPermissions('M_transferOutList_costPrice') ? 10 : 9
  279. arr.splice(ind, 0, { title: '总售价', dataIndex: 'totalPrice', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  280. }
  281. return arr
  282. }
  283. },
  284. methods: {
  285. // 关闭打印状态弹窗
  286. cancelModal () {
  287. this.printIsShow = false
  288. this.$refs.table.refresh(true)
  289. },
  290. custChange (val) {
  291. if (val.row) {
  292. this.queryParam.receiverSn = val.row.dealerSn
  293. this.queryParam.receiverName = undefined
  294. } else {
  295. this.queryParam.receiverSn = undefined
  296. this.queryParam.receiverName = val.key
  297. }
  298. },
  299. // 创建时间 change
  300. dateChange (date) {
  301. this.queryParam.beginDate = date[0]
  302. this.queryParam.endDate = date[1]
  303. },
  304. changeAllocatype (val, opts) {
  305. this.allocateTypeVal = val || []
  306. this.queryParam.costTypeSn = val && val[0] ? val[0] : ''
  307. this.queryParam.allocateSortSn = val && val[1] ? val[1] : ''
  308. this.queryParam.allocateTypeSn = val && val[2] ? val[2] : ''
  309. },
  310. // 重置
  311. resetSearchForm () {
  312. this.$refs.rangeDate.resetDate(this.time)
  313. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  314. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  315. this.queryParam.targetName = ''
  316. this.queryParam.costTypeSn = undefined
  317. this.queryParam.allocateSortSn = undefined
  318. this.queryParam.allocateTypeSn = undefined
  319. this.queryParam.state = undefined
  320. this.queryParam.checkStatus = undefined
  321. this.queryParam.printState = undefined
  322. this.queryParam.allocateNo = ''
  323. this.queryParam.receiverSn = undefined
  324. this.allocateTypeVal = []
  325. this.$refs.receiverSn.resetForm()
  326. this.$refs.table.refresh(true)
  327. },
  328. // 基本信息 保存
  329. handleOk (data) {
  330. this.$router.push({ path: `/allocationManagement/transferOut/add/${data.allocateSn}/${data.dealerLevel}` })
  331. },
  332. // 删除
  333. handleDel (row) {
  334. const _this = this
  335. this.$confirm({
  336. title: '提示',
  337. content: '删除后不可恢复,确定要进行删除吗?',
  338. centered: true,
  339. onOk () {
  340. _this.spinning = true
  341. allocateBillDel({ sn: row.allocateSn }).then(res => {
  342. if (res.status == 200) {
  343. _this.$message.success(res.message)
  344. _this.$refs.table.refresh()
  345. _this.spinning = false
  346. } else {
  347. _this.spinning = false
  348. }
  349. })
  350. }
  351. })
  352. },
  353. // 允许打印
  354. handleYxPrint (row) {
  355. const _this = this
  356. this.$confirm({
  357. title: '提示',
  358. content: '确定要允许打印吗?',
  359. centered: true,
  360. onOk () {
  361. _this.spinning = true
  362. allocateBillAblePrint({ sn: row.allocateSn }).then(res => {
  363. if (res.status == 200) {
  364. _this.$message.success(res.message)
  365. _this.$refs.table.refresh()
  366. _this.spinning = false
  367. } else {
  368. _this.spinning = false
  369. }
  370. })
  371. }
  372. })
  373. },
  374. // 审核
  375. handleExamine (row) {
  376. this.auditInfo = row
  377. this.visibleAudit = true
  378. },
  379. // 审核
  380. auditOrder (state) {
  381. const _this = this
  382. _this.spinningAudit = true
  383. allocateBillAudit({ sn: this.auditInfo.allocateSn, state: state }).then(res => {
  384. if (res.status == 200) {
  385. _this.visibleAudit = false
  386. _this.$message.success(res.message)
  387. _this.$refs.table.refresh()
  388. _this.spinningAudit = false
  389. } else {
  390. _this.visibleAudit = false
  391. _this.spinningAudit = false
  392. }
  393. })
  394. },
  395. // 详情
  396. handleDetail (row) {
  397. if (this.$hasPermissions('M_transferOut_detail')) {
  398. this.$router.push({ path: `/allocationManagement/transferOut/detail/${row.allocateSn}` })
  399. }
  400. },
  401. // 编辑
  402. handleEdit (row) {
  403. this.$router.push({ path: `/allocationManagement/transferOut/edit/${row.allocateSn}/${row.dealerLevel}` })
  404. },
  405. // 导出
  406. handleExport () {
  407. const _this = this
  408. this.$store.state.app.curActionPermission = 'B_transferOut_export'
  409. const params = this.queryParam
  410. this.exportLoading = true
  411. this.spinning = true
  412. hdExportExcel(allocateBillExport, params, '调拨列表', function () {
  413. _this.exportLoading = false
  414. _this.spinning = false
  415. _this.$store.state.app.curActionPermission = ''
  416. })
  417. },
  418. pageInit () {
  419. const _this = this
  420. this.$nextTick(() => { // 页面渲染完成后的回调
  421. _this.setTableH()
  422. })
  423. this.openModal = false
  424. },
  425. setTableH () {
  426. const tableSearchH = this.$refs.tableSearch.offsetHeight
  427. this.tableHeight = window.innerHeight - tableSearchH - 238
  428. },
  429. handlePrint (item) {
  430. const obj = {
  431. no: item.allocateNo,
  432. targetName: item.targetName,
  433. allocateSn: item.allocateSn,
  434. printState: item.printState
  435. }
  436. this.printInfo = obj
  437. this.$nextTick(() => {
  438. this.printIsShow = true
  439. })
  440. }
  441. },
  442. watch: {
  443. advanced (newValue, oldValue) {
  444. const _this = this
  445. this.$nextTick(() => { // 页面渲染完成后的回调
  446. _this.setTableH()
  447. })
  448. },
  449. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  450. this.setTableH()
  451. }
  452. },
  453. mounted () {
  454. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  455. this.pageInit()
  456. this.resetSearchForm()
  457. }
  458. },
  459. activated () {
  460. // 如果是新页签打开,则重置当前页面
  461. if (this.$store.state.app.isNewTab) {
  462. this.pageInit()
  463. this.resetSearchForm()
  464. }
  465. // 仅刷新列表,不重置页面
  466. if (this.$store.state.app.updateList) {
  467. this.pageInit()
  468. this.$refs.table.refresh()
  469. }
  470. },
  471. beforeRouteEnter (to, from, next) {
  472. next(vm => {})
  473. }
  474. }
  475. </script>
  476. <style lang="less">
  477. .active{
  478. color: #ed1c24;
  479. cursor: pointer;
  480. }
  481. .common{
  482. color: rgba(0, 0, 0);
  483. }
  484. </style>