plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

881 lines
28 KiB

11 months ago
1 year ago
1 year ago
11 months ago
9 months ago
2 years ago
1 year ago
9 months ago
1 year ago
9 months ago
9 months ago
9 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
9 months ago
7 months ago
9 months ago
9 months ago
11 months ago
9 months ago
11 months ago
7 months ago
11 months ago
7 months ago
11 months ago
9 months ago
11 months ago
9 months ago
1 year ago
1 year ago
9 months ago
7 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
9 months ago
11 months ago
1 year ago
11 months ago
9 months ago
11 months ago
1 year ago
  1. <script>
  2. import {
  3. selectTestSoBom,
  4. saveTestSoBom,
  5. removeTestSoBom,
  6. updateTestSoBom,
  7. removeBatchTestSoBom
  8. } from "../../../../api/test/testSoBom";
  9. import {updateMaterialTotalAmount} from "../../../../api/test/testInformation";
  10. import {searchPart, searchPartList} from '@/api/part/partInformation.js';
  11. import numberInput from "../../common/numberInput.vue";
  12. import {searchAllUmInformationList} from "../../../../api/part/umInformation";
  13. import {Decimal} from "decimal.js";
  14. import {queryPart, queryPartUnitCostList} from "../../../../api/part/partInformation";
  15. export default {
  16. name: "testTable",
  17. components:{
  18. numberInput,
  19. },
  20. props:{
  21. dataList:{
  22. type: Array,
  23. default: ()=>[],
  24. },
  25. testNo:{
  26. type:String,
  27. },
  28. testNumber:{
  29. type:[String,Number],
  30. },
  31. columnList:{
  32. type: Array,
  33. default: ()=>[],
  34. },
  35. height:{
  36. type:[Number,String],
  37. default:300
  38. },
  39. disabled:{
  40. type:Boolean,
  41. default:false
  42. },
  43. },
  44. model:{
  45. prop:"dataList",
  46. event:"change"
  47. },
  48. data(){
  49. return{
  50. partList:[],
  51. partData:{
  52. partNo:undefined,
  53. partDesc:undefined,
  54. ifsPartNo:undefined,
  55. site:this.$store.state.user.site
  56. },
  57. partDialogFlag:false,
  58. testSoBomLabel:{
  59. componentPartNo: "物料编码",
  60. partDesc:"物料名称",
  61. requiredQty:"需求数量",
  62. assemblyQty:"单位用量",
  63. fixedScrapQty:"固定损耗",
  64. scrapFactor:"报废率"
  65. },
  66. testSoBomRule:{
  67. componentPartNo: [{required: true,message: ' ',trigger: ['change','blur']}],
  68. partDesc: [{required: true,message: ' ',trigger: ['change','blur']}],
  69. requiredQty: [{required: true,message: ' ',trigger: ['change','blur']}],
  70. assemblyQty: [{required: true,message: ' ',trigger: ['change','blur']}],
  71. fixedScrapQty: [{required: true,message: ' ',trigger: ['change','blur']}],
  72. scrapFactor: [{required: true,message: ' ',trigger: ['change','blur']}],
  73. unitCost: [{required: true,message: ' ',trigger: ['change','blur']}],
  74. totalCost: [{required: true,message: ' ',trigger: ['change','blur']}],
  75. },
  76. testSoBom:{
  77. site:this.$store.state.user.site,
  78. testNo:undefined,
  79. itemNo:undefined,
  80. componentPartNo:undefined,
  81. partDesc:undefined,
  82. umId:undefined,
  83. assemblyQty:0,
  84. fixedScrapQty:0,
  85. scrapFactor:0,
  86. requiredQty:0,
  87. issuedQty:undefined,
  88. issuedDate:undefined,
  89. reserveQty:0,
  90. mateGroup:undefined,
  91. notifiedQty:undefined,
  92. rmTypeDb:0,
  93. issuedType:undefined,
  94. remark:undefined,
  95. unitCost:0,
  96. totalCost:0,
  97. status:"N",
  98. },
  99. selectionTestSoBomList:[],
  100. testSoBomColumnList:[{
  101. userId: this.$store.state.user.name,
  102. functionId: 102001,
  103. serialNumber: '102001Table3ItemNo',
  104. tableId: '102001Table3',
  105. tableName: '测试物料结构',
  106. columnProp: 'itemNo',
  107. headerAlign: 'center',
  108. align: 'center',
  109. columnLabel: '序号',
  110. columnHidden: false,
  111. columnImage: false,
  112. columnSortable: false,
  113. sortLv: 0,
  114. status: true,
  115. fixed: '',
  116. columnWidth: 50
  117. },
  118. {
  119. userId: this.$store.state.user.name,
  120. functionId: 102001,
  121. serialNumber: '102001Table3ComponentPartNo',
  122. tableId: '102001Table3',
  123. tableName: '测试物料结构',
  124. columnProp: 'plmPartNo',
  125. headerAlign: 'center',
  126. align: 'left',
  127. columnLabel: 'PLM物料编码',
  128. columnHidden: false,
  129. columnImage: false,
  130. columnSortable: false,
  131. sortLv: 0,
  132. status: true,
  133. fixed: '',
  134. columnWidth: 100
  135. },
  136. {
  137. userId: this.$store.state.user.name,
  138. functionId: 102001,
  139. serialNumber: '102001Table3ComponentPartNo',
  140. tableId: '102001Table3',
  141. tableName: '测试物料结构',
  142. columnProp: 'ifsPartNo',
  143. headerAlign: 'center',
  144. align: 'left',
  145. columnLabel: 'IFS物料编码',
  146. columnHidden: false,
  147. columnImage: false,
  148. columnSortable: false,
  149. sortLv: 0,
  150. status: true,
  151. fixed: '',
  152. columnWidth: 100
  153. },
  154. {
  155. userId: this.$store.state.user.name,
  156. functionId: 102001,
  157. serialNumber: '102001Table3PartDesc',
  158. tableId: '102001Table3',
  159. tableName: '测试物料结构',
  160. columnProp: 'partDesc',
  161. headerAlign: 'center',
  162. align: 'left',
  163. columnLabel: '物料名称',
  164. columnHidden: false,
  165. columnImage: false,
  166. columnSortable: false,
  167. sortLv: 0,
  168. status: true,
  169. fixed: '',
  170. columnWidth: 200
  171. },{
  172. userId: this.$store.state.user.name,
  173. functionId: 102001,
  174. serialNumber: '102001Table3Spec',
  175. tableId: '102001Table3',
  176. tableName: '测试物料结构',
  177. columnProp: 'spec',
  178. headerAlign: 'center',
  179. align: 'left',
  180. columnLabel: '规格型号',
  181. columnHidden: false,
  182. columnImage: false,
  183. columnSortable: false,
  184. sortLv: 0,
  185. status: true,
  186. fixed: '',
  187. columnWidth: 100
  188. },
  189. // {
  190. // userId: this.$store.state.user.name,
  191. // functionId: 102001,
  192. // serialNumber: '102001Table3AssemblyQty',
  193. // tableId: '102001Table3',
  194. // tableName: '测试物料结构',
  195. // columnProp: 'assemblyQty',
  196. // headerAlign: 'center',
  197. // align: 'left',
  198. // columnLabel: '单位用量',
  199. // columnHidden: false,
  200. // columnImage: false,
  201. // columnSortable: false,
  202. // sortLv: 0,
  203. // status: true,
  204. // fixed: '',
  205. // columnWidth: 100
  206. // },
  207. // {
  208. // userId: this.$store.state.user.name,
  209. // functionId: 102001,
  210. // serialNumber: '102001Table3FixedScrapQty',
  211. // tableId: '102001Table3',
  212. // tableName: '测试物料结构',
  213. // columnProp: 'fixedScrapQty',
  214. // headerAlign: 'center',
  215. // align: 'left',
  216. // columnLabel: '固定损耗',
  217. // columnHidden: false,
  218. // columnImage: false,
  219. // columnSortable: false,
  220. // sortLv: 0,
  221. // status: true,
  222. // fixed: '',
  223. // columnWidth: 100
  224. // },
  225. {
  226. userId: this.$store.state.user.name,
  227. functionId: 102001,
  228. serialNumber: '102001Table3UmName',
  229. tableId: '102001Table3',
  230. tableName: '测试物料结构',
  231. columnProp: 'umId',
  232. headerAlign: 'center',
  233. align: 'left',
  234. columnLabel: '计量单位',
  235. columnHidden: false,
  236. columnImage: false,
  237. columnSortable: false,
  238. sortLv: 0,
  239. status: true,
  240. fixed: '',
  241. columnWidth: 100
  242. },
  243. // {
  244. // userId: this.$store.state.user.name,
  245. // functionId: 102001,
  246. // serialNumber: '102001Table3ScrapFactor',
  247. // tableId: '102001Table3',
  248. // tableName: '测试物料结构',
  249. // columnProp: 'scrapFactor',
  250. // headerAlign: 'center',
  251. // align: 'left',
  252. // columnLabel: '报废率%',
  253. // columnHidden: false,
  254. // columnImage: false,
  255. // columnSortable: false,
  256. // sortLv: 0,
  257. // status: true,
  258. // fixed: '',
  259. // columnWidth: 100
  260. // },
  261. {
  262. userId: this.$store.state.user.name,
  263. functionId: 102001,
  264. serialNumber: '102001Table3RequiredQty',
  265. tableId: '102001Table3',
  266. tableName: '测试物料结构',
  267. columnProp: 'requiredQty',
  268. headerAlign: 'center',
  269. align: 'right',
  270. columnLabel: '需求数量',
  271. columnHidden: false,
  272. columnImage: false,
  273. columnSortable: false,
  274. sortLv: 0,
  275. status: true,
  276. fixed: '',
  277. columnWidth: 100
  278. },
  279. // {
  280. // userId: this.$store.state.user.name,
  281. // functionId: 102001,
  282. // serialNumber: '102001Table3ReserveQty',
  283. // tableId: '102001Table3',
  284. // tableName: '测试物料结构',
  285. // columnProp: 'reserveQty',
  286. // headerAlign: 'center',
  287. // align: 'left',
  288. // columnLabel: '预留数量',
  289. // columnHidden: false,
  290. // columnImage: false,
  291. // columnSortable: false,
  292. // sortLv: 0,
  293. // status: true,
  294. // fixed: '',
  295. // columnWidth: 100
  296. // },
  297. // {
  298. // userId: this.$store.state.user.name,
  299. // functionId: 102001,
  300. // serialNumber: '102001Table3IssuedDate',
  301. // tableId: '102001Table3',
  302. // tableName: '测试物料结构',
  303. // columnProp: 'issuedDate',
  304. // headerAlign: 'center',
  305. // align: 'left',
  306. // columnLabel: '发料日期',
  307. // columnHidden: false,
  308. // columnImage: false,
  309. // columnSortable: false,
  310. // sortLv: 0,
  311. // status: true,
  312. // fixed: '',
  313. // columnWidth: 100
  314. // },
  315. {
  316. userId: this.$store.state.user.name,
  317. functionId: 102001,
  318. serialNumber: '102001Table3UnitCost',
  319. tableId: '102001Table3',
  320. tableName: '测试物料结构',
  321. columnProp: 'unitCost',
  322. headerAlign: 'center',
  323. align: 'right',
  324. columnLabel: '单价',
  325. columnHidden: false,
  326. columnImage: false,
  327. columnSortable: false,
  328. sortLv: 0,
  329. status: true,
  330. fixed: '',
  331. columnWidth: 100
  332. },
  333. {
  334. userId: this.$store.state.user.name,
  335. functionId: 102001,
  336. serialNumber: '102001Table3TotalCost',
  337. tableId: '102001Table3',
  338. tableName: '测试物料结构',
  339. columnProp: 'totalCost',
  340. headerAlign: 'center',
  341. align: 'right',
  342. columnLabel: '总价',
  343. columnHidden: false,
  344. columnImage: false,
  345. columnSortable: false,
  346. sortLv: 0,
  347. status: true,
  348. fixed: '',
  349. columnWidth: 100
  350. },
  351. {
  352. userId: this.$store.state.user.name,
  353. functionId: 102001,
  354. serialNumber: '102001Table3Remark',
  355. tableId: '102001Table3',
  356. tableName: '测试物料结构',
  357. columnProp: 'remark',
  358. headerAlign: 'center',
  359. align: 'left',
  360. columnLabel: '备注',
  361. columnHidden: false,
  362. columnImage: false,
  363. columnSortable: false,
  364. sortLv: 0,
  365. status: true,
  366. fixed: '',
  367. columnWidth: 140
  368. },
  369. // {
  370. // userId: this.$store.state.user.name,
  371. // functionId: 102001,
  372. // serialNumber: '102001Table3rmTypeDb',
  373. // tableId: '102001Table3',
  374. // tableName: '测试物料结构',
  375. // columnProp: 'rmTypeDb',
  376. // headerAlign: 'center',
  377. // align: 'left',
  378. // columnLabel: '是否主物料',
  379. // columnHidden: false,
  380. // columnImage: false,
  381. // columnSortable: false,
  382. // sortLv: 0,
  383. // status: true,
  384. // fixed: '',
  385. // columnWidth: 100
  386. // },
  387. ],
  388. saveOrUpdateFlag:false,
  389. umList:[],
  390. no:1,
  391. size:20,
  392. total:0,
  393. queryLoading:false
  394. }
  395. },
  396. created() {
  397. if (this.columnList.length !== 0){
  398. this.testSoBomColumnList = [...this.columnList]
  399. }
  400. },
  401. methods:{
  402. closePartDialog(){
  403. this.partData = {
  404. partNo: undefined,
  405. partDesc: undefined,
  406. ifsPartNo:'',
  407. site:this.$store.state.user.site
  408. }
  409. this.partList = [];
  410. },
  411. openPartDialog(){
  412. this.partDialogFlag = true;
  413. this.partData.partNo = this.testSoBom.componentPartNo
  414. this.initPartList();
  415. },
  416. initPartList(){
  417. let params = {
  418. ...this.partData,
  419. no:this.no,
  420. size:this.size,
  421. }
  422. this.queryLoading = true
  423. searchPartList(params).then(({data})=>{
  424. if (data && data.code === 0) {
  425. this.partList = data.data;
  426. this.total = data.total
  427. }
  428. this.queryLoading = false
  429. }).catch(()=>{
  430. this.queryLoading = false
  431. })
  432. },
  433. dblClickPartTable(row){
  434. if (row.status === 'Y'){
  435. let params = {
  436. site:row.site,
  437. partNo:row.partNo,
  438. configurationId:row.configurationId,
  439. userName: this.$store.state.user.name
  440. }
  441. this.queryLoading = true
  442. queryPartUnitCostList(params).then(({data}) => {
  443. if (data && data.code === 0) {
  444. this.testSoBom.componentPartNo = row.partNo;
  445. this.testSoBom.partDesc = row.partDesc;
  446. this.testSoBom.umId = row.umId;
  447. this.testSoBom.unitCost = (data.rows && data.rows.length === 1)?data.rows[0].inventoryValue:0;
  448. this.testSoBom.status = row.status;
  449. this.partDialogFlag = false;
  450. this.queryLoading = false
  451. }else {
  452. this.$message.warning(data.msg);
  453. this.queryLoading = false
  454. }
  455. }).catch((error)=>{
  456. this.$message.error(error)
  457. this.queryLoading = false
  458. })
  459. }else {
  460. this.testSoBom.componentPartNo = row.partNo;
  461. this.testSoBom.partDesc = row.partDesc;
  462. this.testSoBom.umId = row.umId;
  463. this.testSoBom.status = row.status;
  464. this.testSoBom.unitCost = row.standardCost;
  465. this.partDialogFlag = false;
  466. }
  467. },
  468. testSoBomClickRow(row,column){
  469. if (column.label !== '操作'){
  470. this.$refs.testSoBomTable.toggleRowSelection(row,true)
  471. }
  472. },
  473. selectionTestSoBom(rows){
  474. this.selectionTestSoBomList = rows;
  475. },
  476. saveTestSoBom(row){
  477. if (row){
  478. this.testSoBom = JSON.parse(JSON.stringify(row))
  479. }
  480. this.getAllUm()
  481. this.saveOrUpdateFlag = true
  482. },
  483. removeBatchTestSoBom(){
  484. if (this.selectionTestSoBomList.length === 0){
  485. this.$message.warning("请勾选需要删除的信息")
  486. return
  487. }
  488. this.$confirm('此操作将删除材料信息, 是否继续?', '提示', {
  489. confirmButtonText: '确定',
  490. cancelButtonText: '取消',
  491. type: 'warning'
  492. }).then(() => {
  493. removeBatchTestSoBom(this.selectionTestSoBomList).then(({data})=>{
  494. if (data && data.code === 0){
  495. this.$message.success(data.msg)
  496. this.selectTestSoBom();
  497. this.$refs.testSoBomTable.clearSelection()
  498. }else {
  499. this.$alert(data.msg, '错误', {
  500. confirmButtonText: '确定'
  501. })
  502. }
  503. }).catch((error)=>{
  504. this.$alert(error, '错误', {
  505. confirmButtonText: '确定'
  506. })
  507. })
  508. }).catch(() => {});
  509. },
  510. closeTestSoBom(){
  511. this.$refs.saveForm.resetFields();
  512. this.testSoBom = {
  513. site:this.$store.state.user.site,
  514. testNo:undefined,
  515. itemNo:undefined,
  516. componentPartNo:undefined,
  517. partDesc:undefined,
  518. umId:undefined,
  519. assemblyQty:0,
  520. fixedScrapQty:0,
  521. scrapFactor:0,
  522. requiredQty:0,
  523. issuedQty:undefined,
  524. issuedDate:undefined,
  525. reserveQty:0,
  526. mateGroup:undefined,
  527. notifiedQty:undefined,
  528. rmTypeDb:0,
  529. issuedType:undefined,
  530. remark:undefined,
  531. unitCost:0,
  532. totalCost:0,
  533. }
  534. },
  535. clearTable(){
  536. this.$emit("change",[])
  537. this.$refs.testSoBomTable.clearSelection();
  538. },
  539. selectTestSoBom(){
  540. let params = {
  541. testNo:this.testNo,
  542. site:this.$store.state.user.site
  543. }
  544. this.$emit("change",[])
  545. this.$refs.testSoBomTable.clearSelection();
  546. selectTestSoBom(params).then(({data})=>{
  547. if (data && data.code === 0 ){
  548. this.$emit("change",data.rows)
  549. this.restSoBom();
  550. // 数据加载完成后,更新材料总金额
  551. this.$nextTick(() => {
  552. this.updateTestMaterialTotalAmount()
  553. })
  554. }else {
  555. this.$message.error(data.msg)
  556. }
  557. }).catch((error)=>{
  558. this.$message.error(error)
  559. })
  560. },
  561. saveTestSoBomBtn(isClose){
  562. this.$refs.saveForm.validate((validate,objects)=>{
  563. if (validate){
  564. if (this.testSoBom.itemNo !== undefined && this.testSoBom.itemNo !== null && this.testSoBom.itemNo !== ''){
  565. updateTestSoBom(this.testSoBom).then(({data})=>{
  566. if (data && data.code === 0){
  567. this.$message.success(data.msg)
  568. this.selectTestSoBom()
  569. this.saveOrUpdateFlag = false
  570. }else {
  571. this.$message.error(data.msg)
  572. }
  573. }).catch((error)=>{
  574. this.$message.error(error)
  575. })
  576. }else {
  577. this.testSoBom.testNo = this.testNo
  578. saveTestSoBom(this.testSoBom).then(({data})=>{
  579. if (data && data.code === 0){
  580. this.$message.success(data.msg)
  581. this.selectTestSoBom()
  582. if (!isClose){
  583. this.saveOrUpdateFlag = false
  584. }
  585. }else {
  586. this.$message.error(data.msg)
  587. }
  588. }).catch((error)=>{
  589. this.$message.error(error)
  590. })
  591. }
  592. }else {
  593. for (let key in objects) {
  594. this.$message.error(this.testSoBomLabel[key]+"不能为空")
  595. }
  596. }
  597. })
  598. },
  599. restSoBom(){
  600. this.$nextTick(()=>{
  601. this.testSoBom= {
  602. site:this.$store.state.user.site,
  603. testNo:this.testNo,
  604. itemNo:undefined,
  605. componentPartNo:undefined,
  606. partDesc:undefined,
  607. umId:undefined,
  608. assemblyQty:0,
  609. fixedScrapQty:0,
  610. scrapFactor:0,
  611. requiredQty:0,
  612. issuedQty:undefined,
  613. issuedDate:undefined,
  614. reserveQty:0,
  615. mateGroup:undefined,
  616. notifiedQty:undefined,
  617. rmTypeDb:0,
  618. issuedType:undefined,
  619. remark:undefined,
  620. }
  621. })
  622. },
  623. getAllUm(){
  624. let params = {
  625. site:this.$store.state.user.site
  626. }
  627. searchAllUmInformationList(params).then(({data})=>{
  628. if (data && data.code === 0){
  629. this.umList = data.rows
  630. }else {
  631. this.$message.warning(data.msg)
  632. }
  633. }).catch((error)=>{
  634. this.$message.error(error)
  635. })
  636. },
  637. computeQuantityRequired(){
  638. let total = new Decimal(this.testNumber).mul(new Decimal(this.testSoBom.assemblyQty)).div((new Decimal(100).sub(new Decimal(this.testSoBom.scrapFactor))).div(new Decimal(100)))
  639. this.testSoBom.requiredQty = new Decimal(total.toFixed(3,Decimal.ROUND_FLOOR)).toSignificantDigits().toNumber();
  640. },
  641. computeTotalCost(val){
  642. this.testSoBom.assemblyQty = new Decimal(this.testSoBom.requiredQty).div(new Decimal(this.testNumber)).toNumber()
  643. this.testSoBom.totalCost = new Decimal(this.testSoBom.requiredQty).mul(new Decimal(this.testSoBom.unitCost)).toNumber()
  644. },
  645. handleQueryPart(){
  646. let params = {
  647. site:this.$store.state.user.site,
  648. partNo:this.testSoBom.componentPartNo
  649. }
  650. queryPart(params).then(({data})=>{
  651. if (data && data.code === 0){
  652. if (data.rows && data.rows.length === 1){
  653. this.dblClickPartTable(data.rows[0])
  654. }else {
  655. this.dblClickPartTable({
  656. site:this.$store.state.user.site,
  657. partNo:this.testSoBom.componentPartNo,
  658. })
  659. }
  660. }else {
  661. this.$message.warning(data.msg)
  662. }
  663. }).catch((error)=>{
  664. this.$message.error(error)
  665. })
  666. },
  667. handleSizeChange(val){
  668. this.size = val
  669. this.initPartList()
  670. },
  671. handleCurrentChange(val){
  672. this.no = val
  673. this.initPartList()
  674. },
  675. // 更新测试主信息的材料总金额
  676. updateTestMaterialTotalAmount(){
  677. if (!this.testNo) {
  678. return
  679. }
  680. // 计算当前所有材料的总金额
  681. const totalAmount = this.dataList.reduce((sum, item) => {
  682. return sum + (Number(item.totalCost) || 0)
  683. }, 0)
  684. const params = {
  685. testNo: this.testNo,
  686. materialTotalAmount: totalAmount
  687. }
  688. updateMaterialTotalAmount(params).then(({data}) => {
  689. if (data && data.code === 0) {
  690. // 更新成功,通知父组件刷新主信息
  691. console.log('材料总金额更新成功:', totalAmount)
  692. this.$emit('refresh-test-info')
  693. }
  694. }).catch((error) => {
  695. console.error('更新材料总金额失败', error)
  696. })
  697. }
  698. },
  699. watch:{
  700. partDialogFlag(newVal,oldVal){
  701. if (newVal === false){
  702. this.no = 1;
  703. this.size = 20;
  704. this.total = 0;
  705. this.closePartDialog();
  706. }
  707. },
  708. // queryLoading(newVal,oldVal){
  709. // if (newVal){
  710. // setTimeout(()=>{
  711. // this.queryLoading = false
  712. // },5000)
  713. // }
  714. // }
  715. }
  716. }
  717. </script>
  718. <template>
  719. <div class="testTable">
  720. <div style="margin-bottom: 5px">
  721. <template v-if="isAuth('107001:tab3:save')">
  722. <el-button type="primary" v-if="!disabled" @click="saveTestSoBom(null)">新增</el-button>
  723. </template>
  724. <template v-if="isAuth('107001:tab3:remove')">
  725. <el-button type="primary" v-if="!disabled" @click="removeBatchTestSoBom">删除</el-button>
  726. </template>
  727. </div>
  728. <el-table
  729. :height="height" border
  730. :data="dataList"
  731. ref="testSoBomTable"
  732. @row-click="testSoBomClickRow"
  733. @selection-change="selectionTestSoBom">
  734. <el-table-column
  735. type="selection"
  736. header-align="center"
  737. align="center"
  738. width="50">
  739. </el-table-column>
  740. <el-table-column
  741. v-for="(item,index) in testSoBomColumnList" :key="index"
  742. :sortable="item.columnSortable"
  743. :prop="item.columnProp"
  744. :header-align="item.headerAlign"
  745. :show-overflow-tooltip="item.showOverflowTooltip"
  746. :align="item.align"
  747. :fixed="item.fixed===''?false:item.fixed"
  748. :min-width="item.columnWidth"
  749. :label="item.columnLabel">
  750. <template slot-scope="scope">
  751. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  752. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  753. </template>
  754. </el-table-column>
  755. <el-table-column label="操作" align="center" fixed="right">
  756. <template slot-scope="{row,$index}">
  757. <template v-if="isAuth('107001:tab3:update')">
  758. <a type="text" style="cursor:pointer;" v-if="!disabled" @click="saveTestSoBom(row)">编辑</a>
  759. </template>
  760. </template>
  761. </el-table-column>
  762. </el-table>
  763. <el-dialog :title="(testSoBom.itemNo?'编辑':'新增')+'-物料结构'" :close-on-click-modal="false" v-drag width="600px" append-to-body :visible.sync="saveOrUpdateFlag" @close="closeTestSoBom">
  764. <el-form ref="saveForm" label-position="top" :model="testSoBom" :rules="testSoBomRule">
  765. <el-row :gutter="15">
  766. <el-col :span="24">
  767. <el-row :gutter="15">
  768. <el-col :span="8">
  769. <el-form-item label="物料编码" prop="componentPartNo">
  770. <span slot="label" @click="openPartDialog"><a>物料编码</a></span>
  771. <el-input @blur="handleQueryPart" v-model="testSoBom.componentPartNo"></el-input>
  772. </el-form-item>
  773. </el-col>
  774. <el-col :span="11">
  775. <el-form-item label="物料名称" prop="partDesc">
  776. <el-input disabled v-model="testSoBom.partDesc"></el-input>
  777. </el-form-item>
  778. </el-col>
  779. <el-col :span="5">
  780. <el-form-item label="单位" prop="umId">
  781. <el-select disabled v-model="testSoBom.umId" placeholder=" ">
  782. <el-option v-for="v in umList" :value="v.umId" :label="v.umId" :key="v.umId"></el-option>
  783. </el-select>
  784. </el-form-item>
  785. </el-col>
  786. </el-row>
  787. </el-col>
  788. <el-col :span="8">
  789. <el-form-item label="需求数量" prop="requiredQty">
  790. <el-input-number @input="computeTotalCost" style="width: 100%;margin-top: -5px;" :min="0" v-model="testSoBom.requiredQty" :controls="false"></el-input-number>
  791. </el-form-item>
  792. </el-col>
  793. <el-col :span="8">
  794. <el-form-item label="单价" prop="unitCost">
  795. <el-input-number @input="computeTotalCost" :disabled="testSoBom.status === 'N'" style="width: 100%;margin-top: -5px;" :min="0" v-model="testSoBom.unitCost" :controls="false"></el-input-number>
  796. </el-form-item>
  797. </el-col>
  798. <el-col :span="8">
  799. <el-form-item label="总价" prop="totalCost">
  800. <el-input-number disabled style="width: 100%;margin-top: -5px;" :min="0" v-model="testSoBom.totalCost" :controls="false"></el-input-number>
  801. </el-form-item>
  802. </el-col>
  803. <el-col :span="24">
  804. <el-form-item label="备注" prop="remark" style="height: 90px">
  805. <el-input type="textarea" resize='none' :autosize="{ minRows: 3, maxRows: 3 }" v-model="testSoBom.remark"></el-input>
  806. </el-form-item>
  807. </el-col>
  808. </el-row>
  809. </el-form>
  810. <span slot="footer" class="dialog-footer">
  811. <el-button type="primary" v-if="!testSoBom.itemNo" @click="saveTestSoBomBtn(true)"> </el-button>
  812. <el-button type="primary" @click="saveTestSoBomBtn(false)">保存并关闭</el-button>
  813. <el-button @click="saveOrUpdateFlag = false"> </el-button>
  814. </span>
  815. </el-dialog>
  816. <el-dialog title="物料信息" width="800px" append-to-body :close-on-click-modal="false" v-drag :visible.sync="partDialogFlag">
  817. <!--搜索条件-->
  818. <el-form :model="partData" ref="partDataForm" style="width: 600px;" label-position="top">
  819. <el-row :gutter="10">
  820. <el-col :span="6">
  821. <el-form-item label="物料编号" prop="partNo">
  822. <el-input v-model="partData.partNo" clearable/>
  823. </el-form-item>
  824. </el-col>
  825. <el-col :span="6" >
  826. <el-form-item label="物料名称" prop="partDesc">
  827. <el-input v-model="partData.partDesc" clearable/>
  828. </el-form-item>
  829. </el-col>
  830. <el-col :span="6" >
  831. <el-form-item label="IFS物料编码" prop="ifsPartNo">
  832. <el-input v-model="partData.ifsPartNo" clearable/>
  833. </el-form-item>
  834. </el-col>
  835. <el-col :span="6" >
  836. <el-form-item label=" ">
  837. <el-button type="primary" @click="initPartList"> </el-button>
  838. </el-form-item>
  839. </el-col>
  840. </el-row>
  841. </el-form>
  842. <!--筛选的数据-->
  843. <el-table :data="partList" v-loading="queryLoading" ref="partDataTable" :style="{marginTop:'5px'}"
  844. height="200px" width="100%" stripe border
  845. @row-dblclick="dblClickPartTable">
  846. <el-table-column label="物料编号" prop="partNo" header-align="center" align="left" min-width="100"/>
  847. <el-table-column label="物料名称" prop="partDesc" header-align="center" align="left" min-width="160"/>
  848. <el-table-column label="单位" prop="umId" header-align="center" align="center" min-width="60"/>
  849. <el-table-column label="IFS物料编码" prop="ifsPartNo" header-align="center" align="left" min-width="100"/>
  850. </el-table>
  851. <!--分页-->
  852. <div style="margin-top: 10px;text-align: right;">
  853. <el-pagination style="margin-top: 0;"
  854. @size-change="handleSizeChange"
  855. @current-change="handleCurrentChange"
  856. :current-page="no"
  857. :page-sizes="[20, 50, 100, 200, 500]"
  858. :page-size="size"
  859. :total="total"
  860. layout="total, sizes, prev, pager, next, jumper">
  861. </el-pagination>
  862. </div>
  863. </el-dialog>
  864. </div>
  865. </template>
  866. <style scoped>
  867. .el-input-number /deep/ .el-input__inner{
  868. text-align: right;
  869. padding-right: 5px !important;
  870. }
  871. </style>