管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2022-11-24 a7199e5a4f3e34b14d395e319a552c5c3b8b3a4d
src/views/datamanage/styleManage.vue
@@ -19,7 +19,7 @@
          <el-button
            @click="submitForm('ruleForm')"
            icon="el-icon-search"
            type="primary"
            class="primary"
            size="small"
            >{{ $t('common.iquery') }}</el-button
          >
@@ -31,7 +31,7 @@
            >{{ $t('common.empty') }}</el-button
          >
          <el-button  v-if="btnStatus.insert"
            @click="InsertFormdialog = true"
            @click="setInsertShow()"
            icon="el-icon-edit"
            type="success"
            size="small"
@@ -106,38 +106,6 @@
              prop="descr"
              :label="$t('dataManage.styleObj.descr')"
            />
            <!-- <el-table-column
              align="center"
              prop="fileGuid"
              :label="$t('dataManage.styleObj.fileguid')"
            />
            <el-table-column
              align="center"
              prop="viewGuid"
              :label="$t('dataManage.styleObj.viewguid')"
            />
            <el-table-column
              align="center"
              prop="createUser"
              :label="$t('dataManage.styleObj.createUser')"
            />
            <el-table-column
              align="center"
              prop="createTime"
              :label="$t('dataManage.styleObj.createTime')"
              :formatter="formatTime"
            />
            <el-table-column
              align="center"
              prop="updateUser"
              :label="$t('dataManage.styleObj.updateUser')"
            />
            <el-table-column
              align="center"
              prop="updateTime"
              :label="$t('dataManage.styleObj.updateTime')"
              :formatter="formatTime"
            /> -->
            <el-table-column
              align="center"
              prop="bak"
@@ -267,7 +235,7 @@
      </el-card>
    </div>
    <el-dialog
      title="修改详情"
      :title="$t('dataManage.styleObj.modifyStyleData')"
      top="2vh"
      style="overflow: hidden"
      :before-close="removeUpdate"
@@ -290,7 +258,13 @@
          :label="$t('dataManage.styleObj.dirid')"
          :label-width="formLabelWidth"
        >
          <el-input
         <el-cascader
              v-model="upform.dirid"
              :options="editcatalogOption"
              @change="catalogChange"
              :props="cascader" style="width:730px"
            ></el-cascader>
          <!-- <el-input
            v-model="upform.dirValue"
            disabled
            autocomplete="off"
@@ -300,13 +274,20 @@
            @click="showDirTree(1)"
            style="margin-left: 10px"
            ><i class="el-icon-plus"></i
          ></el-link>
          ></el-link> -->
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.styleObj.depid')"
          :label-width="formLabelWidth"
        >
          <el-input
          <el-cascader
              v-model="upform.depid"
              :options="editCompanyOption"
              @change="editcompanyChange"
              :props="cascader"
              style="width:730px"
            ></el-cascader>
          <!-- <el-input
            v-model="upform.depValue"
            disabled
            autocomplete="off"
@@ -316,7 +297,7 @@
            @click="showDepTree(1)"
            style="margin-left: 10px"
            ><i class="el-icon-plus"></i
          ></el-link>
          ></el-link> -->
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.styleObj.ver')"
@@ -421,8 +402,8 @@
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="removeUpdate">{{$t('common.close')}}</el-button>
        <el-button type="primary" @click="updateForm">{{$t('common.confirm')}}</el-button>
        <el-button type="info" @click="removeUpdate">{{$t('common.close')}}</el-button>
        <el-button class="primary" @click="updateForm">{{$t('common.confirm')}}</el-button>
      </div>
    </el-dialog>
    <el-dialog
@@ -430,6 +411,7 @@
      top="2vh"
      style="overflow: hidden"
      :visible.sync="InsertFormdialog"
      :before-close="handleClose"
    >
      <el-form :model="insertform">
        <el-form-item
