XiaoRuby
2023-08-28 8231542d77a49f80a49434be6ca8bfb3ae9e1efe
src/views/standardLibrary/index.vue
@@ -25,7 +25,11 @@
        <div class="table-header">
          <div class="serve-btn">
            <span class="tipMsg">{{ msg !== "" ? msg : "" }}</span>
            <el-select v-model="versionValue" @change="changeSelect" placeholder="请选择版本号">
            <el-select
              v-model="versionValue"
              @change="changeSelect"
              placeholder="请选择版本号"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
@@ -34,7 +38,9 @@
                >
              </el-option>
            </el-select>
            <el-button type="primary" @click="addVersionFun">新增版本号</el-button>
            <el-button type="primary" @click="addVersionFun"
              >新增版本号</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-plus"
@@ -172,7 +178,7 @@
  deleteListApi,
  blurUpdateApi,
  getVersion,
  addVersion
  addVersion,
} from "@/api/standardLibrary";
import { selectproductModelApi } from "@/api/basicData/index";
@@ -180,7 +186,7 @@
  data() {
    return {
      options:[],
      versionValue: '',
      versionValue: "",
      deleteList: [],
      msg: "",
      isAllSelect: false,
@@ -213,21 +219,21 @@
  created() {
    this.getStandardTree();
  },
  mounted(){
  },
  mounted() {},
  methods: {
    async initSelect(){
        this.options = [];
        this.versionValue = "";
        const response = await getVersion({"specificationsId":this.selectData.id});
      const response = await getVersion({
        specificationsId: this.selectData.id,
      });
        if(response.code===200 && response.data.length>0){
          this.getTableByClick(this.selectData,response.data[0])
        this.getTableByClick(this.selectData, response.data[0]);
          for(let i=0;i<response.data.length;i++){
            this.options.push({
              value: response.data[i],
              label: "V" + response.data[i]
            })
            label: "V" + response.data[i],
          });
            this.versionValue = response.data[0];
          }
        }
@@ -237,23 +243,25 @@
      this.getTableByClick(this.selectData,this.versionValue);
    },
    async insertVersion(){
      const resp = await addVersion({"specificationsId":this.selectData.id});
      const resp = await addVersion({ specificationsId: this.selectData.id });
      if(resp.code===200){
        this.initSelect();
        this.$message({
            type: 'success',
            message: resp.message
          type: "success",
          message: resp.message,
          });
      }
    },
     addVersionFun() {
        this.$confirm('确认添加新的版本号吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
      this.$confirm("确认添加新的版本号吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.insertVersion();
        }).catch(() => {});
        })
        .catch(() => {});
    },
    filterNode(value, data) {
      if (!value) return true;
@@ -327,7 +335,7 @@
    async getTableByClick(data,versionVal) {
      await getProductList({
        specificationsId: data.id,
        version: versionVal
        version: versionVal,
      }).then((res) => {
        res.data.forEach((i) => {
          if (i.name === undefined) {
@@ -349,10 +357,9 @@
      this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`);
    },
    renderContent(h, { node, data, store }) {
      // console.log('data', data)
      // console.log('node', node)
      // 判断是否是父节点或文件夹
      const isFolder = "children" in data;
      console.log(`output->data`, isFolder);
      return (
        <span class="tree-node">
          {isFolder ? (
@@ -499,13 +506,13 @@
      });
    },
    handleSelectionChange(val) {
      this.deleteList = []
      this.deleteList = [];
      val.forEach((v) => {
        if(v.id !== undefined){
          this.deleteList.push(v.id)
          this.deleteList.push(v.id);
        }
      })
      console.log(`output->this.deleteList`,this.deleteList)
      });
      console.log(`output->this.deleteList`, this.deleteList);
    },
    // 表格树全部选中配置  结束
    deleteListClick() {