2025-02-10 18:04:59 +08:00

270 lines
7.3 KiB
Vue

<template>
<lay-container fluid="true" style="padding: 20px">
<lay-row :space="10">
<lay-col :md="24">
<lay-card>
<lay-form style="margin-top: 20px">
<lay-row>
<lay-col :md="5">
<lay-form-item label="年度:" label-width="50">
<lay-date-picker type="year" v-model="searchAccount" placeholder="请选择"
allow-clear></lay-date-picker>
</lay-form-item>
</lay-col>
<lay-col :md="4">
<lay-form-item label-width="0">
<lay-button type="primary" @click="toSearch">查询</lay-button>
<lay-button @click="toReset">重置</lay-button>
</lay-form-item>
</lay-col>
</lay-row>
</lay-form>
</lay-card>
</lay-col>
<lay-col :md="24">
<lay-card>
<div style="padding: 10px">
<span style="font-size: 18px;vertical-align: center;margin-right: 20px">年度自评列表</span>
<lay-button type="primary" size="sm">导出Excel</lay-button>
</div>
<lay-table
:page="page"
:columns="columns"
:dataSource="dataSource"
:even="true"
height="600px"
size="md"
>
<template v-slot:id="{ data }">
{{ data.id }}
</template>
<template v-slot:department_score="{ data }">
{{ data.department_score==0?'-':data.department_score }}
</template>
<template v-slot:username="{ data }">
{{ data.username }}
</template>
<template v-slot:password="{ data }">
{{ data.password }}
</template>
<template v-slot:operator="{ data }">
<span style="color: #00A394;cursor: pointer" v-if="data.if_period==1" @click="getMonthlyInfo(data)">详情</span>
<span style="color: #00A394;cursor: pointer" v-if="data.if_period==2"
@click="insZp(data)">开始自评</span>
</template>
</lay-table>
</lay-card>
</lay-col>
</lay-row>
</lay-container>
<lay-layer v-model="visible11" title="月度自评详情" :type="4" :shade="true" :area="['950px','100%']" :btn="addIsInfo==1?addButton:''">
<lay-container fluid="true" style="padding: 20px">
<lay-card shadow="always">
<div style="height: 70px;width: 100%;">
<lay-step current-status="primary" style="margin: 0 auto" direction="horizontal" :active="active" space="100%"
:center="true">
<lay-step-item>
<template v-slot:default>
<div style="font-size: 18px;font-weight: bold;color: #009688">个人自评</div>
<!-- <div style="color: #999999">2025-01-01 14:35:33</div>-->
</template>
</lay-step-item>
<lay-step-item>
<template v-slot:default>
<div style="font-size: 18px;font-weight: bold;color: #009688">科室考评</div>
<div style="color: #999999"></div>
</template>
</lay-step-item>
</lay-step>
</div>
</lay-card>
<lay-table :default-expand-all="true" ref="tableRef6" children-column-name="children" :columns="columns6"
:data-source="dataSource6">
<template v-slot:input="{ data,rowIndex}">
<lay-input-number v-if="data.pid==0" :disabled="true" :min="0" :max="data.base_score"
v-model="data.base_score" position="right"></lay-input-number>
<lay-input-number v-if="data.pid!=0" :disabled="addIsInfo==2" :min="0" :max="data.base_score" v-model="data.content_score"
position="right"></lay-input-number>
</template>
</lay-table>
</lay-container>
</lay-layer>
</template>
<script setup lang="ts">
import {ref, onMounted} from 'vue'
import {layer} from '@layui/layer-vue'
import {
YearList,
YearContent, YearCreate,YearInfo
} from '../../api/module/home'
import {useUserStore} from "@/store/user";
const userStore = useUserStore()
const active = ref(-1);
const visible11 = ref(false);
const page = ref({total: 100, limit: 10, current: 2});
const dataSource = ref([]);
const addIsInfo=ref(1);
const yearName=ref('');
onMounted(() => {
getYearList();
getYearContent();
})
const insZp = (item) => {
visible11.value = true;
addIsInfo.value=1;
yearName.value=item.year;
}
const getMonthlyInfo = (item) => {
visible11.value=true;
addIsInfo.value=2;
console.log(item)
YearInfo({'user_id': userStore.userInfo.id, 'year': item.year}).then((res) => {
console.log(res)
if (res.code == 1) {
dataSource6.value = res.data;
} else {
layer.msg(res.msg, {icon: 2})
}
})
}
const getYearList = () => {
YearList({'user_id': userStore.userInfo.id}).then((res) => {
console.log(res)
if (res.code == 1) {
dataSource.value = res.data;
} else {
layer.msg(res.msg, {icon: 2})
}
})
}
const dataSource6 = ref([]);
const getYearContent = () => {
YearContent({'type': 1}).then((res) => {
console.log(res)
if (res.code == 1) {
dataSource6.value = res.data;
} else {
layer.msg(res.msg, {icon: 2})
}
})
}
const columns6 = [
{
title: "考评项目",
width: "300px",
key: "project_name"
},
{
title: "分值",
width: "100px",
align: 'center',
key: "base_score"
},
{
title: "自评分",
width: "100px",
align: 'center',
customSlot: 'input',
key: "input"
}
]
const columns = [
{
title: '年度',
width: '100px',
align: 'center',
key: 'year'
},
{
title: '考评对象',
width: '150px',
align: 'center',
key: 'user'
},
{
title: '参评时间',
width: '180px',
align: 'center',
key: 'createtime'
},
{
title: '加分',
key: 'remark',
align: 'center',
},
{
title: '扣分',
key: 'remark',
align: 'center',
},
{
title: '自评总分',
key: 'self_score',
align: 'center',
}, {
title: '科室评分',
key: 'department_score',
customSlot: 'department_score',
align: 'center',
},
{
title: '操作',
width: '180px',
customSlot: 'operator',
key: 'operator',
align: 'center',
fixed: 'right'
}
]
function toSearch() {
layer.load(2, {time: 3000})
}
const searchAccount = ref('')
const searchEmail = ref('')
function toReset() {
searchAccount.value = ''
searchEmail.value = ''
}
const addButton = ref([
{
text: "确认",
callback: async () => {
var json = JSON.stringify(dataSource6.value);
var res = await YearCreate({'term': yearName.value,'json': json,'user_id': userStore.userInfo.id});
console.log(res)
if (res.code == 1) {
layer.msg('提交成功!', {icon: 1})
visible11.value = false;
getYearList();
getYearContent();
} else {
layer.msg(res.msg, {icon: 2})
}
}
},
{
text: "取消",
callback: () => {
visible11.value = false;
}
}
])
</script>
<style>
.layui-table-header .layui-table-cell {
background-color: #ECF8FA !important;
}
</style>