@@ -448,7 +430,14 @@
          :label="$t('dataManage.styleObj.dirid')"
          :label-width="formLabelWidth"
        >
          <el-input
        <el-cascader
              v-model="insertform.dirid"
              :options="catalogOption"
              @change="catalogChange"
              :props="cascader"
              style="width:730px"
            ></el-cascader>
          <!-- <el-input
            v-model="insertform.dirValue"
            disabled
            autocomplete="off"
@@ -458,13 +447,20 @@
            @click="showDirTree(0)"
            style="margin-left: 10px"
            ><i class="el-icon-plus"></i
          ></el-link>
          ></el-link> -->
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.styleObj.depid')"
          :label-width="formLabelWidth"
        >
          <el-input
          <el-cascader
              v-model="insertform.depid"
              :options="companyOption"
              @change="companyChange"
              :props="cascader"
              style="width:730px"
            ></el-cascader>
          <!-- <el-input
            v-model="insertform.depValue"
            disabled
            autocomplete="off"
@@ -474,7 +470,7 @@
            @click="showDepTree(0)"
            style="margin-left: 10px"
            ><i class="el-icon-plus"></i
          ></el-link>
          ></el-link> -->
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.styleObj.ver')"
@@ -580,8 +576,8 @@
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="insertFromDataClose">{{$t('common.close')}}</el-button>
        <el-button type="primary" @click="insertFromData">{{$t('common.confirm')}}</el-button>
        <el-button type="info" @click="insertFromDataClose">{{$t('common.close')}}</el-button>
        <el-button  class="primary" @click="insertFromData">{{$t('common.confirm')}}</el-button>
      </div>
    </el-dialog>
    <div class="leftTree" v-if="showDirCata">
