Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

licailing 5 лет назад
Родитель
Сommit
c841f36d16

+ 11 - 9
src/main/h5/src/router/index.js

@@ -92,15 +92,20 @@ const router = new VueRouter({
 });
 
 router.beforeEach((to, from, next) => {
+  let exports = ["ROLE_EXPERT", "ROLE_DISTRICT_STAFF"];
+  let exportsInfo = store.state.roles.find(item => {
+    return exports.includes(item);
+  });
+  let inspectors = ["ROLE_SUPERVISOR"];
+  let inspectorsInfo = store.state.roles.find(item => {
+    return inspectors.includes(item);
+  });
   if (!store.state.userInfo && to.path !== "/login" && to.meta.checkLogin) {
     store
       .dispatch("getUserInfo")
       .then(() => {
         if (to.name === "inspectorList") {
-          if (
-            store.state.role === "ROLE_EXPERT" ||
-            store.state.role === "ROLE_DISTRICT_STAFF"
-          ) {
+          if (exportsInfo) {
             next("/expertList");
           } else {
             next();
@@ -114,12 +119,9 @@ router.beforeEach((to, from, next) => {
         next("/login");
       });
   } else if (store.state.userInfo && to.name === "inspectorList") {
-    if (store.state.role === "ROLE_SUPERVISOR") {
+    if (inspectorsInfo) {
       next();
-    } else if (
-      store.state.role === "ROLE_EXPERT" ||
-      store.state.role === "ROLE_DISTRICT_STAFF"
-    ) {
+    } else if (exportsInfo) {
       next("/expertList");
     }
   } else if (!to.matched.length) {

+ 6 - 7
src/main/h5/src/store/index.js

@@ -7,14 +7,14 @@ Vue.use(Vuex);
 export default new Vuex.Store({
   state: {
     userInfo: null,
-    role: "ROLE_USER"
+    roles: ["ROLE_USER"]
   },
   mutations: {
     updateUserInfo(state, userInfo) {
       state.userInfo = userInfo;
     },
-    updateRole(state, role) {
-      state.role = role;
+    updateRoles(state, roles) {
+      state.roles = roles;
     }
   },
   actions: {
@@ -22,11 +22,10 @@ export default new Vuex.Store({
       return http.axios
         .get("/user/my")
         .then(res => {
-          res.data.authorities.forEach(item => {
-            if (item.name !== "ROLE_USER") {
-              content.commit("updateRole", item.name);
-            }
+          let roles = res.data.authorities.map(item => {
+            return item.name;
           });
+          content.commit("updateRoles", roles);
 
           content.commit("updateUserInfo", res.data);
           return Promise.resolve();

+ 53 - 1
src/main/h5/src/views/expert/expertAdd.vue

@@ -84,6 +84,15 @@
     </van-uploader> -->
 
     <div class="bottom">
+      <van-button
+        @click="save"
+        class="preview"
+        color="#ffcf6a"
+        block
+        round
+        style="margin-right:12px"
+        >暂存</van-button
+      >
       <!-- <van-button
         @click="$refs.preview.init()"
         class="preview"
@@ -169,7 +178,32 @@ export default {
         };
       });
     });
-    this.submitList = subList;
+
+    this.$http
+      .post(
+        "/rateExpertAudit/all",
+        {
+          query: {
+            rateId: this.$route.query.rateId
+          }
+        },
+        { body: "json" }
+      )
+      .then(res => {
+        res.content.forEach(item => {
+          subList[item.type] = {
+            ...item,
+            imgs: item.img.map(img => {
+              return {
+                url: img
+              };
+            })
+          };
+        });
+
+        this.submitList = subList;
+        // this.rateList = res.content;
+      });
   },
   methods: {
     afterRead(file, detail) {
@@ -227,6 +261,24 @@ export default {
         });
       });
     },
+    save() {
+      let form = { ...this.form };
+      this.$toast.loading({
+        message: "加载中...",
+        forbidClick: true
+      });
+      this.$http
+        .post("/rateExpertAudit/batchSave", {
+          audits: JSON.stringify(this.subJson)
+        })
+        .then(() => {
+          this.$toast.success("成功");
+        })
+        .catch(e => {
+          console.log(e);
+          this.$message.error(e.error);
+        });
+    },
     submit() {
       let form = { ...this.form };
       this.$toast.loading({

+ 0 - 8
src/main/h5/src/views/expert/expertDetail.vue

@@ -162,14 +162,6 @@ export default {
             .then(res => {
               this.rateList = res.content;
             });
-          let audit = {
-            rateId: this.rateInfo.id,
-            remark: "专家组已线下考察完毕",
-            status: "SUBMIT_GRADE"
-          };
-          this.$http.post("/rateAudit/save", audit, {
-            body: "json"
-          });
           return this.$http.get("/organization/get/" + res.organizationId);
         })
         .then(res => {

Разница между файлами не показана из-за своего большого размера
+ 221 - 226
src/main/h5/yarn.lock


+ 9 - 2
src/main/java/com/izouma/wenlvju/service/RateService.java

@@ -62,6 +62,7 @@ public class RateService {
         String district = record.getDistrict();
         if (record.getId() != null) {
             Rate orig = rateRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            boolean examination = orig.isUndertakeExamination();
             ObjUtils.merge(orig, record);
 
             switch (record.getStatus()) {
@@ -78,8 +79,14 @@ public class RateService {
                     njwlSmsService.sendSms(map.get("phone1"), map.get("message1"));
                     break;
                 case SUBMIT_GRADE:// 专家组提交成绩 4
-                    orig.setUndertakeExamination(orig.isUndertakeExamination());
-
+                    orig.setUndertakeExamination(examination);
+                    RateAudit rateAudit = RateAudit.builder()
+                            .userId(orig.getExpertUserId())
+                            .rateId(orig.getId())
+                            .remark("专家组已线下考察完毕")
+                            .status(RateStatus.SUBMIT_GRADE)
+                            .build();
+                    rateAuditRepo.save(rateAudit);
                     Map<String, String> gradeMessage = this.gradeMessage(now, orig.getExpertUserId(), orig
                             .getName());
                     njwlSmsService.sendSms(gradeMessage.get("phone"), gradeMessage.get("message"));

+ 2 - 2
src/main/vue/src/plugins/http.js

@@ -5,8 +5,8 @@ import qs from 'qs';
 let baseUrl = 'http://localhost:8080';
 switch (process.env.NODE_ENV) {
     case 'development':
-        // baseUrl = 'http://localhost:8080';
-        baseUrl = 'http://wlj.izouma.com';
+        baseUrl = 'http://localhost:8080';
+        // baseUrl = 'http://wlj.izouma.com';
         break;
     case 'test':
         baseUrl = 'http://localhost:8080';

Некоторые файлы не были показаны из-за большого количества измененных файлов