管道基础大数据平台系统开发-【前端】-新系統界面
王旭
2023-02-20 fda6fcfc6598c4349d486ca71d57c74e33043d76
src/views/datamanage/styleManage.vue
@@ -5,34 +5,27 @@
        `${$t('dataManage.styleManage')}`,
      ]"></My-bread>
    <el-divider />
    <div class="searchComp subpage_Div">
    <div class="searchComp subpage_Div"  ref="container">
      <el-form
        ref="ruleForm"
        :model="ruleForm"
        :inline="true"
      >
        <el-form-item
       <div class="flex_box">
          <div style="margin-right: auto">
 <el-form-item
          :label="$t('dataManage.vmobj.keyword')"
          prop="name"
        >
          <el-input
            v-model="ruleForm.name"
            :placeholder="$t('common.pleaseInput')"
            style="width:200px"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            @click="submitForm('ruleForm')"
            icon="el-icon-search"
            type="primary"
            size="small"
          >{{ $t('common.iquery') }}</el-button>
          <el-button
            @click="resetForm('ruleForm')"
            icon="el-icon-refresh"
            type="info"
            size="small"
          >{{ $t('common.empty') }}</el-button>
          </div>
          <div>
 <el-form-item>
          <el-button
            v-if="btnStatus.insert"
            @click="setInsertShow()"
@@ -47,16 +40,31 @@
            type="danger"
            size="small"
          >{{ $t('common.delete') }}</el-button>
          <el-button
            @click="submitForm('ruleForm')"
            icon="el-icon-search"
            type="primary"
            size="small"
          >{{ $t('common.iquery') }}</el-button>
          <el-button
            @click="resetForm('ruleForm')"
            icon="el-icon-refresh"
            type="info"
            size="small"
          >{{ $t('common.empty') }}</el-button>
        </el-form-item>
          </div>
       </div>
      </el-form>
    </div>
    <div class="bottom">
      <div class="rightTable">
        <div class="table_box">
        <div class="table_box"  :style="styleVar">
          <el-table
            :data="tableData"
            style="width: 100%"
            height="100%"
            height="calc(100% - 57px)"
            @selection-change="handleSelectionChange"
          >
            <el-table-column
@@ -140,9 +148,7 @@
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div
          style="margin-top: 20px; margin-left: 400px"
             <div
          class="pagination_box"
        >
          <el-pagination
@@ -156,8 +162,9 @@
          >
          </el-pagination>
        </div>
      </div>
    </div>
        </div>
    <div
      class="infoBox subpage_Div box_div"
      v-show="showinfoBox"
@@ -216,7 +223,7 @@
        <el-divider></el-divider>
        <p>
          <label> {{ $t('dataManage.styleObj.fileguid') }}:</label>
          <label class="boxlabel">{{ itemdetail.fileGuid }}</label>
          <label class="boxlabel">{{ itemdetail.fname }}</label>
        </p>
        <el-divider></el-divider>
        <p>
@@ -729,7 +736,7 @@
          <div class="BoxFlex">
            <div class="BoxFlexinput">
              <el-input
                v-model="insertform.fileGuid"
                v-model="insertFileGuid"
                disabled
                autocomplete="off"
                style="width:100%"
@@ -742,7 +749,7 @@
                id="insertFile"
                multiple="multiple"
                style="display: none"
                @change="insertFile(0)"
                @change="insertFileData(0)"
              />
              <el-button
                style="margin-left: 6px;"
@@ -780,7 +787,7 @@
          <div class="BoxFlex">
            <div class="BoxFlexinput">
              <el-input
                v-model="insertform.viewGuid"
                v-model="insertViewGuid"
                disabled
                autocomplete="off"
                style="width:100%"
@@ -793,7 +800,7 @@
                id="insertimageFile"
                multiple="multiple"
                style="display: none"
                @change="insertFile(1)"
                @change="insertFileData(1)"
              />
              <el-button
                style="margin-left: 6px;"
