list.vue 15 KB

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