list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. <dealerSubareaScopeList ref="receiverSn" defValKey="buyerSn" @change="custChange" v-model="queryParam.receiverSn" />
  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="action" slot-scope="text, record">
  127. <a-button
  128. size="small"
  129. type="link"
  130. v-if="record.state == 'WAIT_AUDIT'&&record.printState=='UNABLE_PRINT' && $hasPermissions('B_tfo_yxPrint')"
  131. class="button-warning"
  132. @click="handleYxPrint(record)"
  133. id="allocateBillList-examine-btn">允许打印</a-button>
  134. <a-button
  135. size="small"
  136. type="link"
  137. v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_transferOut_audit')"
  138. class="button-warning"
  139. @click="handleExamine(record)"
  140. id="allocateBillList-examine-btn">审核</a-button>
  141. <a-button
  142. size="small"
  143. type="link"
  144. v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'AUDIT_REJECT')) && $hasPermissions('M_transferOut_edit')"
  145. class="button-info"
  146. @click="handleEdit(record)"
  147. id="allocateBillList-edit-btn">编辑</a-button>
  148. <a-button
  149. size="small"
  150. type="link"
  151. v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'AUDIT_REJECT')) && $hasPermissions('B_transferOut_del')"
  152. class="button-error"
  153. @click="handleDel(record)"
  154. id="allocateBillList-del-btn">删除</a-button>
  155. <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>
  156. </template>
  157. </s-table>
  158. </a-spin>
  159. <!-- 新增 -->
  160. <basic-info-modal v-drag :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  161. <!-- 审核 -->
  162. <auditModal
  163. v-drag
  164. :openModal="visibleAudit"
  165. :spinning="spinningAudit"
  166. @close="visibleAudit=false"
  167. @ok="auditOrder('WAIT_OUT_WAREHOUSE')"
  168. @fail="auditOrder('AUDIT_REJECT')" />
  169. </a-card>
  170. </template>
  171. <script>
  172. import { commonMixin } from '@/utils/mixin'
  173. import moment from 'moment'
  174. import getDate from '@/libs/getDate.js'
  175. import { STable, VSelect } from '@/components'
  176. import basicInfoModal from './basicInfoModal.vue'
  177. import rangeDate from '@/views/common/rangeDate.vue'
  178. import auditModal from '@/views/common/auditModal.vue'
  179. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  180. import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport, allocateBillAblePrint } from '@/api/allocateBill'
  181. import AllocateType from '@/views/common/allocateType.js'
  182. import { hdExportExcel } from '@/libs/exportExcel'
  183. export default {
  184. name: 'TransferOutList',
  185. mixins: [commonMixin],
  186. components: { STable, VSelect, basicInfoModal, rangeDate, auditModal, AllocateType, dealerSubareaScopeList },
  187. data () {
  188. return {
  189. spinning: false,
  190. advanced: true, // 高级搜索 展开/关闭
  191. tableHeight: 0,
  192. time: [
  193. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  194. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  195. ],
  196. allocateTypeVal: [],
  197. queryParam: { // 查询条件
  198. beginDate: getDate.getThreeMonthDays().starttime,
  199. endDate: getDate.getCurrMonthDays().endtime,
  200. targetName: '', // 调往对象
  201. costTypeSn: undefined, // 费用类型
  202. allocateSortSn: undefined, // 调拨类型1
  203. allocateTypeSn: undefined, // 调拨类型2
  204. state: undefined, // 业务状态
  205. allocateNo: '', // 调拨单号
  206. receiverSn: undefined,
  207. checkStatus: undefined,
  208. printState: undefined
  209. },
  210. disabled: false, // 查询、重置按钮是否可操作
  211. exportLoading: false,
  212. // 加载数据方法 必须为 Promise 对象
  213. loadData: parameter => {
  214. this.disabled = true
  215. this.spinning = true
  216. return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
  217. let data
  218. if (res.status == 200) {
  219. data = res.data
  220. const no = (data.pageNo - 1) * data.pageSize
  221. for (var i = 0; i < data.list.length; i++) {
  222. data.list[i].no = no + i + 1
  223. }
  224. this.disabled = false
  225. }
  226. this.spinning = false
  227. return data
  228. })
  229. },
  230. visibleAudit: false,
  231. auditInfo: null,
  232. spinningAudit: false,
  233. openModal: false // 新增编辑 弹框
  234. }
  235. },
  236. computed: {
  237. columns () {
  238. const arr = [
  239. { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
  240. { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  241. { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '13.5%' },
  242. { title: '起止时间', scopedSlots: { customRender: 'promoDate' }, align: 'center', width: '6%' },
  243. { title: '调往对象', dataIndex: 'targetName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  244. { title: '客户类型', dataIndex: 'dealerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  245. { title: '发货编号', dataIndex: 'sendNo', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  246. { title: '收货客户名称', dataIndex: 'receiverName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  247. { title: '总数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  248. // { title: '总售价', dataIndex: 'totalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  249. { title: '审核时间', dataIndex: 'auditTime', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  250. { title: '费用类型', dataIndex: 'costTypeName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  251. { title: '调拨类型', scopedSlots: { customRender: 'allocateType' }, width: '6%', align: 'center' },
  252. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  253. { title: '打印状态', dataIndex: 'printStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  254. { title: '打印次数', dataIndex: 'printCount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  255. { title: '对单状态', dataIndex: 'checkStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  256. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  257. ]
  258. if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
  259. arr.splice(8, 0, { title: '总成本', dataIndex: 'totalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  260. }
  261. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  262. const ind = this.$hasPermissions('B_isShowCost') ? 10 : 9
  263. arr.splice(ind, 0, { title: '总售价', dataIndex: 'totalPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  264. }
  265. return arr
  266. }
  267. },
  268. methods: {
  269. custChange (val) {
  270. this.queryParam.receiverSn = val.key || ''
  271. // this.queryParam.receiverName = val.name || ''
  272. },
  273. // 创建时间 change
  274. dateChange (date) {
  275. this.queryParam.beginDate = date[0]
  276. this.queryParam.endDate = date[1]
  277. },
  278. changeAllocatype (val, opts) {
  279. this.allocateTypeVal = val || []
  280. this.queryParam.costTypeSn = val && val[0] ? val[0] : ''
  281. this.queryParam.allocateSortSn = val && val[1] ? val[1] : ''
  282. this.queryParam.allocateTypeSn = val && val[2] ? val[2] : ''
  283. },
  284. // 重置
  285. resetSearchForm () {
  286. this.$refs.rangeDate.resetDate(this.time)
  287. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  288. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  289. this.queryParam.targetName = ''
  290. this.queryParam.costTypeSn = undefined
  291. this.queryParam.allocateSortSn = undefined
  292. this.queryParam.allocateTypeSn = undefined
  293. this.queryParam.state = undefined
  294. this.queryParam.checkStatus = undefined
  295. this.queryParam.printState = undefined
  296. this.queryParam.allocateNo = ''
  297. this.queryParam.receiverSn = undefined
  298. this.allocateTypeVal = []
  299. this.$refs.receiverSn.resetForm()
  300. this.$refs.table.refresh(true)
  301. },
  302. // 基本信息 保存
  303. handleOk (data) {
  304. this.$router.push({ path: `/allocationManagement/transferOut/add/${data.allocateSn}/${data.dealerLevel}` })
  305. },
  306. // 删除
  307. handleDel (row) {
  308. const _this = this
  309. this.$confirm({
  310. title: '提示',
  311. content: '删除后不可恢复,确定要进行删除吗?',
  312. centered: true,
  313. onOk () {
  314. _this.spinning = true
  315. allocateBillDel({ sn: row.allocateSn }).then(res => {
  316. if (res.status == 200) {
  317. _this.$message.success(res.message)
  318. _this.$refs.table.refresh()
  319. _this.spinning = false
  320. } else {
  321. _this.spinning = false
  322. }
  323. })
  324. }
  325. })
  326. },
  327. // 允许打印
  328. handleYxPrint (row) {
  329. const _this = this
  330. this.$confirm({
  331. title: '提示',
  332. content: '确定要允许打印吗?',
  333. centered: true,
  334. onOk () {
  335. _this.spinning = true
  336. allocateBillAblePrint({ sn: row.allocateSn }).then(res => {
  337. if (res.status == 200) {
  338. _this.$message.success(res.message)
  339. _this.$refs.table.refresh()
  340. _this.spinning = false
  341. } else {
  342. _this.spinning = false
  343. }
  344. })
  345. }
  346. })
  347. },
  348. // 审核
  349. handleExamine (row) {
  350. this.auditInfo = row
  351. this.visibleAudit = true
  352. },
  353. // 审核
  354. auditOrder (state) {
  355. const _this = this
  356. _this.spinningAudit = true
  357. allocateBillAudit({ sn: this.auditInfo.allocateSn, state: state }).then(res => {
  358. if (res.status == 200) {
  359. _this.visibleAudit = false
  360. _this.$message.success(res.message)
  361. _this.$refs.table.refresh()
  362. _this.spinningAudit = false
  363. } else {
  364. _this.visibleAudit = false
  365. _this.spinningAudit = false
  366. }
  367. })
  368. },
  369. // 详情
  370. handleDetail (row) {
  371. if (this.$hasPermissions('M_transferOut_detail')) {
  372. this.$router.push({ path: `/allocationManagement/transferOut/detail/${row.allocateSn}` })
  373. }
  374. },
  375. // 编辑
  376. handleEdit (row) {
  377. this.$router.push({ path: `/allocationManagement/transferOut/edit/${row.allocateSn}/${row.dealerLevel}` })
  378. },
  379. // 导出
  380. handleExport () {
  381. const _this = this
  382. const params = this.queryParam
  383. this.exportLoading = true
  384. this.spinning = true
  385. hdExportExcel(allocateBillExport, params, '调拨列表', function () {
  386. _this.exportLoading = false
  387. _this.spinning = false
  388. })
  389. },
  390. pageInit () {
  391. const _this = this
  392. this.$nextTick(() => { // 页面渲染完成后的回调
  393. _this.setTableH()
  394. })
  395. this.openModal = false
  396. },
  397. setTableH () {
  398. const tableSearchH = this.$refs.tableSearch.offsetHeight
  399. this.tableHeight = window.innerHeight - tableSearchH - 238
  400. }
  401. },
  402. watch: {
  403. advanced (newValue, oldValue) {
  404. const _this = this
  405. this.$nextTick(() => { // 页面渲染完成后的回调
  406. _this.setTableH()
  407. })
  408. },
  409. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  410. this.setTableH()
  411. }
  412. },
  413. mounted () {
  414. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  415. this.pageInit()
  416. this.resetSearchForm()
  417. }
  418. },
  419. activated () {
  420. // 如果是新页签打开,则重置当前页面
  421. if (this.$store.state.app.isNewTab) {
  422. this.pageInit()
  423. this.resetSearchForm()
  424. }
  425. // 仅刷新列表,不重置页面
  426. if (this.$store.state.app.updateList) {
  427. this.pageInit()
  428. this.$refs.table.refresh()
  429. }
  430. },
  431. beforeRouteEnter (to, from, next) {
  432. next(vm => {})
  433. }
  434. }
  435. </script>
  436. <style lang="less">
  437. .active{
  438. color: #ed1c24;
  439. cursor: pointer;
  440. }
  441. .common{
  442. color: rgba(0, 0, 0);
  443. }
  444. </style>