@@ -589,10 +585,10 @@
        <style-dir-tree></style-dir-tree>
      </div>
      <div class="btnBox">
        <el-button type="primary" size="small" @click="selectDirCataName">{{
        <el-button class="primary" size="small" @click="selectDirCataName">{{
          $t('common.confirm')
        }}</el-button>
        <el-button type="primary" size="small" @click="showDirCata = false">{{
        <el-button type="info" size="small" @click="showDirCata = false">{{
          $t('common.close')
        }}</el-button>
      </div>
@@ -602,10 +598,10 @@
        <style-dep-tree></style-dep-tree>
      </div>
      <div class="btnBox">
        <el-button type="primary" size="small" @click="selectDepCataName">{{
        <el-button class="primary" size="small" @click="selectDepCataName">{{
          $t('common.confirm')
        }}</el-button>
        <el-button type="primary" size="small" @click="showDepCata = false">{{
        <el-button type="info" size="small" @click="showDepCata = false">{{
          $t('common.close')
        }}</el-button>
      </div>
@@ -626,6 +622,8 @@
  deleteStyles,
  updateStyle,
  upload_style,
  queryDepTree,
  selectdirTab
} from "../../api/api";
export default {
  name: "styleManage",
@@ -672,11 +670,24 @@
        insert: false,
        update: false,
      },
      companyOption:[],
      catalogOption:[],
      editCompanyOption:[],
      editcatalogOption:[],
       cascader: {
        label: 'name',
        value: 'id',
        children: 'children',
        checkStrictly: true,
        emitPath: false,
      },
    };
  },
  created() {
    this.getRoleTabelData();
    this.showPermsBtn();
     this.getQueryDepTree();this.getSelectdirTab();
  },
  methods: {
    showPermsBtn() {
@@ -687,10 +698,13 @@
        .map((item) => (this.btnStatus[item.tag.substr(1)] = true));
    },
    filesReset() {
      document.getElementById("insertFile").reset();
      document.getElementById("insertimageFile").reset();
      this.guidFile = null;
      this.fileGuid = null;
      // document.getElementById("insertFile").reset();
      // document.getElementById("insertimageFile").reset();
         document.getElementById("insertFile").value = "";
            document.getElementById("insertimageFile").value = "";
      this.guidFile = '';
      this.fileGuid = '';
    },
    getInsertFile(res) {
      if (res == 0) {
@@ -882,8 +896,19 @@
    },
    insertFromDataClose() {
      this.InsertFormdialog = false;
      this.insertform = {};
       this.insertform= {
        fileGuid: null,
        viewGuid: null,
      }
      this.filesReset();
    },
    handleClose(){
     this.InsertFormdialog = false;
     this.insertform= {
        fileGuid: null,
        viewGuid: null,
      }
        this.filesReset();
    },
    async insertFromData() {
      if (this.insertform.dirid == null || this.insertform.depid == null) {
@@ -902,8 +927,10 @@
      const data = await insertStyle(this.insertform);
      if (data.code == 200) {
        this.InsertFormdialog = false;
        this.insertform = {};
     this.insertform= {
        fileGuid: null,
        viewGuid: null,
      }
        this.filesReset();
        this.$message({
          message: "添加成功!",
@@ -1107,7 +1134,7 @@
      this.upflag = false;
      this.dialogFormVisible = false;
      this.upform = {};
      this.filesReset();
      // this.filesReset();
    },
    submitForm(formName) {
      this.getRoleTabelData();
@@ -1144,6 +1171,7 @@
    },
    handleEdit(index, row) {
      this.upflag = true;
      this.dialogFormVisible = true;
      this.upform = row;
@@ -1175,6 +1203,56 @@
        "",
        "height=800, width=1500, top=150, left=350, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"
      );
    },
     catalogChange(res) {
      this.insertform.dirid = res;
      this.upform.dirid =res;
    },
    editcompanyChange(res){
this.upform.depid = res;
    },
    companyChange(res){
        this.insertform.depid = res;
    },
    //新增数据
    setInsertShow(){
this.InsertFormdialog = true;
    },
    //目录列表获取
    async getSelectdirTab() {
      const res = await selectdirTab();
      if (res.code != 200) {
        this.$message.error('目录列表获取失败');
        return;
      }
      this.insertform.dirid = 1;
      this.upform.dirid = 1;
 this.catalogOption = this.treeData(res.result);
 this.editcatalogOption= this.treeData(res.result);
    },
      //单位列表获取
    async getQueryDepTree() {
      const res = await queryDepTree();
      if (res.code != 200) {
        this.$message.error('单位列表获取失败');
        return;
      }
      this.insertform.depid = 1;
            this.upform.depid = 1;
      this.companyOption = this.treeData(res.result);
      this.editCompanyOption= this.treeData(res.result);
    },
    //树列表生成
    treeData(source) {
      let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆
      return cloneData.filter((father) => {
        // 循环所有项
        let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
        branchArr.length > 0 ? (father.children = branchArr) : ''; // 给父级添加一个children属性,并赋值
        return father.pid == 0; // 返回一级菜单
      });
    },
  },
};
@@ -1212,7 +1290,7 @@
    left: 800px;
    width: 400px;
    height: 600px;
    background: #f0f2f5;
    background: #303030;
    border: 1px solid #000;
    .treeBox {
      height: 550px;
@@ -1302,13 +1380,14 @@
  }
  .infoBox {
    width: 500px;
    border: 1px solid #eee;
    position: absolute;
    z-index: 100;
    top: 15%;
    right: 25%;
    background-color: #fff;
    background-color: #303030;
    .el-card {
      color: white;
      background-color: transparent;
      span {
        font-size: 16px;
@@ -1317,7 +1396,7 @@
    }
    .contentBox {
      margin: 0 aotu 10px;
      height: 600px;
      height: 500px;
      overflow: auto;
      p {
        // background-color: #bfa;
@@ -1416,7 +1495,11 @@
  /deep/.el-cascader .el-input__inner {
    border-color: #fff !important;
  }
  .primary {
    background: #409eff;
    border: #409eff;
    color: white;
  }
}
</style>