list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <a-card size="small" :bordered="false" class="examineVerifyList-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. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="examineVerifyList-buyerName" @change="custChange" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="销售单号">
  20. <a-input id="examineVerifyList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  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. <a-input id="examineVerifyList-stockOutNo" v-model.trim="queryParam.stockOutNo" allowClear placeholder="请输入出库单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="打印状态">
  31. <v-select
  32. v-model="queryParam.printStatus"
  33. ref="printStatus"
  34. id="examineVerifyList-printStatus"
  35. code="PRINT_STATUS"
  36. placeholder="请选择打印状态"
  37. allowClear></v-select>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="业务状态">
  42. <v-select
  43. v-model="queryParam.billStatus"
  44. ref="billStatus"
  45. id="examineVerifyList-billStatus"
  46. code="DISPATCH_BILL_STATUS"
  47. placeholder="请选择单据状态"
  48. allowClear></v-select>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24">
  52. <a-form-item label="备货单号">
  53. <a-input id="examineVerifyList-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-model-item label="所在区域">
  58. <subarea id="examineVerifyList-subarea" ref="subarea" @change="subareaChange"></subarea>
  59. </a-form-model-item>
  60. </a-col>
  61. <a-col :md="6" :sm="24">
  62. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  63. <Area id="examineVerifyList-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  64. </a-form-model-item>
  65. </a-col>
  66. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  67. <a-form-model-item label="仓库">
  68. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  69. </a-form-model-item>
  70. </a-col>
  71. </template>
  72. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  73. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="examineVerifyList-refresh">查询</a-button>
  74. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="examineVerifyList-reset">重置</a-button>
  75. <a @click="advanced=!advanced" style="margin-left: 5px">
  76. {{ advanced ? '收起' : '展开' }}
  77. <a-icon :type="advanced ? 'up' : 'down'"/>
  78. </a>
  79. </a-col>
  80. </a-row>
  81. </a-form>
  82. </div>
  83. <!-- alert -->
  84. <a-alert type="info" style="margin-bottom:10px">
  85. <div slot="message">
  86. <span v-if="$hasPermissions('M_examineVerifyList_salesPrice')">总售价:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? toThousands(totalData.totalAmount) : '--' }}</strong>;</span>
  87. 总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
  88. 总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
  89. 总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
  90. </div>
  91. </a-alert>
  92. <!-- 列表 -->
  93. <s-table
  94. class="sTable fixPagination"
  95. ref="table"
  96. :style="{ height: tableHeight+84.5+'px' }"
  97. size="small"
  98. :rowKey="(record) => record.id"
  99. :columns="columns"
  100. :data="loadData"
  101. :scroll="{ y:tableHeight }"
  102. :defaultLoadData="false"
  103. bordered>
  104. <!-- 销售单号 -->
  105. <template slot="salesBillNo" slot-scope="text, record">
  106. <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  107. <span v-else>{{ record.salesBillNo }}</span>
  108. </template>
  109. <!-- 备货单号 -->
  110. <template slot="dispatchBillNo" slot-scope="text, record">
  111. <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  112. <span v-else>{{ record.dispatchBillNo }}</span>
  113. </template>
  114. <!-- 操作 -->
  115. <template slot="action" slot-scope="text, record">
  116. <a-button
  117. size="small"
  118. type="link"
  119. class="button-info"
  120. v-if="record.billStatus=='WAIT_STOCK_UP_AUDIT'&&$hasPermissions('B_dispatchAduit')"
  121. @click="handleExamine(record)"
  122. id="examineVerifyList-examine-btn">备货审核</a-button>
  123. <span v-else>--</span>
  124. </template>
  125. </s-table>
  126. </a-spin>
  127. <!-- 审核 -->
  128. <auditModal
  129. v-drag
  130. :openModal="visibleAudit"
  131. :spinning="spinningAudit"
  132. @close="visibleAudit=false"
  133. @ok="auditOrder('OUTING_WAREHOUSE')"
  134. @fail="auditOrder('STOCK_UP_REJECT')" />
  135. <auditRejectModal
  136. v-drag
  137. :openModal="visibleAuditReject"
  138. :spinning="spinningAuditReject"
  139. :itemData="auditInfo"
  140. @close="visibleAuditReject=false"
  141. @ok="auditReject" />
  142. <!-- 查看销售单或备货单详情 -->
  143. <commonModal
  144. :modalTit="detailType?'备货单详情':'销售单详情'"
  145. bodyPadding="10px"
  146. width="70%"
  147. :showFooter="false"
  148. :openModal="showDetailModal"
  149. @cancel="cancelDetail">
  150. <salesDetail v-if="detailType==0" ref="salesDetail" :bizSn="bizSn"></salesDetail>
  151. <dispatchDetail v-if="detailType==1" ref="dispatchDetail" :bizSn="bizSn"></dispatchDetail>
  152. </commonModal>
  153. </a-card>
  154. </template>
  155. <script>
  156. import { commonMixin } from '@/utils/mixin'
  157. import moment from 'moment'
  158. import commonModal from '@/views/common/commonModal.vue'
  159. import salesDetail from '@/views/salesManagement/salesQuery/detail.vue'
  160. import dispatchDetail from '@/views/salesManagement/pushOrderManagement/detail.vue'
  161. import getDate from '@/libs/getDate.js'
  162. import subarea from '@/views/common/subarea.js'
  163. import Area from '@/views/common/area.js'
  164. import rangeDate from '@/views/common/rangeDate.vue'
  165. import auditModal from '@/views/common/auditModal.vue'
  166. import { STable, VSelect } from '@/components'
  167. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  168. import auditRejectModal from './auditRejectModal.vue'
  169. import chooseWarehouse from '@/views/common/chooseWarehouse'
  170. import { dispatchlBhshList, dispatchQueryBhshCount, dispatchStockUpAduit } from '@/api/dispatch'
  171. export default {
  172. name: 'ExamineVerifyList',
  173. mixins: [commonMixin],
  174. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, commonModal, salesDetail, dispatchDetail, auditModal, subarea, auditRejectModal, Area, chooseWarehouse },
  175. data () {
  176. return {
  177. spinning: false,
  178. advanced: true, // 高级搜索 展开/关闭
  179. tableHeight: 0,
  180. showDetailModal: false,
  181. detailType: 2,
  182. bizSn: null,
  183. time: [
  184. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  185. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  186. ],
  187. queryParam: { // 查询条件
  188. beginDate: getDate.getThreeMonthDays().starttime,
  189. endDate: getDate.getCurrMonthDays().endtime,
  190. buyerSn: undefined, // 客户名称
  191. salesBillNo: '', // 销售单号
  192. dispatchBillNo: '', // 备货单号
  193. stockOutNo: '', // 出库单号
  194. printStatus: undefined, // 打印状态
  195. billStatus: undefined, // 业务状态
  196. subareaArea: {
  197. subareaSn: undefined,
  198. subareaAreaSn: undefined
  199. },
  200. shippingAddrProvinceSn: undefined,
  201. warehouseSn: undefined
  202. },
  203. disabled: false, // 查询、重置按钮是否可操作
  204. selectedRowKeys: [], // Check here to configure the default column
  205. loading: false,
  206. totalData: {
  207. totalAmount: 0,
  208. totalQty: 0,
  209. totalRecord: 0
  210. },
  211. // 加载数据方法 必须为 Promise 对象
  212. loadData: parameter => {
  213. this.disabled = true
  214. this.spinning = true
  215. // 查询总计
  216. dispatchQueryBhshCount(Object.assign(parameter, this.queryParam)).then(res => {
  217. this.totalData = Object.assign(this.totalData, res.data || {})
  218. })
  219. return dispatchlBhshList(Object.assign(parameter, this.queryParam)).then(res => {
  220. let data
  221. if (res.status == 200) {
  222. data = res.data
  223. const no = (data.pageNo - 1) * data.pageSize
  224. for (var i = 0; i < data.list.length; i++) {
  225. data.list[i].no = no + i + 1
  226. }
  227. this.disabled = false
  228. }
  229. this.spinning = false
  230. return data
  231. })
  232. },
  233. visibleAudit: false,
  234. visibleAuditReject: false,
  235. auditInfo: null,
  236. spinningAudit: false,
  237. spinningAuditReject: false
  238. }
  239. },
  240. computed: {
  241. isShowWarehouse () {
  242. return this.$store.state.app.isWarehouse
  243. },
  244. columns () {
  245. const arr = [
  246. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  247. { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  248. { title: '单据来源', dataIndex: 'salesBillEntity.salesBillSourceDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  249. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '10%', align: 'center' },
  250. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '10%', align: 'center' },
  251. { title: '出库单号', dataIndex: 'stockOutNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  252. { title: '客户名称', dataIndex: 'buyerName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  253. { title: '数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  254. // { title: '售价', dataIndex: 'totalAmount', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  255. { title: '备货时间', dataIndex: 'stockUpDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  256. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  257. { title: '打印次数', dataIndex: 'stockUpPrintTimes', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  258. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  259. ]
  260. // 仓库管理权限设置是否显示 (当客户有且只有一条仓库管理权限时,不显示仓库信息)
  261. if (this.isShowWarehouse) {
  262. arr.splice(7, 0, { title: '仓库', dataIndex: 'warehouseName', width: '7%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  263. }
  264. if (this.$hasPermissions('M_examineVerifyList_salesPrice')) { // 售价权限
  265. arr.splice(this.isShowWarehouse ? 9 : 8, 0, { title: '售价', dataIndex: 'totalAmount', width: '5%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  266. }
  267. return arr
  268. }
  269. },
  270. methods: {
  271. custChange (val) {
  272. this.queryParam.buyerSn = val.key
  273. },
  274. // 时间 change
  275. dateChange (date) {
  276. this.queryParam.beginDate = date[0]
  277. this.queryParam.endDate = date[1]
  278. },
  279. subareaChange (val) {
  280. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  281. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  282. },
  283. // 重置
  284. resetSearchForm () {
  285. this.$refs.rangeDate.resetDate(this.time)
  286. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  287. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  288. this.queryParam.buyerSn = undefined
  289. this.$refs.dealerSubareaScopeList.resetForm()
  290. this.queryParam.salesBillNo = ''
  291. this.queryParam.dispatchBillNo = '' //备货单号
  292. this.queryParam.stockOutNo = '' // 出库单号
  293. this.queryParam.billStatus = undefined
  294. this.queryParam.printStatus = undefined
  295. this.queryParam.subareaArea.subareaSn = undefined
  296. this.queryParam.subareaArea.subareaAreaSn = undefined
  297. this.queryParam.warehouseSn = undefined
  298. if (this.advanced) {
  299. this.$refs.subarea.clearData()
  300. }
  301. this.$refs.table.refresh(true)
  302. },
  303. // 审核
  304. handleExamine (row) {
  305. this.auditInfo = row
  306. this.visibleAudit = true
  307. },
  308. auditOrder (billStatus) {
  309. if (billStatus == 'STOCK_UP_REJECT') { // 审核不通过
  310. // 已对单
  311. if (this.auditInfo.checkStatus == 'PASS') {
  312. this.$info({
  313. title: '操作提示',
  314. content: '此备货单已经对单通过,不能操作备货审核不通过。'
  315. })
  316. } else {
  317. this.visibleAuditReject = true
  318. }
  319. } else {
  320. const params = {
  321. dispatchBillSn: this.auditInfo.dispatchBillSn,
  322. billStatus: billStatus
  323. }
  324. this.auditFun(params)
  325. }
  326. },
  327. auditFun (params) {
  328. this.spinningAudit = true
  329. this.spinningAuditReject = true
  330. dispatchStockUpAduit(params).then(res => {
  331. if (res.status == 200) {
  332. this.visibleAudit = false
  333. this.visibleAuditReject = false
  334. this.$message.success(res.message)
  335. this.$refs.table.refresh()
  336. this.spinningAudit = false
  337. this.spinningAuditReject = false
  338. } else {
  339. this.visibleAudit = false
  340. this.visibleAuditReject = false
  341. this.spinningAudit = false
  342. this.spinningAuditReject = false
  343. }
  344. })
  345. },
  346. // 审核不通过 提交
  347. auditReject (remarks) {
  348. const params = {
  349. dispatchBillSn: this.auditInfo.dispatchBillSn,
  350. billStatus: 'STOCK_UP_REJECT',
  351. remarks: remarks
  352. }
  353. this.auditFun(params)
  354. },
  355. // 详情
  356. handleDetail (row, type) {
  357. this.detailType = type
  358. this.bizSn = type == 0 ? row.salesBillSn : row.dispatchBillSn
  359. this.$store.state.app.curActionPermission = type == 0 ? 'B_salesDetail' : 'B_dispatchDetail'
  360. this.showDetailModal = true
  361. },
  362. cancelDetail () {
  363. this.showDetailModal = false
  364. this.detailType = 2
  365. this.bizSn = null
  366. this.$store.state.app.curActionPermission = ''
  367. },
  368. pageInit () {
  369. const _this = this
  370. this.$nextTick(() => { // 页面渲染完成后的回调
  371. _this.setTableH()
  372. })
  373. },
  374. setTableH () {
  375. const tableSearchH = this.$refs.tableSearch.offsetHeight
  376. this.tableHeight = window.innerHeight - tableSearchH - 240
  377. }
  378. },
  379. watch: {
  380. advanced (newValue, oldValue) {
  381. const _this = this
  382. this.$nextTick(() => { // 页面渲染完成后的回调
  383. _this.setTableH()
  384. })
  385. },
  386. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  387. this.setTableH()
  388. }
  389. },
  390. mounted () {
  391. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  392. this.pageInit()
  393. this.resetSearchForm()
  394. }
  395. },
  396. activated () {
  397. // 如果是新页签打开,则重置当前页面
  398. if (this.$store.state.app.isNewTab) {
  399. this.pageInit()
  400. this.resetSearchForm()
  401. }
  402. // 仅刷新列表,不重置页面
  403. if (this.$store.state.app.updateList) {
  404. this.pageInit()
  405. this.$refs.table.refresh()
  406. }
  407. },
  408. beforeRouteEnter (to, from, next) {
  409. next(vm => {})
  410. }
  411. }
  412. </script>