Compare commits
1 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
ffbf220912 | 2 years ago |
42 changed files with 1701 additions and 1260 deletions
@ -0,0 +1,287 @@ |
|||||
|
<!-- |
||||
|
* @作者: 袁纪菲 |
||||
|
* @生成时间: 2024-05-28 |
||||
|
* @备注: 新建岗位方案 |
||||
|
--> |
||||
|
<script lang="ts" setup> |
||||
|
import { reactive } from "vue"; |
||||
|
import { addPostCont , organdpost } from "@/api/opk/api"; |
||||
|
import { ge_add } from "@/api/opk/news/api"; |
||||
|
import { create_scheme } from "@/api/opk/zxy/news/api"; |
||||
|
const getSummaries = (param: any) => { |
||||
|
const { columns, data } = param; |
||||
|
columns.forEach((column:any, index:any) => { |
||||
|
if (index === 0) { |
||||
|
formData.sums[index] = "合计"; |
||||
|
return; |
||||
|
} |
||||
|
const values = data.map((item:any) => Number(item[column.property])); |
||||
|
if (!values.every((value:any) => Number.isNaN(value))) { |
||||
|
formData.sums[2] = ` ${values.reduce((prev:any, curr:any) => { |
||||
|
const value = Number(curr); |
||||
|
if (!Number.isNaN(value)) { |
||||
|
return prev + curr; |
||||
|
} else { |
||||
|
return prev; |
||||
|
} |
||||
|
}, 0)}`; |
||||
|
} |
||||
|
}); |
||||
|
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() { |
||||
|
organdpost({ id: "309", levelL: 0 }) |
||||
|
.then((data) => { |
||||
|
tableData.value = data.data.list; |
||||
|
}) |
||||
|
.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> |
||||
|
<template> |
||||
|
<el-dialog |
||||
|
:model-value="true" |
||||
|
title="新增岗位方案" |
||||
|
style="width: 75%" |
||||
|
@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> |
||||
|
|
||||
|
<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> |
||||
Loading…
Reference in new issue