管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-01-16 3c0bcd367dbc9aff25202d1a8ec2eb143f3e8261
src/views/datamanage/domainManage.vue
@@ -1,25 +1,32 @@
<template>
  <div class="domainBox">
    <My-bread
      :list="[
    <My-bread :list="[
        `${$t('dataManage.dataManage')}`,
        `${$t('dataManage.rangeManage')}`,
      ]"
    ></My-bread>
      ]"></My-bread>
    <el-divider />
    <div class="mainBox">
      <div class="leftTree">
        <el-tree
          :data="domainData"
          :props="defaultProps"
          :default-expand-all="true"
          @node-click="toggleTabs"
        ></el-tree>
        <div style="width:450px">
          <el-tree
            :data="domainData"
            :props="defaultProps"
            :default-expand-all="true"
            @node-click="toggleTabs"
          ></el-tree>
        </div>
      </div>
      <div class="right">
        <div class="inquire">
          <el-form ref="queryForm" :model="queryForm" :inline="true">
            <el-form-item :label="$t('dataManage.vmobj.keyword')" prop="name">
          <el-form
            ref="queryForm"
            :model="queryForm"
            :inline="true"
          >
            <el-form-item
              :label="$t('dataManage.vmobj.keyword')"
              prop="name"
            >
              <el-input
                v-model="queryForm.code"
                :placeholder="$t('common.pleaseInput')"
@@ -31,31 +38,27 @@
                icon="el-icon-search"
                size="small"
                class="primary"
                >{{ $t('common.iquery') }}</el-button
              >
              >{{ $t('common.iquery') }}</el-button>
              <el-button
                @click="resetInfo('queryForm')"
                icon="el-icon-delete"
                size="small"
                type="info"
                >{{ $t('common.empty') }}</el-button
              >
              >{{ $t('common.empty') }}</el-button>
              <el-button
                v-if="btnStatus.insert"
                @click="showAddDialog"
                icon="el-icon-plus"
                size="small"
                type="success"
                >{{ $t('common.append') }}</el-button
              >
              >{{ $t('common.append') }}</el-button>
              <el-button
                v-if="btnStatus.delete"
                @click="deleteInfo"
                type="danger"
                size="small"
                icon="el-icon-delete"
                >{{ $t('common.delete') }}</el-button
              >
              >{{ $t('common.delete') }}</el-button>
            </el-form-item>
          </el-form>
        </div>
@@ -65,7 +68,10 @@
            @selection-change="handleSelectionChange"
            height="100%"
          >
            <el-table-column type="selection" width="50" />
            <el-table-column
              type="selection"
              width="50"
            />
            <el-table-column
              align="center"
              type="index"
@@ -92,11 +98,11 @@
              prop="codeDesc"
              :label="$t('dataManage.domainManage.codeDesc')"
            />
            <el-table-column
            <!-- <el-table-column
              align="center"
              prop="bsm"
              :label="$t('dataManage.domainManage.bsm')"
            />
            /> -->
            <el-table-column
              align="center"
              prop="level"
@@ -113,26 +119,30 @@
              :label="$t('dataManage.domainManage.bak')"
            />
            <el-table-column min-width="150" :label="$t('common.operate')">
              <template slot-scope="scope"
                ><el-button
            <el-table-column
              min-width="150"
              :label="$t('common.operate')"
            >
              <template slot-scope="scope">
                <el-button
                  class="primary"
                  @click="showDetail(scope.row)"
                  size="small"
                  >{{ $t('common.details') }}</el-button
                >
                >{{ $t('common.details') }}</el-button>
                <el-button
                  v-if="btnStatus.update"
                  type="warning"
                  @click="handleEdit(scope.$index, scope.row)"
                  size="small"
                  >{{ $t('common.update') }}</el-button
                >
                >{{ $t('common.update') }}</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="pagination_box" style="margin-top: 20px">
        <div
          class="pagination_box"
          style="margin-top: 20px"
        >
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
@@ -146,11 +156,20 @@
        </div>
      </div>
    </div>
    <div class="infoBox" v-show="showinfoBox">
    <div
      class="infoBox"
      v-show="showinfoBox"
    >
      <el-card class="box-card">
        <div slot="header" class="clearfix">
        <div
          slot="header"
          class="clearfix"
        >
          <span>{{ $t('common.details') }}</span>
          <div style="float: right; cursor: pointer" @click="closeDetial">
          <div
            style="float: right; cursor: pointer"
            @click="closeDetial"
          >
            <i class="el-icon-close"></i>
          </div>
        </div>
