田源
2025-03-05 f6b61a485501f326debe52d77ea65d87fb34b37f
Source/UBCS-WEB/src/views/code/Match.vue
@@ -1,106 +1,112 @@
<template>
<basic-container>
  <avue-crud :option="option"
             :table-loading="loading"
             :data="data"
             ref="crud"
             v-model="form"
             :page.sync="page"
             @row-del="rowDel"
             @row-update="rowUpdate"
             @row-save="rowSave"
             @selection-change="selectionChange"
             @current-change="currentChange"
             @size-change="sizeChange"
             @refresh-change="refreshChange"
             @on-load="onLoad">
    <template slot="menuLeft">
      <el-button type="primary"
                 size="small"
                 icon="el-icon-search"
                 plain @click="searchHandler">查 询
      </el-button>
      <advanced-query :options="options" :visible.sync="findvisible"
                      @echoContion="echoContion"></advanced-query>
      <el-button type="danger"
                 size="small"
                 icon="el-icon-delete"
                 plain @click="deleteHandler">删 除
      </el-button>
      <el-button type="success"
                 size="small"
                 icon="el-icon-edit"
                 plain>修 改
      </el-button>
      <el-button type="primary"
                 size="small"
                 icon="el-icon-refresh-right"
                 plain>刷 新
      </el-button>
    </template>
  </avue-crud>
