list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <a-card size="small" :bordered="false" class="sendOut-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  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="发货单号">
  15. <a-input id="sendOut-sendBillNo" v-model.trim="queryParam.sendBillNo" allowClear placeholder="请输入发货单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  20. <a-input id="sendOut-customeName" v-model.trim="queryParam.customeName" allowClear placeholder="请输入客户名称"/>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="关联业务单号">
  26. <a-input id="sendOut-bizNos" v-model.trim="queryParam.bizNos" allowClear placeholder="请输入备货或调拨单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="托运日期">
  31. <rangeDate ref="sendDate" :value="sendtime" @change="sendDateChange" />
  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.receiveFlag"
  38. ref="receiveFlag"
  39. id="sendOut-receiveFlag"
  40. code="RECEIVE_FLAG"
  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.transportState"
  49. ref="transportState"
  50. id="sendOut-transportState"
  51. code="TRANSPORT_STATE"
  52. placeholder="请选择物流情况"
  53. allowClear></v-select>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-model-item label="所在区域">
  58. <subarea id="sendOut-subarea" ref="subarea" @change="subareaChange"></subarea>
  59. </a-form-model-item>
  60. </a-col>
  61. <a-col :md="6" :sm="24">
  62. <a-form-model-item label="地区" >
  63. <Area id="sendOut-provinceSn" v-model="queryParam.provinceSn" placeholder="请选择省"></Area>
  64. </a-form-model-item>
  65. </a-col>
  66. </template>
  67. <a-col :md="6" :sm="24">
  68. <span class="table-page-search-submitButtons">
  69. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  70. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  71. <a-button
  72. style="margin-left: 10px"
  73. type="primary"
  74. class="button-warning"
  75. @click="handleExport"
  76. :disabled="disabled"
  77. :loading="exportLoading"
  78. v-if="$hasPermissions('B_sendOutExport')"
  79. id="sendOut-export">导出</a-button>
  80. <a @click="advanced=!advanced" style="margin-left: 8px">
  81. {{ advanced ? '收起' : '展开' }}
  82. <a-icon :type="advanced ? 'up' : 'down'"/>
  83. </a>
  84. </span>
  85. </a-col>
  86. </a-row>
  87. </a-form>
  88. <!-- 操作按钮 -->
  89. <div>
  90. <a-button type="primary" class="button-error" v-if="$hasPermissions('B_sendOutPlImport')" @click="openGuideModal=true">批量导入</a-button>
  91. </div>
  92. </div>
  93. <!-- 列表 -->
  94. <s-table
  95. class="sTable fixPagination"
  96. ref="table"
  97. :style="{ height: tableHeight+84.5+'px' }"
  98. size="small"
  99. :rowKey="(record) => record.id"
  100. :columns="columns"
  101. :data="loadData"
  102. :scroll="{ y:tableHeight }"
  103. :defaultLoadData="false"
  104. bordered>
  105. <!-- 发货单号 -->
  106. <template slot="sendBillNo" slot-scope="text, record">
  107. <span class="link-bule" v-if="$hasPermissions('B_SooDetail')" @click="handleDetail(record,1)">{{ record.sendBillNo }}</span>
  108. <span v-else>{{ record.sendBillNo }}</span>
  109. </template>
  110. <!-- 操作 -->
  111. <template slot="action" slot-scope="text, record">
  112. <a-button
  113. size="small"
  114. type="link"
  115. class="button-warning"
  116. v-if="record.receiveFlag == 0&&$hasPermissions('B_SooEdit')"
  117. @click="handleEdit(record)"
  118. >编辑</a-button>
  119. <a-button
  120. size="small"
  121. type="link"
  122. class="button-warning"
  123. v-if="record.receiveFlag == 0&&$hasPermissions('B_WLGZ')"
  124. @click="handleDetail(record,0)"
  125. >物流跟踪</a-button>
  126. <span v-if="record.receiveFlag == 1">--</span>
  127. </template>
  128. </s-table>
  129. </a-spin>
  130. <!-- 发货单详情 -->
  131. <detailModal v-drag ref="detailModal" :openModal="showTipModal" @cancel="showTipModal=false" @ok="sendSuccess"></detailModal>
  132. <!-- 编辑发货单 -->
  133. <sendGoodModal
  134. v-drag
  135. ref="sendGoodModal"
  136. modalTit="编辑发货单"
  137. :openModal="showSendGoodModal"
  138. @ok="sendSuccess"
  139. @cancel="showSendGoodModal=false"></sendGoodModal>
  140. <!-- 导入发货单 -->
  141. <importGuideModal v-drag :openModal="openGuideModal" @close="openGuideModal=false" @ok="resetSearchForm" />
  142. </a-card>
  143. </template>
  144. <script>
  145. import { commonMixin } from '@/utils/mixin'
  146. import rangeDate from '@/views/common/rangeDate.vue'
  147. import { hdExportExcel } from '@/libs/exportExcel'
  148. import { STable, VSelect } from '@/components'
  149. import detailModal from './detailModal.vue'
  150. import sendGoodModal from '../outboundOrder/sendGoodModal.vue'
  151. import Area from '@/views/common/area.js'
  152. import subarea from '@/views/common/subarea.js'
  153. import ImportGuideModal from './importGuideModal.vue'
  154. import { sendBillQueryPageList, sendBillExcel } from '@/api/sendBill'
  155. export default {
  156. name: 'SendOutOrderList',
  157. mixins: [commonMixin],
  158. components: { STable, VSelect, rangeDate, detailModal, sendGoodModal, Area, subarea, ImportGuideModal },
  159. data () {
  160. return {
  161. spinning: false,
  162. exportLoading: false,
  163. advanced: true, // 高级搜索 展开/关闭
  164. disabled: false, // 查询、重置按钮是否可操作
  165. openGuideModal: false,
  166. tableHeight: 0,
  167. time: [],
  168. sendtime: [],
  169. // 查询参数
  170. queryParam: {
  171. beginDate: '',
  172. endDate: '',
  173. sendBeginDate: '',
  174. sendEndDate: '',
  175. customeName: undefined, // 客户名称
  176. sendBillNo: '', // 发货单号
  177. bizNos: '', // 业务单号
  178. transportState: undefined, // 物流状态
  179. receiveFlag: undefined, // 收货状态
  180. subareaArea:{
  181. subareaSn: undefined,
  182. subareaAreaSn: undefined
  183. },
  184. provinceSn: undefined
  185. },
  186. totalData: {
  187. totalAmount: 0,
  188. totalQty: 0,
  189. totalRecord: 0
  190. },
  191. showTipModal: false,
  192. showSendGoodModal: false,
  193. // 加载数据方法 必须为 Promise 对象
  194. loadData: parameter => {
  195. this.disabled = true
  196. this.spinning = true
  197. return sendBillQueryPageList(Object.assign(parameter, this.queryParam)).then(res => {
  198. let data
  199. if (res.status == 200) {
  200. data = res.data
  201. const no = (data.pageNo - 1) * data.pageSize
  202. for (var i = 0; i < data.list.length; i++) {
  203. data.list[i].no = no + i + 1
  204. }
  205. this.disabled = false
  206. }
  207. this.spinning = false
  208. return data
  209. })
  210. }
  211. }
  212. },
  213. computed: {
  214. columns () {
  215. const _this = this
  216. const arr = [
  217. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  218. { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  219. { title: '发货单号', scopedSlots: { customRender: 'sendBillNo' }, width: '12%', align: 'center' },
  220. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  221. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  222. { title: '地区', dataIndex: 'provinceName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  223. { title: '客户名称', dataIndex: 'customeName', width: '10%', align: 'left', customRender: function (text) { return text || '--' } },
  224. { title: '托运日期', dataIndex: 'sendDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  225. { title: '收货人', dataIndex: 'customerCacateName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  226. { title: '物流电话', dataIndex: 'transportTele', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  227. { title: '物流单号', dataIndex: 'transportNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  228. { title: '总件数', dataIndex: 'totalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  229. { title: '运费合计', dataIndex: 'totalSendAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  230. { title: '收货状态', dataIndex: 'receiveFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  231. { title: '收款时间', dataIndex: 'settleTime', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  232. { title: '收货时间', dataIndex: 'receiveDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  233. { title: '物流情况', dataIndex: 'transportStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  234. { title: '备注', dataIndex: 'transportRemark', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  235. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  236. ]
  237. return arr
  238. }
  239. },
  240. methods: {
  241. // 时间 change
  242. dateChange (date) {
  243. this.queryParam.beginDate = date[0]
  244. this.queryParam.endDate = date[1]
  245. },
  246. sendDateChange (date) {
  247. this.queryParam.sendBeginDate = date[0]
  248. this.queryParam.sendEndDate = date[1]
  249. },
  250. // 详情
  251. handleDetail (row, type) {
  252. this.showTipModal = true
  253. this.$refs.detailModal.getDetail(row, type, type ? '发货单详情' : '物流跟踪')
  254. },
  255. // 编辑
  256. handleEdit (row) {
  257. this.showSendGoodModal = true
  258. this.$refs.sendGoodModal.getDetail(row)
  259. },
  260. sendSuccess () {
  261. this.showSendGoodModal = false
  262. this.showTipModal = false
  263. this.$refs.table.refresh()
  264. },
  265. // 导出
  266. handleExport () {
  267. const _this = this
  268. _this.exportLoading = true
  269. _this.spinning = true
  270. hdExportExcel(sendBillExcel, _this.queryParam, '发货单列表', function () {
  271. _this.exportLoading = false
  272. _this.spinning = false
  273. })
  274. },
  275. subareaChange(val){
  276. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  277. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  278. },
  279. // 重置
  280. resetSearchForm () {
  281. this.time = []
  282. this.$refs.rangeDate.resetDate(this.time)
  283. this.queryParam.beginDate = ''
  284. this.queryParam.endDate = ''
  285. this.sendtime = []
  286. this.$refs.sendDate.resetDate(this.sendtime)
  287. this.queryParam.sendBeginDate = ''
  288. this.queryParam.sendEndDate = ''
  289. this.queryParam.customeName = undefined
  290. this.queryParam.sendBillNo = ''
  291. this.queryParam.bizNos = ''
  292. this.queryParam.transportState = undefined
  293. this.queryParam.receiveFlag = undefined
  294. this.queryParam.subareaArea.subareaSn = undefined
  295. this.queryParam.subareaArea.subareaAreaSn = undefined
  296. this.queryParam.provinceSn = undefined
  297. if(this.advanced){
  298. this.$refs.subarea.clearData()
  299. }
  300. this.$refs.table.refresh(true)
  301. },
  302. pageInit () {
  303. const _this = this
  304. this.$nextTick(() => { // 页面渲染完成后的回调
  305. _this.setTableH()
  306. })
  307. },
  308. setTableH () {
  309. const tableSearchH = this.$refs.tableSearch.offsetHeight
  310. this.tableHeight = window.innerHeight - tableSearchH - 208
  311. }
  312. },
  313. watch: {
  314. advanced (newValue, oldValue) {
  315. const _this = this
  316. this.$nextTick(() => { // 页面渲染完成后的回调
  317. _this.setTableH()
  318. })
  319. },
  320. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  321. this.setTableH()
  322. }
  323. },
  324. mounted () {
  325. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  326. this.pageInit()
  327. this.resetSearchForm()
  328. }
  329. },
  330. activated () {
  331. // 如果是新页签打开,则重置当前页面
  332. if (this.$store.state.app.isNewTab) {
  333. this.pageInit()
  334. this.resetSearchForm()
  335. }
  336. // 仅刷新列表,不重置页面
  337. if (this.$store.state.app.updateList) {
  338. this.pageInit()
  339. this.$refs.table.refresh()
  340. }
  341. },
  342. beforeRouteEnter (to, from, next) {
  343. next(vm => {})
  344. }
  345. }
  346. </script>
  347. <style lang="less">
  348. .sendOut-wrap{
  349. .sTable{
  350. margin-top: 10px;
  351. }
  352. }
  353. </style>