Pārlūkot izejas kodu

基础-员工技能添加或修改后获取最新数据,改为@close触发。

jiaxiaoqiang 10 mēneši atpakaļ
vecāks
revīzija
53a996367b

+ 228 - 189
src/views/base/skill/components/edit-skill.vue

@@ -6,8 +6,7 @@
       v-model="form"
       v-model="form"
       :data="data2"
       :data="data2"
       :option="option2"
       :option="option2"
-    >
-    </avue-form>
+    />
     <avue-crud
     <avue-crud
       ref="crudRef"
       ref="crudRef"
       v-model="form"
       v-model="form"
@@ -19,14 +18,8 @@
       @row-del="deleteRow"
       @row-del="deleteRow"
     >
     >
       <template #menu-left="{ size }">
       <template #menu-left="{ size }">
-        <el-button
-          type="primary"
-          icon="el-icon-plus"
-          circle
-          @click="addSkill"
-        ></el-button
-        ></template>
-
+        <el-button type="primary" icon="el-icon-plus" circle @click="addSkill"
+      /></template>
     </avue-crud>
     </avue-crud>
     <CommonTable
     <CommonTable
       ref="ctableRef"
       ref="ctableRef"
@@ -37,7 +30,6 @@
     <div class="detail-footer">
     <div class="detail-footer">
       <el-button type="primary" @click="onHandle"> 确定 </el-button>
       <el-button type="primary" @click="onHandle"> 确定 </el-button>
       <el-button @click="cancelWindow">取消</el-button>
       <el-button @click="cancelWindow">取消</el-button>
-
     </div>
     </div>
   </div>
   </div>
 </template>
 </template>
@@ -49,7 +41,11 @@ import { useCommonStoreHook, useDictionaryStore } from "@/store";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 import SingleUpload from "@/components/Upload/SingleUpload.vue";
 import SingleUpload from "@/components/Upload/SingleUpload.vue";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
-import {getPostSkill,addEmployeeSkill,getSkillDetail} from "@/api/system/skill";
+import {
+  getPostSkill,
+  addEmployeeSkill,
+  getSkillDetail,
+} from "@/api/system/skill";
 // 数据字典相关
 // 数据字典相关
 const { dicts } = useDictionaryStore();
 const { dicts } = useDictionaryStore();
 
 
@@ -57,15 +53,21 @@ const test = () => {
   isShowTable.value = true;
   isShowTable.value = true;
   tableType.value = tableType.value == 1 ? 2 : 1;
   tableType.value = tableType.value == 1 ? 2 : 1;
 };
 };
-const data3=ref([]);
-const data2=ref(null);
+const data3 = ref([]);
+const data2 = ref(null);
 // 传入一个url,后面不带/
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
   useCrud({
     src: "/api/v1/sys/skillScore",
     src: "/api/v1/sys/skillScore",
   });
   });
-const { dataList, createRow, updateRow, deleteRow, searchChange, dataNoPageList } =
-  Methords; //增删改查
+const {
+  dataList,
+  createRow,
+  updateRow,
+  deleteRow,
+  searchChange,
+  dataNoPageList,
+} = Methords; //增删改查
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
 // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
 // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
@@ -75,276 +77,313 @@ const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等
 //   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
 //   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
 //   menu: true,
 //   menu: true,
 // });
 // });
-const option2=ref(null);
+const option2 = ref(null);
 const ctableRef = ref(null); //crudRef.value 获取avue-crud对象
 const ctableRef = ref(null); //crudRef.value 获取avue-crud对象
 const router = useRouter();
 const router = useRouter();
 onMounted(() => {
 onMounted(() => {
   // console.log("crudRef", crudRef)
   // console.log("crudRef", crudRef)
-  getSkillDetail(props.skillId).then(
-    (data)=>{
-      form.value=data.data;
-    }
-  )
-  search.value.employeeSkillId=props.skillId;
+  getSkillDetail(props.skillId).then((data) => {
+    form.value = data.data;
+  });
+  search.value.employeeSkillId = props.skillId;
   dataNoPageList();
   dataNoPageList();
-
-
-
 });
 });
 
 
-const skillChange=(row)=>{
-  if(skillValue.value!==undefined&&skillValue.value!==null&&skillValue.value!==""){
-    data.value[row.$index].skillDictValue=skillValue.value;
+const skillChange = (row) => {
+  if (
+    skillValue.value !== undefined &&
+    skillValue.value !== null &&
+    skillValue.value !== ""
+  ) {
+    data.value[row.$index].skillDictValue = skillValue.value;
   }
   }
-}
-const cancelWindow=()=>{
-  props.editDialog.visible=false;
-}
+};
+const cancelWindow = () => {
+  props.editDialog.visible = false;
+};
 const addSkill = () => {
 const addSkill = () => {
-  const bom=ref({
-    $cellEdit:true,
+  const bom = ref({
+    $cellEdit: true,
   });
   });
   data.value.push(bom.value);
   data.value.push(bom.value);
 };
 };
