list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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="地区">
  80. <a-form-model-item prop="shippingAddrProvinceSn">
  81. <Area id="matchSoo-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  82. </a-form-model-item>
  83. </a-form-model-item>
  84. </a-col>
  85. </template>
  86. <a-col :md="6" :sm="24">
  87. <span class="table-page-search-submitButtons">
  88. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  89. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  90. <a @click="advanced=!advanced" style="margin-left: 8px">
  91. {{ advanced ? '收起' : '展开' }}
  92. <a-icon :type="advanced ? 'up' : 'down'"/>
  93. </a>
  94. </span>
  95. </a-col>
  96. </a-row>
  97. </a-form>
  98. </div>
  99. <!-- 列表 -->
  100. <s-table
  101. class="sTable fixPagination"
  102. ref="table"
  103. :style="{ height: tableHeight+84.5+'px' }"
  104. size="small"
  105. :rowKey="(record) => record.id"
  106. :columns="columns"
  107. :data="loadData"
  108. :scroll="{ y:tableHeight }"
  109. :defaultLoadData="false"
  110. bordered>
  111. <!-- 销售单号 -->
  112. <template slot="salesBillNo" slot-scope="text, record">
  113. <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  114. <span v-else>{{ record.salesBillNo }}</span>
  115. </template>
  116. <!-- 备货单号 -->
  117. <template slot="dispatchBillNo" slot-scope="text, record">
  118. <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  119. <span v-else>{{ record.dispatchBillNo }}</span>
  120. </template>
  121. <!-- 操作 -->
  122. <template slot="action" slot-scope="text, record">
  123. <a-button
  124. size="small"
  125. type="link"
  126. class="button-warning"
  127. v-if="record.checkStatus =='WAIT'&&record.voidFlag==0&&$hasPermissions('B_DDAudit')"
  128. @click="handleAudit(record)"
  129. >对单通过</a-button>
  130. <span v-else>--</span>
  131. </template>
  132. </s-table>
  133. </a-spin>
  134. </a-card>
  135. <!-- 查看销售单或备货单详情 -->
  136. <commonModal
  137. :modalTit="detailType?'备货单详情':'销售单详情'"
  138. bodyPadding="10px"
  139. width="70%"
  140. :showFooter="false"
  141. :openModal="showDetailModal"
  142. @cancel="cancelDetail">
  143. <salesDetail v-if="detailType==0" ref="salesDetail" :bizSn="bizSn"></salesDetail>
  144. <dispatchDetail v-if="detailType==1" ref="dispatchDetail" :bizSn="bizSn"></dispatchDetail>
  145. </commonModal>
  146. </div>
  147. </template>
  148. <script>
  149. import { commonMixin } from '@/utils/mixin'
  150. import rangeDate from '@/views/common/rangeDate.vue'
  151. import { STable, VSelect } from '@/components'
  152. import subarea from '@/views/common/subarea.js'
  153. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  154. import Area from '@/views/common/area.js'
  155. import { dispatchlList, dispatchCheck } from '@/api/dispatch'
  156. import commonModal from '@/views/common/commonModal.vue'
  157. import salesDetail from '@/views/salesManagement/salesQuery/detail.vue'
  158. import dispatchDetail from '@/views/salesManagement/pushOrderManagement/detail.vue'
  159. export default {
  160. name: 'MatchSendOutOrderList',
  161. mixins: [commonMixin],
  162. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, Area, commonModal, salesDetail, dispatchDetail },
  163. data () {
  164. return {
  165. spinning: false,
  166. advanced: true, // 高级搜索 展开/关闭
  167. disabled: false, // 查询、重置按钮是否可操作
  168. showDetailModal: false,
  169. detailType: 2,
  170. bizSn: null,
  171. tableHeight: 0,
  172. time: [],
  173. checktime: [],
  174. // 查询参数
  175. queryParam: {
  176. beginDate: '',
  177. endDate: '',
  178. checkBeginDate: '',
  179. checkEndDate: '',
  180. buyerSn: undefined, // 客户名称
  181. receiverSn: undefined, // 收货客户
  182. salesBillNo: '', // 销售单号
  183. dispatchBillNo: '', // 备货单号
  184. billStatus: undefined, // 业务状态
  185. subareaSn: undefined,
  186. subareaAreaSn: undefined,
  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.subareaSn = val[0] ? val[0] : undefined
  287. this.queryParam.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. subareaSn: undefined,
  308. subareaAreaSn: undefined,
  309. voidFlag: undefined,
  310. shippingAddrProvinceSn: undefined,
  311. checkStatus: undefined
  312. }
  313. if(this.advanced){
  314. this.$refs.subarea.clearData()
  315. }
  316. this.$refs.table.refresh(true)
  317. },
  318. pageInit () {
  319. const _this = this
  320. this.$nextTick(() => { // 页面渲染完成后的回调
  321. _this.setTableH()
  322. })
  323. },
  324. setTableH () {
  325. const tableSearchH = this.$refs.tableSearch.offsetHeight
  326. this.tableHeight = window.innerHeight - tableSearchH - 210
  327. }
  328. },
  329. watch: {
  330. advanced (newValue, oldValue) {
  331. const _this = this
  332. this.$nextTick(() => { // 页面渲染完成后的回调
  333. _this.setTableH()
  334. })
  335. },
  336. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  337. this.setTableH()
  338. }
  339. },
  340. mounted () {
  341. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  342. this.pageInit()
  343. this.resetSearchForm()
  344. }
  345. },
  346. activated () {
  347. // 如果是新页签打开,则重置当前页面
  348. if (this.$store.state.app.isNewTab) {
  349. this.pageInit()
  350. this.resetSearchForm()
  351. }
  352. // 仅刷新列表,不重置页面
  353. if (this.$store.state.app.updateList) {
  354. this.pageInit()
  355. this.$refs.table.refresh()
  356. }
  357. },
  358. beforeRouteEnter (to, from, next) {
  359. next(vm => {})
  360. }
  361. }
  362. </script>
  363. <style lang="less">
  364. .matchSoo-wrap{
  365. .sTable{
  366. margin-top: 10px;
  367. }
  368. .ant-tabs-bar{
  369. margin:0;
  370. }
  371. }
  372. </style>