yangys
2025-09-10 040a1ebd917ae25d7ab41ccbe236d4327cda648e
src/views/wel/shemi.vue
@@ -16,7 +16,7 @@
            </el-col>
            <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="输入至少3个字符过滤数据"
              <el-select v-model="searchTreeData.drawingNo" clearable filterable remote reserve-keyword placeholder="输入至少3个字符过滤数据"
                :remote-method="remoteMethod" :loading="searchLoading">
                <el-option v-for="item in drawingNoList" :key="item.value" :label="item.label"
                  :value="item.value" /></el-select>
@@ -39,29 +39,20 @@
            </el-col>
          </el-row>
        </template>
        <!-- <template #menu-left>
        <el-button :size="size" type="primary" @click="showAdd()">新增根节点</el-button>
      </template> -->
        <template #name="{ row }">
          <span>{{ row.name }}</span>
          <!-- <el-button :size="size" text v-if="row.nodeType != 70" icon="el-icon-setting" type="primary" placeholder="修改" @click="showEdit(row)" title="修改"></el-button>
        <el-button :size="size" text v-if="row.nodeType != 10" icon="el-icon-delete" type="primary" @click="showDel(row)" placeholder="删除" title="删除"></el-button>
        <el-button :size="size" text v-if="row.nodeType != 60 && row.nodeType != 70" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="新增子级" title="新增子级"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 60 || row.nodeType == 50" icon="el-icon-upload" type="primary" @click="showUpload(row)" placeholder="文件上传" title="文件上传"></el-button> -->
          <!-- 涉密网才有 -->
          <!-- <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"
          <!-- 替换  v-if="permission.auto_dispatch"   icon="el-icon-unlock"-->
          <el-button class="treebtn" :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="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked != 1"
            icon="el-icon-lock" type="primary" @click="showLockDlg(row)" 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="showUnLockDlg(row)" placeholder="解锁" title="解锁"></el-button>
      <!---->
           <el-button icon="el-icon-unlock" class="treebtn" v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked != 1"text type="primary" @click="showLockDlg(row)" placeholder="锁定" title="锁定"></el-button>
            <el-button icon="el-icon-lock" class="treebtn" :size="size" text
                v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked == 1"
              type="primary" @click="showUnLockDlg(row)" placeholder="解锁" title="解锁"></el-button>
        </template>
      </avue-crud>
    </div>
@@ -81,7 +72,7 @@
            </el-col>
            <el-col :span="4" class="search-data-flex">
              <span class="search-data-title">零组件号:</span>
              <el-select v-model="searchTreeData.drawingNo" filterable remote reserve-keyword placeholder="输入至少3个字符过滤数据"
              <el-select v-model="searchTreeData.drawingNo" clearable filterable remote reserve-keyword placeholder="输入至少3个字符过滤数据"
                :remote-method="remoteMethod" :loading="searchLoading">
                <el-option v-for="item in drawingNoList" :key="item.value" :label="item.label"
                  :value="item.value" /></el-select>
@@ -111,14 +102,14 @@
          <span>{{ row.name }}</span>
          
          <!-- 替换  v-if="permission.auto_dispatch"-->
          <el-button :size="size" text v-if="row.nodeType == 60 && row.parentIds.indexOf('0,1,') > -1"
          <el-button class="treebtn" :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
          <el-button class="treebtn" :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="showLockDlg(row)" placeholder="锁定" title="锁定"></el-button>
          <el-button :size="size" text
            icon="el-icon-unlock" type="primary" @click="showLockDlg(row)" placeholder="锁定" title="锁定"></el-button>
          <el-button class="treebtn" :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="showUnLockDlg(row)" placeholder="解锁" title="解锁"></el-button>
            icon="el-icon-lock" type="primary" @click="showUnLockDlg(row)" placeholder="解锁" title="解锁"></el-button>
        </template>
      </avue-crud>
    </div>
@@ -189,7 +180,10 @@
</template>
<script>
import { Delete, Edit, Search, Share, Upload ,Lock,Unlock} from '@element-plus/icons-vue'
import debounce from 'lodash/debounce';
import { ElMessage } from 'element-plus';
import TodolistLeft from './components/TodolistLeft.vue';
import TodolistRightTop from './components/TodolistRightTop.vue';
@@ -202,6 +196,7 @@
  data() {
    let rejectText = '驳回';//+this.row.categoryName;
    return {
      size:'large',//树里按钮的尺寸
      isSearch: null,
      treeSearchLoad: false,
      drawingNoList: [],
@@ -472,12 +467,18 @@
            disabled:true,
            labelWidth: "120",
          },
          {
            label: '锁定原因',
            prop: 'remark',
            type: "textarea",
            disabled:true,
            labelWidth: "120",
            span: 24,
          },
          {
            label: '解锁原因',
            prop: 'unlockReason',
            type: "textarea",
            labelWidth: "120",
            span: 24,
          }
@@ -770,7 +771,6 @@
      return time.getTime() > today.getTime() || time.getTime() < threeMonthsAgo.getTime();//
    },
    createTimeChange(value) {
      console.log('createTimeChange', value)
      this.searchTreeData.createTimeBegin = value[0];
      this.searchTreeData.createTimeEnd = value[1];
    },
