Browse Source

fix: bug修复

ystl_myq 2 weeks ago
parent
commit
b6978fd566

+ 10 - 0
src/api/assessment.ts

@@ -58,3 +58,13 @@ export const getAssessmentQuotaDetails = params => {
     }
   );
 };
+// 考核指标修改
+export const updateAssessmentQuotaDetails = data => {
+  return http.request<addDept>(
+    "post",
+    "/assessment/updateAssessmentQuotaDetails",
+    {
+      data
+    }
+  );
+};

+ 0 - 2
src/api/department.ts

@@ -36,8 +36,6 @@ export const treeDept = ref([]);
 export const postListTreeWithUserApi = async () => {
   const res = await postListTreeWithUser();
   treeDept.value = transformData(res.data);
-  console.log("res,data", res.data);
-  console.log("过滤的数据.", treeDept.value);
 };
 const transformData = data => {
   // 基本的转换逻辑

+ 7 - 0
src/api/templateInfo.ts

@@ -84,3 +84,10 @@ export const calculateScoreByConditionMoCondition = data => {
     }
   );
 };
+// 删除指标
+export const deleteIndicator = id => {
+  return http.request<templateInfoList>(
+    "get",
+    `/templateIndicatorRelation/remove/${id}`
+  );
+};

+ 11 - 6
src/views/evaluate/children/change/components/newAdd.vue

@@ -13,7 +13,7 @@ import { ElMessageBox, ElMessage } from "element-plus";
 import { postAddRelationList, postUpdateDept } from "@/api/dimension";
 import { useAppStoreHook } from "@/store/modules/app";
 import { addQuota } from "@/api/indexDefine";
