Эх сурвалжийг харах

绩效分数调整数据权限功能;

001295 1 жил өмнө
parent
commit
e5a9d6434d

+ 19 - 2
src/api/business/ehr/config/config.js

@@ -1,7 +1,7 @@
 import request from '@/utils/request'
 
 // 员工数据权限配置
-export function PmPerformancelist() {
+export function pmPerformanceList() {
   return request({
     url: '/ehr/pm/config/pmPerformance/list',
     method: 'get'
@@ -18,9 +18,26 @@ export function pmPerformanceSave(data) {
 }
 
 // 分数调整权限
-export function listPmScoreAdjustment(query) {
+export function pmScoreAdjustmentList(query) {
   return request({
     url: '/ehr/pm/config/pmScoreAdjustment/list',
     method: 'get'
   })
+}
+
+// 分解结果
+export function pmScoreAdjustmentSalvageList(query) {
+  return request({
+    url: '/ehr/pm/config/pmScoreAdjustment/salvageList',
+    method: 'get'
+  })
+}
+
+// 保存分数调整权限数据
+export function pmScoreAdjustmentSave(data) {
+  return request({
+    url: '/ehr/pm/config/pmScoreAdjustment/save',
+    method: 'post',
+    data: data
+  })
 }

+ 29 - 8
src/views/business/ehr/config/pmPerformanceConfig.vue

@@ -21,6 +21,11 @@
             <el-input size="mini" v-model="scope.row.dept" />
           </template>
         </el-table-column>
+        <el-table-column label="操作" fixed="right" align="center">
+          <template slot-scope="scope">
+            <el-button size="mini" type="text" @click="btnDelete(scope.row)">删行</el-button>
+          </template>
+        </el-table-column>
       </el-table>
     </div>
     <div style="float:right">
@@ -32,7 +37,7 @@
 </template>
 
 <script>
-import { PmPerformancelist,pmPerformanceSave} from "@/api/business/ehr/config/config";
+import { pmPerformanceList,pmPerformanceSave} from "@/api/business/ehr/config/config";
 
 export default {
   name: "PmPerformanceConfig",
@@ -51,7 +56,7 @@ export default {
   async created() {
     this.operatingState = "see";
     this.loading = true;
-    let res = await PmPerformancelist();
+    let res = await pmPerformanceList();
     this.data = res.data;
     this.loading = false;
   },
@@ -63,31 +68,47 @@ export default {
     },
     //取消按钮
     async btnCancel(){
-      PmPerformancelist().then(res => {
+      pmPerformanceList().then(res => {
         this.data = res.data;
       })
       this.refreshTable++;
       this.operatingState = "see";
     },
     //保存按钮
-    btnSave(){
+    async btnSave(){
       this.loading = true;
       try {
-        pmPerformanceSave(this.data).then(response => {
+        let res = await pmPerformanceSave(this.data);
+        if(res.code == '200'){
           this.$modal.msgSuccess("保存成功");
-          PmPerformancelist().then(res => {
+          pmPerformanceList().then(res => {
             this.data = res.data;
             this.refreshTable++;
             this.operatingState = "see";
             this.loading = false;
           })
-        });
+        }else{
+          this.$modal.error("保存失败");
+        }
       } catch (err) {
         console.error(err);
       } finally {
-        
+        this.loading = false;
       }
       
+    },
+    //新增行按钮
+    btnAddRow(){
+      this.data.push({
+        "staff":"",
+        "dept":""
+      });
+    },
+    //删行按钮
+    btnDelete(row){
+      this.data = this.data.filter(function(item) {
+        return item.staff != row.staff
+      });
     }
   }
 };

+ 294 - 7
src/views/business/ehr/config/pmScoreAdjustmentConfig.vue

@@ -1,32 +1,319 @@
 <template>
   <div v-loading="loading">
-    {{this.data}}
+    <div style="float:right">
+      <el-button type="primary" size="mini" @click="btnSeeRes">查看结果</el-button>
+      <el-button type="primary" size="mini" @click="btnAddRow">新增</el-button>
+    </div>
+    <el-table size="mini" v-loading="loading" :data="data" :key="refreshTable">
+      <el-table-column width="200" label="调整人" align="center" prop="adjustmentName">
+        <template slot-scope="scope">
+          <el-popover-select-v2 size="mini" v-model="data[scope.$index].adjustmentName" title="负责人"
+            valueKey="name" referName="CONTACTS_PARAM" :dataMapping="{ adjustment: 'code', adjustmentName: 'name'}"
+            :source.sync="data[scope.$index]" placeholder="请输入负责人">
+          </el-popover-select-v2>
+        </template>
+      </el-table-column>
+      <el-table-column width="100" label="类型" align="center" prop="type" >
+        <template slot-scope="scope">
+          <el-select size="mini" v-model="scope.row.type" placeholder="" @change="typeChange(scope.row)">
+            <el-option
+              v-for="dict in dict.type.ehr_config_datatype"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            ></el-option>
+          </el-select>
+        </template>
+      </el-table-column>
+      <el-table-column label="范围" align="center" prop="radius">
+        <template slot-scope="scope">
+          <el-tag v-for="item in scope.row.radius" :key="item.code" closable @close="btnDelRadius(scope.row,item)">
+            {{item.name}}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="增加范围" fixed="right" align="center">
+          <template slot-scope="scope">
+            <el-button size="mini" type="primary" icon="el-icon-plus" @click="btnAddRadius(scope.row)" circle/>
+          </template>
+        </el-table-column>
+    </el-table>
+    <div style="float:right">
+        <el-button type="primary" size="mini" @click="btnSave">保存</el-button>
+    </div>
+
+    <!-- 选择员工弹窗 -->
+    <el-dialog title="添加员工范围" :visible.sync="staffPopUp" width="1000px" append-to-body :close-on-click-modal="false">
+      <el-form size="mini" ref="queryForm" :model="queryParams" @submit.native.prevent :inline="true" label-width="68px">
+        <el-form-item label="员工" prop="staffCodeOrName">
+          <el-input v-model="queryParams.staffCodeOrName" clearable/>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" plain @click="btnSearch">搜索</el-button>
+          <el-button icon="el-icon-refresh" plain @click="btnReset">重置</el-button>
+        </el-form-item>
+      </el-form>
+      <el-table size="mini" height="500px" v-loading="loadingStaffPopUp" :data="staffList">
+          <el-table-column show-overflow-tooltip label="员工编码" align="center" prop="staffNo"/>
+          <el-table-column show-overflow-tooltip label="员工名称" align="center" prop="staffName"/>
+          <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
+          <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-plus"
+                @click="btnAddStaff(scope.row)"
+              >添加</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-pagination
+          background
+          @size-change="useChangePageSize"
+          @current-change="useCurrentChange"
+          :current-page="queryParams.pageNum"
+          :page-sizes="[10, 15, 20]"
+          :page-size="100"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total=total>
+      </el-pagination>
+    </el-dialog>
+
+    <!-- 选择部门弹窗 -->
+    <el-dialog title="添加部门范围" :visible.sync="deptPopUp" width="1000px" append-to-body :close-on-click-modal="false">
+      <el-cascader
+        size="mini"
+        v-model="treeValue"
+        :options="deptTree"
+        :props="{ checkStrictly: true }"
+        ref="cascaderHandle"
+        clearable
+        @change="handleChange"
+        placeholder=""
+        >
+      </el-cascader>
+      <el-button type="primary" size="mini" plain @click="btnAddDept">确认</el-button>
+    </el-dialog>
+
+    <!-- 选择部门弹窗 -->
+    <el-dialog title="分解结果" :visible.sync="salvagePopUp" width="1000px" append-to-body :close-on-click-modal="false">
+      <el-table size="mini" height="500px" v-loading="salvageLoading" :data="salvageList">
+        <el-table-column show-overflow-tooltip label="员工名称" align="center" prop="staffName"/>
+        <el-table-column show-overflow-tooltip label="员工编码" align="center" prop="staffNo"/>
+        <el-table-column show-overflow-tooltip label="调整人名称" align="center" prop="managerName"/>
+        <el-table-column show-overflow-tooltip label="调整人编码" align="center" prop="manager"/>
+      </el-table>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import { listPmScoreAdjustment} from "@/api/business/ehr/config/config";
+import { pmScoreAdjustmentList,pmScoreAdjustmentSave,pmScoreAdjustmentSalvageList} from "@/api/business/ehr/config/config";
+import { listStaff} from "@/api/business/ehr/ehr/staff";
+import { listDept} from "@/api/business/ehr/ehr/dept";
+import ElPopoverSelectV2 from "@/components/popover-select-v2"
 
 export default {
   name: "PmScoreAdjustmentConfig",
+  dicts: ['ehr_config_datatype'],
+  components: {ElPopoverSelectV2},
   data() {
     return {
       // 遮罩层
-      loading: false,
-      //员工数据权限
+      loading: true,
+      //数据
       data: null,
+      //是否打开员工弹窗
+      staffPopUp:false,
+      //员工查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10
+      },
+      //员工列表数据
+      staffList:[],
+      // 总条数
+      total: 0,
+      //员工弹窗遮罩层
+      loadingStaffPopUp: true,
+      //当前选择的行
+      curRow: null,
+      //是否打开部门弹窗
+      deptPopUp:false,
+      //部门列表
+      deptList: [],
+      //部门树
+      deptTree: [],
+      //当前选择的部门
+      treeValue: null,
+      //是否打开分解结果弹窗
+      salvagePopUp:false,
+      //分解结果数据
+      salvageList:[],
+      //分解结果loading
+      salvageLoading: true,
     };
   },
   async created() {
-    let res = await listPmScoreAdjustment();
+    this.loading = true;
+    let res = await pmScoreAdjustmentList();
     this.data = res.data;
+    this.loading = false;
+    listDept().then(response => {
+      this.deptList = response.rows;
+      this.deptList.forEach(function(element) {
+        element.parent_id = element.superiorsDept;
+        element.value = element.code;
+        element.label = element.name;
+      });
+      this.deptTree = this.arrayToTree(this.deptList,null);
+    });
   },
   methods: {
-    
+    //保存按钮
+    async btnSave(){
+      this.loading = true;
+      try {
+        let res = await pmScoreAdjustmentSave(this.data);
+        if(res.code == '200'){
+          this.$modal.msgSuccess("保存成功");
+          pmScoreAdjustmentList().then(res => {
+            this.data = res.data;
+            this.loading = false;
+          })
+        }else{
+          this.$modal.error("保存失败");
+        }
+      } catch (err) {
+        console.error(err);
+      } finally {
+        this.loading = false;
+      }
+      
+    },
+    //新增行按钮
+    btnAddRow(){
+      this.data.push({
+        "adjustment":"",
+        "adjustmentName":"",
+        "type":"1",
+        "radius":[]
+      });
+    },
+    //删行按钮
+    btnDelete(row){
+      this.data = this.data.filter(function(item) {
+        return item.staff != row.staff
+      });
+    },
+    //增加范围
+    async btnAddRadius(item){
+      this.curRow = item;
+      //员工
+      if(item.type == '0'){
+        //打开弹窗
+        this.staffPopUp = true;
+        //查询员工数据
+        await this.getStaffList();
+      }
+      if(item.type == '1'){
+        this.deptPopUp = true;
+      }
+    },
+    //删除范围
+    btnDelRadius(row,item){
+      row.radius = row.radius.filter(function(i) {
+        return i.code != item.code
+      });
+    },
+    //查询员工列表
+    async getStaffList(){
+      this.loadingStaffPopUp = true;
+      let res = await listStaff(this.queryParams);
+      this.staffList = res.rows;
+      this.total = res.total;
+      this.loadingStaffPopUp = false;
+    },
+    //搜索按钮
+    btnSearch(){
+      this.getStaffList();
+    },
+    //重置按钮
+    btnReset(){
+      this.resetForm("queryForm");
+      this.getStaffList();
+    },
+    //改变一页显示条数
+    useChangePageSize(val){
+      this.queryParams.pageSize = val
+      this.getStaffList()
+    },
+    //翻页
+    useCurrentChange(val){
+      this.queryParams.pageNum = val
+      this.getStaffList()
+    },
+    //添加员工
+    btnAddStaff(item){
+      this.curRow.radius.push({
+        code:item.staffNo,
+        name:item.staffName
+      });
+      this.staffPopUp = false;
+    },
+    //部门树
+    arrayToTree(data, pid) {
+      let result = []
+      this.getChildren(data, result, pid)
+      return result
+    },
+    getChildren(data, result, pid) {
+      for (const item of data) {
+        if (item.parent_id === pid) {
+          const newItem = { children: [], ...item }
+          result.push(newItem)
+          this.getChildren(data, newItem.children, item.code)
+        }
+      }
+    },
+    handleChange(value){
+      this.$refs.cascaderHandle.dropDownVisible = false;
+    },
+    //确认选择部门
+    btnAddDept(){
+      console.log("this.deptList",this.deptList);
+      let treeValue = this.treeValue[this.treeValue.length - 1];
+      console.log("treeValue",treeValue);
+      if(!treeValue){
+        this.$modal.msgWarning("请选择部门!");
+      }
+      let arr = this.deptList.filter(function(item) {
+        return item.code == treeValue;
+      });
+      console.log("arr",arr);
+      this.curRow.radius.push({
+        code:arr[0].code,
+        name:arr[0].name
+      });
+      this.deptPopUp = false;
+      this.treeValue = null;
+    },
+    //类型值改变
+    typeChange(e){
+      e.radius = [];
+    },
+    //查看结果按钮
+    async btnSeeRes(){
+      this.salvagePopUp = true;
+      this.salvageLoading  = true;
+      let res = await pmScoreAdjustmentSalvageList();
+      this.salvageList = res.data;
+      this.salvageLoading  = false;
+    }
   }
 };
 </script>
 
 <style lang="scss" scoped>
-
 </style>