shipmentList.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. <template>
  2. <!-- 发运明细列表 -->
  3. <div id="ShipmentList">
  4. <!-- 查询 -->
  5. <a-card :bordered="false">
  6. <div class="table-page-search-wrapper">
  7. <a-form layout="inline" @keyup.enter.native="searchQuery">
  8. <a-row :gutter="24">
  9. <a-col :md="6" :sm="8">
  10. <a-form-item label="单据号">
  11. <a-input placeholder="请输入单据号" v-model="queryParam.documentNo"></a-input>
  12. </a-form-item>
  13. </a-col>
  14. <a-col :md="6" :sm="8">
  15. <a-form-item label="起始时间">
  16. <a-range-picker
  17. style="width: 100%"
  18. v-model="queryParam.timeRange"
  19. format="YYYY-MM-DD"
  20. :placeholder="['开始时间', '结束时间']"
  21. @change="onDateChange"
  22. @ok="onDateOk"
  23. />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8">
  27. <a-form-item label="预发货日期">
  28. <a-date-picker
  29. placeholder="请选择预发货日期"
  30. format="YYYY-MM-DD"
  31. style="width: 100%"
  32. v-model="queryParam.preDeliveryDate"
  33. @change="deliveryDateChange"
  34. />
  35. </a-form-item>
  36. </a-col>
  37. <template v-if="toggleSearchStatus">
  38. <a-col :md="6" :sm="8">
  39. <a-form-item label="业务员">
  40. <a-input placeholder="请输入业务员" v-model="queryParam.salesman"></a-input>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="8">
  44. <a-form-item label="款号">
  45. <a-input placeholder="请输入款号" v-model="queryParam.itemNumber"></a-input>
  46. </a-form-item>
  47. </a-col>
  48. <a-col :md="6" :sm="8">
  49. <a-form-item label="是否被参照">
  50. <a-select v-model="queryParam.refer">
  51. <a-select-option value="">请选择</a-select-option>
  52. <a-select-option value="0">否</a-select-option>
  53. <a-select-option value="1">是</a-select-option>
  54. </a-select>
  55. </a-form-item>
  56. </a-col>
  57. </template>
  58. <a-col :md="6" :sm="8">
  59. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  60. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  61. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  62. <a @click="handleToggleSearch" style="margin-left: 8px">
  63. {{ toggleSearchStatus ? '收起' : '展开' }}
  64. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  65. </a>
  66. </span>
  67. </a-col>
  68. </a-row>
  69. </a-form>
  70. </div>
  71. </a-card>
  72. <!-- 操作按钮区域 -->
  73. <a-card :bordered="false" style=" marginTop:10px;">
  74. <div class="table-operator">
  75. <a-button type="primary" @click.stop="addShipDet" icon="plus">新增</a-button>
  76. </div>
  77. <!-- 子表 :row-key="record => record.id" :pagination="ipagination-->
  78. <a-table
  79. v-if="shipmentListData"
  80. bordered
  81. rowKey="id"
  82. :columns="shipmentListColumns"
  83. :data-source="shipmentListData"
  84. :loading="loading"
  85. :pagination="pagination"
  86. :scroll="{ x: 1500 }"
  87. @change="handleTableChange"
  88. >
  89. <!-- 推送状态 -->
  90. <span slot="pushState" slot-scope="text, record">
  91. <a-tag color="#2db7f5" v-if="record.pushState == '0'">未推送</a-tag>
  92. <a-tag color="#87d068" v-if="record.pushState == '1'">推送成功</a-tag>
  93. <a-tag color="#f50" v-if="record.pushState == '2'">推送失败</a-tag>
  94. </span>
  95. <!-- 单据状态 -->
  96. <span slot="state" slot-scope="text, record">
  97. <a-tag color="orange" v-if="record.state == '0'">已保存</a-tag>
  98. <a-tag color="green" v-if="record.state == '1'">已提交</a-tag>
  99. </span>
  100. <!-- 操作 默认按钮 未提交未推送-->
  101. <span slot="operationSlot" slot-scope="text, record">
  102. <a href="javascript:void(0);" @click="declareElements(record)" style="color:green">申报要素</a>
  103. <a-divider type="vertical" />
  104. <a-dropdown>
  105. <a class="ant-dropdown-link">更多<a-icon type="down"/></a>
  106. <!-- 已保存 -->
  107. <a-menu slot="overlay" v-if="record.state == '0'">
  108. <a-menu-item>
  109. <a @click="details(record)">详情</a>
  110. </a-menu-item>
  111. <a-menu-item>
  112. <a @click="edit(record)">编辑</a>
  113. </a-menu-item>
  114. <a-menu-item>
  115. <a-popconfirm title="确定提交吗?" ok-text="是" cancel-text="否" @confirm="submit(record)">
  116. <a href="javascript:void(0);" style="color:green;">提交</a>
  117. </a-popconfirm>
  118. </a-menu-item>
  119. <a-menu-item>
  120. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record)">
  121. <a href="javascript:void(0);" style="color:red;">删除</a>
  122. </a-popconfirm>
  123. </a-menu-item>
  124. </a-menu>
  125. <!-- 已提交 且 推送成功 -->
  126. <a-menu slot="overlay" v-if="record.pushState == '1' && record.state == '1'">
  127. <a-menu-item>
  128. <a @click="details(record)">详情</a>
  129. </a-menu-item>
  130. </a-menu>
  131. <!-- 已提交 且 推送失败 -->
  132. <a-menu slot="overlay" v-if="record.pushState == '2' && record.state == '1'">
  133. <a-menu-item>
  134. <a @click="details(record)">详情</a>
  135. </a-menu-item>
  136. <a-menu-item>
  137. <a-popconfirm title="确定重新推送吗?" ok-text="是" cancel-text="否" @confirm="rePush(record)">
  138. <a href="javascript:void(0);" style="color:green;">重新推送</a>
  139. </a-popconfirm>
  140. </a-menu-item>
  141. </a-menu>
  142. <!-- 已提交 -->
  143. <a-menu slot="overlay" v-if="record.state == '1'">
  144. <a-menu-item>
  145. <a @click="details(record)">详情</a>
  146. </a-menu-item>
  147. <a-menu-item>
  148. <a-popconfirm title="确定取消提交吗?" ok-text="是" cancel-text="否" @confirm="cancelSubmit(record)">
  149. <a href="javascript:void(0);" style="color:red;">取消提交</a>
  150. </a-popconfirm>
  151. </a-menu-item>
  152. <a-menu-item>
  153. <a-popconfirm title="确定推送吗?" ok-text="是" cancel-text="否" @confirm="push(record)">
  154. <a href="javascript:void(0);" style="color:green;">推送</a>
  155. </a-popconfirm>
  156. </a-menu-item>
  157. </a-menu>
  158. <!-- 未推送 -->
  159. <a-menu slot="overlay" v-if="record.pushState == '0'">
  160. <a-menu-item>
  161. <a @click="details(record)">详情</a>
  162. </a-menu-item>
  163. <a-menu-item>
  164. <a-popconfirm title="确定推送吗?" ok-text="是" cancel-text="否" @confirm="push(record)">
  165. <a href="javascript:void(0);" style="color:green;">推送</a>
  166. </a-popconfirm>
  167. </a-menu-item>
  168. </a-menu>
  169. </a-dropdown>
  170. </span>
  171. </a-table>
  172. </a-card>
  173. <!-- 抽屉 :fatherObj="detailsByIdObj"-->
  174. <div>
  175. <addShipDet-drawer ref="addShipDetDrawer" :fatherList="getShipmentList" @ok="modalFormOk"></addShipDet-drawer>
  176. <detailsShipDet-drawer ref="detailsShipDetDrawer" @ok="modalFormOk"></detailsShipDet-drawer>
  177. <editShipDet-drawer ref="editShipDetDrawer" :fatherList="getShipmentList" @ok="modalFormOk"></editShipDet-drawer>
  178. <!-- 申报要素 弹框 -->
  179. <declareElements-modal ref="declareElementsModal"></declareElements-modal>
  180. </div>
  181. </div>
  182. </template>
  183. <script>
  184. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  185. import JEllipsis from '@/components/jeecg/JEllipsis'
  186. import moment from 'moment'
  187. import addShipDetDrawer from '@views/shipment-details/addShipDetDrawer.vue'
  188. import detailsShipDetDrawer from '@views/shipment-details/detailsShipDetDrawer.vue'
  189. import editShipDetDrawer from '@views/shipment-details/editShipDetDrawer.vue'
  190. import declareElementsModal from '@views/shipment-details/declareElementsModal.vue'
  191. import {
  192. shipmentList,
  193. deleteShipment,
  194. submitShipment,
  195. shipmentQueryById,
  196. queryDeclarationElements,
  197. cancelSubmitShipment,
  198. pushShipment,
  199. rePushShipment
  200. } from '@api/document/shipmentList'
  201. export default {
  202. name: 'ShipmentList', // 发运明细列表
  203. mixins: [JeecgListMixin],
  204. components: {
  205. JEllipsis,
  206. moment,
  207. addShipDetDrawer,
  208. detailsShipDetDrawer,
  209. editShipDetDrawer,
  210. declareElementsModal,
  211. cancelSubmitShipment,
  212. pushShipment,
  213. rePushShipment
  214. },
  215. data() {
  216. // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  217. return {
  218. loading: false, // 表格加载
  219. id: '',
  220. // 表头
  221. shipmentListColumns: [
  222. {
  223. title: '单据号',
  224. dataIndex: 'documentNo',
  225. fixed: 'left',
  226. width: 120,
  227. className: 'replacecolor'
  228. },
  229. {
  230. title: '销售订单号',
  231. dataIndex: 'orderNumber',
  232. fixed: 'left',
  233. width: 120,
  234. className: 'replacecolor'
  235. },
  236. {
  237. title: '客户简称',
  238. dataIndex: 'customerAbbreviation',
  239. width: 140,
  240. className: 'replacecolor'
  241. },
  242. {
  243. title: '部门',
  244. dataIndex: 'salesDepartment',
  245. width: 120,
  246. className: 'replacecolor'
  247. },
  248. {
  249. title: '业务员',
  250. dataIndex: 'salesman',
  251. width: 120,
  252. className: 'replacecolor'
  253. },
  254. {
  255. title: '小po',
  256. dataIndex: 'smallPo',
  257. width: 120,
  258. className: 'replacecolor'
  259. },
  260. {
  261. title: 'pack id',
  262. dataIndex: 'packId',
  263. width: 120,
  264. className: 'replacecolor'
  265. },
  266. {
  267. title: '分销点',
  268. dataIndex: 'distributionPoint',
  269. width: 120,
  270. className: 'replacecolor'
  271. },
  272. {
  273. title: '款号',
  274. dataIndex: 'itemNumber',
  275. width: 120,
  276. className: 'replacecolor'
  277. },
  278. {
  279. title: '预发货日期',
  280. dataIndex: 'preDeliveryDate',
  281. width: 120,
  282. customRender: text => {
  283. return moment(text).format('YYYY-MM-DD')
  284. },
  285. className: 'replacecolor'
  286. },
  287. {
  288. title: '预完工日期',
  289. dataIndex: 'preCompletionDate',
  290. width: 120,
  291. customRender: text => {
  292. return moment(text).format('YYYY-MM-DD')
  293. },
  294. className: 'replacecolor'
  295. },
  296. {
  297. title: '存货名称',
  298. dataIndex: 'inventoryName',
  299. width: 140,
  300. className: 'replacecolor'
  301. },
  302. {
  303. title: '整单(合计)',
  304. dataIndex: 'wholeOrderTotal',
  305. width: 120,
  306. className: 'replacecolor'
  307. },
  308. {
  309. title: '英文品名',
  310. dataIndex: 'englishProductName',
  311. width: 120,
  312. className: 'replacecolor'
  313. },
  314. {
  315. title: '单价(销售)',
  316. dataIndex: 'salesUnitPrice',
  317. width: 120,
  318. className: 'replacecolor'
  319. },
  320. {
  321. title: '采购/委外订单号',
  322. dataIndex: 'purOrSubOrder',
  323. width: 120,
  324. className: 'replacecolor'
  325. },
  326. {
  327. title: '订单类型',
  328. dataIndex: 'orderType',
  329. width: 120,
  330. className: 'replacecolor'
  331. },
  332. {
  333. title: '工厂单价(采购/委外单价)',
  334. dataIndex: 'factoryUnitPrice',
  335. width: 120,
  336. className: 'replacecolor'
  337. },
  338. {
  339. title: '申报要素(单证维护)',
  340. dataIndex: 'declarationElements',
  341. width: 120,
  342. className: 'replacecolor'
  343. },
  344. {
  345. title: '套装件数(存货自定义项)',
  346. dataIndex: 'numberOfSets',
  347. width: 120,
  348. className: 'replacecolor'
  349. },
  350. {
  351. title: '是否TC',
  352. dataIndex: 'isTc',
  353. width: 90,
  354. customRender: function(text) {
  355. if (text == '0') {
  356. return '否'
  357. }
  358. if (text == '1') {
  359. return '是'
  360. }
  361. },
  362. className: 'replacecolor'
  363. },
  364. {
  365. title: 'HScode',
  366. dataIndex: 'hsCode',
  367. width: 120,
  368. className: 'replacecolor'
  369. },
  370. {
  371. title: '中文品名',
  372. dataIndex: 'chineseName',
  373. width: 120,
  374. className: 'replacecolor'
  375. },
  376. {
  377. title: '成衣工厂',
  378. dataIndex: 'garmentFactory',
  379. width: 120,
  380. className: 'replacecolor'
  381. },
  382. {
  383. title: '报关单价',
  384. dataIndex: 'customsDeclarationUnitPrice',
  385. width: 90,
  386. className: 'replacecolor'
  387. },
  388. {
  389. title: '推送结果',
  390. dataIndex: 'pushState',
  391. scopedSlots: { customRender: 'pushState' },
  392. fixed: 'right',
  393. width: 90,
  394. className: 'replacecolor'
  395. },
  396. {
  397. title: '单据状态',
  398. dataIndex: 'state',
  399. scopedSlots: { customRender: 'state' },
  400. fixed: 'right',
  401. width: 90,
  402. className: 'replacecolor'
  403. },
  404. {
  405. title: '操作',
  406. dataIndex: 'operation',
  407. scopedSlots: { customRender: 'operationSlot' },
  408. fixed: 'right',
  409. width: 160,
  410. className: 'replacecolor'
  411. }
  412. ],
  413. shipmentListData: [], // 发运明细数据
  414. // 查询条件
  415. queryParam: {
  416. documentNo: '', // 单据号
  417. startTime: '',
  418. endTime: '',
  419. // timeRange: [], // 查询条件 时间范围
  420. preDeliveryDate: '',
  421. salesman: '',
  422. itemNumber: '', // 款号
  423. refer: '',
  424. pageNo: '' // 点击的页数
  425. },
  426. // 分页
  427. pagination: {
  428. // total: '',
  429. // current: 0,
  430. // pageSize: 0
  431. },
  432. dateFormat: 'YYYY-MM-DD'
  433. }
  434. },
  435. created() {
  436. this.getShipmentList() // 渲染 发运明细列表
  437. },
  438. methods: {
  439. // 分页查询 发运明细
  440. getShipmentList() {
  441. this.$nextTick(() => {
  442. shipmentList(this.queryParam).then(res => {
  443. if (res.success) {
  444. this.shipmentListData = res.result.records
  445. console.log('发运明细列表', this.shipmentListData)
  446. this.pagination = {
  447. total: res.result.total,
  448. current: res.result.current,
  449. pageSize: res.result.size
  450. }
  451. // console.log('分页器赋值:', this.pagination.total, this.pagination.current, this.pagination.pageSize)
  452. }
  453. })
  454. })
  455. },
  456. // 分页变化时触发
  457. handleTableChange(pagination, filters, sorter) {
  458. console.log('分页器信息', pagination)
  459. if (Object.keys(sorter).length > 0) {
  460. this.isorter.column = sorter.field
  461. this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
  462. }
  463. this.queryParam.pageNo = pagination.current
  464. this.getShipmentList()
  465. },
  466. // 查询按钮
  467. searchQuery() {
  468. this.getShipmentList()
  469. },
  470. // 重置
  471. searchReset() {
  472. this.queryParam.documentNo = ''
  473. this.queryParam.timeRange = []
  474. this.queryParam.startTime = ''
  475. this.queryParam.endTime = ''
  476. this.queryParam.preDeliveryDate = ''
  477. this.queryParam.salesman = ''
  478. this.queryParam.itemNumber = ''
  479. this.queryParam.refer = ''
  480. this.getShipmentList() // 渲染 发运明细列表
  481. },
  482. // --------------------------------------
  483. // 新增
  484. addShipDet() {
  485. this.$refs.addShipDetDrawer.visible = true
  486. },
  487. // --------------------------------------
  488. // 操作 申报要素
  489. declareElements(record) {
  490. // console.log('点击申报要素hsCode', record.hsCode)
  491. this.$refs.declareElementsModal.declareElementsModVis = true
  492. queryDeclarationElements({ hsCode: record.hsCode, id: record.id }).then(res => {
  493. if (res.success) {
  494. console.log('申报要素主子表数据', res.result)
  495. // console.log('申报要素子表数据', res.result.syDeclarationElementsItemList)
  496. this.$refs.declareElementsModal.declareElements = res.result
  497. // 子表赋值
  498. this.$refs.declareElementsModal.declareElementsData = res.result.syDeclarationElementsItemList
  499. }
  500. })
  501. },
  502. // 操作 详情
  503. details(record) {
  504. console.log('00')
  505. this.$refs.detailsShipDetDrawer.visible = true
  506. console.log('11')
  507. // console.log('点击项的ID', record.id)
  508. shipmentQueryById({ id: record.id }).then(res => {
  509. if (res.success) {
  510. console.log('点击的对象', res.result)
  511. // 把通过id查询到的对象,赋值给子组件
  512. this.$refs.detailsShipDetDrawer.detailsShipDet = res.result
  513. this.$refs.detailsShipDetDrawer.syShippingDetailsItemList = res.result.syShippingDetailsItemList
  514. }
  515. })
  516. },
  517. // 操作 编辑
  518. edit(record) {
  519. this.$refs.editShipDetDrawer.visible = true
  520. shipmentQueryById({ id: record.id }).then(res => {
  521. if (res.success) {
  522. console.log('编辑对象', res.result)
  523. // console.log('子表信息', res.result.syShippingDetailsItemList)
  524. this.$refs.editShipDetDrawer.editShipDet = res.result
  525. this.$refs.editShipDetDrawer.syShippingDetailsItemList = res.result.syShippingDetailsItemList
  526. }
  527. })
  528. },
  529. // 操作 提交
  530. submit(record) {
  531. console.log('点击id:', record.id)
  532. this.$nextTick(() => {
  533. //TODO: 缺少参数 提交类型
  534. submitShipment({ id: record.id, type: '1' }).then(res => {
  535. if (res.success) {
  536. console.log('提交成功,单据状态改为【已提交】')
  537. this.shipmentListData.state == '1'
  538. this.getShipmentList() // 渲染 发运明细列表
  539. this.$message.success('提交成功')
  540. }
  541. })
  542. })
  543. },
  544. // 取消提交
  545. cancelSubmit(record) {
  546. console.log('取消订单id:', record.id)
  547. this.$nextTick(() => {
  548. cancelSubmitShipment({ id: record.id, type: '2' }).then(res => {
  549. if (res.success) {
  550. console.log('取消提交成功,单据状态改为【仅保存】')
  551. this.shipmentListData.state == '0'
  552. this.getShipmentList() // 渲染 发运明细列表
  553. this.$message.success('取消提交成功')
  554. }
  555. })
  556. })
  557. },
  558. // 操作 推送
  559. push(record) {
  560. console.log('推送id:', record.id)
  561. this.$nextTick(() => {
  562. pushShipment({ id: record.id }).then(res => {
  563. if (res.success) {
  564. console.log('推送成功,推送状态【推送成功】')
  565. this.shipmentListData.pushState == '1'
  566. this.getShipmentList() // 渲染 发运明细列表
  567. this.$message.success('推送成功')
  568. }
  569. })
  570. })
  571. },
  572. // 重新推送
  573. rePush(record) {
  574. console.log('重新推送record:', record)
  575. this.$nextTick(() => {
  576. rePushShipment({ id: record.id }).then(res => {
  577. if (res.success) {
  578. console.log('重新推送成功,推送状态【推送成功】')
  579. this.shipmentListData.pushState == '1'
  580. this.getShipmentList() // 渲染 发运明细列表
  581. this.$message.success('重新推送成功')
  582. }
  583. })
  584. })
  585. },
  586. // 操作 删除
  587. handleDelete(record) {
  588. console.log('点击删除项id:', record.id)
  589. this.$nextTick(() => {
  590. deleteShipment({ id: record.id }).then(res => {
  591. console.log('res:', res)
  592. this.getShipmentList() // 渲染 发运明细列表
  593. this.$message.success('删除成功')
  594. })
  595. })
  596. },
  597. onDateChange(value, dateString) {
  598. console.log('查询开始时间', dateString[0], '查询结束时间', dateString[1])
  599. this.queryParam.startTime = dateString[0]
  600. this.queryParam.endTime = dateString[1]
  601. },
  602. onDateOk(value) {
  603. console.log('value', value)
  604. },
  605. deliveryDateChange(value, dateString) {
  606. console.log('预完工日期', dateString)
  607. this.queryParam.preCompletionDate = dateString
  608. }
  609. },
  610. computed: {},
  611. mounted() {}
  612. }
  613. </script>
  614. <style lang="less" scoped>
  615. @import '~@assets/less/common.less';
  616. @import '~@assets/less/overwriter.less';
  617. /deep/ .ant-table-thead > tr > th {
  618. text-align: center;
  619. // font-weight: 700;
  620. }
  621. /deep/ .ant-table-tbody {
  622. text-align: center;
  623. }
  624. // /deep/ th.replacecolor {
  625. // background-color: #ccc;
  626. // }
  627. </style>