list.vue 17 KB

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