| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753 |
- <template>
- <el-container>
- <el-main>
- <el-form ref="form" :model="form" label-width="140px">
- <el-form-item label="选择要设定的年份">
- <el-select v-model="form.year" placeholder="" @change="yearChange">
- <el-option :lable="item.year" :value="item.year" :key="item.id" v-for="item in yearList"></el-option>
- </el-select>
- <div style="float:right;margin: 10px 0;">
- <el-button type="primary" @click="saveTableData">保 存</el-button>
- </div>
- </el-form-item>
- </el-form>
- <div class="content_wrapper">
- <div>
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>单元测评</span>
- <el-button style="float: right; padding: 3px 0" type="text" @click="unitReset">恢复默认</el-button>
- </div>
- <el-table
- :data="newTableData"
- :height="tableHeight"
- :span-method="arraySpanMethod"
- border
- style="width: 100%">
- <el-table-column
- prop="name"
- label=""
- align="center"
- width="100">
- <template slot-scope="scope">
- <el-input v-model="scope.row.name" placeholder="请输入内容"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- prop="classify"
- align="center"
- label="分类">
- <template slot-scope="scope">
- <el-input v-model="scope.row.classify" placeholder="请输入内容"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- prop="weight"
- align="center"
- label="权重">
- <template slot-scope="scope">
- <el-input v-model="scope.row.weight" placeholder="请输入内容"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- prop="level"
- align="center"
- label="等级">
- <template slot-scope="scope">
- <span>{{scope.row.level | levelFormat}}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="score"
- align="center"
- label="分值">
- <template slot-scope="scope">
- <el-input v-model="scope.row.score" placeholder="请输入内容"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- prop="allScoreWeight"
- label="总得分权重">
- <template slot-scope="scope">
- <el-input v-model="scope.row.allScoreWeight" placeholder="请输入内容"></el-input>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- </div>
- <div>
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>年度测评</span>
- <el-button style="float: right; padding: 3px 0" type="text" @click="yearReset">恢复默认</el-button>
- </div>
- <el-table
- :height="tableHeight1"
- :data="newTableDataYear"
- :span-method="arraySpanMethodYear"
- border
- style="width: 100%">
- <el-table-column
- prop="classify"
- label=""
- align="center"
- width="100">
- <template slot-scope="scope">
- <el-input v-model="scope.row.classify" placeholder="请输入内容"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- prop="level"
- align="center"
- label="等级">
- <template slot-scope="scope">
- <span>{{scope.row.level | levelFormat}}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="score"
- align="center"
- label="分值">
- <template slot-scope="scope">
- <el-input v-model="scope.row.score" placeholder="请输入内容"></el-input>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- </div>
- </div>
- </el-main>
- </el-container>
- </template>
- <script>
- import request from '@util/gw_ajax_request.js'
- export default {
- data() {
- return {
- tableHeight: window.innerHeight - 400,
- tableHeight1: window.innerHeight - 400,
- form: {
- year: ''
- },
- yearList: [],
- tableData: [
- {
- id: '001',
- name: '工作测评',
- classify: '工作态度',
- weight: 20,
- level: '1',
- score: 95,
- allScoreWeight: 40,
- classes: 2
- }, {
- id: '002',
- name: '工作测评',
- classify: '工作态度',
- weight: 20,
- level: '2',
- score: 85,
- allScoreWeight: 40,
- classes: 2
- }, {
- id: '003',
- name: '工作测评',
- classify: '工作态度',
- weight: 20,
- level: '3',
- score: 75,
- allScoreWeight: 40,
- classes: 2
- }, {
- id: '004',
- name: '工作测评',
- classify: '工作态度',
- weight: 20,
- level: '4',
- score: 65,
- allScoreWeight: 40,
- classes: 2
- }, {
- id: '005',
- name: '工作测评',
- classify: '业务能力',
- weight: 40,
- level: '1',
- score: 95,
- allScoreWeight: 40,
- classes: 3
- }, {
- id: '006',
- name: '工作测评',
- classify: '业务能力',
- weight: 40,
- level: '2',
- score: 85,
- allScoreWeight: 40,
- classes: 3
- }, {
- id: '007',
- name: '工作测评',
- classify: '业务能力',
- weight: 40,
- level: '3',
- score: 75,
- allScoreWeight: 40,
- classes: 3
- }, {
- id: '008',
- name: '工作测评',
- classify: '业务能力',
- weight: 40,
- level: '4',
- score: 65,
- allScoreWeight: 40,
- classes: 3
- }, {
- id: '009',
- name: '工作测评',
- classify: '工作质量',
- weight: 40,
- level: '1',
- score: 95,
- allScoreWeight: 40,
- classes: 4
- }, {
- id: '010',
- name: '工作测评',
- classify: '工作质量',
- weight: 40,
- level: '2',
- score: 85,
- allScoreWeight: 40,
- classes: 4
- }, {
- id: '011',
- name: '工作测评',
- classify: '工作质量',
- weight: 40,
- level: '3',
- score: 75,
- allScoreWeight: 40,
- classes: 4
- }, {
- id: '012',
- name: '工作测评',
- classify: '工作质量',
- weight: 40,
- level: '4',
- score: 65,
- allScoreWeight: 40,
- classes: 4
- }, {
- id: '013',
- name: '综合测评',
- classify: '综合测评',
- weight: '11',
- level: '11',
- score: 98,
- allScoreWeight: 60,
- classes: 5
- }, {
- id: '0123',
- name: '综合测评',
- classify: '综合测评',
- weight: '1',
- level: '1',
- score: 95,
- allScoreWeight: 60,
- classes: 5
- }, {
- id: '014',
- name: '综合测评',
- classify: '综合测评',
- weight: '21',
- level: '21',
- score: 92,
- allScoreWeight: 60,
- classes: 5
- }, {
- id: '015',
- name: '综合测评',
- classify: '综合测评',
- weight: '12',
- level: '12',
- score: 88,
- allScoreWeight: 60,
- classes: 5
- }, {
- id: '016',
- name: '综合测评',
- classify: '综合测评',
- weight: '2',
- level: '2',
- score: 85,
- allScoreWeight: 60,
- classes: 5
- }, {
- id: '017',
- name: '综合测评',
- classify: '综合测评',
- weight: '22',
- level: '22',
- score: 82,
- allScoreWeight: 60,
- classes: 5
- }, {
- id: '018',
- name: '综合测评',
- classify: '综合测评',
- weight: '3',
- level: '3',
- score: 75,
- allScoreWeight: 60,
- classes: 5
- }, {
- id: '019',
- name: '综合测评',
- classify: '综合测评',
- weight: '4',
- level: '4',
- score: 65,
- allScoreWeight: 60,
- classes: 5
- }, {
- id: '020',
- name: '稽察组长(多个稽察组长,均分)',
- classify: '稽察组长(多个稽察组长,均分)',
- weight: '3',
- level: '3',
- score: 75,
- allScoreWeight: 60,
- classes: 6
- }, {
- id: '021',
- name: '助理(多个助理,均分)',
- classify: '助理(多个助理,均分)',
- weight: '4',
- level: '4',
- score: 65,
- allScoreWeight: 40,
- classes: 7
- }
- ],
- tableDataYear: [{
- id: '101',
- classify: '工作态度',
- level: '11',
- score: 98,
- classes: 2
- }, {
- id: '102',
- classify: '工作态度',
- level: '1',
- score: 95,
- classes: 2
- }, {
- id: '103',
- classify: '工作态度',
- level: '12',
- score: 98,
- classes: 2
- }, {
- id: '104',
- classify: '工作态度',
- level: '21',
- score: 95,
- classes: 2
- }, {
- id: '105',
- classify: '工作态度',
- level: '2',
- score: 92,
- classes: 2
- }, {
- id: '106',
- classify: '工作态度',
- level: '22',
- score: 88,
- classes: 2
- }, {
- id: '107',
- classify: '工作态度',
- level: '3',
- score: 85,
- classes: 2
- }, {
- id: '108',
- classify: '工作态度',
- level: '4',
- score: 82,
- classes: 2
- }, {
- id: '1091',
- classify: '业务能力',
- level: '11',
- score: 98,
- classes: 3
- }, {
- id: '109',
- classify: '业务能力',
- level: '1',
- score: 95,
- classes: 3
- }, {
- id: '110',
- classify: '业务能力',
- level: '12',
- score: 98,
- classes: 3
- }, {
- id: '111',
- classify: '业务能力',
- level: '21',
- score: 95,
- classes: 3
- }, {
- id: '112',
- classify: '业务能力',
- level: '2',
- score: 92,
- classes: 3
- }, {
- id: '113',
- classify: '业务能力',
- level: '22',
- score: 88,
- classes: 3
- }, {
- id: '114',
- classify: '业务能力',
- level: '3',
- score: 85,
- classes: 3
- }, {
- id: '115',
- classify: '业务能力',
- level: '4',
- score: 82,
- classes: 3
- }, {
- id: '116',
- classify: '工作质量',
- level: '11',
- score: 98,
- classes: 4
- }, {
- id: '117',
- classify: '工作质量',
- level: '1',
- score: 95,
- classes: 4
- }, {
- id: '118',
- classify: '工作质量',
- level: '12',
- score: 98,
- classes: 4
- }, {
- id: '119',
- classify: '工作质量',
- level: '21',
- score: 95,
- classes: 4
- }, {
- id: '120',
- classify: '工作质量',
- level: '2',
- score: 92,
- classes: 4
- }, {
- id: '121',
- classify: '工作质量',
- level: '22',
- score: 88,
- classes: 4
- }, {
- id: '122',
- classify: '工作质量',
- level: '3',
- score: 85,
- classes: 4
- }, {
- id: '123',
- classify: '工作质量',
- level: '4',
- score: 82,
- classes: 4
- }
- ],
- tableDataFormat: {
- year: '',
- configs: [],
- norms: []
- },
- newTableData: [],
- newTableDataYear: [],
- gzcpItem: {}
- }
- },
- mounted() {
- this.getYear()
- },
- methods: {
- getYear() {
- request.post(`/tac/insp/year/list`, {}).then(res => {
- if (res.success) {
- this.$nextTick(() => {
- this.yearList = res.data;
- this.form.year = this.yearList[0].year
- this.getTableData()
- })
- }
- })
- },
- getTableData: function () {
- let _self = this;
- request.get(`/tac/evalation/config/getConfigsByYear?year=` + this.form.year).then(res => {
- if (res.success) {
- let tableDataAssess = res.data;
- if (tableDataAssess.configs.length > 0) {
- this.newTableData = tableDataAssess.configs;
- this.newTableDataYear = tableDataAssess.norms
- } else {
- this.newTableData = _self.tableData;
- this.newTableDataYear = _self.tableDataYear
- }
- }
- })
- },
- saveTableData() {
- this.sendDataFormat()
- let configs = this.tableDataFormat.configs
- if (Number(configs[1].weight) + Number(configs[5].weight) + Number(configs[9].weight) > 100) {
- this.$message.warning('工作测评总权重不能大于100')
- return
- }
- //1.封装Vo
- let data = {};
- let _self = this;
- data.year = _self.form.year;
- if (_self.newTableData) {
- data.configs = _self.newTableData;
- } else {
- data.configs = _self.tableData;
- }
- if (_self.newTableDataYear) {
- data.norms = _self.newTableDataYear;
- } else {
- data.norms = _self.tableDataYear;
- }
- request.post(`/tac/evalation/config/insertConfigByYear`, data).then(res => {
- if (res.success) {
- this.$message.success('保存成功')
- this.getTableData()
- } else {
- this.$message.error(res.message)
- }
- })
- },
- sendDataFormat() {
- // 单元测评
- console.log(this.newTableData)
- this.tableDataFormat.configs = []
- if (this.newTableData[0].hasOwnProperty('id')) {
- this.gzcpItem.className = this.newTableData[0].name
- this.gzcpItem.weight = this.newTableData[0].allScoreWeight
- this.tableDataFormat.configs[0] = this.gzcpItem
- } else {
- let firstItem = {
- className: this.newTableData[0].name,
- classes: 1,
- weight: this.newTableData[0].allScoreWeight
- }
- this.tableDataFormat.configs[0] = firstItem
- }
- this.newTableData.forEach((ele, index) => {
- let tableItem = {
- className: ele.classify,
- classes: ele.classes,
- weight: ele.weight,
- normLev: ele.level,
- score: ele.score,
- }
- if (index < 12) {
- tableItem['weight'] = ele.weight
- } else {
- tableItem['weight'] = ele.allScoreWeight
- }
- if (ele.classes == 2) {
- tableItem.className = this.newTableData[0].classify
- tableItem.weight = this.newTableData[0].weight
- } else if (ele.classes == 3) {
- tableItem.className = this.newTableData[4].classify
- tableItem.weight = this.newTableData[4].weight
- } else if (ele.classes == 4) {
- tableItem.className = this.newTableData[8].classify
- tableItem.weight = this.newTableData[8].weight
- } else if (ele.classes == 5) {
- tableItem.className = this.newTableData[12].name
- } else if (ele.classes > 5) {
- tableItem.className = ele.name
- }
- if (ele.hasOwnProperty('id')) {
- tableItem['id'] = ele.id
- tableItem['normId'] = ele.normId
- }
- this.tableDataFormat.configs.push(tableItem)
- })
- // 年度测评
- this.tableDataFormat.norms = []
- this.newTableDataYear.forEach((ele, index) => {
- let tableItem = {'className': ele.classify, 'lev': ele.level, 'score': ele.score, 'classes': ele.classes}
- if (ele.classes == 2) {
- tableItem.className = this.newTableDataYear[0].classify
- } else if (ele.classes == 3) {
- tableItem.className = this.newTableDataYear[8].classify
- } else if (ele.classes == 4) {
- tableItem.className = this.newTableDataYear[16].classify
- }
- if (ele.hasOwnProperty('id')) {
- tableItem['id'] = ele.id
- }
- this.tableDataFormat.norms.push(tableItem)
- if (ele.level == '优+') {
- this.tableDataFormat.norms[index].lev = '11'
- } else if (ele.level == '优') {
- this.tableDataFormat.norms[index].lev = '1'
- } else if (ele.level == '优-') {
- this.tableDataFormat.norms[index].lev = '12'
- } else if (ele.level == '良+') {
- this.tableDataFormat.norms[index].lev = '21'
- } else if (ele.level == '良') {
- this.tableDataFormat.norms[index].lev = '2'
- } else if (ele.level == '良-') {
- this.tableDataFormat.norms[index].lev = '22'
- } else if (ele.level == '中') {
- this.tableDataFormat.norms[index].lev = '3'
- } else if (ele.level == '差') {
- this.tableDataFormat.norms[index].lev = '4'
- }
- })
- this.tableDataFormat.year = this.form.year
- console.log(this.tableDataFormat)
- },
- unitReset() {
- console.log(this.tableData)
- // 避免数组赋值后数据随赋值的数组的变动而改变
- let resetTabelData = JSON.parse(JSON.stringify(this.tableData))
- this.newTableData.forEach((ele, index) => {
- if (index < 22) {
- resetTabelData[index]['id'] = ele.id ? ele.id : ''
- resetTabelData[index]['normId'] = ele.normId ? ele.normId : ''
- }
- })
- this.newTableData = resetTabelData
- },
- yearReset() {
- // 避免数组赋值后数据随赋值的数组的变动而改变
- let resetTabelData = JSON.parse(JSON.stringify(this.tableDataYear))
- this.newTableDataYear.forEach((ele, index) => {
- if (index < 24) {
- resetTabelData[index]['id'] = ele.id ? ele.id : ''
- }
- })
- this.newTableDataYear = resetTabelData
- },
- arraySpanMethod({row, column, rowIndex, columnIndex}) {
- if (columnIndex === 0 || columnIndex === 5) {
- if (rowIndex <= 12 && rowIndex === 0) {
- return [12, 1];
- } else if (rowIndex === 12) {
- return [8, 2];
- } else if (rowIndex >= 20) {
- return [1, 5];
- } else {
- return [0, 0];
- }
- } else if (rowIndex >= 12 && rowIndex < 20 && columnIndex === 1) {
- return [0, 0]
- }
- if (rowIndex >= 12 && rowIndex < 20 && columnIndex === 3) {
- return [1, 2];
- } else if (rowIndex >= 12 && rowIndex < 20 && columnIndex === 2) {
- return [0, 0]
- } else if (rowIndex >= 20 && (columnIndex === 1 || columnIndex === 2 || columnIndex === 3 || columnIndex === 4)) {
- return [0, 0]
- }
- if (rowIndex < 12 && (columnIndex === 1 || columnIndex === 2)) {
- if (rowIndex % 4 === 0) {
- return [4, 1]
- } else {
- return [0, 0]
- }
- }
- },
- arraySpanMethodYear({row, column, rowIndex, columnIndex}) {
- if (columnIndex === 0) {
- if (rowIndex % 8 === 0) {
- return [8, 1]
- } else {
- return [0, 0]
- }
- }
- },
- yearChange() {
- this.getTableData()
- }
- },
- filters: {
- levelFormat(val) {
- if (val == '11') {
- return '优+'
- } else if (val == '1') {
- return '优'
- } else if (val == '12') {
- return '优-'
- } else if (val == '21') {
- return '良+'
- } else if (val == '2') {
- return '良'
- } else if (val == '22') {
- return '良-'
- } else if (val == '3') {
- return '中'
- } else if (val == '4') {
- return '差'
- } else {
- return val
- }
- }
- },
- watch: {
- newTableData: {
- deep: true,
- handler(val, oldVal) {
- this.newTableData[12].allScoreWeight = 100 - val[0].allScoreWeight
- this.newTableData[21].allScoreWeight = 100 - val[20].allScoreWeight
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content_wrapper {
- display: flex;
- justify-content: space-between;
- > div {
- width: 39%;
- }
- > div:first-child {
- margin-right: 2%;
- width: 59%;
- }
- }
- </style>
|