shipmentList.vue 35 KB

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