فهرست منبع

Merge branch 'master' of http://git.cc-lotus.info/laboratory/ruoyi-project

lrf 3 سال پیش
والد
کامیت
928273acba

+ 2 - 1
java代码/ruoyi-ui/src/store/index.js

@@ -7,8 +7,8 @@ import permission from './modules/permission'
 import settings from './modules/settings'
 import getters from './getters'
 import role_relation from './role_relation'
+import merits_user from './merits_user'
 import template from './template'
-
 Vue.use(Vuex)
 
 const store = new Vuex.Store({
@@ -19,6 +19,7 @@ const store = new Vuex.Store({
     permission,
     settings,
     role_relation,
+    merits_user,
     template
   },
   getters,

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

@@ -0,0 +1,40 @@
+import Vue from "vue";
+import Vuex from "vuex";
+import _ from "lodash";
+Vue.use(Vuex);
+const api = {
+  interface: `/labelAchievement/api/user`,
+};
+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,
+};

+ 330 - 0
java代码/ruoyi-ui/src/views/merits/account/index.vue

@@ -0,0 +1,330 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <!-- <el-form
+            :model="queryParams"
+            ref="queryForm"
+            :inline="true"
+            v-show="showSearch"
+            label-width="68px"
+          >
+            <el-form-item label="用户名称" prop="userName">
+              <el-input
+                v-model="queryParams.userName"
+                placeholder="请输入用户名称"
+                clearable
+                size="small"
+                style="width: 240px"
+                @keyup.enter.native="handleQuery"
+              />
+            </el-form-item>
+            <el-form-item label="手机号码" prop="phonenumber">
+              <el-input
+                v-model="queryParams.phonenumber"
+                placeholder="请输入手机号码"
+                clearable
+                size="small"
+                style="width: 240px"
+                @keyup.enter.native="handleQuery"
+              />
+            </el-form-item>
+            <el-form-item>
+              <el-button
+                type="primary"
+                icon="el-icon-search"
+                size="mini"
+                @click="handleQuery"
+                >搜索</el-button
+              >
+              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
+                >重置</el-button
+              >
+            </el-form-item>
+          </el-form> -->
+        </el-col>
+        <el-col :span="24" class="two">
+          <el-col :span="24" class="two_1">
+            <el-button
+              type="primary"
+              plain
+              icon="el-icon-plus"
+              size="mini"
+              @click="handleAdd"
+              >新增</el-button
+            >
+          </el-col>
+          <el-col :span="24" class="two_2">
+            <el-table
+              :data="list"
+              border
+              style="width: 100%"
+              :header-cell-style="{ 'text-align': 'center' }"
+              :cell-style="{ 'text-align': 'center' }"
+            >
+              <el-table-column
+                prop="userName"
+                label="用户名称"
+                show-overflow-tooltip
+              >
+              </el-table-column>
+              <el-table-column
+                prop="nickName"
+                label="用户昵称"
+                show-overflow-tooltip
+              >
+              </el-table-column>
+              <el-table-column
+                prop="phonenumber"
+                label="手机号码"
+                show-overflow-tooltip
+              >
+              </el-table-column>
+              <el-table-column label="操作">
+                <template slot-scope="scope">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-edit"
+                    @click="toEdit(scope.row)"
+                    >修改</el-button
+                  >
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-delete"
+                    @click="toDel(scope.row)"
+                    >删除</el-button
+                  >
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-key"
+                    @click="toPwd(scope.row)"
+                    >重置</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-col :span="24" class="page">
+              <el-pagination
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="currentPage"
+                :page-sizes="[10, 20, 30, 50]"
+                :page-size="limit"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="total"
+                background
+              >
+              </el-pagination>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+    <el-dialog
+      :title="dialog.title"
+      :visible.sync="dialog.show"
+      width="40%"
+      :before-close="toClose"
+      :close-on-click-modal="false"
+      custom-class="dialog"
+    >
+      <div class="info">
+        <form-1 :form="form" @onSubmit="onSubmit" @resetForm="toClose"></form-1>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  listUser,
+  getUser,
+  delUser,
+  addUser,
+  updateUser,
+  exportUser,
+  resetUserPwd,
+  changeUserStatus,
+  importTemplate,
+} from "@/api/system/user";
+import form1 from "./parts/form-1.vue";
+import { mapState, mapGetters, createNamespacedHelpers } from "vuex";
+const { mapActions: merits_user } = createNamespacedHelpers("merits_user");
+export default {
+  name: "index",
+  props: {},
+  components: { form1 },
+  data: function () {
+    return {
+      // 显示搜索条件
+      showSearch: true,
+      // 查询
+      queryParams: {},
+      // 列表
+      list: [],
+      total: 0,
+      dialog: { title: "新增用户", show: false },
+      // 添加
+      form: { status: "0" },
+      // 默认密码
+      initPassword: undefined,
+      // 分页
+      currentPage: 1,
+      limit: 10,
+    };
+  },
+  created() {
+    this.getList();
+    this.getConfigKey("sys.user.initPassword").then((response) => {
+      this.initPassword = response.msg;
+    });
+  },
+  methods: {
+    ...merits_user(["query", "create", "delete"]),
+    async getList({ skip = 0, limit = this.limit, ...info } = {}) {
+      info.superior_id = this.user_id;
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 修改信息
+    toEdit(row) {
+      this.$set(this, `form`, row);
+      this.dialog = { title: "修改信息", show: true };
+    },
+    // 删除信息
+    async toDel(row) {
+      const userIds = row.userId || this.ids;
+      this.$confirm("是否确认删除数据项吗?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return delUser(userIds);
+        })
+        .then(async () => {
+          let res = await this.delete(userIds);
+          if (this.$checkRes(res)) {
+            this.handleQuery();
+            this.msgSuccess("删除成功");
+          }
+        })
+        .catch(() => {});
+    },
+    // 重置密码
+    toPwd(row) {
+      this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+      })
+        .then(({ value }) => {
+          resetUserPwd(row.userId, value).then((response) => {
+            this.msgSuccess("修改成功,新密码是:" + value);
+          });
+        })
+        .catch(() => {});
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 新增
+    handleAdd() {
+      this.form.password = this.initPassword;
+      this.dialog = { title: "新增用户", show: true };
+    },
+    // 提交
+    onSubmit({ data }) {
+      if (data && data.userId) {
+        delete data.createTime;
+        delete data.updateTime;
+        updateUser(data).then((response) => {
+          this.msgSuccess("修改成功");
+          this.toClose();
+          this.getList();
+        });
+      } else {
+        addUser(data).then((response) => {
+          if (response.code === 200) {
+            listUser(this.addDateRange({ userName: data.userName })).then(
+              async (res) => {
+                let p1 = res.rows.find((i) => i.userName === data.userName);
+                if (p1) {
+                  let p2 = { user_id: p1.userId, superior_id: this.user_id };
+                  let p3 = await this.create(p2);
+                  if (this.$checkRes(p3)) {
+                    this.msgSuccess("新增成功");
+                    this.toClose();
+                    this.getList();
+                  }
+                }
+              }
+            );
+          }
+        });
+      }
+    },
+    // 关闭
+    toClose() {
+      this.form = { status: "0" };
+      this.dialog = { title: "新增用户", show: false };
+    },
+    // 分页
+    handleSizeChange(val) {
+      this.$set(this, `limit`, val);
+      this.getList();
+    },
+    handleCurrentChange(val) {
+      this.getList({ skip: (val - 1) * this.limit });
+    },
+  },
+
+  computed: {
+    ...mapGetters(["user_id"]),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.main {
+  padding: 25px 30px 30px;
+  .two {
+    .two_1 {
+      margin: 0 0 10px 0;
+    }
+  }
+}
+.page {
+  text-align: right;
+  margin: 10px 0 0 0;
+}
+.dialog {
+  .info {
+    height: 430;
+    overflow-y: auto;
+  }
+}
+</style>

+ 251 - 0
java代码/ruoyi-ui/src/views/merits/account/parts/form-1.vue

@@ -0,0 +1,251 @@
+<template>
+  <div id="form-1">
+    <el-form :model="form" :rules="rules" ref="form" label-width="100px">
+      <el-col :span="12">
+        <el-form-item label="用户昵称" prop="nickName">
+          <el-input
+            v-model="form.nickName"
+            placeholder="请输入用户昵称"
+          ></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="归属部门" prop="deptId">
+          <treeselect
+            v-model="form.deptId"
+            :options="deptOptions"
+            :show-count="true"
+            placeholder="请选择归属部门"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="手机号码" prop="phonenumber">
+          <el-input
+            v-model="form.phonenumber"
+            placeholder="请输入手机号码"
+            maxlength="11"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="邮箱" prop="email">
+          <el-input
+            v-model="form.email"
+            placeholder="请输入邮箱"
+            maxlength="50"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item
+          v-if="form.userId == undefined"
+          label="用户名称"
+          prop="userName"
+        >
+          <el-input v-model="form.userName" placeholder="请输入用户名称" />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item
+          v-if="form.userId == undefined"
+          label="用户密码"
+          prop="password"
+        >
+          <el-input
+            v-model="form.password"
+            placeholder="请输入用户密码"
+            type="password"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="用户性别">
+          <el-select v-model="form.sex" placeholder="请选择">
+            <el-option
+              v-for="dict in sexOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+              >{{ dict.dictLabel }}</el-radio
+            >
+          </el-radio-group>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="岗位">
+          <el-select v-model="form.postIds" multiple placeholder="请选择">
+            <el-option
+              v-for="item in postOptions"
+              :key="item.postId"
+              :label="item.postName"
+              :value="item.postId"
+              :disabled="item.status == 1"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="角色">
+          <el-select v-model="form.roleIds" multiple placeholder="请选择">
+            <el-option
+              v-for="item in roleOptions"
+              :key="item.roleId"
+              :label="item.roleName"
+              :value="item.roleId"
+              :disabled="item.status == 1"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24">
+        <el-form-item label="备注">
+          <el-input
+            v-model="form.remark"
+            type="textarea"
+            placeholder="请输入内容"
+          ></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24" class="btn">
+        <el-button type="primary" @click="onSubmit('form')">确定</el-button>
+        <el-button @click="resetForm('form')">取消</el-button>
+      </el-col>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import { mapState, mapGetters, createNamespacedHelpers } from "vuex";
+import { getUser } from "@/api/system/user";
+import { treeselect } from "@/api/system/dept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+const { mapActions: role_relation } = createNamespacedHelpers("role_relation");
+export default {
+  name: "form-1",
+  props: {
+    form: { type: Object },
+  },
+  components: { Treeselect },
+  data: function () {
+    return {
+      rules: {
+        userName: [
+          { required: true, message: "用户名称不能为空", trigger: "blur" },
+        ],
+        nickName: [
+          { required: true, message: "用户昵称不能为空", trigger: "blur" },
+        ],
+        password: [
+          { required: true, message: "用户密码不能为空", trigger: "blur" },
+        ],
+        email: [
+          {
+            type: "email",
+            message: "'请输入正确的邮箱地址",
+            trigger: ["blur", "change"],
+          },
+        ],
+        phonenumber: [
+          {
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+            message: "请输入正确的手机号码",
+            trigger: "blur",
+          },
+        ],
+      },
+      // 归属部门
+      deptOptions: undefined,
+      // 性别状态字典
+      sexOptions: [],
+      // 状态数据字典
+      statusOptions: [],
+      // 岗位选项
+      postOptions: [],
+      // 角色选项
+      roleOptions: [],
+    };
+  },
+  created() {
+    this.searchOther();
+  },
+  methods: {
+    ...role_relation(["query"]),
+    async searchOther() {
+      treeselect().then((response) => {
+        this.deptOptions = response.data;
+      });
+      this.getDicts("sys_user_sex").then((response) => {
+        this.sexOptions = response.data;
+      });
+      this.getDicts("sys_normal_disable").then((response) => {
+        this.statusOptions = response.data;
+      });
+      getUser().then(async (response) => {
+        this.postOptions = response.posts;
+        let res = await this.query();
+        if (this.$checkRes(res)) {
+          let levelInfo = res.data.relation.find(
+            (i) => i.roleKey == this.roles[0]
+          );
+          if (levelInfo) {
+            let nextLevel = parseInt(levelInfo.level) + 1;
+            let p1 = res.data.relation.filter((i) => i.level == nextLevel)[0];
+            let roleList = response.roles.filter(
+              (i) => i.roleKey == p1.roleKey
+            );
+            if (roleList) this.roleOptions = roleList;
+          }
+        }
+      });
+    },
+    onSubmit(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.$emit("onSubmit", { data: this.form });
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+      this.$emit("resetForm");
+    },
+  },
+
+  computed: {
+    ...mapGetters(["roles"]),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.btn {
+  text-align: center;
+  margin: 5px 0 0 0;
+}
+</style>

+ 15 - 10
java代码/ruoyi-ui/src/views/merits/setting/index.vue

@@ -63,8 +63,14 @@
                   size="mini"
                   type="text"
                   icon="el-icon-refresh-right"
+                  <<<<<<<
+                  h-e-a-d
                   @click="toRelation(scope.row)"
                 >账号等级关联</el-button>
+                =======
+                >账号等级关联</el-button
+                >
+                >>>>>>> b8ad5e67a5de874abca06f3e9ae1247ae844ea55
               </template>
             </el-table-column>
           </el-table>
@@ -114,6 +120,7 @@
 import { mapState, mapGetters, createNamespacedHelpers } from 'vuex'
 import { listRole } from '@/api/system/role'
 const { mapActions: role_relation } = createNamespacedHelpers('role_relation')
+import _ from 'lodash'
 export default {
   name: 'Index',
   components: {},
@@ -137,6 +144,7 @@ export default {
       dialog: { title: '账号关联', show: false },
       // 账号关联
       form: {},
+      info: {},
       rules: {
         level: [
           { required: true, message: '请选择账号等级', trigger: 'change' }
@@ -179,12 +187,9 @@ export default {
       // 查询该角色关联信息
       const res = await this.query()
       if (this.$checkRes(res)) {
-        const arr = {
-          id: res.data.id,
-          roleName: data.roleName,
-          roleKey: data.roleKey
-        }
-        const relation = res.data.relation.find((i) => i.role == data.roleKey)
+        this.$set(this, `info`, res.data)
+        const arr = { roleName: data.roleName, roleKey: data.roleKey }
+        const relation = res.data.relation.find((i) => i.roleKey == data.roleKey)
         if (relation) arr.level = relation.level
         this.$set(this, `form`, arr)
         this.dialog = { title: '账号关联', show: true }
@@ -194,10 +199,10 @@ export default {
     onSubmit(formName) {
       this.$refs[formName].validate(async(valid) => {
         if (valid) {
-          const data = {
-            id: this.form.id,
-            relation: [{ role: this.form.roleKey, level: this.form.level }]
-          }
+          const data = this.info
+          const relation = [this.form, ...data.relation]
+          data.relation = _.uniqBy(relation, 'roleName')
+          console.log(data)
           const res = await this.update(data)
           if (res.code === 200) {
             this.$message({ type: `success`, message: res.msg })

+ 2 - 1
java代码/ruoyi-ui/src/views/system/user/index.vue

@@ -38,7 +38,7 @@
               @keyup.enter.native="handleQuery"
             />
           </el-form-item>
-          <el-form-item label="手机号码" prop="phonenumber">
+          <el-form-item label="手机号码" prop="phonenumber">phonenumber
             <el-input
               v-model="queryParams.phonenumber"
               placeholder="请输入手机号码"
@@ -345,6 +345,7 @@
 
 <script>
 import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
+
 import { getToken } from "@/utils/auth";
 import { treeselect } from "@/api/system/dept";
 import Treeselect from "@riophae/vue-treeselect";