shipmentList.vue 37 KB

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