shipmentList.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183
  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" v-has="'cymx:sbys'">报关要素</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. listExportXls
  302. } from '@api/document/shipmentList'
  303. export default {
  304. name: 'ShipmentList', // 发运明细列表
  305. mixins: [JeecgListMixin],
  306. components: {
  307. JEllipsis,
  308. moment,
  309. addShipDetDrawer,
  310. detailsShipDetDrawer,
  311. editShipDetDrawer,
  312. declareElementsModal,
  313. ReferOrderDataModal,
  314. cancelSubmitShipment,
  315. pushShipment,
  316. rePushShipment,
  317. itemNumEleModal
  318. },
  319. data() {
  320. let ellipsis = (v,l) => <j-ellipsis value={v} length={l} />
  321. return {
  322. loading: false, // 表格加载
  323. exportButton: '1',
  324. exportButton1:'1',
  325. id: '',
  326. selectedNumber:0,//已选择条数
  327. monthStartDate:'',//本月1号
  328. nextMonthStartDate:'',//下月1号
  329. nextMonthEndDate:'',//下月最后一天
  330. shipmentListColumns: [
  331. {
  332. title: '账套',
  333. dataIndex: 'account',
  334. width: 85,
  335. fixed: 'left',
  336. ellipsis: true,
  337. className: 'replacecolor',
  338. sorter:(a, b) => a.account - b.account,
  339. },
  340. {
  341. title: '销售订单号',
  342. dataIndex: 'orderNumber',
  343. // fixed: 'left',
  344. // customRender: t => ellipsis(t,17),
  345. width: 180,
  346. ellipsis: true,
  347. className: 'replacecolor',
  348. sorter:(a, b) => a.orderNumber - b.orderNumber,
  349. },
  350. {
  351. title: '款号',
  352. dataIndex: 'itemNumber',
  353. width: 130,
  354. ellipsis: true,
  355. className: 'replacecolor',
  356. sorter:(a, b) => a.itemNumber - b.itemNumber,
  357. },
  358. {
  359. title: '业务员',
  360. dataIndex: 'salesman',
  361. width: 100,
  362. ellipsis: true,
  363. className: 'replacecolor',
  364. sorter:(a, b) => a.salesman - b.salesman,
  365. },
  366. {
  367. title: '分销点',
  368. dataIndex: 'distributionPoint',
  369. width: 110,
  370. ellipsis: true,
  371. className: 'replacecolor',
  372. sorter:(a, b) => a.distributionPoint - b.distributionPoint,
  373. },
  374. {
  375. title: '小po',
  376. dataIndex: 'smallPo',
  377. width: 110,
  378. ellipsis: true,
  379. className: 'replacecolor',
  380. sorter:(a, b) => a.smallPo - b.smallPo,
  381. },
  382. {
  383. title: '存货名称',
  384. dataIndex: 'inventoryName',
  385. width: 220,
  386. className: 'replacecolor',
  387. ellipsis: true,
  388. sorter:(a, b) => a.inventoryName - b.inventoryName,
  389. },
  390. {
  391. title: '报关品名',
  392. dataIndex: 'declarationName',
  393. width: 110,
  394. className: 'replacecolor',
  395. ellipsis: true,
  396. sorter:(a, b) => a.declarationName - b.declarationName,
  397. },
  398. {
  399. title: '是否TC',
  400. dataIndex: 'isTc',
  401. width: 110,
  402. customRender: function(text) {
  403. if (text === '0') {
  404. return '否'
  405. }
  406. if (text === '1') {
  407. return '是'
  408. }
  409. },
  410. className: 'replacecolor',
  411. sorter:(a, b) => a.isTc - b.isTc,
  412. },
  413. {
  414. title: '预发货日期',
  415. dataIndex: 'preDeliveryDate',
  416. width: 120,
  417. customRender: text => {
  418. if (text == "" || text == null)
  419. return "";
  420. return moment(text).format('YYYY-MM-DD')
  421. },
  422. ellipsis: true,
  423. className: 'replacecolor',
  424. sorter:(a, b) => a.preDeliveryDate - b.preDeliveryDate,
  425. },
  426. {
  427. title: '数量',
  428. dataIndex: 'shipmentQuantity',
  429. width: 80,
  430. ellipsis: true,
  431. className: 'replacecolor',
  432. sorter:(a, b) => a.shipmentQuantity - b.shipmentQuantity,
  433. },
  434. {
  435. title: '报关单价',
  436. dataIndex: 'customsDeclarationUnitPrice',
  437. width: 80,
  438. className: 'replacecolor',
  439. ellipsis: true,
  440. sorter:(a, b) => a.customsDeclarationUnitPrice - b.customsDeclarationUnitPrice,
  441. },
  442. {
  443. title: '成衣工厂',
  444. dataIndex: 'garmentFactory',
  445. width: 100,
  446. className: 'replacecolor',
  447. ellipsis: true,
  448. sorter:(a, b) => a.garmentFactory - b.garmentFactory,
  449. },
  450. {
  451. title: 'HScode',
  452. dataIndex: 'hsCode',
  453. width: 120,
  454. className: 'replacecolor',
  455. ellipsis: true,
  456. sorter:(a, b) => a.hsCode - b.hsCode,
  457. },
  458. {
  459. title: '英文品名',
  460. dataIndex: 'englishProductName',
  461. width: 110,
  462. className: 'replacecolor',
  463. // customRender: t => ellipsis(t),
  464. ellipsis: true,
  465. sorter:(a, b) => a.englishProductName - b.englishProductName,
  466. },
  467. {
  468. title: '物料成分',
  469. dataIndex: 'materialComposition',
  470. width: 180,
  471. ellipsis: true,
  472. className: 'replacecolor',
  473. ellipsis: true,
  474. sorter:(a, b) => a.materialComposition - b.materialComposition,
  475. },
  476. {
  477. title: '采购/委外订单号',
  478. dataIndex: 'purOrSubOrder',
  479. width: 140,
  480. className: 'replacecolor',
  481. ellipsis: true,
  482. sorter:(a, b) => a.purOrSubOrder - b.purOrSubOrder,
  483. },
  484. {
  485. // (存货自定义项)
  486. title: '套装件数',
  487. dataIndex: 'numberOfSets',
  488. width: 90,
  489. className: 'replacecolor',
  490. ellipsis: true,
  491. sorter:(a, b) => a.numberOfSets - b.numberOfSets,
  492. },
  493. {
  494. title: 'pack id',
  495. dataIndex: 'packId',
  496. width: 110,
  497. ellipsis: true,
  498. className: 'replacecolor',
  499. sorter:(a, b) => a.packId - b.packId,
  500. },
  501. {
  502. title: '客户简称',
  503. dataIndex: 'customerAbbreviation',
  504. width: 100,
  505. align: 'left',
  506. ellipsis: true,
  507. className: 'replacecolor',
  508. sorter:(a, b) => a.customerAbbreviation - b.customerAbbreviation,
  509. },
  510. {
  511. title: '部门',
  512. dataIndex: 'salesDepartment',
  513. width: 100,
  514. ellipsis: true,
  515. className: 'replacecolor',
  516. sorter:(a, b) => a.salesDepartment - b.salesDepartment,
  517. },
  518. {
  519. title: '单据号',
  520. dataIndex: 'documentNo',
  521. // fixed: 'left',
  522. align: 'left',
  523. width: 140,
  524. ellipsis: true,
  525. className: 'replacecolor',
  526. sorter:(a, b) => a.documentNo - b.documentNo,
  527. },
  528. {
  529. title: '推送结果',
  530. dataIndex: 'pushState',
  531. scopedSlots: { customRender: 'pushState' },
  532. fixed: 'right',
  533. width: 110,
  534. className: 'replacecolor',
  535. sorter:(a, b) => a.pushState - b.pushState,
  536. },
  537. {
  538. title: '单据状态',
  539. dataIndex: 'submitStatus',
  540. scopedSlots: { customRender: 'state' },
  541. fixed: 'right',
  542. width: 110,
  543. className: 'replacecolor',
  544. sorter:(a, b) => a.submitStatus - b.submitStatus,
  545. },
  546. {
  547. title: '操作',
  548. dataIndex: 'operation',
  549. scopedSlots: { customRender: 'operationSlot' },
  550. fixed: 'right',
  551. width: 250,
  552. className: 'replacecolor',
  553. }
  554. ],
  555. shipmentListData: [], // 发运明细数据
  556. // 查询条件
  557. queryParam: {
  558. flourOrGarment:'1'
  559. },
  560. selectedRowKeys:[],
  561. selectedRows:[],
  562. timeRange:[],//起始时间
  563. preDeliveryDate:[],//预发货日期
  564. returnId:'',//新增后返回的id筛选条件
  565. returnFlourOrGarment:'',//新增后返回类型条件
  566. pagination: {
  567. // total: '',
  568. // current: 0,
  569. // pageSize: 0
  570. },
  571. dateFormat: 'YYYY-MM-DD',
  572. }
  573. },
  574. created() {
  575. // this.getShipmentList() // 渲染 发运明细列表
  576. // this.defalutDate()
  577. },
  578. mounted(){
  579. },
  580. watch:{
  581. selectedRowKeys(newVal){
  582. this.selectedNumber =newVal.length
  583. }
  584. },
  585. methods: {
  586. moment,
  587. //默认预发货日期
  588. defalutDate(){
  589. var now = new Date(); //当前日期
  590. var nowMonth = now.getMonth(); //当前月
  591. var nextMonth = nowMonth+1; //下个月
  592. var nowYear = now.getFullYear(); //当前年
  593. this.monthStartDate = moment(new Date(nowYear, nowMonth, 1)).format('YYYY-MM-DD');
  594. this.nextMonthStartDate = moment(new Date(nowYear, nextMonth, 1)).format('YYYY-MM-DD');
  595. if([1, 3, 5, 7, 8, 10, 12].indexOf(nextMonth+1) > -1){
  596. this.nextMonthEndDate = moment(new Date(nowYear, nextMonth, 31)).format('YYYY-MM-DD');
  597. }else {
  598. this.nextMonthEndDate = moment(new Date(nowYear, nextMonth, 30)).format('YYYY-MM-DD');
  599. }
  600. this.preDeliveryDate.push(this.nextMonthStartDate,this.nextMonthEndDate)
  601. this.queryParam.preDeliveryDateB = this.nextMonthStartDate
  602. this.queryParam.preDeliveryDateE = this.nextMonthEndDate
  603. },
  604. // 分页查询 发运明细
  605. async getShipmentList() {
  606. this.loading = true
  607. await shipmentList(this.queryParam).then(res => {
  608. if (res.success) {
  609. this.loading = false
  610. if(this.queryParam.flourOrGarment == '1'){
  611. this.exportButton ='0'
  612. this.exportButton1 = '1'
  613. }else {
  614. this.exportButton ='1'
  615. this.exportButton1 = '0'
  616. }
  617. this.shipmentListData = res.result.records
  618. for (var i=0; i<this.shipmentListData.length; i++){
  619. this.shipmentListData.randomId = randomUUID();
  620. }
  621. this.selectedRowKeys = []
  622. // this.pagination = {
  623. // total: res.result.total,
  624. // current: res.result.current,
  625. // pageSize: res.result.size
  626. // }
  627. }else {
  628. this.$message.error(res.message)
  629. this.loading = false
  630. }
  631. })
  632. },
  633. //关闭申报要素弹窗
  634. async closeDeclare(){
  635. //判断是否是新增的数据
  636. await this.judageAdd()
  637. var cc = []
  638. this.shipmentListData.map(item =>{
  639. this.selectedRows.map(item1 =>{
  640. if(item.itemIds == item1.itemIds){
  641. cc.push(item)
  642. }
  643. })
  644. })
  645. this.selectedRows = cc
  646. cc.map(item => this.selectedRowKeys.push(item.itemIds))
  647. },
  648. // // 新增
  649. // addShipDet() {
  650. // this.$refs.addShipDetDrawer.syShippingDetailsItemList = [];
  651. // this.$refs.addShipDetDrawer.visible = true
  652. // },
  653. //参照订单数据
  654. referOrderDataOpen(){
  655. this.$refs.referOrderDataModal.referOrderDataModVis = true
  656. this.$refs.referOrderDataModal.range.push(this.monthStartDate)
  657. this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
  658. this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
  659. },
  660. // 申报要素
  661. declareElements(record) {
  662. if (record.inventoryName == ""){
  663. this.$message.error('当前行存货名称为空,无法维护报关要素');
  664. }else{
  665. this.$refs.declareElementsModal.declareElementsModVis = true
  666. queryDeclarationElements({
  667. id: record.elementsId,
  668. syShippingids:record.itemIds
  669. }).then(res => {
  670. if (res.success) {
  671. // console.log('申报要素子表数据', res.result.syDeclarationElementsItemList)
  672. res.result['itemIds'] = record.itemIds;
  673. this.$refs.declareElementsModal.declareElements = res.result
  674. this.$refs.declareElementsModal.flourOrGarment = this.queryParam.flourOrGarment
  675. this.$refs.declareElementsModal.orderNumber = record.orderNumber
  676. if(!res.result.hsCode || res.result.hsCode == ''){
  677. this.$refs.declareElementsModal.query = '0'
  678. }else{
  679. this.$refs.declareElementsModal.query = '1'
  680. }
  681. // 子表赋值
  682. this.$refs.declareElementsModal.declareElementsData = res.result.syDeclarationElementsItemList
  683. if(record.pushState == '1' && record.submitStatus == '1'){
  684. this.$refs.declareElementsModal.pushState = true
  685. }
  686. }
  687. })
  688. }
  689. },
  690. // 维护款号成分
  691. itemNumberElement(record) {
  692. this.$refs.itemNumEleModal.itemNumEleModVis = true
  693. this.$refs.itemNumEleModal.editItemNumber.itemIds = record.itemIds
  694. this.$refs.itemNumEleModal.editItemNumber.itemNumber = record.itemNumber
  695. this.$refs.itemNumEleModal.editItemNumber.materialComposition = record.materialComposition
  696. this.$refs.itemNumEleModal.editItemNumber.isTc = record.isTc
  697. if(record.materialComposition == '' || !record.materialComposition){
  698. var ccode = record.inventoryCcode.substring(0,2);
  699. if(ccode =='19'){ //如果是成衣取规格型号,否则取物料名称
  700. this.$refs.itemNumEleModal.editItemNumber.materialComposition = record.specificationAndModel
  701. }else{
  702. var split = record.inventoryName.split(" ");
  703. this.$refs.itemNumEleModal.editItemNumber.materialComposition = split[0];
  704. }
  705. }
  706. },
  707. //判断是否是新增的数据-刷新数据
  708. async judageAdd(){
  709. await this.getShipmentList()
  710. // if(!this.queryParam.flourOrGarment || this.queryParam.flourOrGarment == ''){
  711. // // this.queryParam ={}
  712. // this.queryParam.id = this.returnId
  713. // this.queryParam.flourOrGarment =this.returnFlourOrGarment
  714. // await this.getShipmentList()
  715. // // this.queryParam = {}
  716. // // this.defalutDate()
  717. // }else{
  718. // await this.getShipmentList()
  719. // }
  720. },
  721. // 导出
  722. handleExportXls(fileName) {
  723. if(!this.queryParam.flourOrGarment || this.queryParam.flourOrGarment == ''){
  724. this.queryParam ={}
  725. this.queryParam.id = this.returnId
  726. this.queryParam.flourOrGarment =this.returnFlourOrGarment
  727. }
  728. var obj ={}
  729. if(this.selectedRowKeys.length==this.shipmentListData.length){
  730. obj = this.queryParam
  731. obj.selectAll = '1'
  732. }else{
  733. var grouyIdList=[]
  734. this.shipmentListData.map(item=>{
  735. this.selectedRowKeys.map(e=>{
  736. if(item.itemIds == e){
  737. grouyIdList.push(item.groupId)
  738. }
  739. })
  740. })
  741. obj.groupidList = grouyIdList.toString()
  742. obj.selectAll = '0'
  743. obj.flourOrGarment =this.queryParam.flourOrGarment
  744. }
  745. exportXls(obj).then(res =>{
  746. if(res.success==false){
  747. this.$message.error(res.message)
  748. }else{
  749. downFile('/shippingDetails/syShippingDetails/exportXls',obj).then(data => {
  750. // this.queryParam = {}
  751. // this.defalutDate()
  752. if (!data) {
  753. this.$message.warning('文件下载失败')
  754. return
  755. }
  756. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  757. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  758. } else {
  759. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  760. let link = document.createElement('a')
  761. link.style.display = 'none'
  762. link.href = url
  763. link.setAttribute('download', fileName + '.xlsx')
  764. document.body.appendChild(link)
  765. link.click()
  766. document.body.removeChild(link) // 下载完成移除元素
  767. window.URL.revokeObjectURL(url) // 释放掉blob对象
  768. }
  769. })
  770. }
  771. })
  772. },
  773. //明细导出
  774. exportXlsShipment(fileName){
  775. var obj ={}
  776. if(this.selectedRowKeys.length==this.shipmentListData.length){
  777. obj = this.queryParam
  778. obj.selectAll = '1'
  779. }else{
  780. var grouyIdList=[]
  781. this.shipmentListData.map(item=>{
  782. this.selectedRowKeys.map(e=>{
  783. if(item.itemIds == e){
  784. grouyIdList.push(item.groupId)
  785. }
  786. })
  787. })
  788. obj.groupidList = grouyIdList.toString()
  789. obj.selectAll = '0'
  790. obj.flourOrGarment =this.queryParam.flourOrGarment
  791. }
  792. listExportXls(obj).then(res =>{
  793. if(res.success==false){
  794. this.$message.error(res.message)
  795. }else{
  796. downFile('/shippingDetails/syShippingDetails/exportXlsShipping',obj).then(data => {
  797. if (!data) {
  798. this.$message.warning('文件下载失败')
  799. return
  800. }
  801. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  802. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  803. } else {
  804. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  805. let link = document.createElement('a')
  806. link.style.display = 'none'
  807. link.href = url
  808. link.setAttribute('download', fileName + '.xlsx')
  809. document.body.appendChild(link)
  810. link.click()
  811. document.body.removeChild(link) // 下载完成移除元素
  812. window.URL.revokeObjectURL(url) // 释放掉blob对象
  813. }
  814. })
  815. }
  816. })
  817. },
  818. // 编辑
  819. edit(record) {
  820. this.$refs.editShipDetDrawer.visible = true
  821. queryByDetails({ id: record.id,itemIds: record.itemIds }).then(res => {
  822. if (res.success) {
  823. // console.log('编辑对象', res.result)
  824. this.$refs.editShipDetDrawer.editShipDet = res.result
  825. res.result.syShippingDetailsItemList.map(item =>{
  826. item.manualYarnFlag = res.result.syShippingDetailsItemList[0].mjudageAddanualYarnFlag
  827. item.customsDeclarationUnitPrice = item.salesUnitPrice - item.ymoney
  828. if(item.manualYarnFlag === 0){
  829. item.manualYarnUnitPrice = null
  830. item.manualYarnProportion = null
  831. this.$refs.editShipDetDrawer.manualYarnDisabled = true
  832. this.$forceUpdate()
  833. }else {
  834. this.$refs.editShipDetDrawer.manualYarnDisabled = false
  835. }
  836. })
  837. this.$refs.editShipDetDrawer.syShippingDetailsItemList = res.result.syShippingDetailsItemList
  838. this.$refs.editShipDetDrawer.readyFabric = this.queryParam.flourOrGarment
  839. }
  840. })
  841. },
  842. // 详情
  843. details(record) {
  844. this.$refs.detailsShipDetDrawer.visible = true
  845. queryByDetails({ id: record.id,itemIds: record.itemIds}).then(res => {
  846. if (res.success) {
  847. console.log('点击的对象', res.result)
  848. // 把通过id查询到的对象,赋值给子组件
  849. this.$refs.detailsShipDetDrawer.detailsShipDet = res.result
  850. this.$refs.detailsShipDetDrawer.syShippingDetailsItemList = res.result.syShippingDetailsItemList
  851. }
  852. })
  853. },
  854. // 提交
  855. submit() {
  856. this.$nextTick(() => {
  857. // for(var i =0;i<this.selectedRows.length;i++){
  858. // var selectRow = this.selectedRows[i]
  859. // if(selectRow.elementsId===''||!selectRow.elementsId){
  860. // this.$message.error('勾选的第'+(i+1)+'行数据报关要素未填写,不可提交!')
  861. // return
  862. // }
  863. // }
  864. var grouyIdList = []
  865. this.shipmentListData.map(item =>{
  866. this.selectedRowKeys.map(e=>{
  867. if(item.itemIds == e){
  868. grouyIdList.push(item.groupId)
  869. }
  870. })
  871. })
  872. submitShipment({ submitListId: this.selectedRowKeys, type: '1' ,grouyIdList:grouyIdList}).then(res => {
  873. if (res.success) {
  874. console.log('提交成功,单据状态改为【已提交】')
  875. this.shipmentListData.submitStatus = '1'
  876. this.selectedRowKeys =[]
  877. this.judageAdd()
  878. // 渲染 发运明细列表
  879. this.$message.success('提交成功')
  880. }else {
  881. this.judageAdd()
  882. this.$message.error(res.message)
  883. }
  884. })
  885. })
  886. },
  887. // 取消提交
  888. cancelSubmit(record) {
  889. console.log('取消订单id:', record.id)
  890. this.$nextTick(() => {
  891. cancelSubmitShipment({ submitListId: this.selectedRowKeys, type: '2' }).then(res => {
  892. if (res.success) {
  893. console.log('取消提交成功,单据状态改为【仅保存】')
  894. this.shipmentListData.submitStatus = '0'
  895. this.selectedRowKeys = []
  896. this.judageAdd()
  897. this.$message.success('取消提交成功')
  898. }else {
  899. this.$message.error(res.message)
  900. }
  901. })
  902. })
  903. },
  904. // 推送
  905. push(record) {
  906. console.log('推送id:', record.id)
  907. this.$nextTick(() => {
  908. if(this.queryParam.flourOrGarment == '1'){
  909. this.$message.error("成衣不可推送!")
  910. }else {
  911. pushShipment({ id: record.id }).then(res => {
  912. if (res.success) {
  913. console.log('推送成功,推送状态【推送成功】')
  914. this.shipmentListData.pushState = '1'
  915. this.judageAdd()
  916. this.$message.success('推送成功')
  917. }else {
  918. this.$message.error(res.message)
  919. }
  920. })
  921. }
  922. })
  923. },
  924. // 重新推送
  925. rePush(record) {
  926. console.log('重新推送record:', record)
  927. this.$nextTick(() => {
  928. if(this.queryParam.flourOrGarment == '1'){
  929. this.$message.error("成衣不可推送!")
  930. }else {
  931. rePushShipment({ id: record.id }).then(res => {
  932. if (res.success) {
  933. console.log('重新推送成功,推送状态【推送成功】')
  934. this.shipmentListData.pushState = '1'
  935. this.judageAdd()
  936. this.$message.success('重新推送成功')
  937. }else {
  938. this.$message.error(res.message)
  939. }
  940. })
  941. }
  942. })
  943. },
  944. // 删除
  945. handleDelete(record) {
  946. console.log('点击删除项id:', record.id)
  947. this.$nextTick(() => {
  948. deleteShipment({ id: record.id,itemIds: record.itemIds }).then(res => {
  949. console.log('res:', res)
  950. this.judageAdd() // 渲染 发运明细列表
  951. this.$message.success('删除成功')
  952. })
  953. })
  954. },
  955. onDateChange(value, dateString) {
  956. console.log('查询开始时间', dateString[0], '查询结束时间', dateString[1])
  957. this.queryParam.startTime = dateString[0]
  958. this.queryParam.endTime = dateString[1]
  959. },
  960. onDateOk(value) {
  961. console.log('value', value)
  962. },
  963. deliveryDateChange(value, dateString) {
  964. console.log('预发货日期', dateString)
  965. this.queryParam.preDeliveryDateB = dateString[0]
  966. this.queryParam.preDeliveryDateE = dateString[1]
  967. },
  968. searchQuery() {
  969. this.toggleSearchStatus = false
  970. if(this.queryParam.flourOrGarment === '' || !this.queryParam.hasOwnProperty('flourOrGarment')){
  971. this.$message.error('请选择查询类型!');
  972. }else if(this.queryParam.flourOrGarment == '1' &&
  973. ((this.queryParam.itemNumber==''||!this.queryParam.itemNumber)&&
  974. (this.queryParam.orderNumber==''||!this.queryParam.orderNumber)&&
  975. (this.queryParam.salesman==''||!this.queryParam.salesman)&&
  976. (this.queryParam.supplier==''||!this.queryParam.supplier)&&
  977. (this.queryParam.customerAbbreviation==''||!this.queryParam.customerAbbreviation)&&
  978. this.preDeliveryDate.length == 0
  979. )){
  980. this.$message.error('款号/订单号/预发货日期/业务员/供应商/客户均未选择!');
  981. }else{
  982. if(this.preDeliveryDate.length ==2){
  983. var separator = "-"; //日期分隔符
  984. var startDates = this.queryParam.preDeliveryDateB.split(separator);
  985. var endDates = this.queryParam.preDeliveryDateE.split(separator);
  986. var startDate = new Date(startDates[0], startDates[1]-1, startDates[2]);
  987. var endDate = new Date(endDates[0], endDates[1]-1, endDates[2]);
  988. var timeInterval= parseInt(Math.abs(endDate - startDate ) / 1000 / 60 / 60 /24) + 1;
  989. if(timeInterval > 60){
  990. this.$message.error('预发货时间区间超过60天,请重新选择!');
  991. }else {
  992. this.queryParam.id = ''
  993. this.getShipmentList()
  994. }
  995. }else{
  996. this.queryParam.id = ''
  997. this.getShipmentList()
  998. }
  999. }
  1000. },
  1001. searchReset() {
  1002. this.queryParam = {
  1003. flourOrGarment:'1'
  1004. }
  1005. this.timeRange = []
  1006. this.preDeliveryDate = []
  1007. // this.defalutDate()
  1008. this.selectedRows = []
  1009. this.selectedRowKeys = []
  1010. this.shipmentListData = [] // 渲染 发运明细列表
  1011. },
  1012. //选中行
  1013. onSelectChange(keys,rows){
  1014. this.selectedRowKeys = keys;
  1015. this.selectedRows = rows;
  1016. },
  1017. // 分页变化时触发
  1018. handleTableChange(pagination, filters, sorter) {
  1019. this.queryParam.pageNo = pagination.current
  1020. this.getShipmentList()
  1021. },
  1022. //关闭新增弹窗
  1023. async closeAdd(data,id,range){
  1024. this.queryParam ={}
  1025. this.queryParam.flourOrGarment = data
  1026. this.queryParam.id = id
  1027. this.preDeliveryDate=range
  1028. this.queryParam.preDeliveryDateB =(this.preDeliveryDate[0]&&this.preDeliveryDate[0]!=='')? this.preDeliveryDate[0].format('YYYY-MM-DD'):'';
  1029. this.queryParam.preDeliveryDateE =(this.preDeliveryDate[1]&&this.preDeliveryDate[1]!=='')? this.preDeliveryDate[1].format('YYYY-MM-DD'):'';
  1030. //其他地方使用
  1031. this.returnId = id
  1032. this.returnFlourOrGarment = data
  1033. await this.getShipmentList()
  1034. // this.queryParam = {}
  1035. // this.defalutDate()
  1036. },
  1037. async closeAddEdit(){
  1038. this.judageAdd()
  1039. }
  1040. }
  1041. }
  1042. </script>
  1043. <style lang="less" scoped>
  1044. @import '~@assets/less/common.less';
  1045. @import '~@assets/less/overwriter.less';
  1046. /deep/ .ant-table-thead > tr > th {
  1047. text-align: center;
  1048. // font-weight: 700;
  1049. }
  1050. /deep/ .ant-table-tbody {
  1051. text-align: center;
  1052. }
  1053. // /deep/ th.replacecolor {
  1054. // background-color: #ccc;
  1055. // }
  1056. // /deep/ .ant-form-item {
  1057. // // margin-bottom: 0 !important;
  1058. // }
  1059. /deep/ .ant-table-tbody .ant-table-row td{
  1060. padding-top: 8px;
  1061. padding-bottom: 8px;
  1062. }
  1063. /deep/.ant-card-body{
  1064. padding-top: 10px !important;
  1065. padding-bottom: 0px !important;
  1066. }
  1067. /deep/.table-operator .ant-btn{
  1068. margin: 0 8px 3px 0;
  1069. }
  1070. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  1071. margin-bottom: 10px;
  1072. }
  1073. /deep/.table-page-search-wrapper .table-page-search-submitButtons{
  1074. margin-bottom: 10px;
  1075. }
  1076. /deep/ thead.ant-table-thead>tr{
  1077. height: 0 !important;
  1078. }
  1079. /deep/ .ant-table-thead > tr > th, .ant-table-tbody > tr > td{
  1080. padding: 9px 16px
  1081. }
  1082. </style>