addShipDetDrawer.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  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="1">是</a-select-option>
  169. <a-select-option :value="0">否</a-select-option>
  170. </a-select>
  171. </a-form-model-item>
  172. </template>
  173. <!--手册纱单价 -->
  174. <template slot="manualYarnUnitPrice" slot-scope="text, record, index">
  175. <a-form-model-item prop="manualYarnUnitPrice">
  176. <a-input style="width:100%" type="text" v-model="record.manualYarnUnitPrice" :disabled='manualYarnDisabled' @change="changeManualYarn('Price',record.manualYarnUnitPrice)" />
  177. </a-form-model-item>
  178. </template>
  179. <!--手册纱占比 -->
  180. <template slot="manualYarnProportion" slot-scope="text, record, index">
  181. <a-form-model-item prop="manualYarnProportion">
  182. <a-input style="width:100%" type="text" v-model="record.manualYarnProportion" :disabled='manualYarnDisabled' @change="changeManualYarn('Proportion',record.manualYarnProportion)" />
  183. </a-form-model-item>
  184. </template>
  185. <!-- 操作 -->
  186. <template slot="operationSlot" slot-scope="text, record, index">
  187. <a-popconfirm
  188. v-if="syShippingDetailsItemList.length"
  189. title="确定删除吗?"
  190. @confirm="handleDelete(index)"
  191. >
  192. <a href="javascript:void(0);" style="color:red;">删除</a>
  193. </a-popconfirm>
  194. </template>
  195. </a-table>
  196. </a-form-model>
  197. </a-spin>
  198. </a-card>
  199. <!-- 页面底部保存取消 -->
  200. <div
  201. :style="{
  202. position: 'absolute',
  203. right: 0,
  204. bottom: 0,
  205. width: '100%',
  206. borderTop: '1px solid #e9e9e9',
  207. padding: '10px 16px',
  208. background: '#fff',
  209. textAlign: 'right',
  210. zIndex: 1
  211. }"
  212. >
  213. <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
  214. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  215. </a-popconfirm>
  216. <a-button type="primary" @click="addSave">
  217. 保存
  218. </a-button>
  219. </div>
  220. </a-drawer>
  221. <!-- 参照订单数据弹框 -->
  222. <referOrderData-modal ref="referOrderDataModal" @bao="getSon" @ok="referOrderDataOk" @default-reset="defaultReset"></referOrderData-modal>
  223. </div>
  224. </template>
  225. <script>
  226. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  227. import JEllipsis from '@/components/jeecg/JEllipsis'
  228. import moment from 'moment'
  229. import ReferOrderDataModal from '@views/shipment-details/referOrderDataModal.vue'
  230. import { addShipmentList } from '@api/document/shipmentList'
  231. import { getDotConfig, getDotValidExpress } from '@/utils/myutil'
  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: 'ymoney',
  461. width: 120,
  462. className: 'replacecolor'
  463. },
  464. {
  465. title: '单价(销售)',
  466. dataIndex: 'salesUnitPrice',
  467. width: 120,
  468. className: 'replacecolor'
  469. },
  470. {
  471. title: '工厂单价',
  472. dataIndex: 'factoryUnitPrice',
  473. width: 120,
  474. scopedSlots: { customRender: 'factoryUnitPrice' },
  475. className: 'replacecolor'
  476. },
  477. {
  478. title: '付款条件',
  479. dataIndex: 'termOfPayment',
  480. width: 160,
  481. customRender: t => ellipsis(t),
  482. className: 'replacecolor'
  483. },
  484. {
  485. title: '最终客户',
  486. dataIndex: 'endCustomer',
  487. width: 120,
  488. className: 'replacecolor'
  489. },
  490. {
  491. title: '订单备注',
  492. dataIndex: 'orderRemarks',
  493. width: 200,
  494. customRender: t => ellipsis(t),
  495. className: 'replacecolor'
  496. },
  497. {
  498. title: '价格备注',
  499. dataIndex: 'priceRemarks',
  500. width: 160,
  501. customRender: t => ellipsis(t),
  502. className: 'replacecolor'
  503. },
  504. {
  505. title: '订单变更说明',
  506. dataIndex: 'orderChangeDescription',
  507. width: 160,
  508. customRender: t => ellipsis(t),
  509. className: 'replacecolor'
  510. },
  511. {
  512. title: '处理方式',
  513. dataIndex: 'treatmentMethod',
  514. width: 160,
  515. scopedSlots: { customRender: 'treatmentMethod' },
  516. className: 'replacecolor'
  517. },
  518. {
  519. title: '是否手册纱',
  520. dataIndex: 'manualYarnFlag',
  521. width: 140,
  522. scopedSlots: { customRender: 'manualYarnFlag' },
  523. className: 'replacecolor'
  524. },
  525. {
  526. title: '手册纱单价',
  527. dataIndex: 'manualYarnUnitPrice',
  528. width: 160,
  529. scopedSlots: { customRender: 'manualYarnUnitPrice' },
  530. className: 'replacecolor'
  531. },
  532. {
  533. title: '手册纱占比',
  534. dataIndex: 'manualYarnProportion',
  535. width: 120,
  536. scopedSlots: { customRender: 'manualYarnProportion' },
  537. className: 'replacecolor'
  538. },
  539. {
  540. title: '操作',
  541. dataIndex: 'operation',
  542. scopedSlots: { customRender: 'operationSlot' },
  543. width: 100,
  544. fixed: 'right',
  545. className: 'replacecolor'
  546. }
  547. ],
  548. monthStartDate:'',//本月第一天日期
  549. syShippingDetailsItemList: [], // 子表数据
  550. msgFormSon: 'test', // 子组件传来数据的变量
  551. manualYarnDisabled: false, //手工纱单价和手工纱占比可输入
  552. addShipDet: {}, // 主表信息
  553. visible: false,
  554. confirmLoading: false,
  555. dateFormat: 'YYYY-MM-DD',
  556. state: '0', // 单据状态初始未【仅保存】
  557. pushState: '0' // 推送状态初始未【仅保存】
  558. // validatorRules: {
  559. // documentNo: [{ required: true, message: '单据号不能为空', trigger: 'blur' }], 单据号
  560. }
  561. },
  562. // 接收父组件查询方法
  563. props: {
  564. fatherList: {
  565. type: Function,
  566. default: null
  567. }
  568. },
  569. methods: {
  570. //默认预发货日期
  571. defalutDate(){
  572. Date.prototype.format = function(fmt) {
  573. var o = {
  574. "M+" : this.getMonth()+1, //月份
  575. "Y+" : this.getFullYear(), //年
  576. "d+" : this.getDate(), //日
  577. "h+" : this.getHours(), //小时
  578. "m+" : this.getMinutes(), //分
  579. "s+" : this.getSeconds(), //秒
  580. "q+" : Math.floor((this.getMonth()+3)/3), //季度
  581. "S" : this.getMilliseconds() //毫秒
  582. };
  583. if(/(Y+)/.test(fmt)) {
  584. fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
  585. }
  586. for(var k in o) {
  587. if(new RegExp("("+ k +")").test(fmt)){
  588. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
  589. }
  590. }
  591. return fmt;
  592. }
  593. var now = new Date(); //当前日期
  594. var nowMonth = now.getMonth(); //当前月
  595. var nowYear = now.getFullYear(); //当前年
  596. //本月的开始时间
  597. this.monthStartDate = new Date(nowYear, nowMonth, 1).format('YYYY-MM-dd');
  598. },
  599. //参照数据重置,恢复默认值
  600. defaultReset() {
  601. this.defalutDate()
  602. this.$refs.referOrderDataModal.range.push(this.monthStartDate)
  603. this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
  604. this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
  605. },
  606. getSon(val) {
  607. this.manualYarnDisabled = false //初始化manualYarnDisabled
  608. var copyValList = JSON.parse(JSON.stringify(val));
  609. this.addShipDet.customer = copyValList[0].customerName;
  610. console.log(copyValList);
  611. for (var i in copyValList) {
  612. copyValList[i]['orderQuantity'] = copyValList[i].quantity
  613. copyValList[i]['orderRemainingQuantity'] = copyValList[i].surplusNum
  614. copyValList[i]['salesUnitPrice'] = copyValList[i].unitPriceIncludingTax
  615. copyValList[i]['customerOrder'] = copyValList[i].customerOrderNumber
  616. copyValList[i]['shipmentQuantity'] = copyValList[i].surplusNum // 订单剩余数量 赋值给发货数量
  617. }
  618. this.syShippingDetailsItemList = this.syShippingDetailsItemList.concat(copyValList);
  619. this.msgFormSon = this.syShippingDetailsItemList;
  620. this.syShippingDetailsItemList.map(item =>{
  621. item.customsDeclarationUnitPrice = item.salesUnitPrice - item.ymoney
  622. item.manualYarnFlag = 0
  623. this.manualYarnDisabled = true
  624. item.manualYarnUnitPrice = null
  625. item.manualYarnProportion = null
  626. })
  627. this.$forceUpdate()
  628. },
  629. // 参照订单数据
  630. referOrderDataOpen() {
  631. this.$refs.referOrderDataModal.range = []
  632. if(this.syShippingDetailsItemList.length !== 0){
  633. this.$refs.referOrderDataModal.fatherData.push(this.syShippingDetailsItemList[0])
  634. }
  635. this.$refs.referOrderDataModal.referOrderDataModVis = true
  636. this.defalutDate()
  637. this.$refs.referOrderDataModal.range.push(this.monthStartDate)
  638. this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
  639. this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
  640. // console.log('点击参照订单数据')
  641. },
  642. // 新增 保存
  643. addSave() {
  644. const that = this;
  645. // 触发表单验证
  646. this.$refs.form.validate(valid => {
  647. if (valid) {
  648. var newObj = {} // 新增对象
  649. newObj.documentNo = this.addShipDet.documentNo
  650. newObj.documentDate = this.addShipDet.documentDate.format('YYYY-MM-DD')
  651. newObj.customer = this.addShipDet.customer
  652. //newObj.preDeliveryDate = this.addShipDet.preDeliveryDate.format('YYYY-MM-DD') // 预发货日期
  653. //newObj.preCompletionDate = this.addShipDet.preCompletionDate.format('YYYY-MM-DD') // 预完工日期
  654. newObj.orderType = this.addShipDet.orderType
  655. newObj.garmentFactory = this.addShipDet.garmentFactory
  656. newObj.wholeOrderTotal = this.addShipDet.wholeOrderTotal
  657. newObj.memo = this.addShipDet.memo // U8系统适用
  658. newObj.syShippingDetailsItemList = this.syShippingDetailsItemList // 子表信息赋值
  659. // 必须选择子表 --- 参照订单数据
  660. if (newObj.syShippingDetailsItemList.length == 0) {
  661. this.$message.error('请选择参照订单数据')
  662. } else {
  663. for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
  664. var rowData = newObj.syShippingDetailsItemList[i];
  665. if (rowData.shipmentQuantity > rowData.orderRemainingQuantity){
  666. this.$message.error('第'+(i+1)+'行超发货数量超过订单剩余数量,无法保存');
  667. return;
  668. }
  669. }
  670. // 根据syOrderDataItemId判断重复子表id
  671. for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
  672. var rowData = newObj.syShippingDetailsItemList[i];
  673. for (var j=i+1;j<newObj.syShippingDetailsItemList.length; j++){
  674. var nextData = newObj.syShippingDetailsItemList[j];
  675. if (rowData.smallPo == nextData.smallPo && rowData.orderNumber == nextData.orderNumber &&
  676. rowData.preDeliveryDate == nextData.preDeliveryDate && rowData.preCompletionDate == nextData.preCompletionDate &&
  677. rowData.itemNumber == nextData.itemNumber && rowData.inventoryCode == nextData.inventoryCode&&
  678. rowData.colour == nextData.colour&& rowData.size == nextData.size){
  679. this.$message.error('第'+(i+1)+'行和第'+(j+1)+'行数据相同,无法保存');
  680. return;
  681. }
  682. }
  683. }
  684. for(var i=0; i<newObj.syShippingDetailsItemList.length; i++){
  685. var rowData = newObj.syShippingDetailsItemList[i];
  686. //判断输入报关单价是否为数字
  687. if(isNaN(Number(rowData.customsDeclarationUnitPrice,10)) && rowData.customsDeclarationUnitPrice){
  688. this.$message.error('第'+(i+1)+'行报关单价必须为数字!');
  689. return
  690. }
  691. //判断输入发货数量是否为数字
  692. if(isNaN(Number(rowData.shipmentQuantity,10)) && rowData.shipmentQuantity){
  693. this.$message.error('第'+(i+1)+'行发货数量必须为数字!');
  694. return
  695. }
  696. //判断输入套装件数是否为数字
  697. if(isNaN(Number(rowData.numberOfSets,10)) && rowData.numberOfSets){
  698. this.$message.error('第'+(i+1)+'行套装件数必须为数字!');
  699. return
  700. }
  701. //判断输入工厂单价是否为数字
  702. if(isNaN(Number(rowData.factoryUnitPrice,10)) && rowData.factoryUnitPrice){
  703. this.$message.error('第'+(i+1)+'行工厂单价必须为数字!');
  704. return
  705. }
  706. //判断输入工厂单价是否为数字
  707. if(isNaN(Number(rowData.manualYarnUnitPrice,10)) && rowData.manualYarnUnitPrice){
  708. this.$message.error('手册纱单价必须为数字!');
  709. return
  710. }
  711. //报关单价不超过四位小数
  712. if(!Number.isInteger(Number(rowData.customsDeclarationUnitPrice)) && rowData.customsDeclarationUnitPrice !== '' && rowData.customsDeclarationUnitPrice !== undefined){
  713. console.log(rowData.customsDeclarationUnitPrice)
  714. var position = rowData.customsDeclarationUnitPrice.toString().indexOf('.') + 1; //小数点的位置
  715. var digit = rowData.customsDeclarationUnitPrice.toString().length - position; //小数的位数
  716. if(digit > 4){
  717. this.$message.error('第'+(i+1)+'行报关单价超过四位小数!');
  718. return
  719. }
  720. }
  721. // //发货数量必须是整数
  722. // if(!Number.isInteger(Number(rowData.shipmentQuantity)) && rowData.shipmentQuantity !== '' && rowData.shipmentQuantity !== undefined){
  723. // this.$message.error('第'+(i+1)+'行发货数量不为整数!');
  724. // return
  725. // }
  726. //套装件数必须为整数
  727. if(!Number.isInteger(Number(rowData.numberOfSets)) && rowData.numberOfSets !== '' && rowData.numberOfSets !== undefined){
  728. this.$message.error('第'+(i+1)+'行套装件数不为整数!');
  729. return
  730. }
  731. //工厂单价不超过四位小数
  732. if(!Number.isInteger(Number(rowData.factoryUnitPrice)) && rowData.factoryUnitPrice !== '' && rowData.factoryUnitPrice !== undefined){
  733. var position = rowData.factoryUnitPrice.toString().indexOf('.') + 1; //小数点的位置
  734. var digit = rowData.factoryUnitPrice.toString().length - position; //小数的位数
  735. if(digit > 4){
  736. this.$message.error('第'+(i+1)+'行工厂单价超过四位小数!');
  737. return
  738. }
  739. }
  740. //手册纱单价不超过四位小数
  741. if(!Number.isInteger(Number(rowData.manualYarnUnitPrice)) && rowData.manualYarnUnitPrice !== '' && rowData.manualYarnUnitPrice !== undefined){
  742. console.log(rowData.factoryUnitPrice)
  743. var position = rowData.manualYarnUnitPrice.toString().indexOf('.') + 1; //小数点的位置
  744. var digit = rowData.manualYarnUnitPrice.toString().length - position; //小数的位数
  745. if(digit > 4){
  746. this.$message.error('手册纱单价超过四位小数!');
  747. return
  748. }
  749. }
  750. }
  751. //判断当是手册纱时,手册纱单价和手册纱占比是否为空
  752. for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
  753. var rowData = newObj.syShippingDetailsItemList[i];
  754. if((rowData.manualYarnFlag === 1 && !rowData.manualYarnUnitPrice) || (rowData.manualYarnFlag === 1 && rowData.manualYarnUnitPrice === '')|| (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === "0") || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === 0) ){
  755. this.$message.error('手册纱单价为必填项');
  756. return
  757. }else if((rowData.manualYarnFlag === 1 && !rowData.manualYarnProportion) || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === '') || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === "0") || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === 0)){
  758. this.$message.error('手册纱占比为必填项');
  759. return
  760. }
  761. }
  762. addShipmentList(newObj).then(res => {
  763. if (res.success) {
  764. this.$message.success('新增成功');
  765. this.close();
  766. // 清空信息
  767. this.addShipDet = {};
  768. this.addShipDet.syShippingDetailsItemList = [];
  769. // this.fatherList(); // 调用父组件 查询方法
  770. // this.msgFormSon = {} 清空子表信息
  771. }else{
  772. this.$message.error(res.message);
  773. }
  774. })
  775. }
  776. }else{
  777. return false;
  778. }
  779. });
  780. // const that = this
  781. // // 触发表单验证
  782. // this.$refs.form.validate(valid => {
  783. // if (valid) {
  784. // that.confirmLoading = true
  785. // }
  786. // })
  787. },
  788. // 校验复制行数量和不能超订单,根据syOrderDataItemId判断
  789. // 増行
  790. // handleAddColumn() {
  791. // console.log('増行')
  792. // const addrow = {
  793. // accountSet: '',
  794. // documentNo: '',
  795. // itemNumber: '',
  796. // orderDate: '',
  797. // businessType: '',
  798. // customerOrder: '',
  799. // smallPo: '',
  800. // packId: '',
  801. // orderDate: '',
  802. // orderRemaQuantity: '',
  803. // shipQuantity: '',
  804. // isTC: '',
  805. // materialComposition: '',
  806. // saleType: '',
  807. // customerShortName: '',
  808. // customerName: '',
  809. // exchangeRate: '',
  810. // wholeSingleCombined: '',
  811. // salesDepartment: '',
  812. // salesman: '',
  813. // currency: '',
  814. // brand: '',
  815. // thirdParty: '',
  816. // depositRate: '',
  817. // deposit: '',
  818. // collaborativeRoute: '',
  819. // paymentClause: '',
  820. // finalCustomer: '',
  821. // orderNote: '',
  822. // priceNote: '',
  823. // orderChangeDesc: '',
  824. // operation: ''
  825. // }
  826. // this.syShippingDetailsItemList.push(addrow)
  827. // },
  828. // --------------------------------------
  829. // 操作 删除
  830. handleDelete(index) {
  831. return this.syShippingDetailsItemList.splice(index, 1)
  832. },
  833. // 操作 复制 复制一行已有的数据
  834. copy(record) {
  835. var newRecord = JSON.parse(JSON.stringify(record));
  836. this.syShippingDetailsItemList.push(newRecord)
  837. },
  838. handleCancel() {
  839. this.close()
  840. },
  841. close() {
  842. this.$emit('close');
  843. this.visible = false;
  844. this.addShipDet = {};
  845. this.syShippingDetailsItemList = [];
  846. },
  847. // 参照订单数据弹框 ok-------------------------------------
  848. referOrderDataOk() {
  849. // console.log('参照订单数据弹框确定')
  850. this.$refs.referOrderDataModal.referOrderDataModVis = false;
  851. this.$refs.referOrderDataModal.queryParam.orderNumber="";
  852. this.$refs.referOrderDataModal.queryParam.account="";
  853. this.$refs.referOrderDataModal.queryParam.salesman="";
  854. this.$refs.referOrderDataModal.queryParam.customerName="";
  855. this.$refs.referOrderDataModal.queryParam.dateRange=[];
  856. this.$refs.referOrderDataModal.queryParam.preDeliveryDate="";
  857. this.$refs.referOrderDataModal.queryParam.flourOrGarment="";
  858. },
  859. //修改是否为手册纱时触发
  860. changeManualYarnFlag(val) {
  861. this.syShippingDetailsItemList.map(item =>{
  862. item.manualYarnFlag = null
  863. item.manualYarnFlag = val
  864. //是手工纱时
  865. if(val === 0){
  866. item.manualYarnUnitPrice = 0
  867. item.manualYarnProportion = 0
  868. this.manualYarnDisabled = true
  869. }else {
  870. this.manualYarnDisabled = false
  871. }
  872. })
  873. this.$forceUpdate()
  874. },
  875. //输入手册纱单价或者手册纱占比时触发
  876. changeManualYarn(data,val){
  877. console.log(this.syShippingDetailsItemList)
  878. this.syShippingDetailsItemList.map(item => {
  879. if(data === 'Price'){item.manualYarnUnitPrice = val}
  880. else{item.manualYarnProportion = val}
  881. })
  882. this.$forceUpdate()
  883. }
  884. }
  885. }
  886. </script>
  887. <style lang="less" scoped>
  888. @import '~@assets/less/common.less';
  889. /deep/ .ant-table-thead > tr > th {
  890. text-align: center;
  891. // font-weight: 700;
  892. }
  893. /deep/ .ant-table-tbody {
  894. text-align: center;
  895. }
  896. // /deep/ th.replacecolor {
  897. // background-color: #ccc;
  898. // }
  899. // 抽屉里的card样式
  900. /deep/ .ant-drawer-content {
  901. background-color: #f0f2f5;
  902. }
  903. /deep/ .ant-drawer-body {
  904. padding: 10px;
  905. }
  906. // 子表下拉显示
  907. /deep/ .ant-card-body {
  908. margin-bottom: 60px;
  909. }
  910. </style>