|
@@ -10,7 +10,7 @@ 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 { postAddRelationList } from "@/api/dimension";
|
|
|
+import { postAddRelationList, postUpdateDept } from "@/api/dimension";
|
|
|
import { useAppStoreHook } from "@/store/modules/app";
|
|
|
import {
|
|
|
postAddDimension,
|
|
@@ -18,9 +18,20 @@ import {
|
|
|
getQuotaByDimensionId
|
|
|
} from "@/api/dimension";
|
|
|
import editMould from "./editMould.vue";
|
|
|
+import {
|
|
|
+ VueDraggable,
|
|
|
+ useDraggable,
|
|
|
+ type DraggableEvent,
|
|
|
+ type UseDraggableReturn
|
|
|
+} from "vue-draggable-plus";
|
|
|
import { delQuota } from "@/api/indexDefine";
|
|
|
import settingIndexDrawer from "./settingIndexDrawer.vue";
|
|
|
-import { postAddTemplate, getInfo, getListBy } from "@/api/templateInfo";
|
|
|
+import {
|
|
|
+ postAddTemplate,
|
|
|
+ getInfo,
|
|
|
+ getListBy,
|
|
|
+ postUpdate
|
|
|
+} from "@/api/templateInfo";
|
|
|
import importIndex from "./importIndex.vue";
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
@@ -30,6 +41,8 @@ const editDrawer = ref();
|
|
|
const editDrawerShow = ref(false);
|
|
|
const titleShow = ref(false);
|
|
|
|
|
|
+// 序号
|
|
|
+const order = ref();
|
|
|
// 指标设置
|
|
|
const settingIndexDrawerRef = ref();
|
|
|
const settingIndexDrawerShow = ref(false);
|
|
@@ -142,7 +155,8 @@ const addDimension = reactive({
|
|
|
});
|
|
|
// 创建考核维度
|
|
|
const createAdd = () => {
|
|
|
- editDrawer.value.open(tepNameForm, "新建");
|
|
|
+ order.value = eaxmCard.value.length + 1;
|
|
|
+ editDrawer.value.open(tepNameForm, "新建", order.value);
|
|
|
};
|
|
|
const backChange = () => {
|
|
|
useAppStoreHook().toggleSideBar(true, "打开");
|
|
@@ -195,8 +209,8 @@ const deleteRow = row => {
|
|
|
});
|
|
|
};
|
|
|
// 编辑
|
|
|
-const editPen = item => {
|
|
|
- editDrawer.value.open(item, "编辑");
|
|
|
+const editPen = (item, order) => {
|
|
|
+ editDrawer.value.open(item, "编辑", order);
|
|
|
};
|
|
|
// 删除考核维度
|
|
|
const deletePen = index => {
|
|
@@ -254,6 +268,52 @@ const importIndexOne = async row => {
|
|
|
ElMessage.error(res.msg);
|
|
|
}
|
|
|
};
|
|
|
+// 拖拽
|
|
|
+const elDraggable = ref();
|
|
|
+const elDraggableTableData = ref();
|
|
|
+// 更新
|
|
|
+const postUpdateDeptApi = async (id, dimName, order) => {
|
|
|
+ await postUpdateDept({
|
|
|
+ id,
|
|
|
+ dimName,
|
|
|
+ order,
|
|
|
+ tpId: tepNameForm.id
|
|
|
+ });
|
|
|
+};
|
|
|
+const onEnd = (e: DraggableEvent) => {
|
|
|
+ eaxmCard.value.map((item, index) => {
|
|
|
+ postUpdateDeptApi(item.id, item.dimName, index + 1);
|
|
|
+ });
|
|
|
+};
|
|
|
+const onStart = (e: DraggableEvent) => {};
|
|
|
+
|
|
|
+const onUpdate = (e: DraggableEvent) => {};
|
|
|
+// 子表格拖拽
|
|
|
+const postUpdateApi = async (dimId, indId, order) => {
|
|
|
+ await postUpdate({
|
|
|
+ tpId: tepNameForm.id,
|
|
|
+ dimId,
|
|
|
+ indId,
|
|
|
+ order
|
|
|
+ });
|
|
|
+};
|
|
|
+// const { start } = useDraggable(elDraggableTableData, eaxmCard.tableData, {
|
|
|
+// animation: 150,
|
|
|
+// ghostClass: "ghost",
|
|
|
+// onStart() {
|
|
|
+// // console.log("start");
|
|
|
+// },
|
|
|
+// onUpdate(item, index) {
|
|
|
+// console.log("update", item);
|
|
|
+// console.log("index", index);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// const onEndTbl = (item: any, id: any) => {
|
|
|
+// console.log(item, id);
|
|
|
+// item.map((item, index) => {
|
|
|
+// postUpdateApi(id, item.id, index + 1);
|
|
|
+// });
|
|
|
+// };
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -336,99 +396,123 @@ const importIndexOne = async row => {
|
|
|
>创建考核维度</el-button
|
|
|
>
|
|
|
</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.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(item.id)"
|
|
|
- ><Delete class="text-red-500"
|
|
|
- /></el-icon>
|
|
|
+ <VueDraggable
|
|
|
+ ref="elDraggable"
|
|
|
+ v-model="eaxmCard"
|
|
|
+ :animation="150"
|
|
|
+ ghostClass="ghost"
|
|
|
+ class="flex flex-col gap-2 p-4 w-300px h-300px m-auto bg-gray-500/5 rounded"
|
|
|
+ @start="onStart"
|
|
|
+ @update="onUpdate"
|
|
|
+ @end="onEnd"
|
|
|
+ >
|
|
|
+ <el-card v-for="(item, index) in eaxmCard" :key="index" class="mb-3">
|
|
|
+ <template #header>
|
|
|
+ <div class="card-header">
|
|
|
+ <span>{{ item.dimName }}({{ item.dimWeight }}%)</span>
|
|
|
+ <div class="float-right mr-7">
|
|
|
+ <el-icon class="mr-3" @click="editPen(item, index + 1)"
|
|
|
+ ><EditPen
|
|
|
+ /></el-icon>
|
|
|
+ <el-icon @click="deletePen(item.id)"
|
|
|
+ ><Delete class="text-red-500"
|
|
|
+ /></el-icon>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <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)"
|
|
|
- ><Setting
|
|
|
- /></el-icon>
|
|
|
- <el-icon @click="deleteRow(row)">
|
|
|
- <Delete class="text-red-500" />
|
|
|
- </el-icon>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <template #footer>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- link
|
|
|
- class="mr-4"
|
|
|
- @click="importIndexOne(item)"
|
|
|
- >
|
|
|
- 添加指标
|
|
|
- </el-button>
|
|
|
- <el-button type="primary" link @click="importIndexDialog(item)">
|
|
|
- 导入指标
|
|
|
- </el-button>
|
|
|
- <span class="float-right num"
|
|
|
- >指标权重合计:{{ amountTo(item.tableData) }}</span
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ :data="item.tableData"
|
|
|
+ style="width: 100%"
|
|
|
+ max-height="250"
|
|
|
>
|
|
|
- </template>
|
|
|
- </el-card>
|
|
|
+ <el-table-column
|
|
|
+ ref="elDraggableTableData"
|
|
|
+ fixed
|
|
|
+ prop="name"
|
|
|
+ label="指标名称"
|
|
|
+ >
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div>{{ row.name }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <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)"
|
|
|
+ ><Setting
|
|
|
+ /></el-icon>
|
|
|
+ <el-icon @click="deleteRow(row)">
|
|
|
+ <Delete class="text-red-500" />
|
|
|
+ </el-icon>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <template #footer>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ class="mr-4"
|
|
|
+ @click="importIndexOne(item)"
|
|
|
+ >
|
|
|
+ 添加指标
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" link @click="importIndexDialog(item)">
|
|
|
+ 导入指标
|
|
|
+ </el-button>
|
|
|
+ <span class="float-right num"
|
|
|
+ >指标权重合计:{{ amountTo(item.tableData) }}</span
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-card>
|
|
|
+ </VueDraggable>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|