lrf 3 years ago
parent
commit
6f5e8c6def

+ 7 - 6
java代码/ruoyi-ui/src/store/index.js

@@ -6,10 +6,10 @@ import tagsView from './modules/tagsView'
 import permission from './modules/permission'
 import settings from './modules/settings'
 import getters from './getters'
-import role_relation from "./role_relation";
+import role_relation from './role_relation'
+import template from './template'
 
-
-Vue.use(Vuex);
+Vue.use(Vuex)
 
 const store = new Vuex.Store({
   modules: {
@@ -18,11 +18,12 @@ const store = new Vuex.Store({
     tagsView,
     permission,
     settings,
-    role_relation
+    role_relation,
+    template
   },
   getters,
-  name:false
+  name: false
   // this.store.name =
-});
+})
 
 export default store

+ 40 - 0
java代码/ruoyi-ui/src/store/template.js

@@ -0,0 +1,40 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+import _ from 'lodash'
+Vue.use(Vuex)
+const api = {
+  interface: `/labelAchievement/api/template`
+}
+const state = () => ({})
+const mutations = {}
+
+const actions = {
+  async query({ commit }, { skip = 0, limit = null, ...info } = {}) {
+    const res = await this.$axios.$get(api.interface, { skip, limit, ...info })
+    return res
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}`, payload)
+    return res
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.interface}/${payload}`)
+    return res
+  },
+  async update({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.interface}/${id}`, {
+      ...info
+    })
+    return res
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.interface}/${payload}`)
+    return res
+  }
+}
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions
+}

+ 72 - 70
java代码/ruoyi-ui/src/views/merits/setting/index.vue

@@ -4,9 +4,9 @@
       <el-col :span="24" class="main">
         <el-col :span="24" class="one">
           <el-form
-            :model="queryParams"
-            ref="queryForm"
             v-show="showSearch"
+            ref="queryForm"
+            :model="queryParams"
             :inline="true"
           >
             <el-form-item label="角色名称" prop="roleName">
@@ -25,11 +25,12 @@
                 icon="el-icon-search"
                 size="mini"
                 @click="handleQuery"
-                >搜索</el-button
-              >
-              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
-                >重置</el-button
-              >
+              >搜索</el-button>
+              <el-button
+                icon="el-icon-refresh"
+                size="mini"
+                @click="resetQuery"
+              >重置</el-button>
             </el-form-item>
           </el-form>
         </el-col>
@@ -58,13 +59,12 @@
             >
               <template slot-scope="scope">
                 <el-button
+                  v-hasPermi="['system:role:relation']"
                   size="mini"
                   type="text"
                   icon="el-icon-refresh-right"
                   @click="toRelation(scope.row)"
-                  v-hasPermi="['system:role:relation']"
-                  >账号等级关联</el-button
-                >
+                >账号等级关联</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -86,10 +86,10 @@
     >
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
         <el-form-item label="角色名称">
-          <el-input v-model="form.roleName" disabled></el-input>
+          <el-input v-model="form.roleName" disabled />
         </el-form-item>
         <el-form-item label="权限字符">
-          <el-input v-model="form.roleKey" disabled></el-input>
+          <el-input v-model="form.roleKey" disabled />
         </el-form-item>
         <el-form-item label="账号等级" prop="level">
           <el-radio-group v-model="form.level">
@@ -99,9 +99,11 @@
           </el-radio-group>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" size="mini" @click="onSubmit('form')"
-            >保存</el-button
-          >
+          <el-button
+            type="primary"
+            size="mini"
+            @click="onSubmit('form')"
+          >保存</el-button>
         </el-form-item>
       </el-form>
     </el-dialog>
@@ -109,14 +111,14 @@
 </template>
 
 <script>
