You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
299 lines
7.4 KiB
299 lines
7.4 KiB
<!--
|
|
@ 作者: 鲁智强
|
|
@ 时间: 2023-08-15 11:34:38
|
|
@ 备注:
|
|
-->
|
|
<template>
|
|
<el-dialog
|
|
:model-value="true"
|
|
title="新增方案"
|
|
style="width: 40%"
|
|
@close="handleClose"
|
|
>
|
|
<el-form
|
|
ref="ruleFormRef"
|
|
:model="formData"
|
|
label-width="80px"
|
|
class="demo-ruleForm"
|
|
style="width: 100%"
|
|
>
|
|
<el-form-item label="行政组织">
|
|
<el-tree-select
|
|
ref="orgTreeRef"
|
|
v-model="formData.deaprtname"
|
|
show-checkbox
|
|
clearable
|
|
node-key="id"
|
|
class="orgTree"
|
|
:data="tableData"
|
|
:props="orgTreeProps"
|
|
:render-after-expand="false"
|
|
@check="ge_adds"
|
|
/>
|
|
<el-form-item label="年度">
|
|
<el-date-picker v-model="formData.value1" type="year" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item v-loading="isshow" :data="tablea">
|
|
<el-row>
|
|
<el-col
|
|
v-for="(item, index) in tablea"
|
|
:key="index"
|
|
label="item.name"
|
|
style="width: 200px"
|
|
>
|
|
<el-card>
|
|
<template #header>
|
|
<div>
|
|
<el-text>考核维度:{{ item.name }}</el-text>
|
|
<span class="tyu">指标合计分:</span>
|
|
{{ formData.sums[2] }}
|
|
<!-- <el-text>{{item.zhiFraction}}</el-text> -->
|
|
</div>
|
|
<el-table
|
|
border
|
|
:summary-method="getSummaries"
|
|
show-summary
|
|
:data="item.child"
|
|
>
|
|
<el-table-column label="指标名称" prop="name" />
|
|
<el-table-column label="说明" prop="content">
|
|
<template #default="scope">
|
|
<el-input v-model="scope.row.content" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="指标权重" prop="referencescore">
|
|
<template #default="scope">
|
|
<el-input
|
|
v-model="scope.row.referencescore"
|
|
@blur="
|
|
scope.row.referencescore = Number(
|
|
scope.row.referencescore
|
|
)
|
|
"
|
|
/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="状态" prop="status">
|
|
<template #default="scope">
|
|
<el-select v-model="scope.row.status">
|
|
<el-option label="使用" :value="1" />
|
|
<el-option label="禁用" :value="2" />
|
|
<el-option label="观察" :value="3" />
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</template>
|
|
</el-card>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="submitForm()">确定</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { reactive } from "vue";
|
|
import {
|
|
tarlist,
|
|
addPostCont,
|
|
addtarget,
|
|
getgroupuser,
|
|
addposttargetcont,
|
|
search_orgpost,
|
|
} from "@/api/opk/api";
|
|
import { editPostCont } from "@/api/opk/pulic/api";
|
|
import { ge_add } from "@/api/opk/news/api";
|
|
import { create_scheme } from "@/api/opk/zxy/news/api";
|
|
import type { TableColumnCtx } from "element-plus";
|
|
const getSummaries = (param: any) => {
|
|
const { columns, data } = param;
|
|
columns.forEach((column, index) => {
|
|
if (index === 0) {
|
|
formData.sums[index] = "合计";
|
|
return;
|
|
|
|
}
|
|
const values = data.map((item) => Number(item[column.property]));
|
|
if (!values.every((value) => Number.isNaN(value))) {
|
|
formData.sums[index] = ` ${values.reduce((prev, curr) => {
|
|
const value = Number(curr);
|
|
if (!Number.isNaN(value)) {
|
|
return prev + curr;
|
|
} else {
|
|
return prev;
|
|
}
|
|
}, 0)}`;
|
|
} else {
|
|
formData.sums[index] = "";
|
|
}
|
|
});
|
|
return formData.sums;
|
|
};
|
|
interface FormInfo {
|
|
id: string;
|
|
age: string;
|
|
name: string;
|
|
sex: string;
|
|
ccc: string;
|
|
ade: string;
|
|
sort: number;
|
|
title: string;
|
|
type: number;
|
|
}
|
|
const isshow = ref(false);
|
|
const props = defineProps({
|
|
title: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
addPostBox: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
addrowInfo: {
|
|
type: Object as () => FormInfo,
|
|
default() {
|
|
return {};
|
|
},
|
|
},
|
|
arrayNum: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
});
|
|
const orgTreeProps = {
|
|
label: "name",
|
|
children: "child",
|
|
};
|
|
const orgTreeProp = {
|
|
label: "title",
|
|
children: "children",
|
|
};
|
|
const emit = defineEmits(["update:addPostBox", "editRow", "addRow"]);
|
|
const formData = reactive({
|
|
deaprtname: "",
|
|
value1: "",
|
|
asd: [] as string[],
|
|
lzq: "",
|
|
zhiFraction: "",
|
|
sums: [] as string[],
|
|
});
|
|
const tableData = ref<any>([]);
|
|
function jjjs() {
|
|
addPostCont("/hrapi/org/govthree", "post")
|
|
.then((data) => {
|
|
tableData.value = data.data[2].child[22].child;
|
|
})
|
|
.catch((error) => {
|
|
console.error("Error fetching data:", error);
|
|
});
|
|
}
|
|
jjjs();
|
|
const handle = (data: any) => {
|
|
formData.deaprtname = data.id;
|
|
ge_adds();
|
|
};
|
|
//行政组织
|
|
const tablea = ref<any>([]);
|
|
function ge_adds() {
|
|
const add = formData.deaprtname.toString();
|
|
ge_add({ id: add })
|
|
.then((data) => {
|
|
tablea.value = data.data;
|
|
})
|
|
.catch((error) => {
|
|
console.error("Error fetching data:", error);
|
|
})
|
|
.finally(() => {
|
|
isshow.value = false;
|
|
});
|
|
}
|
|
ge_adds();
|
|
// 关闭弹窗
|
|
const handleClose = () => {
|
|
emit("update:addPostBox", false);
|
|
};
|
|
const handleDel = (val: any) => {
|
|
ElMessageBox.confirm("你确定删除这条信息吗?", "提示", {
|
|
confirmButtonText: "确认",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
});
|
|
handleSure(val);
|
|
console.log(val.id);
|
|
};
|
|
const handleSure = (val: any) => {
|
|
const index = tableData.value.findIndex((item: any) => item.id === val.id);
|
|
if (index != -1) {
|
|
tableData.value.splice(index, 1);
|
|
}
|
|
};
|
|
const submitForm = () => {
|
|
const add = formData.deaprtname.toString();
|
|
const ess = new Date(formData.value1).getFullYear();
|
|
const see = ess.toString();
|
|
// tablea.zhiFraction = formData.sums[2]
|
|
if (props.addrowInfo.name) {
|
|
// 修改
|
|
const id = props.addrowInfo; // 假设你有一个唯一的ID来识别要修改的项
|
|
emit("editRow", formData);
|
|
} else {
|
|
// 新增
|
|
create_scheme({ orgid: add, year: see, child: tablea._value }).then(
|
|
(response: any) => {
|
|
if (response.code === 200) {
|
|
ElMessage.success("新增成功");
|
|
emit("addRow", formData);
|
|
} else {
|
|
ElMessage.error("新增成功");
|
|
handleClose();
|
|
}
|
|
}
|
|
);
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.avatar-uploader .avatar {
|
|
display: block;
|
|
width: 178px;
|
|
height: 178px;
|
|
}
|
|
</style>
|
|
|
|
<style lang="scss">
|
|
.avatar-uploader .el-upload {
|
|
position: relative;
|
|
overflow: hidden;
|
|
cursor: pointer;
|
|
border: 1px dashed var(--el-border-color);
|
|
border-radius: 6px;
|
|
transition: var(--el-transition-duration-fast);
|
|
}
|
|
|
|
.avatar-uploader .el-upload:hover {
|
|
border-color: var(--el-color-primary);
|
|
}
|
|
|
|
.el-icon.avatar-uploader-icon {
|
|
width: 178px;
|
|
height: 178px;
|
|
font-size: 28px;
|
|
color: #8c939d;
|
|
text-align: center;
|
|
}
|
|
|
|
.el-dialog {
|
|
width: 1200px;
|
|
}
|
|
|
|
.tyu {
|
|
margin: 0 0 0 100px;
|
|
}
|
|
</style>
|
|
|