-const employeeSkill=ref({});
-const onHandle=()=>{
+const employeeSkill = ref({});
+const onHandle = () => {
   console.info(form.value);
   console.info(form.value);
-  if(form.value.userId===null||form.value.userId===undefined||form.value.userId===""){
+  if (
+    form.value.userId === null ||
+    form.value.userId === undefined ||
+    form.value.userId === ""
+  ) {
     ElMessage({
     ElMessage({
       message: "未选择打分用户",
       message: "未选择打分用户",
       type: "error",
       type: "error",
     });
     });
     return false;
     return false;
   }
   }
-  if(form.value.postId===null||form.value.postId===undefined||form.value.postId===""){
+  if (
+    form.value.postId === null ||
+    form.value.postId === undefined ||
+    form.value.postId === ""
+  ) {
     ElMessage({
     ElMessage({
       message: "未选择岗位",
       message: "未选择岗位",
       type: "error",
       type: "error",
     });
     });
     return false;
     return false;
   }
   }
-  if(data.value.length===0){
+  if (data.value.length === 0) {
     ElMessage({
     ElMessage({
       message: "没有要保存的打分项",
       message: "没有要保存的打分项",
       type: "error",
       type: "error",
     });
     });
     return false;
     return false;
   }
   }
-  if(data.value.length>0){
-    for(let i=0;i<data.value.length;i++){
-      if(data.value[i].skillDictValue===undefined||data.value[i].skillDictValue===null||data.value[i].skillDictValue===""){
+  if (data.value.length > 0) {
+    for (let i = 0; i < data.value.length; i++) {
+      if (
+        data.value[i].skillDictValue === undefined ||
+        data.value[i].skillDictValue === null ||
+        data.value[i].skillDictValue === ""
+      ) {
         ElMessage({
         ElMessage({
-          message: "第"+(i+1)+"项没有选择技能",
+          message: "第" + (i + 1) + "项没有选择技能",
           type: "error",
           type: "error",
         });
         });
         return false;
         return false;
       }
       }
-      if(data.value[i].score===undefined||data.value[i].score===null||data.value[i].score===""){
+      if (
+        data.value[i].score === undefined ||
+        data.value[i].score === null ||
+        data.value[i].score === ""
+      ) {
         ElMessage({
         ElMessage({
-          message: "第"+(i+1)+"项没有打分",
+          message: "第" + (i + 1) + "项没有打分",
           type: "error",
           type: "error",
         });
         });
         return false;
         return false;
       }
       }
     }
     }
   }
   }
-  employeeSkill.value.userId=form.value.userId;
-  employeeSkill.value.postId=form.value.postId;
-  employeeSkill.value.skillList=Array.from(data.value);
-  employeeSkill.value.id=form.value.id;
-  addEmployeeSkill(employeeSkill.value).then(
-    (data)=>{
-      if(data.code==="200") {
-        ElMessage({
-          message: data.msg,
-          type: "success",
-        });
-        props.editDialog.visible=false;
-      }
-      else {
-        ElMessage({
-          message: data.msg,
-          type: "error",
-        });
-      }
+  employeeSkill.value.userId = form.value.userId;
+  employeeSkill.value.postId = form.value.postId;
+  employeeSkill.value.skillList = Array.from(data.value);
+  employeeSkill.value.id = form.value.id;
+  addEmployeeSkill(employeeSkill.value).then((data) => {
+    if (data.code === "200") {
+      ElMessage({
+        message: data.msg,
+        type: "success",
+      });
+      props.editDialog.visible = false;
+    } else {
+      ElMessage({
+        message: data.msg,
+        type: "error",
+      });
     }
     }
-  )
-
-}
+  });
+};
 // 设置表格列或者其他自定义的option
 // 设置表格列或者其他自定义的option
 option2.value = {
 option2.value = {
   selection: true,
   selection: true,
-  submitBtn:false,
-  clearAbleBtn:false,
-  emptyBtn:false,
+  submitBtn: false,
+  clearAbleBtn: false,
+  emptyBtn: false,
   column: [
   column: [
-    { label: "id", prop: "id", width: 130,overHidden: true,search: true ,
+    {
+      label: "id",
+      prop: "id",
+      width: 130,
+      overHidden: true,
+      search: true,
       filterable: true,
       filterable: true,
-      width: 100,overHidden: true,
-      disabled:false,
-      display:false,
-
+      width: 100,
+      overHidden: true,
+      disabled: false,
+      display: false,
     },
     },
 
 
-    { label: "用户id", prop: "userId", width: 130,overHidden: true,search: true ,
+    {
+      label: "用户id",
+      prop: "userId",
+      width: 130,
+      overHidden: true,
+      search: true,
       filterable: true,
       filterable: true,
-      width: 100,overHidden: true,
-      disabled:true,
-      display:false,
-
+      width: 100,
+      overHidden: true,
+      disabled: true,
+      display: false,
     },
     },
-    { label: "用户名", prop: "userName", width: 140,overHidden: true,search: true ,rules: [{
-        required: true,
-        search: true,
-        message: "请选择员工姓名",
-        trigger: "blur"
-      }],
+    {
+      label: "用户名",
+      prop: "userName",
+      width: 140,
+      overHidden: true,
+      search: true,
+      rules: [
+        {
+          required: true,
+          search: true,
+          message: "请选择员工姓名",
+          trigger: "blur",
+        },
+      ],
       click: ({ value, column }) => {
       click: ({ value, column }) => {
         ctableRef.value.startSelect();
         ctableRef.value.startSelect();
-      },},
-    { label: "所属机构", prop: "institution", width: 130,overHidden: true,search: true ,
+      },
+    },
+    {
+      label: "所属机构",
+      prop: "institution",
+      width: 130,
+      overHidden: true,
+      search: true,
       filterable: true,
       filterable: true,
-      width: 100,overHidden: true,
-      disabled:true,
-
+      width: 100,
+      overHidden: true,
+      disabled: true,
     },
     },
     {
     {
       label: "员工编号",
       label: "员工编号",
       prop: "employeeCode",
       prop: "employeeCode",
       search: true,
       search: true,
-      disabled:true,
+      disabled: true,
     },
     },
-    { label: "岗位", prop: "postName",
+    {
+      label: "岗位",
+      prop: "postName",
       search: true,
       search: true,
       filterable: true,
       filterable: true,
       overHidden: true,
       overHidden: true,
-      disabled:true,
-      dicUrl:dictDataUtil.post_list_url,
-      dicMethod:"post",
-      change:({ value, column })=>{
-       if(value!==undefined) {
-         props.postId = value;
-         skillValue.value=null;
-         optionSkill.value=null;
-         dataNoPageList();
-       }
+      disabled: true,
+      dicUrl: dictDataUtil.post_list_url,
+      dicMethod: "post",
+      change: ({ value, column }) => {
+        if (value !== undefined) {
+          props.postId = value;
+          skillValue.value = null;
+          optionSkill.value = null;
+          dataNoPageList();
+        }
       },
       },
       props: { label: "postName", value: "id" },
       props: { label: "postName", value: "id" },
-
     },
     },
-    { label: "部门", prop: "deptName", overHidden: true,
-      disabled:true, },
-
+    { label: "部门", prop: "deptName", overHidden: true, disabled: true },
   ],
   ],
 };
 };
