自查自评

pg_adapter
dshclm 6 months ago
parent 37218618f0
commit f240606b12

@ -2,14 +2,17 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增检查报告管理')" />
<th:block th:include="include :: datetimepicker-css" />
<!-- <th:block th:include="include :: datetimepicker-css" />-->
<th:block th:include="include :: element-css" />
<th:block th:include="include :: select2-css" />
<!-- <th:block th:include="include :: select2-css" />-->
</head>
<style>
.layui-layer-btn{
display: none !important;
}
.el-select{
width: 100%;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
@ -17,45 +20,31 @@
<el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px">
<el-card>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="报告人员:" prop="adduser">
<el-input disabled v-model="postForm.adduser" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="报告人单位:" prop="depart">
<el-input disabled v-model="postForm.depart" :precision="1" :max="999999" type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="检查开始日期:" prop="checkStartTime">
<el-date-picker
type="date"
placeholder="选择日期"
v-model="postForm.checkStartTime"
style="width: 100%;"
disabled>
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检查类型:" prop="chackType">
<el-select v-model="postForm.checkType">
<el-option
v-for="item in checkTypeList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="所属地市:" prop="framework">
<el-select @change="getAreaList()" v-model="postForm.framework" class="filter-item">
<el-option
@ -67,7 +56,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="所属区县:" prop="area">
<el-select v-model="postForm.area" class="filter-item">
<el-option
@ -79,64 +68,117 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="检查结束日期:" prop="checkEndTime">
<el-date-picker
type="date"
placeholder="选择日期"
v-model="postForm.checkEndTime"
style="width: 100%;"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="实有项目总分:" prop="totalScore">
<el-input disabled v-model="postForm.totalScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实有项目得分:" prop="realScore">
<el-input disabled v-model="postForm.realScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="得分占比:" prop="percentageScore">
<el-input disabled v-model="postForm.percentageScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-card>
<div class="filter-container" style="margin-top: 25px;height: 310px">
<el-button class="filter-item" type="primary" icon="el-icon-plus" size="small" plain @click="handleAdd">
添加
</el-button>
<div class="filter-container" style="margin-top: 25px;height: 472px">
<el-table
:data="postForm.checkTypeDTOS"
:border="true"
style="width: 100%;margin-top: 25px;height: 90%;overflow: auto"
style="width: 100%;height: 100%;overflow:auto;"
@expand-change="handleChange"
height="472"
>
<el-table-column
label="检查项"
width="300"
align="center"
>
<template v-slot="scope">
<el-select v-model="scope.row.checkType" class="filter-item">
<el-option
v-for="item in reportCheckList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column
label="检查内容"
>
<template v-slot="scope">
<el-input v-model="scope.row.typeContent" type="textarea" />
<el-table-column type="expand">
<template slot-scope="props">
<el-table border :data="props.row.children" v-loading="loading" style="width: 100%">
<el-table-column
label="自查项"
prop="checkItems"
width="200"
>
</el-table-column>
<el-table-column
label="自查内容"
prop="typeContent"
width="500"
>
</el-table-column>
<el-table-column
label="分值"
prop="score"
align="center"
>
</el-table-column>
<el-table-column
label="实有内容"
prop="starts"
align="center"
>
<template v-slot="scope">
<el-checkbox
@change="handleCheckChange(scope.row)"
true-label="1"
v-model="scope.row.starts"
false-label=""
>
</el-checkbox>
</template>
</el-table-column>
<el-table-column
label="得分"
prop="realScore">
<template v-slot="scope">
<el-input
:disabled="scope.row.ifstarts"
v-model="scope.row.realScore"
@blur="handleBlur(scope.row,props.row)"
@input="handleInput(scope.row)"
>
</el-input>
</template>
</el-table-column>
<el-table-column
label="扣分标准"
prop="deductionCriteria"
width="500">
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
width="100px"
>
<template v-slot="scope">
<el-button type="danger" icon="el-icon-delete" circle @click="removeItem(scope.$index)" />
</template>
label="自查类"
prop="typeName">
</el-table-column>
</el-table>
</div>
<div style="position: fixed;bottom: -58px;right: 21px;">
<el-button type="primary" icon="el-icon-check" @click="submitForm">保存</el-button>
<el-button type="info" icon="el-icon-back" @click="closeItem()">返回</el-button>
</div>
</el-form>
<div style="position: fixed;bottom: -31px;right: 21px;">
<el-button type="primary" icon="el-icon-check" @click="submitForm">保存</el-button>
<el-button type="info" icon="el-icon-back" @click="closeItem()">返回</el-button>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<!-- <th:block th:include="include :: datetimepicker-js" />-->
<th:block th:include="include :: element-js" />
<th:block th:include="include :: select2-js" />
<!-- <th:block th:include="include :: select2-js" />-->
<script th:inline="javascript">
var prefix = ctx + "system/checkReport"
$("#form-check-add").validate({
@ -145,6 +187,7 @@
var app = new Vue({
el: '#app',
data: {
loading:'false',
CityList: [],
AreaList:[],
params:{
@ -153,16 +196,23 @@
quTypeDisabled: false,
itemImage: true,
postForm: {
checkTypeDTOS: [],
checkTypeDTOS:[],
framework:'',
area:'',
adduser: [[${user.userName}]],
depart: [[${user.dept.deptName}]],
checkStartTime: '',
checkType: '',
checkEndTime:'',
percentageScore:'',
realScore:'',
totalScore:'',
},
reportCheckList: [],
checkTypeList:[],
cachedData: [], // 新增缓存变量
checkTypeSave: [],
selectedItemIds: [],
checkedStates: {},
tempData:{},
startsArry:[],
rules: {
adduser: [
{ required: true, message: '报告人员不能为空!' }
@ -171,17 +221,19 @@
depart: [
{ required: true, message: '报告人单位不能为空!' }
],
checkStartTime: [
{ required: true, message: '检查开始时间不能为空!' }
],
framework: [
{ required: true, message: '所属地市不能为空!' }
],
area: [
{ required: true, message: '所属区县不能为空!' }
],
checkStartTime: [
{ required: true, message: '请选择检查开始日期', trigger: 'change' }
],
checkEndTime: [
{ required: true, message: '请选择检查结束日期', trigger: 'change' },
// { validator: this.validateEndTime, trigger: 'change' }
]
},
},
@ -191,26 +243,116 @@
if (this.postForm.framework){
this.getAreaList()
}
$.ajax({
url:'/system/dict/data/list',
type:'POST',
data:{dictType: 'sys_check_type_report'},
success:((res)=>{
this.reportCheckList = res.rows
})
})
$.ajax({
url:'/system/dict/data/list',
type:'POST',
data:{dictType: 'sys_check_type'},
success:((res)=>{
this.checkTypeList = res.rows
})
})
var date = new Date();
this.postForm.checkStartTime = this.formatDateToCustomString(date);
this.getCheckView()
},
methods:{
validateEndTime(rule, value, callback) {
// if (value && this.postForm.checkStartTime && new Date(value).getTime() < new Date(this.postForm.checkStartTime).getTime()) {
// callback(new Error('结束日期不能早于开始日期'));
// } else {
// callback();
// }
},
handleChange(row, expandedRows){
this.loading = true;
if (expandedRows.length > 0) {
// 检查缓存中是否已经存在对应的数据
const cachedRow = this.cachedData.find((item) => item.checkType === row.checkType);
if (cachedRow) {
row.children = cachedRow.children;
this.loading = false;
} else {
$.ajax({
url: '/system/checkReport/checkView/' + row.checkType + '/' + row.typeName,
type: 'GET',
success: ((res) => {
if (res.code === web_status.SUCCESS) {
res.data.forEach((item) => {
Object.assign(item, { ifstarts: true });
});
// 将请求到的数据缓存起来
this.updateCachedData(this.cachedData, {...row, children: res.data });
row.children = res.data;
this.loading = false;
}
}),
});
}
}
},
handleCheckChange(row, expandedRows){
// this.$refs.realScoreMax.$refs.input.max = parseFloat(row.score)
// console.log(this.$refs.realScoreMax.$refs.input.max)
if (!this.startsArry){
this.startsArry = []
}
if (row.starts){
row.ifstarts = false
if (!this.startsArry.includes(row)) {
this.startsArry.push(row);
}
this.calculateTotalScore('totalScore')
}else{
row.ifstarts = true
let index = this.startsArry.indexOf(row);
if (index > -1) {
this.startsArry.splice(index, 1);
}
this.calculateTotalScore('totalScore')
row.realScore = ''
}
},
calculateTotalScore(value) {
if (value == 'totalScore'){
this.postForm.totalScore = this.startsArry.reduce((sum, row) => {
return sum + parseFloat(row.score)
}, 0);
}
if (value == 'realScore'){
this.postForm.realScore = this.startsArry.reduce((sum, row) => {
return sum + parseFloat(row.realScore)
}, 0);
}
},
handleBlur(row,rows){
this.updateCachedData(this.cachedData, rows);
const min =0;
const max = parseFloat(row.score);
if (parseFloat(row.realScore) < min) {
row.realScore = min;
}
if (parseFloat(row.realScore) > max) {
row.realScore = max;
}
this.calculateTotalScore('realScore')
this.postForm.percentageScore = this.postForm.realScore / this.postForm.totalScore * 100;
},
handleInput(row, props) {
row.realScore = row.realScore.replace(/[^0-9.]/g, '');
},
updateCachedData(cachedData, rows) {
for (let i = 0; i < cachedData.length; i++) {
if (cachedData[i].checkType === rows.checkType) {
cachedData[i] = rows;
return;
}
}
cachedData.push(rows);
},
//获取外层数据
getCheckView() {
$.ajax({
url: '/system/checkReport/checkViewParent/sys_check_type_report',
type: 'GET',
success: ((res) => {
res.data.forEach(item => {
Object.assign(item, { children: [] });
});
this.postForm.checkTypeDTOS = res.data;
})
});
},
formatDateToCustomString(date) {
var year = date.getFullYear();
var month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始所以加1
@ -242,46 +384,31 @@
}) ,
});
},
// 添加子项
handleAdd() {
this.postForm.checkTypeDTOS.push({checkType:'', typeContent: '',})
},
removeItem(index) {
this.postForm.checkTypeDTOS.splice(index, 1)
},
successTabCallback(result) {
if (result.data.code == web_status.SUCCESS) {
var parent = activeWindow();
if ($.common.isEmpty(parent.table)) {
$.modal.msgSuccessReload(result.data.msg);
} else if (parent.table.options.type == table_type.bootstrapTable) {
$.modal.close();
parent.$.modal.msgSuccess(result.data.msg);
parent.$.table.refresh();
} else if (parent.table.options.type == table_type.bootstrapTreeTable) {
$.modal.close();
parent.$.modal.msgSuccess(result.data.msg);
parent.$.treeTable.refresh();
}
} else if (result.data.code == web_status.WARNING) {
$.modal.alertWarning(result.data.msg)
} else {
$.modal.alertError(result.data.msg);
}
$.modal.closeLoading();
$.modal.enable();
},
submitForm() {
this.$refs.postForm.validate((valid) => {
console.log(this.postForm)
const hasEmptyRealScore = this.cachedData.some(item => {
return item.children.some(child => {
return child.starts && !child.realScore;
});
});
if (hasEmptyRealScore){
$.modal.alertWarning("所选自查项内有未评分项,请检查");
}
// console.log(hasEmptyRealScore);
// console.log(this.cachedData)
if (!valid) {
return
}
let that = this
// this.postForm.checkTypeDTOS = []
this.postForm.checkTypeDTOS = this.cachedData.reduce((acc, item) => {
return acc.concat(item.children);
}, []);
this.postForm.checkStartTime = this.formatDateToCustomString(new Date(this.postForm.checkStartTime))
this.postForm.checkEndTime = this.formatDateToCustomString(new Date(this.postForm.checkEndTime))
axios.post(prefix + '/add', this.postForm)
.then(function (response) {
if (response.data.code === 0) {
$.operate.successCallback(response.data);
$.operate.successTabCallback(response.data);
}else{
$.modal.alertError(response.data.msg)
}
@ -292,7 +419,7 @@
})
},
closeItem(){
$.modal.close()
$.modal.closeTab()
}
}
})

@ -126,14 +126,7 @@
},
{
field: 'checkStartTime',
title: '检查开始时间'
},
{
field: 'checkState',
title: '检查状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(checkStateDatas, value);
}
title: '检查开始时间',
},
{
field: 'createTime',
@ -145,9 +138,8 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.checkId + '\')"><i class="fa fa-edit"></i>详情</a> ');
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.checkId + '\')"><i class="fa fa-edit"></i>详情</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="openEdit(\'' + row.checkId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + selfCheckFlag + '" href="javascript:void(0)" onclick="selfcheck(\'' + row.checkId + '\')"><i class="fa fa-edit"></i>初检</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.checkId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
@ -207,23 +199,18 @@
})
}
function openAdd(){
$.modal.openOptions({
title: '添加' + table.options.modalName,
url: prefix + '/add',
width: "900",
showButtonPanel: false,
btn: 0,
})
// $.modal.openOptions({
// title: '添加' + table.options.modalName,
// url: prefix + '/add',
// width: "900",
// showButtonPanel: false,
// btn: 0,
// })
$.modal.openTab("添加" + table.options.modalName, prefix + '/add');
}
// $.modal.open("修改" + table.options.modalName, );
function openEdit(id){
$.modal.openOptions({
title: '修改' + table.options.modalName,
url: $.operate.editUrl(id),
width: "900",
showButtonPanel: false,
btn: 0,
})
$.modal.openTab("修改" + table.options.modalName, prefix + '/edit' + '/' + id);
}
</script>
</body>