</basic-container>
  <basic-container>
    <avue-crud ref="crud"
               v-model="form"
               :data="data"
               :option="option"
               :page.sync="page"
               :table-loading="loading"
               :permission="permissionList"
               @row-del="rowDel"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft" slot-scope="scope">
        <el-button icon="el-icon-search"
                   plain
                   size="small"
                   v-if="permissionList.search"
                   type="primary" @click="searchHandler">查 询
        </el-button>
        <advanced-query :options="options" :visible.sync="findvisible"
                        @echoContion="echoContion"></advanced-query>
        <el-button icon="el-icon-delete"
                   plain
                   size="small"
                   v-if="permissionList.delBtn"
                   type="danger" @click="deleteHandler">删 除
        </el-button>
        <el-button icon="el-icon-edit"
                   plain
                   size="small"
                   v-if="permissionList.editBtn"
                   type="success" @click="editHandler">修 改
        </el-button>
        <el-button icon="el-icon-refresh-right"
                   plain
                   size="small"
                   v-if="permissionList.breakBtn"
                   type="primary" @click="onLoad">刷 新
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
import {getList,add,editSave,deleteData} from "@/api/code/codeMatch";
import {getList, add, editSave, deleteData} from "@/api/code/codeMatch";
import {mapGetters} from "vuex";
export default {
name: "Match",
  data(){
    return{
  name: "Match",
  data() {
    return {
      options: [
        {
          fieid:'id',
          title:'编号',
          fieldType:'text',
          queryField:'id'
          fieid: 'id',
          title: '编号',
          fieldType: 'text',
          queryField: 'id'
        },
        {
          fieid:'name',
          title:'名称',
          fieldType:'text',
          queryField:'name'
          fieid: 'name',
          title: '名称',
          fieldType: 'text',
          queryField: 'name'
        },
        {
          fieid:'ignoreallspaceflag',
          title:'忽略全部空格',
          fieldType:'truefalse',
          queryField:'ignoreallspaceflag'
          fieid: 'ignoreallspaceflag',
          title: '忽略全部空格',
          fieldType: 'truefalse',
          queryField: 'ignoreallspaceflag'
        },
        {
          fieid:'ignorecaseflag',
          title:'忽略大小写',
          fieldType:'truefalse',
          queryField:'ignorecaseflag'
          fieid: 'ignorecaseflag',
          title: '忽略大小写',
          fieldType: 'truefalse',
          queryField: 'ignorecaseflag'
        },
        {
          fieid:'ignorespaceflag',
          title:'忽略空格',
          fieldType:'truefalse',
          queryField:'ignorespaceflag'
          fieid: 'ignorespaceflag',
          title: '忽略空格',
          fieldType: 'truefalse',
          queryField: 'ignorespaceflag'
        },
        {
          fieid:'ignorewidthflag',
          title:'忽略全半角',
          fieldType:'truefalse',
          queryField:'ignorewidthflag'
          fieid: 'ignorewidthflag',
          title: '忽略全半角',
          fieldType: 'truefalse',
          queryField: 'ignorewidthflag'
        },
        {
          fieid:'linkCharacter',
          title:'忽略连接字符',
          fieldType:'text',
          queryField:'linkCharacter'
          fieid: 'linkCharacter',
          title: '忽略连接字符',
          fieldType: 'text',
          queryField: 'linkCharacter'
        },
      ],
      findvisible:false,
      selectRow:[],
      option:{
        height:700,
        calcHeight: 80,
      findvisible: false,
      selectRow: [],
      option: {
        height: 'auto',
        calcHeight: 20,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        columnBtn:false,
        columnBtn: false,
        border: true,
        index: true,
        selection: true,
@@ -138,8 +144,8 @@
              label: '是',
              value: 'true'
            }],
            formatter:function(row){
              return row.ignoreallspaceflag ==='true' ? '是' : '否'
            formatter: function (row) {
              return row.ignoreallspaceflag === 'true' ? '是' : '否'
            }
          },
          {
@@ -153,8 +159,8 @@
              label: '是',
              value: 'true'
            }],
            formatter:function(row){
              return row.ignorecaseflag ==='true' ? '是' : '否'
            formatter: function (row) {
              return row.ignorecaseflag === 'true' ? '是' : '否'
            }
          },
          {
@@ -169,8 +175,8 @@
              label: '是',
              value: 'true'
            }],
            formatter:function(row){
              return row.ignorespaceflag ==='true' ? '是' : '否'
            formatter: function (row) {
              return row.ignorespaceflag === 'true' ? '是' : '否'
            }
          },
          {
@@ -184,8 +190,8 @@
              label: '是',
              value: 'true'
            }],
            formatter:function(row){
              return row.ignorewidthflag ==='true' ? '是' : '否'
            formatter: function (row) {
              return row.ignorewidthflag === 'true' ? '是' : '否'
            }
          },
          {
@@ -193,54 +199,91 @@
            prop: "linkCharacter",
            type: 'textarea',
            labelWidth: 100,
            span:24
            span: 24
          }
        ]
      },
      loading:true,
      data:[],
      form:{},
      loading: true,
      data: [],
      form: {},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
   }
    }
  },
  created() {
    this.onLoad()
  },
  methods:{
    searchHandler(){
      this.findvisible=true;
    },
    echoContion(row){
    },
    deleteHandler(){
      if(this.selectRow.length <= 0){
        this.$message.warning('请选择一条数据')
      }else {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            const Obj = [...this.selectRow];
            return deleteData(item);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
  computed:{
    ...mapGetters(["permission"]),
    permissionList(){
      return{
        search:this.vaildData(this.permission.match.math_search,false),
        delBtn:this.vaildData(this.permission.match.math_delete,false),
        addBtn:this.vaildData(this.permission.match.math_add,false),
        editBtn:this.vaildData(this.permission.match.math_edit,false),
        breakBtn:this.vaildData(this.permission.match.math_break,false),
      }
    },
    rowDel(row){
  },
  methods: {
    searchHandler() {
      this.findvisible = true;
    },
    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() {
      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(() => {
          return deleteData(this.selectRow[0])
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            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("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
@@ -257,7 +300,7 @@
          });
        });
    },
    rowUpdate(row, index, done, loading){
    rowUpdate(row, index, done, loading) {
      console.log(row)
      editSave(row).then(() => {
        this.onLoad(this.page);
@@ -284,9 +327,9 @@
        loading();
      });
    },
    selectionChange(row){
      console.log(row)
      this.selectRow=row;
    selectionChange(row) {
      // console.log(row)
      this.selectRow = row;
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
@@ -295,15 +338,18 @@
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad( this.page.currentPage,this.page.pageSize);
      this.onLoad(this.page.currentPage, this.page.pageSize);
    },
    onLoad(page){
      getList( this.page.currentPage,this.page.pageSize).then(res=>{
        this.page.total = res.data.total;
        this.data = res.data.data;
    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>