list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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="业务状态">
  32. <v-select
  33. v-model="queryParam.billStatus"
  34. ref="billStatus"
  35. id="matchSoo-billStatus"
  36. code="DISPATCH_BILL_STATUS"
  37. placeholder="请选择业务状态"
  38. allowClear></v-select>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-item label="单据状态">
  43. <v-select
  44. v-model="queryParam.billStatus"
  45. ref="billStatus"
  46. id="matchSoo-billStatus"
  47. code="DISPATCH_BILL_STATUS"
  48. placeholder="请选择单据状态"
  49. allowClear></v-select>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :md="6" :sm="24">
  53. <a-form-item label="对单状态">
  54. <v-select
  55. v-model="queryParam.billStatus"
  56. ref="billStatus"
  57. id="matchSoo-billStatus"
  58. code="DISPATCH_BILL_STATUS"
  59. placeholder="请选择对单状态"
  60. allowClear></v-select>
  61. </a-form-item>
  62. </a-col>
  63. <a-col :md="6" :sm="24">
  64. <a-form-item label="对单时间">
  65. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  66. </a-form-item>
  67. </a-col>
  68. <a-col :md="6" :sm="24">
  69. <a-form-model-item label="所在区域">
  70. <subarea id="matchSoo-subarea" v-model="queryParam.subareaSn"></subarea>
  71. </a-form-model-item>
  72. </a-col>
  73. <a-col :md="6" :sm="24">
  74. <a-form-model-item label="地区">
  75. <a-form-model-item prop="shippingAddrProvinceSn">
  76. <Area id="matchSoo-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  77. </a-form-model-item>
  78. </a-form-model-item>
  79. </a-form-model-item></a-col>
  80. </template>
  81. <a-col :md="6" :sm="24">
  82. <span class="table-page-search-submitButtons">
  83. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  84. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  85. <a @click="advanced=!advanced" style="margin-left: 8px">
  86. {{ advanced ? '收起' : '展开' }}
  87. <a-icon :type="advanced ? 'up' : 'down'"/>
  88. </a>
  89. </span>
  90. </a-col>
  91. </a-row>
  92. </a-form>
  93. </div>
  94. <!-- 列表 -->
  95. <s-table
  96. class="sTable fixPagination"
  97. ref="table"
  98. :style="{ height: tableHeight+84.5+'px' }"
  99. size="small"
  100. :rowKey="(record) => record.id"
  101. :columns="columns"
  102. :data="loadData"
  103. :scroll="{ y:tableHeight }"
  104. :defaultLoadData="false"
  105. bordered>
  106. <!-- 销售单号 -->
  107. <template slot="salesBillNo" slot-scope="text, record">
  108. <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  109. <span v-else>{{ record.salesBillNo }}</span>
  110. </template>
  111. <!-- 备货单号 -->
  112. <template slot="dispatchBillNo" slot-scope="text, record">
  113. <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  114. <span v-else>{{ record.dispatchBillNo }}</span>
  115. </template>
  116. <!-- 操作 -->
  117. <template slot="action" slot-scope="text, record">
  118. <a-button
  119. size="small"
  120. type="link"
  121. class="button-warning"
  122. @click="handleAudit(record)"
  123. >对单通过</a-button>
  124. </template>
  125. </s-table>
  126. </a-spin>
  127. </a-card>
  128. </div>
  129. </template>
  130. <script>
  131. import { commonMixin } from '@/utils/mixin'
  132. import moment from 'moment'
  133. import getDate from '@/libs/getDate.js'
  134. import rangeDate from '@/views/common/rangeDate.vue'
  135. import { STable, VSelect } from '@/components'
  136. import subarea from '@/views/common/subarea.js'
  137. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  138. import Area from '@/views/common/area.js'
  139. import { dispatchlList, dispatchQueryCount } from '@/api/dispatch'
  140. export default {
  141. name: 'PushOrderManagementList',
  142. mixins: [commonMixin],
  143. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, Area },
  144. data () {
  145. return {
  146. spinning: false,
  147. advanced: true, // 高级搜索 展开/关闭
  148. disabled: false, // 查询、重置按钮是否可操作
  149. tableHeight: 0,
  150. time: [
  151. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  152. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  153. ],
  154. // 查询参数
  155. queryParam: {
  156. beginDate: getDate.getThreeMonthDays().starttime,
  157. endDate: getDate.getCurrMonthDays().endtime,
  158. buyerSn: undefined, // 客户名称
  159. salesBillNo: '', // 销售单号
  160. dispatchBillNo: '', // 备货单号
  161. billStatus: undefined, // 业务状态
  162. subareaSn: undefined,
  163. shippingAddrProvinceSn: undefined
  164. },
  165. totalData: {
  166. totalAmount: 0,
  167. totalQty: 0,
  168. totalRecord: 0
  169. },
  170. // 加载数据方法 必须为 Promise 对象
  171. loadData: parameter => {
  172. this.disabled = true
  173. this.spinning = true
  174. // 查询总计
  175. dispatchQueryCount(Object.assign(parameter, this.queryParam)).then(res => {
  176. this.totalData = Object.assign(this.totalData, res.data || {})
  177. })
  178. return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
  179. let data
  180. if (res.status == 200) {
  181. data = res.data
  182. const no = (data.pageNo - 1) * data.pageSize
  183. for (var i = 0; i < data.list.length; i++) {
  184. data.list[i].no = no + i + 1
  185. }
  186. this.disabled = false
  187. }
  188. this.spinning = false
  189. return data
  190. })
  191. }
  192. }
  193. },
  194. computed: {
  195. columns () {
  196. const arr = [
  197. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  198. { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  199. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '14%', align: 'center' },
  200. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '14%', align: 'center' },
  201. { title: '发货编号', dataIndex: 'buyerName1', width: '6%', align: 'center' },
  202. { title: '客户名称', dataIndex: 'buyerName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  203. { title: '收货客户名称', dataIndex: 'buyerName2', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  204. { title: '产品款数', dataIndex: 'totalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  205. { title: '产品数量', dataIndex: 'totalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  206. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  207. { title: '单据状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  208. { title: '对单状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  209. { title: '对单人员', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  210. { title: '对单时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  211. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  212. ]
  213. return arr
  214. }
  215. },
  216. methods: {
  217. // 时间 change
  218. dateChange (date) {
  219. this.queryParam.beginDate = date[0]
  220. this.queryParam.endDate = date[1]
  221. },
  222. custChange (val) {
  223. this.queryParam.buyerSn = val.key
  224. },
  225. // 详情
  226. handleDetail (row, type) {
  227. if (type == 0) {
  228. this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn, type: 'pushOrder' } })
  229. } else {
  230. this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'pushOrder' } })
  231. }
  232. },
  233. // 允许打印
  234. handleAudit (row) {
  235. this.$confirm({
  236. title: '操作提示',
  237. content: '确认对单通过吗?',
  238. centered: true,
  239. onOk () {
  240. console.log('OK')
  241. }
  242. })
  243. },
  244. // 重置
  245. resetSearchForm () {
  246. this.$refs.rangeDate.resetDate(this.time)
  247. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  248. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  249. this.queryParam.buyerSn = undefined
  250. this.$refs.dealerSubareaScopeList.resetForm()
  251. this.queryParam.salesBillNo = ''
  252. this.queryParam.dispatchBillNo = ''
  253. this.queryParam.billStatus = undefined
  254. this.queryParam.subareaSn = undefined
  255. this.queryParam.shippingAddrProvinceSn = undefined
  256. this.$refs.table.refresh(true)
  257. },
  258. pageInit () {
  259. const _this = this
  260. this.$nextTick(() => { // 页面渲染完成后的回调
  261. _this.setTableH()
  262. })
  263. },
  264. setTableH () {
  265. const tableSearchH = this.$refs.tableSearch.offsetHeight
  266. this.tableHeight = window.innerHeight - tableSearchH - 210
  267. }
  268. },
  269. watch: {
  270. advanced (newValue, oldValue) {
  271. const _this = this
  272. this.$nextTick(() => { // 页面渲染完成后的回调
  273. _this.setTableH()
  274. })
  275. },
  276. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  277. this.setTableH()
  278. }
  279. },
  280. mounted () {
  281. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  282. this.pageInit()
  283. this.resetSearchForm()
  284. }
  285. },
  286. activated () {
  287. // 如果是新页签打开,则重置当前页面
  288. if (this.$store.state.app.isNewTab) {
  289. this.pageInit()
  290. this.resetSearchForm()
  291. }
  292. // 仅刷新列表,不重置页面
  293. if (this.$store.state.app.updateList) {
  294. this.pageInit()
  295. this.$refs.table.refresh()
  296. }
  297. },
  298. beforeRouteEnter (to, from, next) {
  299. next(vm => {})
  300. }
  301. }
  302. </script>
  303. <style lang="less">
  304. .matchSoo-wrap{
  305. .sTable{
  306. margin-top: 10px;
  307. }
  308. .ant-tabs-bar{
  309. margin:0;
  310. }
  311. }
  312. </style>