-import { postUpdateTemplateIn } from "@/api/templateInfo";
+import { postUpdateTemplateIn, deleteIndicator } from "@/api/templateInfo";
 import {
   postAddDimension,
   getDimensionRemove,
@@ -223,13 +223,14 @@ const deleteRow = row => {
     }
   )
     .then(async () => {
-      const { code, msg } = await delQuota(row.id);
+      const { code, msg } = await deleteIndicator(row.id);
       if (code === 200) {
         ElMessage({
           type: "success",
           message: "删除成功"
         });
-        initializeTableData(row.dimId);
+        // initializeTableData(row.dimId);
+        getListByApi();
       } else {
         ElMessage.error(msg);
       }
@@ -363,7 +364,7 @@ const postUpdateApi = async () => {
   // indexOf.indName = indexOf.name
   const { code, msg } = await postUpdate(indexOf);
   if (code == 200) {
-    getListByApi(indexOf.dimId);
+    getListByApi();
     ElMessage.success("编辑成功");
   } else {
     ElMessage.error(msg);
@@ -409,7 +410,6 @@ const editClosedEvent = ({ row, column }) => {
     postUpdateApi();
   }
 };
-// const aa =
 </script>
 
 <template>
@@ -576,7 +576,6 @@ const editClosedEvent = ({ row, column }) => {
                 v-if="item.showDatasource"
                 field="stshowDatasourceate"
                 title="数据来源"
-                :edit-render="{ name: 'input' }"
               />
               <vxe-column
                 v-if="item.mode"
@@ -585,6 +584,12 @@ const editClosedEvent = ({ row, column }) => {
                 :edit-render="{ name: 'input' }"
               />
               <vxe-column
+                v-if="item.scoreValue"
+                field="scoreValue"
+                title="分值"
+                :edit-render="{ name: 'input' }"
+              />
+              <vxe-column
                 v-if="item.showTargetValue"
                 field="targetValue"
                 title="目标值"

+ 18 - 10
src/views/evaluate/children/change/components/settingIndexDrawer.vue

@@ -332,17 +332,24 @@ const removeVoid = () => {
   params.formula.noConditionFormula = "";
 };
 // 计算确认
+//
+const calculatorShow = ref(true);
 const count = item => {
-  try {
-    calculator.calculate(rolesList.value);
-    rolesList.num = calculator.get();
-  } catch (error) {
-    ElMessage({
-      message: "计算错误",
-      type: "warning"
-    });
-    console.log(error);
-  }
+  ElMessageBox.confirm("配置项确认保存?确认关闭", {
+    type: "warning"
+  }).then(() => {
+    calculatorShow.value = false;
+  });
+  // try {
+  //   calculator.calculate(rolesList.value);
+  //   rolesList.num = calculator.get();
+  // } catch (error) {
+  //   ElMessage({
+  //     message: "计算错误",
+  //     type: "warning"
+  //   });
+  //   console.log(error);
+  // }
 };
 // 多条件公式
 const addmanyChange = reactive({
@@ -522,6 +529,7 @@ const manyConditions = () => {
                     </el-text>
                   </div>
                   <div
+                    v-if="calculatorShow"
                     class="w-[500px] compute h-64 mt-1 ml-12 flex justify-evenly items-center"
                     style="user-select: none"
                   >

+ 34 - 14
src/views/evaluate/children/change/manage/addExam.vue

@@ -4,7 +4,7 @@ import { ElMessageBox, ElMessage } from "element-plus";
 import { Calendar } from "@element-plus/icons-vue";
 import dayjs from "dayjs";
 import { postAddAssessment } from "@/api/assessment";
-import { postListTreeWithUser } from "@/api/department";
+import { postListTreeWithUser, postListTree } from "@/api/department";
 import { encryption } from "@/utils/encrypt";
 // 人员,医疗组,负责人
 import {
@@ -253,6 +253,7 @@ const aaaa = a => {
   console.log(a);
 };
 // 考核类型
+const dpetTree = ref();
 const assessmentTypeApi = async value => {
   // 人员,医疗组,负责人
   const { data, code } = await getTemplateInfoList(templateparams);
@@ -266,15 +267,11 @@ const assessmentTypeApi = async value => {
   const rolesName = localStorage.getItem("rolesName");
   switch (value) {
     case 0:
-      const yuangong = await postUserList({
-        username: encryption(rolesName),
-        password: encryption(password)
-      });
-      console.log(yuangong);
-      treeDept.value = yuangong.data;
+      postListTreeWithUserApi();
       break;
     case 1:
-      postListTreeWithUserApi();
+      const { data, code } = await postListTree();
+      dpetTree.value = data;
       break;
     case 2:
       const yiliao = await postOrganizationUserPage({
@@ -346,14 +343,18 @@ defineExpose({
                     class="cursor-pointer ml-4 text-xs pt-2"
                     @click="decreaseYear"
                   >
-                    <el-icon><DArrowLeft /></el-icon>
+                    <el-icon>
+                      <DArrowLeft />
+                    </el-icon>
                   </div>
                   <div>{{ yearTime }}</div>
                   <div
                     class="cursor-pointer mr-4 text-xs pt-2"
                     @click="increaseYear"
                   >
-                    <el-icon><DArrowRight /></el-icon>
+                    <el-icon>
+                      <DArrowRight />
+                    </el-icon>
                   </div>
                 </div>
                 <div
@@ -416,7 +417,7 @@ defineExpose({
                     class="w-full mt-1"
                   >
                     <el-tree-select
-                      v-if="form.assessmentType === 1"
+                      v-if="form.assessmentType === 0"
                       ref="assessmentTypeRef"
                       v-model="item.assessmentObjectId"
                       :data="treeDept"
@@ -430,8 +431,25 @@ defineExpose({
                       style="width: 180px"
                       @check-change="handleRreeSelect(index)"
                     />
+                    <el-tree-select
+                      v-if="form.assessmentType === 1"
+                      ref="assessmentTypeRef"
+                      v-model="item.assessmentObjectId"
+                      :data="dpetTree"
+                      :render-after-expand="false"
+                      show-checkbox
+                      :props="{
+                        label: 'deptName',
+                        value: 'deptCode',
+                        children: 'childrenRes'
+                      }"
+                      style="width: 180px"
+                      @check-change="handleRreeSelect(index)"
+                    />
                     <el-select
-                      v-if="form.assessmentType != 1"
+                      v-if="
+                        form.assessmentType != 0 && form.assessmentType != 1
+                      "
                       v-model="item.assessmentObjectId"
                       @change="handChange"
                     >
@@ -480,7 +498,9 @@ defineExpose({
                       @click="deleteItem(index)"
                     >
                       <el-text type="danger">
-                        <el-icon><Delete /></el-icon>
+                        <el-icon>
+                          <Delete />
+                        </el-icon>
                       </el-text>
                     </div>
                   </div>
@@ -493,7 +513,7 @@ defineExpose({
           <template #label>
             <div class="cursor-pointer w-14" @click="addNew">
               <el-text type="primary">
-                <el-icon><Plus /></el-icon>添加
+                <el-icon> <Plus /> </el-icon>添加
               </el-text>
             </div>
           </template>

+ 86 - 42
src/views/evaluate/children/change/mould/manageObject.vue

@@ -7,7 +7,9 @@ import { ref, reactive, onMounted } from "vue";
 import {
   getAssessmentQuotaDetails,
   delAssessmentObject,
-  getAssessmentObjectDetails
+  getAssessmentObjectDetails,
+  postAddAssessmentObject,
+  updateAssessmentQuotaDetails
 } from "@/api/assessment";
 import { getTemplateInfoList } from "@/api/templateInfo";
 import { useRouter } from "vue-router";
@@ -80,6 +82,7 @@ onMounted(() => {
 const getAssessmentQuotaDetailsApi = async () => {
   const res = await getAssessmentQuotaDetails(initParams.indexParams);
   if (res.code === 200) {
+    console.log("指标分页查询", res);
     initParams.Indexlist = res.data.records;
     initParams.total1 = res.data.totalRow;
   }
@@ -101,7 +104,8 @@ const addPersonParams = reactive({
   assessmentId: "",
   objectAddVoList: []
 });
-const aaa = ref();
+// 添加被考核人
+const value1 = ref();
 const delAssessmentObjectApi = async () => {
   if (valSelection.value) {
     ElMessageBox.confirm(
@@ -154,32 +158,6 @@ const changeSelection = val => {
 };
 const router = useRouter();
 const activeName = ref("first");
-const tableData = [
-  {
-    date: "2016-05-03",
-    name: "Tom",
-    address: "No. 189, Grove St, Los Angeles",
-    show: false
-  },
-  {
-    date: "2016-05-02",
-    name: "Tom",
-    address: "No. 189, Grove St, Los Angeles",
-    show: false
-  },
-  {
-    date: "2016-05-04",
-    name: "Tom",
-    address: "No. 189, Grove St, Los Angeles",
-    show: false
-  },
-  {
-    date: "2016-05-01",
-    name: "Tom",
-    address: "No. 189, Grove St, Los Angeles",
-    show: false
-  }
-];
 // 批量导入
 const addsImport = () => {
   router.push({ name: "importIndex", query: { ...messageData.value } });
@@ -195,6 +173,10 @@ const publish = () => {
 // 添加被考核人
 const dialogVisibleAdd = ref(false);
 const handleRreeSelect = data => {
+  addPersonParams.objectAddVoList.push({
+    assessmentObjectId: data.userCode,
+    assessmentObjectName: data.userName
+  });
   console.log("1111111", data);
 };
 const dialogVisibleAddShow = () => {
@@ -236,6 +218,37 @@ const handleCurrentIndexChange = (val: number) => {
   initParams.indexParams.pageNumber = val;
   getAssessmentQuotaDetailsApi();
 };
+// 指标修改
+const updateAssessmentQuotaDetailsApi = async row => {
+  const { msg, code } = await updateAssessmentQuotaDetails({
+    relationId: row.relationId,
+    id: row.id,
+    dimId: row.dimId,
+    assessmentObjectId: row.assessmentObjectId,
+    assessmentModelId: row.assessmentModelId,
+    score: row.score,
+    finalValue: row.finalValue
+  });
+  if (code === 200) {
+    ElMessage.success("修改成功");
+  } else {
+    ElMessage.error(msg);
+  }
+};
+const tableVxeRef = ref();
+const editConfig = ref({
+  trigger: "click",
+  mode: "cell"
+});
+const editClosedEvent = ({ row, column }) => {
+  console.log("row", row);
+  const $table = tableVxeRef.value;
+  if ($table) {
+    updateAssessmentQuotaDetailsApi(row);
+    // Object.assign(indexOf, row);
+    // postUpdateApi();
+  }
+};
 </script>
 
 <template>
@@ -384,12 +397,48 @@ const handleCurrentIndexChange = (val: number) => {
             </Auth>
           </div>
         </div>
-        <el-table
+        <vxe-table
+          ref="tableVxeRef"
+          class="mt-3"
+          show-overflow
+          :edit-config="editConfig"
           :data="initParams.Indexlist"
-          style="width: 100%"
           max-height="250"
+          @edit-closed="editClosedEvent"
           @selection-change="changeSelection"
         >
+          <vxe-column type="checkbox" width="60" />
+          <vxe-column field="realName" fixed title="人员" width="100" />
+          <vxe-column field="userName" fixed title="工号" width="180" />
+          <vxe-column field="deptName" fixed title="部门" width="180" />
+          <vxe-column field="name" fixed title="指标名称" width="180" />
+          <vxe-column field="scoreRule" fixed title="评价标准" width="180" />
+          <vxe-column field="source" fixed title="数据来源" width="180" />
+          <vxe-column field="targetValue" fixed title="目标值" width="180" />
+          <vxe-column
+            field="finalValue"
+            fixed
+            title="完成值"
+            :edit-render="{ name: 'input' }"
+            width="180"
+          />
+          <vxe-column
+            field="score"
+            fixed
+            title="得分"
+            :edit-render="{ name: 'input' }"
+            width="180"
+          />
+          <vxe-column field="updateTime" title="更新时间" sortable width="180">
+            <template #default="{ row }">
+              {{ dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss") }}
+            </template>
+          </vxe-column>
+          <vxe-column field="updateTime" title="操作" fixed="right" width="180">
+            <template #default> - </template>
+          </vxe-column>
+        </vxe-table>
+        <!-- <el-table :data="initParams.Indexlist" style="width: 100%" max-height="250" @selection-change="changeSelection">
           <el-table-column type="selection" width="55" />
           <el-table-column prop="realName" label="人员" width="100" />
           <el-table-column prop="userName" label="工号" width="180" />
@@ -400,22 +449,17 @@ const handleCurrentIndexChange = (val: number) => {
           <el-table-column prop="targetValue" label="目标值" width="180" />
           <el-table-column prop="finalValue" label="完成值" width="180" />
           <el-table-column prop="score" label="得分" width="180" />
-          <el-table-column
-            prop="updateTime"
-            label="更新时间"
-            width="150"
-            sortable
-          >
+          <el-table-column prop="updateTime" label="更新时间" width="150" sortable>
             <template #default="{ row }">
               {{ dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss") }}
             </template>
           </el-table-column>
           <el-table-column label="操作" width="200" fixed="right">
             <template #default>
-              <!-- <el-icon @click="GoView(row)"><View /></el-icon> -->-
+              -
             </template>
           </el-table-column>
-        </el-table>
+        </el-table> -->
         <div class="flex justify-between item-center">
           <div class="float-left mt-5 ml-2 total">
             <!-- 共{{ initParams.total1 }}条数据 -->
@@ -441,7 +485,7 @@ const handleCurrentIndexChange = (val: number) => {
       </el-tab-pane>
     </el-tabs>
     <!-- 添加被考核人 -->
-    <el-dialog v-model="dialogVisibleAdd" title="添加被考核人" width="744">
+    <el-dialog v-model="dialogVisibleAdd" title="添加被考核人" width="500">
       <div>
         <el-form
           ref="ruleFormRef"
@@ -451,20 +495,20 @@ const handleCurrentIndexChange = (val: number) => {
         >
           <el-form-item label="维度权重" label-position="top">
             <el-tree-select
-              v-model="aaa"
+              v-model="value1"
               :data="treeDept"
               multiple
               :props="{
                 label: 'userName',
                 value: 'userCode',
-                children: 'childrenRes'
+                children: 'children'
               }"
               :render-after-expand="false"
               show-checkbox
               check-strictly
               check-on-click-node
               style="width: 240px"
-              @node-click="handleRreeSelect"
+              @check-change="handleRreeSelect"
             />
           </el-form-item>
         </el-form>