From be06498ac750b1ef7bb7e5bc4a9f080e0bb7ff95 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 13 十月 2023 16:44:26 +0800
Subject: [PATCH] 相似项查重规则-表格数据渲染已经增删改查

---
 Source/UBCS-WEB/src/api/code/codeMatch.js |   43 ++++++++
 Source/UBCS-WEB/src/views/code/Match.vue  |  214 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 257 insertions(+), 0 deletions(-)

diff --git a/Source/UBCS-WEB/src/api/code/codeMatch.js b/Source/UBCS-WEB/src/api/code/codeMatch.js
new file mode 100644
index 0000000..475e7ed
--- /dev/null
+++ b/Source/UBCS-WEB/src/api/code/codeMatch.js
@@ -0,0 +1,43 @@
+import request from '@/router/axios';
+
+//鍒嗛〉
+export const getList = (page, limit) => {
+  return request({
+    url: '/api/ubcs-code/resembleRuleController/gridCodeResembleRule',
+    method: 'get',
+    params: {
+      page,
+      limit
+    }
+  })
+}
+
+//娣诲姞
+export const add = (row) => {
+  return request({
+    url: '/api/ubcs-code/resembleRuleController/addSave',
+    method: 'post',
+    data:row
+  })
+}
+
+//淇敼
+export const editSave = (row) => {
+  return request({
+    url: '/api/ubcs-code/resembleRuleController/editSave',
+    method: 'put',
+    data:row
+  })
+}
+
+//鍒犻櫎
+export const deleteData = (row) => {
+  const formData = new FormData();
+  formData.append('oid', row.oid);
+  formData.append('ts', row.ts);
+  return request({
+    url: '/api/ubcs-code/resembleRuleController/deleteData',
+    method: 'delete',
+    data:formData
+  })
+}
diff --git a/Source/UBCS-WEB/src/views/code/Match.vue b/Source/UBCS-WEB/src/views/code/Match.vue
new file mode 100644
index 0000000..c81ff91
--- /dev/null
+++ b/Source/UBCS-WEB/src/views/code/Match.vue
@@ -0,0 +1,214 @@
+<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">
+  </avue-crud>
+</basic-container>
+</template>
+
+<script>
+import {getList,add,editSave,deleteData} from "@/api/code/codeMatch";
+export default {
+name: "Match",
+  data(){
+    return{
+      option:{
+        height:700,
+        calcHeight: 80,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        columnBtn:false,
+        border: true,
+        index: true,
+        selection: true,
+        dialogClickModal: false,
+        highlightCurrentRow: true,
+        column: [
+          {
+            label: "缂栧彿",
+            prop: "id",
+            labelWidth: 100,
+            rules: [{
+              required: true,
+              message: "璇疯緭鍏ョ紪鍙�",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "鍚嶇О",
+            prop: "name",
+            rules: [{
+              required: true,
+              message: "璇疯緭鍏ュ悕绉�",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "蹇界暐鍏ㄩ儴绌烘牸",
+            prop: "ignoreallspaceflag",
+            labelWidth: 100,
+            type: 'switch',
+            dicData: [{
+              label: '鍚�',
+              value: 'false'
+            }, {
+              label: '鏄�',
+              value: 'true'
+            }],
+            formatter:function(row){
+              return row.ignoreallspaceflag ==='true' ? '鏄�' : '鍚�'
+            }
+          },
+          {
+            label: "蹇界暐澶у皬鍐�",
+            prop: "ignorecaseflag",
+            type: 'switch',
+            dicData: [{
+              label: '鍚�',
+              value: 'false'
+            }, {
+              label: '鏄�',
+              value: 'true'
+            }],
+            formatter:function(row){
+              return row.ignorecaseflag ==='true' ? '鏄�' : '鍚�'
+            }
+          },
+          {
+            label: "蹇界暐绌烘牸",
+            prop: "ignorespaceflag",
+            type: 'switch',
+            labelWidth: 100,
+            dicData: [{
+              label: '鍚�',
+              value: 'false'
+            }, {
+              label: '鏄�',
+              value: 'true'
+            }],
+            formatter:function(row){
+              return row.ignorespaceflag ==='true' ? '鏄�' : '鍚�'
+            }
+          },
+          {
+            label: "蹇界暐鍏ㄥ崐瑙�",
+            prop: "ignorewidthflag",
+            type: 'switch',
+            dicData: [{
+              label: '鍚�',
+              value: 'false'
+            }, {
+              label: '鏄�',
+              value: 'true'
+            }],
+            formatter:function(row){
+              return row.ignorewidthflag ==='true' ? '鏄�' : '鍚�'
+            }
+          },
+          {
+            label: "蹇界暐杩炴帴瀛楃",
+            prop: "linkCharacter",
+            type: 'textarea',
+            labelWidth: 100,
+            span:24
+
+          }
+        ]
+      },
+      loading:true,
+      data:[],
+      form:{},
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+   }
+  },
+  created() {
+    this.onLoad()
+  },
+  methods:{
+    rowDel(row){
+      this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          return deleteData(row);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛!"
+          });
+        });
+    },
+    rowUpdate(row, index, done, loading){
+      console.log(row)
+      editSave(row).then(() => {
+        this.onLoad(this.page);
+        this.$message({
+          type: "success",
+          message: "鎿嶄綔鎴愬姛!"
+        });
+        done();
+      }, error => {
+        loading();
+        console.log(error);
+      });
+    },
+    rowSave(row, done, loading) {
+      add(row).then(() => {
+        this.onLoad(this.page);
+        this.$message({
+          type: "success",
+          message: "鎿嶄綔鎴愬姛!"
+        });
+        done();
+      }, error => {
+        window.console.log(error);
+        loading();
+      });
+    },
+    selectionChange(row){
+      console.log(row)
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      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;
+        this.loading = false;
+      })
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

--
Gitblit v1.9.3