list.vue 15 KB

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