Bladeren bron

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

guhongwei 3 jaren geleden
bovenliggende
commit
e941e49ed8

+ 2 - 2
java代码/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -170,11 +170,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</update>
 	
 	<delete id="deleteUserById" parameterType="string">
-		update sys_user set del_flag = '2' where user_id = #{userId}
+    delete from sys_user where user_id = #{userId}
  	</delete>
  	
  	<delete id="deleteUserByIds" parameterType="string">
- 		update sys_user set del_flag = '2' where user_id in
+ 		delete from sys_user where user_id in
  		<foreach collection="array" item="userId" open="(" separator="," close=")">
  			#{userId}
         </foreach> 

+ 5 - 3
java代码/ruoyi-ui/src/components/free/excel-view.vue

@@ -7,10 +7,11 @@
       <el-col v-if="viewRowCol" :span="10">
         <el-row>
           <el-col :span="24" :xs="0" style="padding:20px">
-            当前内容说明内容为:<br>{{ getCellContent() }}
+            <font style="color:red">{{ getCellContent() }}</font><br>
+            的说明内容
           </el-col>
           <el-col :span="24">
-            <el-input v-model="tip" type="textarea" :autosize="{ minRows: 30, maxRows: 30}" />
+            <el-input v-model="tip" :readonly="read" type="textarea" :autosize="{ minRows: 30, maxRows: 30}" />
           </el-col>
         </el-row>
       </el-col>
@@ -32,7 +33,8 @@ export default {
   },
   props: {
     data: { type: Object, required: true },
-    view: { type: Object }
+    view: { type: Object },
+    read: { type: Boolean, default: false }
   },
   data: function() {
     return {

+ 86 - 68
java代码/ruoyi-ui/src/views/merits/apply/form-frame.vue

@@ -3,27 +3,16 @@
     <el-row>
       <el-col :span="24" class="formMain">
         <el-col :span="24" class="one">
-          <el-button
-            type="primary"
-            plain
-            icon="el-icon-back"
-            size="mini"
-            @click="toBack"
-            >返回</el-button
-          ></el-col
-        >
+          <el-button type="primary" plain icon="el-icon-back" size="mini" @click="toBack">返回</el-button>
+        </el-col>
         <el-col :span="24" class="two">
-          <el-form :model="form" :rules="rules" ref="form" label-width="100px">
+          <el-form ref="form" :model="form" :rules="rules" label-width="100px">
             <el-form-item label="申请年度" prop="apply_year">
-              <el-input
-                v-model="form.apply_year"
-                placeholder="请输入申请年度"
-              ></el-input>
+              <el-input v-model="form.apply_year" placeholder="请输入申请年度" />
             </el-form-item>
-            <el-col :span="24" class="btn">
-              <el-button type="primary" @click="onSubmit('form')"
-                >提交保存</el-button
-              >
+            <excel-view v-if="!excelLoading" ref="excelView" v-model="form.excel" :read="true" :view="viewStyle" />
+            <el-col v-if="!view" :span="24" class="btn">
+              <el-button type="primary" @click="onSubmit('form')">提交保存</el-button>
               <el-button type="warning" @click="onDraft()">保存草稿</el-button>
               <el-button @click="onReset('form')">重置信息</el-button>
             </el-col>
@@ -35,97 +24,126 @@
 </template>
 
 <script>
-import { mapState, mapGetters, createNamespacedHelpers } from "vuex";
-const { mapActions: merits_apply } = createNamespacedHelpers("merits_apply");
+import excelView from '@/components/free/excel-view.vue'
+import { mapState, mapGetters, createNamespacedHelpers } from 'vuex'
+const { mapActions: merits_apply } = createNamespacedHelpers('merits_apply')
+const { mapActions: template } = createNamespacedHelpers('template')
 export default {
-  name: "form-frame",
+  name: 'FormFrame',
+  components: { excelView },
   props: {
     id: { type: String },
+    view: { type: Boolean, default: false }
   },
-  components: {},
-  data: function () {
+  data: function() {
     return {
-      form: {},
+      form: { excel: {}},
+      viewStyle: {
+        height: () => document.documentElement.clientHeight - 250,
+        width: () => 800
+      },
       rules: {
         apply_year: [
-          { required: true, message: "请输入申请年度", trigger: "blur" },
-        ],
+          { required: true, message: '请输入申请年度', trigger: 'blur' }
+        ]
       },
-    };
+      excel: {},
+      excelLoading: true
+    }
   },
-  created() {
-    this.$set(this, `form`, { user_id: this.user_id, user_name: this.name });
+  async created() {
+    await this.getTemplate()
+    if (this.id) {
+      this.searchInfo(this.id)
+    } else { this.init() }
   },
   methods: {
-    ...merits_apply(["fetch", "create", "update"]),
+    ...merits_apply(['fetch', 'create', 'update']),
+    ...template(['query']),
+    async init() {
+      this.$set(this, `form`, { user_id: this.user_id, user_name: this.name, excel: this.excel })
+      this.excelLoading = false
+    },
+    async getTemplate() {
+      if (this.id) return
+      const res = await this.query()
+      if (this.$checkRes(res)) {
+        const template = res.data.find(f => f.is_use)
+        if (template) {
+          const { excel = {}} = template
+          this.$set(this, 'excel', excel)
+        }
+      }
+    },
     // 返回
     toBack() {
-      this.$emit("toBack");
+      this.$emit('toBack')
     },
     // 提交保存
     onSubmit(formName) {
-      this.$refs[formName].validate(async (valid) => {
+      this.$refs[formName].validate(async(valid) => {
         if (valid) {
-          let data = this.form;
-          data.status = "1";
-          let res;
-          if (data.id) res = await this.update(data);
-          else res = await this.create(data);
+          const data = this.form
+          data.status = '1'
+          let res
+          if (data.id) res = await this.update(data)
+          else res = await this.create(data)
           if (res.code === 200) {
-            this.$message({ type: `success`, message: res.msg });
-            this.toBack();
+            this.$message({ type: `success`, message: res.msg })
+            this.toBack()
           } 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
         }
-      });
+      })
     },
     // 保存草稿
     async onDraft() {
-      let data = this.form;
-      let res;
-      if (data.id) res = await this.update(data);
-      else res = await this.create(data);
+      const data = this.form
+      let res
+      if (data.id) res = await this.update(data)
+      else res = await this.create(data)
       if (res.code === 200) {
-        this.$message({ type: `success`, message: res.msg });
-        this.toBack();
+        this.$message({ type: `success`, message: res.msg })
+        this.toBack()
       } else {
-        this.$message({ type: `error`, message: res.msg });
+        this.$message({ type: `error`, message: res.msg })
       }
     },
     // 查看详情
     async searchInfo(id) {
-      let res = await this.fetch(id);
+      const res = await this.fetch(id)
       if (res.code === 200) {
-        this.$set(this, `form`, res.data);
+        this.$set(this, `form`, res.data)
+        this.excelLoading = false
       } else {
-        this.$message({ type: `error`, message: res.msg });
+        this.$message({ type: `error`, message: res.msg })
       }
     },
     // 重置信息
     onReset(formName) {
-      this.$refs[formName].resetFields();
-    },
+      this.$refs[formName].resetFields()
+    }
   },
   computed: {
-    ...mapGetters(["user_id", "name"]),
+    ...mapGetters(['user_id', 'name'])
   },
   metaInfo() {
-    return { title: this.$route.meta.title };
-  },
-  watch: {
-    id: {
-      deep: true,
-      immediate: true,
-      handler(val) {
-        if (val) this.searchInfo(val);
-      },
-    },
-  },
-};
+    return { title: this.$route.meta.title }
+  }
+  // watch: {
+  //   id: {
+  //     deep: true,
+  //     immediate: true,
+  //     handler(val) {
+  //       if (val) this.searchInfo(val)
+  //     }
+  //   }
+  // }
+}
 </script>
 
 <style lang="less" scoped>

