material.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. <!-- 材料明细-->
  2. <template>
  3. <div >
  4. <a-form-model ref="formRef" :model="form">
  5. <a-table
  6. ref="table"
  7. size="middle"
  8. bordered
  9. id='sonList'
  10. :columns="columns"
  11. rowKey="rowNo"
  12. :dataSource="form.dataSource"
  13. :pagination="false"
  14. :scroll="{ x: 6500, y: 300 }"
  15. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  16. @change="handleTableChange"
  17. >
  18. <span slot="quantityTitle" class="form-table-heard">
  19. 主数量
  20. </span>
  21. <span slot="unQuantityTitle" class="form-table-heard">
  22. 辅数量
  23. </span>
  24. <span slot="inventoryCodeTitle" class="form-table-heard">
  25. 料品编码
  26. </span>
  27. <template slot="batch" slot-scope="text, record, index">
  28. <a-form-model-item prop="batch" class='sonItem'>
  29. <span v-if="title=='订单操作'">{{ record.batch }}</span>
  30. <a-input placeholder="请输入" v-model="record.batch" v-else></a-input>
  31. </a-form-model-item>
  32. </template>
  33. <template slot="inventoryCode" slot-scope="text, record, index">
  34. <a-form-model-item :prop="'dataSource.'+index+'.inventoryCode'" class='sonItem' :rules="rules.inventoryCode">
  35. <span v-if="title=='订单操作'">{{ record.inventoryCode }}</span>
  36. <a-input-search placeholder="请输入" v-model="record.inventoryCode" @search="onSearchInven(record)" readOnly v-else></a-input-search>
  37. </a-form-model-item>
  38. </template>
  39. <template slot="quantity" slot-scope="text, record, index">
  40. <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules.quantity">
  41. <span v-if="title=='订单操作'">{{ record.quantity }}</span>
  42. <a-input placeholder="请输入" v-model="record.quantity" @blur="changeQuantity(record)" @change="getUnQuan(record)" v-else></a-input>
  43. </a-form-model-item>
  44. </template>
  45. <template slot="unQuantity" slot-scope="text, record, index">
  46. <a-form-model-item :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules.unQuantity">
  47. <span v-if="title=='订单操作'">{{ record.unQuantity }}</span>
  48. <a-input placeholder="请输入" v-model="record.unQuantity" @blur="changeUQuantity(record)" @change="getQuan(record)" v-else></a-input>
  49. </a-form-model-item>
  50. </template>
  51. <template slot="unQuantityExecute" slot-scope="text, record, index">
  52. <a-form-model-item prop="unQuantityExecute" class='sonItem'>
  53. <a-input placeholder="请输入" v-model="record.unQuantityExecute" v-if="record.allowEditNum=='yes'" @blur="changeQuantityExecuteIn(index,record,'1')"></a-input>
  54. <span v-else>{{ record.unQuantityExecute }}</span>
  55. </a-form-model-item>
  56. </template>
  57. <template slot="quantityExecute" slot-scope="text, record, index">
  58. <a-form-model-item prop="quantityExecute" class='sonItem'>
  59. <a-input placeholder="请输入" v-model="record.quantityExecute" v-if="record.allowEditNum=='yes'" @blur="changeQuantityExecuteIn(index,record,'2')"></a-input>
  60. <span v-else>{{ record.quantityExecute }}</span>
  61. </a-form-model-item>
  62. </template>
  63. <template slot="model" slot-scope="text, record, index">
  64. <a-form-model-item prop="model" class='sonItem'>
  65. <span v-if="title=='订单操作'">{{ record.model }}</span>
  66. <a-input placeholder="请输入" v-model="record.model" v-else></a-input>
  67. </a-form-model-item>
  68. </template>
  69. <template slot="color" slot-scope="text, record, index">
  70. <a-form-model-item prop="color" class='sonItem'>
  71. <span v-if="title=='订单操作'">{{ record.color }}</span>
  72. <a-input placeholder="请输入" v-model="record.color" v-else></a-input>
  73. </a-form-model-item>
  74. </template>
  75. <template slot="fixedNum" slot-scope="text, record, index">
  76. <a-form-model-item prop="fixedNum" class='sonItem'>
  77. <span v-if="title=='订单操作'">{{ record.fixedNum }}</span>
  78. <a-input placeholder="请输入" v-model="record.fixedNum" v-else></a-input>
  79. </a-form-model-item>
  80. </template>
  81. <template slot="fixedLength" slot-scope="text, record, index">
  82. <a-form-model-item prop="fixedLength" class='sonItem'>
  83. <span v-if="title=='订单操作'">{{ record.fixedLength }}</span>
  84. <a-input placeholder="请输入" v-model="record.fixedLength" v-else></a-input>
  85. </a-form-model-item>
  86. </template>
  87. <template slot="widthHeight" slot-scope="text, record, index">
  88. <a-form-model-item prop="widthHeight" class='sonItem'>
  89. <span v-if="title=='订单操作'">{{ record.widthHeight }}</span>
  90. <a-input placeholder="请输入" v-model="record.widthHeight" v-else></a-input>
  91. </a-form-model-item>
  92. </template>
  93. <template slot="pieces" slot-scope="text, record, index">
  94. <a-form-model-item prop="pieces" class='sonItem'>
  95. <span v-if="title=='订单操作'">{{ record.pieces }}</span>
  96. <a-input placeholder="请输入" v-model="record.pieces" v-else></a-input>
  97. </a-form-model-item>
  98. </template>
  99. <template slot="remarks" slot-scope="text, record, index">
  100. <a-form-model-item prop="remarks" class='sonItem'>
  101. <span v-if="title=='订单操作'">{{ record.remarks }}</span>
  102. <a-input placeholder="请输入" v-model="record.remarks" v-else></a-input>
  103. </a-form-model-item>
  104. </template>
  105. <template slot="meterWeight" slot-scope="text, record, index">
  106. <a-form-model-item prop="meterWeight" class='sonItem'>
  107. <span v-if="title=='订单操作'">{{ record.meterWeight }}</span>
  108. <a-input placeholder="请输入" v-model="record.meterWeight" v-else></a-input>
  109. </a-form-model-item>
  110. </template>
  111. <template slot="decorationLength" slot-scope="text, record, index">
  112. <a-form-model-item prop="decorationLength" class='sonItem'>
  113. <span v-if="title=='订单操作'">{{ record.decorationLength }}</span>
  114. <a-input placeholder="请输入" v-model="record.decorationLength" v-else></a-input>
  115. </a-form-model-item>
  116. </template>
  117. <template slot="windowNo" slot-scope="text, record, index">
  118. <a-form-model-item prop="windowNo" class='sonItem'>
  119. <span v-if="title=='订单操作'">{{ record.windowNo }}</span>
  120. <a-input placeholder="请输入" v-model="record.windowNo" v-else></a-input>
  121. </a-form-model-item>
  122. </template>
  123. <template slot="exclusiveZone" slot-scope="text, record, index">
  124. <a-form-model-item prop="exclusiveZone" class='sonItem'>
  125. <span v-if="title=='订单操作'">{{ record.exclusiveZone }}</span>
  126. <a-input placeholder="请输入" v-model="record.exclusiveZone" v-else></a-input>
  127. </a-form-model-item>
  128. </template>
  129. <template slot="widthLength" slot-scope="text, record, index">
  130. <a-form-model-item prop="widthLength" class='sonItem'>
  131. <span v-if="title=='订单操作'">{{ record.widthLength }}</span>
  132. <a-input placeholder="请输入" v-model="record.widthLength" v-else></a-input>
  133. </a-form-model-item>
  134. </template>
  135. <template slot="height" slot-scope="text, record, index">
  136. <a-form-model-item prop="height" class='sonItem'>
  137. <span v-if="title=='订单操作'">{{ record.height }}</span>
  138. <a-input placeholder="请输入" v-model="record.height" v-else></a-input>
  139. </a-form-model-item>
  140. </template>
  141. <template slot="buildingNumber" slot-scope="text, record, index">
  142. <a-form-model-item prop="buildingNumber" class='sonItem'>
  143. <span v-if="title=='订单操作'">{{ record.buildingNumber }}</span>
  144. <a-input placeholder="请输入" v-model="record.buildingNumber" v-else></a-input>
  145. </a-form-model-item>
  146. </template>
  147. <template slot="framesTang" slot-scope="text, record, index">
  148. <a-form-model-item prop="framesTang" class='sonItem'>
  149. <span v-if="title=='订单操作'">{{ record.framesTang }}</span>
  150. <a-input placeholder="请输入" v-model="record.framesTang" v-else></a-input>
  151. </a-form-model-item>
  152. </template>
  153. <template slot="framesCount" slot-scope="text, record, index">
  154. <a-form-model-item prop="framesCount" class='sonItem'>
  155. <span v-if="title=='订单操作'">{{ record.framesCount }}</span>
  156. <a-input placeholder="请输入" v-model="record.framesCount" v-else></a-input>
  157. </a-form-model-item>
  158. </template>
  159. <template slot="leafCount" slot-scope="text, record, index">
  160. <a-form-model-item prop="leafCount" class='sonItem'>
  161. <span v-if="title=='订单操作'">{{ record.leafCount }}</span>
  162. <a-input placeholder="请输入" v-model="record.leafCount" v-else></a-input>
  163. </a-form-model-item>
  164. </template>
  165. <template slot="semiClass" slot-scope="text, record, index">
  166. <a-form-model-item prop="semiClass" class='sonItem'>
  167. <span v-if="title=='订单操作'">{{ record.semiClass }}</span>
  168. <a-input placeholder="请输入" v-model="record.semiClass" v-else></a-input>
  169. </a-form-model-item>
  170. </template>
  171. <template slot="area" slot-scope="text, record, index">
  172. <a-form-model-item prop="area" class='sonItem'>
  173. <span v-if="title=='订单操作'">{{ record.area }}</span>
  174. <a-input placeholder="请输入" v-model="record.area" v-else></a-input>
  175. </a-form-model-item>
  176. </template>
  177. <template slot="cuttingLength" slot-scope="text, record, index">
  178. <a-form-model-item prop="cuttingLength" class='sonItem'>
  179. <span v-if="title=='订单操作'">{{ record.cuttingLength }}</span>
  180. <a-input placeholder="请输入" v-model="record.cuttingLength" v-else></a-input>
  181. </a-form-model-item>
  182. </template>
  183. <template slot="cuttingLeftDown" slot-scope="text, record, index">
  184. <a-form-model-item prop="cuttingLeftDown" class='sonItem'>
  185. <span v-if="title=='订单操作'">{{ record.cuttingLeftDown }}</span>
  186. <a-input placeholder="请输入" v-model="record.cuttingLeftDown" v-else></a-input>
  187. </a-form-model-item>
  188. </template>
  189. <template slot="cuttingRightTop" slot-scope="text, record, index">
  190. <a-form-model-item prop="cuttingRightTop" class='sonItem'>
  191. <span v-if="title=='订单操作'">{{ record.cuttingRightTop }}</span>
  192. <a-input placeholder="请输入" v-model="record.cuttingRightTop" v-else></a-input>
  193. </a-form-model-item>
  194. </template>
  195. <template slot="series" slot-scope="text, record, index">
  196. <a-form-model-item prop="series" class='sonItem'>
  197. <span v-if="title=='订单操作'">{{ record.series }}</span>
  198. <a-input placeholder="请输入" v-model="record.series" v-else></a-input>
  199. </a-form-model-item>
  200. </template>
  201. <template slot="glassNumber" slot-scope="text, record, index">
  202. <a-form-model-item prop="glassNumber" class='sonItem'>
  203. <span v-if="title=='订单操作'">{{ record.glassNumber }}</span>
  204. <a-input placeholder="请输入" v-model="record.glassNumber" v-else></a-input>
  205. </a-form-model-item>
  206. </template>
  207. </a-table>
  208. </a-form-model>
  209. <inventoryPopup ref="inventoryPopup" @okData="okDataInvent" @okDataMultiple="addDataMultiple"></inventoryPopup>
  210. </div>
  211. </template>
  212. <script>
  213. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  214. import JEllipsis from '@/components/jeecg/JEllipsis'
  215. import inventoryPopup from '../../Popup/inventoryPopup.vue'
  216. import { httpAction ,getAction,postAction,putAction} from '@/api/manage'
  217. import moment from 'moment'
  218. export default {
  219. name: 'material', // Tabs 详情
  220. mixins: [JeecgListMixin],
  221. components: {
  222. JEllipsis,
  223. moment,
  224. inventoryPopup
  225. },
  226. data() {
  227. return {
  228. selectedRowKeys:[],
  229. selectedRows:[],
  230. form:{
  231. dataSource:[],
  232. },
  233. planOrg:'',
  234. disableMixinCreated:'1',
  235. columns: [
  236. {
  237. title: '行号',
  238. dataIndex: '',
  239. key: 'rowIndex',
  240. width: 60,
  241. align: "center",
  242. customRender:function (t, r, index) {
  243. return parseInt(index)+1;
  244. }
  245. },
  246. {
  247. title: '项目编码',
  248. align:"center",
  249. dataIndex: 'projectCode',
  250. ellipsis: true,
  251. },
  252. {
  253. title: '项目名称',
  254. align:"center",
  255. dataIndex: 'projectName',
  256. ellipsis: true,
  257. },
  258. {
  259. title: '批次',
  260. align:"center",
  261. dataIndex: 'batch',
  262. ellipsis: true,
  263. scopedSlots: { customRender: 'batch' }
  264. },
  265. {
  266. // title: '料品编码',
  267. align:"center",
  268. dataIndex: 'inventoryCode',
  269. ellipsis: true,
  270. scopedSlots: { customRender: 'inventoryCode' } ,
  271. slots:{title:'inventoryCodeTitle'},
  272. },
  273. {
  274. title: '料品名称',
  275. align:"center",
  276. dataIndex: 'inventoryName',
  277. ellipsis: true,
  278. },
  279. {
  280. title: '料品属性',
  281. align:"center",
  282. dataIndex: 'attribute',
  283. ellipsis: true,
  284. },
  285. {
  286. title: '计量单位',
  287. align:"center",
  288. dataIndex: 'unit',
  289. ellipsis: true,
  290. },
  291. {
  292. title: '辅计量单位',
  293. align:"center",
  294. dataIndex: 'auxiliaryUnit',
  295. ellipsis: true,
  296. },
  297. {
  298. // title: '主数量',
  299. align:"center",
  300. dataIndex: 'quantity',
  301. ellipsis: true,
  302. scopedSlots: { customRender: 'quantity' } ,
  303. slots:{title:'quantityTitle'},
  304. },
  305. {
  306. // title: '辅数量',
  307. align:"center",
  308. dataIndex: 'unQuantity',
  309. ellipsis: true,
  310. scopedSlots: { customRender: 'unQuantity' } ,
  311. slots:{title:'unQuantityTitle'},
  312. },
  313. {
  314. title: '税率',
  315. align:"center",
  316. dataIndex: 'rate',
  317. ellipsis: true,
  318. },
  319. {
  320. title: '已执行主数量',
  321. align:"center",
  322. dataIndex: 'quantityExecute',
  323. ellipsis: true,
  324. scopedSlots: { customRender: 'quantityExecute' }
  325. },
  326. {
  327. title: '已执行辅数量',
  328. align:"center",
  329. dataIndex: 'unQuantityExecute',
  330. ellipsis: true,
  331. scopedSlots: { customRender: 'unQuantityExecute' }
  332. },
  333. {
  334. title: '规格',
  335. align:"center",
  336. dataIndex: 'specs',
  337. ellipsis: true,
  338. // scopedSlots: { customRender: 'specs' }
  339. },
  340. {
  341. title: '型号',
  342. align:"center",
  343. dataIndex: 'model',
  344. ellipsis: true,
  345. scopedSlots: { customRender: 'model' }
  346. },
  347. {
  348. title: '颜色',
  349. align:"center",
  350. dataIndex: 'color',
  351. ellipsis: true,
  352. scopedSlots: { customRender: 'color' }
  353. },
  354. {
  355. title: '支数',
  356. align:"center",
  357. dataIndex: 'fixedNum',
  358. ellipsis: true,
  359. scopedSlots: { customRender: 'fixedNum' }
  360. },
  361. {
  362. title: '定尺',
  363. align:"center",
  364. dataIndex: 'fixedLength',
  365. ellipsis: true,
  366. scopedSlots: { customRender: 'fixedLength' }
  367. },
  368. {
  369. title: '宽/高',
  370. align:"center",
  371. dataIndex: 'widthHeight',
  372. ellipsis: true,
  373. scopedSlots: { customRender: 'widthHeight' }
  374. },
  375. {
  376. title: '片数',
  377. align:"center",
  378. dataIndex: 'pieces',
  379. ellipsis: true,
  380. scopedSlots: { customRender: 'pieces' }
  381. },
  382. {
  383. title: '备注',
  384. align:"center",
  385. dataIndex: 'remarks',
  386. ellipsis: true,
  387. scopedSlots: { customRender: 'remarks' }
  388. },
  389. {
  390. title: '米重',
  391. align:"center",
  392. dataIndex: 'meterWeight',
  393. ellipsis: true,
  394. scopedSlots: { customRender: 'meterWeight' }
  395. },
  396. {
  397. title: '装饰面周长',
  398. align:"center",
  399. dataIndex: 'decorationLength',
  400. ellipsis: true,
  401. scopedSlots: { customRender: 'decorationLength' }
  402. },
  403. {
  404. title: '窗号',
  405. align:"center",
  406. dataIndex: 'windowNo',
  407. ellipsis: true,
  408. scopedSlots: { customRender: 'windowNo' }
  409. },
  410. {
  411. title: '专用区',
  412. align:"center",
  413. dataIndex: 'exclusiveZone',
  414. ellipsis: true,
  415. scopedSlots: { customRender: 'exclusiveZone' }
  416. },
  417. {
  418. title: '宽度/长度',
  419. align:"center",
  420. dataIndex: 'widthLength',
  421. ellipsis: true,
  422. scopedSlots: { customRender: 'widthLength' }
  423. },
  424. {
  425. title: '高度',
  426. align:"center",
  427. dataIndex: 'height',
  428. ellipsis: true,
  429. scopedSlots: { customRender: 'height' }
  430. },
  431. {
  432. title: '楼层楼号',
  433. align:"center",
  434. dataIndex: 'buildingNumber',
  435. ellipsis: true,
  436. scopedSlots: { customRender: 'buildingNumber' }
  437. },
  438. {
  439. title: '樘数(数量)',
  440. align:"center",
  441. dataIndex: 'framesTang',
  442. ellipsis: true,
  443. scopedSlots: { customRender: 'framesTang' }
  444. },
  445. {
  446. title: '框数量',
  447. align:"center",
  448. dataIndex: 'framesCount',
  449. ellipsis: true,
  450. scopedSlots: { customRender: 'framesCount' }
  451. },
  452. {
  453. title: '扇数量',
  454. align:"center",
  455. dataIndex: 'leafCount',
  456. ellipsis: true,
  457. scopedSlots: { customRender: 'leafCount' }
  458. },
  459. {
  460. title: '半成品分类',
  461. align:"center",
  462. dataIndex: 'semiClass',
  463. ellipsis: true,
  464. scopedSlots: { customRender: 'semiClass' }
  465. },
  466. {
  467. title: '面积',
  468. align:"center",
  469. dataIndex: 'area',
  470. ellipsis: true,
  471. scopedSlots: { customRender: 'area' }
  472. },
  473. {
  474. title: '切割长度',
  475. align:"center",
  476. dataIndex: 'cuttingLength',
  477. ellipsis: true,
  478. scopedSlots: { customRender: 'cuttingLength' }
  479. },
  480. {
  481. title: '切割角度左下',
  482. align:"center",
  483. dataIndex: 'cuttingLeftDown',
  484. ellipsis: true,
  485. scopedSlots: { customRender: 'cuttingLeftDown' }
  486. },
  487. {
  488. title: '切割角度右上',
  489. align:"center",
  490. dataIndex: 'cuttingRightTop',
  491. ellipsis: true,
  492. scopedSlots: { customRender: 'cuttingRightTop' }
  493. },
  494. {
  495. title: '系列',
  496. align:"center",
  497. dataIndex: 'series',
  498. ellipsis: true,
  499. scopedSlots: { customRender: 'series' }
  500. },
  501. {
  502. title: '玻璃编号',
  503. align:"center",
  504. dataIndex: 'glassNumber',
  505. ellipsis: true,
  506. scopedSlots: { customRender: 'glassNumber' }
  507. },
  508. {
  509. title: '同步状态',
  510. align:"center",
  511. dataIndex: 'sync',
  512. ellipsis: true,
  513. },
  514. {
  515. title: '同步信息',
  516. align:"center",
  517. dataIndex: 'syncInfo',
  518. ellipsis: true,
  519. width:460,
  520. },
  521. ],
  522. projectCode:"",
  523. projectName:'',
  524. rules:{
  525. quantity:{required:true,message:"不可为空"},
  526. unQuantity:{required:true,message:"不可为空"},
  527. inventoryCode:{required:true,message:"不可为空"},
  528. },
  529. }
  530. },
  531. props:{
  532. title: {
  533. type: String,
  534. default:''
  535. },
  536. },
  537. created() {},
  538. methods: {
  539. onSelectChange(selectedRowKeys, selectionRows) {
  540. this.selectedRowKeys = selectedRowKeys;
  541. this.selectedRows = selectionRows;
  542. },
  543. addList(projectCode,projectName){
  544. this.projectCode=projectCode
  545. this.projectName=projectName
  546. if(this.planOrg&&this.planOrg!==''){
  547. this.$refs.inventoryPopup.visible = true
  548. this.$refs.inventoryPopup.getData(this.planOrg,'add')
  549. }else{
  550. this.$message.warning("请选择组织!")
  551. }
  552. // this.form.dataSource.push({rowNo: this.form.dataSource.length+1,projectCode:projectCode,projectName:projectName})
  553. },
  554. delectRow(){
  555. if( this.selectedRowKeys.length==0){
  556. this.$message.warning('请勾选子表数据!')
  557. }else{
  558. this.selectedRowKeys.map(event=>{
  559. this.form.dataSource = this.form.dataSource.filter( (x)=> {return x.rowNo !== event});
  560. })
  561. }
  562. },
  563. addMaterial(){
  564. this.form.dataSource.push({newRow:'1'})
  565. },
  566. validateList(){
  567. let flag = null
  568. this.$refs.formRef.validate(valid =>{
  569. if(valid){
  570. flag = true
  571. }else{
  572. flag = false
  573. }
  574. })
  575. return flag
  576. },
  577. changeQuantity(record){
  578. if(record.quantity&&record.quantityExecute&&(Number(record.quantity)<Number(record.quantityExecute))){
  579. record.quantity = ''
  580. this.$message.warning('主数量不可小于已执行主数量!')
  581. }
  582. },
  583. //改变主数量计算辅数量
  584. getUnQuan(record){
  585. if(record.rate){
  586. var num = (Number(record.quantity)*Number(record.rate)).toFixed(2)
  587. this.$set(record,'unQuantity',num)
  588. }
  589. },
  590. //改变辅数量计算主数量
  591. getQuan(record){
  592. if(record.rate){
  593. var numUn = (Number(record.unQuantity)/Number(record.rate)).toFixed(2)
  594. this.$set(record,'quantity',numUn)
  595. }
  596. },
  597. changeUQuantity(record){
  598. if(record.unQuantity&&record.unQuantityExecute&&(Number(record.unQuantity)<Number(record.unQuantityExecute))){
  599. record.unQuantity = ''
  600. this.$message.warning('辅数量不可小于已执行辅数量!')
  601. }
  602. },
  603. // 修改已执行数量
  604. editNum(index){
  605. this.form.dataSource[index-1].allowEditNum = 'yes'
  606. this.$forceUpdate();
  607. },
  608. changeQuantityExecuteIn(index,record,state){
  609. if(state=='1'){
  610. if(record.unQuantityExecute>record.unQuantity||record.unQuantityExecute<0){
  611. this.$message.error('已执行辅数量需小于辅数量,且大于0!');
  612. }else{
  613. this.submitData(index,record)
  614. }
  615. }else{
  616. if(record.quantityExecute>record.quantity||record.quantityExecute<0){
  617. this.$message.error('已执行主数量需小于主数量,且大于0!');
  618. }else{
  619. this.submitData(index,record)
  620. }
  621. }
  622. },
  623. submitData(index,record){
  624. this.$confirm({
  625. content: `是否保存修改后已执行数量?`,
  626. onOk: () => {
  627. postAction('/productionOrder/madeProductionOrders/updateProductionNum',record).then(res=>{
  628. if(res.success){
  629. this.$message.success('修改成功')
  630. this.form.dataSource[index].allowEditNum = ''
  631. this.$forceUpdate();
  632. this.selectedRowKeys = []
  633. this.selectedRows = []
  634. }else{
  635. this.$message.error(res.message);
  636. }
  637. })
  638. }
  639. })
  640. },
  641. onSearchInven(record){
  642. if(!this.planOrg||this.planOrg==''){
  643. this.$message.warning('请选择生产组织!')
  644. }else{
  645. this.$refs.inventoryPopup.visible = true
  646. this.$refs.inventoryPopup.getData(this.planOrg,'edit')
  647. this.$refs.inventoryPopup.record=record
  648. }
  649. },
  650. okDataInvent(data,recoerd){
  651. this.$set(recoerd,'inventoryCode',data.Code)
  652. this.$set(recoerd,'inventoryName',data.Name)
  653. this.$set(recoerd,'specs',data.SPECS)
  654. this.$set(recoerd,'unit',data.unit)
  655. this.$set(recoerd,'auxiliaryUnit',data.auxiliaryUnit )
  656. this.$set(recoerd,'attribute',data.Code1 )
  657. this.$set(recoerd,'inventory',data.ID )
  658. this.$set(recoerd,'quantity','' )
  659. this.$set(recoerd,'unQuantity','')
  660. this.$set(recoerd,'rate',data.rate)
  661. var attributeArr = data.Code1.split("-")
  662. if(attributeArr.length==4){
  663. this.$set(recoerd,'color',attributeArr[1])
  664. this.$set(recoerd,'fixedLength',attributeArr[2])
  665. this.$set(recoerd,'widthHeight',attributeArr[3])
  666. }
  667. },
  668. addDataMultiple(rows){
  669. rows.map(item=>{
  670. var obj ={}
  671. this.$set(obj,'inventoryCode',item.Code)
  672. this.$set(obj,'inventoryName',item.Name)
  673. this.$set(obj,'specs',item.SPECS)
  674. this.$set(obj,'unit',item.unit )
  675. this.$set(obj,'auxiliaryUnit',item.auxiliaryUnit )
  676. this.$set(obj,'attribute',item.Code1 )
  677. this.$set(obj,'inventory',item.ID )
  678. this.$set(obj,'rate',item.rate)
  679. this.$set(obj,'quantity','')
  680. this.$set(obj,'unQuantity','')
  681. this.$set(obj,'rowNo',this.form.dataSource.length+1)
  682. this.$set(obj,'projectCode',this.projectCode)
  683. this.$set(obj,'projectName',this.projectName)
  684. var attributeArr = item.Code1.split("-")
  685. if(attributeArr.length==4){
  686. this.$set(obj,'color',attributeArr[1])
  687. this.$set(obj,'fixedLength',attributeArr[2])
  688. this.$set(obj,'widthHeight',attributeArr[3])
  689. }
  690. this.form.dataSource.push(obj)
  691. })
  692. },
  693. },
  694. computed: {
  695. // 合计数据
  696. // sumInfoSource() {}
  697. }
  698. }
  699. </script>
  700. <style lang="less" scoped>
  701. /* @import '~@assets/less/common.less' */
  702. /deep/.ant-input{
  703. height:29px;
  704. }
  705. /deep/.ant-select-selection--single {
  706. height: 29px;
  707. }
  708. /deep/.ant-select{
  709. font-size: 12px;
  710. }
  711. /deep/.ant-form label{
  712. font-size: 12px;
  713. }
  714. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  715. margin-bottom:9px
  716. }
  717. /deep/.moddle>.ant-card-body{
  718. padding-bottom:0px;
  719. padding-top: 12px;
  720. }
  721. /deep/.top>.ant-card-body{
  722. padding-bottom:0px;
  723. padding-top: 12px;
  724. }
  725. /deep/.ant-btn{
  726. height:28px
  727. }
  728. /deep/.ant-modal-body{
  729. padding-bottom: 0px;
  730. padding-top: 0px;
  731. }
  732. // /deep/.ant-modal-body{
  733. // background: #f0f2f5;
  734. // }
  735. /deep/.ant-modal-content{
  736. background: #f0f2f5;
  737. }
  738. /deep/.ant-card-body .table-operator {
  739. margin-bottom: 0px;
  740. }
  741. /deep/.three>.ant-card-body{
  742. padding-bottom:12px;
  743. padding-top: 12px;
  744. }
  745. /deep/.bottom>.ant-card-body{
  746. padding-bottom:0px;
  747. padding-top: 12px;
  748. }
  749. /deep/.ant-calendar-picker{
  750. min-width: 0px !important;
  751. }
  752. /deep/.sonItem {
  753. margin-bottom:0px !important
  754. }
  755. /deep/#sonList>.ant-spin-nested-loading>.ant-spin-container>.ant-table>.ant-table-content>.ant-table-scroll>.ant-table-body>.ant-table-fixed>.ant-table-tbody > tr > td {
  756. padding: 0px 8px !important;
  757. }
  758. .form-table-heard:before {
  759. content:'*';
  760. color:red
  761. }
  762. /deep/.ant-form-explain, .ant-form-split {
  763. display: none;
  764. }
  765. </style>