shipmentList.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  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. shipmentListColumns: [
  258. {
  259. title: '账套',
  260. dataIndex: 'account',
  261. width: 90,
  262. fixed: 'left',
  263. ellipsis: true,
  264. className: 'replacecolor'
  265. },
  266. {
  267. title: '单据号',
  268. dataIndex: 'documentNo',
  269. fixed: 'left',
  270. align: 'left',
  271. width: 140,
  272. ellipsis: true,
  273. className: 'replacecolor'
  274. },
  275. {
  276. title: '销售订单号',
  277. dataIndex: 'orderNumber',
  278. // fixed: 'left',
  279. customRender: t => ellipsis(t,17),
  280. width: 200,
  281. className: 'replacecolor'
  282. },
  283. {
  284. title: '客户简称',
  285. dataIndex: 'customerAbbreviation',
  286. width: 220,
  287. align: 'left',
  288. ellipsis: true,
  289. className: 'replacecolor'
  290. },
  291. {
  292. title: '部门',
  293. dataIndex: 'salesDepartment',
  294. width: 120,
  295. ellipsis: true,
  296. className: 'replacecolor'
  297. },
  298. {
  299. title: '业务员',
  300. dataIndex: 'salesman',
  301. width: 120,
  302. ellipsis: true,
  303. className: 'replacecolor'
  304. },
  305. {
  306. title: '小po',
  307. dataIndex: 'smallPo',
  308. width: 120,
  309. ellipsis: true,
  310. className: 'replacecolor'
  311. },
  312. {
  313. title: 'pack id',
  314. dataIndex: 'packId',
  315. width: 120,
  316. ellipsis: true,
  317. className: 'replacecolor'
  318. },
  319. {
  320. title: '分销点',
  321. dataIndex: 'distributionPoint',
  322. width: 120,
  323. ellipsis: true,
  324. className: 'replacecolor'
  325. },
  326. {
  327. title: '款号',
  328. dataIndex: 'itemNumber',
  329. width: 180,
  330. ellipsis: true,
  331. className: 'replacecolor'
  332. },
  333. {
  334. title: '数量',
  335. dataIndex: 'shipmentQuantity',
  336. width: 180,
  337. ellipsis: true,
  338. className: 'replacecolor'
  339. },
  340. {
  341. title: '物料成分',
  342. dataIndex: 'materialComposition',
  343. width: 180,
  344. ellipsis: true,
  345. className: 'replacecolor',
  346. ellipsis: true,
  347. },
  348. {
  349. title: '预发货日期',
  350. dataIndex: 'preDeliveryDate',
  351. width: 120,
  352. customRender: text => {
  353. if (text == "" || text == null)
  354. return "";
  355. return moment(text).format('YYYY-MM-DD')
  356. },
  357. ellipsis: true,
  358. className: 'replacecolor'
  359. },
  360. // {
  361. // title: '预完工日期',
  362. // dataIndex: 'preCompletionDate',
  363. // width: 120,
  364. // customRender: text => {
  365. // if (text == "" || text == null)
  366. // return "";
  367. // return moment(text).format('YYYY-MM-DD')
  368. // },
  369. // className: 'replacecolor'
  370. // },
  371. {
  372. title: '存货名称',
  373. dataIndex: 'inventoryName',
  374. width: 240,
  375. className: 'replacecolor',
  376. ellipsis: true,
  377. },
  378. // {
  379. // title: '英文品名',
  380. // dataIndex: 'englishProductName',
  381. // width: 120,
  382. // className: 'replacecolor',
  383. // customRender: t => ellipsis(t),
  384. // },
  385. // {
  386. // title: '单价(销售)',
  387. // dataIndex: 'salesUnitPrice',
  388. // width: 120,
  389. // className: 'replacecolor',
  390. // },
  391. {
  392. title: '采购/委外订单号',
  393. dataIndex: 'purOrSubOrder',
  394. width: 180,
  395. className: 'replacecolor'
  396. },
  397. // {
  398. // title: '订单类型',
  399. // dataIndex: 'orderType',
  400. // width: 120,
  401. // className: 'replacecolor'
  402. // },
  403. // {
  404. // // (采购/委外单价)
  405. // title: '工厂单价',
  406. // dataIndex: 'factoryUnitPrice',
  407. // width: 120,
  408. // className: 'replacecolor'
  409. // },
  410. // {
  411. // title: '申报要素(单证维护)',
  412. // dataIndex: 'declarationElements',
  413. // width: 120,
  414. // className: 'replacecolor'
  415. // },
  416. {
  417. // (存货自定义项)
  418. title: '套装件数',
  419. dataIndex: 'numberOfSets',
  420. width: 120,
  421. className: 'replacecolor'
  422. },
  423. {
  424. title: '是否TC',
  425. dataIndex: 'isTc',
  426. width: 90,
  427. customRender: function(text) {
  428. if (text === '0') {
  429. return '否'
  430. }
  431. if (text === '1') {
  432. return '是'
  433. }
  434. },
  435. className: 'replacecolor'
  436. },
  437. // {
  438. // title: 'HScode',
  439. // dataIndex: 'hsCode',
  440. // width: 120,
  441. // className: 'replacecolor'
  442. // },
  443. // {
  444. // title: '中文品名',
  445. // dataIndex: 'chineseName',
  446. // width: 120,
  447. // className: 'replacecolor'
  448. // },
  449. {
  450. title: '成衣工厂',
  451. dataIndex: 'garmentFactory',
  452. width: 120,
  453. className: 'replacecolor'
  454. },
  455. {
  456. title: '报关单价',
  457. dataIndex: 'customsDeclarationUnitPrice',
  458. width: 90,
  459. className: 'replacecolor'
  460. },
  461. {
  462. title: '推送结果',
  463. dataIndex: 'pushState',
  464. scopedSlots: { customRender: 'pushState' },
  465. fixed: 'right',
  466. width: 90,
  467. className: 'replacecolor'
  468. },
  469. {
  470. title: '单据状态',
  471. dataIndex: 'submitStatus',
  472. scopedSlots: { customRender: 'state' },
  473. fixed: 'right',
  474. width: 90,
  475. className: 'replacecolor'
  476. },
  477. {
  478. title: '操作',
  479. dataIndex: 'operation',
  480. scopedSlots: { customRender: 'operationSlot' },
  481. fixed: 'right',
  482. width: 160,
  483. className: 'replacecolor'
  484. }
  485. ],
  486. shipmentListData: [], // 发运明细数据
  487. // 查询条件
  488. queryParam: {
  489. orderNumber: '', // 订单号
  490. startTime: '',
  491. supplier:'',//供应商
  492. endTime: '',
  493. preDeliveryDateB:'',//预发货日期开始时间
  494. preDeliveryDateE:'',//预发货日期结束时间
  495. // timeRange: [], // 查询条件 时间范围
  496. // preDeliveryDate: '',
  497. salesman: '',
  498. itemNumber: '', // 款号
  499. refer: '',
  500. flourOrGarment: '', //类型
  501. pageSize:20,//每页条数
  502. pageNo: '' // 点击的页数
  503. },
  504. selectedRowKeys:[],
  505. selectedRows:[],
  506. timeRange:[],//起始时间
  507. preDeliveryDate:[],//预发货日期
  508. pagination: {
  509. // total: '',
  510. // current: 0,
  511. // pageSize: 0
  512. },
  513. dateFormat: 'YYYY-MM-DD',
  514. }
  515. },
  516. created() {
  517. // this.getShipmentList() // 渲染 发运明细列表
  518. },
  519. methods: {
  520. moment,
  521. //默认预发货日期
  522. defalutDate(){
  523. var now = new Date(); //当前日期
  524. var nowMonth = now.getMonth(); //当前月
  525. var nowYear = now.getFullYear(); //当前年
  526. this.monthStartDate = moment(new Date(nowYear, nowMonth, 1)).format('YYYY-MM-DD');
  527. },
  528. // 分页查询 发运明细
  529. async getShipmentList() {
  530. await shipmentList(this.queryParam)
  531. .then(res => {
  532. if (res.success) {
  533. this.shipmentListData = res.result.records
  534. for (var i=0; i<this.shipmentListData.length; i++){
  535. this.shipmentListData.randomId = randomUUID();
  536. }
  537. this.pagination = {
  538. total: res.result.total,
  539. current: res.result.current,
  540. pageSize: res.result.size
  541. }
  542. }
  543. return this.shipmentListData
  544. })
  545. },
  546. async closeDeclare(){
  547. await this.getShipmentList()
  548. // this.getShipmentList()
  549. var cc = []
  550. // for(var i= 0;i<this.shipmentListData)
  551. this.shipmentListData.map(item =>{
  552. this.selectedRows.map(item1 =>{
  553. if(item.itemIds == item1.itemIds){
  554. cc.push(item)
  555. }
  556. })
  557. })
  558. this.selectedRows = cc
  559. cc.map(item => this.selectedRowKeys.push(item.itemIds))
  560. },
  561. // // 新增
  562. // addShipDet() {
  563. // this.$refs.addShipDetDrawer.syShippingDetailsItemList = [];
  564. // this.$refs.addShipDetDrawer.visible = true
  565. // },
  566. //参照订单数据
  567. referOrderDataOpen(){
  568. this.$refs.referOrderDataModal.referOrderDataModVis = true
  569. this.defalutDate()
  570. this.$refs.referOrderDataModal.range.push(this.monthStartDate)
  571. this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
  572. this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
  573. },
  574. //参照数据重置,恢复默认值
  575. defaultReset() {
  576. this.defalutDate()
  577. this.$refs.referOrderDataModal.range.push(this.monthStartDate)
  578. this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
  579. this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
  580. },
  581. // 申报要素
  582. declareElements(record) {
  583. if (record.inventoryName == ""){
  584. this.$message.error('当前行存货名称为空,无法维护报关要素');
  585. }else{
  586. this.$refs.declareElementsModal.declareElementsModVis = true
  587. queryDeclarationElements({
  588. id: record.elementsId,
  589. syShippingids:record.itemIds
  590. }).then(res => {
  591. if (res.success) {
  592. // console.log('申报要素子表数据', res.result.syDeclarationElementsItemList)
  593. res.result['itemIds'] = record.itemIds;
  594. this.$refs.declareElementsModal.declareElements = res.result
  595. // 子表赋值
  596. this.$refs.declareElementsModal.declareElementsData = res.result.syDeclarationElementsItemList
  597. if(record.pushState == '1' && record.submitStatus == '1'){
  598. this.$refs.declareElementsModal.pushState = true
  599. }
  600. }
  601. })
  602. }
  603. },
  604. // 维护款号成分
  605. itemNumberElement(record) {
  606. this.$refs.itemNumEleModal.itemNumEleModVis = true
  607. this.$refs.itemNumEleModal.editItemNumber.itemIds = record.itemIds
  608. this.$refs.itemNumEleModal.editItemNumber.itemNumber = record.itemNumber
  609. this.$refs.itemNumEleModal.editItemNumber.materialComposition = record.materialComposition
  610. this.$refs.itemNumEleModal.editItemNumber.isTc = record.isTc
  611. if(record.materialComposition == '' || !record.materialComposition){
  612. this.$refs.itemNumEleModal.editItemNumber.materialComposition = record.specificationAndModel
  613. }
  614. },
  615. // 导出
  616. handleExportXls(fileName) {
  617. downFile('/shippingDetails/syShippingDetails/exportXls',this.queryParam).then(data => {
  618. if (!data) {
  619. this.$message.warning('文件下载失败')
  620. return
  621. }
  622. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  623. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  624. } else {
  625. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  626. let link = document.createElement('a')
  627. link.style.display = 'none'
  628. link.href = url
  629. link.setAttribute('download', fileName + '.xls')
  630. document.body.appendChild(link)
  631. link.click()
  632. document.body.removeChild(link) // 下载完成移除元素
  633. window.URL.revokeObjectURL(url) // 释放掉blob对象
  634. }
  635. })
  636. },
  637. // 编辑
  638. edit(record) {
  639. this.$refs.editShipDetDrawer.visible = true
  640. queryByDetails({ id: record.id,itemIds: record.itemIds }).then(res => {
  641. if (res.success) {
  642. // console.log('编辑对象', res.result)
  643. this.$refs.editShipDetDrawer.editShipDet = res.result
  644. res.result.syShippingDetailsItemList.map(item =>{
  645. item.manualYarnFlag = res.result.syShippingDetailsItemList[0].manualYarnFlag
  646. item.customsDeclarationUnitPrice = item.salesUnitPrice - item.ymoney
  647. if(item.manualYarnFlag === 0){
  648. item.manualYarnUnitPrice = null
  649. item.manualYarnProportion = null
  650. this.$refs.editShipDetDrawer.manualYarnDisabled = true
  651. this.$forceUpdate()
  652. }else {
  653. this.$refs.editShipDetDrawer.manualYarnDisabled = false
  654. }
  655. })
  656. this.$refs.editShipDetDrawer.syShippingDetailsItemList = res.result.syShippingDetailsItemList
  657. }
  658. })
  659. },
  660. // 详情
  661. details(record) {
  662. this.$refs.detailsShipDetDrawer.visible = true
  663. // console.log('点击项的ID', record.id)
  664. queryByDetails({ id: record.id,itemIds: record.itemIds}).then(res => {
  665. if (res.success) {
  666. console.log('点击的对象', res.result)
  667. // 把通过id查询到的对象,赋值给子组件
  668. this.$refs.detailsShipDetDrawer.detailsShipDet = res.result
  669. this.$refs.detailsShipDetDrawer.syShippingDetailsItemList = res.result.syShippingDetailsItemList
  670. }
  671. })
  672. },
  673. // 提交
  674. submit() {
  675. // console.log('点击id:', record.id)
  676. this.$nextTick(() => {
  677. for(var i =0;i<this.selectedRows.length;i++){
  678. var selectRow = this.selectedRows[i]
  679. if(selectRow.elementsId===''||!selectRow.elementsId){
  680. this.$message.error('勾选的第'+(i+1)+'行数据报关要素未填写,不可提交!')
  681. return
  682. }
  683. }
  684. submitShipment({ submitListId: this.selectedRowKeys, type: '1' }).then(res => {
  685. if (res.success) {
  686. console.log('提交成功,单据状态改为【已提交】')
  687. this.shipmentListData.submitStatus = '1'
  688. this.selectedRowKeys =[]
  689. this.getShipmentList() // 渲染 发运明细列表
  690. this.$message.success('提交成功')
  691. }else {
  692. this.$message.error(res.message)
  693. }
  694. })
  695. })
  696. },
  697. // 取消提交
  698. cancelSubmit(record) {
  699. console.log('取消订单id:', record.id)
  700. this.$nextTick(() => {
  701. cancelSubmitShipment({ submitListId: this.selectedRowKeys, type: '2' }).then(res => {
  702. if (res.success) {
  703. console.log('取消提交成功,单据状态改为【仅保存】')
  704. this.shipmentListData.submitStatus = '0'
  705. this.selectedRowKeys = []
  706. this.getShipmentList() // 渲染 发运明细列表
  707. this.$message.success('取消提交成功')
  708. }else {
  709. this.$message.error(res.message)
  710. }
  711. })
  712. })
  713. },
  714. // 推送
  715. push(record) {
  716. console.log('推送id:', record.id)
  717. this.$nextTick(() => {
  718. pushShipment({ id: record.id }).then(res => {
  719. if (res.success) {
  720. console.log('推送成功,推送状态【推送成功】')
  721. this.shipmentListData.pushState = '1'
  722. this.getShipmentList() // 渲染 发运明细列表
  723. this.$message.success('推送成功')
  724. }
  725. })
  726. })
  727. },
  728. // 重新推送
  729. rePush(record) {
  730. console.log('重新推送record:', record)
  731. this.$nextTick(() => {
  732. rePushShipment({ id: record.id }).then(res => {
  733. if (res.success) {
  734. console.log(res)
  735. console.log('重新推送成功,推送状态【推送成功】')
  736. this.shipmentListData.pushState = '1'
  737. this.getShipmentList() // 渲染 发运明细列表
  738. this.$message.success('重新推送成功')
  739. }
  740. })
  741. })
  742. },
  743. // 删除
  744. handleDelete(record) {
  745. console.log('点击删除项id:', record.id)
  746. this.$nextTick(() => {
  747. deleteShipment({ id: record.id,itemIds: record.itemIds }).then(res => {
  748. console.log('res:', res)
  749. this.getShipmentList() // 渲染 发运明细列表
  750. this.$message.success('删除成功')
  751. })
  752. })
  753. },
  754. onDateChange(value, dateString) {
  755. console.log('查询开始时间', dateString[0], '查询结束时间', dateString[1])
  756. this.queryParam.startTime = dateString[0]
  757. this.queryParam.endTime = dateString[1]
  758. },
  759. onDateOk(value) {
  760. console.log('value', value)
  761. },
  762. deliveryDateChange(value, dateString) {
  763. console.log('预发货日期', dateString)
  764. this.queryParam.preDeliveryDateB = dateString[0]
  765. this.queryParam.preDeliveryDateE = dateString[1]
  766. },
  767. searchQuery() {
  768. if(this.queryParam.flourOrGarment === ''){
  769. this.$message.error('请选择查询类型!');
  770. }else {
  771. this.queryParam.pageNo = ''
  772. this.queryParam.pageSize = 20
  773. this.getShipmentList()
  774. }
  775. },
  776. searchReset() {
  777. this.queryParam.orderNumber = ''
  778. this.queryParam.supplier = ''
  779. this.timeRange = []
  780. this.preDeliveryDate = []
  781. this.queryParam.startTime = ''
  782. this.queryParam.endTime = ''
  783. this.queryParam.preDeliveryDateB = ''
  784. this.queryParam.preDeliveryDateE = ''
  785. this.queryParam.salesman = ''
  786. this.queryParam.itemNumber = ''
  787. this.queryParam.refer = ''
  788. this.queryParam.isTc = ''
  789. this.queryParam.pageSize = 20
  790. this.selectedRows = []
  791. this.selectedRowKeys = []
  792. this.queryParam.flourOrGarment = '', //类型
  793. this.shipmentListData = [] // 渲染 发运明细列表
  794. },
  795. //选中行
  796. onSelectChange(keys,rows){
  797. this.selectedRowKeys = keys;
  798. this.selectedRows = rows;
  799. },
  800. // 分页变化时触发
  801. handleTableChange(pagination, filters, sorter) {
  802. this.queryParam.pageNo = pagination.current
  803. this.getShipmentList()
  804. },
  805. //关闭新增弹窗
  806. closeAdd(){
  807. this.queryParam.orderNumber = ''
  808. this.queryParam.supplier = ''
  809. this.timeRange = []
  810. this.queryParam.startTime = ''
  811. this.queryParam.endTime = ''
  812. this.preDeliveryDate = []
  813. this.queryParam.preDeliveryDateB = ''
  814. this.queryParam.preDeliveryDateE = ''
  815. this.queryParam.salesman = ''
  816. this.queryParam.itemNumber = ''
  817. this.queryParam.refer = ''
  818. this.queryParam.isTc = ''
  819. this.queryParam.flourOrGarment = '', //类型
  820. this.shipmentListData = [] // 渲染 发运明细列表
  821. }
  822. }
  823. }
  824. </script>
  825. <style lang="less" scoped>
  826. @import '~@assets/less/common.less';
  827. @import '~@assets/less/overwriter.less';
  828. /deep/ .ant-table-thead > tr > th {
  829. text-align: center;
  830. // font-weight: 700;
  831. }
  832. /deep/ .ant-table-tbody {
  833. text-align: center;
  834. }
  835. // /deep/ th.replacecolor {
  836. // background-color: #ccc;
  837. // }
  838. /deep/ .ant-form-item {
  839. // margin-bottom: 0 !important;
  840. }
  841. </style>