shipmentList.vue 32 KB

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