xiejun
2023-10-16 5ac5fd23fe42935d00ea1fd24417e4309e312999
Source/UBCS-WEB/src/views/code/Match.vue
@@ -1,11 +1,11 @@
<template>
<basic-container>
  <avue-crud :option="option"
             :table-loading="loading"
             :data="data"
             ref="crud"
    <avue-crud ref="crud"
             v-model="form"
               :data="data"
               :option="option"
             :page.sync="page"
               :table-loading="loading"
             @row-del="rowDel"
             @row-update="rowUpdate"
             @row-save="rowSave"
@@ -14,28 +14,28 @@
             @size-change="sizeChange"
             @refresh-change="refreshChange"
             @on-load="onLoad">
    <template slot="menuLeft">
      <el-button type="primary"
      <template slot="menuLeft" slot-scope="scope">
        <el-button icon="el-icon-search"
                   plain
                 size="small"
                 icon="el-icon-search"
                 plain @click="searchHandler">查 询
                   type="primary" @click="searchHandler">查 询
      </el-button>
      <advanced-query :options="options" :visible.sync="findvisible"
                      @echoContion="echoContion"></advanced-query>
      <el-button type="danger"
        <el-button icon="el-icon-delete"
                   plain
                 size="small"
                 icon="el-icon-delete"
                 plain @click="deleteHandler">删 除
                   type="danger" @click="deleteHandler">删 除
      </el-button>
      <el-button type="success"
        <el-button icon="el-icon-edit"
                   plain
                 size="small"
                 icon="el-icon-edit"
                 plain>修 改
                   type="success" @click="editHandler">修 改
      </el-button>
      <el-button type="primary"
        <el-button icon="el-icon-refresh-right"
                   plain
                 size="small"
                 icon="el-icon-refresh-right"
                 plain>刷 新
                   type="primary" @click="onLoad">刷 新
      </el-button>
    </template>
  </avue-crud>
@@ -44,6 +44,7 @@
<script>
import {getList,add,editSave,deleteData} from "@/api/code/codeMatch";
export default {
name: "Match",
  data(){
@@ -215,21 +216,34 @@
    searchHandler(){
      this.findvisible=true;
    },
    echoContion(row){
    echoContion(val) {
      console.log(...val)
      // FindData({
      //   templateOid: this.templateOid,
      //   codeClassifyOid: this.codeClassifyOid,
      //   ...val,
      // }).then((res) => {
      //   this.tableData = res.data.data;
      //   this.page.total = res.data.total
      // });
    },
    deleteHandler(){
      if(this.selectRow.length <= 0){
        this.$message.warning('请选择一条数据')
      }else {
      const length = this.selectRow.length;
      if (length > 1) {
        this.$message.warning('只能选择一条数据!');
        return;
      }
      if (length <= 0) {
        this.$message.warning('请选择一条数据! ');
        return;
      }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            const Obj = [...this.selectRow];
            return deleteData(item);
          return deleteData(this.selectRow[0])
          })
          .then(() => {
            this.onLoad(this.page);
@@ -238,7 +252,19 @@
              message: "操作成功!"
            });
          });
    },
    editHandler() {
      const length = this.selectRow.length;
      if (length > 1) {
        this.$message.warning('只能选择一条数据!');
        return;
      }
      if (length <= 0) {
        this.$message.warning('请选择一条数据! ');
        return;
      }
      this.$refs.crud.rowEdit(this.selectRow[0]);
    },
    rowDel(row){
      this.$confirm("确定将选择数据删除?", {
@@ -285,7 +311,7 @@
      });
    },
    selectionChange(row){
      console.log(row)
      // console.log(row)
      this.selectRow=row;
    },
    currentChange(currentPage) {
@@ -298,12 +324,15 @@
      this.onLoad( this.page.currentPage,this.page.pageSize);
    },
    onLoad(page){
      this.loading = true;
      getList( this.page.currentPage,this.page.pageSize).then(res=>{
        if (res.data && res.data.data.length > 0) {
        this.page.total = res.data.total;
        this.data = res.data.data;
        }
        this.loading = false;
      })
    },
      });
    }
  }
}
</script>