-const postIdValue=ref({});
+const postIdValue = ref({});
 
 
 const props = defineProps({
 const props = defineProps({
-  editDialog:{
-    type:Object,
-    default:()=>{
+  editDialog: {
+    type: Object,
+    default: () => {
       return {};
       return {};
-    }
+    },
   },
   },
-  skillId:{
-    type:String,
-    default:()=>{
+  skillId: {
+    type: String,
+    default: () => {
       return "0";
       return "0";
-    }
+    },
   },
   },
-  postId:{
-    type:Number,
-    default:()=>{
+  postId: {
+    type: Number,
+    default: () => {
       return "0";
       return "0";
-    }
-  }
-
-})
-const postIdSkill=ref({});
+    },
+  },
+});
+const postIdSkill = ref({});
 // 设置表格列或者其他自定义的option
 // 设置表格列或者其他自定义的option
-option.value = Object.assign(option.value,{
+option.value = Object.assign(option.value, {
   selection: false,
   selection: false,
   addBtn: false,
   addBtn: false,
   viewBtn: false,
   viewBtn: false,
-  editBtn:false,
-  saveBtn:false,
+  editBtn: false,
+  saveBtn: false,
 
 
   cellBtn: true,
   cellBtn: true,
-  column: [{
-    label: "技能",
-    prop: "skillDictValue",
-    align: 'center',
-    headerAlign: 'center',
-    span:24,
-    cell: true,
-    type: 'select',
-    dicUrl: import.meta.env.VITE_APP_BASE_API + "/api/v1/sys/postSkill/list/"+props.postId,
-    props: {
-      label: "skillDictLabel", // 下拉菜单显示的字段
-      value: "skillDictValue", // 下拉菜单值的字段
+  column: [
+    {
+      label: "技能",
+      prop: "skillDictValue",
+      align: "center",
+      headerAlign: "center",
+      span: 24,
+      cell: true,
+      type: "select",
+      dicUrl:
+        import.meta.env.VITE_APP_BASE_API +
+        "/api/v1/sys/postSkill/list/" +
+        props.postId,
+      props: {
+        label: "skillDictLabel", // 下拉菜单显示的字段
+        value: "skillDictValue", // 下拉菜单值的字段
+      },
     },
     },
-  },
     {
     {
       label: "分数",
       label: "分数",
       prop: "score",
       prop: "score",
-      align: 'center',
-      headerAlign: 'center',
+      align: "center",
+      headerAlign: "center",
       cell: true,
       cell: true,
-      type:"number",
+      type: "number",
       precision: 2,
       precision: 2,
-      max:100,
-      min:0,
-      span:24,
-    },],
+      max: 100,
+      min: 0,
+      span: 24,
+    },
+  ],
 });
 });
-const onSelectedFinish=(selectedValue)=>{
-  form.value.userId=selectedValue.id;
-
-  form.value.userName=selectedValue.userName;
-  form.value.deptName=selectedValue.deptName;
-  form.value.employeeCode=selectedValue.employeeCode;
-  form.value.institution=selectedValue.institution;
+const onSelectedFinish = (selectedValue) => {
+  form.value.userId = selectedValue.id;
 
 
-}
-const skillValue=ref(null);
-const optionSkill=ref([]);
-const getPostSkills=()=>{
-  if(postIdValue.value===undefined||postIdValue.value===null||postIdValue.value===""){
+  form.value.userName = selectedValue.userName;
+  form.value.deptName = selectedValue.deptName;
+  form.value.employeeCode = selectedValue.employeeCode;
+  form.value.institution = selectedValue.institution;
+};
+const skillValue = ref(null);
+const optionSkill = ref([]);
+const getPostSkills = () => {
+  if (
+    postIdValue.value === undefined ||
+    postIdValue.value === null ||
+    postIdValue.value === ""
+  ) {
     ElMessage({
     ElMessage({
       message: "未选择岗位",
       message: "未选择岗位",
       type: "error",
       type: "error",
     });
     });
     return false;
     return false;
   }
   }
-  getPostSkill(postIdValue.value).then(
-    (data)=>{
-      optionSkill.value=Array.from(data.data);
-    }
-  )
-}
-
+  getPostSkill(postIdValue.value).then((data) => {
+    optionSkill.value = Array.from(data.data);
+  });
+};
 </script>
 </script>
 <style type="text/css">
 <style type="text/css">
