shipmentList.vue 34 KB

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