china
2023-05-11 c7bc3eb18e1fda4254ca0195e2133d2ed978de11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<template>
    <div class="app-container">
      <el-card shadow="never" class="box-card filter-card">
        <!--搜索条件-->
        <div class="filter-container">
          <el-form :inline="true" :model="filterForm" size="small">
            <el-form-item label="顶级单位">
              <el-select v-model="filterForm.orgId" placeholder="选择顶级单位" @change="search(1)">
                <el-option
                  v-for="org in this.rootOrgList" :key="org.id" :label="org.dept_name" :value="org.id"/>
              </el-select>
            </el-form-item>
            <!--            <el-form-item label="发起时间">-->
            <!--              <el-date-picker v-model="filterFrom.startTime" type="date" placeholder="选择开始日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 177px" />-->
            <!--              - <el-date-picker v-model="filterFrom.finishTime" style="width: 177px" type="date" placeholder="选择结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />-->
            <!--            </el-form-item>-->
            <el-form-item label="题库大类">
              <el-select v-model="filterForm.rootCatalog" placeholder="题库大类" clearable>
                <el-option
                  v-for="dict in dict.type.question_root_catalog"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="试卷名称">
              <el-input v-model="filterForm.content" placeholder="试卷名称关键词" clearable/>
            </el-form-item>
            <el-form-item>
              <my-button-v2 site="filter" name="搜索" @click="search(1)" />
              <my-button-v2 site="filter" name="重置" @click="reset()" />
            </el-form-item>
          </el-form>
        </div>
      </el-card>
      <!--列表-->
      <my-table-v3 ref="myTable" :filter="filterForm" :table="table" />
      <!--添加/编辑弹窗-->
      <add v-if="editSetting.show" :setting="editSetting" @close="editSetting.show=false" @search="search" />
    </div>
</template>
 
<script>
  import { listOrgRoot } from '@/api/system/dept'
  import {deletePaper} from "@/api/etaa/paper";
  import myTableV3 from '@/views/components/myTableV3';
  import myButtonV2 from '@/views/components/myButtonV2'
  import {isEmptyValue} from "@/utils/StringUtils";
  import add from "./add";
 
  export default {
    name: "Paper",
    components: {myTableV3, myButtonV2, add},
    dicts: ['question_root_catalog'],
    data(){
      return {
        /** 搜索条件*/
        filterForm: {
          orgId: null,
          rootCatalog: null,
          rootCatalogName: null, // 临时存放名字
          majorCatalog: null,
          content: null
        },
 
        table: {
          autoLoad: false,
          showIndex: false, // 是否显示序号
          expand: false, // 是否显示详情数据
          checkBox: false, // 是否显示复选框
          url: globalConf.baseUrl + '/etaa/paper/list', // 请求地址
          // 工具条
          tools: {
            columnsCtrl: {// 列控制按钮
              show: true
            },
            generalExport: {// 通用导出按钮
              show: false
            },
            custom: [ // 自定义工具条按钮
              {
                name: '添加',
                checkPermission: 'etaa:paper:add',
                myType: 'danger',
                click: ()=> {
                  this.handleRAdd();
                }
              },
              {
                name: '导出参数',
                click: ()=> {
 
                }
              }
            ]
          },
          columns: [
            { title: '名称', field: 'name', align: 'left', width: 190 },
            { title: '大类', field: 'parameter.rootCatalogName', align: 'left', width: 100 },
            { title: '小类', field: 'majorCatalogName', align: 'left', width: 80 },
            { title: '组卷策略', field: 'paperPolicy', align: 'left', width: 90 },
            { title: '策略详情', field: 'policyContent', align: 'left', width: 150 },
            { title: '题量', field: 'questionCount', align: 'left', width: 60 },
            { title: '总分', field: 'scoreTotal', align: 'left', width: 60 },
            { title: '分值详情', field: 'scorePolicy', align: 'left', width: 120 },
            { title: '难度', field: 'difficultLevel', align: 'left', width: 70 },
            { title: '状态', field: 'dataStatus', align: 'left', width: 60, formatter: row => {
                let title = '';
                let type = 'primary';
                switch (row.dataStatus) {
                  case 0:
                    title = '正常'
                    break
                  case 1:
                    title = '禁用'
                    type = 'warn'
                    break
                  case 2:
                    title = '删除'
                    type = 'danger'
                    break
                }
                return { value: title, type: type }
              }
            },
            { title: '创建时间', field: 'parameter.createTimeName', align: 'left', width: 170 },
            { title: '创建人', field: 'parameter.createUserName', align: 'left', width: 90 },
            { title: '备注', field: 'summary', align: 'left', width: 160 }
          ],
          // 操作信息
          operation: {
            show: true, // 显示操作列
            width: '100', // 列宽
            attr: [
              {
                title: '编辑',
                checkPermission: 'etaa:paper:edit',
                events: row => {
                  this.handleUpdate(row)
                }
              },
              {
                title: '删除',
                checkPermission: 'etaa:paper:remove:query',
                events: row => {
                  this.handleDelete(row.id);
                }
              }
            ]
          },
          paging: {
            show: true, // 显示分页
            // 分页信息
            page: {
              small: false,
              pageNum: 1,
              pageSize: platformPageSize,
              total: 0
            }
          }
        },
 
        // 添加&编辑窗口
        editSetting: {
          id: null,
          title: '',
          show: false
        },
 
        // 2022-12-30 根机构列表,个人只能列出自己所在根机构
        rootOrgList:[],
        // 2022-12-30 超级管理员选择的顶级机构ID
        selectedRootOrgId: undefined,
      }
    },
 
    created() {
      this.getRootOrgList();
    },
 
    methods: {
      /** 获取顶级机构列表选择框 2022-12-30 */
      getRootOrgList(){
        listOrgRoot().then(response => {
          this.rootOrgList = response.data;
          this.selectedRootOrgId = this.rootOrgList[0].id;
          this.filterForm.orgId = this.selectedRootOrgId;
        }).then(() => {
          // this.listCatalogTree();
          this.search(1);
        }).catch(function() {
        });
      },
 
      // 重置
      reset() {
        this.filterForm = {
          orgId: this.selectedRootOrgId,
          rootCatalog: null,
          rootCatalogName: null,
          majorCatalog: null,
          content: null
        }
        this.search(1)
      },
 
      // 查询table列表
      search(pageNum) {
        if(isEmptyValue(this.filterForm.orgId)){
          return;
        } else {
          if (pageNum != undefined) {
            this.$refs.myTable.search({ pageNum: pageNum })
          } else {
            this.$refs.myTable.search()
          }
        }
      },
 
      handleRAdd(){
        if(isEmptyValue(this.selectedRootOrgId)){
          this.$message.warning("请先选择一个顶级机构");
          return;
        }
        // if(isEmptyValue(this.filterForm.rootCatalog)){
        //   this.$message.warning("请先选择题库大类");
        //   return;
        // }
        this.editSetting.id = null;
        this.editSetting.title = "添加试卷";
        this.editSetting.rootCatalog = this.filterForm.rootCatalog;
        this.editSetting.orgId = this.selectedRootOrgId;
        this.editSetting.show = true;
      },
 
      handleDelete(id){
        this.$modal.confirm("确定要删除试卷吗?仅在测试时可以,正式只能禁用").then(()=>{
          deletePaper(id).then(response => {
            this.search(1);
            this.$message.success("删除成功!");
          });
        }).catch(() => {});
      }
    }
  }
</script>
 
<style scoped>
 
</style>