-  .title-detail{
-    width: 30%;
-    height: 50px;
-    line-height: 50px;
-    margin: 25px 20px 25px 0;
-    float: left;
-  }
-  .detail{
-    margin: 0 auto;
-    width: 100%;
-  }
-  .avue-crud{
-    float: left;
-  }
-  .detail-footer{
-    float: right;
-    margin-top:15px;
-  }
-  .el-select__selection{
-    width: 150px;
-  }
-
+.title-detail {
+  width: 30%;
+  height: 50px;
+  line-height: 50px;
+  margin: 25px 20px 25px 0;
+  float: left;
+}
+.detail {
+  margin: 0 auto;
+  width: 100%;
+}
+.avue-crud {
+  float: left;
+}
+.detail-footer {
+  float: right;
+  margin-top: 15px;
+}
+.el-select__selection {
+  width: 150px;
+}
 </style>
 </style>

+ 201 - 166
src/views/base/skill/components/user-skill.vue

@@ -14,8 +14,7 @@
       @size-change="dataList"
       @size-change="dataList"
       @current-change="dataList"
       @current-change="dataList"
       @selection-change="selectionChange"
       @selection-change="selectionChange"
-    >
-    </avue-form>
+    />
     <avue-crud
     <avue-crud
       ref="crudRef"
       ref="crudRef"
       v-model="form"
       v-model="form"
@@ -26,26 +25,24 @@
       @row-update="updateRow"
       @row-update="updateRow"
       @row-del="deleteRow"
       @row-del="deleteRow"
     >
     >
-      <template #skillDictValue="{row,index,type}">
-        <el-select v-model="skillValue" placeholder="请选择技能" @click="getPostSkills()" @change="skillChange(row)">
+      <template #skillDictValue="{ row, index, type }">
+        <el-select
+          v-model="skillValue"
+          placeholder="请选择技能"
+          @click="getPostSkills()"
+          @change="skillChange(row)"
+        >
           <el-option
           <el-option
             v-for="item in optionSkill"
             v-for="item in optionSkill"
             :key="item.value"
             :key="item.value"
             :label="item.skillDictLabel"
             :label="item.skillDictLabel"
             :value="item.skillDictValue"
             :value="item.skillDictValue"
-          >
-          </el-option>
+          />
         </el-select>
         </el-select>
       </template>
       </template>
       <template #menu-left="{ size }">
       <template #menu-left="{ size }">
-        <el-button
-          type="primary"
-          icon="el-icon-plus"
-          circle
-          @click="addSkill"
-        ></el-button
-        ></template>
-
+        <el-button type="primary" icon="el-icon-plus" circle @click="addSkill"
+      /></template>
     </avue-crud>
     </avue-crud>
     <CommonTable
     <CommonTable
       ref="ctableRef"
       ref="ctableRef"
@@ -56,7 +53,6 @@
     <div class="detail-footer">
     <div class="detail-footer">
       <el-button type="primary" @click="onHandle"> 确定 </el-button>
       <el-button type="primary" @click="onHandle"> 确定 </el-button>
       <el-button @click="cancelWindow">取消</el-button>
       <el-button @click="cancelWindow">取消</el-button>
-
     </div>
     </div>
   </div>
   </div>
 </template>
 </template>
@@ -68,7 +64,7 @@ import { useCommonStoreHook, useDictionaryStore } from "@/store";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 import SingleUpload from "@/components/Upload/SingleUpload.vue";
 import SingleUpload from "@/components/Upload/SingleUpload.vue";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
-import {getPostSkill,addEmployeeSkill} from "@/api/system/skill";
+import { getPostSkill, addEmployeeSkill } from "@/api/system/skill";
 // 数据字典相关
 // 数据字典相关
 const { dicts } = useDictionaryStore();
 const { dicts } = useDictionaryStore();
 
 
@@ -76,14 +72,20 @@ const test = () => {
   isShowTable.value = true;
   isShowTable.value = true;
   tableType.value = tableType.value == 1 ? 2 : 1;
   tableType.value = tableType.value == 1 ? 2 : 1;
 };
 };
-const data2=ref(null);
+const data2 = ref(null);
 // 传入一个url,后面不带/
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
   useCrud({
     src: "/api/v1/sys/skillScore",
     src: "/api/v1/sys/skillScore",
   });
   });
-const { dataList, createRow, updateRow, deleteRow, searchChange, dataNoPageList } =
-  Methords; //增删改查
+const {
+  dataList,
+  createRow,
+  updateRow,
+  deleteRow,
+  searchChange,
+  dataNoPageList,
+} = Methords; //增删改查
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
 // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
 // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
