addShipDetDrawer.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  1. <template>
  2. <!-- 新增 发运明细 -->
  3. <div id="AddShipDetDrawer">
  4. <a-drawer
  5. title="新增发运明细"
  6. width="89%"
  7. placement="right"
  8. :closable="true"
  9. :visible="visible"
  10. @close="handleCancel"
  11. >
  12. <!-- 主表信息 填写-->
  13. <a-card :bordered="true">
  14. <div class="table-page-search-wrapper">
  15. <!-- :rules="validatorRules" -->
  16. <a-form-model layout="inline" ref="form" :model="addShipDet" :rules="validatorRules">
  17. <a-row :gutter="24">
  18. <a-col :md="6" :sm="8">
  19. <!-- required 必填项 disabled 禁用 -->
  20. <a-form-model-item label="单据号" prop="documentNo">
  21. <a-input placeholder="自动生成" v-model="addShipDet.documentNo" readOnly></a-input>
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :md="6" :sm="8">
  25. <a-form-model-item label="单据日期" prop="documentDate">
  26. <a-date-picker
  27. placeholder="请选择单据日期"
  28. format="YYYY-MM-DD"
  29. style="width:100%;"
  30. v-model="addShipDet.documentDate"
  31. />
  32. </a-form-model-item>
  33. </a-col>
  34. <a-col :md="6" :sm="8">
  35. <a-form-model-item label="客户" prop="customer">
  36. <a-input placeholder="请输入客户" v-model="addShipDet.customer"></a-input>
  37. </a-form-model-item>
  38. </a-col>
  39. <!-- <a-col :md="6" :sm="8">
  40. <a-form-model-item label="预发货日期" prop="preDeliveryDate">
  41. <a-date-picker
  42. placeholder="请选择预发货时间"
  43. format="YYYY-MM-DD"
  44. style="width:100%;"
  45. v-model="addShipDet.preDeliveryDate"
  46. />
  47. </a-form-model-item>
  48. </a-col> -->
  49. <!-- <a-col :md="6" :sm="8">
  50. <a-form-model-item label="预完工日期" prop="preCompletionDate">
  51. <a-date-picker
  52. placeholder="请选择预完工日期"
  53. format="YYYY-MM-DD"
  54. style="width:100%;"
  55. v-model="addShipDet.preCompletionDate"
  56. />
  57. </a-form-model-item>
  58. </a-col> -->
  59. <a-col :md="6" :sm="8">
  60. <a-form-model-item label="订单类型" prop="orderType">
  61. <a-input placeholder="请输入订单类型" v-model="addShipDet.orderType"></a-input>
  62. </a-form-model-item>
  63. </a-col>
  64. <!-- <a-col :md="6" :sm="8">
  65. <a-form-model-item label="成衣工厂" prop="garmentFactory">
  66. <a-input placeholder="请输入成衣工厂" v-model="addShipDet.garmentFactory"></a-input>
  67. </a-form-model-item>
  68. </a-col> -->
  69. <!--
  70. <a-col :md="6" :sm="8">
  71. <a-form-model-item label="整单合计" prop="wholeOrderTotal">
  72. <a-input placeholder="整单合计" v-model="addShipDet.wholeOrderTotal"></a-input>
  73. </a-form-model-item>
  74. </a-col> -->
  75. <!-- U8系统适用 -->
  76. <a-col :md="12" :sm="12">
  77. <a-form-model-item label="备注" prop="memo">
  78. <a-input placeholder="U8系统适用" v-model="addShipDet.memo"></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">
  87. <div class="table-operator">
  88. <a-button type="primary" @click.stop="referOrderDataOpen" icon="ordered-list">参照订单数据</a-button>
  89. <!-- <a-button type="primary" @click.stop="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button> -->
  90. </div>
  91. <!-- 子表 :model="form" rowKey="id" ,y:800 -->
  92. <a-spin :spinning="confirmLoading">
  93. <a-form-model ref="formRef">
  94. <a-table
  95. :loading="loading"
  96. v-if="syShippingDetailsItemList"
  97. bordered
  98. :rowKey="record => record.id"
  99. :columns="columns"
  100. :data-source="syShippingDetailsItemList"
  101. :pagination="false"
  102. :scroll="{ x: 2800, y: 400 }"
  103. size="small"
  104. >
  105. <!-- 款号 输入框 :rules="rules.itemNumber" -->
  106. <template slot="itemNumber" slot-scope="text, record, index">
  107. <a-form-model-item prop="itemNumber">
  108. <a-input style="width:100%" type="text" v-model="record.itemNumber" readOnly />
  109. </a-form-model-item>
  110. </template>
  111. <!-- 发货数量 :rules="rules.shipQuantity"-->
  112. <template slot="shipmentQuantity" slot-scope="text, record, index">
  113. <a-form-model-item prop="shipmentQuantity">
  114. <a-input style="width:100%" type="text" v-model="record.shipmentQuantity" />
  115. </a-form-model-item>
  116. </template>
  117. <!-- 是否TC功能 :rules="rules.isTC"-->
  118. <!-- isTc ' 是否 tc 功能 0 否 1 是', -->
  119. <template slot="isTC" slot-scope="text, record, index">
  120. <a-form-model-item prop="isTc">
  121. <a-select v-model="record.isTc">
  122. <a-select-option value="">请选择</a-select-option>
  123. <a-select-option value="1">是</a-select-option>
  124. <a-select-option value="0">否</a-select-option>
  125. </a-select>
  126. </a-form-model-item>
  127. </template>
  128. <!-- 物料成分 :rules="rules.materialComposition"-->
  129. <template slot="materialComposition" slot-scope="text, record, index">
  130. <a-form-model-item prop="materialComposition">
  131. <a-input style="width:100%" type="text" v-model="record.materialComposition" />
  132. </a-form-model-item>
  133. </template>
  134. <!-- 采购/委外订单号 :rules="rules.purOrSubOrder"-->
  135. <template slot="purOrSubOrder" slot-scope="text, record, index">
  136. <a-form-model-item prop="purOrSubOrder">
  137. <a-input style="width:100%" type="text" v-model="record.purOrSubOrder" />
  138. </a-form-model-item>
  139. </template>
  140. <!-- 报关单价 :rules="rules.customsDeclarationUnitPrice"-->
  141. <template slot="customsDeclarationUnitPrice" slot-scope="text, record, index">
  142. <a-form-model-item prop="customsDeclarationUnitPrice">
  143. <a-input style="width:100%" type="text" v-model="record.customsDeclarationUnitPrice" />
  144. </a-form-model-item>
  145. </template>
  146. <!-- 套装件数 :rules="rules.numberOfSets"-->
  147. <template slot="numberOfSets" slot-scope="text, record, index">
  148. <a-form-model-item prop="numberOfSets">
  149. <a-input style="width:100%" type="text" v-model="record.numberOfSets" />
  150. </a-form-model-item>
  151. </template>
  152. <!-- 工厂单价 :rules="rules.factoryUnitPrice"-->
  153. <template slot="factoryUnitPrice" slot-scope="text, record, index">
  154. <a-form-model-item prop="factoryUnitPrice">
  155. <a-input style="width:100%" type="text" v-model="record.factoryUnitPrice" />
  156. </a-form-model-item>
  157. </template>
  158. <!--处理方式 -->
  159. <template slot="treatmentMethod" slot-scope="text, record, index">
  160. <a-form-model-item prop="treatmentMethod">
  161. <a-input style="width:100%" type="text" v-model="record.treatmentMethod" />
  162. </a-form-model-item>
  163. </template>
  164. <!--是否手册纱 -->
  165. <template slot="manualYarnFlag" slot-scope="text, record, index">
  166. <a-form-model-item prop="manualYarnFlag">
  167. <a-select v-model="record.manualYarnFlag" @change='changeManualYarnFlag'>
  168. <a-select-option value="">请选择</a-select-option>
  169. <a-select-option :value="1">是</a-select-option>
  170. <a-select-option :value="0">否</a-select-option>
  171. </a-select>
  172. </a-form-model-item>
  173. </template>
  174. <!--手册纱单价 -->
  175. <template slot="manualYarnUnitPrice" slot-scope="text, record, index">
  176. <a-form-model-item prop="manualYarnUnitPrice">
  177. <a-input style="width:100%" type="text" v-model="record.manualYarnUnitPrice" :disabled='manualYarnDisabled' @change="changeManualYarn('Price',record.manualYarnUnitPrice)" />
  178. </a-form-model-item>
  179. </template>
  180. <!--手册纱占比 -->
  181. <template slot="manualYarnProportion" slot-scope="text, record, index">
  182. <a-form-model-item prop="manualYarnProportion">
  183. <a-input style="width:100%" type="text" v-model="record.manualYarnProportion" :disabled='manualYarnDisabled' @change="changeManualYarn('Proportion',record.manualYarnProportion)" />
  184. </a-form-model-item>
  185. </template>
  186. <!-- 操作 -->
  187. <template slot="operationSlot" slot-scope="text, record, index">
  188. <a-popconfirm
  189. v-if="syShippingDetailsItemList.length"
  190. title="确定删除吗?"
  191. @confirm="handleDelete(index)"
  192. >
  193. <a href="javascript:void(0);" style="color:red;">删除</a>
  194. </a-popconfirm>
  195. </template>
  196. </a-table>
  197. </a-form-model>
  198. </a-spin>
  199. </a-card>
  200. <!-- 页面底部保存取消 -->
  201. <div
  202. :style="{
  203. position: 'absolute',
  204. right: 0,
  205. bottom: 0,
  206. width: '100%',
  207. borderTop: '1px solid #e9e9e9',
  208. padding: '10px 16px',
  209. background: '#fff',
  210. textAlign: 'right',
  211. zIndex: 1
  212. }"
  213. >
  214. <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
  215. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  216. </a-popconfirm>
  217. <a-button type="primary" @click="addSave">
  218. 保存
  219. </a-button>
  220. </div>
  221. </a-drawer>
  222. <!-- 参照订单数据弹框 -->
  223. <referOrderData-modal ref="referOrderDataModal" @bao="getSon" @ok="referOrderDataOk"></referOrderData-modal>
  224. </div>
  225. </template>
  226. <script>
  227. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  228. import JEllipsis from '@/components/jeecg/JEllipsis'
  229. import moment from 'moment'
  230. import ReferOrderDataModal from '@views/shipment-details/referOrderDataModal.vue'
  231. import { addShipmentList } from '@api/document/shipmentList'
  232. export default {
  233. name: 'AddShipDetDrawer', // 新增 发运明细 抽屉
  234. mixins: [JeecgListMixin],
  235. components: { JEllipsis, ReferOrderDataModal, moment }, // 参照订单数据 弹框
  236. data() {
  237. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  238. return {
  239. id: '',
  240. validatorRules:{
  241. documentDate:[{required: true, message: '请输入单据日期!'}],
  242. // customer:[{required: true, message: '请选择客户!'}],
  243. // preDeliveryDate:[{required: true, message: '请选择预发货时间!'}],
  244. // preCompletionDate:[{required: true, message: '请选择预完工日期!'}],
  245. // orderType:[{required: true, message: '请输入订单类型!'}],
  246. },
  247. // 表头
  248. columns: [
  249. {
  250. title: '账套',
  251. dataIndex: 'account',
  252. width: 80,
  253. fixed: 'left',
  254. className: 'replacecolor'
  255. },
  256. {
  257. title: '订单号',
  258. dataIndex: 'orderNumber',
  259. width: 120,
  260. fixed: 'left',
  261. className: 'replacecolor'
  262. },
  263. {
  264. title: '款号',
  265. dataIndex: 'itemNumber',
  266. fixed: 'left',
  267. width: 180,
  268. className: 'replacecolor'
  269. },
  270. {
  271. title: '订单日期',
  272. dataIndex: 'orderDate',
  273. width: 120,
  274. className: 'replacecolor',
  275. customRender: text => {
  276. return moment(text).format('YYYY-MM-DD')
  277. }
  278. },
  279. {
  280. title: '预发货日期',
  281. dataIndex: 'preDeliveryDate',
  282. width: 100,
  283. className: 'replacecolor',
  284. },
  285. {
  286. title: '预完工日期',
  287. dataIndex: 'preCompletionDate',
  288. width: 100,
  289. className: 'replacecolor',
  290. },
  291. {
  292. title: '成衣工厂',
  293. dataIndex: 'garmentFactory',
  294. width: 100,
  295. className: 'replacecolor'
  296. },
  297. {
  298. title: '业务类型',
  299. dataIndex: 'businessTypeText',
  300. width: 120,
  301. className: 'replacecolor'
  302. },
  303. {
  304. title: '客户订单',
  305. dataIndex: 'customerOrder',
  306. width: 120,
  307. className: 'replacecolor'
  308. },
  309. {
  310. title: '小po',
  311. dataIndex: 'smallPo',
  312. width: 120,
  313. className: 'replacecolor'
  314. },
  315. {
  316. title: 'Pack Id',
  317. dataIndex: 'packId',
  318. width: 120,
  319. className: 'replacecolor'
  320. },
  321. {
  322. title: '分销点',
  323. dataIndex: 'distributionPoint',
  324. width: 120,
  325. className: 'replacecolor'
  326. },
  327. {
  328. title: '采购/委外订单号',
  329. dataIndex: 'purOrSubOrder',
  330. scopedSlots: { customRender: 'purOrSubOrder' },
  331. // fixed: 'left',
  332. width: 180,
  333. className: 'replacecolor'
  334. },
  335. {
  336. title: ' 报关单价',
  337. dataIndex: 'customsDeclarationUnitPrice',
  338. scopedSlots: { customRender: 'customsDeclarationUnitPrice' },
  339. // fixed: 'left',
  340. width: 180,
  341. className: 'replacecolor'
  342. },
  343. {
  344. title: '订单数量',
  345. dataIndex: 'orderQuantity',
  346. width: 120,
  347. className: 'replacecolor'
  348. },
  349. {
  350. title: '订单剩余数量',
  351. dataIndex: 'orderRemainingQuantity',
  352. width: 120,
  353. className: 'replacecolor'
  354. },
  355. {
  356. title: '发货数量',
  357. dataIndex: 'shipmentQuantity',
  358. scopedSlots: { customRender: 'shipmentQuantity' },
  359. width: 120,
  360. },
  361. {
  362. title: '套装件数',
  363. dataIndex: 'numberOfSets',
  364. scopedSlots: { customRender: 'numberOfSets' },
  365. width: 120,
  366. className: 'replacecolor'
  367. },
  368. {
  369. title: '是否TC功能',
  370. dataIndex: 'isTC',
  371. width: 90,
  372. scopedSlots: { customRender: 'isTC' },
  373. className: 'replacecolor'
  374. },
  375. {
  376. title: '物料成分',
  377. dataIndex: 'materialComposition',
  378. scopedSlots: { customRender: 'materialComposition' },
  379. width: 140,
  380. className: 'replacecolor'
  381. },
  382. {
  383. title: '销售类型',
  384. dataIndex: 'salesTypeText',
  385. width: 120,
  386. className: 'replacecolor'
  387. },
  388. {
  389. title: '客户简称',
  390. dataIndex: 'customerAbbreviation',
  391. width: 220,
  392. align: 'left',
  393. className: 'replacecolor'
  394. },
  395. {
  396. title: '客户名称',
  397. dataIndex: 'customerName',
  398. width: 300,
  399. align: 'left',
  400. className: 'replacecolor',
  401. customRender: t => ellipsis(t),
  402. },
  403. {
  404. title: '汇率',
  405. dataIndex: 'exchangeRate',
  406. width: 120,
  407. className: 'replacecolor'
  408. },
  409. {
  410. title: '销售部门',
  411. dataIndex: 'salesDepartment',
  412. width: 120,
  413. className: 'replacecolor'
  414. },
  415. {
  416. title: '业务员',
  417. dataIndex: 'salesman',
  418. width: 120,
  419. className: 'replacecolor'
  420. },
  421. {
  422. title: '币种',
  423. dataIndex: 'currencyText',
  424. width: 120,
  425. className: 'replacecolor'
  426. },
  427. {
  428. title: '品牌方',
  429. dataIndex: 'brandSide',
  430. width: 180,
  431. className: 'replacecolor'
  432. },
  433. {
  434. title: '第三方',
  435. dataIndex: 'thirdParty',
  436. width: 220,
  437. align: 'left',
  438. className: 'replacecolor'
  439. },
  440. {
  441. title: '定金比例(%)',
  442. dataIndex: 'depositRatio',
  443. width: 120,
  444. className: 'replacecolor'
  445. },
  446. {
  447. title: '定金',
  448. dataIndex: 'deposit',
  449. width: 120,
  450. className: 'replacecolor'
  451. },
  452. {
  453. title: '协同路线',
  454. dataIndex: 'collaborativeRoute',
  455. width: 120,
  456. className: 'replacecolor'
  457. },
  458. {
  459. title: '单价(销售)',
  460. dataIndex: 'salesUnitPrice',
  461. width: 120,
  462. className: 'replacecolor'
  463. },
  464. {
  465. title: '工厂单价',
  466. dataIndex: 'factoryUnitPrice',
  467. width: 120,
  468. scopedSlots: { customRender: 'factoryUnitPrice' },
  469. className: 'replacecolor'
  470. },
  471. {
  472. title: '付款条件',
  473. dataIndex: 'termOfPayment',
  474. width: 160,
  475. customRender: t => ellipsis(t),
  476. className: 'replacecolor'
  477. },
  478. {
  479. title: '最终客户',
  480. dataIndex: 'endCustomer',
  481. width: 120,
  482. className: 'replacecolor'
  483. },
  484. {
  485. title: '订单备注',
  486. dataIndex: 'orderRemarks',
  487. width: 200,
  488. customRender: t => ellipsis(t),
  489. className: 'replacecolor'
  490. },
  491. {
  492. title: '价格备注',
  493. dataIndex: 'priceRemarks',
  494. width: 160,
  495. customRender: t => ellipsis(t),
  496. className: 'replacecolor'
  497. },
  498. {
  499. title: '订单变更说明',
  500. dataIndex: 'orderChangeDescription',
  501. width: 160,
  502. customRender: t => ellipsis(t),
  503. className: 'replacecolor'
  504. },
  505. {
  506. title: '处理方式',
  507. dataIndex: 'treatmentMethod',
  508. width: 160,
  509. scopedSlots: { customRender: 'treatmentMethod' },
  510. className: 'replacecolor'
  511. },
  512. {
  513. title: '是否手册纱',
  514. dataIndex: 'manualYarnFlag',
  515. width: 140,
  516. scopedSlots: { customRender: 'manualYarnFlag' },
  517. className: 'replacecolor'
  518. },
  519. {
  520. title: '手册纱单价',
  521. dataIndex: 'manualYarnUnitPrice',
  522. width: 160,
  523. scopedSlots: { customRender: 'manualYarnUnitPrice' },
  524. className: 'replacecolor'
  525. },
  526. {
  527. title: '手册纱占比',
  528. dataIndex: 'manualYarnProportion',
  529. width: 120,
  530. scopedSlots: { customRender: 'manualYarnProportion' },
  531. className: 'replacecolor'
  532. },
  533. {
  534. title: '操作',
  535. dataIndex: 'operation',
  536. scopedSlots: { customRender: 'operationSlot' },
  537. width: 100,
  538. fixed: 'right',
  539. className: 'replacecolor'
  540. }
  541. ],
  542. syShippingDetailsItemList: [], // 子表数据
  543. msgFormSon: 'test', // 子组件传来数据的变量
  544. manualYarnDisabled: false, //手工纱单价和手工纱占比可输入
  545. addShipDet: {}, // 主表信息
  546. visible: false,
  547. confirmLoading: false,
  548. dateFormat: 'YYYY-MM-DD',
  549. state: '0', // 单据状态初始未【仅保存】
  550. pushState: '0' // 推送状态初始未【仅保存】
  551. // validatorRules: {
  552. // documentNo: [{ required: true, message: '单据号不能为空', trigger: 'blur' }], 单据号
  553. }
  554. },
  555. // 接收父组件查询方法
  556. props: {
  557. fatherList: {
  558. type: Function,
  559. default: null
  560. }
  561. },
  562. methods: {
  563. getSon(val) {
  564. this.manualYarnDisabled = false //初始化manualYarnDisabled
  565. var copyValList = JSON.parse(JSON.stringify(val));
  566. this.addShipDet.customer = copyValList[0].customerName;
  567. console.log(copyValList);
  568. for (var i in copyValList) {
  569. copyValList[i]['orderQuantity'] = copyValList[i].quantity
  570. copyValList[i]['orderRemainingQuantity'] = copyValList[i].surplusNum
  571. copyValList[i]['salesUnitPrice'] = copyValList[i].unitPriceIncludingTax
  572. copyValList[i]['customerOrder'] = copyValList[i].customerOrderNumber
  573. copyValList[i]['shipmentQuantity'] = copyValList[i].surplusNum // 订单剩余数量 赋值给发货数量
  574. }
  575. this.syShippingDetailsItemList = this.syShippingDetailsItemList.concat(copyValList);
  576. this.msgFormSon = this.syShippingDetailsItemList;
  577. },
  578. // 参照订单数据
  579. referOrderDataOpen() {
  580. this.$refs.referOrderDataModal.referOrderDataModVis = true
  581. // console.log('点击参照订单数据')
  582. },
  583. // 新增 保存
  584. addSave() {
  585. const that = this;
  586. // 触发表单验证
  587. this.$refs.form.validate(valid => {
  588. if (valid) {
  589. var newObj = {} // 新增对象
  590. newObj.documentNo = this.addShipDet.documentNo
  591. newObj.documentDate = this.addShipDet.documentDate.format('YYYY-MM-DD')
  592. newObj.customer = this.addShipDet.customer
  593. //newObj.preDeliveryDate = this.addShipDet.preDeliveryDate.format('YYYY-MM-DD') // 预发货日期
  594. //newObj.preCompletionDate = this.addShipDet.preCompletionDate.format('YYYY-MM-DD') // 预完工日期
  595. newObj.orderType = this.addShipDet.orderType
  596. newObj.garmentFactory = this.addShipDet.garmentFactory
  597. newObj.wholeOrderTotal = this.addShipDet.wholeOrderTotal
  598. newObj.memo = this.addShipDet.memo // U8系统适用
  599. newObj.syShippingDetailsItemList = this.syShippingDetailsItemList // 子表信息赋值
  600. // 必须选择子表 --- 参照订单数据
  601. if (newObj.syShippingDetailsItemList.length == 0) {
  602. this.$message.error('请选择参照订单数据')
  603. } else {
  604. for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
  605. var rowData = newObj.syShippingDetailsItemList[i];
  606. if (rowData.shipmentQuantity > rowData.orderRemainingQuantity){
  607. this.$message.error('第'+(i+1)+'行超发货数量超过订单剩余数量,无法保存');
  608. return;
  609. }
  610. }
  611. // 根据syOrderDataItemId判断重复子表id
  612. for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
  613. var rowData = newObj.syShippingDetailsItemList[i];
  614. for (var j=i+1;j<newObj.syShippingDetailsItemList.length; j++){
  615. var nextData = newObj.syShippingDetailsItemList[j];
  616. if (rowData.syOrderDataItemId == nextData.syOrderDataItemId){
  617. this.$message.error('第'+(i+1)+'行和第'+(j+1)+'行物订单子表id重复,无法保存');
  618. return;
  619. }
  620. }
  621. }
  622. //判断当是手册纱时,手册纱单价和手册纱占比是否为空
  623. for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
  624. var rowData = newObj.syShippingDetailsItemList[i];
  625. if((rowData.manualYarnFlag === 1 && rowData.manualYarnUnitPrice === undefined) || (rowData.manualYarnFlag === 1 && rowData.manualYarnUnitPrice === '') ){
  626. this.$message.error('手册纱单价为必填项');
  627. return
  628. }else if((rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === undefined) || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === '')){
  629. this.$message.error('手册纱占比为必填项');
  630. return
  631. }
  632. }
  633. addShipmentList(newObj).then(res => {
  634. if (res.success) {
  635. this.$message.success('新增成功');
  636. this.close();
  637. // 清空信息
  638. this.addShipDet = {};
  639. this.addShipDet.syShippingDetailsItemList = [];
  640. this.fatherList(); // 调用父组件 查询方法
  641. // this.msgFormSon = {} 清空子表信息
  642. }else{
  643. this.$message.error(res.message);
  644. }
  645. })
  646. }
  647. }else{
  648. return false;
  649. }
  650. });
  651. // const that = this
  652. // // 触发表单验证
  653. // this.$refs.form.validate(valid => {
  654. // if (valid) {
  655. // that.confirmLoading = true
  656. // }
  657. // })
  658. },
  659. // 校验复制行数量和不能超订单,根据syOrderDataItemId判断
  660. // 増行
  661. // handleAddColumn() {
  662. // console.log('増行')
  663. // const addrow = {
  664. // accountSet: '',
  665. // documentNo: '',
  666. // itemNumber: '',
  667. // orderDate: '',
  668. // businessType: '',
  669. // customerOrder: '',
  670. // smallPo: '',
  671. // packId: '',
  672. // orderDate: '',
  673. // orderRemaQuantity: '',
  674. // shipQuantity: '',
  675. // isTC: '',
  676. // materialComposition: '',
  677. // saleType: '',
  678. // customerShortName: '',
  679. // customerName: '',
  680. // exchangeRate: '',
  681. // wholeSingleCombined: '',
  682. // salesDepartment: '',
  683. // salesman: '',
  684. // currency: '',
  685. // brand: '',
  686. // thirdParty: '',
  687. // depositRate: '',
  688. // deposit: '',
  689. // collaborativeRoute: '',
  690. // paymentClause: '',
  691. // finalCustomer: '',
  692. // orderNote: '',
  693. // priceNote: '',
  694. // orderChangeDesc: '',
  695. // operation: ''
  696. // }
  697. // this.syShippingDetailsItemList.push(addrow)
  698. // },
  699. // --------------------------------------
  700. // 操作 删除
  701. handleDelete(index) {
  702. return this.syShippingDetailsItemList.splice(index, 1)
  703. },
  704. // 操作 复制 复制一行已有的数据
  705. copy(record) {
  706. var newRecord = JSON.parse(JSON.stringify(record));
  707. this.syShippingDetailsItemList.push(newRecord)
  708. },
  709. handleCancel() {
  710. this.close()
  711. },
  712. close() {
  713. this.$emit('close');
  714. this.visible = false;
  715. this.addShipDet = {};
  716. this.syShippingDetailsItemList = [];
  717. },
  718. // 参照订单数据弹框 ok-------------------------------------
  719. referOrderDataOk() {
  720. // console.log('参照订单数据弹框确定')
  721. this.$refs.referOrderDataModal.referOrderDataModVis = false;
  722. this.$refs.referOrderDataModal.queryParam.orderNumber="";
  723. this.$refs.referOrderDataModal.queryParam.account="";
  724. this.$refs.referOrderDataModal.queryParam.salesman="";
  725. this.$refs.referOrderDataModal.queryParam.customerName="";
  726. this.$refs.referOrderDataModal.queryParam.dateRange=[];
  727. this.$refs.referOrderDataModal.queryParam.preDeliveryDate="";
  728. this.$refs.referOrderDataModal.queryParam.flourOrGarment="";
  729. },
  730. //修改是否为手册纱时触发
  731. changeManualYarnFlag(val) {
  732. this.syShippingDetailsItemList.map(item =>{
  733. item.manualYarnFlag = null
  734. item.manualYarnFlag = val
  735. //是手工纱时
  736. if(val === 0){
  737. item.manualYarnUnitPrice = 0
  738. item.manualYarnProportion = 0
  739. this.manualYarnDisabled = true
  740. }else {
  741. this.manualYarnDisabled = false
  742. }
  743. })
  744. this.$forceUpdate()
  745. },
  746. //输入手册纱单价或者手册纱占比时触发
  747. changeManualYarn(data,val){
  748. console.log(this.syShippingDetailsItemList)
  749. debugger
  750. this.syShippingDetailsItemList.map(item => {
  751. if(data === 'Price'){item.manualYarnUnitPrice = val}
  752. else{item.manualYarnProportion = val}
  753. })
  754. this.$forceUpdate()
  755. }
  756. }
  757. }
  758. </script>
  759. <style lang="less" scoped>
  760. @import '~@assets/less/common.less';
  761. /deep/ .ant-table-thead > tr > th {
  762. text-align: center;
  763. // font-weight: 700;
  764. }
  765. /deep/ .ant-table-tbody {
  766. text-align: center;
  767. }
  768. // /deep/ th.replacecolor {
  769. // background-color: #ccc;
  770. // }
  771. // 抽屉里的card样式
  772. /deep/ .ant-drawer-content {
  773. background-color: #f0f2f5;
  774. }
  775. /deep/ .ant-drawer-body {
  776. padding: 10px;
  777. }
  778. // 子表下拉显示
  779. /deep/ .ant-card-body {
  780. margin-bottom: 60px;
  781. }
  782. </style>