yangys
2025-09-13 7b7edbf4bc099317bbf26238639a4b46d10dcd83
src/views/wel/shemi.vue
@@ -1,7 +1,7 @@
<template>
  <basic-container>
    <div class="norightmenu" v-if="!isSearch">
      <avue-crud :addBtn="false" :option="option" :row-style="{height:'20px'}" :cell-style="{padding:'0px'}" :table-loading="loading" :data="treeData" ref="crud"
      <avue-crud :addBtn="false" :option="option" :row-style="{height:'20px'}" :cell-style="{padding:'0px'}" :table-loading="loading" :data="treeData" ref="crud0"
        v-model:search="search" v-model:page="mypage" @current-change="currentChange" @size-change="sizeChange"
        @refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad" @row-click="rowClick">
        <template #search>
@@ -14,20 +14,20 @@
                <el-checkbox value="3" label="偏离" />
              </el-checkbox-group>
            </el-col>
            <el-col :span="6" class="search-data-flex">
            <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>
            </el-col>
            <el-col :span="8" class="search-data-flex">
            <el-col :span="6" 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"
                @change="createTimeChange" /><!--:disabled-date="disabledDate" 不需要禁用日期-->
            </el-col>
            <el-col :span="4" class="search-data-flex">
            <el-col :span="6" class="search-data-flex">
              <el-button type="primary" @click="searchTree" :loading="treeSearchLoad"><el-icon class="el-icon--right"
                  style="margin-right: 6px;">
                  <Search />
@@ -36,6 +36,7 @@
                  style="margin-right: 6px;">
                  <Delete />
                </el-icon>清空</el-button>
              <el-button type="danger" @click="refresh('crud0')">重置表格</el-button>
            </el-col>
          </el-row>
        </template>
@@ -43,20 +44,20 @@
        <template #name="{ row }">
          <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="permission.replace_button && 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>
    <div class="norightmenu" v-else>
      <avue-crud :addBtn="false" :option="option" :row-style="{height:'20px'}" :cell-style="{padding:'0px'}" :table-loading="loading" :data="treeData" ref="crud"
      <avue-crud :addBtn="false" :option="option" :row-style="{height:'20px'}" :cell-style="{padding:'0px'}" :table-loading="loading" :data="treeData" ref="crud1"
        v-model:search="search" v-model:page="mypage" @current-change="currentChange" @size-change="sizeChange"
        @refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad" @row-click="rowClick">
        <template #search>
@@ -71,18 +72,18 @@
            </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>
            </el-col>
            <el-col :span="8" class="search-data-flex">
            <el-col :span="6" 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"
                @change="createTimeChange" /><!--:disabled-date="disabledDate" 不需要禁用日期-->
            </el-col>
            <el-col :span="6" class="search-data-flex">
            <el-col :span="8" class="search-data-flex">
              <el-button type="primary" @click="searchTree" :loading="treeSearchLoad"><el-icon class="el-icon--right"
                  style="margin-right: 6px;">
                  <Search />
@@ -91,6 +92,7 @@
                  style="margin-right: 6px;">
                  <Delete />
                </el-icon>清空</el-button>
                <el-button type="danger" @click="refresh('crud1')">重置表格</el-button>
            </el-col>
          </el-row>
        </template>
@@ -101,14 +103,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="permission.replace_button && 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>
@@ -179,7 +181,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';
@@ -192,6 +197,7 @@
  data() {
    let rejectText = '驳回';//+this.row.categoryName;
    return {
      size:'large',//树里按钮的尺寸
      isSearch: null,
      treeSearchLoad: false,
      drawingNoList: [],
@@ -766,7 +772,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];
    },
@@ -797,6 +802,15 @@
          this.drawingNoList = drawingNoList;
        });
    },
    refresh(refname){
      this.treeData=[];
      //this.$refs[refname].doLayout();
      this.$refs[refname].refreshTable();
      let curS = this.isSearch;
      this.isSearch = null;
      this.onLoad();
      this.isSearch = !curS
    },
    showLockDlg(row){
      //this.lockForm = row;
      this.lockForm.id = row.id;
@@ -818,7 +832,6 @@
      this.unlockBox = true;
    },
    lockSubmit(row,done) {  
      //console.log(row,done)
      //锁定提交
      this.$confirm('是否锁定', {
        confirmButtonText: '确定',
@@ -826,11 +839,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.unlockBox = false;
            this.lockBox = false;
          } else {
            this.$message({ type: 'error', message: res.data.msg });
          }
@@ -858,6 +870,7 @@
          if (res.data.code == 200) {
            this.$message({ type: 'success', message: '解锁流程已启动!' });
            this.addLocalTreeNode(row.parentId);
            this.unlockBox = false;
          } else {
            this.$message({ type: 'error', message: res.data.msg });
          }
@@ -891,7 +904,6 @@
        done();
        this.todolistModel = false;
      }).catch(error => {
        window.console.log('haha', error);
        done();
      });
      
@@ -974,7 +986,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) {
@@ -987,10 +998,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
@@ -1010,7 +1021,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;
@@ -1312,7 +1322,6 @@
      this.uploadmodalBox = false;
    },
    treeLoad(tree, treeNode, resolve) {
      console.log('tree', tree, treeNode, this.option)
      this.loading = true;
      var obj = { parentId: tree.id }
      
@@ -1400,6 +1409,9 @@
</script>
<style lang="scss">
.treebtn {
   font-size:16px;
}
.norightmenu .avue-crud .avue-crud__header {
  display: none !important;
}