@@ -93,244 +95,277 @@ const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等
 //   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
 //   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
 //   menu: true,
 //   menu: true,
 // });
 // });
-const option2=ref(null);
+const option2 = ref(null);
 const ctableRef = ref(null); //crudRef.value 获取avue-crud对象
 const ctableRef = ref(null); //crudRef.value 获取avue-crud对象
 const router = useRouter();
 const router = useRouter();
 
 
 onMounted(() => {
 onMounted(() => {
   // console.log("crudRef", crudRef)
   // console.log("crudRef", crudRef)
   //dataNoPageList();
   //dataNoPageList();
-
 });
 });
-const skillChange=(row)=>{
-  if(skillValue.value!==undefined&&skillValue.value!==null&&skillValue.value!==""){
-    data.value[row.$index].skillDictValue=skillValue.value;
+const skillChange = (row) => {
+  if (
+    skillValue.value !== undefined &&
+    skillValue.value !== null &&
+    skillValue.value !== ""
+  ) {
+    data.value[row.$index].skillDictValue = skillValue.value;
   }
   }
-}
-const cancelWindow=()=>{
-  props.dialog.visible=false;
-}
+};
+const cancelWindow = () => {
+  props.dialog.visible = false;
+};
 const addSkill = () => {
 const addSkill = () => {
-  const bom=ref({
-    $cellEdit:true,
+  const bom = ref({
+    $cellEdit: true,
   });
   });
   data.value.push(bom.value);
   data.value.push(bom.value);
 };
 };
-const employeeSkill=ref({});
-const onHandle=()=>{
+const employeeSkill = ref({});
+const onHandle = () => {
   console.info(form.value);
   console.info(form.value);
-  if(form.value.userId===null||form.value.userId===undefined||form.value.userId===""){
+  if (
+    form.value.userId === null ||
+    form.value.userId === undefined ||
+    form.value.userId === ""
+  ) {
     ElMessage({
     ElMessage({
       message: "未选择打分用户",
       message: "未选择打分用户",
       type: "error",
       type: "error",
     });
     });
     return false;
     return false;
   }
   }
-  if(form.value.postId===null||form.value.postId===undefined||form.value.postId===""){
+  if (
+    form.value.postId === null ||
+    form.value.postId === undefined ||
+    form.value.postId === ""
+  ) {
     ElMessage({
     ElMessage({
       message: "未选择岗位",
       message: "未选择岗位",
       type: "error",
       type: "error",
     });
     });
     return false;
     return false;
   }
   }
-  console.info("data",data.value);
-  if(data.value.length===0){
+  console.info("data", data.value);
+  if (data.value.length === 0) {
     ElMessage({
     ElMessage({
       message: "没有要保存的打分项",
       message: "没有要保存的打分项",
       type: "error",
       type: "error",
     });
     });
     return false;
     return false;
   }
   }
-  if(data.value.length>0){
-    for(let i=0;i<data.value.length;i++){
-      if(data.value[i].skillDictValue===undefined||data.value[i].skillDictValue===null||data.value[i].skillDictValue===""){
+  if (data.value.length > 0) {
+    for (let i = 0; i < data.value.length; i++) {
+      if (
+        data.value[i].skillDictValue === undefined ||
+        data.value[i].skillDictValue === null ||
+        data.value[i].skillDictValue === ""
+      ) {
         ElMessage({
         ElMessage({
-          message: "第"+(i+1)+"项没有选择技能",
+          message: "第" + (i + 1) + "项没有选择技能",
           type: "error",
           type: "error",
         });
         });
         return false;
         return false;
       }
       }
-      if(data.value[i].score===undefined||data.value[i].score===null||data.value[i].score===""){
+      if (
+        data.value[i].score === undefined ||
+        data.value[i].score === null ||
+        data.value[i].score === ""
+      ) {
         ElMessage({
         ElMessage({
-          message: "第"+(i+1)+"项没有打分",
+          message: "第" + (i + 1) + "项没有打分",
           type: "error",
           type: "error",
         });
         });
         return false;
         return false;
       }
       }
     }
     }
   }
   }
-  employeeSkill.value.userId=form.value.userId;
-  employeeSkill.value.postId=form.value.postId;
-  employeeSkill.value.skillList=Array.from(data.value);
-  console.info("11",employeeSkill.value)
-  addEmployeeSkill(employeeSkill.value).then(
-    (data)=>{
-      if(data.code==="200") {
-        ElMessage({
-          message: data.msg,
-          type: "success",
-        });
-        props.dialog.visible=false;
-      }
-      else {
-        ElMessage({
-          message: data.msg,
-          type: "error",
-        });
-      }
+  employeeSkill.value.userId = form.value.userId;
+  employeeSkill.value.postId = form.value.postId;
+  employeeSkill.value.skillList = Array.from(data.value);
+  console.info("11", employeeSkill.value);
+  addEmployeeSkill(employeeSkill.value).then((data) => {
+    if (data.code === "200") {
+      ElMessage({
+        message: data.msg,
+        type: "success",
+      });
+      props.dialog.visible = false;
+    } else {
+      ElMessage({
+        message: data.msg,
+        type: "error",
+      });
     }
     }
-  )
-
-}
+  });
+};
 
 
-const postIdValue=ref(null);
+const postIdValue = ref(null);
 // 设置表格列或者其他自定义的option
 // 设置表格列或者其他自定义的option
 option2.value = {
 option2.value = {
   selection: true,
   selection: true,
-  submitBtn:false,
-  clearAbleBtn:false,
-  emptyBtn:false,
+  submitBtn: false,
+  clearAbleBtn: false,
+  emptyBtn: false,
   column: [
   column: [
-
-    { label: "用户id", prop: "userId", width: 130,overHidden: true,search: true ,
+    {
+      label: "用户id",
+      prop: "userId",
+      width: 130,
+      overHidden: true,
+      search: true,
       filterable: true,
       filterable: true,
-      width: 100,overHidden: true,
-      disabled:true,
-      display:false,
-
+      width: 100,
+      overHidden: true,
+      disabled: true,
+      display: false,
     },
     },
-    { label: "用户名", prop: "userName", width: 140,overHidden: true,search: true ,rules: [{
-        required: true,
-        search: true,
-        message: "请选择员工姓名",
-        trigger: "blur"
-      }],
+    {
+      label: "用户名",
+      prop: "userName",
+      width: 140,
+      overHidden: true,
+      search: true,
+      rules: [
+        {
+          required: true,
+          search: true,
+          message: "请选择员工姓名",
+          trigger: "blur",
+        },
+      ],
       click: ({ value, column }) => {
       click: ({ value, column }) => {
         ctableRef.value.startSelect();
         ctableRef.value.startSelect();
-      },},
-    { label: "所属机构", prop: "institution", width: 130,overHidden: true,search: true ,
+      },
+    },
+    {
+      label: "所属机构",
+      prop: "institution",
+      width: 130,
+      overHidden: true,
+      search: true,
       filterable: true,
       filterable: true,
-      width: 100,overHidden: true,
-      disabled:true,
-
+      width: 100,
+      overHidden: true,
+      disabled: true,
     },
     },
     {
     {
       label: "员工编号",
       label: "员工编号",
       prop: "employeeCode",
       prop: "employeeCode",
       search: true,
       search: true,
-      disabled:true,
+      disabled: true,
     },
     },
-    { label: "岗位", prop: "postId",
+    {
+      label: "岗位",
+      prop: "postId",
       search: true,
       search: true,
       filterable: true,
       filterable: true,
       type: "select",
       type: "select",
       overHidden: true,
       overHidden: true,
-      dicUrl:dictDataUtil.post_list_url,
-      dicMethod:"post",
-      change:({ value, column })=>{
-       if(value!==undefined) {
-         postIdValue.value = value;
-         skillValue.value=null;
-         optionSkill.value=null;
-       }
+      dicUrl: dictDataUtil.post_list_url,
+      dicMethod: "post",
+      change: ({ value, column }) => {
+        if (value !== undefined) {
+          postIdValue.value = value;
+          skillValue.value = null;
+          optionSkill.value = null;
+        }
       },
       },
       props: { label: "postName", value: "id" },
       props: { label: "postName", value: "id" },
-
     },
     },
-    { label: "部门", prop: "deptName", overHidden: true,
-      disabled:true, },
-
+    { label: "部门", prop: "deptName", overHidden: true, disabled: true },
   ],
   ],
 };
 };
 
 
 const props = defineProps({
 const props = defineProps({
-  dialog:{
-    type:Object,
-    default:()=>{
+  dialog: {
+    type: Object,
+    default: () => {
       return {};
       return {};
-    }
-  }
-})
+    },
+  },
+});
 // 设置表格列或者其他自定义的option
 // 设置表格列或者其他自定义的option
