zhangjie 4 жил өмнө
parent
commit
95b06dfed7

+ 5 - 2
src/api.js

@@ -12,8 +12,11 @@ export const resetPwd = ({ userId, password }) => {
 };
 
 // org-manage
-export const orgList = () => {
-  return $get("/api/admin/organization");
+export const orgList = datas => {
+  return $get("/api/admin/organization", datas);
+};
+export const orgDetail = organizationId => {
+  return $get(`/api/admin/organization/${organizationId}`);
 };
 export const createOrg = datas => {
   return $post(`/api/admin/organization`, datas, "json");

+ 6 - 1
src/constants/authority.js

@@ -1,4 +1,9 @@
 export const main = [
+  {
+    name: "OrgManage",
+    title: "机构管理",
+    icon: "ivu-icon-task"
+  },
   {
     name: "WorkManage",
     title: "工作文件夹",
@@ -62,7 +67,7 @@ export const clientSet = [
   },
   {
     name: "InspectionAccountSet",
-    title: "纪检账号"
+    title: "纪检/质检账号"
   }
 ];
 

+ 10 - 0
src/constants/enumerate.js

@@ -40,6 +40,16 @@ export const ROLE_TYPE = {
   MARKER: "评卷员",
   MARK_LEADER: "科组长"
 };
+// system role type
+export const SYSTEM_ROLE_TYPE = {
+  MARKER: "评卷员",
+  MARK_LEADER: "科组长",
+  INSPECTION: "纪检员",
+  QC: "质检员",
+  COLLECTOR: "采集员",
+  ADMIN: "管理员",
+  SUPER_ADMIN: "超级管理员"
+};
 
 export const MARKER_RIGHT_TYPE = {
   ALLOW_LEVELING: "只允许分档",

+ 10 - 2
src/modules/client-set/ClientAccountSet.vue

@@ -40,6 +40,7 @@
 <script>
 import { clientUserPageList, deleteClientUser, updateClientUser } from "@/api";
 import ModifyClientUser from "./components/ModifyClientUser";
+import { SYSTEM_ROLE_TYPE } from "@/constants/enumerate";
 
 export default {
   name: "client-account-set",
@@ -116,7 +117,10 @@ export default {
         size: this.size
       };
       const data = await clientUserPageList(datas);
-      this.users = data.data;
+      this.users = data.data.map(item => {
+        item.roleName = SYSTEM_ROLE_TYPE[item.role];
+        return item;
+      });
       this.total = data.totalCount;
     },
     toPage(page) {
@@ -127,7 +131,11 @@ export default {
       return row.enabled ? "" : "row-disabled";
     },
     toAdd() {
-      this.curUser = {};
+      this.curUser = {
+        role: "COLLECTOR",
+        roleName: "采集员",
+        workId: this.workId
+      };
       this.$refs.ModifyClientUser.open();
     },
     toEdit(row) {

+ 25 - 14
src/modules/client-set/InspectionAccountSet.vue

@@ -7,21 +7,24 @@
       disabled-hover
       border
     ></Table>
+
+    <!-- modify-client-user -->
+    <modify-client-user
+      :instance="curUser"
+      @modified="getList"
+      ref="ModifyClientUser"
+    ></modify-client-user>
   </div>
 </template>
 
 <script>
 import { inspectionUserPageList, resetPwd } from "@/api";
-
-const initModalForm = {
-  id: "",
-  roleName: "纪检",
-  loginName: "",
-  password: ""
-};
+import ModifyClientUser from "./components/ModifyClientUser";
+import { SYSTEM_ROLE_TYPE } from "@/constants/enumerate";
 
 export default {
   name: "client-account-set",
+  components: { ModifyClientUser },
   data() {
     return {
       workId: this.$route.params.workId,
@@ -47,6 +50,10 @@ export default {
         },
         {
           title: "密码",
+          key: "password"
+        },
+        {
+          title: "操作",
           key: "action",
           width: 100,
           align: "center",
@@ -54,15 +61,17 @@ export default {
           render: (h, param) => {
             let actions = [
               {
-                name: "重置",
-                type: "text",
+                icon: "md-create",
+                attrs: {
+                  title: "编辑"
+                },
                 action: () => {
-                  this.toResetPwd(param.row);
+                  this.toEdit(param.row);
                 }
               }
             ];
 
-            return h("div", this.$tableAction(h, actions));
+            return h("div", this.$tableIconAction(h, actions));
           }
         }
       ]
@@ -82,13 +91,15 @@ export default {
         return {
           id: item.id,
           loginName: item.loginName,
+          role: item.role,
           password: item.password,
-          roleName: "纪检"
+          roleName: SYSTEM_ROLE_TYPE[item.role]
         };
       });
     },
-    toAdd() {
-      this.users.push({ ...initModalForm });
+    toEdit(row) {
+      this.curUser = row;
+      this.$refs.ModifyClientUser.open();
     },
     async toResetPwd(user) {
       let result = true;

+ 26 - 9
src/modules/client-set/components/ModifyClientUser.vue

@@ -19,8 +19,11 @@
           size="large"
           v-model.trim="modalForm.loginName"
           placeholder="请输入账号"
+          :disabled="isEdit"
           clearable
-        ></Input>
+        >
+          <span slot="prepend" v-if="!isEdit">{{ loginNamePrepend }}</span>
+        </Input>
       </FormItem>
       <FormItem prop="password" label="密码">
         <Input
@@ -41,11 +44,14 @@
 </template>
 
 <script>
-import { updateClientUser } from "@/api";
+import { updateClientUser, orgDetail } from "@/api";
 import { password } from "@/plugins/formRules";
 
 const initModalForm = {
   id: "",
+  workId: "",
+  role: "",
+  roleName: "",
   loginName: "",
   password: ""
 };
@@ -65,7 +71,7 @@ export default {
       return !!this.instance.id;
     },
     title() {
-      return (this.isEdit ? "编辑" : "新增") + "采集账号";
+      return (this.isEdit ? "编辑" : "新增") + this.instance.roleName + "账号";
     }
   },
   data() {
@@ -73,6 +79,8 @@ export default {
       modalIsShow: false,
       isSubmit: false,
       modalForm: { ...initModalForm },
+      orgInfo: {},
+      loginNamePrepend: "",
       rules: {
         loginName: [
           {
@@ -86,20 +94,26 @@ export default {
       }
     };
   },
+  created() {
+    this.getOrgDetail();
+  },
   methods: {
     initData(val) {
       this.$refs.modalFormComp.resetFields();
-      if (val.id) {
-        this.modalForm = this.$objAssign(initModalForm, val);
-      } else {
-        this.modalForm = { ...initModalForm };
-      }
+      this.modalForm = this.$objAssign(initModalForm, val);
+      this.loginNamePrepend = `${this.orgInfo.abbreviation.toLowerCase()}-${
+        this.modalForm.workId
+      }-`;
     },
     visibleChange(visible) {
       if (visible) {
         this.initData(this.instance);
       }
     },
+    async getOrgDetail() {
+      const organizationId = this.$ls.get("organizationId");
+      this.orgInfo = await orgDetail(organizationId);
+    },
     cancel() {
       this.modalIsShow = false;
     },
@@ -113,7 +127,10 @@ export default {
       if (this.isSubmit) return;
       this.isSubmit = true;
       let result = true;
-      await updateClientUser(this.modalForm).catch(() => {
+      const datas = { ...this.modalForm };
+      if (!this.isEdit)
+        datas.loginName = `${this.loginNamePrepend}${datas.loginName}`;
+      await updateClientUser(datas).catch(() => {
         result = false;
       });
       this.isSubmit = false;

+ 16 - 7
src/modules/grading-set/GradingLevelSet.vue

@@ -28,7 +28,7 @@
               v-model="level.code"
               style="width: 60px"
               @on-blur="codeChange(level)"
-              v-if="level.canEdit"
+              v-if="level.canEdit && workDetail.modifyOtherVal"
             ></Input>
             <p v-else>{{ level.code }}</p>
           </td>
@@ -38,7 +38,7 @@
               :min="0"
               :max="200"
               @on-blur="checkLevelValidate(level)"
-              v-if="level.canEdit"
+              v-if="level.canEdit && workDetail.modifyOtherVal"
             ></InputNumber>
             <p v-else>{{ level.minScore }}</p>
           </td>
@@ -48,7 +48,7 @@
               :min="1"
               :max="200"
               @on-blur="checkLevelValidate(level)"
-              v-if="level.canEdit"
+              v-if="level.canEdit && workDetail.modifyOtherVal"
             ></InputNumber>
             <p v-else>{{ level.maxScore }}</p>
           </td>
@@ -60,7 +60,11 @@
               :precision="0"
               :disabled="!level.canEdit"
               @on-blur="checkLevelValidate(level)"
-              v-if="level.levelType === 'ADMITED' && level.canEdit"
+              v-if="
+                level.levelType === 'ADMITED' &&
+                  level.canEdit &&
+                  workDetail.modifyOtherVal
+              "
             ></InputNumber>
             <p v-else>{{ level.intervalScore }}</p>
           </td>
@@ -70,7 +74,7 @@
               :min="1"
               :max="100"
               @on-blur="checkLevelValidate(level)"
-              v-if="level.canEdit"
+              v-if="level.canEdit && workDetail.modifyOtherVal"
             ></InputNumber>
             <p v-else>{{ level.weight }}</p>
           </td>
@@ -79,7 +83,7 @@
               v-model="level.levelType"
               @on-change="levelTypeChange(level)"
               style="width: 120px"
-              v-if="level.canEdit"
+              v-if="level.canEdit && workDetail.modifyOtherVal"
             >
               <Option
                 v-for="(val, key) in LEVEL_TYPE"
@@ -94,7 +98,11 @@
             <Input
               v-model="level.scoreList"
               @on-blur="checkLevelValidate(level)"
-              v-if="level.levelType === 'UNADMIT' && level.canEdit"
+              v-if="
+                level.levelType === 'UNADMIT' &&
+                  level.canEdit &&
+                  workDetail.modifyOtherVal
+              "
             ></Input>
             <p v-else>{{ level.scoreList }}</p>
           </td>
@@ -126,6 +134,7 @@
                 type="md-trash"
                 title="删除"
                 @click="toDelete(index)"
+                v-if="workDetail.modifyOtherVal"
               />
             </div>
           </td>

+ 9 - 4
src/modules/grading/Grading.vue

@@ -77,7 +77,8 @@ export default {
       curNav: {},
       curSubject: { name: "" },
       SUBJECT_STAGE,
-      IS_ADMIN: true,
+      IS_ADMIN: false,
+      IS_SUPER_ADMIN: false,
       stepName: "",
       stepProgress: ""
     };
@@ -92,11 +93,12 @@ export default {
   mounted() {
     const curUserRoleType = this.$ls.get("user", { role: "" }).role;
     this.IS_ADMIN = curUserRoleType === "ADMIN";
+    this.IS_SUPER_ADMIN = curUserRoleType === "SUPER_ADMIN";
     this.initData();
   },
   methods: {
     async initData() {
-      if (this.IS_ADMIN) {
+      if (this.IS_ADMIN || this.IS_SUPER_ADMIN) {
         this.curSubject = await subjectDetail(this.subjectId);
         if (this.curSubject.stage === "SCORE") {
           this.$router.replace({
@@ -127,9 +129,12 @@ export default {
     },
     buildNavs() {
       this.navs = deepCopy(grading);
-      if (this.IS_ADMIN) {
+      if (this.IS_ADMIN || this.IS_SUPER_ADMIN) {
         this.navs.pop();
-        this.navs = [...main.slice(0, 2), ...this.navs];
+        const navHead = this.IS_SUPER_ADMIN
+          ? main.slice(0, 3)
+          : main.slice(1, 3);
+        this.navs = [...navHead, ...this.navs];
         if (this.curSubject.stage === "LEVEL") {
           this.navs[this.navs.length - 1].title = "打分分组";
         }

+ 0 - 1
src/modules/grading/GradingUserManage.vue

@@ -171,7 +171,6 @@ export default {
     },
     toDelete(row) {
       this.$Modal.confirm({
-        title: "删除警告",
         content: "确定要删除当前账号吗?",
         onOk: () => {
           this.toDel(row.id);

+ 20 - 3
src/modules/grading/components/ModifyGradingUser.vue

@@ -22,7 +22,9 @@
           placeholder="请输入账号"
           :disabled="isEdit"
           clearable
-        ></Input>
+        >
+          <span slot="prepend" v-if="!isEdit">{{ loginNamePrepend }}</span>
+        </Input>
       </FormItem>
       <FormItem prop="password" label="密码">
         <Input
@@ -114,7 +116,7 @@
 </template>
 
 <script>
-import { updateGradingUser } from "@/api";
+import { updateGradingUser, orgDetail } from "@/api";
 import { commonCode, password, numberValidator } from "@/plugins/formRules";
 import { ROLE_TYPE, MARKER_RIGHT_TYPE } from "@/constants/enumerate";
 
@@ -164,6 +166,8 @@ export default {
       roleTypes: [],
       MARKER_RIGHT_TYPE,
       modalForm: { ...initModalForm },
+      loginNamePrepend: "",
+      orgInfo: {},
       rules: {
         loginName: commonCode({ prop: "账号" }),
         password,
@@ -194,6 +198,9 @@ export default {
       }
     };
   },
+  created() {
+    this.getOrgDetail();
+  },
   methods: {
     initData(val) {
       this.$refs.modalFormComp.resetFields();
@@ -209,12 +216,19 @@ export default {
         );
       }
       this.modalForm = this.$objAssign(initModalForm, val);
+      this.loginNamePrepend = `${this.orgInfo.abbreviation.toLowerCase()}-${
+        this.modalForm.workId
+      }-`;
     },
     visibleChange(visible) {
       if (visible) {
         this.initData(this.instance);
       }
     },
+    async getOrgDetail() {
+      const organizationId = this.$ls.get("organizationId");
+      this.orgInfo = await orgDetail(organizationId);
+    },
     cancel() {
       this.modalIsShow = false;
     },
@@ -228,7 +242,10 @@ export default {
       if (this.isSubmit) return;
       this.isSubmit = true;
       let result = true;
-      await updateGradingUser(this.modalForm).catch(() => {
+      const datas = { ...this.modalForm };
+      if (!this.isEdit)
+        datas.loginName = `${this.loginNamePrepend}${datas.loginName}`;
+      await updateGradingUser(datas).catch(() => {
         result = false;
       });
       this.isSubmit = false;

+ 3 - 6
src/modules/login/LoginHome.vue

@@ -114,12 +114,9 @@ export default {
       this.isSubmit = false;
       if (!data) return;
 
-      this.$ls.set("user", data, this.GLOBAL.authTimeout);
-      this.$ls.set(
-        "organizationId",
-        data.organizationId,
-        this.GLOBAL.authTimeout
-      );
+      this.$ls.set("user", data);
+      this.$ls.set("organizationId", data.organizationId);
+
       this.$store.commit("setUser", data);
       // 初次登陆强制修改密码
       if (

+ 7 - 1
src/modules/main/Main.vue

@@ -41,7 +41,8 @@ export default {
   mixins: [menuMixins],
   data() {
     return {
-      navs: main,
+      navs: [],
+      IS_ADMIN: false,
       curNav: {}
     };
   },
@@ -53,6 +54,11 @@ export default {
     }
   },
   mounted() {
+    this.IS_ADMIN = this.$ls.get("user", { role: "" }).role === "ADMIN";
+    this.navs = [...main];
+    if (this.IS_ADMIN) {
+      this.navs.shift();
+    }
     this.actMainNav();
   },
   methods: {

+ 27 - 2
src/modules/main/OrgManage.vue

@@ -103,6 +103,17 @@
               </tr>
             </template>
           </table>
+
+          <div class="part-page">
+            <Page
+              :current="current"
+              :total="total"
+              :page-size="size"
+              show-total
+              show-elevator
+              @on-change="toPage"
+            ></Page>
+          </div>
         </div>
       </div>
     </div>
@@ -126,6 +137,10 @@ export default {
   components: { ModifyOrg },
   data() {
     return {
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      totalPage: 0,
       orgs: [],
       curUsers: []
     };
@@ -135,8 +150,18 @@ export default {
   },
   methods: {
     async getList() {
-      const data = await orgList();
-      this.orgs = data;
+      const datas = {
+        curPage: this.current - 1,
+        pageSize: this.size
+      };
+      const data = await orgList(datas);
+      this.orgs = data.data;
+      this.total = data.totalCount;
+      this.totalPage = data.pageCount;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
     },
     toAdd() {
       this.curUsers = [];

+ 33 - 20
src/modules/main/WorkManage.vue

@@ -5,25 +5,36 @@
     <div class="home-body">
       <div class="home-main">
         <div class="part-box-head">
-          <Form label-position="left" inline>
-            <FormItem>
-              <Input
-                v-model.trim="modalForm.name"
-                placeholder="工作名称"
-                clearable
-              ></Input>
-            </FormItem>
-            <FormItem :label-width="0">
-              <Button
-                size="small"
-                type="success"
-                icon="recode-white icon"
-                shape="circle"
-                @click="toAdd"
-                >新增工作文件</Button
-              >
-            </FormItem>
-          </Form>
+          <div class="part-box-head-left">
+            <Form label-position="left" inline>
+              <FormItem>
+                <Input
+                  v-model.trim="modalForm.name"
+                  placeholder="工作名称"
+                  clearable
+                ></Input>
+              </FormItem>
+              <FormItem :label-width="0">
+                <Button
+                  size="small"
+                  type="success"
+                  icon="recode-white icon"
+                  shape="circle"
+                  @click="toAdd"
+                  >新增工作文件</Button
+                >
+              </FormItem>
+            </Form>
+          </div>
+          <div class="part-box-head-right" v-if="IS_SUPER_ADMIN">
+            <Button
+              size="small"
+              icon="md-arrow-back"
+              shape="circle"
+              @click="$router.go(-1)"
+              >返回</Button
+            >
+          </div>
         </div>
         <Table
           ref="TableList"
@@ -49,6 +60,7 @@ export default {
       modalForm: {
         name: ""
       },
+      IS_SUPER_ADMIN: false,
       works: [],
       columns: [
         {
@@ -127,6 +139,8 @@ export default {
     };
   },
   mounted() {
+    this.IS_SUPER_ADMIN =
+      this.$ls.get("user", { role: "" }).role === "SUPER_ADMIN";
     this.getList();
   },
   methods: {
@@ -173,7 +187,6 @@ export default {
     },
     toDelete(row) {
       this.$Modal.confirm({
-        title: "删除警告",
         content: "确定要删除当前工作吗?",
         onOk: () => {
           this.toDel(row.id);

+ 8 - 3
src/modules/mark/MarkHome.vue

@@ -76,7 +76,8 @@ export default {
       curNav: {},
       curSubject: { name: "" },
       SUBJECT_STAGE,
-      IS_ADMIN: true
+      IS_ADMIN: false,
+      IS_SUPER_ADMIN: false
     };
   },
   watch: {
@@ -89,6 +90,7 @@ export default {
   mounted() {
     const curUserRoleType = this.$ls.get("user", { role: "" }).role;
     this.IS_ADMIN = curUserRoleType === "ADMIN";
+    this.IS_SUPER_ADMIN = curUserRoleType === "SUPER_ADMIN";
     this.initData();
   },
   methods: {
@@ -109,9 +111,12 @@ export default {
     },
     buildNavs() {
       this.navs = deepCopy(mark);
-      if (this.IS_ADMIN) {
+      if (this.IS_ADMIN || this.IS_SUPER_ADMIN) {
         this.navs.pop();
-        this.navs = [...main.slice(0, 2), ...this.navs];
+        const navHead = this.IS_SUPER_ADMIN
+          ? main.slice(0, 3)
+          : main.slice(1, 3);
+        this.navs = [...navHead, ...this.navs];
       } else {
         this.navs.splice(1, 1);
         this.navs.splice(2, 1);

+ 1 - 1
src/routers/main.js

@@ -45,7 +45,7 @@ const clientSetRoutes = [
     name: "InspectionAccountSet",
     component: InspectionAccountSet,
     meta: {
-      title: "纪检账号"
+      title: "纪检/质检账号"
     }
   }
 ];