shipmentList.vue 20 KB

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