fix: BUG修改

This commit is contained in:
kun 2023-09-12 18:11:05 +08:00
parent 5a50b11cb4
commit 2e21c23e2e
6 changed files with 820 additions and 5 deletions

View File

@ -54,7 +54,7 @@
:clearable="item.clearable" :clearable="item.clearable"
:disabled="item.disabled" :disabled="item.disabled"
:type="item.inputType" :type="item.inputType"
:row="item.row" :rows="item.row"
:style="{ width: item.width + 'px' }" :style="{ width: item.width + 'px' }"
/> />

View File

@ -107,7 +107,8 @@ const formConfig = reactive({
label: "评分标准", label: "评分标准",
prop: "scoreCriteria", prop: "scoreCriteria",
type: "textarea", type: "textarea",
inputType: "textarea" inputType: "textarea",
row: 5
}, },
// { // {
// label: "", // label: "",

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="origin-table"> <div class="origin-table" id="scoreTable">
<div class="table-head-one">{{ formData.enterpriseTypeName }}服务考核评分表</div> <div class="table-head-one">{{ formData.enterpriseTypeName }}服务考核评分表</div>
<div class="table-head-two"> <div class="table-head-two">
<div><span>服务单位名称</span></div> <div><span>服务单位名称</span></div>
@ -91,7 +91,12 @@
<el-option v-for="(item2, index) in item.standardScore + 1" :key="index" :label="index" :value="index" /> <el-option v-for="(item2, index) in item.standardScore + 1" :key="index" :label="index" :value="index" />
</el-select> </el-select>
</div> </div>
<div><el-input placeholder="请输入" v-model="item.punish" class="form-element-input" /></div> <div>
<!-- <el-input placeholder="请输入" v-model="item.punish" class="form-element-input" /> -->
<el-select placeholder="请选择" class="form-element-select" v-model="item.punish">
<el-option v-for="(item2, index) in rankRemark" :key="item2.label" :label="item2.label" :value="item2.value" />
</el-select>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -149,6 +154,11 @@ const scoreOptions = ref([
{ label: "9", value: 9 }, { label: "9", value: 9 },
{ label: "10", value: 10 } { label: "10", value: 10 }
]); ]);
const rankRemark = ref([
{ label: "优", value: "优" },
{ label: "良", value: "良" },
{ label: "差", value: "差" }
]);
// //
const saveScore = async () => { const saveScore = async () => {
console.log(formData.value); console.log(formData.value);

View File

@ -0,0 +1,780 @@
<template>
<div class="origin-table-print" id="scoreTablePrint">
<div class="table-head-one">{{ formData.enterpriseTypeName }}服务考核评分表</div>
<div class="table-head-two">
<div><span>服务单位名称</span></div>
<div class="form-element">
<!-- <el-select placeholder="请选择" class="form-element-select">
<el-option v-for="item in selectOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select> -->
<span>{{ formData.enterpriseName }}</span>
</div>
<div><span>类别对象</span></div>
<div class="form-element">
<span>{{ formData.enterpriseTypeName }}</span>
</div>
<div><span>填表时间</span></div>
<div class="form-element-date">
<!-- <el-date-picker
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
v-model="formData.scoreTime"
placeholder="请选择"
/> -->
<span>{{ formData.scoreTime }}</span>
</div>
</div>
<div class="table-head-three">
<div><span>服务项目名称</span></div>
<div>{{ formData.engineeringName }}</div>
<div><span>合同编号</span></div>
<div class="form-element">
<el-input placeholder="请输入" v-model="formData.concatNumber" class="form-element-input" />
</div>
</div>
<div class="table-head-four">
<div><span>服务考核区间</span></div>
<div class="form-element">
<el-date-picker
v-model="formData.timeRange"
type="monthrange"
range-separator="至"
format="YYYY-MM"
value-format="YYYY-MM"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</div>
</div>
<div class="table-head-five">
<div><span>考核标准项</span></div>
<div><span>评分</span></div>
</div>
<div class="table-head-six">
<div><span>90()以上为优秀80()89分为良好60()79分为合格60以下为不合格</span></div>
</div>
<div class="table-head-combo" v-for="(value, key, index) in recordData" :key="index">
<div class="table-head-six-add">
<div>
<span>{{ key }}</span>
</div>
</div>
<div class="table-head-seven">
<div><span>考核项目</span></div>
<div><span>考核得分</span></div>
</div>
<div class="table-head-eight">
<div><span>类别</span></div>
<div><span>编号</span></div>
<div><span>考核内容</span></div>
<div><span>总分值</span></div>
<div><span>得分</span></div>
<div><span>扣分说明</span></div>
</div>
<div class="table-head-nine">
<div class="table-head-nine-part1" v-for="(value2, key2, index2) in value" :key="index2">
<div class="category-title">
<span>{{ key2 }}</span>
</div>
<div class="category-content">
<div v-for="(item, index3) in value2" :key="index3">
<div>
<span>{{ index3 + 1 }}</span>
</div>
<div>{{ item.scoreCriteria }}</div>
<div>
<span>{{ item.standardScore }}</span>
</div>
<div>
<el-select placeholder="请选择" class="form-element-select" v-model="item.score">
<el-option v-for="(item2, index) in item.standardScore + 1" :key="index" :label="index" :value="index" />
</el-select>
</div>
<div>
<!-- <el-input placeholder="请输入" v-model="item.punish" class="form-element-input" /> -->
<el-select placeholder="请选择" class="form-element-select" v-model="item.punish">
<el-option v-for="(item2, index) in rankRemark" :key="item2.label" :label="item2.label" :value="item2.value" />
</el-select>
</div>
</div>
</div>
</div>
<div class="table-head-nine-part2">
<div><span>小计</span></div>
<div>
<span>{{ sumAllScore("all", value) }}</span>
</div>
<div>
<span>{{ sumAllScore("get", value) }}</span>
</div>
<div></div>
</div>
</div>
</div>
<div class="table-head-ten">
<div><span>考核总评分</span></div>
<div>
<span>{{ sumAllScoreCount("all") }}</span>
</div>
<div>
<span>{{ sumAllScoreCount("get") }}</span>
</div>
<div><span></span></div>
</div>
</div>
<div class="operate-btn" v-if="false">
<el-button class="hzCancelStyle" @click="cancelScore">取消</el-button>
<el-button class="btnStyle" type="primary" @click="saveScore"> 保存 </el-button>
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref, watch, reactive } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import type { FormInstance, UploadProps } from "element-plus";
import { scoreSubItemList, scoreDetail, noScoreDetail, addScoreDetail, updateScoreDetail } from "@/api/modules/huizhou";
import dayjs from "dayjs";
const formData = ref({});
const emits = defineEmits(["confirm"]);
const props = defineProps(["relativeInfo", "printVisible"]);
const recordData = ref({});
const categoryList = ref([]);
const selectOptions = ref([{ label: "测试", value: 1 }]);
const scoreOptions = ref([
{ label: "0", value: 0 },
{ label: "1", value: 1 },
{ label: "2", value: 2 },
{ label: "3", value: 3 },
{ label: "4", value: 4 },
{ label: "5", value: 5 },
{ label: "6", value: 6 },
{ label: "7", value: 7 },
{ label: "8", value: 8 },
{ label: "9", value: 9 },
{ label: "10", value: 10 }
]);
const rankRemark = ref([
{ label: "优", value: "优" },
{ label: "良", value: "良" },
{ label: "差", value: "差" }
]);
//
const saveScore = async () => {
console.log(formData.value);
let arr = [];
for (let i in recordData.value) {
for (let x in recordData.value[i]) {
recordData.value[i][x].map(item => {
item.scoreId = props.relativeInfo.id;
// delete item.id;
arr.push(item);
});
}
}
let requestData = {
concatNumber: formData.value.concatNumber,
scoreTime: formData.value.scoreTime,
startTime: formData.value.timeRange ? formData.value.timeRange[0] : null,
endTime: formData.value.timeRange ? formData.value.timeRange[1] : null,
enterpriseScoreDetails: arr
};
console.log(requestData);
console.log(arr);
if (props.relativeInfo.score) {
const res = await updateScoreDetail(requestData);
} else {
const res = await addScoreDetail(requestData);
}
ElMessage.success("操作成功");
emits("confirm", false);
};
//
const cancelScore = () => {
emits("confirm", false);
};
const sumAllScoreCount = (label: any) => {
let score = 0;
if (label == "all") {
for (let i in recordData.value) {
for (let x in recordData.value[i]) {
recordData.value[i][x].map(item => {
score += item.standardScore;
});
}
}
return score;
} else {
for (let i in recordData.value) {
for (let x in recordData.value[i]) {
recordData.value[i][x].map(item => {
score += item.score;
});
}
}
return score;
}
};
//
const sumAllScore = (label: any, arr: any) => {
console.log(arr);
let score = 0;
if (label == "all") {
for (let i in arr) {
arr[i].map(item => {
score += item.standardScore;
});
}
return score;
} else {
for (let i in arr) {
arr[i].map(item => {
score += item.score;
});
}
return score;
}
};
const getDetails = async (obj?: any) => {
// let categoryName = "";
// let score = 0;
// let recordDataCreate = {};
recordData.value = {};
if (props.relativeInfo.score) {
let requestData = {
scoreId: props.relativeInfo.id
};
const res = await scoreDetail(requestData);
console.log(res);
if (res && res.result) {
// categoryName = res.result[0].category;
// recordDataCreate[categoryName] = { children: [] };
// res.result.map(item => {
// score += item.standardScore;
// if (item.category == categoryName) {
// recordDataCreate[item.category].children.push(item);
// } else {
// categoryName = item.category;
// recordDataCreate[categoryName] = { children: [] };
// }
// });
// console.log(recordDataCreate);
recordData.value = res.result;
}
} else {
let requestData = {
enterpriseType: +props.relativeInfo.enterpriseType
};
const res = await noScoreDetail(requestData);
console.log(res);
if (res && res.result) {
for (let i in res.result) {
for (let x in res.result[i]) {
res.result[i][x].map(item => {
item.score = 0;
});
}
}
recordData.value = res.result;
// categoryName = res.result[0].category;
// recordDataCreate[categoryName] = { children: [] };
// res.result.map(item => {
// item.score = 0;
// score += item.standardScore;
// if (item.category == categoryName) {
// recordDataCreate[item.category].children.push(item);
// } else {
// categoryName = item.category;
// recordDataCreate[categoryName] = { children: [] };
// }
// });
// console.log(recordDataCreate);
}
}
};
const getScoreSubItemData = async () => {
let requestData = {
enterpriseType: props.relativeInfo.enterpriseType
};
const res = await scoreSubItemList(requestData);
if (res && res.result) {
categoryList.value = res.result;
getDetails(res.result[0]);
}
console.log(res);
};
onMounted(async () => {
await getScoreSubItemData();
formData.value = { ...props.relativeInfo };
if (formData.value.startTime) {
formData.value.timeRange = [formData.value.startTime, formData.value.endTime];
}
formData.value.scoreTime = dayjs().format("YYYY-MM-DD");
console.log(formData.value);
});
</script>
<style lang="scss" scoped>
.origin-table-print {
display: flex;
flex-direction: column;
margin: 20px 10px 20px 20px;
border: 2px solid #086d93;
overflow-y: scroll;
overflow-x: hidden;
> div {
line-height: 32px;
> div {
height: 100%;
}
}
.table-head-one {
width: 100%;
// background-color: #d9e1f2;
text-align: center;
color: black;
font-size: 22px;
border-bottom: 2px solid #086d93;
}
.table-head-two {
display: flex;
align-items: center;
text-align: center;
color: black;
font-size: 20px;
> div {
width: 17%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
.form-element {
display: flex;
align-items: center;
justify-content: center;
&-select {
width: 95%;
:deep() {
.el-input,
.select-trigger {
width: 100%;
height: 100%;
}
}
}
&-input {
width: 95%;
}
}
.form-element-date {
:deep() {
.el-input {
width: 95%;
}
}
}
}
.table-head-three {
display: flex;
align-items: center;
text-align: center;
// color: #2a334c;
color: black;
font-size: 20px;
> div {
width: 17%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
> div:nth-child(2) {
width: calc(51% + 4px) !important;
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
.form-element {
display: flex;
align-items: center;
justify-content: center;
&-input {
width: 95%;
}
}
}
.table-head-four {
display: flex;
align-items: center;
text-align: center;
color: black;
font-size: 20px;
> div {
width: 17%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
> div:nth-child(2) {
width: calc(85% + 8px);
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
.form-element {
display: flex;
align-items: center;
justify-content: center;
:deep() {
.el-date-editor {
width: 85%;
margin-top: 2px;
// box-shadow: none;
}
.el-range-separator {
color: black;
}
.el-range-input {
color: black;
}
.el-input__wrapper {
flex: none;
}
.el-range-input {
font-size: 20px;
}
}
}
}
.table-head-five {
display: flex;
align-items: center;
text-align: center;
background-color: #09314e;
color: black;
font-size: 20px;
> div {
width: 50%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
}
.table-head-six {
display: flex;
align-items: center;
text-align: center;
color: black;
font-size: 20px;
> div {
width: 100%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
}
.table-head-combo {
display: flex;
flex-direction: column;
.table-head-six-add {
display: flex;
color: black;
font-size: 20px;
> div {
width: 100%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
span {
margin-left: 15px;
}
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
}
.table-head-seven {
display: flex;
align-items: center;
text-align: center;
color: black;
font-size: 20px;
> div:nth-child(1) {
width: 68%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
> div:nth-child(2) {
width: 34%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
}
.table-head-eight {
display: flex;
align-items: center;
text-align: center;
color: black;
font-size: 20px;
> div:nth-child(1) {
width: 17%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
> div:nth-child(2) {
width: 5%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
> div:nth-child(3) {
width: calc(46% - 4px);
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
> div:nth-child(4) {
width: 11%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
> div:nth-child(5) {
width: 11%;
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
> div:nth-child(6) {
width: calc(12% - 4px);
border-bottom: 2px solid #086d93;
white-space: nowrap;
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
}
.table-head-nine {
display: flex;
flex-direction: column;
.table-head-nine-part1 {
display: flex;
// align-items: center;
// background-color: #fff;
text-align: center;
color: black;
font-size: 20px;
border-bottom: 1px solid #086d93;
.category-title {
width: calc(17% - 2px);
// height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
// overflow-wrap: anywhere;
border-right: 2px solid #086d93;
// text-align: left !important;
}
.category-content {
width: calc(85% - 8px);
> div {
width: 100%;
display: flex;
> div:nth-child(1) {
width: 6%;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
}
> div:nth-child(2) {
width: 54%;
overflow-wrap: anywhere;
text-align: left !important;
}
> div:nth-child(3) {
width: 13%;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
}
> div:nth-child(4) {
width: 13%;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
}
> div:nth-child(5) {
width: calc(14% - 2px);
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
}
> div:not(:last-child) {
> div:nth-child(1) {
border-bottom: 1px solid #086d93;
}
> div:nth-child(2) {
border-bottom: 1px solid #086d93;
}
> div:nth-child(3) {
border-bottom: 1px solid #086d93;
}
> div:nth-child(4) {
border-bottom: 1px solid #086d93;
}
> div:nth-child(5) {
border-bottom: 1px solid #086d93;
}
}
}
}
.table-head-nine-part2 {
display: flex;
align-items: center;
text-align: center;
color: black;
font-size: 20px;
border-bottom: 1px solid #086d93;
> div:nth-child(1) {
width: 68%;
display: flex;
flex-direction: column;
white-space: nowrap;
> span:not(:first-child) {
border-top: 1px solid #086d93;
}
}
> div:nth-child(2) {
width: 11%;
display: flex;
flex-direction: column;
white-space: nowrap;
> span:not(:first-child) {
border-top: 1px solid #086d93;
}
}
> div:nth-child(3) {
width: 11%;
display: flex;
flex-direction: column;
white-space: nowrap;
> span:not(:first-child) {
border-top: 1px solid #086d93;
}
}
> div:nth-child(4) {
width: calc(12% - 4px);
display: flex;
flex-direction: column;
white-space: nowrap;
}
div:not(:last-child) {
border-right: 2px solid #086d93;
}
}
}
}
.table-head-ten {
display: flex;
align-items: center;
text-align: center;
color: black;
font-weight: 700;
font-size: 20px;
border-bottom: 1px solid #086d93;
> div:nth-child(1) {
width: 68%;
display: flex;
flex-direction: column;
white-space: nowrap;
> span:not(:first-child) {
border-top: 1px solid #086d93;
}
}
> div:nth-child(2) {
width: 11%;
display: flex;
flex-direction: column;
white-space: nowrap;
> span:not(:first-child) {
border-top: 1px solid #086d93;
}
}
> div:nth-child(3) {
width: 11%;
display: flex;
flex-direction: column;
white-space: nowrap;
> span:not(:first-child) {
border-top: 1px solid #086d93;
}
}
> div:nth-child(4) {
width: calc(12% - 4px);
display: flex;
flex-direction: column;
white-space: nowrap;
}
// > div:nth-child(1) {
// width: 68%;
// display: flex;
// flex-direction: column;
// white-space: nowrap;
// > span:not(:first-child) {
// border-top: 1px solid #086d93;
// }
// }
// > div:nth-child(2) {
// width: calc(22% + 2px);
// display: flex;
// flex-direction: column;
// white-space: nowrap;
// > span:not(:first-child) {
// border-top: 1px solid #086d93;
// }
// }
// > div:nth-child(3) {
// width: calc(12% - 4px);
// display: flex;
// flex-direction: column;
// white-space: nowrap;
// > span:not(:first-child) {
// border-top: 1px solid #086d93;
// }
// }
div:not(:last-child) {
border-right: 2px solid #086d93;
}
}
}
.operate-btn {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
}
:deep() {
.el-input__wrapper,
.el-textarea__inner,
.el-input.is-disabled .el-input__wrapper {
background-color: transparent;
box-shadow: 0 0 0 1px #087ba4 inset;
}
.el-input__inner,
.el-textarea__inner {
color: black !important;
font-size: 20px;
}
}
</style>

View File

@ -74,6 +74,11 @@
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin: 20px 20px 0 0; margin: 20px 20px 0 0;
:deep() {
.el-button {
margin-left: 15px;
}
}
} }
} }
.table-box { .table-box {

View File

@ -53,14 +53,19 @@
</ProTable> </ProTable>
</div> </div>
</div> </div>
<div class="content-area" v-else> <div class="content-area" style="page-break-inside: avoid; page-break-after: avoid; page-break-before: avoid" v-else>
<div class="back-btn"> <div class="back-btn">
<el-button type="primary" @click="openScore = false"> <el-button type="primary" @click="openScore = false">
<span>返回</span> <span>返回</span>
</el-button> </el-button>
<el-button type="primary" @click="submitPrint">
<span>打印</span>
</el-button>
</div> </div>
<!-- 评分表 --> <!-- 评分表 -->
<scoreTableNew :relativeInfo="relativeInfo" @confirm="confirmScore"></scoreTableNew> <scoreTableNew :relativeInfo="relativeInfo" @confirm="confirmScore"></scoreTableNew>
<!-- 打印评分表 -->
<scoreTableNewPrint :relativeInfo="relativeInfo" @confirm="confirmScore"></scoreTableNewPrint>
</div> </div>
<!-- 新增单位 --> <!-- 新增单位 -->
<el-dialog class="imgDialog" title="新增" width="50%" v-model="addVisible" show-close> <el-dialog class="imgDialog" title="新增" width="50%" v-model="addVisible" show-close>
@ -135,9 +140,12 @@ import DialogForm from "@/components/DialogForm/index.vue";
import scoreTable from "./components/scoreTable.vue"; import scoreTable from "./components/scoreTable.vue";
import addCompany from "./components/addCompany.vue"; import addCompany from "./components/addCompany.vue";
import scoreTableNew from "./components/scoreTableNew.vue"; import scoreTableNew from "./components/scoreTableNew.vue";
import scoreTableNewPrint from "./components/scoreTableNewPrint.vue";
import { getDicList } from "@/api/modules/jxjview"; import { getDicList } from "@/api/modules/jxjview";
import { scorePage, enterpriseList, engineerList, scoreAdd, deleteScoreDetail } from "@/api/modules/huizhou"; import { scorePage, enterpriseList, engineerList, scoreAdd, deleteScoreDetail } from "@/api/modules/huizhou";
import { useHandleData } from "@/hooks/useHandleData"; import { useHandleData } from "@/hooks/useHandleData";
import printJS from "print-js";
const printVisible = ref(false);
const relativeInfo = ref({}); const relativeInfo = ref({});
const dicMainData = ref([]); const dicMainData = ref([]);
const openScore = ref(false); const openScore = ref(false);
@ -244,6 +252,17 @@ const companyType = ref({});
const proTable = ref(); const proTable = ref();
const enterpriseDataList = ref<any>([]); const enterpriseDataList = ref<any>([]);
const engineerDataList = ref<any>([]); const engineerDataList = ref<any>([]);
//
const submitPrint = async () => {
printJS({
printable: "scoreTablePrint",
type: "html",
targetStyles: ["*"],
maxWidth: 3000,
style: "@page{size:auto; margin: 0;}" + "@media print { @page {size: landscape; } }"
});
};
// //
const clearScore = async (ids: []) => { const clearScore = async (ids: []) => {
console.log(ids); console.log(ids);