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.

650 lines
20 KiB

2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" style="margin-top: 1px; margin-left: 0px;" >
  4. <el-row :gutter="20">
  5. <el-col :span="18">
  6. <el-form-item label="物料">
  7. <el-input v-model="bomData.partNo" readonly style="width: 120px"></el-input>
  8. </el-form-item>
  9. <el-form-item label="BOM类型">
  10. <el-input v-model="bomData.bomType" readonly style="width: 120px"></el-input>
  11. </el-form-item>
  12. <el-form-item label="BOM版本">
  13. <el-input v-model="bomData.engChgLevel" readonly style="width: 120px"></el-input>
  14. </el-form-item>
  15. <el-form-item label="替代编码">
  16. <el-input v-model="bomData.alternativeNo" readonly style="width: 120px"></el-input>
  17. </el-form-item>
  18. <el-form-item label=" ">
  19. <el-button type="primary" @click="searchTable()" >刷新</el-button>
  20. <el-button type="primary" v-if="!ifDisableFlag" @click="changeBomRev()" >变更</el-button>
  21. <el-button type="primary" @click="jumpBom()" >跳转至BOM</el-button>
  22. <el-button v-if="baseForm.status === 'spz'&&!ifDisableFlag" type="primary" @click="agreeSubmit">同意</el-button>
  23. <el-button v-if="baseForm.status === 'spz' && baseForm.isReject === 'Y' &&!ifDisableFlag" type="primary" @click="submitDataModal">驳回</el-button>
  24. <!-- <el-button type="primary" @click="newData()" v-if="!ifDisableFlag">新增</el-button>-->
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="3"><div class="grid-content bg-purple">
  28. <el-form-item :label="'当前节点'" style="width: 100%">
  29. <el-input v-model="spForm.nodeName" disabled ></el-input>
  30. </el-form-item>
  31. </div>
  32. </el-col>
  33. <el-col :span="3"><div class="grid-content bg-purple">
  34. <el-form-item :label="'审批人'" style="width: 100%">
  35. <el-input v-model="spForm.sp" disabled ></el-input>
  36. </el-form-item>
  37. </div>
  38. </el-col>
  39. </el-row>
  40. <el-table
  41. :data="bomList"
  42. :height="height"
  43. border
  44. ref="componentTable"
  45. style="width:100%">
  46. <el-table-column
  47. v-for="(item,index) in columnList1" :key="index"
  48. :sortable="item.columnSortable"
  49. :prop="item.columnProp"
  50. :header-align="item.headerAlign"
  51. :show-overflow-tooltip="item.showOverflowTooltip"
  52. :align="item.align"
  53. :fixed="item.fixed == ''?false:item.fixed"
  54. :min-width="item.columnWidth"
  55. :label="item.columnLabel">
  56. <template slot-scope="scope">
  57. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  58. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column
  62. fixed="right"
  63. header-align="center"
  64. align="center"
  65. width="90"
  66. label="操作">
  67. <template slot-scope="scope">
  68. <a type="text" size="small" @click="jumpPeifang(scope.row)">跳转配方</a>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. </el-form>
  73. <el-dialog title="变更BOM" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="750px">
  74. <el-table
  75. :data="bomDetailList"
  76. height="300"
  77. border
  78. highlight-current-row
  79. onclick=""
  80. @row-click="getRow"
  81. ref="componentTable"
  82. style="width:100%">
  83. <el-table-column
  84. prop="partNo"
  85. header-align="left"
  86. align="left"
  87. min-width="80"
  88. label="物料编码">
  89. </el-table-column>
  90. <el-table-column
  91. prop="bomType"
  92. header-align="left"
  93. align="left"
  94. min-width="80"
  95. label="BOM类型">
  96. </el-table-column>
  97. <el-table-column
  98. prop="engChgLevel"
  99. header-align="left"
  100. align="left"
  101. min-width="80"
  102. label="BOM版本">
  103. </el-table-column>
  104. <el-table-column
  105. prop="alternativeNo"
  106. header-align="left"
  107. align="left"
  108. min-width="80"
  109. label="替代编码">
  110. </el-table-column>
  111. <el-table-column
  112. prop="alternativeDescription"
  113. header-align="left"
  114. align="left"
  115. min-width="80"
  116. label="替代名称">
  117. </el-table-column>
  118. <el-table-column
  119. prop="status"
  120. header-align="left"
  121. align="left"
  122. min-width="60"
  123. label="状态">
  124. </el-table-column>
  125. <el-table-column
  126. prop="effPhaseInDate"
  127. header-align="left"
  128. align="left"
  129. min-width="80"
  130. label="生效日期">
  131. </el-table-column>
  132. <el-table-column
  133. prop="effPhaseOutDate"
  134. header-align="left"
  135. align="left"
  136. min-width="80"
  137. label="失效日期">
  138. </el-table-column>
  139. </el-table>
  140. <el-footer style="height:30px;margin-top:20px;text-align:center">
  141. <el-button type="primary" @click="updateBMBomRev()">确定</el-button>
  142. <el-button type="primary" @click="modalFlag=false">取消</el-button>
  143. </el-footer>
  144. </el-dialog>
  145. <!-- 提交 -->
  146. <el-dialog title="驳回" top="30vh" :close-on-click-modal="false" v-drag :visible.sync="submitModalFlag" width="500px">
  147. <el-form :inline="true" label-position="top">
  148. <el-form-item :label="'驳回意见'">
  149. <el-input type="textarea" v-model="rejectOpinion" :rows="3" resize='none' show-word-limit style="width: 479px;height: 30px"></el-input>
  150. </el-form-item>
  151. </el-form>
  152. <el-footer style="height:30px;margin-top: 50px;text-align:center">
  153. <el-button type="primary" @click="rejectSubmit">确定</el-button>
  154. <el-button type="primary" @click="submitModalFlag = false">取消</el-button>
  155. </el-footer>
  156. </el-dialog>
  157. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  158. </div>
  159. </template>
  160. <script>
  161. import {
  162. searchBMBom,
  163. searchBMBomDetail,
  164. updateBMBomRev,
  165. tsdBasicInformationSearch,getBMStatusDesc,
  166. submitChange, // 提交
  167. getOADetailForBM,
  168. } from "@/api/sampleManagement/technicalSpecificationList.js"
  169. import {
  170. getNodeAuthority, // 获取节点权限
  171. } from '@/api/changeManagement/changeManagement.js'
  172. import Chooselist from '@/views/modules/common/Chooselist'
  173. export default {
  174. components: {
  175. Chooselist
  176. },
  177. data() {
  178. return {
  179. modalFlag:false,
  180. bomFlag:false,
  181. height:200,
  182. searchData: {
  183. site: '',
  184. username: this.$store.state.user.name,
  185. codeNo: '',
  186. buNo:'',
  187. fieldId:'',
  188. },
  189. bomData:{
  190. site: '',
  191. partNo:'',
  192. alternativeNo:'',
  193. bomType:'',
  194. engChgLevel:'',
  195. },
  196. currentRow:"",
  197. bomList:[],
  198. bomDetailList:[],
  199. columnList1: [
  200. {
  201. userId: this.$store.state.user.name,
  202. functionId: 104002,
  203. serialNumber: '104002Table2LineSequence',
  204. tableId: '104002Table2',
  205. tableName: 'BOM子物料表',
  206. columnProp: 'lineSequence',
  207. headerAlign: 'center',
  208. align: 'center',
  209. columnLabel: '序号',
  210. columnHidden: false,
  211. columnImage: false,
  212. columnSortable: false,
  213. sortLv: 0,
  214. status: true,
  215. fixed: '',
  216. columnWidth: 60
  217. },
  218. {
  219. userId: this.$store.state.user.name,
  220. functionId: 104002,
  221. serialNumber: '104002Table2ComponentPart',
  222. tableId: '104002Table2',
  223. tableName: 'BOM子物料表',
  224. columnProp: 'componentPart',
  225. headerAlign: 'center',
  226. align: 'center',
  227. columnLabel: '物料编码',
  228. columnHidden: false,
  229. columnImage: false,
  230. columnSortable: false,
  231. sortLv: 0,
  232. status: true,
  233. fixed: '',
  234. columnWidth: 120
  235. },
  236. {
  237. userId: this.$store.state.user.name,
  238. functionId: 104002,
  239. serialNumber: '104002Table2ComponentPartDesc',
  240. tableId: '104002Table2',
  241. tableName: 'BOM子物料表',
  242. columnProp: 'componentPartDesc',
  243. headerAlign: 'center',
  244. align: 'left',
  245. columnLabel: '物料名称',
  246. columnHidden: false,
  247. columnImage: false,
  248. columnSortable: false,
  249. sortLv: 0,
  250. status: true,
  251. fixed: '',
  252. columnWidth: 120
  253. },
  254. {
  255. userId: this.$store.state.user.name,
  256. functionId: 104002,
  257. serialNumber: '104002Table2QtyPerAssembly',
  258. tableId: '104002Table2',
  259. tableName: 'BOM子物料表',
  260. columnProp: 'qtyPerAssembly',
  261. headerAlign: 'center',
  262. align: 'right',
  263. columnLabel: '单位用量',
  264. columnHidden: false,
  265. columnImage: false,
  266. columnSortable: false,
  267. sortLv: 0,
  268. status: true,
  269. fixed: '',
  270. columnWidth: 80
  271. },
  272. {
  273. userId: this.$store.state.user.name,
  274. functionId: 104002,
  275. serialNumber: '104002Table2ComponentScrap',
  276. tableId: '104002Table2',
  277. tableName: 'BOM子物料表',
  278. columnProp: 'componentScrap',
  279. headerAlign: 'center',
  280. align: 'right',
  281. columnLabel: '调机量',
  282. columnHidden: false,
  283. columnImage: false,
  284. columnSortable: false,
  285. sortLv: 0,
  286. status: true,
  287. fixed: '',
  288. columnWidth: 80
  289. },
  290. {
  291. userId: this.$store.state.user.name,
  292. functionId: 104002,
  293. serialNumber: '104002Table2ShrinkageFactor',
  294. tableId: '104002Table2',
  295. tableName: 'BOM子物料表',
  296. columnProp: 'shrinkageFactor',
  297. headerAlign: 'center',
  298. align: 'right',
  299. columnLabel: '损耗率',
  300. columnHidden: false,
  301. columnImage: false,
  302. columnSortable: false,
  303. sortLv: 0,
  304. status: true,
  305. fixed: '',
  306. columnWidth: 80
  307. },
  308. {
  309. userId: this.$store.state.user.name,
  310. functionId: 104002,
  311. serialNumber: '104002Table2PrintUnitName',
  312. tableId: '104002Table2',
  313. tableName: 'BOM子物料表',
  314. columnProp: 'printUnit',
  315. headerAlign: 'center',
  316. align: 'center',
  317. columnLabel: '单位',
  318. columnHidden: false,
  319. columnImage: false,
  320. columnSortable: false,
  321. sortLv: 0,
  322. status: true,
  323. fixed: '',
  324. columnWidth: 60
  325. },
  326. {
  327. userId: this.$store.state.user.name,
  328. functionId: 104002,
  329. serialNumber: '104002Table2IssueType',
  330. tableId: '104002Table2',
  331. tableName: 'BOM子物料表',
  332. columnProp: 'issueType',
  333. headerAlign: 'center',
  334. align: 'center',
  335. columnLabel: '生产属性',
  336. columnHidden: false,
  337. columnImage: false,
  338. columnSortable: false,
  339. sortLv: 0,
  340. status: true,
  341. fixed: '',
  342. columnWidth: 80
  343. },
  344. {
  345. userId: this.$store.state.user.name,
  346. functionId: 104002,
  347. serialNumber: '104002Table2OperationDesc',
  348. tableId: '104002Table2',
  349. tableName: 'BOM子物料表',
  350. columnProp: 'operationId',
  351. headerAlign: 'center',
  352. align: 'center',
  353. columnLabel: '工序',
  354. columnHidden: false,
  355. columnImage: false,
  356. columnSortable: false,
  357. sortLv: 0,
  358. status: true,
  359. fixed: '',
  360. columnWidth: 80
  361. },
  362. {
  363. userId: this.$store.state.user.name,
  364. functionId: 104002,
  365. serialNumber: '104002Table2IssueToLoc',
  366. tableId: '104002Table2',
  367. tableName: 'BOM子物料表',
  368. columnProp: 'issueToLocName',
  369. headerAlign: 'center',
  370. align: 'center',
  371. columnLabel: '发料库位',
  372. columnHidden: false,
  373. columnImage: false,
  374. columnSortable: false,
  375. sortLv: 0,
  376. status: true,
  377. fixed: '',
  378. columnWidth: 80
  379. },
  380. {
  381. userId: this.$store.state.user.name,
  382. functionId: 104002,
  383. serialNumber: '104002Table2NoteText',
  384. tableId: '104002Table2',
  385. tableName: 'BOM子物料表',
  386. columnProp: 'noteText',
  387. headerAlign: 'center',
  388. align: 'left',
  389. columnLabel: '备注',
  390. columnHidden: false,
  391. columnImage: false,
  392. columnSortable: false,
  393. sortLv: 0,
  394. status: true,
  395. fixed: '',
  396. columnWidth: 150
  397. },
  398. ],
  399. baseForm:{
  400. status:'',
  401. isReject:'',
  402. },
  403. spForm:{
  404. sp:'',
  405. nodeName:'',
  406. },
  407. ifDisableFlag:false,
  408. rejectOpinion: '',
  409. submitModalFlag: false,
  410. }
  411. },
  412. mounted () {
  413. this.$nextTick(() => {
  414. this.height = window.innerHeight - 100
  415. })
  416. },
  417. methods: {
  418. // 获取基础数据列表S
  419. getBaseList (val, type) {
  420. this.tagNo = val
  421. this.tagNo1 = type
  422. this.$nextTick(() => {
  423. let strVal = ''
  424. if (val === 1013) {
  425. if(type==1) {
  426. strVal = this.dataForm.partType
  427. }
  428. }
  429. this.$refs.baseList.init(val, strVal)
  430. })
  431. },
  432. /* 列表方法的回调 */
  433. getBaseData (val) {
  434. if (this.tagNo === 1013) {
  435. if(this.tagNo1==1) {
  436. this.dataForm.partType = val.Base_id
  437. this.dataForm.partTypeDesc = val.Base_desc
  438. }
  439. }
  440. },
  441. choosePart(row){
  442. this.dataForm.erpPartNo=row.erpPartNo
  443. this.dataForm.familyId=row.familyId
  444. this.dataForm.familyName=row.familyName
  445. this.dataForm.partDesc=row.partDesc
  446. this.dataForm.spec=row.spec
  447. this.partModelFlag=false;
  448. },
  449. //初始化组件的参数
  450. init(inData) {
  451. if(this.searchData.codeNo!=null&&this.searchData.codeNo!=''){
  452. return false;
  453. }
  454. //初始化参数
  455. this.searchData = JSON.parse(JSON.stringify(inData));
  456. if(this.searchData.ifDisableFlag){
  457. this.ifDisableFlag=true
  458. }
  459. //刷新表格
  460. this.searchTable();
  461. },
  462. searchTable(){
  463. getOADetailForBM(this.searchData).then(({data}) => {
  464. this.spForm.nodeName = data.row.nodeName
  465. this.spForm.sp = data.row.sp
  466. })
  467. searchBMBom(this.searchData).then(({data}) => {
  468. if(data&& data.code===0){
  469. this.bomList = data.rows;
  470. this.bomData = data.row;
  471. } else {
  472. this.$message.error(data.msg)
  473. }
  474. });
  475. tsdBasicInformationSearch(this.searchData).then(({data}) => {
  476. this.baseForm=data.row;
  477. this.bomData.site=data.row.site
  478. this.bomData.partNo=data.row.finalPartNo
  479. this.getNodeAuthority(data.row)
  480. })
  481. },
  482. searchDetailTable(){
  483. searchBMBomDetail(this.bomData).then(({data}) => {
  484. this.bomDetailList=data.rows;
  485. });
  486. },
  487. changeBomRev(){
  488. this.searchDetailTable()
  489. this.currentRow=null
  490. this.modalFlag=true;
  491. },
  492. getRow(row){
  493. this.currentRow=row
  494. },
  495. updateBMBomRev(){
  496. if(this.currentRow==null){
  497. this.$alert('请点击选择BOM版本!', '错误', {
  498. confirmButtonText: '确定'
  499. })
  500. return false;
  501. }
  502. if(this.currentRow.status!=='Buildable'){
  503. this.$alert('只有Buildable状态的可以保存!', '错误', {
  504. confirmButtonText: '确定'
  505. })
  506. return false;
  507. }
  508. let inData={
  509. site:this.bomData.site,
  510. codeNo:this.searchData.codeNo,
  511. bomType:this.currentRow.bomType,
  512. engChgLevel:this.currentRow.engChgLevel,
  513. bomAlternativeNo:this.currentRow.alternativeNo
  514. }
  515. updateBMBomRev(inData).then(({data})=>{
  516. if(data&& data.code===0){
  517. this.searchTable();
  518. this.modalFlag=false;
  519. this.$message.success( '操作成功')
  520. } else {
  521. this.$message.error(data.msg)
  522. }
  523. })
  524. },
  525. jumpBom(){
  526. if(this.bomData.engChgLevel!=null||this.bomData.engChgLevel!==''){
  527. this.$message.error("bom明细不存在")
  528. }
  529. let inData={
  530. site:this.searchData.site,
  531. partNo:this.bomData.partNo,
  532. bomType:this.bomData.bomType,
  533. engChgLevel:this.bomData.engChgLevel,
  534. }
  535. localStorage.setItem('bomData', JSON.stringify(inData))
  536. window.open('#/part-bomManagement');
  537. },
  538. jumpPeifang(row){
  539. let inData={
  540. site:row.site,
  541. partNo:row.componentPart,
  542. bomType:'Manufacturing',
  543. }
  544. localStorage.setItem('recipeData', JSON.stringify(inData))
  545. window.open('#/part-recipeManagement');
  546. },
  547. // 获取流程的配置权限
  548. getNodeAuthority (row) {
  549. getBMStatusDesc(this.searchData).then(({data})=>{
  550. if(data.status==='已完成'||data.status==='已升版'){
  551. this.ifDisableFlag=true
  552. return false
  553. }else {
  554. //区分请求成功和失败的状况
  555. let tempData = {
  556. site: row.site,
  557. stepId: row.stepId,
  558. menuId: '103002'
  559. }
  560. getNodeAuthority(tempData).then(({data}) => {
  561. if (data && data.code === 0) {
  562. let plmStepRoleBaseBm = data.rows.plm_stepRole_base_bm
  563. let arr = plmStepRoleBaseBm.filter(a => a.fieldId === this.searchData.fieldId)
  564. if (arr.length > 0) {
  565. if (arr[0].updateFlag === 'N') {
  566. this.ifDisableFlag = true
  567. } else {
  568. this.ifDisableFlag = false
  569. }
  570. } else {
  571. this.ifDisableFlag = true
  572. }
  573. }
  574. })
  575. }
  576. })
  577. },
  578. // 同意提交
  579. agreeSubmit () {
  580. this.$confirm(`是否确认提交?`, '提示', {
  581. confirmButtonText: '确定',
  582. cancelButtonText: '取消',
  583. type: 'warning'
  584. }).then(() => {
  585. let tempData = {
  586. site: this.searchData.site,
  587. userName: this.$store.state.user.name,
  588. codeNo: this.searchData.codeNo,
  589. menuId: '103002',
  590. nodeConclusion: 'Y'
  591. }
  592. this.submitData(tempData)
  593. })
  594. },
  595. // 驳回提交
  596. rejectSubmit () {
  597. this.$confirm(`是否确认驳回?`, '提示', {
  598. confirmButtonText: '确定',
  599. cancelButtonText: '取消',
  600. type: 'warning'
  601. }).then(() => {
  602. let tempData = {
  603. site: this.searchData.site,
  604. userName: this.$store.state.user.name,
  605. codeNo: this.searchData.codeNo,
  606. menuId: '103002',
  607. nodeConclusion: 'N',
  608. rejectOpinion : this.rejectOpinion
  609. }
  610. this.submitData(tempData)
  611. })
  612. },
  613. submitData (tempData) {
  614. submitChange(tempData).then(({data}) => {
  615. if (data && data.code === 0) {
  616. this.submitModalFlag = false
  617. this.searchTable();
  618. this.$message({message: '操作成功', type: 'success'})
  619. } else {
  620. this.$alert(data.msg, '错误', {
  621. confirmButtonText: '确定'
  622. })
  623. }
  624. })
  625. },
  626. // 打开提交模态框
  627. submitDataModal () {
  628. this.rejectOpinion = ''
  629. this.submitModalFlag = true
  630. },
  631. },
  632. }
  633. </script>
  634. <style scoped>
  635. </style>