list.vue 16 KB

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