From 605de7523806e4b60ea5b678968df1e9ddb2fcc9 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期二, 30 四月 2024 14:51:32 +0800 Subject: [PATCH] 前后端文件名统一调整 --- src/views/system/result/detail/index1.vue | 210 +++++++++++++++++++++++++++++++++++----------------- 1 files changed, 142 insertions(+), 68 deletions(-) diff --git a/src/views/system/result/detail/index1.vue b/src/views/system/result/detail/index1.vue index 44b2338..84e0a50 100644 --- a/src/views/system/result/detail/index1.vue +++ b/src/views/system/result/detail/index1.vue @@ -3,8 +3,8 @@ <div> <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" style="margin-bottom: 10px"> - <el-menu-item index="1">鐪佸巺鑰冩牳</el-menu-item> - <el-menu-item index="2">鍖哄煙鑰冩牳</el-menu-item> + <el-menu-item index="0">鐪佸巺鑰冩牳</el-menu-item> + <el-menu-item index="1">鍖哄煙鑰冩牳</el-menu-item> </el-menu> </div> @@ -26,8 +26,8 @@ </el-card> </div> - <div style="margin-top: 35px"> - <el-table :data="tableData" style="width: 100%" v-loading="loading"> + <div style="margin-top: 35px;margin-bottom: 35px"> + <el-table :data="tableData" style="width: 100%" v-loading="tableLoading"> <el-table-column label="鑰冩牳鏃堕棿" prop="createTime" align="center"> </el-table-column> <el-table-column label="鑰冩牳瀵硅薄" prop="deptId" align="center"> @@ -50,71 +50,75 @@ <el-table-column label="鍒嗘暟" prop="score" align="center"> </el-table-column> <el-table-column label="鐘舵��" prop="publish" align="center"> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> - <el-button size="small" type="text" v-show="scope.row.publish != 1">纭鍙戝竷</el-button> - <el-button size="small" type="text" v-show="scope.row.publish == 1">鍙栨秷鍙戝竷</el-button> - <el-button size="mini" type="text" icon="el-icon-view" - @click="handleDetail(scope.row, scope.index)">璇︾粏</el-button> + <dict-tag :options="dict.type.platform_is_publish" :value="scope.row.publish" /> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center"> + <template slot-scope="scope"> + <div style="display: flex;justify-content: center;"> + <el-button size="small" type="text" @click="handlePublish(scope.row)" v-if="scope.row.publish === 'UNPUBLISHED'" >纭鍙戝竷</el-button> + <el-button size="small" type="text" @click="handlePublish(scope.row)" v-if="scope.row.publish === 'PUBLISHED'">鍙栨秷鍙戝竷</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-view" + @click="handleDetail(scope.row.id)" + >璇︾粏</el-button> + </div> </template> </el-table-column> </el-table> - </div> - <div style="text-align: right; margin-top: 10px"> - <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage4" - :page-sizes="[5, 10, 20]" :page-size="5" layout="total, sizes, prev, pager, next, jumper" :total="4"> - </el-pagination> + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParamsList.pageNum" + :limit.sync="queryParamsList.pageSize" + @pagination="getList" + /> + </div> </div> </template> <script> -import { listScore, getScore, delScore, addScore, updateScore, publishScore } from "@/api/platform/check-score"; +import { listScore, getScore, delScore, addScore, updateScore, publishScore, detailScore } from "@/api/platform/check-score"; import { areaSelect } from '@/api/system/dept'; -import { mapState } from 'vuex'; import * as echarts from 'echarts'; let lineChart = null; let observer = null; export default { name: 'index', - dicts: ['platform_examine_use', 'platform_examine_category'], + dicts: ['platform_examine_category','platform_is_publish'], data() { return { - activeIndex: '1', - activeIndex2: '2', + activeIndex: '0', areaList: [], + province: { + id: [], + publish: null, + }, date: '', dateRange: '', - company: '', + // 鎬绘潯鏁� + total: 0, queryParams: { pageNum: 1, pageSize: 10, deptId: null, + examineTag: 0 }, - dataList: [ - { - name: '鍏ㄩ儴', - complete: { - '4.5': 95.5, '4.6': 95.3, '4.7': 96.0, '4.8': 97.2, '4.9': 96.5, - '4.10': 95.5, '4.11': 95.3, '4.12': 96.0, '4.13': 97.2, '4.14': 96.5, - '4.15': 95.5, '4.16': 95.3, '4.17': 96.0, '4.18': 97.2, '4.19': 96.5, - '4.20': 95.5, '4.21': 95.3, '4.22': 96.0, '4.23': 97.2, '4.24': 96.5, - '4.25': 95.5, '4.26': 95.3, '4.27': 96.0, '4.28': 97.2, '4.29': 96.5 - }, - waiting: { - '4.5': 94.8, '4.6': 91.3, '4.7': 95.3, '4.8': 92.3, '4.9': 93.3, - '4.10': 94.8, '4.11': 91.3, '4.12': 95.3, '4.13': 92.3, '4.14': 93.3 - }, - pending: { - '4.5': 91.6, '4.6': 92.6, '4.7': 93.7, '4.8': 94.0, '4.9': 95.9 - , '4.10': 91.6, '4.11': 92.6, '4.12': 93.7, '4.13': 94.0, '4.14': 95.9 - } - } - ], + queryParamsList: { + pageNum: 1, + pageSize: 10, + deptId: null, + examineTag:0 + }, tableData: [], + tableLoading: false, + loading: false, searchForm: { time: null, } @@ -125,20 +129,54 @@ console.log(this.$route.query.index) if (this.$route.query.index) { this.queryParams.deptId = this.$route.query.index + this.queryParamsList.deptId = this.$route.query.index } const date = new Date(); const year = date.getFullYear(); const month = (date.getMonth() + 1) >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1); this.date = year + '-' + month; - console.log(this.date); this.queryParams.date = this.date; - this.getList(this.$route.query.index); + this.queryParams.examineTag =this.$route.query.examineTag; + this.queryParamsList.examineTag =this.$route.query.examineTag; + this.activeIndex = this.$route.query.examineTag; this.areaSelect(); + this.getList(this.$route.query.index); }, computed: { - ...mapState('dict', ['dict']) + }, methods: { + //鍙戝竷 + handlePublish(row) { + const getExamineCategoryText = category => { + switch (category) { + case 1: return '瑙嗛鑰冩牳'; + case 2: return '杞﹁締鑰冩牳'; + case 3: return '浜鸿劯鑰冩牳'; + default: return '鏈煡'; + } + }; + + const year = row.createTime.substr(0, 4); + const month = (parseInt(row.createTime.substr(5, 2), 10)).toString(); + const day = (parseInt(row.createTime.substr(8, 2), 10)).toString(); + const formattedCreateTime = year + '骞�' + month + '鏈�' + day + '鏃�'; + + let text = row.publish === 'UNPUBLISHED' ? '鍙戝竷' : '鍙栨秷鍙戝竷'; + this.province.id = [row.id] + this.province.publish = text === "鍙戝竷" ? "PUBLISHED" : "UNPUBLISHED"; + this.$modal.confirm('纭瑕�' + text + "" + getExamineCategoryText(row.examineCategory) + "" + formattedCreateTime + '鐨勮�冩牳鎴愮哗鍚楋紵') + .then(() => { + return publishScore(this.province); + }) + .then(() => { + this.getList(); + this.$modal.msgSuccess(text + "鎴愬姛"); + }) + .catch(() => { + // 閿欒澶勭悊閫昏緫 + }); + }, // 鍖哄煙涓嬫媺鏁版嵁 areaSelect() { areaSelect().then(res => { @@ -151,17 +189,28 @@ }, /** 瀵艰埅鍒囨崲 */ handleSelect(key) { - this.activeIndex = key; // 鏇存柊褰撳墠婵�娲荤殑鑿滃崟椤� - this.getList(); + this.activeIndex = key; + this.queryParams.examineTag = key; + this.queryParamsList.examineTag = key; + this.getChart(this.queryParams.deptId); + this.getList(this.queryParamsList.deptId); }, /** 鏌ヨ鑰冩牳妯℃澘鍒楄〃 */ - getList(deptId) { + getChart(deptId) { this.loading = true; + lineChart.showLoading(); listScore(this.queryParams).then(response => { - this.tableData = response.data[deptId]; - this.loading = false; - this.initChart(response.data[deptId]); + this.loading = false; + }); + }, + /** 鏌ヨ鑰冩牳妯℃澘鍒楄〃 */ + getList() { + this.tableLoading = true; + detailScore(this.queryParamsList).then(response => { + this.tableData = response.rows; + this.total = response.total; + this.tableLoading = false; }); }, handleSizeChange(val) { @@ -170,9 +219,15 @@ handleCurrentChange(val) { console.log(`褰撳墠椤�: ${val}`); }, - handleDetail(index, row) { - console.log(index, row); - this.$router.push("/examine/detail/detail") + handleDetail(id) { + this.$router.push({ + path: '/examine/detail/detail', + query: { + id: id, + examineTag: this.activeIndex, + deptId: this.queryParamsList.deptId + } + }) }, handleDelete(index, row) { console.log(index, row); @@ -199,12 +254,12 @@ data: dataList.map((item) => item[0]), }, yAxis: { - min: 90, + min: 'dataMin' }, series: [ { name: '杞﹁締鑰冩牳', - data: this.filterData(dataList,0), + data: this.filterData(dataList, 2), type: 'line', itemStyle: { color: 'rgba(62, 144, 247, 1)' @@ -212,7 +267,7 @@ }, { name: '浜鸿劯鑰冩牳', - data: this.filterData(dataList,1), + data: this.filterData(dataList, 3), type: 'line', itemStyle: { color: 'rgba(85, 192, 191, 1)' @@ -220,7 +275,7 @@ }, { name: '瑙嗛鑰冩牳', - data: this.filterData(dataList,2), + data: this.filterData(dataList, 1), type: 'line', itemStyle: { color: 'rgba(255, 165, 0, 1)' @@ -229,30 +284,51 @@ ] }; lineChart.setOption(option, true); + lineChart.hideLoading(); }, groupByData(data) { - if(!data) return []; + if (!data) return this.getAllDay().map((item) => [item, []]); const tempGroup = {}; data.forEach((item) => { - const { createTime } = item; + let { createTime } = item; + let tempTime = createTime.split('-'); + createTime = tempTime[1] + '-' + tempTime[2]; if (!tempGroup[createTime]) { tempGroup[createTime] = []; } tempGroup[createTime].push(item); }) const tempArray = Object.entries(tempGroup).sort(([keyA], [keyB]) => new Date([keyA]) - new Date([keyB])); - return tempArray; }, - filterData(data,tag) { - if(!data) return [0]; + filterData(data, tag) { const scoreList = data.map((item) => { let temp = item[1].find((exam) => exam.examineCategory === tag); - return temp.score; + if (temp) { + return temp.score; + } else { + return; + } }); - console.log(scoreList); return scoreList; + }, + + getAllDay() { + // const date = new Date(); + // const year = date.getFullYear(); + // const month = (date.getMonth() + 1) >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1); + // this.date = year + '-' + month; + const currentDate = this.date.split('-'); + const currentYear = currentDate[0]; + const currentMonth = currentDate[1]; + const daysInMonth = new Date(currentYear, currentMonth, 0).getDate(); + const datesOfMonth = []; + for (var day = 1; day <= daysInMonth; day++) { + const formattedDate = currentMonth + '-' + (day.toString().padStart(2, '0')); + datesOfMonth.push(formattedDate); + } + return datesOfMonth; }, // 鐩戝惉鍙樺寲 @@ -274,15 +350,13 @@ dateChange() { this.queryParams.date = this.date; console.log(this.queryParams); - this.getList(this.queryParams.deptId); + this.getChart(this.queryParams.deptId); } }, mounted() { - this.acitveData = this.dataList[0]; - this.company = this.acitveData.name; lineChart = echarts.init(this.$refs.chartContent); - this.initChart(); + this.getChart(this.$route.query.index); this.observe(); }, beforeDestroy() { -- Gitblit v1.8.0