addFabricDrawer.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. <template>
  2. <!-- 新增面料 装箱单 -->
  3. <div id="addFabricDrawer">
  4. <a-drawer :title="(defaultMethod == 'add')?'新增面料':'编辑面料'" width="89%" placement="right" :closable="true" :visible="visible" @close="handleCancel">
  5. <!-- 主表信息 填写-->
  6. <a-card :bordered="true">
  7. <div class="table-page-search-wrapper">
  8. <a-form-model layout="inline" ref="form" :model="addFabric" :rules="validatorRules">
  9. <a-row :gutter="24">
  10. <a-col :md="6" :sm="8">
  11. <a-form-model-item label="单号" prop="oddNum">
  12. {{addFabric.documentNo}}
  13. <!-- <a-input placeholder="自动生成" v-model="addFabric.documentNo"></a-input> -->
  14. </a-form-model-item>
  15. </a-col>
  16. <!-- <a-col :md="6" :sm="8">
  17. <a-form-model-item label="订单号" prop="oddNum">
  18. <a-input placeholder="选择子表自动生成" v-model="addFabric.orderNumber"></a-input>
  19. </a-form-model-item>
  20. </a-col> -->
  21. <a-col :md="6" :sm="8">
  22. <a-form-model-item label="集装箱号" prop="containerNumber">
  23. <a-input placeholder="请输入集装箱号" v-model="addFabric.containerNumber"></a-input>
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8">
  27. <a-form-model-item label="铅分号" prop="plumbumNo">
  28. <a-input placeholder="请输入铅分号" v-model="addFabric.plumbumNo"></a-input>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="6" :sm="8">
  32. <a-form-model-item label="装柜日期" prop="latestDateOfShipment">
  33. <a-date-picker
  34. placeholder="请选择装柜日期"
  35. :format="dateFormat"
  36. style="width: 100%"
  37. v-model="addFabric.latestDateOfShipment"
  38. />
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :md="6" :sm="8">
  42. <a-form-model-item label="成衣工厂" prop="garmentFactory">
  43. <a-input placeholder="勾选数据自动生成" v-model="addFabric.garmentFactory"></a-input>
  44. </a-form-model-item>
  45. </a-col>
  46. <!-- <a-col :md="6" :sm="8">
  47. <a-form-model-item label="发票号" prop="invoiceNum">
  48. <a-input placeholder="请输入发票号" v-model="addFabric.invoiceNo"></a-input>
  49. </a-form-model-item>
  50. </a-col> -->
  51. <!-- <a-col :md="6" :sm="8">
  52. <a-form-model-item label="制单人" prop="preparedBy">
  53. <a-input placeholder="请输入制单人" v-model="addFabric.preparedBy"></a-input>
  54. </a-form-model-item>
  55. </a-col> -->
  56. <!-- <a-col :md="6" :sm="8">
  57. <a-form-model-item label="制单日期" prop="preparedDate">
  58. <a-date-picker
  59. placeholder="请选择制单日期"
  60. :format="dateFormat"
  61. style="width: 100%"
  62. v-model="addFabric.preparedDate"
  63. />
  64. </a-form-model-item>
  65. </a-col> -->
  66. <a-col :md="6" :sm="8">
  67. <a-form-model-item label="外销发票号" prop="exportInvoiceNo">
  68. <a-input placeholder="请输入外销发票号" v-model="addFabric.exportInvoiceNo" @blur="convertUppercase(addFabric.exportInvoiceNo)"></a-input>
  69. </a-form-model-item>
  70. </a-col>
  71. <a-col :md="6" :sm="8">
  72. <a-form-model-item label="托书号" prop="shippingOrderNumber">
  73. <a-input placeholder="请输入托书号" v-model="addFabric.shippingOrderNumber" @blur="convertUppercaseNumber(addFabric.shippingOrderNumber)"></a-input>
  74. </a-form-model-item>
  75. </a-col>
  76. <a-col :md="6" :sm="8">
  77. <a-form-model-item label="备注" prop="remarks">
  78. <a-input placeholder="请输入备注" v-model="addFabric.remarks"></a-input>
  79. </a-form-model-item>
  80. </a-col>
  81. </a-row>
  82. </a-form-model>
  83. </div>
  84. </a-card>
  85. <!--操作按钮区域 参照发运明细 増行-->
  86. <a-card :bordered="true" style="margin:10px 0 60px 0;">
  87. <div class="table-operator">
  88. <a-button type="primary" @click="referadvancePackingList" icon="ordered-list">参照出运明细</a-button>
  89. <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button>
  90. </div>
  91. <!-- 子表 -->
  92. <a-spin :spinning="confirmLoading">
  93. <a-form-model ref="formRef" >
  94. <a-table
  95. bordered
  96. :columns="addFabricColumns"
  97. :data-source="addFabricData"
  98. :loading="loading"
  99. :scroll="{ x: 1500,y: 350 }"
  100. @change="handleTableChange"
  101. >
  102. <!-- 自定义表头 -->
  103. <span slot="netWeightTitle" class="form-table-heard">
  104. 净重/NW/kg
  105. </span>
  106. <span slot="grossWeightTitle" class="form-table-heard">
  107. 毛重/GW/kg
  108. </span>
  109. <span slot="dyelotNumberTitle" class="form-table-heard">
  110. 缸号/Batch no.
  111. </span>
  112. <span slot="actualDeclaredQuantityTitle" class="form-table-heard">
  113. 实际报关数量
  114. </span>
  115. <!-- 操作 -->
  116. <span slot="operationSlot" slot-scope="text, record,index">
  117. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record,index)">
  118. <a href="javascript:void(0);" style="color:red;">删除</a>
  119. </a-popconfirm>
  120. <a-divider type="vertical"/>
  121. <a href="javascript:void(0);" @click="copy(record,index)">复制</a>
  122. </span>
  123. <!-- 备注 -->
  124. <template slot="remarks2" slot-scope="text, record, index">
  125. <a-form-model-item prop="remarks2">
  126. <a-input style="width:100%" type="text" v-model="record.remarks2" />
  127. </a-form-model-item>
  128. </template>
  129. <!-- 缸号 -->
  130. <template slot="dyelotNumber" slot-scope="text, record, index">
  131. <a-form-model-item prop="dyelotNumber">
  132. <a-input style="width:100%" type="text" v-model="record.dyelotNumber" />
  133. </a-form-model-item>
  134. </template>
  135. <!-- 成分 -->
  136. <template slot="composition" slot-scope="text, record, index">
  137. <a-form-model-item prop="composition">
  138. <a-input style="width:100%" type="text" v-model="record.composition" />
  139. </a-form-model-item>
  140. </template>
  141. <!-- 门幅 -->
  142. <template slot="width" slot-scope="text, record, index">
  143. <a-form-model-item prop="width">
  144. <a-input style="width:100%" type="text" v-model="record.width" @change="changeNetWeight(record)"/>
  145. </a-form-model-item>
  146. </template>
  147. <!-- 匹数 -->
  148. <template slot="rolls" slot-scope="text, record, index">
  149. <a-form-model-item prop="rolls">
  150. <a-input style="width:100%" type="text" v-model="record.rolls" />
  151. </a-form-model-item>
  152. </template>
  153. <!-- 毛重 -->
  154. <template slot="grossWeight" slot-scope="text, record, index">
  155. <a-form-model-item prop="grossWeight">
  156. <a-input style="width:100%" type="text" v-model="record.grossWeight" />
  157. </a-form-model-item>
  158. </template>
  159. <!-- 净重 -->
  160. <template slot="netWeight" slot-scope="text, record, index">
  161. <a-form-model-item prop="netWeight">
  162. <a-input style="width:100%" type="text" v-model="record.netWeight" @change="changeNetWeight(record)" />
  163. </a-form-model-item>
  164. </template>
  165. <!-- 染后重 -->
  166. <template slot="afterHeavy" slot-scope="text, record, index">
  167. <a-form-model-item prop="afterHeavy">
  168. <a-input style="width:100%" type="text" v-model="record.afterHeavy" />
  169. </a-form-model-item>
  170. </template>
  171. <!-- 拷布重 -->
  172. <template slot="kaoClothWeight" slot-scope="text, record, index">
  173. <a-form-model-item prop="kaoClothWeight">
  174. <a-input style="width:100%" type="text" v-model="record.kaoClothWeight" />
  175. </a-form-model-item>
  176. </template>
  177. <!-- 供应商编码 (染厂)-->
  178. <template slot="supplierCodeDyeingPlant" slot-scope="text, record, index">
  179. <a-form-model-item prop="supplierCodeDyeingPlant">
  180. <a-input style="width:100%" type="text" v-model="record.supplierCodeDyeingPlant" />
  181. </a-form-model-item>
  182. </template>
  183. <!-- 供应商(染厂) -->
  184. <template slot="supplierDyeingPlant" slot-scope="text, record, index">
  185. <a-form-model-item prop="supplierDyeingPlant">
  186. <a-input style="width:100%" type="text" v-model="record.supplierDyeingPlant" />
  187. </a-form-model-item>
  188. </template>
  189. <!-- 供应商编码(印厂) -->
  190. <template slot="supplierCodePrintingPlant" slot-scope="text, record, index">
  191. <a-form-model-item prop="supplierCodePrintingPlant">
  192. <a-input style="width:100%" type="text" v-model="record.supplierCodePrintingPlant" />
  193. </a-form-model-item>
  194. </template>
  195. <!-- 供应商(印厂) -->
  196. <template slot="supplierPrintingPlant" slot-scope="text, record, index">
  197. <a-form-model-item prop="supplierPrintingPlant">
  198. <a-input style="width:100%" type="text" v-model="record.supplierPrintingPlant" />
  199. </a-form-model-item>
  200. </template>
  201. <!-- 包装方式 -->
  202. <template slot="mannerOfPacking" slot-scope="text, record, index">
  203. <a-form-model-item prop="mannerOfPacking">
  204. <a-input style="width:100%" type="text" v-model="record.mannerOfPacking" />
  205. </a-form-model-item>
  206. </template>
  207. <!-- 处理方式 -->
  208. <template slot="treatmentMethod" slot-scope="text, record, index">
  209. <a-form-model-item prop="treatmentMethod">
  210. <a-input style="width:100%" type="text" v-model="record.treatmentMethod" />
  211. </a-form-model-item>
  212. </template>
  213. <!-- 手册纱 -->
  214. <template slot="manualYarnFlag" slot-scope="text, record, index">
  215. <a-form-model-item prop="manualYarnFlag">
  216. <a-select v-model="record.manualYarnFlag" @change='changeManualYarnFlag'>
  217. <a-select-option :value="1">是</a-select-option>
  218. <a-select-option :value="0">否</a-select-option>
  219. </a-select>
  220. </a-form-model-item>
  221. </template>
  222. <!--手册纱单价 -->
  223. <template slot="manualYarnUnitPrice" slot-scope="text, record, index">
  224. <a-form-model-item prop="manualYarnUnitPrice">
  225. <a-input style="width:100%" type="text" v-model="record.manualYarnUnitPrice" :disabled='manualYarnDisabled' @change="changeManualYarn('Price',record.manualYarnUnitPrice)" />
  226. </a-form-model-item>
  227. </template>
  228. <!--手册纱占比 -->
  229. <template slot="manualYarnProportion" slot-scope="text, record, index">
  230. <a-form-model-item prop="manualYarnProportion">
  231. <a-input style="width:100%" type="text" v-model="record.manualYarnProportion" :disabled='manualYarnDisabled' @change="changeManualYarn('Proportion',record.manualYarnProportion)" />
  232. </a-form-model-item>
  233. </template>
  234. <!-- 柜号 -->
  235. <template slot="containerNumber" slot-scope="text, record, index">
  236. <a-form-model-item prop="containerNumber">
  237. <a-input style="width:100%" type="text" v-model="record.containerNumber" />
  238. </a-form-model-item>
  239. </template>
  240. <!-- 入库数量 -->
  241. <template slot="inventoryQuantity" slot-scope="text, record, index">
  242. <a-form-model-item prop="inventoryQuantity">
  243. <a-input style="width:100%" type="text" v-model="record.inventoryQuantity" @change="inventoryQuantityChange(record)" />
  244. </a-form-model-item>
  245. </template>
  246. <!-- 实际报关数量 -->
  247. <template slot="actualDeclaredQuantity" slot-scope="text, record, index">
  248. <a-form-model-item prop="actualDeclaredQuantity">
  249. <a-input style="width:100%" type="text" v-model="record.actualDeclaredQuantity" @change="actualDeclaredQuantityChange(record)"/>
  250. </a-form-model-item>
  251. </template>
  252. </a-table>
  253. </a-form-model>
  254. </a-spin>
  255. </a-card>
  256. <!-- 页面底部提交取消 -->
  257. <div
  258. :style="{
  259. position: 'absolute',
  260. right: 0,
  261. bottom: 0,
  262. width: '100%',
  263. borderTop: '1px solid #e9e9e9',
  264. padding: '10px 16px',
  265. background: '#fff',
  266. textAlign: 'right',
  267. zIndex: 999
  268. }"
  269. >
  270. <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
  271. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  272. </a-popconfirm>
  273. <a-button type="primary" @click="submitAdd">
  274. 保存
  275. </a-button>
  276. </div>
  277. </a-drawer>
  278. <!-- 参照发运明细弹框 -->
  279. <referShipDetails-modal ref="referShipDetailsModal" :father="aa" @callback="getFabricData" @ok="modalFormOk"></referShipDetails-modal>
  280. </div>
  281. </template>
  282. <script>
  283. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  284. import { getShippingDetailId,addFabricList,editFabricList} from '@api/document/packing-list/packinglist-fabrics'
  285. import JEllipsis from '@/components/jeecg/JEllipsis'
  286. import moment from 'moment'
  287. import referShipDetailsModal from '@views/packing-list/packinglist-fabrics/referShipDetailsModal.vue'
  288. export default {
  289. name: 'AddFabricDrawer', // 新增 装箱单 -面料
  290. mixins: [JeecgListMixin],
  291. computed: {},
  292. components: { JEllipsis, referShipDetailsModal,moment }, // 参照发运明细 弹框
  293. props: {
  294. fatherList: {
  295. type: Function,
  296. default: null
  297. }
  298. },
  299. data() {
  300. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  301. return {
  302. // 表头
  303. addFabricColumns: [
  304. {
  305. title: '业务员 Merchandiser',
  306. dataIndex: 'salesman',
  307. width: 120,
  308. // fixed: 'left',
  309. className: 'replacecolor'
  310. },
  311. {
  312. title: '计划单号',
  313. dataIndex: 'planLotNumber',
  314. width: 160,
  315. // fixed: 'left',
  316. className: 'replacecolor'
  317. },
  318. {
  319. title: '款号/Kimball',
  320. dataIndex: 'itemNumber',
  321. width: 120,
  322. className: 'replacecolor'
  323. },
  324. {
  325. // title: '缸号/Batch no.',
  326. dataIndex: 'dyelotNumber',
  327. scopedSlots: { customRender: 'dyelotNumber' },
  328. slots:{title:'dyelotNumberTitle'},
  329. width: 170,
  330. className: 'replacecolor'
  331. },
  332. {
  333. title: '颜色/Color',
  334. dataIndex: 'colour',
  335. width: 120,
  336. className: 'replacecolor'
  337. },
  338. {
  339. title: '项目/Item(存货编码)',
  340. dataIndex: 'inventoryCode',
  341. width: 120,
  342. className: 'replacecolor'
  343. },
  344. {
  345. title: '存货名称(辅料名称)',
  346. dataIndex: 'inventoryName',
  347. width: 160,
  348. className: 'replacecolor'
  349. },
  350. {
  351. title: '报关品名',
  352. dataIndex: 'declarationName',
  353. width: 120,
  354. className: 'replacecolor'
  355. },
  356. {
  357. title: '成分/Composition',
  358. dataIndex: 'composition',
  359. scopedSlots: { customRender: 'composition' },
  360. width: 150,
  361. className: 'replacecolor'
  362. },
  363. {
  364. title: '门幅/Width',
  365. dataIndex: 'width',
  366. // scopedSlots: { customRender: 'width' },
  367. width: 140,
  368. className: 'replacecolor'
  369. },
  370. {
  371. title: '匹数/Rolls',
  372. dataIndex: 'rolls',
  373. scopedSlots: { customRender: 'rolls' },
  374. width: 120,
  375. className: 'replacecolor'
  376. },
  377. {
  378. // title: '毛重/GW/kg',
  379. dataIndex: 'grossWeight',
  380. scopedSlots: { customRender: 'grossWeight' },
  381. width: 170,
  382. className: 'replacecolor',
  383. slots:{title:'grossWeightTitle'}
  384. },
  385. {
  386. // title: '净重/NW/kg',
  387. scopedSlots: { customRender: 'netWeight' },
  388. dataIndex: 'netWeight',
  389. width: 170,
  390. className: 'replacecolor',
  391. slots:{title:'netWeightTitle'}
  392. },
  393. {
  394. title: '染后重',
  395. dataIndex: 'afterHeavy',
  396. scopedSlots: { customRender: 'afterHeavy' },
  397. width: 90,
  398. className: 'replacecolor'
  399. },
  400. {
  401. title: '拷布重',
  402. dataIndex: 'kaoClothWeight',
  403. scopedSlots: { customRender: 'kaoClothWeight' },
  404. width: 120,
  405. className: 'replacecolor'
  406. },
  407. {
  408. title: '米数/Length/m',
  409. dataIndex: 'meter',
  410. width: 130,
  411. className: 'replacecolor'
  412. },
  413. {
  414. // title: '实际报关数量',
  415. dataIndex: 'actualDeclaredQuantity',
  416. scopedSlots: { customRender: 'actualDeclaredQuantity' },
  417. width: 170,
  418. className: 'replacecolor',
  419. slots:{title:'actualDeclaredQuantityTitle'}
  420. },
  421. // {
  422. // title: '价格',
  423. // dataIndex: 'price',
  424. // width: 120,
  425. // className: 'replacecolor'
  426. // },
  427. {
  428. title: '克重/G',
  429. dataIndex: 'gramWeight',
  430. width: 120,
  431. className: 'replacecolor'
  432. },
  433. {
  434. title: '供应商编码(染厂)',
  435. dataIndex: 'supplierCodeDyeingPlant',
  436. // scopedSlots: { customRender: 'supplierCodeDyeingPlant' },
  437. width: 120,
  438. className: 'replacecolor'
  439. },
  440. {
  441. title: '供应商(染厂)',
  442. dataIndex: 'supplierDyeingPlant',
  443. // scopedSlots: { customRender: 'supplierDyeingPlant' },
  444. width: 120,
  445. className: 'replacecolor'
  446. },
  447. {
  448. title: '供应商编码(印厂)',
  449. // scopedSlots: { customRender: 'supplierCodePrintingPlant' },
  450. dataIndex: 'supplierCodePrintingPlant',
  451. width: 120,
  452. className: 'replacecolor'
  453. },
  454. {
  455. title: '供应商(印厂)',
  456. dataIndex: 'supplierPrintingPlant',
  457. // scopedSlots: { customRender: 'supplierPrintingPlant' },
  458. width: 120,
  459. className: 'replacecolor'
  460. },
  461. {
  462. title: '包装方式',
  463. dataIndex: 'mannerOfPacking ',
  464. scopedSlots: { customRender: 'mannerOfPacking' },
  465. width: 120,
  466. className: 'replacecolor'
  467. },
  468. {
  469. title: '处理方式',
  470. scopedSlots: { customRender: 'treatmentMethod' },
  471. dataIndex: 'treatmentMethod',
  472. width: 120,
  473. className: 'replacecolor'
  474. },
  475. {
  476. title: '是否手册纱',
  477. dataIndex: 'manualYarnFlag',
  478. scopedSlots: { customRender: 'manualYarnFlag' },
  479. width: 120,
  480. className: 'replacecolor'
  481. },
  482. {
  483. title: '手册纱单价',
  484. dataIndex: 'manualYarnUnitPrice',
  485. scopedSlots: { customRender: 'manualYarnUnitPrice' },
  486. width: 120,
  487. className: 'replacecolor'
  488. },
  489. {
  490. title: '手册纱占比%',
  491. dataIndex: 'manualYarnProportion',
  492. scopedSlots: { customRender: 'manualYarnProportion' },
  493. width: 120,
  494. className: 'replacecolor'
  495. },
  496. {
  497. title: '柜号',
  498. dataIndex: 'containerNumber',
  499. scopedSlots: { customRender: 'containerNumber' },
  500. width: 120,
  501. className: 'replacecolor'
  502. },
  503. // {
  504. // title: '备注',
  505. // dataIndex: 'memo',
  506. // width: 160,
  507. // customRender: t => ellipsis(t),
  508. // className: 'replacecolor'
  509. // },
  510. // {
  511. // title: '入库数量',
  512. // dataIndex: 'inventoryQuantity',
  513. // scopedSlots: { customRender: 'inventoryQuantity' },
  514. // width: 120,
  515. // className: 'replacecolor'
  516. // },
  517. {
  518. title: '规格型号',
  519. dataIndex: 'specificationAndModel',
  520. width: 120,
  521. className: 'replacecolor'
  522. },
  523. {
  524. title: '超发',
  525. dataIndex: 'excessQuantity',
  526. width: 120,
  527. className: 'replacecolor'
  528. },
  529. {
  530. title: '单位',
  531. dataIndex: 'masterMetering',
  532. width: 120,
  533. className: 'replacecolor'
  534. },
  535. {
  536. title: '备注(U8)',
  537. dataIndex: 'remarks2',
  538. width: 160,
  539. // fixed: 'right',
  540. scopedSlots: { customRender: 'remarks2' },
  541. className: 'replacecolor'
  542. },
  543. {
  544. title: '操作',
  545. dataIndex: 'operation',
  546. scopedSlots: { customRender: 'operationSlot' },
  547. width: 120,
  548. fixed: 'right',
  549. className: 'replacecolor'
  550. }
  551. ],
  552. addFabricData: [],
  553. loading: false, // 表格加载
  554. addFabric: {},
  555. visible: false,
  556. judge : 0,
  557. manualYarnDisabled:false,
  558. confirmLoading: false,
  559. defaultMethod:'add',
  560. validatorRules: {
  561. plumbumNo: [{ required: true, message: '铅分号不能为空'}],
  562. containerNumber: [{ required: true, message: '集装箱号不能为空'}],
  563. exportInvoiceNo: [{ required: true, message: '外销发票号不能为空'}],
  564. latestDateOfShipment: [{ required: true, message: '装柜日期不能为空'}],
  565. garmentFactory: [{ required: true, message: '成衣工厂不能为空'}],
  566. // 待确定还有哪些必填信息
  567. },
  568. dateFormat: 'YYYY-MM-DD'
  569. }
  570. },
  571. created() {},
  572. mounted() {},
  573. methods: {
  574. moment,
  575. //外销发票转化大写
  576. convertUppercase(val){
  577. this.addFabric.exportInvoiceNo = val.toUpperCase()
  578. },
  579. //托书号
  580. convertUppercaseNumber(val) {
  581. this.addFabric.shippingOrderNumber = val.toUpperCase()
  582. },
  583. // 参照发运明细 弹框
  584. referadvancePackingList() {
  585. console.log('打开参照发运明细 弹框')
  586. this.$refs.referShipDetailsModal.referShipDetailsModVis = true
  587. this.$refs.referShipDetailsModal.getReferenceList()
  588. if(this.addFabricData.length !== 0){
  589. this.$refs.referShipDetailsModal.fatherFactory = this.addFabric.garmentFactory
  590. }
  591. },
  592. getFabricData(rows,token) {
  593. // this.addFabric = {}
  594. // this.addFabricData = []
  595. var rowsId = [],
  596. group = []
  597. rows.map(item => {rowsId.push(item.id),group.push(item.groupId)} )
  598. var ids = rowsId.toString(),
  599. groupId =group.toString()
  600. getShippingDetailId({ids:ids,groupIds:groupId}).then(res => {
  601. if (res.success) {
  602. var data = res.result
  603. if(this.addFabricData.length == 0){
  604. this.addFabric ={
  605. // id:data.id,
  606. // orderNumber:data.orderNumber,
  607. documentNo:data.documentNo,
  608. containerNumber : data.containerNumber,
  609. latestDateOfShipment : data.latestDateOfShipment,
  610. garmentFactory : data.garmentFactory,
  611. invoiceNo : data.invoiceNo,
  612. // preparedBy : data.preparedBy,
  613. preparedDate : moment(new Date()).format('YYYY-MM-DD'),
  614. exportInvoiceNo : data.exportInvoiceNo,
  615. shippingOrderNumber : data.shippingOrderNumber,
  616. plumbumNo : data.plumbumNo,
  617. customer : data.customer,
  618. customerAbbreviation : data.customerAbbreviation
  619. }
  620. }else {
  621. data.syPackingListFabricItem.map(item =>{
  622. item.isAdd = 1
  623. })
  624. }
  625. this.addFabricData = this.addFabricData.concat(data.syPackingListFabricItem )
  626. this.addFabricData.map(item =>{
  627. // item.inventoryQuantity = 0
  628. item.meter = 0
  629. item.excessQuantity = item.actualDeclaredQuantity - item.remainingQuantity
  630. if(item.excessQuantity < 0){
  631. item.excessQuantity = 0
  632. }
  633. if(item.manualYarnFlag == 0){
  634. this.manualYarnDisabled = true
  635. }else {
  636. this.manualYarnDisabled = false
  637. }
  638. var code = item.inventoryCcode.slice(0,2)
  639. if(!((code =='03' || code == '04') && (item.inventoryCcode !== '0399' || item.inventoryCcode !== '0499'))){
  640. item.actualDeclaredQuantity = item.inventoryQuantity
  641. }
  642. })
  643. }else {
  644. this.$message.error(res.message);
  645. }
  646. })
  647. },
  648. changeNetWeight(event){
  649. if(Number(event.netWeight) !==0 && Number(event.width) !== 0 && Number(event.gramWeight) !== 0 && event.netWeight!==null && event.netWeight!=="" && event.width !== "" && event.gramWeight !== ""){
  650. event.meter = (event.netWeight/(event.width/100)/(event.gramWeight/1000)).toFixed(2)
  651. }else {
  652. event.meter = 0
  653. }
  654. var code = event.inventoryCcode.slice(0,2)
  655. if((code =='03' || code == '04') && (event.inventoryCcode !== '0399' || event.inventoryCcode !== '0499')){
  656. event.actualDeclaredQuantity = event.meter
  657. }
  658. },
  659. // 増行
  660. handleAddColumn() {
  661. console.log('増行')
  662. const addrow = {
  663. accountSet: '',
  664. clothesFactory: '',
  665. hod: '',
  666. styleNo: '',
  667. poNo: '',
  668. itemNo: '',
  669. dcLabel: '',
  670. s: '',
  671. m: '',
  672. l: '',
  673. xl: '',
  674. xxl: '',
  675. xxxl: '',
  676. inceptionBoxNo: '',
  677. endBoxNo: '',
  678. colorChUsa: '',
  679. configCode: '',
  680. packagesBox: '',
  681. boxes: '',
  682. totalPackagesNum: '',
  683. suttle: '',
  684. totalSuttle: '',
  685. roughWeight: '',
  686. totalRoughWeigh: '',
  687. boxLength: '',
  688. boxWidth: '',
  689. boxHeight: '',
  690. totalVolume: '',
  691. netNetWeight: '',
  692. price: '',
  693. totalPrices: '',
  694. note: '',
  695. operation: ''
  696. }
  697. this.addFabricData.push(addrow)
  698. },
  699. judageCloumn(){
  700. this.addFabricColumns.map(item => {
  701. if(item.title == "匹数/Rolls"){
  702. item.title = '箱数'
  703. }
  704. })
  705. var obj = {
  706. title: '尺码',
  707. dataIndex: 'size',
  708. width: 120,
  709. className: 'replacecolor'
  710. }
  711. this.addFabricColumns.splice(30,0,obj)
  712. },
  713. // -------------------------------------
  714. // 操作 删除
  715. handleDelete(record,index) {
  716. this.addFabricData.splice(index, 1);
  717. },
  718. //修改是否为手册纱时触发
  719. changeManualYarnFlag(val) {
  720. this.addFabricData.map(item =>{
  721. item.manualYarnFlag = null
  722. item.manualYarnFlag = val
  723. //是手工纱时
  724. if(val === 0){
  725. item.manualYarnUnitPrice = ""
  726. item.manualYarnProportion = ""
  727. this.manualYarnDisabled = true
  728. }else {
  729. this.manualYarnDisabled = false
  730. }
  731. })
  732. this.$forceUpdate()
  733. },
  734. //输入手册纱单价或者手册纱占比时触发
  735. changeManualYarn(data,val){
  736. this.addFabricData.map(item => {
  737. if(data === 'Price'){item.manualYarnUnitPrice = val}
  738. else{item.manualYarnProportion = val}
  739. })
  740. this.$forceUpdate()
  741. },
  742. //操作 复制
  743. copy(record,index){
  744. var newRow = JSON.parse(JSON.stringify(record));
  745. newRow.isAdd = 1
  746. this.addFabricData.splice(index+1, 0, newRow);
  747. },
  748. // -------------------------------------
  749. // 抽屉 取消
  750. handleCancel() {
  751. console.log('点击抽屉取消')
  752. this.close()
  753. },
  754. // 抽屉 提交
  755. submitAdd() {
  756. console.log('保存新增、刷新装箱单-面料')
  757. const that = this
  758. // 触发表单验证
  759. this.$refs.form.validate(async valid => {
  760. if (valid) {
  761. // that.confirmLoading = true
  762. var newObj = {
  763. documentNo:this.addFabric.documentNo,
  764. plumbumNo:this.addFabric.plumbumNo,
  765. // orderNumber:this.addFabric.orderNumber,
  766. containerNumber:this.addFabric.containerNumber,
  767. latestDateOfShipment:this.addFabric.latestDateOfShipment,
  768. garmentFactory:this.addFabric.garmentFactory,
  769. invoiceNo:this.addFabric.invoiceNo,
  770. preparedBy:this.addFabric.preparedBy,
  771. preparedDate:this.addFabric.preparedDate,
  772. exportInvoiceNo:this.addFabric.exportInvoiceNo,
  773. shippingOrderNumber:this.addFabric.shippingOrderNumber,
  774. remarks:this.addFabric.remarks,
  775. customer : this.addFabric.customer,
  776. customerAbbreviation : this.addFabric.customerAbbreviation,
  777. syPackingListFabricItem:this.addFabricData
  778. }
  779. await this.JudgeVluabled(newObj)
  780. if(this.judge == 0){
  781. if(this.defaultMethod === 'add'){
  782. addFabricList(newObj).then(res => {
  783. if (res.success) {
  784. this.$message.success('新增成功')
  785. this.close()
  786. //清空信息
  787. newObj = {};
  788. that.fatherList() // 调用父组件 查询方法
  789. }else{
  790. this.$message.error(res.message)
  791. this.close()
  792. }
  793. })
  794. }else {
  795. newObj.id = this.addFabric.id,
  796. editFabricList(newObj).then(res => {
  797. if (res.success) {
  798. this.$message.success('编辑成功')
  799. this.close()
  800. //清空信息
  801. newObj = {};
  802. that.fatherList() // 调用父组件 查询方法
  803. }else{
  804. this.$message.error(res.message)
  805. this.close()
  806. }
  807. })
  808. }
  809. }
  810. }
  811. })
  812. // this.close()
  813. // this.getShipmentList() // 刷新 装箱单-面料
  814. },
  815. JudgeVluabled(data){
  816. this.judge = 0
  817. for (var i=0; i<data.syPackingListFabricItem.length;i++){
  818. var tableRow = data.syPackingListFabricItem[i];
  819. //是否未填
  820. var required = [
  821. {key:'dyelotNumber',value:'缸号'},
  822. {key:'grossWeight',value:'毛重/GW/kg'},
  823. {key:'netWeight',value:'净重/NW/kg'},
  824. {key:'actualDeclaredQuantity',value:'实际报关数量'},
  825. ]
  826. for(var j=0 ; j<required.length;j++){
  827. if(tableRow[required[j].key] == null || tableRow[required[j].key] == "" || tableRow[required[j].key] == undefined){
  828. this.$message.error('第'+(i+1)+'行'+required[j].value+'无值,无法保存');
  829. this.judge+=1
  830. return
  831. }
  832. }
  833. }
  834. },
  835. // -------------------------------------
  836. close() {
  837. this.$emit('close')
  838. this.visible = false
  839. this.defaultMethod = 'add'
  840. this.addFabric = {}
  841. this.addFabricData = []
  842. this.addFabricColumns = this.addFabricColumns.filter(item => item.title !== '尺码')
  843. this.addFabricColumns.map(item => {
  844. if(item.title == "箱数"){
  845. item.title = '匹数/Rolls'
  846. }
  847. })
  848. this.$refs.form.resetFields()
  849. },
  850. // - father------------------------------------
  851. aa() {},
  852. modalFormOk() {},
  853. inventoryQuantityChange(record){
  854. record.actualDeclaredQuantity = record.inventoryQuantity
  855. },
  856. actualDeclaredQuantityChange(record){
  857. if(record.actualDeclaredQuantity !== '' || !record.actualDeclaredQuantity){
  858. record.excessQuantity = record.actualDeclaredQuantity - record.remainingQuantity
  859. if(record.excessQuantity < 0){
  860. record.excessQuantity = 0}
  861. }
  862. },
  863. // 分页、排序、筛选变化时触发
  864. // handleTableChange(pagination, filters, sorter) {
  865. // // console.log('当前页信息>>>>',pagination)
  866. // this.queryParam.pageNo = pagination.current
  867. // this.getAnnList()
  868. // }'
  869. }
  870. }
  871. </script>
  872. <style lang="less" scoped>
  873. @import '~@assets/less/common.less';
  874. @import '~@assets/less/overwriter.less';
  875. /deep/ .ant-table-thead > tr > th {
  876. text-align: center;
  877. // font-weight: 700;
  878. }
  879. /deep/ .ant-table-tbody {
  880. text-align: center;
  881. }
  882. // /deep/ th.replacecolor {
  883. // background-color: #ccc;
  884. // }
  885. // 抽屉里的card样式
  886. /deep/ .ant-drawer-content {
  887. background-color: #f0f2f5;
  888. }
  889. /deep/ .ant-drawer-body {
  890. padding: 10px;
  891. }
  892. </style>