|
@@ -12,7 +12,15 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
|
import { Delete, Check } from "@element-plus/icons-vue";
|
|
import { Delete, Check } from "@element-plus/icons-vue";
|
|
import { Search } from "@element-plus/icons-vue";
|
|
import { Search } from "@element-plus/icons-vue";
|
|
import { getSelectDictListtApi, select } from "@/api/select";
|
|
import { getSelectDictListtApi, select } from "@/api/select";
|
|
-import { getQuotaPageList, delQuota, postUpdateDept } from "@/api/indexDefine";
|
|
|
|
|
|
+import {
|
|
|
|
+ getQuotaPageList,
|
|
|
|
+ delQuota,
|
|
|
|
+ postUpdateDept,
|
|
|
|
+ postPageQuotaClassify,
|
|
|
|
+ postAddQuotaClassify,
|
|
|
|
+ postEditQuotaClassify,
|
|
|
|
+ postDeleteQuotaClassify
|
|
|
|
+} from "@/api/indexDefine";
|
|
import { getStateData, getStateType } from "@/config/tag";
|
|
import { getStateData, getStateType } from "@/config/tag";
|
|
import dayjs from "dayjs";
|
|
import dayjs from "dayjs";
|
|
const value = ref("");
|
|
const value = ref("");
|
|
@@ -47,6 +55,7 @@ const params = reactive({
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
param: null,
|
|
param: null,
|
|
categoryName: null,
|
|
categoryName: null,
|
|
|
|
+
|
|
statue: null,
|
|
statue: null,
|
|
orderField: "updateTime",
|
|
orderField: "updateTime",
|
|
orderType: null
|
|
orderType: null
|
|
@@ -79,6 +88,11 @@ const newAddIndex = () => {
|
|
const close = () => {
|
|
const close = () => {
|
|
showDialog.value = false;
|
|
showDialog.value = false;
|
|
getQuotaPageListApi();
|
|
getQuotaPageListApi();
|
|
|
|
+ getPageQuotaClassify();
|
|
|
|
+};
|
|
|
|
+const editClose = () => {
|
|
|
|
+ getQuotaPageListApi();
|
|
|
|
+ getPageQuotaClassify();
|
|
};
|
|
};
|
|
// 编辑
|
|
// 编辑
|
|
const setEdit = row => {
|
|
const setEdit = row => {
|
|
@@ -193,10 +207,12 @@ const changeSort = ({ column, prop, order }) => {
|
|
const typeDialogTitle = ref("新增");
|
|
const typeDialogTitle = ref("新增");
|
|
const typeDialogVisible = ref(false);
|
|
const typeDialogVisible = ref(false);
|
|
const typeForm = reactive({
|
|
const typeForm = reactive({
|
|
- typeName: ""
|
|
|
|
|
|
+ classifyName: "",
|
|
|
|
+ classifyCode: "",
|
|
|
|
+ classifyNum: 0
|
|
});
|
|
});
|
|
const typeRules = reactive({
|
|
const typeRules = reactive({
|
|
- typeName: [
|
|
|
|
|
|
+ classifyName: [
|
|
{
|
|
{
|
|
required: true,
|
|
required: true,
|
|
message: "请输入分类名称",
|
|
message: "请输入分类名称",
|
|
@@ -204,22 +220,24 @@ const typeRules = reactive({
|
|
}
|
|
}
|
|
]
|
|
]
|
|
});
|
|
});
|
|
-const typeList = ref([
|
|
|
|
- {
|
|
|
|
- name: "全部分类",
|
|
|
|
- value: 115
|
|
|
|
- }
|
|
|
|
-]);
|
|
|
|
|
|
+const typeList = ref([]);
|
|
const openTypeDialog = (type = "", row: any = {}) => {
|
|
const openTypeDialog = (type = "", row: any = {}) => {
|
|
typeDialogVisible.value = true;
|
|
typeDialogVisible.value = true;
|
|
if (type === "add") {
|
|
if (type === "add") {
|
|
typeDialogTitle.value = "新增";
|
|
typeDialogTitle.value = "新增";
|
|
} else if (type === "edit") {
|
|
} else if (type === "edit") {
|
|
typeDialogTitle.value = "编辑";
|
|
typeDialogTitle.value = "编辑";
|
|
- typeForm.typeName = row.name;
|
|
|
|
|
|
+ typeForm.classifyName = row.classifyName;
|
|
|
|
+ typeForm.classifyCode = row.classifyCode;
|
|
|
|
+ typeForm.classifyNum = row.classifyNum || 0;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-const deleteType = () => {
|
|
|
|
|
|
+type rowType = {
|
|
|
|
+ classifyName: string;
|
|
|
|
+ classifyCode: string;
|
|
|
|
+ classifyNum: number;
|
|
|
|
+};
|
|
|
|
+const deleteType = (row: rowType) => {
|
|
ElMessageBox.confirm(
|
|
ElMessageBox.confirm(
|
|
"请先解除分类下的指标后再删除",
|
|
"请先解除分类下的指标后再删除",
|
|
"确定要删除这项分类吗?",
|
|
"确定要删除这项分类吗?",
|
|
@@ -230,9 +248,18 @@ const deleteType = () => {
|
|
}
|
|
}
|
|
)
|
|
)
|
|
.then(() => {
|
|
.then(() => {
|
|
- ElMessage({
|
|
|
|
- type: "success",
|
|
|
|
- message: "删除成功"
|
|
|
|
|
|
+ postDeleteQuotaClassify({
|
|
|
|
+ classifyName: row.classifyName,
|
|
|
|
+ classifyCode: row.classifyCode,
|
|
|
|
+ classifyNum: row.classifyNum
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ ElMessage({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "删除成功"
|
|
|
|
+ });
|
|
|
|
+ getPageQuotaClassify();
|
|
|
|
+ }
|
|
});
|
|
});
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|
|
@@ -245,16 +272,65 @@ const deleteType = () => {
|
|
const closeTypeDialog = () => {
|
|
const closeTypeDialog = () => {
|
|
typeDialogVisible.value = false;
|
|
typeDialogVisible.value = false;
|
|
typeDialogTitle.value = "";
|
|
typeDialogTitle.value = "";
|
|
- typeForm.typeName = "";
|
|
|
|
|
|
+ typeForm.classifyName = "";
|
|
|
|
+ typeForm.classifyCode = "";
|
|
|
|
+ typeForm.classifyNum = 0;
|
|
};
|
|
};
|
|
const typeFormRef = ref();
|
|
const typeFormRef = ref();
|
|
const confirmTypeDialog = () => {
|
|
const confirmTypeDialog = () => {
|
|
typeFormRef.value.validate(valid => {
|
|
typeFormRef.value.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ if (typeDialogTitle.value === "新增") {
|
|
|
|
+ addQuotaClassify();
|
|
|
|
+ } else if (typeDialogTitle.value === "编辑") {
|
|
|
|
+ editQuotaClassify();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+// 获取指标分类
|
|
|
|
+const getPageQuotaClassify = () => {
|
|
|
|
+ postPageQuotaClassify().then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ typeList.value = res.data || [];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+onMounted(() => {
|
|
|
|
+ getPageQuotaClassify();
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+// 新增指标分类
|
|
|
|
+const addQuotaClassify = () => {
|
|
|
|
+ postAddQuotaClassify({ classifyName: typeForm.classifyName }).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ ElMessage({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "新增成功"
|
|
|
|
+ });
|
|
|
|
+ getPageQuotaClassify();
|
|
closeTypeDialog();
|
|
closeTypeDialog();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+// 编辑指标分类
|
|
|
|
+const editQuotaClassify = () => {
|
|
|
|
+ postEditQuotaClassify({ ...typeForm }).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ ElMessage({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "编辑成功"
|
|
|
|
+ });
|
|
|
|
+ getPageQuotaClassify();
|
|
|
|
+ closeTypeDialog();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+// 通过指标分类搜索
|
|
|
|
+const searchClassify = (row: rowType) => {
|
|
|
|
+ params.params.categoryName = row.classifyName;
|
|
|
|
+ getQuotaPageListApi();
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -266,12 +342,14 @@ const confirmTypeDialog = () => {
|
|
<editDrawer
|
|
<editDrawer
|
|
ref="EditdrawerShow"
|
|
ref="EditdrawerShow"
|
|
v-model:drawerValue="EditshowDrawer"
|
|
v-model:drawerValue="EditshowDrawer"
|
|
- @closeEditDialog="getQuotaPageListApi"
|
|
|
|
|
|
+ :typeList="typeList"
|
|
|
|
+ @closeEditDialog="editClose"
|
|
/>
|
|
/>
|
|
<!-- 新建 -->
|
|
<!-- 新建 -->
|
|
<dialogVue
|
|
<dialogVue
|
|
ref="dialogShow"
|
|
ref="dialogShow"
|
|
v-model:modelValue="showDialog"
|
|
v-model:modelValue="showDialog"
|
|
|
|
+ :typeList="typeList"
|
|
@closeDialog="close"
|
|
@closeDialog="close"
|
|
/>
|
|
/>
|
|
<!-- 日志 -->
|
|
<!-- 日志 -->
|
|
@@ -290,11 +368,26 @@ const confirmTypeDialog = () => {
|
|
:key="index"
|
|
:key="index"
|
|
class="item-left-list-item"
|
|
class="item-left-list-item"
|
|
>
|
|
>
|
|
- <span>{{ item.name }}</span>
|
|
|
|
|
|
+ <span class="classify-name" @click="searchClassify(item)">{{
|
|
|
|
+ item.classifyName
|
|
|
|
+ }}</span>
|
|
<el-dropdown class="ml-2" trigger="click">
|
|
<el-dropdown class="ml-2" trigger="click">
|
|
- <span class="type-number">{{ item.value }}</span>
|
|
|
|
|
|
+ <span
|
|
|
|
+ class="type-number"
|
|
|
|
+ :class="{
|
|
|
|
+ 'no-type': ['allclassify', 'noclassify'].includes(
|
|
|
|
+ item.classifyCode
|
|
|
|
+ )
|
|
|
|
+ }"
|
|
|
|
+ >{{ item.classifyNum || 0 }}</span
|
|
|
|
+ >
|
|
<template #dropdown>
|
|
<template #dropdown>
|
|
- <el-dropdown-menu class="setting">
|
|
|
|
|
|
+ <el-dropdown-menu
|
|
|
|
+ v-if="
|
|
|
|
+ !['allclassify', 'noclassify'].includes(item.classifyCode)
|
|
|
|
+ "
|
|
|
|
+ class="setting"
|
|
|
|
+ >
|
|
<el-dropdown-item>
|
|
<el-dropdown-item>
|
|
<el-text
|
|
<el-text
|
|
type="primary"
|
|
type="primary"
|
|
@@ -307,7 +400,7 @@ const confirmTypeDialog = () => {
|
|
</el-text>
|
|
</el-text>
|
|
</el-dropdown-item>
|
|
</el-dropdown-item>
|
|
<el-dropdown-item>
|
|
<el-dropdown-item>
|
|
- <el-text type="danger" @click="deleteType">
|
|
|
|
|
|
+ <el-text type="danger" @click="deleteType(item)">
|
|
<el-icon>
|
|
<el-icon>
|
|
<Delete />
|
|
<Delete />
|
|
</el-icon>
|
|
</el-icon>
|
|
@@ -318,10 +411,6 @@ const confirmTypeDialog = () => {
|
|
</template>
|
|
</template>
|
|
</el-dropdown>
|
|
</el-dropdown>
|
|
</div>
|
|
</div>
|
|
- <div class="item-left-list-item">
|
|
|
|
- <span>未分类</span>
|
|
|
|
- <span class="type-number no-type">0</span>
|
|
|
|
- </div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="item-right">
|
|
<div class="item-right">
|
|
@@ -329,24 +418,6 @@ const confirmTypeDialog = () => {
|
|
<div class="mb-2 flex gap-2 justify-between flex-wrap">
|
|
<div class="mb-2 flex gap-2 justify-between flex-wrap">
|
|
<div class="flex mt-2">
|
|
<div class="flex mt-2">
|
|
<div class="flex mr-2">
|
|
<div class="flex mr-2">
|
|
- <div class="text-sm leading-8 mr-3">指标分类</div>
|
|
|
|
- <el-select
|
|
|
|
- v-model="params.params.categoryName"
|
|
|
|
- clearable
|
|
|
|
- filterable
|
|
|
|
- placeholder="请选择"
|
|
|
|
- style="width: 150px"
|
|
|
|
- @change="getQuotaPageListApi"
|
|
|
|
- >
|
|
|
|
- <el-option
|
|
|
|
- v-for="(item, index) in select"
|
|
|
|
- :key="index"
|
|
|
|
- :label="item.dictValue"
|
|
|
|
- :value="item.dictValue"
|
|
|
|
- />
|
|
|
|
- </el-select>
|
|
|
|
- </div>
|
|
|
|
- <div class="flex mr-2">
|
|
|
|
<div class="text-sm leading-8 mr-3">状态</div>
|
|
<div class="text-sm leading-8 mr-3">状态</div>
|
|
<el-select
|
|
<el-select
|
|
v-model="params.params.statue"
|
|
v-model="params.params.statue"
|
|
@@ -526,9 +597,9 @@ const confirmTypeDialog = () => {
|
|
label-width="auto"
|
|
label-width="auto"
|
|
:rules="typeRules"
|
|
:rules="typeRules"
|
|
>
|
|
>
|
|
- <el-form-item prop="typeName" label="分类名称">
|
|
|
|
|
|
+ <el-form-item prop="classifyName" label="分类名称">
|
|
<el-input
|
|
<el-input
|
|
- v-model="typeForm.typeName"
|
|
|
|
|
|
+ v-model="typeForm.classifyName"
|
|
placeholder="请输入分类名称"
|
|
placeholder="请输入分类名称"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -607,6 +678,10 @@ const confirmTypeDialog = () => {
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
margin-bottom: 10px;
|
|
margin-bottom: 10px;
|
|
|
|
|
|
|
|
+ .classify-name {
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ }
|
|
|
|
+
|
|
.type-number {
|
|
.type-number {
|
|
margin-left: 10px;
|
|
margin-left: 10px;
|
|
font-size: 16px;
|
|
font-size: 16px;
|