material.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  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: 5500, 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. <a-input placeholder="请输入" v-model="record.batch" ></a-input>
  30. </a-form-model-item>
  31. </template>
  32. <template slot="inventoryCode" slot-scope="text, record, index">
  33. <a-form-model-item :prop="'dataSource.'+index+'.inventoryCode'" class='sonItem' :rules="rules.inventoryCode">
  34. <a-input-search placeholder="请输入" v-model="record.inventoryCode" @search="onSearchInven(record)" readOnly ></a-input-search>
  35. </a-form-model-item>
  36. </template>
  37. <template slot="quantity" slot-scope="text, record, index">
  38. <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules.quantity">
  39. <a-input placeholder="请输入" v-model="record.quantity" @blur="changeQuantity(record)" @change="getUnQuan(record)"></a-input>
  40. </a-form-model-item>
  41. </template>
  42. <template slot="unQuantity" slot-scope="text, record, index">
  43. <a-form-model-item :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules.unQuantity">
  44. <a-input placeholder="请输入" v-model="record.unQuantity" @blur="changeUQuantity(record)" @change="getQuan(record)"></a-input>
  45. </a-form-model-item>
  46. </template>
  47. <template slot="model" slot-scope="text, record, index">
  48. <a-form-model-item prop="model" class='sonItem'>
  49. <a-input placeholder="请输入" v-model="record.model" ></a-input>
  50. </a-form-model-item>
  51. </template>
  52. <template slot="color" slot-scope="text, record, index">
  53. <a-form-model-item prop="color" class='sonItem'>
  54. <a-input placeholder="请输入" v-model="record.color"></a-input>
  55. </a-form-model-item>
  56. </template>
  57. <template slot="fixedNum" slot-scope="text, record, index">
  58. <a-form-model-item prop="fixedNum" class='sonItem'>
  59. <a-input placeholder="请输入" v-model="record.fixedNum"></a-input>
  60. </a-form-model-item>
  61. </template>
  62. <template slot="fixedLength" slot-scope="text, record, index">
  63. <a-form-model-item prop="fixedLength" class='sonItem'>
  64. <a-input placeholder="请输入" v-model="record.fixedLength" ></a-input>
  65. </a-form-model-item>
  66. </template>
  67. <template slot="widthHeight" slot-scope="text, record, index">
  68. <a-form-model-item prop="widthHeight" class='sonItem'>
  69. <a-input placeholder="请输入" v-model="record.widthHeight" ></a-input>
  70. </a-form-model-item>
  71. </template>
  72. <template slot="pieces" slot-scope="text, record, index">
  73. <a-form-model-item prop="pieces" class='sonItem'>
  74. <a-input placeholder="请输入" v-model="record.pieces"></a-input>
  75. </a-form-model-item>
  76. </template>
  77. <template slot="remarks" slot-scope="text, record, index">
  78. <a-form-model-item prop="remarks" class='sonItem'>
  79. <a-input placeholder="请输入" v-model="record.remarks" ></a-input>
  80. </a-form-model-item>
  81. </template>
  82. <template slot="meterWeight" slot-scope="text, record, index">
  83. <a-form-model-item prop="meterWeight" class='sonItem'>
  84. <a-input placeholder="请输入" v-model="record.meterWeight" ></a-input>
  85. </a-form-model-item>
  86. </template>
  87. <template slot="decorationLength" slot-scope="text, record, index">
  88. <a-form-model-item prop="decorationLength" class='sonItem'>
  89. <a-input placeholder="请输入" v-model="record.decorationLength" ></a-input>
  90. </a-form-model-item>
  91. </template>
  92. <template slot="windowNo" slot-scope="text, record, index">
  93. <a-form-model-item prop="windowNo" class='sonItem'>
  94. <a-input placeholder="请输入" v-model="record.windowNo" ></a-input>
  95. </a-form-model-item>
  96. </template>
  97. <template slot="exclusiveZone" slot-scope="text, record, index">
  98. <a-form-model-item prop="exclusiveZone" class='sonItem'>
  99. <a-input placeholder="请输入" v-model="record.exclusiveZone" ></a-input>
  100. </a-form-model-item>
  101. </template>
  102. <template slot="widthLength" slot-scope="text, record, index">
  103. <a-form-model-item prop="widthLength" class='sonItem'>
  104. <a-input placeholder="请输入" v-model="record.widthLength" ></a-input>
  105. </a-form-model-item>
  106. </template>
  107. <template slot="height" slot-scope="text, record, index">
  108. <a-form-model-item prop="height" class='sonItem'>
  109. <a-input placeholder="请输入" v-model="record.height" ></a-input>
  110. </a-form-model-item>
  111. </template>
  112. <template slot="buildingNumber" slot-scope="text, record, index">
  113. <a-form-model-item prop="buildingNumber" class='sonItem'>
  114. <a-input placeholder="请输入" v-model="record.buildingNumber"></a-input>
  115. </a-form-model-item>
  116. </template>
  117. <template slot="framesTang" slot-scope="text, record, index">
  118. <a-form-model-item prop="framesTang" class='sonItem'>
  119. <a-input placeholder="请输入" v-model="record.framesTang" ></a-input>
  120. </a-form-model-item>
  121. </template>
  122. <template slot="framesCount" slot-scope="text, record, index">
  123. <a-form-model-item prop="framesCount" class='sonItem'>
  124. <a-input placeholder="请输入" v-model="record.framesCount" ></a-input>
  125. </a-form-model-item>
  126. </template>
  127. <template slot="leafCount" slot-scope="text, record, index">
  128. <a-form-model-item prop="leafCount" class='sonItem'>
  129. <a-input placeholder="请输入" v-model="record.leafCount" ></a-input>
  130. </a-form-model-item>
  131. </template>
  132. <template slot="semiClass" slot-scope="text, record, index">
  133. <a-form-model-item prop="semiClass" class='sonItem'>
  134. <a-input placeholder="请输入" v-model="record.semiClass" ></a-input>
  135. </a-form-model-item>
  136. </template>
  137. <template slot="area" slot-scope="text, record, index">
  138. <a-form-model-item prop="area" class='sonItem'>
  139. <a-input placeholder="请输入" v-model="record.area" ></a-input>
  140. </a-form-model-item>
  141. </template>
  142. <template slot="cuttingLength" slot-scope="text, record, index">
  143. <a-form-model-item prop="cuttingLength" class='sonItem'>
  144. <a-input placeholder="请输入" v-model="record.cuttingLength" ></a-input>
  145. </a-form-model-item>
  146. </template>
  147. <template slot="cuttingLeftDown" slot-scope="text, record, index">
  148. <a-form-model-item prop="cuttingLeftDown" class='sonItem'>
  149. <a-input placeholder="请输入" v-model="record.cuttingLeftDown"></a-input>
  150. </a-form-model-item>
  151. </template>
  152. <template slot="cuttingRightTop" slot-scope="text, record, index">
  153. <a-form-model-item prop="cuttingRightTop" class='sonItem'>
  154. <a-input placeholder="请输入" v-model="record.cuttingRightTop" ></a-input>
  155. </a-form-model-item>
  156. </template>
  157. <template slot="series" slot-scope="text, record, index">
  158. <a-form-model-item prop="series" class='sonItem'>
  159. <a-input placeholder="请输入" v-model="record.series" ></a-input>
  160. </a-form-model-item>
  161. </template>
  162. <template slot="glassNumber" slot-scope="text, record, index">
  163. <a-form-model-item prop="glassNumber" class='sonItem'>
  164. <a-input placeholder="请输入" v-model="record.glassNumber"></a-input>
  165. </a-form-model-item>
  166. </template>
  167. </a-table>
  168. </a-form-model>
  169. <inventoryPopup ref="inventoryPopup" @okData="okDataInvent"></inventoryPopup>
  170. </div>
  171. </template>
  172. <script>
  173. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  174. import JEllipsis from '@/components/jeecg/JEllipsis'
  175. import inventoryPopup from '../../Popup/inventoryPopup.vue'
  176. import moment from 'moment'
  177. export default {
  178. name: 'material', // Tabs 详情
  179. mixins: [JeecgListMixin],
  180. components: {
  181. JEllipsis,
  182. moment,
  183. inventoryPopup
  184. },
  185. data() {
  186. return {
  187. selectedRowKeys:[],
  188. selectedRows:[],
  189. form:{
  190. dataSource:[],
  191. },
  192. planOrg:'',
  193. disableMixinCreated:'1',
  194. columns: [
  195. {
  196. title: '行号',
  197. dataIndex: '',
  198. key: 'rowIndex',
  199. width: 60,
  200. align: "center",
  201. customRender:function (t, r, index) {
  202. return parseInt(index)+1;
  203. }
  204. },
  205. {
  206. title: '项目编码',
  207. align:"center",
  208. dataIndex: 'projectCode',
  209. ellipsis: true,
  210. },
  211. {
  212. title: '项目名称',
  213. align:"center",
  214. dataIndex: 'projectName',
  215. ellipsis: true,
  216. },
  217. {
  218. title: '批次',
  219. align:"center",
  220. dataIndex: 'batch',
  221. ellipsis: true,
  222. scopedSlots: { customRender: 'batch' }
  223. },
  224. {
  225. // title: '料品编码',
  226. align:"center",
  227. dataIndex: 'inventoryCode',
  228. ellipsis: true,
  229. scopedSlots: { customRender: 'inventoryCode' } ,
  230. slots:{title:'inventoryCodeTitle'},
  231. },
  232. {
  233. title: '料品名称',
  234. align:"center",
  235. dataIndex: 'inventoryName',
  236. ellipsis: true,
  237. },
  238. {
  239. title: '料品属性',
  240. align:"center",
  241. dataIndex: 'attribute',
  242. ellipsis: true,
  243. },
  244. {
  245. title: '计量单位',
  246. align:"center",
  247. dataIndex: 'unit',
  248. ellipsis: true,
  249. },
  250. {
  251. title: '辅计量单位',
  252. align:"center",
  253. dataIndex: 'auxiliaryUnit',
  254. ellipsis: true,
  255. },
  256. {
  257. // title: '主数量',
  258. align:"center",
  259. dataIndex: 'quantity',
  260. ellipsis: true,
  261. scopedSlots: { customRender: 'quantity' } ,
  262. slots:{title:'quantityTitle'},
  263. },
  264. {
  265. // title: '辅数量',
  266. align:"center",
  267. dataIndex: 'unQuantity',
  268. ellipsis: true,
  269. scopedSlots: { customRender: 'unQuantity' } ,
  270. slots:{title:'unQuantityTitle'},
  271. },
  272. {
  273. title: '税率',
  274. align:"center",
  275. dataIndex: 'rate',
  276. ellipsis: true,
  277. },
  278. {
  279. title: '已执行辅数量',
  280. align:"center",
  281. dataIndex: 'unQuantityExecute',
  282. ellipsis: true,
  283. // scopedSlots: { customRender: 'unQuantityExecute' }
  284. },
  285. {
  286. title: '已执行主数量',
  287. align:"center",
  288. dataIndex: 'quantityExecute',
  289. ellipsis: true,
  290. // scopedSlots: { customRender: 'quantityExecute' }
  291. },
  292. {
  293. title: '规格',
  294. align:"center",
  295. dataIndex: 'specs',
  296. ellipsis: true,
  297. // scopedSlots: { customRender: 'specs' }
  298. },
  299. {
  300. title: '型号',
  301. align:"center",
  302. dataIndex: 'model',
  303. ellipsis: true,
  304. scopedSlots: { customRender: 'model' }
  305. },
  306. {
  307. title: '颜色',
  308. align:"center",
  309. dataIndex: 'color',
  310. ellipsis: true,
  311. scopedSlots: { customRender: 'color' }
  312. },
  313. {
  314. title: '支数',
  315. align:"center",
  316. dataIndex: 'fixedNum',
  317. ellipsis: true,
  318. scopedSlots: { customRender: 'fixedNum' }
  319. },
  320. {
  321. title: '定尺',
  322. align:"center",
  323. dataIndex: 'fixedLength',
  324. ellipsis: true,
  325. scopedSlots: { customRender: 'fixedLength' }
  326. },
  327. {
  328. title: '宽/高',
  329. align:"center",
  330. dataIndex: 'widthHeight',
  331. ellipsis: true,
  332. scopedSlots: { customRender: 'widthHeight' }
  333. },
  334. {
  335. title: '片数',
  336. align:"center",
  337. dataIndex: 'pieces',
  338. ellipsis: true,
  339. scopedSlots: { customRender: 'pieces' }
  340. },
  341. {
  342. title: '备注',
  343. align:"center",
  344. dataIndex: 'remarks',
  345. ellipsis: true,
  346. scopedSlots: { customRender: 'remarks' }
  347. },
  348. {
  349. title: '米重',
  350. align:"center",
  351. dataIndex: 'meterWeight',
  352. ellipsis: true,
  353. scopedSlots: { customRender: 'meterWeight' }
  354. },
  355. {
  356. title: '装饰面周长',
  357. align:"center",
  358. dataIndex: 'decorationLength',
  359. ellipsis: true,
  360. scopedSlots: { customRender: 'decorationLength' }
  361. },
  362. {
  363. title: '窗号',
  364. align:"center",
  365. dataIndex: 'windowNo',
  366. ellipsis: true,
  367. scopedSlots: { customRender: 'windowNo' }
  368. },
  369. {
  370. title: '专用区',
  371. align:"center",
  372. dataIndex: 'exclusiveZone',
  373. ellipsis: true,
  374. scopedSlots: { customRender: 'exclusiveZone' }
  375. },
  376. {
  377. title: '宽度/长度',
  378. align:"center",
  379. dataIndex: 'widthLength',
  380. ellipsis: true,
  381. scopedSlots: { customRender: 'widthLength' }
  382. },
  383. {
  384. title: '高度',
  385. align:"center",
  386. dataIndex: 'height',
  387. ellipsis: true,
  388. scopedSlots: { customRender: 'height' }
  389. },
  390. {
  391. title: '楼层楼号',
  392. align:"center",
  393. dataIndex: 'buildingNumber',
  394. ellipsis: true,
  395. scopedSlots: { customRender: 'buildingNumber' }
  396. },
  397. {
  398. title: '樘数(数量)',
  399. align:"center",
  400. dataIndex: 'framesTang',
  401. ellipsis: true,
  402. scopedSlots: { customRender: 'framesTang' }
  403. },
  404. {
  405. title: '框数量',
  406. align:"center",
  407. dataIndex: 'framesCount',
  408. ellipsis: true,
  409. scopedSlots: { customRender: 'framesCount' }
  410. },
  411. {
  412. title: '扇数量',
  413. align:"center",
  414. dataIndex: 'leafCount',
  415. ellipsis: true,
  416. scopedSlots: { customRender: 'leafCount' }
  417. },
  418. {
  419. title: '半成品分类',
  420. align:"center",
  421. dataIndex: 'semiClass',
  422. ellipsis: true,
  423. scopedSlots: { customRender: 'semiClass' }
  424. },
  425. {
  426. title: '面积',
  427. align:"center",
  428. dataIndex: 'area',
  429. ellipsis: true,
  430. scopedSlots: { customRender: 'area' }
  431. },
  432. {
  433. title: '切割长度',
  434. align:"center",
  435. dataIndex: 'cuttingLength',
  436. ellipsis: true,
  437. scopedSlots: { customRender: 'cuttingLength' }
  438. },
  439. {
  440. title: '切割角度左下',
  441. align:"center",
  442. dataIndex: 'cuttingLeftDown',
  443. ellipsis: true,
  444. scopedSlots: { customRender: 'cuttingLeftDown' }
  445. },
  446. {
  447. title: '切割角度右上',
  448. align:"center",
  449. dataIndex: 'cuttingRightTop',
  450. ellipsis: true,
  451. scopedSlots: { customRender: 'cuttingRightTop' }
  452. },
  453. {
  454. title: '系列',
  455. align:"center",
  456. dataIndex: 'series',
  457. ellipsis: true,
  458. scopedSlots: { customRender: 'series' }
  459. },
  460. {
  461. title: '玻璃编号',
  462. align:"center",
  463. dataIndex: 'glassNumber',
  464. ellipsis: true,
  465. scopedSlots: { customRender: 'glassNumber' }
  466. },
  467. ],
  468. rules:{
  469. quantity:{required:true,message:"不可为空"},
  470. unQuantity:{required:true,message:"不可为空"},
  471. inventoryCode:{required:true,message:"不可为空"},
  472. },
  473. }
  474. },
  475. props: {
  476. },
  477. created() {},
  478. methods: {
  479. onSelectChange(selectedRowKeys, selectionRows) {
  480. this.selectedRowKeys = selectedRowKeys;
  481. this.selectedRows = selectionRows;
  482. },
  483. addList(projectCode,projectName){
  484. this.form.dataSource.push({rowNo: this.form.dataSource.length+1,projectCode:projectCode,projectName:projectName})
  485. },
  486. delectRow(){
  487. if( this.selectedRowKeys.length==0){
  488. this.$message.warning('请勾选子表数据!')
  489. }else{
  490. this.selectedRowKeys.map(event=>{
  491. this.form.dataSource = this.form.dataSource.filter( (x)=> {return x.rowNo !== event});
  492. })
  493. }
  494. },
  495. addMaterial(){
  496. this.form.dataSource.push({newRow:'1'})
  497. },
  498. validateList(){
  499. let flag = null
  500. this.$refs.formRef.validate(valid =>{
  501. if(valid){
  502. flag = true
  503. }else{
  504. flag = false
  505. }
  506. })
  507. return flag
  508. },
  509. changeQuantity(record){
  510. if(record.quantity&&record.quantityExecute&&(Number(record.quantity)<Number(record.quantityExecute))){
  511. record.quantity = ''
  512. this.$message.warning('主数量不可小于已执行主数量!')
  513. }
  514. },
  515. //改变主数量计算辅数量
  516. getUnQuan(record){
  517. if(record.rate){
  518. var num = (Number(record.quantity)*Number(record.rate)).toFixed(2)
  519. this.$set(record,'unQuantity',num)
  520. }
  521. },
  522. //改变辅数量计算主数量
  523. getQuan(record){
  524. if(record.rate){
  525. var numUn = (Number(record.unQuantity)/Number(record.rate)).toFixed(2)
  526. this.$set(record,'quantity',numUn)
  527. }
  528. },
  529. changeUQuantity(record){
  530. if(record.unQuantity&&record.unQuantityExecute&&(Number(record.unQuantity)<Number(record.unQuantityExecute))){
  531. record.unQuantity = ''
  532. this.$message.warning('辅数量不可小于已执行辅数量!')
  533. }
  534. },
  535. onSearchInven(record){
  536. if(!this.planOrg||this.planOrg==''){
  537. this.$message.warning('请选择生产组织!')
  538. }else{
  539. this.$refs.inventoryPopup.visible = true
  540. this.$refs.inventoryPopup.getData(this.planOrg)
  541. this.$refs.inventoryPopup.record=record
  542. }
  543. },
  544. okDataInvent(data,recoerd){
  545. this.$set(recoerd,'inventoryCode',data.Code)
  546. this.$set(recoerd,'inventoryName',data.Name)
  547. this.$set(recoerd,'specs',data.SPECS)
  548. this.$set(recoerd,'unit',data.unit)
  549. this.$set(recoerd,'auxiliaryUnit',data.auxiliaryUnit )
  550. this.$set(recoerd,'attribute',data.Code1 )
  551. this.$set(recoerd,'inventory',data.ID )
  552. this.$set(recoerd,'quantity','' )
  553. this.$set(recoerd,'unQuantity','')
  554. this.$set(recoerd,'rate',data.rate)
  555. },
  556. },
  557. computed: {
  558. // 合计数据
  559. // sumInfoSource() {}
  560. }
  561. }
  562. </script>
  563. <style lang="less" scoped>
  564. /* @import '~@assets/less/common.less' */
  565. /deep/.ant-input{
  566. height:29px;
  567. }
  568. /deep/.ant-select-selection--single {
  569. height: 29px;
  570. }
  571. /deep/.ant-select{
  572. font-size: 12px;
  573. }
  574. /deep/.ant-form label{
  575. font-size: 12px;
  576. }
  577. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  578. margin-bottom:9px
  579. }
  580. /deep/.moddle>.ant-card-body{
  581. padding-bottom:0px;
  582. padding-top: 12px;
  583. }
  584. /deep/.top>.ant-card-body{
  585. padding-bottom:0px;
  586. padding-top: 12px;
  587. }
  588. /deep/.ant-btn{
  589. height:28px
  590. }
  591. /deep/.ant-modal-body{
  592. padding-bottom: 0px;
  593. padding-top: 0px;
  594. }
  595. // /deep/.ant-modal-body{
  596. // background: #f0f2f5;
  597. // }
  598. /deep/.ant-modal-content{
  599. background: #f0f2f5;
  600. }
  601. /deep/.ant-card-body .table-operator {
  602. margin-bottom: 0px;
  603. }
  604. /deep/.three>.ant-card-body{
  605. padding-bottom:12px;
  606. padding-top: 12px;
  607. }
  608. /deep/.bottom>.ant-card-body{
  609. padding-bottom:0px;
  610. padding-top: 12px;
  611. }
  612. /deep/.ant-calendar-picker{
  613. min-width: 0px !important;
  614. }
  615. /deep/.sonItem {
  616. margin-bottom:0px !important
  617. }
  618. /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 {
  619. padding: 0px 8px !important;
  620. }
  621. .form-table-heard:before {
  622. content:'*';
  623. color:red
  624. }
  625. /deep/.ant-form-explain, .ant-form-split {
  626. display: none;
  627. }
  628. </style>