-import { mapState, mapGetters, createNamespacedHelpers } from "vuex";
-import { listRole } from "@/api/system/role";
-const { mapActions: role_relation } = createNamespacedHelpers("role_relation");
+import { mapState, mapGetters, createNamespacedHelpers } from 'vuex'
+import { listRole } from '@/api/system/role'
+const { mapActions: role_relation } = createNamespacedHelpers('role_relation')
 export default {
-  name: "index",
-  props: {},
+  name: 'Index',
   components: {},
-  data: function () {
+  props: {},
+  data: function() {
     return {
       // 遮罩层
       loading: true,
@@ -130,105 +132,105 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        roleName: undefined,
+        roleName: undefined
       },
-      dialog: { title: "账号关联", show: false },
+      dialog: { title: '账号关联', show: false },
       // 账号关联
       form: {},
       rules: {
         level: [
-          { required: true, message: "请选择账号等级", trigger: "change" },
-        ],
-      },
-    };
+          { required: true, message: '请选择账号等级', trigger: 'change' }
+        ]
+      }
+    }
   },
   created() {
-    this.getList();
-    this.getDicts("sys_normal_disable").then((response) => {
-      this.statusOptions = response.data;
-    });
+    this.getList()
+    this.getDicts('sys_normal_disable').then((response) => {
+      this.statusOptions = response.data
+    })
   },
   methods: {
-    ...role_relation(["query", "update"]),
+    ...role_relation(['query', 'update']),
     /** 查询角色列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
         (response) => {
-          this.roleList = response.rows;
-          this.total = response.total;
-          this.loading = false;
+          this.roleList = response.rows
+          this.total = response.total
+          this.loading = false
         }
-      );
+      )
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+      this.queryParams.pageNum = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.dateRange = [];
-      this.resetForm("queryForm");
-      this.handleQuery();
+      this.dateRange = []
+      this.resetForm('queryForm')
+      this.handleQuery()
     },
     // 账号等级关联
     async toRelation(data) {
       // 查询该角色关联信息
-      let res = await this.query();
+      const res = await this.query()
       if (this.$checkRes(res)) {
-        let arr = {
+        const arr = {
           id: res.data.id,
           roleName: data.roleName,
-          roleKey: data.roleKey,
-        };
-        let relation = res.data.relation.find((i) => i.role == data.roleKey);
-        if (relation) arr.level = relation.level;
-        this.$set(this, `form`, arr);
-        this.dialog = { title: "账号关联", show: true };
+          roleKey: data.roleKey
+        }
+        const relation = res.data.relation.find((i) => i.role == data.roleKey)
+        if (relation) arr.level = relation.level
+        this.$set(this, `form`, arr)
+        this.dialog = { title: '账号关联', show: true }
       }
     },
     // 保存
     onSubmit(formName) {
-      this.$refs[formName].validate(async (valid) => {
+      this.$refs[formName].validate(async(valid) => {
         if (valid) {
-          let data = {
+          const data = {
             id: this.form.id,
-            relation: [{ role: this.form.roleKey, level: this.form.level }],
-          };
-          let res = await this.update(data);
+            relation: [{ role: this.form.roleKey, level: this.form.level }]
+          }
+          const res = await this.update(data)
           if (res.code === 200) {
-            this.$message({ type: `success`, message: res.msg });
-            this.toClose();
+            this.$message({ type: `success`, message: res.msg })
+            this.toClose()
           } else {
-            this.$message({ type: `error`, message: res.msg });
+            this.$message({ type: `error`, message: res.msg })
           }
         } else {
-          console.log("error submit!!");
-          return false;
+          console.log('error submit!!')
+          return false
         }
-      });
+      })
     },
     // 账号关联关闭
     toClose() {
-      this.dialog = { title: "账号关联", show: false };
-      this.getList();
-    },
+      this.dialog = { title: '账号关联', show: false }
+      this.getList()
+    }
   },
   computed: {
-    ...mapGetters(["roles"]),
+    ...mapGetters(['roles'])
   },
   metaInfo() {
-    return { title: this.$route.meta.title };
+    return { title: this.$route.meta.title }
   },
   watch: {
     test: {
       deep: true,
       immediate: true,
-      handler(val) {},
-    },
-  },
-};
+      handler(val) {}
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>

+ 29 - 0
java代码/ruoyi-ui/src/views/merits/template/index.vue

@@ -0,0 +1,29 @@
+<template>
+  <div id="index">
+    <template v-if="view==='list'">
+      <list-view />
+    </template>
+    <template v-else>
+      detail
+    </template>
+  </div>
+</template>
+
+<script>
+import listView from './parts/list.vue'
+import { mapState, createNamespacedHelpers } from 'vuex'
+export default {
+  name: 'Index',
+  components: { listView },
+  props: {},
+  data: function() {
+    return {
+      view: 'list'
+    }
+  },
+  created() {},
+  methods: {}
+}
+</script>
+
+<style lang="less" scoped></style>

+ 35 - 0
java代码/ruoyi-ui/src/views/merits/template/parts/list.vue

@@ -0,0 +1,35 @@
+<template>
+  <div id="list">
+    <el-row style="padding:20px">
+      <el-col :span="24">
+        <el-table :data="list" border>
+          <el-table-column align="center" label="模板名称" prop="title" />
+          <el-table-column align="center" label="是否启用" prop="is_use" />
+          <el-table-column align="center" label="操作" prop="opera" />
+        </el-table>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex'
+const { mapActions } = createNamespacedHelpers('template')
+export default {
+  name: 'List',
+  components: {},
+  props: {},
+  data: function() {
+    return {
+      list: []
+    }
+  },
+  created() {},
+  methods: {
+    ...mapActions(['query', 'delete']),
+    async search() {}
+  }
+}
+</script>
+
+<style lang="less" scoped></style>