田源
2025-01-16 404966637eda6881a0f17683c5aacc7c1c34aed8
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue
@@ -2,10 +2,10 @@
  <basic-container>
    <avue-crud
      ref="useCrud"
      :table-loading="loading"
      :data="data"
      :option="option"
      :page.sync="page"
      :table-loading="loading"
      @selection-change="selectChange"
      @row-click="rowClickHandler"
      @refresh-change="handleRefresh"
@@ -13,27 +13,46 @@
      @current-change="currentChange"
    >
      <template slot="menuLeft">
        <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">创建
        <el-button v-if="permissionList.addBtn" class="button-custom-icon" plain size="small" type="primary"
                   @click="addClickHandler">
          <icon-show :name="permissionList.addBtn.source"></icon-show>
          创建
        </el-button>
        <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">删除
        <el-button v-if="permissionList.delBtn" class="button-custom-icon" plain size="small" type="danger" @click="delClickHandler">
          <icon-show :name="permissionList.delBtn.source"></icon-show>
          删除
        </el-button>
        <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出
        <el-button v-if="permissionList.viewTheScopeBtn" class="button-custom-icon" plain size="small" type="primary"  @click="checkViewClickHandler">
          <icon-show :name="permissionList.viewTheScopeBtn.source"></icon-show>
          查看使用范围
        </el-button>
        <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">导入
        <el-button v-if="permissionList.importBtn" class="button-custom-icon" plain size="small" type="primary" @click="uploadClickHandler">
          <icon-show :name="permissionList.importBtn.source"></icon-show>
          导入
        </el-button>
        <el-button icon="el-icon-check" plain size="small" type="primary"
                   @click="checkViewClickHandler">查看使用范围
        <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary" @click="exportClickHandler">
          <icon-show :name="permissionList.exportBtn.source"></icon-show>
          导出
        </el-button>
      </template>
      <template slot="menu" slot-scope="{row,index}">
        <el-button icon="el-icon-edit" plain size="small" type="text" @click="editClickHandler(row)">修改
        <el-button v-if="permissionList.editBtn" size="small" type="text"
                   @click="editClickHandler(row)">
          <icon-show :name="permissionList.editBtn.source"></icon-show>
          编辑
        </el-button>
        <el-button icon="el-icon-delete" plain size="small" type="text" @click="delRowClickHandler(row)">删除
        <el-button v-if="permissionList.delBtn" plain size="small" type="text" @click="delRowClickHandler(row)">
          <icon-show :name="permissionList.delBtn.source"></icon-show>
          删除
        </el-button>
      </template>
      <template #icon="{ row }">
        <span class="avue-icon">
          <icon-show :name="row.imagePath"></icon-show>
        </span>
      </template>
    </avue-crud>
    <!-- 新增 修改 -->
@@ -43,10 +62,10 @@
      :visible.sync="visible"
      append-to-body="true"
      class="avue-dialog"
      width="40%"
      width="500px"
      @close="visibleCloseHandler"
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small">
        <el-row>
          <el-col :span="24">
            <el-form-item label="名称:" prop="id">
@@ -59,6 +78,12 @@
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="图标:" prop="imagePath">
              <input-icon v-model="form.imagePath" placeholder="请选择图标">
              </input-icon>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="描述:" prop="description">
              <el-input v-model="form.description" :rows="2" type="textarea"></el-input>
            </el-form-item>
@@ -66,14 +91,14 @@
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
         <el-button @click="visibleCloseHandler">取 消</el-button>
         <el-button type="primary" @click="addSaveHandler">确 定</el-button>
         <el-button size="small" type="primary" @click="addSaveHandler">确 定</el-button>
         <el-button size="small" @click="visibleCloseHandler">取 消</el-button>
        </span>
    </el-dialog>
    <!-- 导入 -->
    <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入"
                 @updata="getTreeList"></upload-file>
                 @updata="getList"></upload-file>
    <!-- 查看使用范围 -->
    <el-dialog
@@ -95,19 +120,19 @@
      </avue-crud>
    </el-dialog>
  </basic-container>
