Files
2026-09-08 19:49:21 +08:00

692 lines
30 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<div id="app" v-cloak>
<guava ref="guava" edit_scroll>
<template>
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-date-picker
@change="khSearch"
:picker-options="pickerOptions"
v-model="pageForm.annual"
type="year"
value-format="yyyy"
placeholder="选择年度">
</el-date-picker>
</div>
<div class="btn-group tool-button mt5">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table :data="tableData" style="width: 100%" row-key="id"
v-loading="tabLoading">
<el-table-column align="center" header-align="center" label="序号" width="100px">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column label="年度" prop="annual" header-align="center" width="300px" sortable
align="center">
<template scope="scope">
{{scope.row.annual}}
</template>
</el-table-column>
<el-table-column label="考核名称" prop="assessment" header-align="center" show-overflow-tooltip
align="center"></el-table-column>
<el-table-column label="自评得分" prop="zp_score" header-align="center" sortable align="center">
<template scope="scope">
{{scope.row.zp_score | none2str}}
</template>
</el-table-column>
<el-table-column label="校工会评分" prop="xgh_score" header-align="center" sortable align="center">
<template scope="scope">
{{scope.row.xgh_score | none2str}}
</template>
</el-table-column>
<el-table-column label="状态" prop="name" header-align="center" align="center">
<template scope="scope">
<span class="text-info" v-if="!scope.row.state">未自评</span>
<span class="text-success" v-else-if="scope.row.state==1">自评中</span>
<span class="text-warning" v-else-if="scope.row.state==2">待校工会评分</span>
<span class="text-success" v-else-if="scope.row.state==3">考核成功</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="250px">
<template scope="scope">
<el-button size="mini" type="primary" v-if="scope.row.state" @click="openView(scope.row)">
查看
</el-button>
<el-button size="mini" type="primary" @click="openAdd(scope.row)"
v-if="!scope.row.state">
自评
</el-button>
<el-button size="mini" type="primary" @click="openEdit(scope.row)"
v-if="scope.row.state==1">
修改
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit_func>
<el-button type="primary"
style="float: right;margin-top: 5px;margin-left: 10px;"
@click="doSaveOrSubmit('submit')">
提交
</el-button>
<el-button type="primary" plain style="float: right;margin-top: 5px"
@click="doSaveOrSubmit('save')">
保存
</el-button>
</template>
<template #edit>
<h3 style="color: rgb(24, 103, 176);text-align: center;margin: 10px 0px 50px 0">
{{formData.assessment}}
</h3>
<border-table>
<table>
<tr>
<th>年度</th>
<td>{{formData.annual}}</td>
<th>考核分工会</th>
<td>${@shiro.getPrincipalProperty('union').getUnionname()}</td>
</tr>
</table>
</border-table>
<el-form :model="formData" ref="form" label-width="100px">
<div v-for="nr,idx in formData.nrs" :key="nr.id">
<div style="font-size: 16px;line-height: 1.1;margin: 10px 0">{{ idx + 1 }}.{{nr.content}}</div>
<el-row style="margin-top: 20px">
<el-table :data="nr.bzs" border show-summary :summary-method="getSummaries">
<el-table-column align="center" header-align="center" label="序号" type="index"
width="70px">
</el-table-column>
<el-table-column label="考评内容" prop="inspection" header-align="center"
align="center">
<template scope="{row}">
{{row.inspection}}
</template>
</el-table-column>
<el-table-column label="评分标准" prop="inspection" header-align="center"
align="center"
width="300px">
<template scope="{row}">
{{row.scoringCriteria}}
</template>
</el-table-column>
<el-table-column label="项目自评" prop="score" header-align="center"
width="200px"
align="center">
<template scope="{row}">
{{row.score}}
</template>
</el-table-column>
<el-table-column label="自评分值" disabled prop="zp.zpf" header-align="center"
width="200px"
align="center">
<template scope="{row,$index}">
<el-form-item :prop="getPropPath(idx, $index)"
label-width="0"
:rules="[{required:true,message:'必填',trigger:['blur','change']}]">
<el-input-number v-if="row.score>0"
v-model="row.zp.zpf"
:max="row.score"
:min="0"
step-strictly
:precision="0"></el-input-number>
<el-input-number v-else
v-model="row.zp.zpf"
:min="0"
step-strictly
:precision="0"></el-input-number>
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-row>
</div>
</el-form>
<!-- <div>-->
<!-- <el-button type="primary" @click="doSaveOrSubmit('submit')">-->
<!-- 提交-->
<!-- </el-button>-->
<!-- <el-button type="primary" plain style="float: right;margin-top: 5px" @click="doSaveOrSubmit('save')">-->
<!-- 保存-->
<!-- </el-button>-->
<!-- </div>-->
</template>
<template #view>
<h3 style="color: rgb(24, 103, 176);text-align: center;margin: 10px 0px 50px 0">
{{formData.assessment}}
</h3>
<border-table>
<table>
<tr>
<th>年度</th>
<td>{{formData.annual}}</td>
<th>考核分工会</th>
<td>${@shiro.getPrincipalProperty('union').getUnionname()}</td>
</tr>
</table>
</border-table>
<el-form :model="formData" ref="form" label-width="100px">
<el-form-item label="" label-width="0" v-for="nr,idx in formData.nrs" :key="nr.id">
<div style="font-size: 16px;line-height: 1.1;margin: 10px 0">{{ idx + 1 }}.{{nr.content}}</div>
<el-row style="margin-top: 20px">
<el-table :data="nr.bzs" border show-summary :summary-method="getSummaries2">
<el-table-column align="center" header-align="center" label="序号" type="index"
width="70px">
</el-table-column>
<el-table-column label="考核标准" disabled prop="inspection" header-align="center"
align="center">
<template scope="{row}">
{{row.inspection}}
</template>
</el-table-column>
<el-table-column label="标准分" prop="score" header-align="center" align="center"
width="250px">
<template scope="{row}">
{{row.score}}
</template>
</el-table-column>
<el-table-column label="自评得分" prop="zpf" header-align="center" align="center"
width="250px">
<template scope="{row}">
{{row.zpf}}
<!-- <el-input v-if="row.zpf" v-model.number="row.zpf" maxlength="4"-->
<!-- readonly placeholder="请填写自评分"></el-input>-->
<!-- <el-input v-else value="暂无" maxlength="4"-->
<!-- readonly></el-input>-->
</template>
</el-table-column>
</el-table>
</el-row>
</el-form-item>
</el-form>
</template>
</guava>
<el-drawer
:visible.sync="dialog"
:show-close="false"
direction="rtl" size="40%"
custom-class="demo-drawer" :before-close="()=>{addForm()}"
ref="drawer">
<div class="demo-drawer__content" style="padding: 0 15px">
<upload-materials :data="data"></upload-materials>
<div class="demo-drawer__footer" style="float: right">
<el-popover
placement="top"
width="160"
v-model="visible">
<p>您确定要返回吗?返回将不能保存!</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="cancelForm">确定</el-button>
</div>
<el-button slot="reference">返 回</el-button>
</el-popover>
<!-- <el-button @click="cancelForm">取 消</el-button>-->
<el-button type="primary" @click="addForm">确 定</el-button>
</div>
</div>
</el-drawer>
<el-drawer
:visible.sync="dialog_view"
direction="rtl" size="40%"
custom-class="demo-drawer"
ref="drawer">
<div class="demo-drawer__content" style="padding: 0 15px">
<upload-materials :data="data" :is_view="true"></upload-materials>
</div>
</el-drawer>
<calcscore-table :relation_year="relationYear"
:show_modal.sync="calcSoreTableModal"
@get_table_data="autoFillScore"/>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
visible: false,
fileList: [],
v: 'index',
tableData: [],
formData: {},
dialog: false,
dialog_view: false,
loading: false,
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
},
data: {bz: '', clnrs: null, nr: ''},
row: {},
index: "",
idx: "",
addFormData: [],
pickerOptions: {
disabledDate(time) {
return (
time.getFullYear() > new Date().getFullYear()
);
}
},
relationYear: {},
calcSoreTableModal: false,
current_bz_id: ''
}
},
filters: {
none2str(val) {
return val ? val : '暂无'
}
},
components: {
'upload-materials': httpVueLoader('/components/kh/UploadMaterials.vue'),
'calcscore-table': httpVueLoader('/components/kh/CalcScoreTab.vue?ver=' + Math.random()),
},
methods: {
getPropPath(idx, rowIndex) {
return 'nrs[' + idx + "].bzs[" + rowIndex + "].zp.zpf";
},
goBack() {
this.pageData()
this.$refs.guava.index()
},
//计算得分
async calcScore(row) {
this.current_bz_id = row.id
this.calcSoreTableModal = true
this.relationYear = {year: this.formData.annual, bz_relation_id: row.bz_relation_id}
},
autoFillScore(scoreTable) {
this.formData.nrs.some(nr => {
nr.bzs.some(v => {
if (v.id === this.current_bz_id) {
this.$set(v, 'clnr', this.renderScoreTable(v.bz_relation_id, scoreTable))
if (scoreTable.length * v.single_score > Number(v.score) && !v.beyond_highestscore) {
this.$message.warning('自评得分不能超过标准分!')
this.$set(v.zp, 'zpf', v.score)
return true
}
if (this.relationYear.bz_relation_id === "Performance") {
let single_score = 0
scoreTable.map(v => {
single_score += v.integral
})
this.$set(v.zp, 'zpf', single_score)
} else {
this.$set(v.zp, 'zpf', scoreTable.length * v.single_score)
}
return true
}
})
})
},
//自定义材料内容
renderScoreTable(relation_id, score_data) {
if (score_data) {
let res = ''
switch (relation_id) {
case 'proposal':
score_data.map((v, i) => {
res += (i + 1) + ' .提案人:' + v.username + ',提案名称:' + v.proposalName + ';\n'
})
return res
case 'secteameet':
score_data.map((v, i) => {
res += (i + 1) + ' .申请人:' + v.username + ',会议名称:' + v.meeting_name + ';\n'
})
return res
case 'ConandDif':
score_data.map((v, i) => {
res += (i + 1) + ' .被慰问/补助人:' + v.be_username + ',慰问/补助类型:' + v.typename + ';\n'
})
return res
case 'Performance':
score_data.map((v, i) => {
res += (i + 1) + ' .在:' + v.activityName + '届运动会中,' + v.eventName + '项目获得了地' + v.ranking + '名;\n'
})
return res
default:
return ''
}
}
return ''
},
async doSaveOrSubmit(v) {
const msg = v === 'save' ? '保存后可继续填写或修改,您确定要保存吗?' : '提交后不允许修改自评分,您确定要提交至校工会吗?'
const confirm = await this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm !== 'confirm') {
return
}
const params = []
this.formData.nrs.forEach(n => {
n.bzs.forEach(b => {
params.push({
"zb_id": this.formData.id,
"nr_id": n.id,
"bz_id": b.id,
"clnr": b.zp.clnr,
"zpf": b.zp.zpf,
"files": b.zp.files,
"id": b.zp.id ? b.zp.id : null
})
})
})
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const res = await $.post(base + "/platform/ghkh/zp/doHandler", {
zp: JSON.stringify(params),
handleType: v,
zbId: this.formData.id
})
if (res.code === 0) {
this.pageData()
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
loading.close()
if (v === 'submit') {
this.$refs.guava.index()
return
}
const resa = await $.post(base + '/platform/ghkh/zp/openView', {id: this.formData.id})
await this.$nextTick()
this.formData = resa.data
},
async getKh() {
await $.get("/platform/ghkh/khph/getKh", {"annual": this.pageForm.annual}).then(res => {
if (res.data.length != 0) {
this.kh = res.data
this.pageForm.khid = this.kh[0].id
} else {
this.kh = []
this.pageForm.khid = ""
}
})
},
async khSearch() {
await this.getKh()
},
viewUpload(nr, bz, row) {
this.data = {nr, bz, clnr: row.clnr, ...row.zp}
this.dialog_view = true
},
upload(nr, bz, row, index, idx) {
this.dialog = true
if (row.zp) {
this.data = {nr, bz, clnr: row.clnr, ...row.zp}
} else {
this.data = {nr, bz, clnr: row.clnr, ...row.zp}
}
this.row = row
this.index = index
this.idx = idx
},
addForm() {
this.formData.nrs[this.idx].bzs[this.index].zp = this.data
this.dialog = false
},
cancelForm() {
this.visible = false
this.loading = false;
this.dialog = false;
},
getSummaries(param) {
const {columns, data} = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '小计';
} else if ([1, 2].includes(index)) {
sums[index] = '';
} else if (index === 3) {
sums[index] = (data.map(v => isNaN(v['score']) ? 0 : parseInt(v['score'])).reduce((a, b) => a + b)) + '分'
} else if (index === 4) {
sums[index] = (data.map(v => v['zp']['zpf']).reduce((a, b) => parseInt(a) + parseInt(b))) + '分'
}
});
return sums
},
getSummaries2(param) {
const {columns, data} = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '小计';
} else if ([1].includes(index)) {
sums[index] = '';
} else if (index === 2) {
sums[index] = (data.map(v => isNaN(v['score']) ? 0 : parseInt(v['score'])).reduce((a, b) => a + b)) + '分'
} else if (index === 3) {
sums[index] = (data.map(v => v['zp']['zpf']).reduce((a, b) => parseInt(a) + parseInt(b))) + '分'
}
});
return sums
},
pageData() {
sublime.showLoadingbar();
this.tabLoading = true
$.post(base + "/platform/ghkh/zp/pageData", this.pageForm, (data) => {
sublime.closeLoadingbar();
this.tabLoading = false
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
},
async openAdd(row) {
const data = await $.post(base + "/platform/ghkh/khzb/getZb", {id: row.id})
data.nrs.forEach(v => {
v.bzs.forEach(x => {
if (!x.zp) {
x.zp = {zpf: 0}
}
})
})
this.formData = data
this.$refs.guava.edit()
},
async openEdit(row) {
const resa = await $.post(base + '/platform/ghkh/zp/openView', {id: row.id})
this.formData = resa.data
this.$refs.guava.edit()
},
async doAdd() {
this.addFormData = []
this.formData.nrs.forEach(n => {
let zp = {}
n.bzs.forEach(b => {
if (b.zp) {
zp = {
"zb_id": this.formData.id, "nr_id": n.id,
"bz_id": b.id, "clnr": b.zp.clnr, "zpf": b.zpf, "files": b.zp.files
}
} else {
zp = {"zb_id": this.formData.id, "nr_id": n.id, "bz_id": b.id, "zpf": b.zpf}
}
this.addFormData.push(zp)
})
})
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const res = await $.post(base + "/platform/ghkh/zp/doAdd", {zp: JSON.stringify(this.addFormData)})
if (res.code === 0) {
this.pageData()
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
loading.close()
const resa = await $.post(base + '/platform/ghkh/zp/openView', {id: this.formData.id})
await this.$nextTick()
this.formData = resa.data
},
doEdit() {
this.formData.nrs.forEach(nr => {
nr.bzs.forEach(bz => {
if (bz.zp) {
bz.zp = {
...bz.zp, "zpf": bz.zpf,
}
}
})
})
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.post(base + "/platform/ghkh/zp/doEdit", {zb: JSON.stringify(this.formData)}, (data) => {
if (data.code == 0) {
this.pageData()
this.$message.success(data.msg)
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
loading.close()
})
},
subXgh() {
this.formData.nrs.forEach(nr => {
nr.bzs.forEach(bz => {
if (bz.zp) {
bz.zp = {
"bz": bz.zp.bz,
"files": bz.zp.files,
"clnr": bz.zp.clnr,
"zb_id": this.formData.id,
"nr_id": nr.id,
"bz_id": bz.id,
"zpf": bz.zpf
}
/* bz.zp = {
...bz.zp, "zpf": bz.zpf,
}*/
} else {
bz.zp = {"zb_id": this.formData.id, "nr_id": nr.id, "bz_id": bz.id, "zpf": bz.zpf}
}
})
})
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.post(base + "/platform/ghkh/zp/subXgh", {zb: JSON.stringify(this.formData)}, (data) => {
if (data.code == 0) {
this.$refs.guava.index()
this.pageData()
this.$message.success(data.msg)
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
loading.close()
})
},
openView(row) {
$.post(loc() + "/findOne", {id: row.id}, (res) => {
res.data.nrs.forEach(nr => {
nr.bzs.forEach(bz => {
if (bz.zp) {
bz.zpf = bz.zp.zpf
bz.clnr = bz.zp.clnr
}
})
})
this.formData = res.data;
})
this.$refs.guava.view()
},
},
async created() {
this.pageData();
}
})
</script>
<!--#
}
#-->