editShipDetDrawer.vue 36 KB

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