|
@@ -10,10 +10,15 @@ import two2 from "@/assets/svg/1-1.svg";
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
import { Edit } from "@element-plus/icons-vue";
|
|
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
-import { postAddDimension, getDimensionRemove } from "@/api/dimension";
|
|
|
+import {
|
|
|
+ postAddDimension,
|
|
|
+ getDimensionRemove,
|
|
|
+ getQuotaByDimensionId
|
|
|
+} from "@/api/dimension";
|
|
|
import editMould from "./editMould.vue";
|
|
|
+import { delQuota } from "@/api/indexDefine";
|
|
|
import settingIndexDrawer from "./settingIndexDrawer.vue";
|
|
|
-import { postAddTemplate, getInfoRelation } from "@/api/templateInfo";
|
|
|
+import { postAddTemplate, getInfo, getListBy } from "@/api/templateInfo";
|
|
|
import importIndex from "./importIndex.vue";
|
|
|
import { useNav } from "@/layout/hooks/useNav";
|
|
|
const { toggleSideBar } = useNav();
|
|
@@ -24,6 +29,7 @@ const active = ref(0);
|
|
|
const editDrawer = ref();
|
|
|
const editDrawerShow = ref(false);
|
|
|
const titleShow = ref(false);
|
|
|
+
|
|
|
// 指标设置
|
|
|
const settingIndexDrawerRef = ref();
|
|
|
const settingIndexDrawerShow = ref(false);
|
|
@@ -41,18 +47,23 @@ onMounted(() => {
|
|
|
tepNameForm.id = route.query.id;
|
|
|
}
|
|
|
});
|
|
|
+const tableData = ref([]);
|
|
|
const tepNameForm = reactive({
|
|
|
tpName: "",
|
|
|
id: ""
|
|
|
});
|
|
|
+// 新建模板
|
|
|
const postAddTemplateApi = async () => {
|
|
|
const res = await postAddTemplate({ ...tepNameForm });
|
|
|
+ Object.assign(tepNameForm, {
|
|
|
+ tpName: "",
|
|
|
+ id: ""
|
|
|
+ });
|
|
|
if (res.code === 200) {
|
|
|
ElMessage({
|
|
|
message: "创建成功",
|
|
|
type: "success"
|
|
|
});
|
|
|
- console.log("res", res.data);
|
|
|
tepNameForm.tpName = res.data.tpName;
|
|
|
tepNameForm.id = res.data.id;
|
|
|
titleShow.value = true;
|
|
@@ -61,17 +72,53 @@ const postAddTemplateApi = async () => {
|
|
|
}
|
|
|
};
|
|
|
// 考核维度卡片
|
|
|
-const eaxmCard = ref([{ name: "工作量", value: 1 }]);
|
|
|
-// 获取指标信息
|
|
|
-const getInfoRelationApi = async () => {
|
|
|
- const { code, data, msg } = await getInfoRelation(tepNameForm.id);
|
|
|
- console.log("data", data);
|
|
|
+const eaxmCard = ref([]);
|
|
|
+// 获取维度
|
|
|
+const getListByApi = async () => {
|
|
|
+ console.log(tepNameForm.id);
|
|
|
+ const { code, data, msg } = await getListBy(tepNameForm.id);
|
|
|
+ Object.assign(tepNameForm, {
|
|
|
+ tpName: "",
|
|
|
+ id: ""
|
|
|
+ });
|
|
|
if (code === 200) {
|
|
|
titleShow.value = true;
|
|
|
+ eaxmCard.value = data;
|
|
|
+ eaxmCard.value.forEach(item => {
|
|
|
+ initializeTableData(item);
|
|
|
+ });
|
|
|
} else {
|
|
|
ElMessage.error(msg);
|
|
|
}
|
|
|
};
|
|
|
+// 获取指标信息
|
|
|
+const paramsIndex = reactive({
|
|
|
+ id: "",
|
|
|
+ tpId: "",
|
|
|
+ dimId: ""
|
|
|
+});
|
|
|
+const getQuotaByDimensionIdApi = async id => {
|
|
|
+ paramsIndex.dimId = id;
|
|
|
+ const { code, data, msg } = await getQuotaByDimensionId(paramsIndex);
|
|
|
+ if (code === 200) {
|
|
|
+ return data;
|
|
|
+ } else {
|
|
|
+ ElMessage.error(msg);
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+};
|
|
|
+const initializeTableData = async item => {
|
|
|
+ item.tableData = await getQuotaByDimensionIdApi(item.id);
|
|
|
+};
|
|
|
+const amountTo = itemList => {
|
|
|
+ let num = 0;
|
|
|
+ if (itemList) {
|
|
|
+ itemList.forEach(item => {
|
|
|
+ num = num + item.weight;
|
|
|
+ });
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+};
|
|
|
const addDimension = reactive({
|
|
|
list: [
|
|
|
{
|
|
@@ -95,37 +142,25 @@ const addDimension = reactive({
|
|
|
});
|
|
|
// 创建考核维度
|
|
|
const createAdd = () => {
|
|
|
- // eaxmCard.value.push({ name: "考核维度", value: eaxmCard.value.length + 1 });
|
|
|
- // ElMessage({
|
|
|
- // type: "success",
|
|
|
- // message: "创建成功"
|
|
|
- // });
|
|
|
- editDrawer.value.open();
|
|
|
+ editDrawer.value.open(tepNameForm, "新建");
|
|
|
};
|
|
|
const backChange = () => {
|
|
|
toggleSideBar();
|
|
|
router.back();
|
|
|
};
|
|
|
-const tableData = ref([
|
|
|
- {
|
|
|
- date: "2016-05-01",
|
|
|
- name: "Tom",
|
|
|
- state: "California",
|
|
|
- city: "Los Angeles",
|
|
|
- address: "No. 189, Grove St, Los Angeles",
|
|
|
- zip: "CA 90036"
|
|
|
- }
|
|
|
-]);
|
|
|
const save = () => {
|
|
|
formRef.value.validate(valid => {
|
|
|
if (valid) {
|
|
|
if (tepNameForm.id) {
|
|
|
- getInfoRelationApi();
|
|
|
+ getListByApi();
|
|
|
} else {
|
|
|
postAddTemplateApi();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ if (titleShow.value) {
|
|
|
+ router.back();
|
|
|
+ }
|
|
|
};
|
|
|
const deleteRow = row => {
|
|
|
console.log(row);
|
|
@@ -138,11 +173,17 @@ const deleteRow = row => {
|
|
|
type: "warning"
|
|
|
}
|
|
|
)
|
|
|
- .then(() => {
|
|
|
- ElMessage({
|
|
|
- type: "success",
|
|
|
- message: "删除成功"
|
|
|
- });
|
|
|
+ .then(async () => {
|
|
|
+ const { code, msg } = await delQuota(row.id);
|
|
|
+ if (code === 200) {
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功"
|
|
|
+ });
|
|
|
+ initializeTableData(row.dimId);
|
|
|
+ } else {
|
|
|
+ ElMessage.error(msg);
|
|
|
+ }
|
|
|
})
|
|
|
.catch(() => {
|
|
|
ElMessage({
|
|
@@ -153,7 +194,7 @@ const deleteRow = row => {
|
|
|
};
|
|
|
// 编辑
|
|
|
const editPen = item => {
|
|
|
- editDrawer.value.open(item);
|
|
|
+ editDrawer.value.open(item, "编辑");
|
|
|
};
|
|
|
// 删除考核维度
|
|
|
const deletePen = index => {
|
|
@@ -170,6 +211,7 @@ const deletePen = index => {
|
|
|
// eaxmCard.value.splice(index, 1);
|
|
|
const { code, msg } = await getDimensionRemove(index);
|
|
|
if (code === 200) {
|
|
|
+ getListByApi();
|
|
|
ElMessage({
|
|
|
type: "success",
|
|
|
message: "删除成功"
|
|
@@ -190,8 +232,7 @@ const settingIndex = row => {
|
|
|
settingIndexDrawerRef.value.open();
|
|
|
};
|
|
|
const importIndexDialog = row => {
|
|
|
- console.log(row);
|
|
|
- importIndexRef.value.open();
|
|
|
+ importIndexRef.value.open(row);
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -205,7 +246,11 @@ const importIndexDialog = row => {
|
|
|
v-model:drawerValue="settingIndexDrawerShow"
|
|
|
/>
|
|
|
<!-- 新增、编辑模块 -->
|
|
|
- <editMould ref="editDrawer" v-model:drawerValue="editDrawerShow" />
|
|
|
+ <editMould
|
|
|
+ ref="editDrawer"
|
|
|
+ v-model:drawerValue="editDrawerShow"
|
|
|
+ @handClick="getListByApi"
|
|
|
+ />
|
|
|
<div class="w-[100%] flex justify-evenly">
|
|
|
<div class="left-box">
|
|
|
<el-text class="cursor-pointer" @click="backChange"
|
|
@@ -268,27 +313,70 @@ const importIndexDialog = row => {
|
|
|
>
|
|
|
</div>
|
|
|
<el-card v-for="(item, index) in eaxmCard" :key="index" class="mb-3">
|
|
|
+ <!-- {{ getQuotaByDimensionIdApi(item.id) }} -->
|
|
|
<template #header>
|
|
|
<div class="card-header">
|
|
|
- <span>{{ item.name }}(30%)</span>
|
|
|
+ <span>{{ item.dimName }}({{ item.dimWeight }}%)</span>
|
|
|
<div class="float-right mr-7">
|
|
|
<el-icon class="mr-3" @click="editPen(item)"
|
|
|
><EditPen
|
|
|
/></el-icon>
|
|
|
- <el-icon @click="deletePen(index)"
|
|
|
+ <el-icon @click="deletePen(item.id)"
|
|
|
><Delete class="text-red-500"
|
|
|
/></el-icon>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <el-table :data="tableData" style="width: 100%" max-height="250">
|
|
|
- <el-table-column fixed prop="date" label="指标名称" width="150" />
|
|
|
- <el-table-column prop="name" label="指标说明" width="120" />
|
|
|
- <el-table-column prop="state" label="评价标准" width="300" />
|
|
|
- <el-table-column prop="state" label="数据来源" width="120" />
|
|
|
- <el-table-column prop="city" label="权重" width="120" />
|
|
|
- <el-table-column prop="name" label="分值" width="120" />
|
|
|
- <el-table-column prop="zip" label="目标值" width="120" />
|
|
|
+ <el-table :data="item.tableData" style="width: 100%" max-height="250">
|
|
|
+ <el-table-column fixed prop="name" label="指标名称" />
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.showIndicRemark"
|
|
|
+ prop="remark"
|
|
|
+ label="指标说明"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.showScoreRule"
|
|
|
+ prop="scoreRule"
|
|
|
+ label="评价标准"
|
|
|
+ width="300"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.showDatasource"
|
|
|
+ prop="stshowDatasourceate"
|
|
|
+ label="数据来源"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.mode"
|
|
|
+ prop="weight"
|
|
|
+ label="权重"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.showTargetValue"
|
|
|
+ prop="targetValue"
|
|
|
+ label="目标值"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.showFinalValue"
|
|
|
+ prop="finalValue"
|
|
|
+ label="完成值"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.showChallengeValue"
|
|
|
+ prop="challengeValue"
|
|
|
+ label="挑战值"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.showStartValue"
|
|
|
+ prop="startValue"
|
|
|
+ label="门槛值"
|
|
|
+ width="120"
|
|
|
+ />
|
|
|
<el-table-column fixed="right" label="操作">
|
|
|
<template #default="{ row }">
|
|
|
<el-icon class="mr-3" @click="settingIndex(row)"
|
|
@@ -302,9 +390,12 @@ const importIndexDialog = row => {
|
|
|
</el-table>
|
|
|
<template #footer>
|
|
|
<el-button type="primary" link class="mr-4"> 添加指标 </el-button>
|
|
|
- <el-button type="primary" link @click="importIndexDialog">
|
|
|
+ <el-button type="primary" link @click="importIndexDialog(item)">
|
|
|
导入指标
|
|
|
</el-button>
|
|
|
+ <span class="float-right num"
|
|
|
+ >指标权重合计:{{ amountTo(item.tableData) }}</span
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-card>
|
|
|
</div>
|
|
@@ -356,4 +447,13 @@ const importIndexDialog = row => {
|
|
|
color: #0006;
|
|
|
letter-spacing: 0;
|
|
|
}
|
|
|
+
|
|
|
+.num {
|
|
|
+ font-size: 14px;
|
|
|
+ // font-family: PingFangSC-Regular;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 22px;
|
|
|
+ color: #0009;
|
|
|
+ letter-spacing: 0;
|
|
|
+}
|
|
|
</style>
|