+ 34 - 23
java代码/ruoyi-ui/src/views/merits/apply/index.vue

@@ -6,65 +6,76 @@
           v-if="onShow == '1'"
           @toAdd="toAdd"
           @toEdit="toEdit"
-        ></list-frame>
+          @toView="toView"
+        />
         <form-frame
           v-else-if="onShow == '2'"
-          @toBack="toBack"
           :id="id"
-        ></form-frame>
+          :view="view"
+          @toBack="toBack"
+        />
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
-import listFrame from "./list-frame.vue";
-import formFrame from "./form-frame.vue";
-import { mapState, mapGetters, createNamespacedHelpers } from "vuex";
+import listFrame from './list-frame.vue'
+import formFrame from './form-frame.vue'
+import { mapState, mapGetters, createNamespacedHelpers } from 'vuex'
 export default {
-  name: "index",
-  props: {},
+  name: 'Index',
   components: {
     listFrame,
-    formFrame,
+    formFrame
   },
-  data: function () {
+  props: {},
+  data: function() {
     return {
       // 显示
-      onShow: "1",
-      id: "",
-    };
+      onShow: '1',
+      id: '',
+      view: false
+    }
   },
   async created() {},
   methods: {
     // 新增
     toAdd() {
-      this.$set(this, `onShow`, "2");
+      this.$set(this, `onShow`, '2')
+      this.$set(this, `view`, false)
     },
     // 修改
     toEdit(data) {
-      this.$set(this, `id`, data._id);
-      this.$set(this, `onShow`, "2");
+      this.$set(this, `id`, data._id)
+      this.$set(this, `onShow`, '2')
+      this.$set(this, `view`, false)
     },
     // 返回
     toBack() {
-      this.$set(this, `onShow`, "1");
+      this.$set(this, `onShow`, '1')
+      this.$set(this, `view`, false)
     },
+    toView(data) {
+      this.$set(this, `id`, data._id)
+      this.$set(this, `onShow`, '2')
+      this.$set(this, `view`, true)
+    }
   },
   computed: {
-    ...mapGetters(["user_id"]),
+    ...mapGetters(['user_id'])
   },
   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="less" scoped>

+ 57 - 55
java代码/ruoyi-ui/src/views/merits/apply/list-frame.vue

@@ -14,9 +14,11 @@
             @toCheck="toCheck"
           >
             <template #selfbtn>
-              <el-button type="primary" size="mini" @click="toAdd"
-                >添加</el-button
-              >
+              <el-button
+                type="primary"
+                size="mini"
+                @click="toAdd"
+              >添加</el-button>
             </template>
           </data-table>
         </el-col>
@@ -26,106 +28,106 @@
 </template>
 
 <script>
-import dataTable from "@/components/free/filter-page-table.vue";
-import { mapState, mapGetters, createNamespacedHelpers } from "vuex";
-const { mapActions: merits_apply } = createNamespacedHelpers("merits_apply");
+import dataTable from '@/components/free/filter-page-table.vue'
+import { mapState, mapGetters, createNamespacedHelpers } from 'vuex'
+const { mapActions: merits_apply } = createNamespacedHelpers('merits_apply')
 export default {
-  name: "list-frame",
-  props: {},
+  name: 'ListFrame',
   components: { dataTable },
-  data: function () {
+  props: {},
+  data: function() {
     return {
       list: [],
       total: 0,
       fields: [
-        { label: "用户名称", prop: "user_name", filter: true },
-        { label: "申请年度", prop: "apply_year" },
+        { label: '用户名称', prop: 'user_name', filter: true },
+        { label: '申请年度', prop: 'apply_year' },
         {
-          label: "申报状态",
-          prop: "status",
+          label: '申报状态',
+          prop: 'status',
           format: (i) =>
-            i == "0"
-              ? "草稿"
-              : i == "1"
-              ? "待审中"
-              : i == "2"
-              ? "审核通过"
-              : i == "3"
-              ? "审核拒绝"
-              : "",
-        },
+            i == '0'
+              ? '草稿'
+              : i == '1'
+                ? '待审中'
+                : i == '2'
+                  ? '审核通过'
+                  : i == '3'
+                    ? '审核拒绝'
+                    : ''
+        }
       ],
       opera: [
         {
-          label: "查看",
-          method: "toView",
+          label: '查看',
+          method: 'toView'
         },
         {
-          label: "修改",
-          method: "toEdit",
-          display: (i) => i.status == "0",
+          label: '修改',
+          method: 'toEdit',
+          display: (i) => i.status === '0'
         },
         {
-          label: "提交",
-          method: "success",
-          display: (i) => i.status == "0",
-        },
-      ],
-    };
+          label: '提交',
+          method: 'toCheck',
+          display: (i) => i.status === '0'
+        }
+      ]
+    }
   },
   async created() {
-    await this.search();
+    await this.search()
   },
   methods: {
-    ...merits_apply(["query", "update"]),
+    ...merits_apply(['query', 'update']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      info.user_id = this.user_id;
-      let res = await this.query({ skip, limit, ...info });
+      info.user_id = this.user_id
+      const res = await this.query({ skip, limit, ...info })
       if (this.$checkRes(res)) {
-        this.$set(this, `list`, res.data);
-        this.$set(this, `total`, res.total);
+        this.$set(this, `list`, res.data)
+        this.$set(this, `total`, res.total)
       }
     },
     // 新增
     toAdd() {
-      this.$emit("toAdd");
+      this.$emit('toAdd')
     },
     // 查看信息
     toView({ data }) {
-      console.log(data);
+      this.$emit('toView', data)
     },
     // 修改信息
     toEdit({ data }) {
-      this.$emit("toEdit", data);
+      this.$emit('toEdit', data)
     },
     // 提交审核
     async toCheck({ data }) {
-      let res = await this.update({ id: data._id, status: "1" });
+      const res = await this.update({ id: data._id, status: '1' })
       if (res.code === 200) {
-        this.$message({ type: `success`, message: res.msg });
+        this.$message({ type: `success`, message: res.msg })
       } else {
         this.$message({
           type: `error`,
-          message: res.msg || res.errmsg + ":" + res.details,
-        });
+          message: res.msg || res.errmsg + ':' + res.details
+        })
       }
-      this.search();
-    },
+      this.search()
+    }
   },
   computed: {
-    ...mapGetters(["user_id"]),
+    ...mapGetters(['user_id'])
   },
   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="less" scoped></style>