@@ -198,79 +217,136 @@
    <el-dialog
      width="510px"
      top="5vh"
      :title="behavior"
      :title="
        behavior == '新增用户'
          ? `${$t('common.append')}`
          : `${$t('common.update')}`
      "
      :visible.sync="dialogFormVisible"
      :before-close="handleClose"
    >
      <el-form :model="editForm" ref="editForm">
      <el-form
        :model="editForm"
        ref="editForm"
      >
        <el-form-item
          :label="$t('dataManage.domainManage.domName')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="editForm.domName" autocomplete="off"></el-input>
          <el-select
            v-model="editForm.domName"
            placeholder="请选择"
          >
            <el-option
              v-for="item in domainOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
          <!-- <el-input v-model="editForm.domName" autocomplete="off"></el-input> -->
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.domainManage.domDesc')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="editForm.domDesc" autocomplete="off"></el-input>
          <el-input
            v-model="editForm.domDesc"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.domainManage.domCode')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="editForm.domCode" autocomplete="off"></el-input>
          <el-input
            v-model="editForm.domCode"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.domainManage.codeDesc')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="editForm.codeDesc" autocomplete="off"></el-input>
          <el-input
            v-model="editForm.codeDesc"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.domainManage.bsm')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="editForm.bsm" autocomplete="off"></el-input>
          <el-input
            v-model="editForm.bsm"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.domainManage.level')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="editForm.level" autocomplete="off"></el-input>
          <el-input
            v-model="editForm.level"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.domainManage.orderid')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="editForm.orderid" autocomplete="off"></el-input>
          <el-input
            v-model="editForm.orderid"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('dataManage.domainManage.bak')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="editForm.bak" autocomplete="off"></el-input>
          <el-input
            v-model="editForm.bak"
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>
      <div v-if="behavior == '修改信息'" slot="footer" class="dialog-footer">
        <el-button @click="cancelEdit()">重置</el-button>
      <div
        v-if="behavior == '修改信息'"
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          size="medium"
          type="primary"
          size="small"
          @click="cancelEdit()"
        >{{ $t('common.reset') }}</el-button>
        <el-button
          size="small"
          class="primary"
          type="info"
          @click="sendEdit('editForm')"
          v-loading.fullscreen.lock="fullscreenLoading"
          >{{ $t('common.confirm') }}</el-button
        >
        >{{ $t('common.confirm') }}</el-button>
      </div>
      <div v-else slot="footer" class="dialog-footer">
        <el-button @click="cancelAdd('editForm')">重置</el-button>
      <div
        v-else
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          size="medium"
          type="primary"
          type="info"
          size="small"
          @click="cancelAdd('editForm')"
        >{{
          $t('common.reset')
        }}</el-button>
        <el-button
          size="small"
          class="primary"
          @click="sendAdd('editForm')"
          v-loading.fullscreen.lock="fullscreenLoading"
          >{{ $t('common.confirm') }}</el-button
        >
        >{{ $t('common.confirm') }}</el-button>
      </div>
    </el-dialog>
  </div>
@@ -283,6 +359,7 @@
  insertDomain,
  deleteDomain,
  updateDomain,
  domain_selectDomainNames,
} from '../../api/api';
import MyBread from '../../components/MyBread.vue';
export default {
@@ -290,6 +367,7 @@
  components: { MyBread },
  data() {
    return {
      domainOptions: [],
      multipleSelection: [],
      behavior: '',
      formLabelWidth: '100px',
@@ -297,7 +375,9 @@
      showinfoBox: false,
      fullscreenLoading: false,
      itemdetail: {},
      editForm: {},
      editForm: {
        domName: '',
      },
      queryForm: {
        code: '',
      },
@@ -323,17 +403,17 @@
      },
      domainData: [
        {
          tabDesc: '基础数据',
          val: '基础数据',
          children: [],
        },
        {
          tabDesc: '业务数据',
          val: '业务数据',
          children: [],
        },
      ],
      defaultProps: {
        children: 'children',
        label: 'tabDesc',
        label: 'val',
      },
    };
  },
