list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <div class="matchSoo-wrap">
  3. <a-card style="margin-top: 5px;" size="small" :bordered="false">
  4. <a-spin :spinning="spinning" tip="Loading...">
  5. <!-- 搜索条件 -->
  6. <div ref="tableSearch" class="table-page-search-wrapper">
  7. <a-form layout="inline">
  8. <a-row :gutter="15">
  9. <a-col :md="6" :sm="24">
  10. <a-form-item label="创建时间">
  11. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  12. </a-form-item>
  13. </a-col>
  14. <a-col :md="6" :sm="24">
  15. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  16. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="matchSoo-buyerName" @change="custChange" />
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="销售单号">
  21. <a-input id="matchSoo-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="备货单号">
  26. <a-input id="matchSoo-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <template v-if="advanced">
  30. <a-col :md="6" :sm="24">
  31. <a-form-item label="收货客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  32. <dealerSubareaScopeList ref="shbuyerName" id="matchSoo-shbuyerName" @change="shcustChange" />
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="6" :sm="24">
  36. <a-form-item label="业务状态">
  37. <v-select
  38. v-model="queryParam.billStatus"
  39. ref="billStatus"
  40. id="matchSoo-billStatus"
  41. code="DISPATCH_BILL_STATUS"
  42. placeholder="请选择业务状态"
  43. allowClear></v-select>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="6" :sm="24">
  47. <a-form-item label="单据状态">
  48. <v-select
  49. v-model="queryParam.voidFlag"
  50. ref="voidFlag"
  51. id="pushOrder-voidFlag"
  52. code="VOID_FLAG"
  53. placeholder="请选择单据状态"
  54. allowClear></v-select>
  55. </a-form-item>
  56. </a-col>
  57. <a-col :md="6" :sm="24">
  58. <a-form-item label="对单状态">
  59. <v-select
  60. v-model="queryParam.checkStatus"
  61. ref="checkStatus"
  62. id="matchSoo-checkStatus"
  63. code="CHECK_STATUS"
  64. placeholder="请选择对单状态"
  65. allowClear></v-select>
  66. </a-form-item>
  67. </a-col>
  68. <a-col :md="6" :sm="24">
  69. <a-form-item label="对单时间">
  70. <rangeDate ref="checkDate" :value="checktime" @change="checkDateChange" />
  71. </a-form-item>
  72. </a-col>
  73. <a-col :md="6" :sm="24">
  74. <a-form-model-item label="所在区域">
  75. <subarea id="matchSoo-subarea" ref="subarea" @change="subareaChange"></subarea>
  76. </a-form-model-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  80. <Area id="matchSoo-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  81. </a-form-model-item>
  82. </a-col>
  83. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  84. <a-form-model-item label="仓库">
  85. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  86. </a-form-model-item>
  87. </a-col>
  88. </template>
  89. <a-col :md="24" :sm="24">
  90. <div class="table-page-search-submitButtons" style="text-align:center;">
  91. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  92. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  93. <a @click="advanced=!advanced" style="margin-left: 8px">
  94. {{ advanced ? '收起' : '展开' }}
  95. <a-icon :type="advanced ? 'up' : 'down'"/>
  96. </a>
  97. </div>
  98. </a-col>
  99. </a-row>
  100. </a-form>
  101. </div>
  102. <!-- 列表 -->
  103. <s-table
  104. class="sTable fixPagination"
  105. ref="table"
  106. :style="{ height: tableHeight+84.5+'px' }"
  107. size="small"
  108. :rowKey="(record) => record.id"
  109. :columns="columns"
  110. :data="loadData"
  111. :scroll="{ y:tableHeight }"
  112. :defaultLoadData="false"
  113. bordered>
  114. <!-- 销售单号 -->
  115. <template slot="salesBillNo" slot-scope="text, record">
  116. <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  117. <span v-else>{{ record.salesBillNo }}</span>
  118. </template>
  119. <!-- 备货单号 -->
  120. <template slot="dispatchBillNo" slot-scope="text, record">
  121. <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  122. <span v-else>{{ record.dispatchBillNo }}</span>
  123. </template>
  124. <!-- 操作 -->
  125. <template slot="action" slot-scope="text, record">
  126. <a-button
  127. size="small"
  128. type="link"
  129. class="button-warning"
  130. v-if="record.checkStatus =='WAIT'&&record.voidFlag==0&&$hasPermissions('B_DDAudit')"
  131. @click="handleAudit(record)"
  132. >对单通过</a-button>
  133. <span v-else>--</span>
  134. </template>
  135. </s-table>
  136. </a-spin>
  137. </a-card>
  138. <!-- 查看销售单或备货单详情 -->
  139. <commonModal
  140. :modalTit="detailType?'备货单详情':'销售单详情'"
  141. bodyPadding="10px"
  142. width="70%"
  143. :showFooter="false"
  144. :openModal="showDetailModal"
  145. @cancel="cancelDetail">
  146. <salesDetail v-if="detailType==0" ref="salesDetail" :bizSn="bizSn"></salesDetail>
  147. <dispatchDetail v-if="detailType==1" ref="dispatchDetail" :bizSn="bizSn"></dispatchDetail>
  148. </commonModal>
  149. </div>
  150. </template>
  151. <script>
  152. import { commonMixin } from '@/utils/mixin'
  153. import rangeDate from '@/views/common/rangeDate.vue'
  154. import { STable, VSelect } from '@/components'
  155. import subarea from '@/views/common/subarea.js'
  156. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  157. import Area from '@/views/common/area.js'
  158. import { dispatchlList, dispatchCheck } from '@/api/dispatch'
  159. import commonModal from '@/views/common/commonModal.vue'
  160. import salesDetail from '@/views/salesManagement/salesQuery/detail.vue'
  161. import chooseWarehouse from '@/views/common/chooseWarehouse'
  162. import dispatchDetail from '@/views/salesManagement/pushOrderManagement/detail.vue'
  163. export default {
  164. name: 'MatchSendOutOrderList',
  165. mixins: [commonMixin],
  166. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, Area, commonModal, salesDetail, dispatchDetail, chooseWarehouse },
  167. data () {
  168. return {
  169. spinning: false,
  170. advanced: true, // 高级搜索 展开/关闭
  171. disabled: false, // 查询、重置按钮是否可操作
  172. showDetailModal: false,
  173. detailType: 2,
  174. bizSn: null,
  175. tableHeight: 0,
  176. time: [],
  177. checktime: [],
  178. // 查询参数
  179. queryParam: {
  180. beginDate: '',
  181. endDate: '',
  182. checkBeginDate: '',
  183. checkEndDate: '',
  184. buyerSn: undefined, // 客户名称
  185. receiverSn: undefined, // 收货客户
  186. salesBillNo: '', // 销售单号
  187. dispatchBillNo: '', // 备货单号
  188. billStatus: undefined, // 业务状态
  189. subareaArea: {
  190. subareaSn: undefined,
  191. subareaAreaSn: undefined
  192. },
  193. voidFlag: undefined,
  194. shippingAddrProvinceSn: undefined,
  195. checkStatus: undefined,
  196. warehouseSn: undefined
  197. },
  198. // 加载数据方法 必须为 Promise 对象
  199. loadData: parameter => {
  200. this.disabled = true
  201. this.spinning = true
  202. return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
  203. let data
  204. if (res.status == 200) {
  205. data = res.data
  206. const no = (data.pageNo - 1) * data.pageSize
  207. for (var i = 0; i < data.list.length; i++) {
  208. data.list[i].no = no + i + 1
  209. }
  210. this.disabled = false
  211. }
  212. this.spinning = false
  213. return data
  214. })
  215. }
  216. }
  217. },
  218. computed: {
  219. columns () {
  220. const arr = [
  221. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  222. { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  223. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '10%', align: 'center' },
  224. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '14%', align: 'center' },
  225. { title: '发货编号', dataIndex: 'sendNo', width: '6%', align: 'center' },
  226. { title: '客户名称', dataIndex: 'buyerName', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  227. // { title: '仓库', dataIndex: 'warehouseName', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  228. { title: '收货客户名称', dataIndex: 'receiverName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  229. { title: '产品款数', dataIndex: 'totalCategory', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  230. { title: '产品数量', dataIndex: 'totalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  231. // { title: '总售价', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  232. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  233. { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  234. { title: '对单状态', dataIndex: 'checkStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  235. { title: '对单人员', dataIndex: 'checkPersonName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  236. { title: '对单时间', dataIndex: 'checkDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  237. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  238. ]
  239. if (this.isShowWarehouse) {
  240. arr.splice(7, 0, { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  241. }
  242. if (this.$hasPermissions('M_matchSendOutOrderList_salesPrice')) { // 售价权限
  243. arr.splice(this.isShowWarehouse ? 10 : 9, 0, { title: '总售价', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  244. }
  245. return arr
  246. }
  247. },
  248. methods: {
  249. // 时间 change
  250. dateChange (date) {
  251. this.queryParam.beginDate = date[0]
  252. this.queryParam.endDate = date[1]
  253. },
  254. checkDateChange (date) {
  255. this.queryParam.checkBeginDate = date[0]
  256. this.queryParam.checkEndDate = date[1]
  257. },
  258. custChange (val) {
  259. this.queryParam.buyerSn = val.key
  260. },
  261. shcustChange (val) {
  262. this.queryParam.receiverSn = val.key
  263. },
  264. // 详情
  265. handleDetail (row, type) {
  266. this.detailType = type
  267. this.bizSn = type == 0 ? row.salesBillSn : row.dispatchBillSn
  268. this.$store.state.app.curActionPermission = type == 0 ? 'B_salesDetail' : 'B_dispatchDetail'
  269. this.showDetailModal = true
  270. },
  271. cancelDetail () {
  272. this.showDetailModal = false
  273. this.detailType = 2
  274. this.bizSn = null
  275. this.$store.state.app.curActionPermission = ''
  276. },
  277. // 对单
  278. handleAudit (row) {
  279. const _this = this
  280. this.$confirm({
  281. title: '操作提示',
  282. content: '确认对单通过吗?',
  283. centered: true,
  284. onOk () {
  285. _this.spinning = true
  286. dispatchCheck({ dispatchBillSn: row.dispatchBillSn }).then(res => {
  287. _this.$message.info(res.message)
  288. if (res.status == 200) {
  289. _this.$refs.table.refresh()
  290. }
  291. _this.spinning = false
  292. })
  293. }
  294. })
  295. },
  296. subareaChange (val) {
  297. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  298. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  299. },
  300. // 重置
  301. resetSearchForm () {
  302. this.time = []
  303. this.$refs.rangeDate.resetDate(this.time)
  304. this.checktime = []
  305. this.$refs.checkDate.resetDate(this.checktime)
  306. this.$refs.dealerSubareaScopeList.resetForm()
  307. this.$refs.shbuyerName.resetForm()
  308. this.queryParam = {
  309. beginDate: '',
  310. endDate: '',
  311. checkBeginDate: '',
  312. checkEndDate: '',
  313. buyerSn: undefined, // 客户名称
  314. receiverSn: undefined, // 收货客户
  315. salesBillNo: '', // 销售单号
  316. dispatchBillNo: '', // 备货单号
  317. billStatus: undefined, // 业务状态
  318. subareaArea: {
  319. subareaSn: undefined,
  320. subareaAreaSn: undefined
  321. },
  322. voidFlag: undefined,
  323. shippingAddrProvinceSn: undefined,
  324. checkStatus: undefined,
  325. warehouseSn: undefined
  326. }
  327. if (this.advanced) {
  328. this.$refs.subarea.clearData()
  329. }
  330. this.$refs.table.refresh(true)
  331. },
  332. pageInit () {
  333. const _this = this
  334. this.$nextTick(() => { // 页面渲染完成后的回调
  335. _this.setTableH()
  336. })
  337. },
  338. setTableH () {
  339. const tableSearchH = this.$refs.tableSearch.offsetHeight
  340. this.tableHeight = window.innerHeight - tableSearchH - 210
  341. }
  342. },
  343. watch: {
  344. advanced (newValue, oldValue) {
  345. const _this = this
  346. this.$nextTick(() => { // 页面渲染完成后的回调
  347. _this.setTableH()
  348. })
  349. },
  350. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  351. this.setTableH()
  352. }
  353. },
  354. mounted () {
  355. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  356. this.pageInit()
  357. this.resetSearchForm()
  358. }
  359. },
  360. activated () {
  361. // 如果是新页签打开,则重置当前页面
  362. if (this.$store.state.app.isNewTab) {
  363. this.pageInit()
  364. this.resetSearchForm()
  365. }
  366. // 仅刷新列表,不重置页面
  367. if (this.$store.state.app.updateList) {
  368. this.pageInit()
  369. this.$refs.table.refresh()
  370. }
  371. },
  372. beforeRouteEnter (to, from, next) {
  373. next(vm => {})
  374. }
  375. }
  376. </script>
  377. <style lang="less">
  378. .matchSoo-wrap{
  379. .sTable{
  380. margin-top: 10px;
  381. }
  382. .ant-tabs-bar{
  383. margin:0;
  384. }
  385. }
  386. </style>