list.vue 15 KB

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