list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. 总售价:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? totalData.totalAmount : '--' }}</strong>元;
  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. </a-card>
  124. </template>
  125. <script>
  126. import moment from 'moment'
  127. import getDate from '@/libs/getDate.js'
  128. import subarea from '@/views/common/subarea.js'
  129. import { getArea } from '@/api/data'
  130. import rangeDate from '@/views/common/rangeDate.vue'
  131. import auditModal from '@/views/common/auditModal.vue'
  132. import { STable, VSelect } from '@/components'
  133. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  134. import { dispatchlList, dispatchQueryCount, dispatchStockUpAduit } from '@/api/dispatch'
  135. export default {
  136. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, auditModal, subarea },
  137. data () {
  138. return {
  139. spinning: false,
  140. advanced: false, // 高级搜索 展开/关闭
  141. tableHeight: 0,
  142. time: [
  143. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  144. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  145. ],
  146. queryParam: { // 查询条件
  147. beginDate: getDate.getThreeMonthDays().starttime,
  148. endDate: getDate.getCurrMonthDays().endtime,
  149. buyerSn: undefined, // 客户名称
  150. salesBillNo: '', // 销售单号
  151. dispatchBillNo: '', // 备货单号
  152. stockOutNo: '', // 出库单号
  153. printStatus: undefined, // 打印状态
  154. billStatus: undefined, // 业务状态
  155. subareaSn: undefined,
  156. shippingAddrProvinceSn: undefined
  157. },
  158. disabled: false, // 查询、重置按钮是否可操作
  159. columns: [
  160. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  161. { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '单据来源', dataIndex: 'salesBillEntity.salesBillSourceDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '销售单号', dataIndex: 'salesBillNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '12%', align: 'center' },
  165. { title: '出库单号', dataIndex: 'stockOutNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '客户名称', dataIndex: 'buyerName', width: '11%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  167. { title: '数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  168. { title: '售价', dataIndex: 'totalAmount', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  169. { title: '备货时间', dataIndex: 'stockUpDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  170. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  171. { title: '打印次数', dataIndex: 'stockUpPrintTimes', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  172. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  173. ],
  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. dispatchQueryCount(Object.assign(parameter, this.queryParam)).then(res => {
  187. this.totalData = Object.assign(this.totalData, res.data || {})
  188. })
  189. return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
  190. const data = res.data
  191. const no = (data.pageNo - 1) * data.pageSize
  192. for (var i = 0; i < data.list.length; i++) {
  193. data.list[i].no = no + i + 1
  194. }
  195. this.disabled = false
  196. this.spinning = false
  197. return data
  198. })
  199. },
  200. addrProvinceList: [], // 省下拉
  201. visibleAudit: false,
  202. auditInfo: null,
  203. spinningAudit: false
  204. }
  205. },
  206. methods: {
  207. custChange (val) {
  208. this.queryParam.buyerSn = val.key
  209. },
  210. // 时间 change
  211. dateChange (date) {
  212. this.queryParam.beginDate = date[0]
  213. this.queryParam.endDate = date[1]
  214. },
  215. // 重置
  216. resetSearchForm () {
  217. this.$refs.rangeDate.resetDate(this.time)
  218. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  219. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  220. this.queryParam.buyerSn = undefined
  221. this.$refs.dealerSubareaScopeList.resetForm()
  222. this.queryParam.salesBillNo = ''
  223. this.queryParam.dispatchBillNo = '' // 备货单号
  224. this.queryParam.stockOutNo = '' // 出库单号
  225. this.queryParam.billStatus = undefined
  226. this.queryParam.printStatus = undefined
  227. this.queryParam.subareaSn = undefined
  228. this.queryParam.shippingAddrProvinceSn = undefined
  229. this.$refs.table.refresh(true)
  230. },
  231. // 审核
  232. handleExamine (row) {
  233. this.auditInfo = row
  234. this.visibleAudit = true
  235. },
  236. auditOrder (billStatus) {
  237. this.spinningAudit = true
  238. dispatchStockUpAduit({
  239. dispatchBillSn: this.auditInfo.dispatchBillSn,
  240. billStatus: billStatus
  241. }).then(res => {
  242. if (res.status == 200) {
  243. this.visibleAudit = false
  244. this.$message.success(res.message)
  245. this.$refs.table.refresh()
  246. this.spinningAudit = false
  247. } else {
  248. this.visibleAudit = false
  249. this.spinningAudit = false
  250. }
  251. })
  252. },
  253. // 详情
  254. handleDetail (row) {
  255. this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'pushOrder' } })
  256. },
  257. // 省/市/区
  258. getArea (leve, sn) {
  259. let params
  260. if (leve == 'province') {
  261. params = { type: '2' }
  262. } else {
  263. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  264. }
  265. getArea(params).then(res => {
  266. if (res.status == 200) {
  267. if (leve == 'province') {
  268. this.addrProvinceList = res.data || []
  269. } else if (leve == 'city') {
  270. this.addrCityList = res.data || []
  271. } else if (leve == 'district') {
  272. this.addrDistrictList = res.data || []
  273. }
  274. } else {
  275. if (leve == 'province') {
  276. this.addrProvinceList = []
  277. } else if (leve == 'city') {
  278. this.addrCityList = []
  279. } else if (leve == 'district') {
  280. this.addrDistrictList = []
  281. }
  282. }
  283. })
  284. },
  285. pageInit () {
  286. const _this = this
  287. this.$nextTick(() => { // 页面渲染完成后的回调
  288. _this.setTableH()
  289. })
  290. this.getArea('province')
  291. },
  292. setTableH () {
  293. const tableSearchH = this.$refs.tableSearch.offsetHeight
  294. this.tableHeight = window.innerHeight - tableSearchH - 230
  295. }
  296. },
  297. watch: {
  298. advanced (newValue, oldValue) {
  299. const _this = this
  300. setTimeout(() => {
  301. _this.setTableH()
  302. }, 400)
  303. },
  304. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  305. this.setTableH()
  306. }
  307. },
  308. mounted () {
  309. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  310. this.pageInit()
  311. this.resetSearchForm()
  312. }
  313. },
  314. activated () {
  315. // 如果是新页签打开,则重置当前页面
  316. if (this.$store.state.app.isNewTab) {
  317. this.pageInit()
  318. this.resetSearchForm()
  319. }
  320. // 仅刷新列表,不重置页面
  321. if (this.$store.state.app.updateList) {
  322. this.pageInit()
  323. this.$refs.table.refresh()
  324. }
  325. },
  326. beforeRouteEnter (to, from, next) {
  327. next(vm => {})
  328. }
  329. }
  330. </script>