shipmentList.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  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="25">
  9. <a-col :md="5" :sm="8">
  10. <a-form-item label="订单号">
  11. <a-input placeholder="请输入订单号" v-model="queryParam.orderNumber"></a-input>
  12. </a-form-item>
  13. </a-col>
  14. <a-col :md="5" :sm="8">
  15. <a-form-item label="款号">
  16. <a-input placeholder="请输入款号" v-model="queryParam.itemNumber"></a-input>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="5" :sm="8">
  20. <a-form-model-item label="类型">
  21. <a-select v-model="queryParam.flourOrGarment">
  22. <a-select-option value="">请选择</a-select-option>
  23. <a-select-option value="1">成衣</a-select-option>
  24. <a-select-option value="0">面辅料</a-select-option>
  25. </a-select>
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col :md="5" :sm="8">
  29. <a-form-item label="预发货日期">
  30. <a-range-picker
  31. :placeholder="['开始时间', '结束时间']"
  32. format="YYYY-MM-DD"
  33. style="width: 100%"
  34. v-model="preDeliveryDate"
  35. @change="deliveryDateChange"
  36. />
  37. </a-form-item>
  38. </a-col>
  39. <template v-if="toggleSearchStatus">
  40. <a-col :md="5" :sm="8">
  41. <a-form-item label="业务员">
  42. <a-input placeholder="请输入业务员" v-model="queryParam.salesman"></a-input>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="5" :sm="8">
  46. <a-form-item label="是否被参照">
  47. <a-select v-model="queryParam.refer">
  48. <a-select-option value="">请选择</a-select-option>
  49. <a-select-option value="0">否</a-select-option>
  50. <a-select-option value="1">是</a-select-option>
  51. </a-select>
  52. </a-form-item>
  53. </a-col>
  54. <a-col :md="5" :sm="8">
  55. <a-form-item label="是否提交">
  56. <a-select v-model="queryParam.submitStatus">
  57. <a-select-option value="">请选择</a-select-option>
  58. <a-select-option value="0">否</a-select-option>
  59. <a-select-option value="1">是</a-select-option>
  60. </a-select>
  61. </a-form-item>
  62. </a-col>
  63. <a-col :md="5" :sm="8">
  64. <a-form-item label="起始时间">
  65. <a-range-picker
  66. style="width: 100%"
  67. v-model="timeRange"
  68. format="YYYY-MM-DD"
  69. :placeholder="['开始时间', '结束时间']"
  70. @change="onDateChange"
  71. @ok="onDateOk"
  72. />
  73. </a-form-item>
  74. </a-col>
  75. <a-col :md="5" :sm="8">
  76. <a-form-item label="供应商">
  77. <a-input placeholder="请输入供应商" v-model="queryParam.supplier"></a-input>
  78. </a-form-item>
  79. </a-col>
  80. <a-col :md="5" :sm="8">
  81. <a-form-model-item label="申报要素是否维护">
  82. <a-select v-model="queryParam.isElement">
  83. <a-select-option value="">请选择</a-select-option>
  84. <a-select-option value="1">已维护</a-select-option>
  85. <a-select-option value="0">未维护</a-select-option>
  86. </a-select>
  87. </a-form-model-item>
  88. </a-col>
  89. </template>
  90. <a-col :md="4" :sm="8">
  91. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  92. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  93. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  94. <a @click="handleToggleSearch" style="margin-left: 8px">
  95. {{ toggleSearchStatus ? '收起' : '展开' }}
  96. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  97. </a>
  98. </span>
  99. </a-col>
  100. </a-row>
  101. </a-form>
  102. </div>
  103. </a-card>
  104. <!-- 操作按钮区域 -->
  105. <a-card :bordered="false" style=" marginTop:10px;">
  106. <div class="table-operator">
  107. <!-- <a-button type="primary" @click.stop="addShipDet" icon="plus">新增</a-button> -->
  108. <a-button type="primary" @click.stop="referOrderDataOpen" icon="plus" >参照订单数据</a-button>
  109. <a-button type="primary" icon="download" @click="handleExportXls('箱单数据')">箱单数据导出</a-button>
  110. <a-button type="primary" icon="download" @click="exportXlsShipment('明细')">明细导出</a-button>
  111. <a-button type="primary" icon="check" @click="submit">批量提交</a-button>
  112. <a-button type="primary" icon="close" @click="cancelSubmit">批量取消提交</a-button>
  113. </div>
  114. <!-- 子表 :row-key="record => record.id" :pagination="ipagination-->
  115. <a-table
  116. v-if="shipmentListData"
  117. bordered
  118. rowKey="itemIds"
  119. :columns="shipmentListColumns"
  120. :data-source="shipmentListData"
  121. :loading="loading"
  122. :pagination="false"
  123. :scroll="{ x: 1500 , y: 500}"
  124. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  125. @change="handleTableChange"
  126. >
  127. <!-- 推送状态 -->
  128. <span slot="pushState" slot-scope="text, record">
  129. <a-tag color="#2db7f5" v-if="record.pushState == '0'">未推送</a-tag>
  130. <a-tag color="#87d068" v-if="record.pushState == '1'">推送成功</a-tag>
  131. <a-tag color="#f50" v-if="record.pushState == '2'">推送失败</a-tag>
  132. </span>
  133. <!-- 单据状态 -->
  134. <span slot="state" slot-scope="text, record">
  135. <a-tag color="orange" v-if="record.submitStatus == '0'">已保存</a-tag>
  136. <a-tag color="green" v-if="record.submitStatus == '1'">已提交</a-tag>
  137. </span>
  138. <!-- 操作 默认按钮 未提交未推送-->
  139. <span slot="operationSlot" slot-scope="text, record">
  140. <a href="javascript:void(0);" @click="declareElements(record)" style="color:green">报关要素</a>
  141. <a-divider type="vertical" />
  142. <a-dropdown>
  143. <a class="ant-dropdown-link">更多<a-icon type="down"/></a>
  144. <!-- 已保存 -->
  145. <a-menu slot="overlay" v-if="record.submitStatus == '0'">
  146. <a-menu-item>
  147. <a @click="details(record)">详情</a>
  148. </a-menu-item>
  149. <a-menu-item>
  150. <a @click="edit(record)">编辑</a>
  151. </a-menu-item>
  152. <a-menu-item>
  153. <a href="javascript:void(0);" @click="itemNumberElement(record)">维护款号成分</a>
  154. </a-menu-item>
  155. <!-- <a-menu-item>
  156. <a-popconfirm title="确定提交吗?" ok-text="是" cancel-text="否" @confirm="submit(record)">
  157. <a href="javascript:void(0);" style="color:green;">提交</a>
  158. </a-popconfirm>
  159. </a-menu-item> -->
  160. <a-menu-item>
  161. <a-popconfirm arrowPointAtCenter title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record)">
  162. <a href="javascript:void(0);" style="color:red;">删除</a>
  163. </a-popconfirm>
  164. </a-menu-item>
  165. <!-- <a-menu-item>
  166. <a href="javascript:void(0);" @click="itemNumberElement(record)">维护款号成分</a>
  167. </a-menu-item> -->
  168. </a-menu>
  169. <!-- 已提交 且 推送成功 -->
  170. <a-menu slot="overlay" v-if="record.pushState == '1' && record.submitStatus == '1'">
  171. <a-menu-item>
  172. <a @click="details(record)">详情</a>
  173. </a-menu-item>
  174. </a-menu>
  175. <!-- 已提交 且 推送失败 -->
  176. <a-menu slot="overlay" v-if="record.pushState == '2' && record.submitStatus == '1'">
  177. <a-menu-item>
  178. <a @click="details(record)">详情</a>
  179. </a-menu-item>
  180. <a-menu-item>
  181. <a-popconfirm title="确定重新推送吗?" ok-text="是" cancel-text="否" @confirm="rePush(record)">
  182. <a href="javascript:void(0);" style="color:green;">重新推送</a>
  183. </a-popconfirm>
  184. </a-menu-item>
  185. </a-menu>
  186. <!-- 已提交 -->
  187. <a-menu slot="overlay" v-if="record.submitStatus == '1'">
  188. <a-menu-item>
  189. <a @click="details(record)">详情</a>
  190. </a-menu-item>
  191. <!-- <a-menu-item>
  192. <a-popconfirm title="确定取消提交吗?" ok-text="是" cancel-text="否" @confirm="cancelSubmit(record)">
  193. <a href="javascript:void(0);" style="color:red;">取消提交</a>
  194. </a-popconfirm>
  195. </a-menu-item> -->
  196. <a-menu-item>
  197. <a-popconfirm title="确定推送吗?" ok-text="是" cancel-text="否" @confirm="push(record)">
  198. <a href="javascript:void(0);" style="color:green;">推送</a>
  199. </a-popconfirm>
  200. </a-menu-item>
  201. </a-menu>
  202. <!-- 未推送 -->
  203. <a-menu slot="overlay" v-if="record.pushState == '0'">
  204. <a-menu-item>
  205. <a @click="details(record)">详情</a>
  206. </a-menu-item>
  207. <a-menu-item>
  208. <a-popconfirm title="确定推送吗?" ok-text="是" cancel-text="否" @confirm="push(record)">
  209. <a href="javascript:void(0);" style="color:green;">推送</a>
  210. </a-popconfirm>
  211. </a-menu-item>
  212. </a-menu>
  213. </a-dropdown>
  214. </span>
  215. </a-table>
  216. </a-card>
  217. <!-- 抽屉 -->
  218. <div>
  219. <!-- <addShipDet-drawer ref="addShipDetDrawer" :fatherList="getShipmentList" @ok="modalFormOk" @close="closeAdd"></addShipDet-drawer> -->
  220. <!-- 参照订单数据 -->
  221. <referOrderData-modal ref="referOrderDataModal" @close="closeAdd" ></referOrderData-modal>
  222. <editShipDet-drawer ref="editShipDetDrawer" :fatherList="getShipmentList" @ok="modalFormOk"></editShipDet-drawer>
  223. <detailsShipDet-drawer ref="detailsShipDetDrawer" @ok="modalFormOk"></detailsShipDet-drawer>
  224. <!-- 申报要素 弹框 -->
  225. <declareElements-modal ref="declareElementsModal" @table="getShipmentList" @close-declare="closeDeclare"></declareElements-modal>
  226. <!-- 维护款号成分 -->
  227. <itemNumEle-modal ref="itemNumEleModal" :fatherList="getShipmentList"></itemNumEle-modal>
  228. </div>
  229. </div>
  230. </template>
  231. <script>
  232. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  233. import JEllipsis from '@/components/jeecg/JEllipsis'
  234. import moment from 'moment'
  235. import { downFile } from '@/api/manage'
  236. import addShipDetDrawer from '@views/shipment-details/addShipDetDrawer.vue'
  237. import detailsShipDetDrawer from '@views/shipment-details/detailsShipDetDrawer.vue'
  238. import editShipDetDrawer from '@views/shipment-details/editShipDetDrawer.vue'
  239. import declareElementsModal from '@views/shipment-details/declareElementsModal.vue'
  240. import ReferOrderDataModal from '@views/shipment-details/referOrderDataModal.vue'
  241. import itemNumEleModal from '@views/shipment-details/itemNumEleModal.vue'
  242. import { randomUUID } from '@/utils/util'
  243. import {
  244. shipmentList,
  245. deleteShipment,
  246. submitShipment,
  247. shipmentQueryById,
  248. queryByDetails,
  249. queryDeclarationElements,
  250. cancelSubmitShipment,
  251. pushShipment,
  252. rePushShipment
  253. } from '@api/document/shipmentList'
  254. export default {
  255. name: 'ShipmentList', // 发运明细列表
  256. mixins: [JeecgListMixin],
  257. components: {
  258. JEllipsis,
  259. moment,
  260. addShipDetDrawer,
  261. detailsShipDetDrawer,
  262. editShipDetDrawer,
  263. declareElementsModal,
  264. ReferOrderDataModal,
  265. cancelSubmitShipment,
  266. pushShipment,
  267. rePushShipment,
  268. itemNumEleModal
  269. },
  270. data() {
  271. let ellipsis = (v,l) => <j-ellipsis value={v} length={l} />
  272. return {
  273. loading: false, // 表格加载
  274. id: '',
  275. monthStartDate:'',//本月1号
  276. nextMonthStartDate:'',//下月1号
  277. nextMonthEndDate:'',//下月最后一天
  278. shipmentListColumns: [
  279. {
  280. title: '账套',
  281. dataIndex: 'account',
  282. width: 90,
  283. // fixed: 'left',
  284. ellipsis: true,
  285. className: 'replacecolor'
  286. },
  287. {
  288. title: '单据号',
  289. dataIndex: 'documentNo',
  290. // fixed: 'left',
  291. align: 'left',
  292. width: 140,
  293. ellipsis: true,
  294. className: 'replacecolor'
  295. },
  296. {
  297. title: '销售订单号',
  298. dataIndex: 'orderNumber',
  299. // fixed: 'left',
  300. customRender: t => ellipsis(t,17),
  301. width: 200,
  302. className: 'replacecolor'
  303. },
  304. {
  305. title: '客户简称',
  306. dataIndex: 'customerAbbreviation',
  307. width: 220,
  308. align: 'left',
  309. ellipsis: true,
  310. className: 'replacecolor'
  311. },
  312. {
  313. title: '部门',
  314. dataIndex: 'salesDepartment',
  315. width: 120,
  316. ellipsis: true,
  317. className: 'replacecolor'
  318. },
  319. {
  320. title: '业务员',
  321. dataIndex: 'salesman',
  322. width: 120,
  323. ellipsis: true,
  324. className: 'replacecolor'
  325. },
  326. {
  327. title: '小po',
  328. dataIndex: 'smallPo',
  329. width: 120,
  330. ellipsis: true,
  331. className: 'replacecolor'
  332. },
  333. {
  334. title: 'pack id',
  335. dataIndex: 'packId',
  336. width: 120,
  337. ellipsis: true,
  338. className: 'replacecolor'
  339. },
  340. {
  341. title: '分销点',
  342. dataIndex: 'distributionPoint',
  343. width: 120,
  344. ellipsis: true,
  345. className: 'replacecolor'
  346. },
  347. {
  348. title: '款号',
  349. dataIndex: 'itemNumber',
  350. width: 180,
  351. ellipsis: true,
  352. className: 'replacecolor'
  353. },
  354. {
  355. title: '数量',
  356. dataIndex: 'shipmentQuantity',
  357. width: 180,
  358. ellipsis: true,
  359. className: 'replacecolor'
  360. },
  361. {
  362. title: '物料成分',
  363. dataIndex: 'materialComposition',
  364. width: 180,
  365. ellipsis: true,
  366. className: 'replacecolor',
  367. ellipsis: true,
  368. },
  369. {
  370. title: '预发货日期',
  371. dataIndex: 'preDeliveryDate',
  372. width: 120,
  373. customRender: text => {
  374. if (text == "" || text == null)
  375. return "";
  376. return moment(text).format('YYYY-MM-DD')
  377. },
  378. ellipsis: true,
  379. className: 'replacecolor'
  380. },
  381. // {
  382. // title: '预完工日期',
  383. // dataIndex: 'preCompletionDate',
  384. // width: 120,
  385. // customRender: text => {
  386. // if (text == "" || text == null)
  387. // return "";
  388. // return moment(text).format('YYYY-MM-DD')
  389. // },
  390. // className: 'replacecolor'
  391. // },
  392. {
  393. title: '存货名称',
  394. dataIndex: 'inventoryName',
  395. width: 240,
  396. className: 'replacecolor',
  397. ellipsis: true,
  398. },
  399. {
  400. title: 'HScode',
  401. dataIndex: 'hsCode',
  402. width: 120,
  403. className: 'replacecolor'
  404. },
  405. {
  406. title: '报关品名',
  407. dataIndex: 'declarationName',
  408. width: 120,
  409. className: 'replacecolor'
  410. },
  411. {
  412. title: '英文品名',
  413. dataIndex: 'englishProductName',
  414. width: 120,
  415. className: 'replacecolor',
  416. customRender: t => ellipsis(t),
  417. },
  418. // {
  419. // title: '单价(销售)',
  420. // dataIndex: 'salesUnitPrice',
  421. // width: 120,
  422. // className: 'replacecolor',
  423. // },
  424. {
  425. title: '采购/委外订单号',
  426. dataIndex: 'purOrSubOrder',
  427. width: 180,
  428. className: 'replacecolor'
  429. },
  430. // {
  431. // title: '订单类型',
  432. // dataIndex: 'orderType',
  433. // width: 120,
  434. // className: 'replacecolor'
  435. // },
  436. // {
  437. // // (采购/委外单价)
  438. // title: '工厂单价',
  439. // dataIndex: 'factoryUnitPrice',
  440. // width: 120,
  441. // className: 'replacecolor'
  442. // },
  443. // {
  444. // title: '申报要素(单证维护)',
  445. // dataIndex: 'declarationElements',
  446. // width: 120,
  447. // className: 'replacecolor'
  448. // },
  449. {
  450. // (存货自定义项)
  451. title: '套装件数',
  452. dataIndex: 'numberOfSets',
  453. width: 120,
  454. className: 'replacecolor'
  455. },
  456. {
  457. title: '是否TC',
  458. dataIndex: 'isTc',
  459. width: 90,
  460. customRender: function(text) {
  461. if (text === '0') {
  462. return '否'
  463. }
  464. if (text === '1') {
  465. return '是'
  466. }
  467. },
  468. className: 'replacecolor'
  469. },
  470. {
  471. title: '成衣工厂',
  472. dataIndex: 'garmentFactory',
  473. width: 120,
  474. className: 'replacecolor'
  475. },
  476. {
  477. title: '报关单价',
  478. dataIndex: 'customsDeclarationUnitPrice',
  479. width: 90,
  480. className: 'replacecolor'
  481. },
  482. {
  483. title: '推送结果',
  484. dataIndex: 'pushState',
  485. scopedSlots: { customRender: 'pushState' },
  486. fixed: 'right',
  487. width: 90,
  488. className: 'replacecolor'
  489. },
  490. {
  491. title: '单据状态',
  492. dataIndex: 'submitStatus',
  493. scopedSlots: { customRender: 'state' },
  494. fixed: 'right',
  495. width: 90,
  496. className: 'replacecolor'
  497. },
  498. {
  499. title: '操作',
  500. dataIndex: 'operation',
  501. scopedSlots: { customRender: 'operationSlot' },
  502. fixed: 'right',
  503. width: 160,
  504. className: 'replacecolor'
  505. }
  506. ],
  507. shipmentListData: [], // 发运明细数据
  508. // 查询条件
  509. queryParam: {
  510. // orderNumber: '', // 订单号
  511. // startTime: '',
  512. // supplier:'',//供应商
  513. // endTime: '',
  514. // preDeliveryDateB:'',//预发货日期开始时间
  515. // preDeliveryDateE:'',//预发货日期结束时间
  516. // // timeRange: [], // 查询条件 时间范围
  517. // // preDeliveryDate: '',
  518. // isElement:'',//申报要素是否维护
  519. // salesman: '',
  520. // itemNumber: '', // 款号
  521. // refer: '',
  522. // flourOrGarment: '', //类型
  523. // pageSize:20,//每页条数
  524. // pageNo: '' // 点击的页数
  525. },
  526. selectedRowKeys:[],
  527. selectedRows:[],
  528. timeRange:[],//起始时间
  529. preDeliveryDate:[],//预发货日期
  530. pagination: {
  531. // total: '',
  532. // current: 0,
  533. // pageSize: 0
  534. },
  535. dateFormat: 'YYYY-MM-DD',
  536. }
  537. },
  538. created() {
  539. // this.getShipmentList() // 渲染 发运明细列表
  540. this.defalutDate()
  541. },
  542. methods: {
  543. moment,
  544. //默认预发货日期
  545. defalutDate(){
  546. var now = new Date(); //当前日期
  547. var nowMonth = now.getMonth(); //当前月
  548. var nextMonth = nowMonth+1; //下个月
  549. var nowYear = now.getFullYear(); //当前年
  550. this.monthStartDate = moment(new Date(nowYear, nowMonth, 1)).format('YYYY-MM-DD');
  551. this.nextMonthStartDate = moment(new Date(nowYear, nextMonth, 1)).format('YYYY-MM-DD');
  552. if([1, 3, 5, 7, 8, 10, 12].indexOf(nextMonth+1) > -1){
  553. this.nextMonthEndDate = moment(new Date(nowYear, nextMonth, 31)).format('YYYY-MM-DD');
  554. }else {
  555. this.nextMonthEndDate = moment(new Date(nowYear, nextMonth, 30)).format('YYYY-MM-DD');
  556. }
  557. this.preDeliveryDate.push(this.nextMonthStartDate,this.nextMonthEndDate)
  558. this.queryParam.preDeliveryDateB = this.nextMonthStartDate
  559. this.queryParam.preDeliveryDateE = this.nextMonthEndDate
  560. },
  561. // 分页查询 发运明细
  562. async getShipmentList() {
  563. this.loading = true
  564. await shipmentList(this.queryParam).then(res => {
  565. if (res.success) {
  566. this.loading = false
  567. this.shipmentListData = res.result.records
  568. for (var i=0; i<this.shipmentListData.length; i++){
  569. this.shipmentListData.randomId = randomUUID();
  570. }
  571. this.pagination = {
  572. total: res.result.total,
  573. current: res.result.current,
  574. pageSize: res.result.size
  575. }
  576. }else {
  577. this.$message.error(res.message)
  578. this.loading = false
  579. }
  580. })
  581. },
  582. async closeDeclare(){
  583. await this.getShipmentList()
  584. // this.getShipmentList()
  585. var cc = []
  586. // for(var i= 0;i<this.shipmentListData)
  587. this.shipmentListData.map(item =>{
  588. this.selectedRows.map(item1 =>{
  589. if(item.itemIds == item1.itemIds){
  590. cc.push(item)
  591. }
  592. })
  593. })
  594. this.selectedRows = cc
  595. cc.map(item => this.selectedRowKeys.push(item.itemIds))
  596. },
  597. // // 新增
  598. // addShipDet() {
  599. // this.$refs.addShipDetDrawer.syShippingDetailsItemList = [];
  600. // this.$refs.addShipDetDrawer.visible = true
  601. // },
  602. //参照订单数据
  603. referOrderDataOpen(){
  604. this.$refs.referOrderDataModal.referOrderDataModVis = true
  605. // this.defalutDate()
  606. this.$refs.referOrderDataModal.range.push(this.monthStartDate)
  607. this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
  608. this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
  609. },
  610. // //参照数据重置,恢复默认值
  611. // defaultReset() {
  612. // this.defalutDate()
  613. // this.$refs.referOrderDataModal.range.push(this.monthStartDate)
  614. // this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
  615. // this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
  616. // },
  617. // 申报要素
  618. declareElements(record) {
  619. if (record.inventoryName == ""){
  620. this.$message.error('当前行存货名称为空,无法维护报关要素');
  621. }else{
  622. this.$refs.declareElementsModal.declareElementsModVis = true
  623. queryDeclarationElements({
  624. id: record.elementsId,
  625. syShippingids:record.itemIds
  626. }).then(res => {
  627. if (res.success) {
  628. // console.log('申报要素子表数据', res.result.syDeclarationElementsItemList)
  629. res.result['itemIds'] = record.itemIds;
  630. this.$refs.declareElementsModal.declareElements = res.result
  631. // 子表赋值
  632. this.$refs.declareElementsModal.declareElementsData = res.result.syDeclarationElementsItemList
  633. if(record.pushState == '1' && record.submitStatus == '1'){
  634. this.$refs.declareElementsModal.pushState = true
  635. }
  636. }
  637. })
  638. }
  639. },
  640. // 维护款号成分
  641. itemNumberElement(record) {
  642. this.$refs.itemNumEleModal.itemNumEleModVis = true
  643. this.$refs.itemNumEleModal.editItemNumber.itemIds = record.itemIds
  644. this.$refs.itemNumEleModal.editItemNumber.itemNumber = record.itemNumber
  645. this.$refs.itemNumEleModal.editItemNumber.materialComposition = record.materialComposition
  646. this.$refs.itemNumEleModal.editItemNumber.isTc = record.isTc
  647. if(record.materialComposition == '' || !record.materialComposition){
  648. this.$refs.itemNumEleModal.editItemNumber.materialComposition = record.specificationAndModel
  649. }
  650. },
  651. // 导出
  652. handleExportXls(fileName) {
  653. downFile('/shippingDetails/syShippingDetails/exportXls',this.queryParam).then(data => {
  654. if (!data) {
  655. this.$message.warning('文件下载失败')
  656. return
  657. }
  658. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  659. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  660. } else {
  661. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  662. let link = document.createElement('a')
  663. link.style.display = 'none'
  664. link.href = url
  665. link.setAttribute('download', fileName + '.xlsx')
  666. document.body.appendChild(link)
  667. link.click()
  668. document.body.removeChild(link) // 下载完成移除元素
  669. window.URL.revokeObjectURL(url) // 释放掉blob对象
  670. }
  671. })
  672. },
  673. //明细导出
  674. exportXlsShipment(fileName){
  675. downFile('/shippingDetails/syShippingDetails/exportXlsShipping',this.queryParam).then(data => {
  676. if (!data) {
  677. this.$message.warning('文件下载失败')
  678. return
  679. }
  680. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  681. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  682. } else {
  683. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  684. let link = document.createElement('a')
  685. link.style.display = 'none'
  686. link.href = url
  687. link.setAttribute('download', fileName + '.xls')
  688. document.body.appendChild(link)
  689. link.click()
  690. document.body.removeChild(link) // 下载完成移除元素
  691. window.URL.revokeObjectURL(url) // 释放掉blob对象
  692. }
  693. })
  694. },
  695. // 编辑
  696. edit(record) {
  697. this.$refs.editShipDetDrawer.visible = true
  698. queryByDetails({ id: record.id,itemIds: record.itemIds }).then(res => {
  699. if (res.success) {
  700. // console.log('编辑对象', res.result)
  701. this.$refs.editShipDetDrawer.editShipDet = res.result
  702. res.result.syShippingDetailsItemList.map(item =>{
  703. item.manualYarnFlag = res.result.syShippingDetailsItemList[0].manualYarnFlag
  704. item.customsDeclarationUnitPrice = item.salesUnitPrice - item.ymoney
  705. if(item.manualYarnFlag === 0){
  706. item.manualYarnUnitPrice = null
  707. item.manualYarnProportion = null
  708. this.$refs.editShipDetDrawer.manualYarnDisabled = true
  709. this.$forceUpdate()
  710. }else {
  711. this.$refs.editShipDetDrawer.manualYarnDisabled = false
  712. }
  713. })
  714. this.$refs.editShipDetDrawer.syShippingDetailsItemList = res.result.syShippingDetailsItemList
  715. this.$refs.editShipDetDrawer.readyFabric = this.queryParam.flourOrGarment
  716. }
  717. })
  718. },
  719. // 详情
  720. details(record) {
  721. this.$refs.detailsShipDetDrawer.visible = true
  722. // console.log('点击项的ID', record.id)
  723. queryByDetails({ id: record.id,itemIds: record.itemIds}).then(res => {
  724. if (res.success) {
  725. console.log('点击的对象', res.result)
  726. // 把通过id查询到的对象,赋值给子组件
  727. this.$refs.detailsShipDetDrawer.detailsShipDet = res.result
  728. this.$refs.detailsShipDetDrawer.syShippingDetailsItemList = res.result.syShippingDetailsItemList
  729. }
  730. })
  731. },
  732. // 提交
  733. submit() {
  734. // console.log('点击id:', record.id)
  735. this.$nextTick(() => {
  736. for(var i =0;i<this.selectedRows.length;i++){
  737. var selectRow = this.selectedRows[i]
  738. if(selectRow.elementsId===''||!selectRow.elementsId){
  739. this.$message.error('勾选的第'+(i+1)+'行数据报关要素未填写,不可提交!')
  740. return
  741. }
  742. }
  743. submitShipment({ submitListId: this.selectedRowKeys, type: '1' }).then(res => {
  744. if (res.success) {
  745. console.log('提交成功,单据状态改为【已提交】')
  746. this.shipmentListData.submitStatus = '1'
  747. this.selectedRowKeys =[]
  748. this.getShipmentList() // 渲染 发运明细列表
  749. this.$message.success('提交成功')
  750. }else {
  751. this.$message.error(res.message)
  752. }
  753. })
  754. })
  755. },
  756. // 取消提交
  757. cancelSubmit(record) {
  758. console.log('取消订单id:', record.id)
  759. this.$nextTick(() => {
  760. cancelSubmitShipment({ submitListId: this.selectedRowKeys, type: '2' }).then(res => {
  761. if (res.success) {
  762. console.log('取消提交成功,单据状态改为【仅保存】')
  763. this.shipmentListData.submitStatus = '0'
  764. this.selectedRowKeys = []
  765. this.getShipmentList() // 渲染 发运明细列表
  766. this.$message.success('取消提交成功')
  767. }else {
  768. this.$message.error(res.message)
  769. }
  770. })
  771. })
  772. },
  773. // 推送
  774. push(record) {
  775. console.log('推送id:', record.id)
  776. this.$nextTick(() => {
  777. if(this.queryParam.flourOrGarment == '1'){
  778. this.$message.error("成衣不可推送!")
  779. }else {
  780. pushShipment({ id: record.id }).then(res => {
  781. if (res.success) {
  782. console.log('推送成功,推送状态【推送成功】')
  783. this.shipmentListData.pushState = '1'
  784. this.getShipmentList() // 渲染 发运明细列表
  785. this.$message.success('推送成功')
  786. }else {
  787. this.$message.error(res.message)
  788. }
  789. })
  790. }
  791. })
  792. },
  793. // 重新推送
  794. rePush(record) {
  795. console.log('重新推送record:', record)
  796. this.$nextTick(() => {
  797. if(this.queryParam.flourOrGarment == '1'){
  798. this.$message.error("成衣不可推送!")
  799. }else {
  800. rePushShipment({ id: record.id }).then(res => {
  801. if (res.success) {
  802. console.log('重新推送成功,推送状态【推送成功】')
  803. this.shipmentListData.pushState = '1'
  804. this.getShipmentList() // 渲染 发运明细列表
  805. this.$message.success('重新推送成功')
  806. }else {
  807. this.$message.error(res.message)
  808. }
  809. })
  810. }
  811. })
  812. },
  813. // 删除
  814. handleDelete(record) {
  815. console.log('点击删除项id:', record.id)
  816. this.$nextTick(() => {
  817. deleteShipment({ id: record.id,itemIds: record.itemIds }).then(res => {
  818. console.log('res:', res)
  819. this.getShipmentList() // 渲染 发运明细列表
  820. this.$message.success('删除成功')
  821. })
  822. })
  823. },
  824. onDateChange(value, dateString) {
  825. console.log('查询开始时间', dateString[0], '查询结束时间', dateString[1])
  826. this.queryParam.startTime = dateString[0]
  827. this.queryParam.endTime = dateString[1]
  828. },
  829. onDateOk(value) {
  830. console.log('value', value)
  831. },
  832. deliveryDateChange(value, dateString) {
  833. console.log('预发货日期', dateString)
  834. this.queryParam.preDeliveryDateB = dateString[0]
  835. this.queryParam.preDeliveryDateE = dateString[1]
  836. },
  837. searchQuery() {
  838. this.toggleSearchStatus = false
  839. if(this.queryParam.flourOrGarment === '' || !this.queryParam.hasOwnProperty('flourOrGarment')){
  840. this.$message.error('请选择查询类型!');
  841. }else if(this.queryParam.flourOrGarment == '0' && this.preDeliveryDate.length == 0){
  842. this.$message.error('请选择预发货时间!');
  843. }else{
  844. if(this.preDeliveryDate.length ==2){
  845. var separator = "-"; //日期分隔符
  846. var startDates = this.queryParam.preDeliveryDateB.split(separator);
  847. var endDates = this.queryParam.preDeliveryDateE.split(separator);
  848. var startDate = new Date(startDates[0], startDates[1]-1, startDates[2]);
  849. var endDate = new Date(endDates[0], endDates[1]-1, endDates[2]);
  850. var timeInterval= parseInt(Math.abs(endDate - startDate ) / 1000 / 60 / 60 /24) + 1;
  851. if(timeInterval > 31){
  852. this.$message.error('预发货时间区间超过31天,请重新选择!');
  853. }else {
  854. this.getShipmentList()
  855. }
  856. }else{
  857. this.getShipmentList()
  858. }
  859. }
  860. },
  861. searchReset() {
  862. // this.queryParam.isElement = ''
  863. // this.queryParam.orderNumber = ''
  864. // this.queryParam.supplier = ''
  865. this.queryParam = {}
  866. this.timeRange = []
  867. this.preDeliveryDate = []
  868. this.defalutDate()
  869. // this.queryParam.startTime = ''
  870. // this.queryParam.endTime = ''
  871. // this.queryParam.preDeliveryDateB = ''
  872. // this.queryParam.preDeliveryDateE = ''
  873. // this.queryParam.salesman = ''
  874. // this.queryParam.itemNumber = ''
  875. // this.queryParam.refer = ''
  876. // this.queryParam.isTc = ''
  877. // this.queryParam.pageSize = 20
  878. this.selectedRows = []
  879. this.selectedRowKeys = []
  880. // this.queryParam.flourOrGarment = '', //类型
  881. this.shipmentListData = [] // 渲染 发运明细列表
  882. },
  883. //选中行
  884. onSelectChange(keys,rows){
  885. this.selectedRowKeys = keys;
  886. this.selectedRows = rows;
  887. },
  888. // 分页变化时触发
  889. handleTableChange(pagination, filters, sorter) {
  890. this.queryParam.pageNo = pagination.current
  891. this.getShipmentList()
  892. },
  893. //关闭新增弹窗
  894. async closeAdd(data){
  895. this.queryParam ={}
  896. this.queryParam.flourOrGarment = data
  897. this.timeRange = []
  898. this.preDeliveryDate = []
  899. // this.shipmentListData = [] // 渲染 发运明细列表
  900. await this.getShipmentList()
  901. this.queryParam = {}
  902. this.defalutDate()
  903. }
  904. }
  905. }
  906. </script>
  907. <style lang="less" scoped>
  908. @import '~@assets/less/common.less';
  909. @import '~@assets/less/overwriter.less';
  910. /deep/ .ant-table-thead > tr > th {
  911. text-align: center;
  912. // font-weight: 700;
  913. }
  914. /deep/ .ant-table-tbody {
  915. text-align: center;
  916. }
  917. // /deep/ th.replacecolor {
  918. // background-color: #ccc;
  919. // }
  920. // /deep/ .ant-form-item {
  921. // // margin-bottom: 0 !important;
  922. // }
  923. </style>