yangys
2025-08-24 2a120264875c70aefcb96327918898fda218c2f9
src/views/wel/shemi.vue
@@ -1,5 +1,6 @@
<template>
<template >
  <basic-container>
    <div class="norightmenu">
    <avue-crud
      :addBtn="false"
      :option="option"
@@ -17,7 +18,7 @@
    >
      <template #search>
        <el-row :gutter="24">
          <el-col :span="8" class="search-data-flex">
          <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="试切" />
@@ -25,16 +26,16 @@
              <el-checkbox value="3" label="偏离" />
            </el-checkbox-group>
          </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-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="8" class="search-data-flex">
            <span class="search-data-title">时间范围:</span>
            <el-date-picker v-model="searchTreeData.createTime" type="daterange" range-separator="To" start-placeholder="开始时间" end-placeholder="结束时间" :size="size" format="YYYY-MM-DD" value-format="YYYY-MM-DD" :disabled-date="disabledDate" @change="createTimeChange"/>
            <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="8">
          <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>
@@ -53,12 +54,14 @@
        <!-- <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 != 1" 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 == 1" 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>
  </div>
    <!-- 新增节点 -->
    <el-dialog :title="modalTitle" append-to-body v-model="modalBox">
      <avue-form :option="modalOption" v-model="modalForm" @submit="modalSubmit" @reset-change="modalCancel"/>
@@ -507,6 +510,7 @@
    };
  },
  computed: {
    ...mapGetters(['userInfo', 'permission']),
    uploadmodalOption() {
      return {
        submitText: "保存",
@@ -645,6 +649,7 @@
  },
  methods: {
    disabledDate(time) {
      //不需要禁用日期
      // 获取当前日期
      const today = new Date();
      today.setHours(0, 0, 0, 0); // 设置为当天开始时间
@@ -654,10 +659,11 @@
      threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);
      threeMonthsAgo.setHours(0, 0, 0, 0);
      
      // 禁用今天之后的日期和三个月前的日期之前的日期
      return time.getTime() > today.getTime() || time.getTime() < threeMonthsAgo.getTime();
      // 禁用今天之后的日期 即可
      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];
    },
@@ -834,11 +840,12 @@
    searchTree() {
      if(this.searchTreeData.programStatus.length == 0) return;
      if(this.searchTreeData.drawingNo == "") return;
      this.searchTreeData.status = this.searchTreeData.programStatus.join();
      axios({
        url: '/blade-mdm/program/node/search-list2',
        method: 'get',
        params: this.searchTreeData,
        params: this.searchTreeData
      }).then(res => {
        if(res.data.data.length == 0) return;
        this.option.defaultExpandAll = true;
@@ -1227,9 +1234,30 @@
    },
    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()];
    let defTimeRange = [b,this.getToday()];
    this.searchTreeData.createTime = defTimeRange
    this.createTimeChange(defTimeRange)
    this.tabsOption = this.tabsOption1;
    //获取nodetype
    axios({url: '/blade-system/dict-biz/dictionary?code=nc_node_type',method: 'get'}).then(res => {
@@ -1241,6 +1269,9 @@
</script>
<style lang="scss">
.norightmenu .avue-crud .avue-crud__header {
            display: none !important;
      }
.delFile {
  color: red;
  margin-left: 12px;