addFabricDrawer.vue 37 KB

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