shipmentList.vue 38 KB

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