list.vue 17 KB

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