@@ -817,11 +817,11 @@
      this.unlockForm.id = row.id;
      this.unlockForm.name = row.name
      this.unlockForm.remark = row.remark;
      this.unlockForm.unlockReason='';
      this.unlockForm.parentId = row.parentId;
      this.unlockBox = true;
    },
    lockSubmit(row,done) {  
      //console.log(row,done)
      //锁定提交
      this.$confirm('是否锁定', {
        confirmButtonText: '确定',
@@ -829,11 +829,10 @@
        type: 'warning',
      }).then(() => {
        axios.post('/blade-mdm/program/node/lock',qs.stringify(this.lockForm)).then(res=>{
          console.log('res',res.data)
          if (res.data.code == 200) {
            this.$message({ type: 'success', message: '操作成功!' });
            this.addLocalTreeNode(this.lockForm.parentId);
            this.lockBox = false;
          } else {
            this.$message({ type: 'error', message: res.data.msg });
          }
@@ -856,13 +855,14 @@
        axios({
          url: '/blade-mdm/flow/lock/start-unlock',
          method: 'post',
          params: {nodeId: row.id }
          params: {nodeId: row.id,unlockReason:row.unlockReason }
        }).then(res => {
          if (res.data.code == 200) {
            this.$message({ type: 'success', message: '解锁流程已启动!' });
            this.addLocalTreeNode(row.parentId);
            this.unlockBox = false;
          } else {
            this.$message({ type: 'success', message: res.data.msg });
            this.$message({ type: 'error', message: res.data.msg });
          }
        });
        done();
@@ -894,34 +894,9 @@
        done();
        this.todolistModel = false;
      }).catch(error => {
        window.console.log('haha', error);
        done();
      });
      // if(this.row.taskDefinitionKey === 'programmingTask') {
      //     // if(this.applist.length !== 1) {
      //     //     done();
      //     //     return this.$message.success('请选择1个程序');
      //     // }
      // }
      // approve({
      //     ...this.formApprove,
      //     taskId: this.row.taskId,
      //     processInstanceId: this.row.processInstanceId,
      //     // programIds: this.row.taskDefinitionKey === 'programmingTask' ? this.applist.map(v => v.id).join(',') : '',
      // }).then(res => {
      //     if(res.data.code !== 200) {
      //         this.$message.error(res.data.msg);
      //         done();
      //         return;
      //     }
      //     this.$message.success('审批成功');
      //     this.approveBox = false;
      //     this.onLoad(this.page, this.query);
      //     done();
      // }).catch(err => {
      //     done();
      //     console.error(err);
      // });
    },
    todoSelectionChange(applist) {
      this.applist = applist;
@@ -1001,7 +976,6 @@
      return treeData.map(node => {
        if (node.children && node.children.length > 0) {
          this.defaultExpandedKeys.push(node.id);
          console.log('>>>>>>>>', this.defaultExpandedKeys)
          node.children = this.removeHasChildren(node.children);
        }
        if (node.children.length > 0) {
@@ -1014,10 +988,10 @@
      });
    },
    searchTree() {
      if (this.searchTreeData.programStatus.length == 0 || this.searchTreeData.drawingNo == ""){
      if (this.searchTreeData.programStatus.length == 0 || !this.searchTreeData.drawingNo){
        this.$message.warning('请输入程序状态和零组件号进行搜索');
        return;
      }
      }
      
      this.treeSearchLoad = true;
      this.isSearch = !this.isSearch
@@ -1037,7 +1011,6 @@
        };
        // this.option.defaultExpandAll = true;
        let treeData = this.removeHasChildren(res.data.data);
        console.log('treeData', treeData)
        this.option = Object.assign({},this.option,{defaultExpandedKeys: this.defaultExpandedKeys,lazy: true,defaultExpandAll: true});
        setTimeout(() => {
          this.treeSearchLoad = false;
@@ -1277,50 +1250,7 @@
      this.modalBox = true;
      this.modalForm = row;
    },
    showDel(row) {
      this.$confirm('将会删除该节点及其子节点,是否确认删除?', {
        confirmButtonText: '是',
        cancelButtonText: '否',
        type: 'warning',
      }).then(() => {
        //调用接口
        this.loading = true;
        axios({
          url: '/blade-mdm/program/node/remove',
          method: 'post',
          params: { id: row.id },
        }).then(
          res => {
            this.loading = false;
            this.addLocalTreeNode(row.parentId);
          }
        );
      })
    },
    showAdd(row) {  //新增子节点
      if (!row) {
        this.modalTitle = "新增根节点";
        this.modalForm.nodeType = this.nodeTypeList[0].dictKey;
        this.modalForm.parentId = 0;
      } else {
        if (row.nodeType == 60) { //程序包
          return;
        }
        var defalutNodeType = "";  //下一级节点类型
        for (var i = 0; i < this.nodeTypeList.length; i++) {
          if (row.nodeType == this.nodeTypeList[i].dictKey) {
            defalutNodeType = this.nodeTypeList[i + 1].dictKey;
          }
        }
        this.modalTitle = "新增子节点";
        this.selectedColumn.nodeType = defalutNodeType;
        this.selectedColumn.parentId = row.id;
        this.selectedColumn.name = "";
        this.selectedColumn.id = "";
        this.modalForm = this.selectedColumn;
      }
      this.modalBox = true;
    },
    modalSubmit(row, done) {  //新增子节点保存/修改
      if (this.modalTitle == "修改") {
        var url = "/blade-mdm/program/node/update";
@@ -1382,7 +1312,6 @@
      this.uploadmodalBox = false;
    },
    treeLoad(tree, treeNode, resolve) {
      console.log('tree', tree, treeNode, this.option)
      this.loading = true;
      var obj = { parentId: tree.id }
      
@@ -1470,6 +1399,9 @@
</script>
<style lang="scss">
.treebtn {
   font-size:16px;
}
.norightmenu .avue-crud .avue-crud__header {
  display: none !important;
}