@@ -915,13 +922,19 @@
  updateStyle,
  upload_style,
  queryDepTree,
  selectdirTab
  selectdirTab,
} from "../../api/api";
export default {
  name: "styleManage",
  components: { MyBread, styleDirTree, styleDepTree },
  data() {
    return {
      insertFileGuid: "",
      insertViewGuid: "",
      insertFileName: "",
      insertViewName: "",
      insertform: {},
      dialogFormVisible: false,
      InsertFormdialog: false,
      showCata: false,
@@ -940,10 +953,7 @@
      showDirCata: false,
      showDepCata: false,
      tableData: [],
      insertform: {
        fileGuid: null,
        viewGuid: null,
      },
      dirFlag: null,
      depFlag: null,
      guidFile: null,
@@ -968,9 +978,9 @@
      editCompanyOption: [],
      editcatalogOption: [],
      cascader: {
        label: 'name',
        value: 'id',
        children: 'children',
        label: "name",
        value: "id",
        children: "children",
        checkStrictly: true,
        emitPath: false,
      },
@@ -978,17 +988,44 @@
        children: "children",
        label: "name",
      },
      selectOptionWidth: '',
      selectheight: 'auto',
      defaultexpand: false
      selectOptionWidth: "",
      selectheight: "auto",
      defaultexpand: false,
      tableHeight: 0,
      timer: 0,
      styleVar: {
        height: "calc(100% - 109px)",
      },
    };
  },
  created() {
    this.getRoleTabelData();
    this.showPermsBtn();
    this.getQueryDepTree(); this.getSelectdirTab();
    this.getQueryDepTree();
    this.getSelectdirTab();
  },
  beforeDestroy() {
    this.timer && clearTimeout(this.timer);
    window.removeEventListener("resize", this.onResize);
  },
  mounted() {
    window.addEventListener("resize", this.onResize);
    this.calHeight();
  },
  methods: {
    onResize() {
      this.timer && clearTimeout(this.timer);
      this.timer = setTimeout(() => {
        this.calHeight();
      }, 500);
    },
    calHeight() {
      this.$nextTick(() => {
        const rect = this.$refs.container.getBoundingClientRect();
        this.tableHeight = `${rect.height + 97}px`;
        this.styleVar["height"] = `calc(100% - ${rect.height + 97}px)`;
      });
    },
    showPermsBtn() {
      let currentPerms = this.$store.state.currentPerms;
      let permsEntity = this.$store.state.permsEntity;
@@ -1002,8 +1039,8 @@
      document.getElementById("insertFile").value = "";
      document.getElementById("insertimageFile").value = "";
      this.guidFile = '';
      this.fileGuid = '';
      this.guidFile = "";
      this.fileGuid = "";
    },
    getInsertFile(res) {
      if (res == 0) {
@@ -1012,15 +1049,17 @@
        $("#insertimageFile").click();
      }
    },
    insertFile(res) {
    insertFileData: function (res) {
      if (res == 0) {
        var val = document.getElementById("insertFile").files;
        if (!val || !val.length) return;
        this.insertform.fileGuid = val[0].name;
        let val = document.getElementById("insertFile").files;
        this.insertFileGuid = val[0].name;
        this.insertFileName = val[0].name;
      } else if (res == 1) {
        var val = document.getElementById("insertimageFile").files;
        if (!val || !val.length) return;
        this.insertform.viewGuid = val[0].name;
        let val = document.getElementById("insertimageFile").files;
        this.insertViewGuid = val[0].name;
        this.insertViewName = val[0].name;
      }
    },
    async setinsertFile(res) {
@@ -1145,30 +1184,32 @@
      for (var i in this.multipleSelection) {
        std.push(this.multipleSelection[i].id);
      }
      this.$confirm('此操作将永久删除该样式, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        const data = await deleteStyles({ ids: std.toString() });
        if (data.code == 200) {
      this.$confirm("此操作将永久删除该样式, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const data = await deleteStyles({ ids: std.toString() });
          if (data.code == 200) {
            this.$message({
              message: "删除成功!",
              type: "success",
            });
            this.getRoleTabelData();
          } else {
            this.$message({
              message: "删除失败!",
              type: "warning",
            });
          }
        })
        .catch(() => {
          this.$message({
            message: "删除成功!",
            type: "success",
            type: "info",
            message: "已取消删除",
          });
          this.getRoleTabelData();
        } else {
          this.$message({
            message: "删除失败!",
            type: "warning",
          });
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    showDirTree(res) {
      this.dirFlag = res;
@@ -1207,10 +1248,9 @@
    },
    insertFromDataClose() {
      this.InsertFormdialog = false;
      this.insertform = {
        fileGuid: null,
        viewGuid: null,
      }
      this.insertform = {};
      this.insertFileGuid = "";
      this.insertViewGuid = "";
      this.filesReset();
    },
    handleClose() {
@@ -1218,7 +1258,7 @@
      this.insertform = {
        fileGuid: null,
        viewGuid: null,
      }
      };
      this.filesReset();
    },
    async insertFromData() {
@@ -1231,17 +1271,22 @@
      }
      if (this.guidFile != null) {
        this.insertform.fileGuid = this.guidFile;
        this.insertform.fname = this.insertFileName;
      }
      if (this.viewFile != null) {
        this.insertform.viewGuid = this.viewFile;
        this.insertform.vname = this.insertViewName;
      }
      const data = await insertStyle(this.insertform);
      if (data.code == 200) {
        this.InsertFormdialog = false;
        this.insertform = {
          fileGuid: null,
          viewGuid: null,
        }
        };
        this.insertFileGuid = "";
        this.insertViewGuid = "";
        this.filesReset();
        this.$message({
          message: "添加成功!",
@@ -1261,6 +1306,7 @@
      }
      this.listData.name = this.ruleForm.name;
      const data = await select_Style_ByPageAndCount(this.listData);
      if (data.code != 200) {
        this.$message.error("列表调用失败");
      }
@@ -1307,7 +1353,7 @@
      if (!val || !val.length) return;
      var formData = new FormData();
      formData.append("file0", val[0]);
      var res = $.ajax(+ "/style/upload", {
      var res = $.ajax(+"/style/upload", {
        type: "post",
        data: formData,
        async: false,
@@ -1419,9 +1465,11 @@
        this.upform.status = this.statusFormat(this.upform.status);
      }
      if (this.guidFile != null) {
        this.upform.fname = this.upform.fileGuid;
        this.upform.fileGuid = this.guidFile;
      }
      if (this.viewFile != null) {
        this.upform.vname = this.upform.viewGuid;
        this.upform.viewGuid = this.viewFile;
      }
      const data = await updateStyle(this.upform);
@@ -1466,6 +1514,7 @@
    showDetail(index, row) {
      var token = getToken();
      this.showinfoBox = true;
      this.itemdetail = row;
      this.itemdetail.createTime = this.formomentTime(
        this.itemdetail.createTime
@@ -1482,12 +1531,13 @@
    },
    handleEdit(index, row) {
      this.upflag = true;
      this.dialogFormVisible = true;
      this.upform = row;
      this.upform.depValue = row.depName;
      this.upform.dirValue = row.dirName;
      this.upform.fileGuid = row.fname;
      this.upform.viewGuid = row.vname;
      this.upform.status = this.forMontStatus(row.status);
    },
    handleDelete(index, row) {
@@ -1504,7 +1554,7 @@
          });
          this.startFromData();
        })
        .catch(() => { });
        .catch(() => {});
    },
    // 获取多选
@@ -1518,16 +1568,15 @@
    catalogChange(res) {
      this.insertform.dirid = res;
      this.upform.dirid = res;
    },
    handcatalogChange(data, node, nodeData) {
      this.$set(this.insertform, 'dirid', data.id)
      this.$set(this.insertform, 'dirName', data.name)
      this.$set(this.insertform, "dirid", data.id);
      this.$set(this.insertform, "dirName", data.name);
      // this.insertform.dirid = data.id;
      // this.insertform.dirName = data.name
    },
    handleNodeClickto(data, node, nodeData) {
      this.insertform.depid = data.id
      this.insertform.depid = data.id;
      this.upform.dirid = data.id;
      this.upform.dirName = data.name;
    },
@@ -1537,24 +1586,23 @@
    },
    companyChange(res) {
      this.insertform.depid = res;
    },
    handcompanyChange(data, node, nodeData) {
      this.$set(this.insertform, 'depid', data.id)
      this.$set(this.insertform, "depid", data.id);
      // this.insertform.depid = data.id;
      this.$set(this.insertform, 'depName', data.name)
      this.$set(this.insertform, "depName", data.name);
      // this.insertform.depName = data.name;
    },
    //新增数据
    setInsertShow() {
      this.InsertFormdialog = true;
      this.$set(this, 'insertform', {})
      this.$set(this, "insertform", {});
    },
    //目录列表获取
    async getSelectdirTab() {
      const res = await selectdirTab();
      if (res.code != 200) {
        this.$message.error('目录列表获取失败');
        this.$message.error("目录列表获取失败");
        return;
      }
      this.insertform.dirid = 1;
@@ -1566,7 +1614,7 @@
    async getQueryDepTree() {
      const res = await queryDepTree();
      if (res.code != 200) {
        this.$message.error('单位列表获取失败');
        this.$message.error("单位列表获取失败");
        return;
      }
      this.insertform.depid = 1;
@@ -1575,7 +1623,7 @@
      this.editCompanyOption = this.treeData(res.result);
    },
    handleNodeClick(data, node, nodeData) {
      this.upform.depid = data.id
      this.upform.depid = data.id;
      this.upform.depName = data.name;
    },
    //树列表生成
@@ -1584,16 +1632,16 @@
      return cloneData.filter((father) => {
        // 循环所有项
        let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
        branchArr.length > 0 ? (father.children = branchArr) : ''; // 给父级添加一个children属性,并赋值
        branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值
        return father.pid == 0; // 返回一级菜单
      });
    },
    setOptionWidth(event) {
      // 下拉框聚焦,设置弹框的宽度
      this.$nextTick(() => {
        this.selectOptionWidth = event.srcElement.offsetWidth + 'px';
        this.selectOptionWidth = event.srcElement.offsetWidth + "px";
      });
    }
    },
  },
};
</script>
@@ -1609,16 +1657,18 @@
  }
  .searchComp {
    margin: 10px auto;
    padding: 8px;
    margin-top: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    .el-form-item {
      margin: 5px;
    }
    .el-input {
      width: 467px;
    }
    // .el-input {
    //   width: 467px;
    // }
  }
  .leftTree {
    position: absolute;
@@ -1638,20 +1688,7 @@
      margin: 10px auto 0;
    }
  }
  .bottom {
    width: 100%;
    height: 85%;
    .rightTable {
      height: 100%;
      width: 100%;
      .table_box {
        width: 100%;
        height: 80%;
        margin: 0 auto;
        overflow: auto;
      }
    }
  }
  .BoxFlex {
    display: flex;
    justify-content: space-around;