-option.value = Object.assign(option.value,{
+option.value = Object.assign(option.value, {
   selection: false,
   selection: false,
   addBtn: false,
   addBtn: false,
   viewBtn: false,
   viewBtn: false,
-  editBtn:false,
-  saveBtn:false,
+  editBtn: false,
+  saveBtn: false,
 
 
   cellBtn: true,
   cellBtn: true,
-  column: [{
-    label: "技能",
-    prop: "skillDictValue",
-    align: 'center',
-    headerAlign: 'center',
-    span:24,
-    type: 'select',
-    dicData:dicts.skill_type,
-    props: { label: "dictLabel", value: "dictValue" },
-  },
+  column: [
+    {
+      label: "技能",
+      prop: "skillDictValue",
+      align: "center",
+      headerAlign: "center",
+      span: 24,
+      type: "select",
+      dicData: dicts.skill_type,
+      props: { label: "dictLabel", value: "dictValue" },
+    },
     {
     {
       label: "分数",
       label: "分数",
       prop: "score",
       prop: "score",
-      align: 'center',
-      headerAlign: 'center',
+      align: "center",
+      headerAlign: "center",
       cell: true,
       cell: true,
-      type:"number",
+      type: "number",
       precision: 2,
       precision: 2,
-      max:100,
-      min:0,
-      span:24,
-    },],
+      max: 100,
+      min: 0,
+      span: 24,
+    },
+  ],
 });
 });