@ -1,15 +1,18 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('检查报告管理详情')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: header('修改检查报告管理')" />
<!-- <th:block th:include="include :: datetimepicker-css" />-->
<th:block th:include="include :: element-css" />
<th:block th:include="include :: select2-css" />
<!-- <th:block th:include="include :: select2-css" />-->
</head>
<style>
.layui-layer-btn{
display: none !important;
}
.el-select{
width: 100%;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
@ -17,31 +20,35 @@
<el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px">
<el-card>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="报告人员:" prop="adduser">
<el-input disabled v-model="postForm.adduser" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="报告人单位:" prop="depart">
<el-input disabled v-model="postForm.depart" :precision="1" :max="999999" type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-col :span="8">
<el-form-item label="检查开始日期:" prop="checkStartTime">
<el-date-picker
type="date"
placeholder="选择日期"
v-model="postForm.checkStartTime"
style="width: 100%;"
disabled
<el-form-item label="检查开始日期:" prop="checkStartTime">
<el-date-picker
type="date"
placeholder="选择日期"
v-model="postForm.checkStartTime"
style="width: 100%;"
disabled>
</el-date-picker>
</el-form-item>
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="所属地市:" prop="framework">
<el-select disabled @change="getAreaList()" v-model="postForm.framework" class="filter-item">
<el-select @change="getAreaList()" disabled v-model="postForm.framework" class="filter-item">
<el-option
v-for="item in CityList"
:key="item.id"
@ -51,9 +58,9 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item disabled label="所属区县:" prop="area">
<el-select disabled v-model="postForm.area" class="filter-item">
<el-col :span="8">
<el-form-item label="所属区县:" prop="area">
<el-select v-model="postForm.area" disabled class="filter-item">
<el-option
v-for="item in AreaList"
:key="item.id"
@ -63,54 +70,110 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="检查结束日期:" prop="checkEndTime">
<el-date-picker
type="date"
placeholder="选择日期"
v-model="postForm.checkEndTime"
style="width: 100%;"
disabled
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="实有项目总分:" prop="totalScore">
<el-input disabled v-model="postForm.totalScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实有项目得分:" prop="realScore">
<el-input disabled v-model="postForm.realScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="得分占比:" prop="percentageScore">
<el-input disabled v-model="postForm.percentageScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-card>
<div class="filter-container" style="margin-top: 25px;height: 310px">
<el-button disabled class="filter-item" type="primary" icon="el-icon-plus" size="small" plain @click="handleAdd">
添加
</el-button>
<div class="filter-container" style="margin-top: 25px;height: 472px">
<el-table
:data="postForm.checkTypeDTOS"
:border="true"
style="width: 100%;margin-top: 25px;height: 90%;overflow: auto"
style="width: 100%;height: 100%;overflow:auto;"
@expand-change="handleChange"
height="472"
>
<el-table-column
label="检查项"
width="300"
align="center"
>
<template v-slot="scope">
<el-select disabled v-model="scope.row.checkType" class="filter-item">
<el-option
v-for="item in reportCheckList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue">
</el-option>
</el-select>
<el-table-column type="expand">
<template slot-scope="props">
<el-table border :data="props.row.children" v-loading="loading" style="width: 100%">
<el-table-column
label="自查项"
prop="checkItems"
width="200"
>
</el-table-column>
<el-table-column
label="自查内容"
prop="typeContent"
width="500"
>
</el-table-column>
<el-table-column
label="分值"
prop="score"
align="center"
>
</el-table-column>
<el-table-column
label="实有内容"
prop="starts"
align="center"
>
<template v-slot="scope">
<el-checkbox
@change="handleCheckChange(scope.row)"
true-label="1"
v-model="scope.row.starts"
false-label=""
disabled
>
</el-checkbox>
</template>
</el-table-column>
<el-table-column
label="得分"
prop="realScore">
<template v-slot="scope">
<el-input
disabled
v-model="scope.row.realScore"
@blur="handleBlur(scope.row,props.row)"
@input="handleInput(scope.row)"
>
</el-input>
</template>
</el-table-column>
<el-table-column
label="扣分标准"
prop="deductionCriteria"
width="500">
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column
label="检查内容"
>
<template v-slot="scope">
<el-input disabled v-model="scope.row.typeContent" type="textarea" />
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
width="100px"
>
<template v-slot="scope">
<el-button disabled type="danger" icon="el-icon-delete" circle @click="removeItem(scope.$index)" />
</template>
label="自查类"
prop="typeName">
</el-table-column>
</el-table>
</div>
<!-- <div style="position: fixed;bottom: -58px;right: 21px;">-->
<!-- <div style="position: fixed;bottom: -31px;right: 21px;">-->
<!-- <el-button type="primary" icon="el-icon-check" @click="submitForm">保存</el-button>-->
<!-- <el-button type="info" icon="el-icon-back" @click="closeItem()">返回</el-button>-->
<!-- </div>-->
@ -118,9 +181,9 @@
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<!--<th:block th:include="include :: datetimepicker-js" />-->
<th:block th:include="include :: element-js" />
<th:block th:include="include :: select2-js" />
<!--<th:block th:include="include :: select2-js" />-->
<script th:inline="javascript">
var prefix = ctx + "system/checkReport"
$("#form-check-add").validate({
@ -129,6 +192,7 @@
var app = new Vue({
el: '#app',
data: {
loading:'false',
CityList: [],
AreaList:[],
params:{
@ -143,8 +207,18 @@
adduser: [[${tdCheckReportDTO.adduser}]],
depart: [[${tdCheckReportDTO.depart}]],
checkStartTime: '',
checkEndTime:'',
percentageScore:0,
realScore:0,
totalScore:0,
},
reportCheckList: [],
cachedData: [], // 新增缓存变量
checkTypeSave: [],
selectedItemIds: [],
checkedStates: {},
tempData:{},
startsArry:[],
editcheckTypeDTOS:[],
rules: {
adduser: [
{ required: true, message: '报告人员不能为空!' }
@ -153,23 +227,26 @@
depart: [
{ required: true, message: '报告人单位不能为空!' }
],
checkStartTime: [
{ required: true, message: '检查开始时间不能为空!' }
],
framework: [
{ required: true, message: '所属地市不能为空!' }
],
area: [
{ required: true, message: '所属区县不能为空!' }
],
checkStartTime: [
{ required: true, message: '请选择检查开始日期', trigger: 'change' }
],
checkEndTime: [
{ required: true, message: '请选择检查结束日期', trigger: 'change' },
// { validator: this.validateEndTime, trigger: 'change' }
]
},
},
mounted(){
if([[${tdCheckReportDTO}]].checkTypeDTOS){
this.postForm = [[${tdCheckReportDTO}]]
this.editcheckTypeDTOS = [[${tdCheckReportDTO}]].checkTypeDTOS
}else{
this.postForm = [[${tdCheckReportDTO}]]
this.postForm.checkTypeDTOS = []
@ -179,20 +256,13 @@
if (this.postForm.framework){
this.getAreaList()
}
$.ajax({
url:'/system/dict/data/list',
type:'POST',
data:{dictType: 'sys_check_type_report'},
success:((res)=>{
this.reportCheckList = res.rows
})
})
var date = new Date();
this.postForm.checkStartTime = this.formatDateToCustomString(date);
this.postForm.createTime = this.formatISO8601ToDateTime([[${tdCheckReportDTO}]].createTime);
if ([[${tdCheckReportDTO}]].checkEndTime){
this.postForm.checkEndTime = this.formatISO8601ToDateTime([[${tdCheckReportDTO}]].checkEndTime);
}
this.getCheckView()
// var date = new Date();
// this.postForm.checkStartTime = this.formatDateToCustomString(date);
// this.postForm.createTime = this.formatISO8601ToDateTime([[${tdCheckReportDTO}]].createTime);
// if ([[${tdCheckReportDTO}]].checkEndTime){
// this.postForm.checkEndTime = this.formatISO8601ToDateTime([[${tdCheckReportDTO}]].checkEndTime);
// }
},
methods:{
formatISO8601ToDateTime(isoString) {
@ -217,6 +287,118 @@
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
validateEndTime(rule, value, callback) {
// if (value && this.postForm.checkStartTime && new Date(value).getTime() < new Date(this.postForm.checkStartTime).getTime()) {
// callback(new Error('结束日期不能早于开始日期'));
// } else {
// callback();
// }
},
handleChange(row, expandedRows){
this.loading = true;
if (expandedRows.length > 0) {
// 检查缓存中是否已经存在对应的数据
const cachedRow = this.cachedData.find((item) => item.checkType === row.checkType);
if (cachedRow) {
row.children = cachedRow.children;
this.loading = false;
} else {
// $.ajax({
// url: '/system/checkReport/checkView/' + row.checkType + '/' + row.typeName,
// type: 'GET',
// success: ((res) => {
// if (res.code === web_status.SUCCESS) {
// res.data.forEach((item) => {
// Object.assign(item, { ifstarts: true });
// });
// // 将请求到的数据缓存起来
// this.updateCachedData(this.cachedData, {...row, children: res.data });
// row.children = res.data;
// this.loading = false;
// }
// }),
// });
row.children = []
this.editcheckTypeDTOS.forEach(item => {
if (item.checkType === row.checkType) {
row.children.push(item);
}
});
this.updateCachedData(this.cachedData, {...row, children: row.children });
this.loading = false
}
}
},
handleCheckChange(row, expandedRows){
// console.log(this.editcheckTypeDTOS)
// console.log(row)
let existingData = this.editcheckTypeDTOS.find(item => row.itemsType === item.itemsType);
if (!this.startsArry){
this.startsArry = []
}
if (row.starts){
row.ifstarts = false
let totalScore = parseFloat(this.postForm.totalScore)
let score = parseFloat(row.score)
this.postForm.totalScore = totalScore + score
// if (!this.startsArry.includes(row)) {
// this.startsArry.push(row);
// }
// this.calculateTotalScore('totalScore')
}else{
row.ifstarts = true
let totalScore = parseFloat(this.postForm.totalScore)
let score = parseFloat(row.score)
let realScore = parseFloat(this.postForm.realScore)
this.postForm.totalScore = totalScore - score
this.postForm.realScore = realScore - parseFloat(row.realScore)
// let index = this.startsArry.indexOf(row);
// if (index > -1) {
// this.startsArry.splice(index, 1);
// }
// this.calculateTotalScore('totalScore')
row.realScore = 0
}
},
handleBlur(row,rows){
this.updateCachedData(this.cachedData, rows);
const min =0;
const max = parseFloat(row.score);
if (parseFloat(row.realScore) < min) {
row.realScore = min;
}
if (parseFloat(row.realScore) > max) {
row.realScore = max;
}
let realScore = parseFloat(this.postForm.realScore)
this.postForm.realScore = realScore + parseFloat(row.realScore)
this.postForm.percentageScore = this.postForm.realScore / this.postForm.totalScore * 100;
},
handleInput(row, props) {
row.realScore = row.realScore.replace(/[^0-9.]/g, '');
},
updateCachedData(cachedData, rows) {
for (let i = 0; i < cachedData.length; i++) {
if (cachedData[i].checkType === rows.checkType) {
cachedData[i] = rows;
return;
}
}
cachedData.push(rows);
},
//获取外层数据
getCheckView() {
$.ajax({
url: '/system/checkReport/checkViewParent/sys_check_type_report',
type: 'GET',
success: ((res) => {
res.data.forEach(item => {
Object.assign(item, { children: [] });
});
this.postForm.checkTypeDTOS = res.data;
})
});
},
getCityList(){
$.ajax({
url: ctx + "system/area/getSysAreaList",
@ -239,49 +421,38 @@
}) ,
});
},
// 添加子项
handleAdd() {
console.log(
this.postForm
)
this.postForm.checkTypeDTOS.push({checkType:'', typeContent: '',})
},
removeItem(index) {
this.postForm.checkTypeDTOS.splice(index, 1)
},
successTabCallback(result) {
if (result.data.code == web_status.SUCCESS) {
var parent = activeWindow();
if ($.common.isEmpty(parent.table)) {
$.modal.msgSuccessReload(result.data.msg);
} else if (parent.table.options.type == table_type.bootstrapTable) {
$.modal.close();
parent.$.modal.msgSuccess(result.data.msg);
parent.$.table.refresh();
} else if (parent.table.options.type == table_type.bootstrapTreeTable) {
$.modal.close();
parent.$.modal.msgSuccess(result.data.msg);
parent.$.treeTable.refresh();
}
} else if (result.data.code == web_status.WARNING) {
$.modal.alertWarning(result.data.msg)
} else {
$.modal.alertError(result.data.msg);
}
$.modal.closeLoading();
$.modal.enable();
},
submitForm() {
this.$refs.postForm.validate((valid) => {
console.log(this.postForm)
const hasEmptyRealScore = this.cachedData.some(item => {
return item.children.some(child => {
return child.starts && !child.realScore;
});
});
if (hasEmptyRealScore){
$.modal.alertWarning("所选自查项内有未评分项,请检查");
}
// console.log(hasEmptyRealScore);
// console.log(this.cachedData)
if (!valid) {
return
}
let that = this
// this.postForm.checkTypeDTOS = this.cachedData.reduce((acc, item) => {
// return acc.concat(item.children);
// }, []);
this.postForm.checkTypeDTOS = this.editcheckTypeDTOS.map(editItem => {
let cachedItem = this.cachedData.find(cachedItem => cachedItem.itemsType === editItem.itemsType);
if (cachedItem) {
return {...editItem, ...cachedItem};
}
return editItem;
})
this.postForm.checkStartTime = this.formatISO8601ToDateTime(this.postForm.checkStartTime)
this.postForm.checkEndTime = this.formatISO8601ToDateTime(this.postForm.checkEndTime)
this.postForm.createTime = this.formatISO8601ToDateTime(this.postForm.createTime)
axios.post(prefix + '/edit', this.postForm)
.then(function (response) {
if (response.data.code === 0) {
$.operate.successCallback(response.data);
$.operate.successTabCallback(response.data);
}else{
$.modal.alertError(response.data.msg)
}
@ -292,7 +463,7 @@
})
},
closeItem(){
$.modal.close()
$.modal.closeTab()
}
}
})

@ -2,14 +2,17 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改检查报告管理')" />
<th:block th:include="include :: datetimepicker-css" />
<!-- <th:block th:include="include :: datetimepicker-css" />-->
<th:block th:include="include :: element-css" />
<th:block th:include="include :: select2-css" />
<!-- <th:block th:include="include :: select2-css" />-->
</head>
<style>
.layui-layer-btn{
display: none !important;
}
.el-select{
width: 100%;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
@ -17,46 +20,31 @@
<el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px">
<el-card>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="报告人员:" prop="adduser">
<el-input disabled v-model="postForm.adduser" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="报告人单位:" prop="depart">
<el-input disabled v-model="postForm.depart" :precision="1" :max="999999" type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="检查开始日期:" prop="checkStartTime">
<el-date-picker
type="date"
placeholder="选择日期"
v-model="postForm.checkStartTime"
style="width: 100%;"
disabled>
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检查类型:" prop="chackType">
<el-select v-model="postForm.checkType">
<el-option
v-for="item in checkTypeList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="所属地市:" prop="framework">
<el-select @change="getAreaList()" v-model="postForm.framework" class="filter-item">
<el-option
@ -68,7 +56,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="所属区县:" prop="area">
<el-select v-model="postForm.area" class="filter-item">
<el-option
@ -80,54 +68,113 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="检查结束日期:" prop="checkEndTime">
<el-date-picker
type="date"
placeholder="选择日期"
v-model="postForm.checkEndTime"
style="width: 100%;"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="实有项目总分:" prop="totalScore">
<el-input disabled v-model="postForm.totalScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实有项目得分:" prop="realScore">
<el-input disabled v-model="postForm.realScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="得分占比:" prop="percentageScore">
<el-input disabled v-model="postForm.percentageScore" placeholder="请选择自查项" type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-card>
<div class="filter-container" style="margin-top: 25px;height: 310px">
<el-button class="filter-item" type="primary" icon="el-icon-plus" size="small" plain @click="handleAdd">
添加
</el-button>
<div class="filter-container" style="margin-top: 25px;height: 472px">
<el-table
:data="postForm.checkTypeDTOS"
:border="true"
style="width: 100%;margin-top: 25px;height: 90%;overflow: auto"
style="width: 100%;height: 100%;overflow:auto;"
@expand-change="handleChange"
height="472"
>
<el-table-column
label="报告类型"
width="300"
align="center"
>
<template v-slot="scope">
<el-select v-model="scope.row.checkType" class="filter-item">
<el-option
v-for="item in reportCheckList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column
label="报告内容"
>
<template v-slot="scope">
<el-input v-model="scope.row.typeContent" type="textarea" />
<el-table-column type="expand">
<template slot-scope="props">
<el-table border :data="props.row.children" v-loading="loading" style="width: 100%">
<el-table-column
label="自查项"
prop="checkItems"
width="200"
>
</el-table-column>
<el-table-column
label="自查内容"
prop="typeContent"
width="500"
>
</el-table-column>
<el-table-column
label="分值"
prop="score"
align="center"
>
</el-table-column>
<el-table-column
label="实有内容"
prop="starts"
align="center"
>
<template v-slot="scope">
<el-checkbox
@change="handleCheckChange(scope.row)"
true-label="1"
v-model="scope.row.starts"
false-label=""
>
</el-checkbox>
</template>
</el-table-column>
<el-table-column
label="得分"
prop="realScore">
<template v-slot="scope">
<el-input
:disabled="scope.row.ifstarts"
v-model="scope.row.realScore"
@blur="handleBlur(scope.row,props.row)"
@input="handleInput(scope.row)"
>
</el-input>
</template>
</el-table-column>
<el-table-column
label="扣分标准"
prop="deductionCriteria"
width="500">
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
width="100px"
>
<template v-slot="scope">
<el-button type="danger" icon="el-icon-delete" circle @click="removeItem(scope.$index)" />
</template>
label="自查类"
prop="typeName">
</el-table-column>
</el-table>
</div>
<div style="position: fixed;bottom: -58px;right: 21px;">
<div>
<span style="font-size: 16px;color: red">
提示:修改分数时,先取消实有内容列的选择状态(清除原有分数),再次选中后填写分数即可!
</span>
</div>
<div style="position: fixed;bottom: -9px;right: 21px;">
<el-button type="primary" icon="el-icon-check" @click="submitForm">保存</el-button>
<el-button type="info" icon="el-icon-back" @click="closeItem()">返回</el-button>
</div>
@ -135,9 +182,9 @@
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<!--<th:block th:include="include :: datetimepicker-js" />-->
<th:block th:include="include :: element-js" />
<th:block th:include="include :: select2-js" />
<!--<th:block th:include="include :: select2-js" />-->
<script th:inline="javascript">
var prefix = ctx + "system/checkReport"
$("#form-check-add").validate({
@ -146,6 +193,7 @@
var app = new Vue({
el: '#app',
data: {
loading:'false',
CityList: [],
AreaList:[],
params:{
@ -160,10 +208,18 @@
adduser: [[${tdCheckReportDTO.adduser}]],
depart: [[${tdCheckReportDTO.depart}]],
checkStartTime: '',
checkType: '',
checkEndTime:'',
percentageScore:0,
realScore:0,
totalScore:0,
},
reportCheckList: [],
checkTypeList:[],
cachedData: [], // 新增缓存变量
checkTypeSave: [],
selectedItemIds: [],
checkedStates: {},
tempData:{},
startsArry:[],
editcheckTypeDTOS:[],
rules: {
adduser: [
{ required: true, message: '报告人员不能为空!' }
@ -172,23 +228,26 @@
depart: [
{ required: true, message: '报告人单位不能为空!' }
],
checkStartTime: [
{ required: true, message: '检查开始时间不能为空!' }
],
framework: [
{ required: true, message: '所属地市不能为空!' }
],
area: [
{ required: true, message: '所属区县不能为空!' }
],
checkStartTime: [
{ required: true, message: '请选择检查开始日期', trigger: 'change' }
],
checkEndTime: [
{ required: true, message: '请选择检查结束日期', trigger: 'change' },
// { validator: this.validateEndTime, trigger: 'change' }
]
},
},
mounted(){
if([[${tdCheckReportDTO}]].checkTypeDTOS){
this.postForm = [[${tdCheckReportDTO}]]
this.editcheckTypeDTOS = [[${tdCheckReportDTO}]].checkTypeDTOS
}else{
this.postForm = [[${tdCheckReportDTO}]]
this.postForm.checkTypeDTOS = []
@ -198,28 +257,13 @@
if (this.postForm.framework){
this.getAreaList()
}
$.ajax({
url:'/system/dict/data/list',
type:'POST',
data:{dictType: 'sys_check_type_report'},
success:((res)=>{
this.reportCheckList = res.rows
})
})
$.ajax({
url:'/system/dict/data/list',
type:'POST',
data:{dictType: 'sys_check_type'},
success:((res)=>{
this.checkTypeList = res.rows
})
})
var date = new Date();
this.postForm.checkStartTime = this.formatDateToCustomString(date);
this.postForm.createTime = this.formatISO8601ToDateTime([[${tdCheckReportDTO}]].createTime);
if ([[${tdCheckReportDTO}]].checkEndTime){
this.postForm.checkEndTime = this.formatISO8601ToDateTime([[${tdCheckReportDTO}]].checkEndTime);
}
this.getCheckView()
// var date = new Date();
// this.postForm.checkStartTime = this.formatDateToCustomString(date);
// this.postForm.createTime = this.formatISO8601ToDateTime([[${tdCheckReportDTO}]].createTime);
// if ([[${tdCheckReportDTO}]].checkEndTime){
// this.postForm.checkEndTime = this.formatISO8601ToDateTime([[${tdCheckReportDTO}]].checkEndTime);
// }
},
methods:{
formatISO8601ToDateTime(isoString) {
@ -244,6 +288,120 @@
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
validateEndTime(rule, value, callback) {
// if (value && this.postForm.checkStartTime && new Date(value).getTime() < new Date(this.postForm.checkStartTime).getTime()) {
// callback(new Error('结束日期不能早于开始日期'));
// } else {
// callback();
// }
},
handleChange(row, expandedRows){
this.loading = true;
if (expandedRows.length > 0) {
// 检查缓存中是否已经存在对应的数据
const cachedRow = this.cachedData.find((item) => item.checkType === row.checkType);
if (cachedRow) {
row.children = cachedRow.children;
this.loading = false;
} else {
// $.ajax({
// url: '/system/checkReport/checkView/' + row.checkType + '/' + row.typeName,
// type: 'GET',
// success: ((res) => {
// if (res.code === web_status.SUCCESS) {
// res.data.forEach((item) => {
// Object.assign(item, { ifstarts: true });
// });
// // 将请求到的数据缓存起来
// this.updateCachedData(this.cachedData, {...row, children: res.data });
// row.children = res.data;
// this.loading = false;
// }
// }),
// });
row.children = []
this.editcheckTypeDTOS.forEach(item => {
if (item.checkType === row.checkType) {
row.children.push(item);
}
Object.assign(item, { ifstarts: true });
});
this.updateCachedData(this.cachedData, {...row, children: row.children });
this.loading = false
}
}
},
handleCheckChange(row, expandedRows){
// console.log(this.editcheckTypeDTOS)
// console.log(row)
let existingData = this.editcheckTypeDTOS.find(item => row.itemsType === item.itemsType);
if (!this.startsArry){
this.startsArry = []
}
if (row.starts){
row.ifstarts = false
let totalScore = parseFloat(this.postForm.totalScore)
let score = parseFloat(row.score)
this.postForm.totalScore = totalScore + score
// if (!this.startsArry.includes(row)) {
// this.startsArry.push(row);
// }
// this.calculateTotalScore('totalScore')
}else{
debugger
row.ifstarts = true
let totalScore = parseFloat(this.postForm.totalScore)
let score = parseFloat(row.score)
let realScore = parseFloat(this.postForm.realScore)
this.postForm.totalScore = totalScore - score
this.postForm.realScore = realScore - parseFloat(row.realScore == null ? 0 : row.realScore)
// let index = this.startsArry.indexOf(row);
// if (index > -1) {
// this.startsArry.splice(index, 1);
// }
// this.calculateTotalScore('totalScore')
row.realScore = 0
}
},
handleBlur(row,rows){
this.updateCachedData(this.cachedData, rows);
const min =0;
const max = parseFloat(row.score);
if (parseFloat(row.realScore) < min) {
row.realScore = min;
}
if (parseFloat(row.realScore) > max) {
row.realScore = max;
}
let realScore = parseFloat(this.postForm.realScore)
this.postForm.realScore = realScore + parseFloat(row.realScore)
this.postForm.percentageScore = this.postForm.realScore / this.postForm.totalScore * 100;
},
handleInput(row, props) {
row.realScore = row.realScore.replace(/[^0-9.]/g, '');
},
updateCachedData(cachedData, rows) {
for (let i = 0; i < cachedData.length; i++) {
if (cachedData[i].checkType === rows.checkType) {
cachedData[i] = rows;
return;
}
}
cachedData.push(rows);
},
//获取外层数据
getCheckView() {
$.ajax({
url: '/system/checkReport/checkViewParent/sys_check_type_report',
type: 'GET',
success: ((res) => {
res.data.forEach(item => {
Object.assign(item, { children: [] });
});
this.postForm.checkTypeDTOS = res.data;
})
});
},
getCityList(){
$.ajax({
url: ctx + "system/area/getSysAreaList",
@ -266,49 +424,38 @@
}) ,
});
},
// 添加子项
handleAdd() {
console.log(
this.postForm
)
this.postForm.checkTypeDTOS.push({checkType:'', typeContent: '',})
},
removeItem(index) {
this.postForm.checkTypeDTOS.splice(index, 1)
},
successTabCallback(result) {
if (result.data.code == web_status.SUCCESS) {
var parent = activeWindow();
if ($.common.isEmpty(parent.table)) {
$.modal.msgSuccessReload(result.data.msg);
} else if (parent.table.options.type == table_type.bootstrapTable) {
$.modal.close();
parent.$.modal.msgSuccess(result.data.msg);
parent.$.table.refresh();
} else if (parent.table.options.type == table_type.bootstrapTreeTable) {
$.modal.close();
parent.$.modal.msgSuccess(result.data.msg);
parent.$.treeTable.refresh();
}
} else if (result.data.code == web_status.WARNING) {
$.modal.alertWarning(result.data.msg)
} else {
$.modal.alertError(result.data.msg);
}
$.modal.closeLoading();
$.modal.enable();
},
submitForm() {
this.$refs.postForm.validate((valid) => {
console.log(this.postForm)
const hasEmptyRealScore = this.cachedData.some(item => {
return item.children.some(child => {
return child.starts && !child.realScore;
});
});
if (hasEmptyRealScore){
$.modal.alertWarning("所选自查项内有未评分项,请检查");
}
// console.log(hasEmptyRealScore);
// console.log(this.cachedData)
if (!valid) {
return
}
let that = this
// this.postForm.checkTypeDTOS = this.cachedData.reduce((acc, item) => {
// return acc.concat(item.children);
// }, []);
this.postForm.checkTypeDTOS = this.editcheckTypeDTOS.map(editItem => {
let cachedItem = this.cachedData.find(cachedItem => cachedItem.itemsType === editItem.itemsType);
if (cachedItem) {
return {...editItem, ...cachedItem};
}
return editItem;
})
this.postForm.checkStartTime = this.formatISO8601ToDateTime(this.postForm.checkStartTime)
this.postForm.checkEndTime = this.formatISO8601ToDateTime(this.postForm.checkEndTime)
this.postForm.createTime = this.formatISO8601ToDateTime(this.postForm.createTime)
axios.post(prefix + '/edit', this.postForm)
.then(function (response) {
if (response.data.code === 0) {
$.operate.successCallback(response.data);
$.operate.successTabCallback(response.data);
}else{
$.modal.alertError(response.data.msg)
}
@ -319,7 +466,7 @@
})
},
closeItem(){
$.modal.close()
$.modal.closeTab()
}
}
})

Loading…
Cancel
Save