| | |
| | | > |
| | | <template #search> |
| | | <el-row :gutter="24"> |
| | | <el-col :span="6"> |
| | | <el-input v-model="search.name" placeholder="请输入节点名称" clearable/> |
| | | <el-col :span="6" class="search-data-flex"> |
| | | <span class="search-data-title">程序状态:</span> |
| | | <el-checkbox-group v-model="searchTreeData.programStatus"> |
| | | <el-checkbox value="1" label="试切" /> |
| | | <el-checkbox value="2" label="固化" /> |
| | | <el-checkbox value="3" label="偏离" /> |
| | | </el-checkbox-group> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-select v-model="search.nodeType" placeholder="请输入节点类型" clearable> |
| | | <el-option v-for="item in nodeTypeList" :key="item.dictValue" :label="item.dictValue" :value="item.dictKey"/>formApprove. |
| | | </el-select> |
| | | <el-col :span="6" class="search-data-flex"> |
| | | <span class="search-data-title">零组件号:</span> |
| | | <el-select v-model="searchTreeData.drawingNo" filterable remote reserve-keyword placeholder="零组件号" :remote-method="remoteMethod" :loading="searchLoading"> |
| | | <el-option v-for="item in drawingNoList" :key="item.value" :label="item.label" :value="item.value"/></el-select> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-col :span="8" class="search-data-flex"> |
| | | <span class="search-data-title">时间范围:</span> |
| | | <el-date-picker v-model="searchTreeData.createTime" type="daterange" start-placeholder="开始时间" end-placeholder="结束时间" :size="size" format="YYYY-MM-DD" value-format="YYYY-MM-DD" :disabled-date="disabledDate" @change="createTimeChange"/> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-button type="primary" @click="searchTree"><el-icon class="el-icon--right" style="margin-right: 6px;"><Search /></el-icon>搜索</el-button> |
| | | <el-button :icon="Delete" @click="setClearTree"><el-icon class="el-icon--right" style="margin-right: 6px;"><Delete /></el-icon>清空</el-button> |
| | | </el-col> |
| | |
| | | <!-- <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-pie-chart" type="primary" @click="upgrade(row)" placeholder="升版" title="升版"></el-button> --> |
| | | <!-- 工控网才有 --> |
| | | <!-- <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="下发" title="下发"></el-button> --> |
| | | <!-- 替换 --> |
| | | |
| | | <!-- 替换 v-if="permission.auto_dispatch"--> |
| | | <el-button :size="size" text v-if="row.nodeType == 60 && row.parentIds.indexOf('0,1,')>-1" icon="el-icon-switch" type="primary" @click="replacement(row)" placeholder="替换" title="替换"></el-button> |
| | | <el-button :size="size" text v-if="row.nodeType == 60 && row.parentIds.indexOf('0,2')>-1 && !row.isLocked" icon="el-icon-lock" type="primary" @click="locked(row,true)" placeholder="锁定" title="锁定"></el-button> |
| | | <el-button :size="size" text v-if="row.nodeType == 60 && row.parentIds.indexOf('0,2')>-1 && row.isLocked" icon="el-icon-unlock" type="primary" @click="locked(row,false)" placeholder="解锁" title="解锁"></el-button> |
| | | <el-button :size="size" text v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2')>-1 && row.isLocked != 1" icon="el-icon-lock" type="primary" @click="locked(row,true)" placeholder="锁定" title="锁定"></el-button> |
| | | <el-button :size="size" text v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2')>-1 && row.isLocked == 1" icon="el-icon-unlock" type="primary" @click="locked(row,false)" placeholder="解锁" title="解锁"></el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <!-- 新增节点 --> |
| | |
| | | data() { |
| | | let rejectText = '驳回';//+this.row.categoryName; |
| | | return { |
| | | drawingNoList: [], |
| | | searchLoading: false, |
| | | searchTreeData: { |
| | | programStatus: [], |
| | | drawingNo: "", |
| | | createTime: [], |
| | | createTimeBegin: "", |
| | | createTimeEnd: "" |
| | | }, |
| | | drawingNo: '', |
| | | processNo: '', |
| | | processEdition: '', |
| | | processEdition: '', |
| | | replaceDataId: "", |
| | | formApprove: { |
| | | title: '', |
| | |
| | | modalTitle: "", |
| | | id: "", |
| | | parentId:1, |
| | | search: { |
| | | name: "", |
| | | nodeType: "" |
| | | }, |
| | | loading: true, |
| | | mypage: { |
| | | size: 10, |
| | |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo', 'permission']), |
| | | uploadmodalOption() { |
| | | return { |
| | | submitText: "保存", |
| | |
| | | |
| | | }, |
| | | methods: { |
| | | locked(row, isLock) { |
| | | row.isLocked == isLock |
| | | this.$confirm(`是否${isLock ? '锁定' : '解锁'}`, { |
| | | disabledDate(time) { |
| | | // 获取当前日期 |
| | | const today = new Date(); |
| | | today.setHours(0, 0, 0, 0); // 设置为当天开始时间 |
| | | |
| | | // 获取三个月前的日期 |
| | | const threeMonthsAgo = new Date(); |
| | | threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3); |
| | | threeMonthsAgo.setHours(0, 0, 0, 0); |
| | | |
| | | // 禁用今天之后的日期和三个月前的日期之前的日期 |
| | | return time.getTime() > today.getTime() || time.getTime() < threeMonthsAgo.getTime(); |
| | | }, |
| | | createTimeChange(value) { |
| | | this.searchTreeData.createTimeBegin = value[0]; |
| | | this.searchTreeData.createTimeEnd = value[1]; |
| | | }, |
| | | remoteMethod(query) { |
| | | if (query) { |
| | | this.searchLoading = true; |
| | | axios({ |
| | | url: '/blade-mdm/program/node/drawing-no-pick', |
| | | method: 'get', |
| | | params: {drawingNo: query} |
| | | }).then(resp => { |
| | | this.searchLoading = false; |
| | | var drawingNoList = []; |
| | | resp.data.data.forEach(item=> { |
| | | drawingNoList.push({label: item,value: item}) |
| | | }) |
| | | this.drawingNoList = drawingNoList; |
| | | }); |
| | | }else { |
| | | this.drawingNoList = []; |
| | | } |
| | | }, |
| | | locked(row, isLockP) { |
| | | //row.isLocked == isLock |
| | | var isLock = row.isLocked == 1; |
| | | console.log('isLock',isLock) |
| | | this.$confirm(`是否${isLock ? '解锁' : '锁定'}`, { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | |
| | | axios({ |
| | | url: isLock ? '/blade-mdm/program/node/lock' : '/blade-mdm/flow/lock/start-unlock', |
| | | url: isLock ? '/blade-mdm/flow/lock/start-unlock' : '/blade-mdm/program/node/lock', |
| | | method: 'post', |
| | | params: {id: row.id,nodeId: row.id} |
| | | }).then(res => { |
| | | if(res.data.code == 200) { |
| | | this.$message({type: 'success',message: '操作成功!'}); |
| | | this.addLocalTreeNode(row.parentId); |
| | | }else { |
| | | this.$message({type: 'success',message: res.data.msg}); |
| | | } |
| | | }); |
| | | }).catch(action=>{ |
| | | console.log('cancel') |
| | | }); |
| | | }, |
| | | handleSubmit(form, done) { |
| | |
| | | url: '/blade-mdm/flow/replace/start', |
| | | method: 'post', |
| | | data: obj |
| | | }).then( |
| | | resp => { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }).then(resp => { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }); |
| | | done(); |
| | | this.todolistModel = false; |
| | | }).catch(error =>{ |
| | | window.console.log('haha',error); |
| | | done(); |
| | | }); |
| | | done(); |
| | | this.todolistModel = false; |
| | | }); |
| | | // if(this.row.taskDefinitionKey === 'programmingTask') { |
| | | // // if(this.applist.length !== 1) { |
| | | // // done(); |
| | |
| | | url: '/blade-mdm/flow/replace/pre', |
| | | method: 'post', |
| | | params: {nodeId: row.id} |
| | | }).then( |
| | | resp => { |
| | | }).then(resp => { |
| | | this.row = row; |
| | | this.replaceDataId = resp.data.data.processInstanceId; |
| | | this.processNo = resp.data.data.processNo; |
| | |
| | | if (node.children && node.children.length > 0) { |
| | | node.children = this.removeHasChildren(node.children); |
| | | } |
| | | if(node.children.length > 0) { |
| | | const { hasChildren, ...rest } = node; |
| | | return rest; |
| | | } else { |
| | | return node; |
| | | } |
| | | // 删除当前节点的 hasChildren 属性 |
| | | const { hasChildren, ...rest } = node; |
| | | return rest; |
| | | }); |
| | | }, |
| | | // 递归查找目标行(name="机床1") |
| | |
| | | } |
| | | }, |
| | | searchTree() { |
| | | if(this.searchTreeData.programStatus.length == 0) return; |
| | | if(this.searchTreeData.drawingNo == "") return; |
| | | this.searchTreeData.createTimeBegin = this.searchTreeData.createTime[0]; |
| | | this.searchTreeData.createTimeEnd = this.searchTreeData.createTime[1]; |
| | | this.searchTreeData.status = this.searchTreeData.programStatus.join(); |
| | | axios({ |
| | | url: '/blade-mdm/program/node/search-list', |
| | | url: '/blade-mdm/program/node/search-list2', |
| | | method: 'get', |
| | | params: this.search, |
| | | params: this.searchTreeData |
| | | }).then(res => { |
| | | if(res.data.data.length == 0) return; |
| | | this.option.defaultExpandAll = true; |
| | | this.treeData = this.removeHasChildren(res.data.data); |
| | | this.$nextTick(() => { |
| | | this.highlightTargetRow(); // 设置当前行高亮 |
| | | this.tabsForm = this.targetRow; //tabs节点信息 |
| | | if(this.tabsForm == null) return; |
| | | this.nodeTypeList.forEach(item=> { |
| | | if(item.dictKey == this.tabsForm.nodeType) { |
| | | this.tabsForm.nodeTypeName = item.dictValue; |
| | |
| | | }, |
| | | setClearTree() { |
| | | this.option.defaultExpandAll = false; |
| | | this.searchTreeData = { |
| | | programStatus: [], |
| | | status:'', |
| | | drawingNo: "", |
| | | createTime: [], |
| | | createTimeBegin: "", |
| | | createTimeEnd: "" |
| | | }; |
| | | this.treeData = []; |
| | | this.$nextTick(()=> { |
| | | this.onLoad(); |
| | |
| | | }, |
| | | getPre() { |
| | | alert(1) |
| | | } |
| | | }, |
| | | subtractMonths(date, months) { |
| | | const newDate = new Date(date); |
| | | const currentMonth = newDate.getMonth(); |
| | | newDate.setMonth(currentMonth - months); |
| | | return newDate; |
| | | }, |
| | | getBeginDate() { |
| | | var beginDate = this.subtractMonths(new Date(),3); |
| | | return `${beginDate.getFullYear()}-${(beginDate.getMonth() + 1).toString().padStart(2, '0')}-${beginDate.getDate().toString().padStart(2, '0')}`; |
| | | }, |
| | | getToday() { |
| | | let today = new Date(); |
| | | return `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate().toString().padStart(2, '0')}`; |
| | | |
| | | }, |
| | | }, |
| | | mounted() { |
| | | let b = this.getBeginDate() |
| | | this.defaultTimeRange = [b,this.getToday()]; |
| | | this.searchTreeData.createTime =[b,this.getToday()] |
| | | |
| | | this.tabsOption = this.tabsOption1; |
| | | //获取nodetype |
| | | axios({url: '/blade-system/dict-biz/dictionary?code=nc_node_type',method: 'get'}).then(res => { |
| | |
| | | .code-box .el-drawer__header { |
| | | margin-bottom: 0; |
| | | } |
| | | .search-data-title { |
| | | font-size: 12px; |
| | | margin-right: 8px; |
| | | display: inline-block; |
| | | width: 68px; |
| | | } |
| | | .search-data-flex { |
| | | display: flex!important; |
| | | align-items: center; |
| | | } |
| | | </style> |