</template>
<script>
import {gridStatus, addSave, editSave, deleteStatus, exportStatus, listUsed} from "@/api/modeling/statusPool/api";
import func from "@/util/func";
import basicOption from "@/util/basic-option";
import {mapGetters} from "vuex";
export default {
  name: "index",
  data() {
    return {
      loading:false,
      loading: false,
      data: [],
      option: {
        ...basicOption,
@@ -120,6 +145,10 @@
            label: '名称',
            prop: 'id',
            sortable: true,
          },
          {
            label: '图标',
            prop: 'icon'
          },
          {
            label: '标签',
@@ -143,6 +172,7 @@
        searchMenuSpan: 8,
        refreshBtn: false,
        selection: false,
        header:false,
        column: [
          {
            label: '名称',
@@ -178,8 +208,8 @@
        ]
      },
      visible: false,
      selectList:[],
      lastIndex:null,
      selectList: [],
      lastIndex: null,
      page: {
        currentPage: 1,
        pageSize: 15,
@@ -188,42 +218,52 @@
      },
    }
  },
  computed:{
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false),
        delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false),
        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
        exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false),
        importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
        viewTheScopeBtn: this.vaildData(this.permission[this.$route.query.id].SEARCH, false),
      };
    },
  },
  created() {
    this.getTreeList();
    this.getList();
  },
  methods: {
    // 左侧树请求
    getTreeList() {
    getList() {
      gridStatus(this.page.currentPage, this.page.pageSize).then(res => {
        const data = res.data.data;
        this.data = data;
        this.page.total = res.data.total;
        this.loading = false;
      }).catch(err => {
        this.$message.error(err)
      });
    },
    // 表格刷新
    handleRefresh(){
      this.getTreeList();
    handleRefresh() {
      this.getList();
    },
    // 表格多选
    selectChange(row){
    selectChange(row) {
      this.selectList = row;
    },
    //  条数
    sizeChange(val) {
      this.page.pageSize = val;
      this.getTreeList();
      this.getList();
    },
    // 页码
    currentChange(val) {
      this.page.currentPage = val;
      this.getTreeList();
      this.getList();
    },
    // 行单选
@@ -232,8 +272,12 @@
        row,
        this.$refs.useCrud,
        this.lastIndex,
        (newIndex) => { this.lastIndex = newIndex; },
        () => { this.selectList = []; }
        (newIndex) => {
          this.lastIndex = newIndex;
        },
        () => {
          this.selectList = [row];
        }
      );
    },
@@ -265,7 +309,7 @@
        deleteStatus(this.selectList).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTreeList();
            this.getList();
          }
        })
      }).catch(() => {
@@ -277,7 +321,7 @@
    },
    // 行单个删除
    delRowClickHandler(row){
    delRowClickHandler(row) {
      this.$confirm('您确定要删除所选择的数据吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
@@ -288,7 +332,7 @@
        deleteStatus(list).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTreeList();
            this.getList();
          }
        })
      }).catch(() => {
@@ -315,18 +359,21 @@
    // 创建或编辑保存
    addSaveHandler() {
      const saveFunction = this.dialogTitle === 'add' ? addSave : editSave;
      saveFunction(this.form).then(res => {
        if (res.data.code === 200) {
          this.$message.success(res.data.obj);
          this.loading = true;
          this.getTreeList();
          this.visible = false;
      this.$refs.form.validate((valid) => {
        if (valid) {
          saveFunction(this.form).then(res => {
            if (res.data.code === 200) {
              this.$message.success(res.data.obj);
              this.loading = true;
              this.getList();
              this.visible = false;
            } else {
              this.$message.error(res.data.obj);
            }
          })
        } else {
          this.$message.error(res.data.obj);
          return false;
        }
      }).catch(error => {
        this.$message.error(error);
      });
    },
@@ -382,7 +429,6 @@
        this.checkViewData = this.checkViewDataSearch;
        return done();
      }
      ;
      this.checkViewData = this.checkViewData.filter(item => {
        return item.name && item.name.includes(name);