list.vue 15 KB

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