|
@@ -0,0 +1,156 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="list-view">
|
|
|
|
|
+ <el-table
|
|
|
|
|
+ :data="categories"
|
|
|
|
|
+ ref="table"
|
|
|
|
|
+ header-row-class-name="table-header-row"
|
|
|
|
|
+ header-cell-class-name="table-header-cell"
|
|
|
|
|
+ row-class-name="table-row"
|
|
|
|
|
+ cell-class-name="table-cell"
|
|
|
|
|
+ :height="tableHeight1"
|
|
|
|
|
+ :span-method="objectSpanMethod"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-table-column prop="parentLabel" label="一级指标" min-width="25" align="center">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ {{ row.parentLabel }}
|
|
|
|
|
+ <div>{{ row.parentScore }}分</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <!-- <el-table-column prop="parentScore" label="总分" min-width="15"> </el-table-column> -->
|
|
|
|
|
+ <el-table-column prop="label" label="二级指标" min-width="35" align="center"> </el-table-column>
|
|
|
|
|
+ <el-table-column prop="sub" label="评定项目和要求" min-width="120" show-overflow-tooltip> </el-table-column>
|
|
|
|
|
+ <el-table-column prop="score" label="分值" min-width="20" align="center"> </el-table-column>
|
|
|
|
|
+ <el-table-column prop="score" label="评分" min-width="20" align="center"> </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+import { mapState } from 'vuex';
|
|
|
|
|
+import pageableTable from '@/mixins/pageableTable';
|
|
|
|
|
+import expert from '@/mixins/expert';
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: 'GradeRuleList',
|
|
|
|
|
+ mixins: [pageableTable, expert],
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ multipleMode: false,
|
|
|
|
|
+ search: '',
|
|
|
|
|
+ downloading: false,
|
|
|
|
|
+ spanArr: [],
|
|
|
|
|
+ tableHeight1: 200
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ selection() {
|
|
|
|
|
+ return this.$refs.table.selection.map(i => i.id);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ this.tableHeight1 = document.querySelector('.el-table').getBoundingClientRect().height;
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ beforeGetData() {
|
|
|
|
|
+ return { search: this.search };
|
|
|
|
|
+ },
|
|
|
|
|
+ toggleMultipleMode(multipleMode) {
|
|
|
|
|
+ this.multipleMode = multipleMode;
|
|
|
|
|
+ if (!multipleMode) {
|
|
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ addRow() {
|
|
|
|
|
+ this.$router.push({
|
|
|
|
|
+ path: '/gradeRuleEdit',
|
|
|
|
|
+ query: {
|
|
|
|
|
+ ...this.$route.query
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ editRow(row) {
|
|
|
|
|
+ this.$router.push({
|
|
|
|
|
+ path: '/gradeRuleEdit',
|
|
|
|
|
+ query: {
|
|
|
|
|
+ id: row.id
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ download() {
|
|
|
|
|
+ this.downloading = true;
|
|
|
|
|
+ this.$axios
|
|
|
|
|
+ .get('/gradeRule/excel', {
|
|
|
|
|
+ responseType: 'blob',
|
|
|
|
|
+ params: { size: 10000 }
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ this.downloading = false;
|
|
|
|
|
+ const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
|
|
|
|
|
+ const link = document.createElement('a');
|
|
|
|
|
+ link.href = downloadUrl;
|
|
|
|
|
+ link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
|
|
|
|
|
+ document.body.appendChild(link);
|
|
|
|
|
+ link.click();
|
|
|
|
|
+ link.remove();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ this.downloading = false;
|
|
|
|
|
+ this.$message.error(e.error);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ deleteRow(row) {
|
|
|
|
|
+ this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ return this.$http.post(`/gradeRule/del/${row.id}`);
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.$message.success('删除成功');
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ if (e !== 'cancel') {
|
|
|
|
|
+ this.$message.error(e.error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
|
|
+ if (columnIndex === 0) {
|
|
|
|
|
+ if (rowIndex === 0) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ // 合并第一列(columnIndex === 0),从第2行开始往下2行
|
|
|
|
|
+ rowspan: 5,
|
|
|
|
|
+ colspan: 1
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (rowIndex === 5) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ // 合并第一列(columnIndex === 0),从第2行开始往下2行
|
|
|
|
|
+ rowspan: 8,
|
|
|
|
|
+ colspan: 1
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (rowIndex === 13) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ // 合并第一列(columnIndex === 0),从第2行开始往下2行
|
|
|
|
|
+ rowspan: 2,
|
|
|
|
|
+ colspan: 1
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ if (rowIndex != 0 || rowIndex != 5 || rowIndex != 13) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ // 删除第一列(columnIndex === 0),第3、4行单元格
|
|
|
|
|
+ rowspan: 0,
|
|
|
|
|
+ colspan: 0
|
|
|
|
|
+ };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return {
|
|
|
|
|
+ // 除了第一列,其余的不变
|
|
|
|
|
+ rowspan: 1,
|
|
|
|
|
+ colspan: 1
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+<style lang="less" scoped></style>
|