@@ -347,15 +427,37 @@
    },
  },
  methods: {
    toggleTabs(data) {
    async toggleTabs(data) {
      this.fullscreenLoading = true;
      this.listData.ns = data.ns;
      this.listData.tab = data.tab;
      this.listData.pageIndex = 1;
      this.listData.pageSize = 10;
      const res = await domain_selectDomainNames(data);
      if (res.code != 200) {
        this.$message.error('domain调用失败');
      }
      var std = [];
      for (var i = 0; i < res.result.length; i++) {
        std.push({
          value: res.result[i],
          label: res.result[i],
        });
      }
      this.domainOptions = std;
      this.editForm.domName = res.result[0];
      getSingleTab(this.listData).then((res) => {
        setTimeout(() => {
          this.tableData = res.result;
          this.count = res.count;
          this.fullscreenLoading = false;
          if (res.code == 200) {
            this.tableData = res.result;
            this.count = res.count;
            this.fullscreenLoading = false;
          } else {
            this.tableData = [];
            this.count = 0;
            this.fullscreenLoading = false;
          }
        }, 500);
      });
    },
@@ -370,6 +472,12 @@
      getDomainTabs().then((res) => {
        let bdres = res.result.filter((item) => item.ns == 'bd');
        let bsres = res.result.filter((item) => item.ns == 'bs');
        for (var i in bdres) {
          bdres[i].val = bdres[i].tabDesc + '(' + bdres[i].tab + ')';
        }
        for (var i in bsres) {
          bsres[i].val = bsres[i].tabDesc + '(' + bsres[i].tab + ')';
        }
        this.domainData[0].children = bdres;
        this.domainData[1].children = bsres;
      });
@@ -380,7 +488,7 @@
    queryInfo() {
      let searchData = {
        code: this.queryForm.code,
        name: this.queryForm.code,
        ns: this.listData.ns,
        tab: this.listData.tab,
        pageIndex: this.listData.pageIndex,
@@ -392,7 +500,6 @@
          this.tableData = res.result;
          this.count = res.count;
        } else {
          console.log('查询接口报错');
          this.$notify.error({
            title: res.code,
            message: res.result,
@@ -404,7 +511,9 @@
      this.queryForm = {};
      this.$store.state.verCateNode = {};
      this.$bus.$emit('clearTressLabel', true);
      this.getAllTabelData();
      this.listData.pageIndex = 1;
      this.listData.pageSize = 10;
      this.queryInfo();
    },
    // 删除多条
    deleteInfo() {
@@ -460,8 +569,8 @@
    sendAdd(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          // console.log(this.editForm);
          this.fullscreenLoading = true;
          insertDomain(this.editForm)
            .then((res) => {
              setTimeout(() => {
@@ -484,7 +593,7 @@
              }, 500);
            })
            .catch((res) => {
              alert('修改失败,请重试!');
              alert('添加失败,请重试!');
              this.fullscreenLoading = false;
            });
        } else {
@@ -499,7 +608,7 @@
          this.editForm = {};
          done();
        })
        .catch((_) => {});
        .catch((_) => { });
    },
    // 查看界面
    showDetail(row) {
@@ -593,7 +702,7 @@
  watch: {
    pathId: {
      immediate: true,
      handler(val) {},
      handler(val) { },
    },
  },
};
@@ -601,9 +710,9 @@
<style lang="less" scoped>
//@import url(); 引入公共css类
.domainBox {
  height: 80%;
  width: 97%;
  position: absolute;
  height: 98%;
  width: 98%;
  padding: 1%;
  .mainBox {
    width: 100%;
    height: 92%;
@@ -611,7 +720,7 @@
    justify-content: space-between;
    .leftTree {
      width: 15%;
      height: 96%;
      height: 91%;
      border: 1px solid white;
      border-radius: 5px;
      padding: 1%;
@@ -620,7 +729,7 @@
    }
    .right {
      width: 80%;
      height: 96%;
      height: 91%;
      border: 1px solid white;
      border-radius: 5px;
      padding: 1%;