Преглед изворни кода

Merge branch 'dev' into Regulation

# Conflicts:
#	src/main/java/com/izouma/wenlvju/service/RecordService.java
#	src/main/vue/src/plugins/http.js
#	src/main/vue/src/router.js
licailing пре 5 година
родитељ
комит
e97f1699bc

+ 28 - 27
src/main/h5/src/main.js

@@ -1,27 +1,28 @@
-import Vue from "vue";
-import App from "./App.vue";
-import router from "./router";
-import store from "./store";
-import http from "./plugins/http";
-import ElementUI from "element-ui";
-import "element-ui/lib/theme-chalk/index.css";
-import Vant from "vant";
-import "vant/lib/index.css";
-import MetaInfo from "vue-meta-info";
-Vue.prototype.$colors = {
-  prim: "#2C96FF",
-  text2: "#939599"
-};
-
-Vue.use(Vant);
-
-Vue.use(ElementUI);
-Vue.use(http);
-Vue.config.productionTip = false;
-Vue.use(MetaInfo);
-
-new Vue({
-  router,
-  store,
-  render: h => h(App)
-}).$mount("#app");
+import Vue from "vue";
+import App from "./App.vue";
+import router from "./router";
+import store from "./store";
+import http from "./plugins/http";
+import ElementUI from "element-ui";
+import "element-ui/lib/theme-chalk/index.css";
+import Vant from "vant";
+import "vant/lib/index.css";
+import MetaInfo from "vue-meta-info";
+Vue.prototype.$colors = {
+  prim: "#2C96FF",
+  text2: "#939599"
+};
+
+Vue.use(Vant);
+
+Vue.use(ElementUI);
+Vue.use(http);
+Vue.config.productionTip = false;
+Vue.use(MetaInfo);
+
+new Vue({
+  router,
+  store,
+  render: h => h(App)
+}).$mount("#app");
+//test

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

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

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

@@ -92,12 +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") {
+          if (exportsInfo) {
             next("/expertList");
           } else {
             next();
@@ -111,9 +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") {
+    } 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"));

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

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

+ 1 - 1
src/main/vue/src/views/rate/RateEdit.vue

@@ -356,7 +356,7 @@ export default {
             this.formData.organizationId = this.organization.id;
             this.readonly = false;
         } else {
-            this.readonly = false;
+            this.readonly = true;
         }
         this.$http
             // .get('/district/NJ')

Неке датотеке нису приказане због велике количине промена