editShipDetDrawer.vue 30 KB

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