From 2cfc86edb6a7dcc80c757669b00fcd921723d883 Mon Sep 17 00:00:00 2001
From: sk1551 <15175617877@163.com>
Date: Sat, 18 Apr 2020 15:06:21 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B2=97=E4=BD=8D=E4=BD=BF?=
 =?UTF-8?q?=E7=94=A8=E7=94=A8=E9=80=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ruoyi-ui/src/views/system/post/index.vue      | 69 ++++++++++++++-----
 .../ruoyi/project/system/domain/SysPost.java  | 14 ++++
 .../mybatis/system/SysPostMapper.xml          |  6 +-
 3 files changed, 70 insertions(+), 19 deletions(-)

diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue
index ffd3f42bb..a418c289e 100644
--- a/ruoyi-ui/src/views/system/post/index.vue
+++ b/ruoyi-ui/src/views/system/post/index.vue
@@ -107,7 +107,7 @@
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -137,6 +137,15 @@
             >{{dict.dictLabel}}</el-radio>
           </el-radio-group>
         </el-form-item>
+        <el-form-item label="岗位用途" prop="purp">
+          <el-radio-group v-model="form.purp">
+            <el-radio
+              v-for="dict in purpOptions"
+              :key="dict.dictValue"
+              :label="dict.dictValue"
+            >{{dict.dictLabel}}</el-radio>
+          </el-radio-group>
+        </el-form-item>
         <el-form-item label="备注" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
@@ -150,7 +159,14 @@
 </template>
 
 <script>
-import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post";
+import {
+  listPost,
+  getPost,
+  delPost,
+  addPost,
+  updatePost,
+  exportPost
+} from "@/api/system/post";
 
 export default {
   name: "Post",
@@ -174,13 +190,16 @@ export default {
       open: false,
       // 状态数据字典
       statusOptions: [],
+      // 岗位用途
+      purpOptions: [],
       // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
         postCode: undefined,
         postName: undefined,
-        status: undefined
+        status: undefined,
+        purp: undefined
       },
       // 表单参数
       form: {},
@@ -203,6 +222,9 @@ export default {
     this.getDicts("sys_normal_disable").then(response => {
       this.statusOptions = response.data;
     });
+    this.getDicts("sys_purpose").then(response => {
+      this.purpOptions = response.data;
+    });
   },
   methods: {
     /** 查询岗位列表 */
@@ -231,6 +253,7 @@ export default {
         postName: undefined,
         postSort: 0,
         status: "0",
+        purp: "1",
         remark: undefined
       };
       this.resetForm("form");
@@ -247,9 +270,9 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.postId)
-      this.single = selection.length!=1
-      this.multiple = !selection.length
+      this.ids = selection.map(item => item.postId);
+      this.single = selection.length != 1;
+      this.multiple = !selection.length;
     },
     /** 新增按钮操作 */
     handleAdd() {
@@ -260,7 +283,7 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const postId = row.postId || this.ids
+      const postId = row.postId || this.ids;
       getPost(postId).then(response => {
         this.form = response.data;
         this.open = true;
@@ -298,29 +321,39 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const postIds = row.postId || this.ids;
-      this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', "警告", {
+      this.$confirm(
+        '是否确认删除岗位编号为"' + postIds + '"的数据项?',
+        "警告",
+        {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
-        }).then(function() {
+        }
+      )
+        .then(function() {
           return delPost(postIds);
-        }).then(() => {
+        })
+        .then(() => {
           this.getList();
           this.msgSuccess("删除成功");
-        }).catch(function() {});
+        })
+        .catch(function() {});
     },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;
-      this.$confirm('是否确认导出所有岗位数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
+      this.$confirm("是否确认导出所有岗位数据项?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(function() {
           return exportPost(queryParams);
-        }).then(response => {
+        })
+        .then(response => {
           this.download(response.msg);
-        }).catch(function() {});
+        })
+        .catch(function() {});
     }
   }
 };
diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/domain/SysPost.java b/ruoyi/src/main/java/com/ruoyi/project/system/domain/SysPost.java
index ebafe7d9b..65344fa34 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/system/domain/SysPost.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/system/domain/SysPost.java
@@ -37,6 +37,9 @@ public class SysPost extends BaseEntity
     @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
     private String status;
 
+    /** 用途(1幼儿园 2系统) */
+    private String purp;
+
     /** 用户是否存在此岗位标识 默认不存在 */
     private boolean flag = false;
 
@@ -104,6 +107,14 @@ public class SysPost extends BaseEntity
     {
         this.flag = flag;
     }
+
+    public String getPurp() {
+        return purp;
+    }
+
+    public void setPurp(String purp) {
+        this.purp = purp;
+    }
     
     @Override
     public String toString() {
@@ -118,6 +129,9 @@ public class SysPost extends BaseEntity
             .append("updateBy", getUpdateBy())
             .append("updateTime", getUpdateTime())
             .append("remark", getRemark())
+            .append("purp", getPurp())
             .toString();
     }
+
+
 }
diff --git a/ruoyi/src/main/resources/mybatis/system/SysPostMapper.xml b/ruoyi/src/main/resources/mybatis/system/SysPostMapper.xml
index 1fb6f4580..d36d7b121 100644
--- a/ruoyi/src/main/resources/mybatis/system/SysPostMapper.xml
+++ b/ruoyi/src/main/resources/mybatis/system/SysPostMapper.xml
@@ -15,10 +15,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="updateBy"      column="update_by"     />
 		<result property="updateTime"    column="update_time"   />
 		<result property="remark"        column="remark"        />
+		<result property="purp"        column="purp"        />
 	</resultMap>
 	
 	<sql id="selectPostVo">
-        select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark 
+        select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark, purp
 		from sys_post
     </sql>
 	
@@ -79,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="postName != null and postName != ''">post_name = #{postName},</if>
  			<if test="postSort != null and postSort != ''">post_sort = #{postSort},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
+			<if test="purp != null and purp != ''">purp = #{purp},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  			update_time = sysdate()
@@ -93,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="postName != null and postName != ''">post_name,</if>
  			<if test="postSort != null and postSort != ''">post_sort,</if>
  			<if test="status != null and status != ''">status,</if>
+ 		    <if test="purp != null and purp != ''">purp,</if>
  			<if test="remark != null and remark != ''">remark,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			create_time
@@ -102,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="postName != null and postName != ''">#{postName},</if>
  			<if test="postSort != null and postSort != ''">#{postSort},</if>
  			<if test="status != null and status != ''">#{status},</if>
+		    <if test="purp != null and purp != ''">#{purp},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			sysdate()