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.

625 lines
20 KiB

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