-const onSelectedFinish=(selectedValue)=>{
-  form.value.userId=selectedValue.id;
+const onSelectedFinish = (selectedValue) => {
+  form.value.userId = selectedValue.id;
 
 
-  form.value.userName=selectedValue.userName;
-  form.value.deptName=selectedValue.deptName;
-  form.value.employeeCode=selectedValue.employeeCode;
-  form.value.institution=selectedValue.institution;
-
-}
-const skillValue=ref(null);
-const optionSkill=ref([]);
-const getPostSkills=()=>{
-  if(postIdValue.value===undefined||postIdValue.value===null||postIdValue.value===""){
+  form.value.userName = selectedValue.userName;
+  form.value.deptName = selectedValue.deptName;
+  form.value.employeeCode = selectedValue.employeeCode;
+  form.value.institution = selectedValue.institution;
+};
+const skillValue = ref(null);
+const optionSkill = ref([]);
+const getPostSkills = () => {
+  if (
+    postIdValue.value === undefined ||
+    postIdValue.value === null ||
+    postIdValue.value === ""
+  ) {
     ElMessage({
     ElMessage({
       message: "未选择岗位",
       message: "未选择岗位",
       type: "error",
       type: "error",
     });
     });
     return false;
     return false;
   }
   }
-  getPostSkill(postIdValue.value).then(
-    (data)=>{
-      optionSkill.value=Array.from(data.data);
-    }
-  )
-}
-
+  getPostSkill(postIdValue.value).then((data) => {
+    optionSkill.value = Array.from(data.data);
+  });
+};
 </script>
 </script>
 <style type="text/css">
 <style type="text/css">
-  .title-detail{
-    width: 30%;
-    height: 50px;
-    line-height: 50px;
-    margin: 25px 20px 25px 0;
-    float: left;
-  }
-  .detail{
-    margin: 0 auto;
-    width: 100%;
-  }
-  .avue-crud{
-    float: left;
-  }
-  .detail-footer{
-    float: right;
-    margin-top:15px;
-  }
-  .el-select__selection{
-    width: 150px;
-  }
-
+.title-detail {
+  width: 30%;
+  height: 50px;
+  line-height: 50px;
+  margin: 25px 20px 25px 0;
+  float: left;
+}
+.detail {
+  margin: 0 auto;
+  width: 100%;
+}
+.avue-crud {
+  float: left;
+}
+.detail-footer {
+  float: right;
+  margin-top: 15px;
+}
+.el-select__selection {
+  width: 150px;
+}
 </style>
 </style>

+ 87 - 68
src/views/base/skill/index.vue

@@ -21,7 +21,7 @@
           icon="el-icon-plus"
           icon="el-icon-plus"
           :size="size"
           :size="size"
           @click="addRow"
           @click="addRow"
-        >新增</el-button
+          >新增</el-button
         >
         >
         <el-button
         <el-button
           :disabled="toDeleteIds.length < 1"
           :disabled="toDeleteIds.length < 1"
@@ -30,30 +30,33 @@
           :size="size"
           :size="size"
           @click="multipleDelete"
           @click="multipleDelete"
           >删除</el-button
           >删除</el-button
-        ></template>
-        <template #menu="{row,index,type}">
-          <el-button @click="editSkills(row)"
-                     icon="el-icon-edit"
-                     text
-                     type="primary"
-          >编辑</el-button>
-          <el-button @click="viewSkills(row)"
-                     icon="el-icon-view"
-                     text
-                     type="primary"
-          >查看</el-button>
-        </template>
-
-
+        ></template
+      >
+      <template #menu="{ row, index, type }">
+        <el-button
+          @click="editSkills(row)"
+          icon="el-icon-edit"
+          text
+          type="primary"
+          >编辑</el-button
+        >
+        <el-button
+          @click="viewSkills(row)"
+          icon="el-icon-view"
+          text
+          type="primary"
+          >查看</el-button
+        >
+      </template>
     </avue-crud>
     </avue-crud>
     <el-dialog
     <el-dialog
       v-model="dialog.visible"
       v-model="dialog.visible"
       :title="dialog.title"
       :title="dialog.title"
       width="800px"
       width="800px"
       :destroy-on-close="true"
       :destroy-on-close="true"
-      @close="dialog.visible = false"
+      @close="addClose"
     >
     >
-      <user-skill   :dialog="dialog"/>
+      <user-skill :dialog="dialog" />
     </el-dialog>
     </el-dialog>
 
 
     <el-dialog
     <el-dialog
@@ -63,16 +66,24 @@
       :destroy-on-close="true"
       :destroy-on-close="true"
       @close="editClose"
       @close="editClose"
     >
     >
-      <editSkill   :editDialog="editDialog" :skillId="editUser.id" :postId="editUser.postId"/>
+      <editSkill
+        :editDialog="editDialog"
+        :skillId="editUser.id"
+        :postId="editUser.postId"
+      />
     </el-dialog>
     </el-dialog>
     <el-dialog
     <el-dialog
       v-model="viewDialog.visible"
       v-model="viewDialog.visible"
       :title="viewDialog.title"
       :title="viewDialog.title"
       width="800px"
       width="800px"
       :destroy-on-close="true"
       :destroy-on-close="true"
-      @close="viewDialog.visible=false"
+      @close="viewDialog.visible = false"
     >
     >
-      <viewSkill   :viewDialog="viewDialog" :skillId="viewUser.id" :postId="viewUser.postId"/>
+      <viewSkill
+        :viewDialog="viewDialog"
+        :skillId="viewUser.id"
+        :postId="viewUser.postId"
+      />
     </el-dialog>
     </el-dialog>
   </div>
   </div>
 </template>
 </template>
@@ -82,8 +93,8 @@ import { useCrud } from "@/hooks/userCrud";
 import ButtonPermKeys from "@/common/configs/buttonPermission";
 import ButtonPermKeys from "@/common/configs/buttonPermission";
 import { useCommonStoreHook, useDictionaryStore } from "@/store";
 import { useCommonStoreHook, useDictionaryStore } from "@/store";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 import dictDataUtil from "@/common/configs/dictDataUtil";
-import editSkill from "@/views/base/skill/components/edit-skill.vue"
-import viewSkill from "@/views/base/skill/components/view-skill.vue"
+import editSkill from "@/views/base/skill/components/edit-skill.vue";
+import viewSkill from "@/views/base/skill/components/view-skill.vue";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 // 数据字典相关
 // 数据字典相关
 const { dicts } = useDictionaryStore();
 const { dicts } = useDictionaryStore();
@@ -106,13 +117,18 @@ const viewDialog = reactive({
   title: "查看",
   title: "查看",
   visible: false,
   visible: false,
 });
 });
-const editClose=()=>{
+
+const addClose = () => {
+  dialog.visible = false;
+  dataList();
+};
+const editClose = () => {
   editDialog.visible = false;
   editDialog.visible = false;
   dataList();
   dataList();
-}
-const addRow=()=>{
-  dialog.visible=true;
-}
+};
+const addRow = () => {
+  dialog.visible = true;
+};
 // 传入一个url,后面不带/
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
   useCrud({
@@ -138,8 +154,6 @@ onMounted(() => {
   dataList();
   dataList();
 });
 });
 
 
-
-
 /**
 /**
  * 上传excel相关
  * 上传excel相关
  */
  */
@@ -154,63 +168,69 @@ const importExcelData = () => {
     uploadRef.value.show("/api/v1/plan/order/import");
     uploadRef.value.show("/api/v1/plan/order/import");
   }
   }
 };
 };
-const editUser=ref(null);
-const viewUser=ref(null);
-const editSkills=(row)=>{
-  editDialog.visible=true;
-  editUser.value=row;
-
-}
-const viewSkills=(row)=>{
-  viewDialog.visible=true;
-  viewUser.value=row;
-
-}
+const editUser = ref(null);
+const viewUser = ref(null);
+const editSkills = (row) => {
+  editDialog.visible = true;
+  editUser.value = row;
+};
+const viewSkills = (row) => {
+  viewDialog.visible = true;
+  viewUser.value = row;
+};
 // 设置表格列或者其他自定义的option
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
 option.value = Object.assign(option.value, {
   selection: true,
   selection: true,
-  addBtn:false,
-  viewBtn:false,
-  editBtn:false,
+  addBtn: false,
+  viewBtn: false,
+  editBtn: false,
   column: [
   column: [
-
-
-    { label: "所属机构", prop: "institution", width: 130,
+    {
+      label: "所属机构",
+      prop: "institution",
+      width: 130,
       search: true,
       search: true,
       filterable: true,
       filterable: true,
       type: "select",
       type: "select",
       overHidden: true,
       overHidden: true,
-      dicUrl:dictDataUtil.dept_list_url,
-      dicMethod:"post",
+      dicUrl: dictDataUtil.dept_list_url,
+      dicMethod: "post",
       props: { label: "deptName", value: "id" },
       props: { label: "deptName", value: "id" },
-      disabled:true,
-
+      disabled: true,
     },
     },
-    { label: "员工姓名", prop: "userName", width: 140,overHidden: true,search: true ,rules: [{
-        required: true,
-        search: true,
-        message: "请选择员工姓名",
-        trigger: "blur"
-      }],
+    {
+      label: "员工姓名",
+      prop: "userName",
+      width: 140,
+      overHidden: true,
+      search: true,
+      rules: [
+        {
+          required: true,
+          search: true,
+          message: "请选择员工姓名",
+          trigger: "blur",
+        },
+      ],
     },
     },
     {
     {
       label: "员工编号",
       label: "员工编号",
       prop: "employeeCode",
       prop: "employeeCode",
       search: true,
       search: true,
-      disabled:true,
+      disabled: true,
     },
     },
-    { label: "岗位", prop: "postId",
+    {
+      label: "岗位",
+      prop: "postId",
       search: true,
       search: true,
       filterable: true,
       filterable: true,
       type: "select",
       type: "select",
       overHidden: true,
       overHidden: true,
-      dicUrl:dictDataUtil.post_list_url,
-      dicMethod:"post",
+      dicUrl: dictDataUtil.post_list_url,
+      dicMethod: "post",
       props: { label: "postName", value: "id" },
       props: { label: "postName", value: "id" },
-
     },
     },
-    { label: "部门", prop: "deptName", overHidden: true,
-      disabled:true, },
+    { label: "部门", prop: "deptName", overHidden: true, disabled: true },
     {
     {
       label: "分数",
       label: "分数",
       prop: "scopes",
       prop: "scopes",
@@ -218,8 +238,7 @@ option.value = Object.assign(option.value, {
     },
     },
   ],
   ],
 });
 });
-const onSelectedFinish=()=>{
-
-}
+const onSelectedFinish = () => {};
 
 
+// 数据保存成功需要更新列表
 </script>
 </script>