Commit 1544d4d5375d7b9b57f39b125f3b24fd2576839f

Authored by wwk
1 parent 3cf63544

aa

antis-ncc-admin/src/views/tbEvaluation/Form.vue
1 1 <template>
2   - <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px">
3   - <el-row :gutter="15" class="" >
4   - <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules">
5   - <el-col :span="24">
6   - <el-form-item label="标题" prop="title">
7   - <el-input v-model="dataForm.title" placeholder="请输入" required show-word-limit :style='{"width":"100%"}' type='textarea' :autosize='{"minRows":4,"maxRows":4}' maxlength="200" >
8   - </el-input>
9   - </el-form-item>
10   - </el-col>
11   - <el-col :span="24">
12   - <el-form-item label="图片" prop="img">
13   - <NCC-UploadImg v-model="dataForm.img" required :fileSize="5" sizeUnit="MB" :limit="1" >
14   - </NCC-UploadImg>
15   - </el-form-item>
16   - </el-col>
17   - <el-col :span="24">
18   - <el-form-item label="图文信息" prop="editors">
19   - <NCC-Quill v-model="dataForm.editors" placeholder="请输入内容..." required >
20   - </NCC-Quill>
21   - </el-form-item>
22   - </el-col>
23   - <el-col :span="24" v-if="false" >
24   - <el-form-item label="创建时间" prop="creatorTime">
25   - <el-input v-model="dataForm.creatorTime" placeholder="系统自动生成" readonly >
26   - </el-input>
27   - </el-form-item>
28   - </el-col>
29   - <el-col :span="24" v-if="false" >
30   - <el-form-item label="修改时间" prop="lastModifyTime">
31   - <el-input v-model="dataForm.lastModifyTime" placeholder="系统自动生成" readonly >
32   - </el-input>
33   - </el-form-item>
34   - </el-col>
35   - </el-form>
  2 + <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false"
  3 + :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px">
  4 + <el-row :gutter="15" class="">
  5 + <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right"
  6 + :disabled="!!isDetail" :rules="rules">
  7 + <el-col :span="24">
  8 + <el-form-item label="标题" prop="title">
  9 + <el-input v-model="dataForm.title" placeholder="请输入" required show-word-limit
  10 + :style='{"width":"100%"}' type='textarea' :autosize='{"minRows":4,"maxRows":4}'
  11 + maxlength="200">
  12 + </el-input>
  13 + </el-form-item>
  14 + </el-col>
  15 + <el-col :span="24">
  16 + <el-form-item label="是否默认" prop="detault">
  17 + <el-select v-model="dataForm.detault" placeholder="请选择" clearable required
  18 + :style='{"width":"100%"}'>
  19 + <el-option v-for="(item, index) in detaultOptions" :key="index" :label="item.fullName"
  20 + :value="item.id"></el-option>
  21 + </el-select>
  22 + </el-form-item>
  23 + </el-col>
  24 + <el-col :span="24">
  25 + <el-form-item label="图片" prop="img">
  26 + <NCC-UploadImg v-model="dataForm.img" required :fileSize="5" sizeUnit="MB" :limit="1">
  27 + </NCC-UploadImg>
  28 + </el-form-item>
  29 + </el-col>
  30 + <el-col :span="24">
  31 + <el-form-item label="图文信息" prop="editors">
  32 + <NCC-Quill v-model="dataForm.editors" placeholder="请输入内容..." required>
  33 + </NCC-Quill>
  34 + </el-form-item>
  35 + </el-col>
  36 + <el-col :span="24" v-if="false">
  37 + <el-form-item label="创建时间" prop="creatorTime">
  38 + <el-input v-model="dataForm.creatorTime" placeholder="系统自动生成" readonly>
  39 + </el-input>
  40 + </el-form-item>
  41 + </el-col>
  42 + <el-col :span="24" v-if="false">
  43 + <el-form-item label="修改时间" prop="lastModifyTime">
  44 + <el-input v-model="dataForm.lastModifyTime" placeholder="系统自动生成" readonly>
  45 + </el-input>
  46 + </el-form-item>
  47 + </el-col>
  48 + </el-form>
36 49 </el-row>
37 50 <span slot="footer" class="dialog-footer">
38 51 <el-button @click="visible = false">取 消</el-button>
... ... @@ -42,8 +55,12 @@
42 55 </template>
43 56 <script>
44 57 import request from '@/utils/request'
45   - import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
46   - import { previewDataInterface } from '@/api/systemData/dataInterface'
  58 + import {
  59 + getDictionaryDataSelector
  60 + } from '@/api/systemData/dictionary'
  61 + import {
  62 + previewDataInterface
  63 + } from '@/api/systemData/dataInterface'
47 64 export default {
48 65 components: {},
49 66 props: [],
... ... @@ -53,103 +70,108 @@
53 70 visible: false,
54 71 isDetail: false,
55 72 dataForm: {
56   - id:'',
57   - title:undefined,
58   - img:[],
59   - editors:undefined,
60   - creatorTime:undefined,
61   - lastModifyTime:undefined,
  73 + id: '',
  74 + title: undefined,
  75 + img: [],
  76 + detault: undefined,
  77 + editors: undefined,
  78 + creatorTime: undefined,
  79 + lastModifyTime: undefined,
62 80 },
  81 + detaultOptions: [{
  82 + "fullName": "默认",
  83 + "id": "1"
  84 + }, {
  85 + "fullName": "普通",
  86 + "id": "2"
  87 + }],
63 88 rules: {
64   - title:[
65   - {
66   - required:true,
67   - message:'请输入标题',
68   - trigger:'blur'
69   - },
70   - ],
71   - img:[
72   - {
73   - required:true,
74   - message:'请输入图片',
75   - trigger:'click'
76   - },
77   - ],
78   - editors:[
79   - {
80   - required:true,
81   - message:'请输入图文信息',
82   - trigger:'blur'
83   - },
84   - ],
  89 + title: [{
  90 + required: true,
  91 + message: '请输入标题',
  92 + trigger: 'blur'
  93 + }, ],
  94 + img: [{
  95 + required: true,
  96 + message: '请输入图片',
  97 + trigger: 'click'
  98 + }, ],
  99 + editors: [{
  100 + required: true,
  101 + message: '请输入图文信息',
  102 + trigger: 'blur'
  103 + }, ],
  104 + detault: [{
  105 + required: true,
  106 + message: '请输入是否默认',
  107 + trigger: 'change'
  108 + }, ],
85 109 },
86 110 }
87 111 },
88 112 computed: {},
89   - watch: {},
90   - created() {
91   - },
92   - mounted() {
93   - },
  113 + watch: {},
  114 + created() {},
  115 + mounted() {},
94 116 methods: {
95 117 goBack() {
96   - this.$emit('refresh')
97   - },
  118 + this.$emit('refresh')
  119 + },
98 120 init(id, isDetail) {
99 121 this.dataForm.id = id || 0;
100   - this.visible = true;
101   - this.isDetail = isDetail || false;
  122 + this.visible = true;
  123 + this.isDetail = isDetail || false;
102 124 this.$nextTick(() => {
103 125 this.$refs['elForm'].resetFields();
104 126 if (this.dataForm.id) {
105 127 request({
106 128 url: '/api/Education/TbEvaluation/' + this.dataForm.id,
107 129 method: 'get'
108   - }).then(res =>{
  130 + }).then(res => {
109 131 this.dataForm = res.data;
110   - if(!this.dataForm.img)this.dataForm.img=[];
  132 + if (!this.dataForm.img) this.dataForm.img = [];
111 133 })
112 134 }
113 135 })
114 136 },
115 137 dataFormSubmit() {
116 138 this.$refs['elForm'].validate((valid) => {
117   - if (valid) {
118   - if (!this.dataForm.id) {
119   - request({
120   - url: `/api/Education/TbEvaluation`,
121   - method: 'post',
122   - data: this.dataForm,
123   - }).then((res) => {
124   - this.$message({
125   - message: res.msg,
126   - type: 'success',
127   - duration: 1000,
128   - onClose: () => {
129   - this.visible = false,
130   - this.$emit('refresh', true)
131   - }
132   - })
133   - })
134   - } else {
135   - request({
136   - url: '/api/Education/TbEvaluation/' + this.dataForm.id,
137   - method: 'PUT',
138   - data: this.dataForm
139   - }).then((res) => {
140   - this.$message({
141   - message: res.msg,
142   - type: 'success',
143   - duration: 1000,
144   - onClose: () => {
145   - this.visible = false
146   - this.$emit('refresh', true)
147   - }
148   - })
149   - })
150   - }
151   - }
152   - })
  139 + if (valid) {
  140 + if (!this.dataForm.id) {
  141 + request({
  142 + url: `/api/Education/TbEvaluation`,
  143 + method: 'post',
  144 + data: this.dataForm,
  145 + }).then((res) => {
  146 + this.$message({
  147 + message: res.msg,
  148 + type: 'success',
  149 + duration: 1000,
  150 + onClose: () => {
  151 + this.visible = false,
  152 + this.$emit('refresh', true)
  153 + }
  154 + })
  155 + })
  156 + } else {
  157 + request({
  158 + url: '/api/Education/TbEvaluation/' + this.dataForm.id,
  159 + method: 'PUT',
  160 + data: this.dataForm
  161 + }).then((res) => {
  162 + this.$message({
  163 + message: res.msg,
  164 + type: 'success',
  165 + duration: 1000,
  166 + onClose: () => {
  167 + this.visible = false
  168 + this.$emit('refresh', true)
  169 + }
  170 + })
  171 + })
  172 + }
  173 + }
  174 + })
153 175 },
154 176 }
155 177 }
... ...
antis-ncc-admin/src/views/tbEvaluation/index.vue
... ... @@ -5,7 +5,15 @@
5 5 <el-form @submit.native.prevent>
6 6 <el-col :span="6">
7 7 <el-form-item label="标题">
8   - <el-input v-model="query.title" placeholder="标题" />
  8 + <el-input v-model="query.title" placeholder="标题" />
  9 + </el-form-item>
  10 + </el-col>
  11 + <el-col :span="6">
  12 + <el-form-item label="是否默认">
  13 + <el-select v-model="query.detault" placeholder="是否默认" clearable>
  14 + <el-option v-for="(item, index) in detaultOptions" :key="index" :label="item.fullName"
  15 + :value="item.id" />
  16 + </el-select>
9 17 </el-form-item>
10 18 </el-col>
11 19 <el-col :span="6">
... ... @@ -25,190 +33,241 @@
25 33 </div>
26 34 <div class="NCC-common-head-right">
27 35 <el-tooltip effect="dark" content="刷新" placement="top">
28   - <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false" @click="reset()" />
  36 + <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false"
  37 + @click="reset()" />
29 38 </el-tooltip>
30 39 <screenfull isContainer />
31 40 </div>
32 41 </div>
33   - <NCC-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange">
  42 + <NCC-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange">
34 43 <el-table-column prop="title" label="标题" align="left" />
35   - <el-table-column prop="creatorTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat"/>
36   - <el-table-column prop="lastModifyTime" label="修改时间" align="left" :formatter="ncc.tableDateFormat"/>
  44 + <el-table-column label="是否默认" prop="detault" align="left">
  45 + <template slot-scope="scope">{{ scope.row.detault | dynamicText(detaultOptions) }}</template>
  46 + </el-table-column>
  47 + <el-table-column prop="creatorTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat" />
  48 + <el-table-column prop="lastModifyTime" label="修改时间" align="left" :formatter="ncc.tableDateFormat" />
37 49 <el-table-column label="操作" fixed="right" width="100">
38   - <template slot-scope="scope">
39   - <el-button type="text" @click="addOrUpdateHandle(scope.row.id)" >编辑</el-button>
40   - <el-button type="text" @click="handleDel(scope.row.id)" class="NCC-table-delBtn" >删除</el-button>
  50 + <template slot-scope="scope">
  51 + <el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button>
  52 + <el-button type="text" @click="handleDel(scope.row.id)" class="NCC-table-delBtn">删除
  53 + </el-button>
  54 + <el-button type="text" @click="Cofirm(scope.row.id)">设为置顶</el-button>
41 55 </template>
42 56 </el-table-column>
43 57 </NCC-table>
44   - <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" />
45   - </div>
46   - </div>
  58 + <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
  59 + @pagination="initData" />
  60 + </div>
  61 + </div>
47 62 <NCC-Form v-if="formVisible" ref="NCCForm" @refresh="refresh" />
48 63 <ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" />
49 64 </div>
50 65 </template>
51 66 <script>
52   - import request from '@/utils/request'
53   - import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
54   - import NCCForm from './Form'
55   - import ExportBox from './ExportBox'
56   - import { previewDataInterface } from '@/api/systemData/dataInterface'
  67 + import request from '@/utils/request'
  68 + import {
  69 + getDictionaryDataSelector
  70 + } from '@/api/systemData/dictionary'
  71 + import NCCForm from './Form'
  72 + import ExportBox from './ExportBox'
  73 + import {
  74 + previewDataInterface
  75 + } from '@/api/systemData/dataInterface'
57 76 export default {
58   - components: { NCCForm, ExportBox },
59   - data() {
60   - return {
  77 + components: {
  78 + NCCForm,
  79 + ExportBox
  80 + },
  81 + data() {
  82 + return {
61 83 query: {
62   - title:undefined,
  84 + title: undefined,
  85 + detault: undefined,
63 86 },
64   - list: [],
65   - listLoading: true,
66   - multipleSelection: [], total: 0,
67   - listQuery: {
68   - currentPage: 1,
69   - pageSize: 20,
  87 + list: [],
  88 + listLoading: true,
  89 + multipleSelection: [],
  90 + total: 0,
  91 + listQuery: {
  92 + currentPage: 1,
  93 + pageSize: 20,
70 94 sort: "desc",
71   - sidx: "",
72   - },
73   - formVisible: false,
74   - exportBoxVisible: false,
75   - columnList: [
76   - { prop: 'title', label: '标题' },
77   - { prop: 'creatorTime', label: '创建时间' },
78   - { prop: 'lastModifyTime', label: '修改时间' },
  95 + sidx: "",
  96 + },
  97 + formVisible: false,
  98 + exportBoxVisible: false,
  99 + detaultOptions: [{
  100 + "fullName": "默认",
  101 + "id": "1"
  102 + }, {
  103 + "fullName": "普通",
  104 + "id": "2"
  105 + }],
  106 + columnList: [{
  107 + prop: 'title',
  108 + label: '标题'
  109 + },
  110 + {
  111 + prop: 'creatorTime',
  112 + label: '创建时间'
  113 + },
  114 + {
  115 + prop: 'lastModifyTime',
  116 + label: '修改时间'
  117 + },
  118 + {
  119 + prop: 'detault',
  120 + label: '是否默认'
  121 + },
79 122 ],
80 123 }
81   - },
  124 + },
82 125 computed: {},
83 126 created() {
84 127 this.initData()
85 128 },
86 129 methods: {
  130 + Cofirm(id){
  131 + request({
  132 + url: `/api/Education/tbevaluation/ConfirmEvalDefault?id=`+id,
  133 + method: 'POST',
  134 + }).then(res => {
  135 + if(res.code==200){
  136 + this.$message.success('设置成功')
  137 + this.initData()
  138 + }else{
  139 + this.$message.error('设置失败')
  140 + }
  141 + })
  142 + },
87 143 initData() {
88   - this.listLoading = true;
89   - let _query = {
90   - ...this.listQuery,
91   - ...this.query
92   - };
93   - let query = {}
94   - for (let key in _query) {
95   - if (Array.isArray(_query[key])) {
96   - query[key] = _query[key].join()
97   - } else {
98   - query[key] = _query[key]
99   - }
100   - }
101   - request({
102   - url: `/api/Education/TbEvaluation`,
103   - method: 'GET',
104   - data: query
105   - }).then(res => {
106   - this.list = res.data.list
107   - this.total = res.data.pagination.total
108   - this.listLoading = false
109   - })
110   - },
  144 + this.listLoading = true;
  145 + let _query = {
  146 + ...this.listQuery,
  147 + ...this.query
  148 + };
  149 + let query = {}
  150 + for (let key in _query) {
  151 + if (Array.isArray(_query[key])) {
  152 + query[key] = _query[key].join()
  153 + } else {
  154 + query[key] = _query[key]
  155 + }
  156 + }
  157 + request({
  158 + url: `/api/Education/TbEvaluation`,
  159 + method: 'GET',
  160 + data: query
  161 + }).then(res => {
  162 + this.list = res.data.list
  163 + this.total = res.data.pagination.total
  164 + this.listLoading = false
  165 + })
  166 + },
111 167 handleDel(id) {
112   - this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
113   - type: 'warning'
114   - }).then(() => {
115   - request({
116   - url: `/api/Education/TbEvaluation/${id}`,
117   - method: 'DELETE'
118   - }).then(res => {
119   - this.$message({
120   - type: 'success',
121   - message: res.msg,
122   - onClose: () => {
123   - this.initData()
124   - }
125   - });
126   - })
127   - }).catch(() => {
128   - });
129   - },
  168 + this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  169 + type: 'warning'
  170 + }).then(() => {
  171 + request({
  172 + url: `/api/Education/TbEvaluation/${id}`,
  173 + method: 'DELETE'
  174 + }).then(res => {
  175 + this.$message({
  176 + type: 'success',
  177 + message: res.msg,
  178 + onClose: () => {
  179 + this.initData()
  180 + }
  181 + });
  182 + })
  183 + }).catch(() => {});
  184 + },
130 185 handleSelectionChange(val) {
131   - const res = val.map(item => item.id)
132   - this.multipleSelection = res
133   - },
134   - handleBatchRemoveDel() {
135   - if (!this.multipleSelection.length) {
136   - this.$message({
137   - type: 'error',
138   - message: '请选择一条数据',
139   - duration: 1500,
140   - })
141   - return
142   - }
143   - const ids = this.multipleSelection
144   - this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
145   - type: 'warning'
146   - }).then(() => {
147   - request({
148   - url: `/api/Education/TbEvaluation/batchRemove`,
149   - method: 'POST',
150   - data: ids ,
151   - }).then(res => {
152   - this.$message({
153   - type: 'success',
154   - message: res.msg,
155   - onClose: () => {
156   - this.initData()
157   - }
158   - });
159   - })
160   - }).catch(() => { })
161   - },
  186 + const res = val.map(item => item.id)
  187 + this.multipleSelection = res
  188 + },
  189 + handleBatchRemoveDel() {
  190 + if (!this.multipleSelection.length) {
  191 + this.$message({
  192 + type: 'error',
  193 + message: '请选择一条数据',
  194 + duration: 1500,
  195 + })
  196 + return
  197 + }
  198 + const ids = this.multipleSelection
  199 + this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
  200 + type: 'warning'
  201 + }).then(() => {
  202 + request({
  203 + url: `/api/Education/TbEvaluation/batchRemove`,
  204 + method: 'POST',
  205 + data: ids,
  206 + }).then(res => {
  207 + this.$message({
  208 + type: 'success',
  209 + message: res.msg,
  210 + onClose: () => {
  211 + this.initData()
  212 + }
  213 + });
  214 + })
  215 + }).catch(() => {})
  216 + },
162 217 addOrUpdateHandle(id, isDetail) {
163   - this.formVisible = true
164   - this.$nextTick(() => {
165   - this.$refs.NCCForm.init(id, isDetail)
166   - })
167   - },
  218 + this.formVisible = true
  219 + this.$nextTick(() => {
  220 + this.$refs.NCCForm.init(id, isDetail)
  221 + })
  222 + },
168 223 exportData() {
169   - this.exportBoxVisible = true
170   - this.$nextTick(() => {
171   - this.$refs.ExportBox.init(this.columnList)
172   - })
173   - },
174   - download(data) {
175   - let query = { ...data, ...this.listQuery, ...this.query }
176   - request({
177   - url: `/api/Education/TbEvaluation/Actions/Export`,
178   - method: 'GET',
179   - data: query
180   - }).then(res => {
181   - if (!res.data.url) return
182   - window.location.href = this.define.comUrl + res.data.url
183   - this.$refs.ExportBox.visible = false
184   - this.exportBoxVisible = false
185   - })
186   - },
  224 + this.exportBoxVisible = true
  225 + this.$nextTick(() => {
  226 + this.$refs.ExportBox.init(this.columnList)
  227 + })
  228 + },
  229 + download(data) {
  230 + let query = {
  231 + ...data,
  232 + ...this.listQuery,
  233 + ...this.query
  234 + }
  235 + request({
  236 + url: `/api/Education/TbEvaluation/Actions/Export`,
  237 + method: 'GET',
  238 + data: query
  239 + }).then(res => {
  240 + if (!res.data.url) return
  241 + window.location.href = this.define.comUrl + res.data.url
  242 + this.$refs.ExportBox.visible = false
  243 + this.exportBoxVisible = false
  244 + })
  245 + },
187 246 search() {
188   - this.listQuery = {
189   - currentPage: 1,
190   - pageSize: 20,
191   - sort: "desc",
192   - sidx: "",
193   - }
194   - this.initData()
195   - },
196   - refresh(isrRefresh) {
197   - this.formVisible = false
198   - if (isrRefresh) this.reset()
199   - },
200   - reset() {
201   - for (let key in this.query) {
202   - this.query[key] = undefined
203   - }
204   - this.listQuery = {
205   - currentPage: 1,
206   - pageSize: 20,
207   - sort: "desc",
208   - sidx: "",
209   - }
210   - this.initData()
211   - }
  247 + this.listQuery = {
  248 + currentPage: 1,
  249 + pageSize: 20,
  250 + sort: "desc",
  251 + sidx: "",
  252 + }
  253 + this.initData()
  254 + },
  255 + refresh(isrRefresh) {
  256 + this.formVisible = false
  257 + if (isrRefresh) this.reset()
  258 + },
  259 + reset() {
  260 + for (let key in this.query) {
  261 + this.query[key] = undefined
  262 + }
  263 + this.listQuery = {
  264 + currentPage: 1,
  265 + pageSize: 20,
  266 + sort: "desc",
  267 + sidx: "",
  268 + }
  269 + this.initData()
  270 + }
212 271 }
213   - }
214   -</script>
215 272 \ No newline at end of file
  273 + }
  274 +</script>
... ...
antis-ncc-admin/src/views/tbMemCode/index.vue
... ... @@ -37,6 +37,8 @@
37 37 <el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增</el-button>
38 38 <el-button type="text" icon="el-icon-download" @click="exportData()">导出</el-button>
39 39 <el-button type="text" icon="el-icon-delete" @click="handleBatchRemoveDel()">批量删除</el-button>
  40 + <el-button type="text" icon="el-icon-delete" @click="dialogVisibleCreate=true">批量生成</el-button>
  41 + <el-button type="text" icon="el-icon-delete" @click="dialogVisibleUpdate=true">批量修改</el-button>
40 42 </div>
41 43 <div class="NCC-common-head-right">
42 44 <el-tooltip effect="dark" content="刷新" placement="top">
... ... @@ -51,7 +53,7 @@
51 53 <el-table-column label="状态" prop="type" align="left">
52 54 <template slot-scope="scope">{{ scope.row.type | dynamicText(typeOptions) }}</template>
53 55 </el-table-column>
54   - <el-table-column prop="expire" label="到期时间截至" align="left" :formatter="ncc.tableDateFormat"/>
  56 + <el-table-column prop="expire" label="到期时间截至" align="left" :formatter="ncc.tableDateFormat" />
55 57 <el-table-column prop="creatorTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat" />
56 58 <el-table-column prop="lastModifyTime" label="修改时间" align="left" :formatter="ncc.tableDateFormat" />
57 59 <el-table-column label="操作" fixed="right" width="100">
... ... @@ -68,6 +70,33 @@
68 70 </div>
69 71 <NCC-Form v-if="formVisible" ref="NCCForm" @refresh="refresh" />
70 72 <ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" />
  73 + <el-dialog title="批量生成" :visible.sync="dialogVisibleCreate" width="30%">
  74 + <el-form ref="CreateCodeModel" :model="CreateCodeModel" label-width="80px">
  75 + <el-form-item label="数量">
  76 + <el-input-number v-model="CreateCodeModel.numbers" :min="1" :max="10" label="数量"></el-input-number>
  77 + </el-form-item>
  78 + <el-form-item label="到期日期">
  79 + <el-date-picker v-model="CreateCodeModel.expire" type="date" placeholder="选择日期">
  80 + </el-date-picker>
  81 + </el-form-item>
  82 + </el-form>
  83 + <span slot="footer" class="dialog-footer">
  84 + <el-button @click="dialogVisibleCreate = false">取 消</el-button>
  85 + <el-button type="primary" @click="SubmitCreate">确 定</el-button>
  86 + </span>
  87 + </el-dialog>
  88 + <el-dialog title="批量修改" :visible.sync="dialogVisibleUpdate" width="30%">
  89 + <el-form ref="UpdateCodeModel" :model="UpdateCodeModel" label-width="80px">
  90 + <el-form-item label="到期日期">
  91 + <el-date-picker v-model="UpdateCodeModel.expire" type="date" placeholder="选择日期">
  92 + </el-date-picker>
  93 + </el-form-item>
  94 + </el-form>
  95 + <span slot="footer" class="dialog-footer">
  96 + <el-button @click="dialogVisibleUpdate = false">取 消</el-button>
  97 + <el-button type="primary" @click="SubmitUpdate">确 定</el-button>
  98 + </span>
  99 + </el-dialog>
71 100 </div>
72 101 </template>
73 102 <script>
... ... @@ -87,6 +116,8 @@
87 116 },
88 117 data() {
89 118 return {
  119 + dialogVisibleCreate: false,
  120 + dialogVisibleUpdate: false,
90 121 query: {
91 122 code: undefined,
92 123 type: undefined,
... ... @@ -134,6 +165,15 @@
134 165 "fullName": "未使用",
135 166 "id": "2"
136 167 }],
  168 + CreateCodeModel: {
  169 + "numbers": 1,
  170 + "expire": undefined
  171 + },
  172 + IDS:[],
  173 + UpdateCodeModel: {
  174 + "ids": "",
  175 + "expire": undefined
  176 + }
137 177 }
138 178 },
139 179 computed: {},
... ... @@ -141,6 +181,51 @@
141 181 this.initData()
142 182 },
143 183 methods: {
  184 + SubmitCreate() {
  185 + if(this.CreateCodeModel.expire){
  186 + this.$message.error('请填写截至日期时间')
  187 + return
  188 + }
  189 + request({
  190 + url: `/api/Education/tbmemcode/MutinueCreateCode`,
  191 + method: 'POST',
  192 + data: this.CreateCodeModel
  193 + }).then(res => {
  194 + if(res.code==200){
  195 + this.$message.success('操作成功')
  196 + this.initData()
  197 + this.dialogVisibleCreate=false
  198 + }else{
  199 + this.$message.error('操作失败')
  200 + }
  201 + })
  202 + },
  203 + SubmitUpdate(){
  204 + this.UpdateCodeModel.ids=this.IDS.toString()
  205 + this.UpdateCodeModel.expire=this.ncc.dateFormat(this.UpdateCodeModel.expire,'YYYY-MM-DD')
  206 + console.log('这是最终参数',this.UpdateCodeModel)
  207 + if(this.IDS.length==0){
  208 + this.$message.error('请选择会员码')
  209 + return
  210 + }
  211 + if(this.UpdateCodeModel.expire==undefined){
  212 + this.$message.error('请选择会员码')
  213 + return
  214 + }
  215 + request({
  216 + url: `/api/Education/tbmemcode/MutinueUpdateDaysNumber`,
  217 + method: 'POST',
  218 + data: this.UpdateCodeModel
  219 + }).then(res => {
  220 + if(res.code==200){
  221 + this.$message.success('操作成功')
  222 + this.initData()
  223 + this.dialogVisibleUpdate=false
  224 + }else{
  225 + this.$message.error('操作失败')
  226 + }
  227 + })
  228 + },
144 229 initData() {
145 230 this.listLoading = true;
146 231 let _query = {
... ... @@ -185,6 +270,12 @@
185 270 },
186 271 handleSelectionChange(val) {
187 272 const res = val.map(item => item.id)
  273 + this.IDS=[]
  274 + val.forEach((item,index)=>{
  275 + this.IDS.push(item.id)
  276 + })
  277 + console.log('这是赋值的信息',this.IDS)
  278 + console.log('这是选择的西悉尼',val)
188 279 this.multipleSelection = res
189 280 },
190 281 handleBatchRemoveDel() {
... ...
antis-ncc-admin/src/views/tbPunch/index.vue
... ... @@ -130,7 +130,7 @@
130 130 { prop: 'lastModifyTime', label: '修改时间' },
131 131 { prop: 'type', label: '状态' },
132 132 ],
133   - typeOptions:[{"fullName":"已打卡","id":"1"},{"fullName":"缺卡","id":"2"}],
  133 + typeOptions:[{"fullName":"已打卡","id":"1"},{"fullName":"缺卡","id":"2"}],
134 134 }
135 135 },
136 136 computed: {},
... ...
antis-ncc-admin/src/views/tbQuestion/Form.vue
1 1 <template>
2   - <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px">
3   - <el-row :gutter="15" class="" >
4   - <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules">
5   - <el-col :span="24">
6   - <el-form-item label="标题" prop="title">
7   - <el-input v-model="dataForm.title" placeholder="请输入" required show-word-limit :style='{"width":"100%"}' type='textarea' :autosize='{"minRows":4,"maxRows":4}' maxlength="200" >
8   - </el-input>
9   - </el-form-item>
10   - </el-col>
11   - <el-col :span="24">
12   - <el-form-item label="图片信息" prop="img">
13   - <NCC-UploadImg v-model="dataForm.img" required :fileSize="5" sizeUnit="MB" :limit="1" >
14   - </NCC-UploadImg>
15   - </el-form-item>
16   - </el-col>
17   - <el-col :span="24">
18   - <el-form-item label="图文信息" prop="editors">
19   - <NCC-Quill v-model="dataForm.editors" placeholder="请输入内容..." required >
20   - </NCC-Quill>
21   - </el-form-item>
22   - </el-col>
23   - <el-col :span="24" v-if="false" >
24   - <el-form-item label="创建时间" prop="creatorTime">
25   - <el-input v-model="dataForm.creatorTime" placeholder="系统自动生成" readonly >
26   - </el-input>
27   - </el-form-item>
28   - </el-col>
29   - <el-col :span="24" v-if="false" >
30   - <el-form-item label="修改时间" prop="lastModifyTime">
31   - <el-input v-model="dataForm.lastModifyTime" placeholder="系统自动生成" readonly >
32   - </el-input>
33   - </el-form-item>
34   - </el-col>
35   - </el-form>
  2 + <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false"
  3 + :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px">
  4 + <el-row :gutter="15" class="">
  5 + <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right"
  6 + :disabled="!!isDetail" :rules="rules">
  7 + <el-col :span="24">
  8 + <el-form-item label="标题" prop="title">
  9 + <el-input v-model="dataForm.title" placeholder="请输入" required show-word-limit
  10 + :style='{"width":"100%"}' type='textarea' :autosize='{"minRows":4,"maxRows":4}'
  11 + maxlength="200">
  12 + </el-input>
  13 + </el-form-item>
  14 + </el-col>
  15 + <el-col :span="24">
  16 + <el-form-item label="图片信息" prop="img">
  17 + <NCC-UploadImg v-model="dataForm.img" required :fileSize="5" sizeUnit="MB" :limit="1">
  18 + </NCC-UploadImg>
  19 + </el-form-item>
  20 + </el-col>
  21 + <el-col :span="24">
  22 + <el-form-item label="是否默认" prop="detault">
  23 + <el-select v-model="dataForm.detault" placeholder="请选择" clearable required
  24 + :style='{"width":"100%"}'>
  25 + <el-option v-for="(item, index) in detaultOptions" :key="index" :label="item.fullName"
  26 + :value="item.id"></el-option>
  27 + </el-select>
  28 + </el-form-item>
  29 + </el-col>
  30 + <el-col :span="24">
  31 + <el-form-item label="图文信息" prop="editors">
  32 + <NCC-Quill v-model="dataForm.editors" placeholder="请输入内容..." required>
  33 + </NCC-Quill>
  34 + </el-form-item>
  35 + </el-col>
  36 + <el-col :span="24" v-if="false">
  37 + <el-form-item label="创建时间" prop="creatorTime">
  38 + <el-input v-model="dataForm.creatorTime" placeholder="系统自动生成" readonly>
  39 + </el-input>
  40 + </el-form-item>
  41 + </el-col>
  42 + <el-col :span="24" v-if="false">
  43 + <el-form-item label="修改时间" prop="lastModifyTime">
  44 + <el-input v-model="dataForm.lastModifyTime" placeholder="系统自动生成" readonly>
  45 + </el-input>
  46 + </el-form-item>
  47 + </el-col>
  48 + </el-form>
36 49 </el-row>
37 50 <span slot="footer" class="dialog-footer">
38 51 <el-button @click="visible = false">取 消</el-button>
... ... @@ -42,8 +55,12 @@
42 55 </template>
43 56 <script>
44 57 import request from '@/utils/request'
45   - import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
46   - import { previewDataInterface } from '@/api/systemData/dataInterface'
  58 + import {
  59 + getDictionaryDataSelector
  60 + } from '@/api/systemData/dictionary'
  61 + import {
  62 + previewDataInterface
  63 + } from '@/api/systemData/dataInterface'
47 64 export default {
48 65 components: {},
49 66 props: [],
... ... @@ -53,103 +70,110 @@
53 70 visible: false,
54 71 isDetail: false,
55 72 dataForm: {
56   - id:'',
57   - title:undefined,
58   - img:[],
59   - editors:undefined,
60   - creatorTime:undefined,
61   - lastModifyTime:undefined,
  73 + id: '',
  74 + title: undefined,
  75 + img: [],
  76 + detault: undefined,
  77 +
  78 + editors: undefined,
  79 + creatorTime: undefined,
  80 + lastModifyTime: undefined,
62 81 },
  82 + detaultOptions: [{
  83 + "fullName": "默认",
  84 + "id": "1"
  85 + }, {
  86 + "fullName": "普通",
  87 + "id": "2"
  88 + }],
  89 +
63 90 rules: {
64   - title:[
65   - {
66   - required:true,
67   - message:'请输入标题',
68   - trigger:'blur'
69   - },
70   - ],
71   - img:[
72   - {
73   - required:true,
74   - message:'请输入图片信息',
75   - trigger:'click'
76   - },
77   - ],
78   - editors:[
79   - {
80   - required:true,
81   - message:'请输入图文信息',
82   - trigger:'blur'
83   - },
84   - ],
  91 + title: [{
  92 + required: true,
  93 + message: '请输入标题',
  94 + trigger: 'blur'
  95 + }, ],
  96 + img: [{
  97 + required: true,
  98 + message: '请输入图片信息',
  99 + trigger: 'click'
  100 + }, ],
  101 + editors: [{
  102 + required: true,
  103 + message: '请输入图文信息',
  104 + trigger: 'blur'
  105 + }, ],
  106 + detault: [{
  107 + required: true,
  108 + message: '请输入是否默认',
  109 + trigger: 'change'
  110 + }, ],
85 111 },
86 112 }
87 113 },
88 114 computed: {},
89   - watch: {},
90   - created() {
91   - },
92   - mounted() {
93   - },
  115 + watch: {},
  116 + created() {},
  117 + mounted() {},
94 118 methods: {
95 119 goBack() {
96   - this.$emit('refresh')
97   - },
  120 + this.$emit('refresh')
  121 + },
98 122 init(id, isDetail) {
99 123 this.dataForm.id = id || 0;
100   - this.visible = true;
101   - this.isDetail = isDetail || false;
  124 + this.visible = true;
  125 + this.isDetail = isDetail || false;
102 126 this.$nextTick(() => {
103 127 this.$refs['elForm'].resetFields();
104 128 if (this.dataForm.id) {
105 129 request({
106 130 url: '/api/Education/TbQuestion/' + this.dataForm.id,
107 131 method: 'get'
108   - }).then(res =>{
  132 + }).then(res => {
109 133 this.dataForm = res.data;
110   - if(!this.dataForm.img)this.dataForm.img=[];
  134 + if (!this.dataForm.img) this.dataForm.img = [];
111 135 })
112 136 }
113 137 })
114 138 },
115 139 dataFormSubmit() {
116 140 this.$refs['elForm'].validate((valid) => {
117   - if (valid) {
118   - if (!this.dataForm.id) {
119   - request({
120   - url: `/api/Education/TbQuestion`,
121   - method: 'post',
122   - data: this.dataForm,
123   - }).then((res) => {
124   - this.$message({
125   - message: res.msg,
126   - type: 'success',
127   - duration: 1000,
128   - onClose: () => {
129   - this.visible = false,
130   - this.$emit('refresh', true)
131   - }
132   - })
133   - })
134   - } else {
135   - request({
136   - url: '/api/Education/TbQuestion/' + this.dataForm.id,
137   - method: 'PUT',
138   - data: this.dataForm
139   - }).then((res) => {
140   - this.$message({
141   - message: res.msg,
142   - type: 'success',
143   - duration: 1000,
144   - onClose: () => {
145   - this.visible = false
146   - this.$emit('refresh', true)
147   - }
148   - })
149   - })
150   - }
151   - }
152   - })
  141 + if (valid) {
  142 + if (!this.dataForm.id) {
  143 + request({
  144 + url: `/api/Education/TbQuestion`,
  145 + method: 'post',
  146 + data: this.dataForm,
  147 + }).then((res) => {
  148 + this.$message({
  149 + message: res.msg,
  150 + type: 'success',
  151 + duration: 1000,
  152 + onClose: () => {
  153 + this.visible = false,
  154 + this.$emit('refresh', true)
  155 + }
  156 + })
  157 + })
  158 + } else {
  159 + request({
  160 + url: '/api/Education/TbQuestion/' + this.dataForm.id,
  161 + method: 'PUT',
  162 + data: this.dataForm
  163 + }).then((res) => {
  164 + this.$message({
  165 + message: res.msg,
  166 + type: 'success',
  167 + duration: 1000,
  168 + onClose: () => {
  169 + this.visible = false
  170 + this.$emit('refresh', true)
  171 + }
  172 + })
  173 + })
  174 + }
  175 + }
  176 + })
153 177 },
154 178 }
155 179 }
... ...
antis-ncc-admin/src/views/tbQuestion/index.vue
1   -<template>
  1 +<template>
2 2 <div class="NCC-common-layout">
3 3 <div class="NCC-common-layout-center">
4 4 <el-row class="NCC-common-search-box" :gutter="16">
5 5 <el-form @submit.native.prevent>
6 6 <el-col :span="6">
7 7 <el-form-item label="标题">
8   - <el-input v-model="query.title" placeholder="标题" />
  8 + <el-input v-model="query.title" placeholder="标题" />
  9 + </el-form-item>
  10 + </el-col>
  11 + <el-col :span="6">
  12 + <el-form-item label="是否默认">
  13 + <el-select v-model="query.detault" placeholder="是否默认" clearable>
  14 + <el-option v-for="(item, index) in detaultOptions" :key="index" :label="item.fullName"
  15 + :value="item.id" />
  16 + </el-select>
9 17 </el-form-item>
10 18 </el-col>
11 19 <el-col :span="6">
... ... @@ -25,190 +33,244 @@
25 33 </div>
26 34 <div class="NCC-common-head-right">
27 35 <el-tooltip effect="dark" content="刷新" placement="top">
28   - <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false" @click="reset()" />
  36 + <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false"
  37 + @click="reset()" />
29 38 </el-tooltip>
30 39 <screenfull isContainer />
31 40 </div>
32 41 </div>
33   - <NCC-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange">
  42 + <NCC-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange">
34 43 <el-table-column prop="title" label="标题" align="left" />
35   - <el-table-column prop="creatorTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat"/>
36   - <el-table-column prop="lastModifyTime" label="修改时间" align="left" :formatter="ncc.tableDateFormat"/>
  44 + <el-table-column label="是否默认" prop="detault" align="left">
  45 + <template slot-scope="scope">{{ scope.row.detault | dynamicText(detaultOptions) }}</template>
  46 + </el-table-column>
  47 + <el-table-column prop="creatorTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat" />
  48 + <el-table-column prop="lastModifyTime" label="修改时间" align="left" :formatter="ncc.tableDateFormat" />
37 49 <el-table-column label="操作" fixed="right" width="100">
38   - <template slot-scope="scope">
39   - <el-button type="text" @click="addOrUpdateHandle(scope.row.id)" >编辑</el-button>
40   - <el-button type="text" @click="handleDel(scope.row.id)" class="NCC-table-delBtn" >删除</el-button>
  50 + <template slot-scope="scope">
  51 + <el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button>
  52 + <el-button type="text" @click="handleDel(scope.row.id)" class="NCC-table-delBtn">删除
  53 + </el-button>
  54 + <el-button type="text" @click="Cofirm(scope.row.id)">设为置顶</el-button>
41 55 </template>
42 56 </el-table-column>
43 57 </NCC-table>
44   - <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" />
45   - </div>
46   - </div>
  58 + <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
  59 + @pagination="initData" />
  60 + </div>
  61 + </div>
47 62 <NCC-Form v-if="formVisible" ref="NCCForm" @refresh="refresh" />
48 63 <ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" />
49 64 </div>
50 65 </template>
51 66 <script>
52   - import request from '@/utils/request'
53   - import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
54   - import NCCForm from './Form'
55   - import ExportBox from './ExportBox'
56   - import { previewDataInterface } from '@/api/systemData/dataInterface'
  67 + import request from '@/utils/request'
  68 + import {
  69 + getDictionaryDataSelector
  70 + } from '@/api/systemData/dictionary'
  71 + import NCCForm from './Form'
  72 + import ExportBox from './ExportBox'
  73 + import {
  74 + previewDataInterface
  75 + } from '@/api/systemData/dataInterface'
57 76 export default {
58   - components: { NCCForm, ExportBox },
59   - data() {
60   - return {
  77 + components: {
  78 + NCCForm,
  79 + ExportBox
  80 + },
  81 + data() {
  82 + return {
61 83 query: {
62   - title:undefined,
  84 + title: undefined,
  85 + detault: undefined,
  86 +
63 87 },
64   - list: [],
65   - listLoading: true,
66   - multipleSelection: [], total: 0,
67   - listQuery: {
68   - currentPage: 1,
69   - pageSize: 20,
  88 + list: [],
  89 + listLoading: true,
  90 + multipleSelection: [],
  91 + total: 0,
  92 + listQuery: {
  93 + currentPage: 1,
  94 + pageSize: 20,
70 95 sort: "desc",
71   - sidx: "",
72   - },
73   - formVisible: false,
74   - exportBoxVisible: false,
75   - columnList: [
76   - { prop: 'title', label: '标题' },
77   - { prop: 'creatorTime', label: '创建时间' },
78   - { prop: 'lastModifyTime', label: '修改时间' },
  96 + sidx: "",
  97 + },
  98 + formVisible: false,
  99 + exportBoxVisible: false,
  100 + detaultOptions: [{
  101 + "fullName": "默认",
  102 + "id": "1"
  103 + }, {
  104 + "fullName": "普通",
  105 + "id": "2"
  106 + }],
  107 +
  108 + columnList: [{
  109 + prop: 'title',
  110 + label: '标题'
  111 + },
  112 + {
  113 + prop: 'creatorTime',
  114 + label: '创建时间'
  115 + },
  116 + {
  117 + prop: 'lastModifyTime',
  118 + label: '修改时间'
  119 + },
  120 + {
  121 + prop: 'detault',
  122 + label: '是否默认'
  123 + },
  124 +
79 125 ],
80 126 }
81   - },
  127 + },
82 128 computed: {},
83 129 created() {
84 130 this.initData()
85 131 },
86 132 methods: {
  133 + Cofirm(id){
  134 + request({
  135 + url: `/api/Education/tbquestion/ConfirmDefault?id=`+id,
  136 + method: 'POST',
  137 + }).then(res => {
  138 + if(res.code==200){
  139 + this.$message.success('设置成功')
  140 + this.initData()
  141 + }else{
  142 + this.$message.error('设置失败')
  143 + }
  144 + })
  145 + },
87 146 initData() {
88   - this.listLoading = true;
89   - let _query = {
90   - ...this.listQuery,
91   - ...this.query
92   - };
93   - let query = {}
94   - for (let key in _query) {
95   - if (Array.isArray(_query[key])) {
96   - query[key] = _query[key].join()
97   - } else {
98   - query[key] = _query[key]
99   - }
100   - }
101   - request({
102   - url: `/api/Education/TbQuestion`,
103   - method: 'GET',
104   - data: query
105   - }).then(res => {
106   - this.list = res.data.list
107   - this.total = res.data.pagination.total
108   - this.listLoading = false
109   - })
110   - },
  147 + this.listLoading = true;
  148 + let _query = {
  149 + ...this.listQuery,
  150 + ...this.query
  151 + };
  152 + let query = {}
  153 + for (let key in _query) {
  154 + if (Array.isArray(_query[key])) {
  155 + query[key] = _query[key].join()
  156 + } else {
  157 + query[key] = _query[key]
  158 + }
  159 + }
  160 + request({
  161 + url: `/api/Education/TbQuestion`,
  162 + method: 'GET',
  163 + data: query
  164 + }).then(res => {
  165 + this.list = res.data.list
  166 + this.total = res.data.pagination.total
  167 + this.listLoading = false
  168 + })
  169 + },
111 170 handleDel(id) {
112   - this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
113   - type: 'warning'
114   - }).then(() => {
115   - request({
116   - url: `/api/Education/TbQuestion/${id}`,
117   - method: 'DELETE'
118   - }).then(res => {
119   - this.$message({
120   - type: 'success',
121   - message: res.msg,
122   - onClose: () => {
123   - this.initData()
124   - }
125   - });
126   - })
127   - }).catch(() => {
128   - });
129   - },
  171 + this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  172 + type: 'warning'
  173 + }).then(() => {
  174 + request({
  175 + url: `/api/Education/TbQuestion/${id}`,
  176 + method: 'DELETE'
  177 + }).then(res => {
  178 + this.$message({
  179 + type: 'success',
  180 + message: res.msg,
  181 + onClose: () => {
  182 + this.initData()
  183 + }
  184 + });
  185 + })
  186 + }).catch(() => {});
  187 + },
130 188 handleSelectionChange(val) {
131   - const res = val.map(item => item.id)
132   - this.multipleSelection = res
133   - },
134   - handleBatchRemoveDel() {
135   - if (!this.multipleSelection.length) {
136   - this.$message({
137   - type: 'error',
138   - message: '请选择一条数据',
139   - duration: 1500,
140   - })
141   - return
142   - }
143   - const ids = this.multipleSelection
144   - this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
145   - type: 'warning'
146   - }).then(() => {
147   - request({
148   - url: `/api/Education/TbQuestion/batchRemove`,
149   - method: 'POST',
150   - data: ids ,
151   - }).then(res => {
152   - this.$message({
153   - type: 'success',
154   - message: res.msg,
155   - onClose: () => {
156   - this.initData()
157   - }
158   - });
159   - })
160   - }).catch(() => { })
161   - },
  189 + const res = val.map(item => item.id)
  190 + this.multipleSelection = res
  191 + },
  192 + handleBatchRemoveDel() {
  193 + if (!this.multipleSelection.length) {
  194 + this.$message({
  195 + type: 'error',
  196 + message: '请选择一条数据',
  197 + duration: 1500,
  198 + })
  199 + return
  200 + }
  201 + const ids = this.multipleSelection
  202 + this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
  203 + type: 'warning'
  204 + }).then(() => {
  205 + request({
  206 + url: `/api/Education/TbQuestion/batchRemove`,
  207 + method: 'POST',
  208 + data: ids,
  209 + }).then(res => {
  210 + this.$message({
  211 + type: 'success',
  212 + message: res.msg,
  213 + onClose: () => {
  214 + this.initData()
  215 + }
  216 + });
  217 + })
  218 + }).catch(() => {})
  219 + },
162 220 addOrUpdateHandle(id, isDetail) {
163   - this.formVisible = true
164   - this.$nextTick(() => {
165   - this.$refs.NCCForm.init(id, isDetail)
166   - })
167   - },
  221 + this.formVisible = true
  222 + this.$nextTick(() => {
  223 + this.$refs.NCCForm.init(id, isDetail)
  224 + })
  225 + },
168 226 exportData() {
169   - this.exportBoxVisible = true
170   - this.$nextTick(() => {
171   - this.$refs.ExportBox.init(this.columnList)
172   - })
173   - },
174   - download(data) {
175   - let query = { ...data, ...this.listQuery, ...this.query }
176   - request({
177   - url: `/api/Education/TbQuestion/Actions/Export`,
178   - method: 'GET',
179   - data: query
180   - }).then(res => {
181   - if (!res.data.url) return
182   - window.location.href = this.define.comUrl + res.data.url
183   - this.$refs.ExportBox.visible = false
184   - this.exportBoxVisible = false
185   - })
186   - },
  227 + this.exportBoxVisible = true
  228 + this.$nextTick(() => {
  229 + this.$refs.ExportBox.init(this.columnList)
  230 + })
  231 + },
  232 + download(data) {
  233 + let query = {
  234 + ...data,
  235 + ...this.listQuery,
  236 + ...this.query
  237 + }
  238 + request({
  239 + url: `/api/Education/TbQuestion/Actions/Export`,
  240 + method: 'GET',
  241 + data: query
  242 + }).then(res => {
  243 + if (!res.data.url) return
  244 + window.location.href = this.define.comUrl + res.data.url
  245 + this.$refs.ExportBox.visible = false
  246 + this.exportBoxVisible = false
  247 + })
  248 + },
187 249 search() {
188   - this.listQuery = {
189   - currentPage: 1,
190   - pageSize: 20,
191   - sort: "desc",
192   - sidx: "",
193   - }
194   - this.initData()
195   - },
196   - refresh(isrRefresh) {
197   - this.formVisible = false
198   - if (isrRefresh) this.reset()
199   - },
200   - reset() {
201   - for (let key in this.query) {
202   - this.query[key] = undefined
203   - }
204   - this.listQuery = {
205   - currentPage: 1,
206   - pageSize: 20,
207   - sort: "desc",
208   - sidx: "",
209   - }
210   - this.initData()
211   - }
  250 + this.listQuery = {
  251 + currentPage: 1,
  252 + pageSize: 20,
  253 + sort: "desc",
  254 + sidx: "",
  255 + }
  256 + this.initData()
  257 + },
  258 + refresh(isrRefresh) {
  259 + this.formVisible = false
  260 + if (isrRefresh) this.reset()
  261 + },
  262 + reset() {
  263 + for (let key in this.query) {
  264 + this.query[key] = undefined
  265 + }
  266 + this.listQuery = {
  267 + currentPage: 1,
  268 + pageSize: 20,
  269 + sort: "desc",
  270 + sidx: "",
  271 + }
  272 + this.initData()
  273 + }
212 274 }
213   - }
214   -</script>
215 275 \ No newline at end of file
  276 + }
  277 +</script>
... ...
antis-ncc-net-core/ClassLibrary1/测评信息/Dto/TbEvaluationCrInput.cs
... ... @@ -33,6 +33,10 @@ namespace NCC.Education.Entitys.Dto.TbEvaluation
33 33 /// 修改时间
34 34 /// </summary>
35 35 public DateTime? lastModifyTime { get; set; }
36   -
  36 + /// <summary>
  37 + /// 是否默认 1--默认 2--普通
  38 + /// </summary>
  39 + public string detault { get; set; }
  40 +
37 41 }
38 42 }
... ...
antis-ncc-net-core/ClassLibrary1/测评信息/Dto/TbEvaluationInfoOutput.cs
... ... @@ -38,6 +38,10 @@ namespace NCC.Education.Entitys.Dto.TbEvaluation
38 38 /// 修改时间
39 39 /// </summary>
40 40 public DateTime? lastModifyTime { get; set; }
41   -
  41 + /// <summary>
  42 + /// 是否默认 1--默认 2--普通
  43 + /// </summary>
  44 + public string detault { get; set; }
  45 +
42 46 }
43 47 }
... ...
antis-ncc-net-core/ClassLibrary1/测评信息/Dto/TbEvaluationListOutput.cs
... ... @@ -54,6 +54,10 @@ namespace NCC.Education.Entitys.Dto.TbEvaluation
54 54 /// 修改时间
55 55 /// </summary>
56 56 public DateTime? lastModifyTime { get; set; }
57   -
  57 + /// <summary>
  58 + /// 是否默认 1--默认 2--普通
  59 + /// </summary>
  60 + public string detault { get; set; }
  61 +
58 62 }
59 63 }
... ...
antis-ncc-net-core/ClassLibrary1/测评信息/Dto/TbEvaluationListQueryInput.cs
... ... @@ -23,6 +23,10 @@ namespace NCC.Education.Entitys.Dto.TbEvaluation
23 23 /// 标题
24 24 /// </summary>
25 25 public string title { get; set; }
26   -
  26 + /// <summary>
  27 + /// 是否默认 1--默认 2--普通
  28 + /// </summary>
  29 + public string detault { get; set; }
  30 +
27 31 }
28 32 }
... ...
antis-ncc-net-core/ClassLibrary1/测评信息/Entity/TbEvaluationEntity.cs
... ... @@ -46,6 +46,10 @@ namespace NCC.Education.Entitys
46 46 /// </summary>
47 47 [SugarColumn(ColumnName = "F_LastModifyTime")]
48 48 public DateTime? LastModifyTime { get; set; }
49   -
  49 + /// <summary>
  50 + /// 是否默认 1--默认 2--非默认
  51 + /// </summary>
  52 + [SugarColumn(ColumnName = "F_Detault")]
  53 + public string Detault { get; set; }
50 54 }
51 55 }
52 56 \ No newline at end of file
... ...
antis-ncc-net-core/ClassLibrary1/题库信息/Dto/TbQuestionCrInput.cs
... ... @@ -33,6 +33,10 @@ namespace NCC.Education.Entitys.Dto.TbQuestion
33 33 /// 修改时间
34 34 /// </summary>
35 35 public DateTime? lastModifyTime { get; set; }
36   -
  36 + /// <summary>
  37 + /// 是否默认 1--默认 2--普通
  38 + /// </summary>
  39 + public string detault { get; set; }
  40 +
37 41 }
38 42 }
... ...
antis-ncc-net-core/ClassLibrary1/题库信息/Dto/TbQuestionInfoOutput.cs
... ... @@ -38,6 +38,10 @@ namespace NCC.Education.Entitys.Dto.TbQuestion
38 38 /// 修改时间
39 39 /// </summary>
40 40 public DateTime? lastModifyTime { get; set; }
41   -
  41 + /// <summary>
  42 + /// 是否默认 1--默认 2--普通
  43 + /// </summary>
  44 + public string detault { get; set; }
  45 +
42 46 }
43 47 }
... ...
antis-ncc-net-core/ClassLibrary1/题库信息/Dto/TbQuestionListOutput.cs
1   -using System;
  1 +using Aspose.Words.Lists;
  2 +using NCC.Common.Model;
  3 +using Newtonsoft.Json;
  4 +using SqlSugar;
  5 +using System;
  6 +using System.Collections.Generic;
2 7  
3 8 namespace NCC.Education.Entitys.Dto.TbQuestion
4 9 {
... ... @@ -16,7 +21,9 @@ namespace NCC.Education.Entitys.Dto.TbQuestion
16 21 /// 标题
17 22 /// </summary>
18 23 public string title { get; set; }
19   -
  24 +
  25 + public string editors { get; set; }
  26 +
20 27 /// <summary>
21 28 /// 创建时间
22 29 /// </summary>
... ... @@ -26,6 +33,26 @@ namespace NCC.Education.Entitys.Dto.TbQuestion
26 33 /// 修改时间
27 34 /// </summary>
28 35 public DateTime? lastModifyTime { get; set; }
29   -
  36 +
  37 + /// <summary>
  38 + /// 图片信息
  39 + /// </summary>
  40 + public string img { get; set; }
  41 + /// <summary>
  42 + /// 是否默认 1--默认 2--普通
  43 + /// </summary>
  44 + public string detault { get; set; }
  45 +
  46 + public List<FileControlsModel> Img { get
  47 + {
  48 + try
  49 + {
  50 + return JsonConvert.DeserializeObject<List<FileControlsModel>>(img);
  51 + }catch(Exception ex)
  52 + {
  53 + return new List<FileControlsModel>();
  54 + }
  55 + } }
  56 +
30 57 }
31 58 }
... ...
antis-ncc-net-core/ClassLibrary1/题库信息/Dto/TbQuestionListQueryInput.cs
... ... @@ -23,6 +23,10 @@ namespace NCC.Education.Entitys.Dto.TbQuestion
23 23 /// 标题
24 24 /// </summary>
25 25 public string title { get; set; }
26   -
  26 + /// <summary>
  27 + /// 是否默认 1--默认 2--普通
  28 + /// </summary>
  29 + public string detault { get; set; }
  30 +
27 31 }
28 32 }
... ...
antis-ncc-net-core/ClassLibrary1/题库信息/Entity/TbQuestionEntity.cs
... ... @@ -46,6 +46,11 @@ namespace NCC.Education.Entitys
46 46 /// </summary>
47 47 [SugarColumn(ColumnName = "F_LastModifyTime")]
48 48 public DateTime? LastModifyTime { get; set; }
49   -
  49 + /// <summary>
  50 + /// 是否默认 1--默认 2--非默认
  51 + /// </summary>
  52 + [SugarColumn(ColumnName = "F_Detault")]
  53 + public string Detault { get; set; }
  54 +
50 55 }
51 56 }
52 57 \ No newline at end of file
... ...
antis-ncc-net-core/NCC.Education/会员码管理/TbMemCodeService.cs
... ... @@ -25,6 +25,7 @@ using NCC.ClayObject;
25 25 using NCC.System.Interfaces.System;
26 26 using NCC.System.Entitys.Permission;
27 27 using Microsoft.Extensions.Logging;
  28 +using NPOI.HPSF;
28 29  
29 30 namespace NCC.Education.TbMemCode
30 31 {
... ... @@ -62,6 +63,91 @@ namespace NCC.Education.TbMemCode
62 63 }
63 64  
64 65 /// <summary>
  66 + /// 获取时间戳
  67 + /// </summary>
  68 + /// <returns></returns>
  69 + public static long getTime()
  70 + {
  71 + return (long)(DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1)).TotalMilliseconds;
  72 + }
  73 +
  74 + /// <summary>
  75 + /// 批量生成会员码入参
  76 + /// </summary>
  77 + public class mutineCreateCodeOptions
  78 + {
  79 + /// <summary>
  80 + /// 个数
  81 + /// </summary>
  82 + public int numbers { get; set; }
  83 + /// <summary>
  84 + /// 过期时间
  85 + /// </summary>
  86 + public DateTime? expire { get; set; }
  87 +
  88 + }
  89 + /// <summary>
  90 + /// 批量生成会员码
  91 + /// </summary>
  92 + /// <returns></returns>
  93 + [HttpPost("MutinueCreateCode")]
  94 + public async Task MutinueCreateCode(mutineCreateCodeOptions query)
  95 + {
  96 + List<TbMemCodeEntity> list = new List<TbMemCodeEntity>();
  97 + for(var i=0;i< query.numbers; i++)
  98 + {
  99 + list.Add(new TbMemCodeEntity
  100 + {
  101 + Id = YitIdHelper.NextId().ToString(),
  102 + Code =Guid.NewGuid().ToString().Replace("-","").ToLower().Substring(0,10),
  103 + Expire = query.expire,
  104 + Type = "2",
  105 + CreatorTime = DateTime.Now
  106 + });
  107 + }
  108 + var result = _db.Insertable(list).ExecuteCommand();
  109 + if (!(result > 0)) throw NCCException.Oh($"批量生成失败!");
  110 + }
  111 +
  112 + /// <summary>
  113 + /// 批量更改会员截至日期入参
  114 + /// </summary>
  115 + public class MutineUpdateExpireOptions
  116 + {
  117 + /// <summary>
  118 + /// IDS
  119 + /// </summary>
  120 + public string ids { get; set; }
  121 + /// <summary>
  122 + /// 会员截至日期
  123 + /// </summary>
  124 + public DateTime? expire { get; set; }
  125 + }
  126 +
  127 + /// <summary>
  128 + /// 批量更改会员截至日期
  129 + /// </summary>
  130 + /// <param name="query"></param>
  131 + /// <returns></returns>
  132 + [HttpPost("MutinueUpdateDaysNumber")]
  133 + public async Task MutinueUpdateDaysNumber(MutineUpdateExpireOptions query)
  134 + {
  135 + if (query.ids.IsNullOrEmpty()) throw NCCException.Oh($"参数错误");
  136 + List<string> list = new List<string>();
  137 + if (!query.ids.Contains(","))
  138 + {
  139 + list.Add(query.ids);
  140 + }
  141 + else
  142 + {
  143 + list = query.ids.Split(",").ToList();
  144 + }
  145 + var result = _db.Updateable<TbMemCodeEntity>().SetColumns(it => new TbMemCodeEntity { Expire = query.expire }).Where(o => list.Contains(o.Id)).ExecuteCommand();
  146 + if (!(result > 0)) throw NCCException.Oh($"批量更改失败!");
  147 + }
  148 +
  149 +
  150 + /// <summary>
65 151 /// 普通用户根据会员码转会员参数
66 152 /// </summary>
67 153 public class ShiftToMemOptions
... ...
antis-ncc-net-core/NCC.Education/打卡记录/TbPunchService.cs
... ... @@ -62,6 +62,29 @@ namespace NCC.Education.TbPunch
62 62 }
63 63  
64 64 /// <summary>
  65 + /// 查询用户会员到期时间
  66 + /// </summary>
  67 + /// <returns></returns>
  68 + [HttpPost("TaskSchedulerUserType")]
  69 + public async Task TaskSchedulerUserType()
  70 + {
  71 + var list = _db.Queryable<UserEntity>().Where(o => o.IsAdministrator == 0).ToList();
  72 + foreach (var item in list)
  73 + {
  74 + if (item.Type == "2" && item.MemDate.ToDate() < DateTime.Now)
  75 + {
  76 + item.Type = "1";
  77 + item.MemDate = null;
  78 + var result = _db.Updateable(item).ExecuteCommand();
  79 + _logger.LogInformation($"更改会员用户为普通用户:{result}----{item.ToJson()}");
  80 + }
  81 + }
  82 + }
  83 +
  84 +
  85 +
  86 +
  87 + /// <summary>
65 88 /// 每天凌晨过5分判断前一天的时间有那些人没打卡 进行赋值缺卡
66 89 /// </summary>
67 90 /// <returns></returns>
... ...
antis-ncc-net-core/NCC.Education/测评信息/TbEvaluationService.cs
... ... @@ -54,7 +54,29 @@ namespace NCC.Education.TbEvaluation
54 54 _dataBaseService = dataBaseService;
55 55 _userManager = userManager;
56 56 }
57   -
  57 + /// <summary>
  58 + /// 根据ID设定测评默认
  59 + /// </summary>
  60 + /// <param name="id"></param>
  61 + /// <returns></returns>
  62 + [HttpPost("ConfirmEvalDefault")]
  63 + public async Task ConfirmEvalDefault(string id)
  64 + {
  65 + var model = _db.Queryable<TbEvaluationEntity>().Where(o => o.Id == id).First();
  66 + if (model == null) throw NCCException.Oh($"暂无此数据");
  67 + try
  68 + {
  69 + _db.BeginTran();
  70 + var result =await _db.Updateable<TbEvaluationEntity>().SetColumns(it => new TbEvaluationEntity { Detault = "2" }).Where(o => o.Detault == "1").ExecuteCommandAsync();
  71 + model.Detault = "1";
  72 + var data = await _db.Updateable(model).ExecuteCommandAsync();
  73 + _db.CommitTran();
  74 + }
  75 + catch (Exception ex)
  76 + {
  77 + _db.RollbackTran();
  78 + }
  79 + }
58 80 /// <summary>
59 81 /// 获取测评信息
60 82 /// </summary>
... ... @@ -99,6 +121,8 @@ namespace NCC.Education.TbEvaluation
99 121 var sidx = input.sidx == null ? "id" : input.sidx;
100 122 var data = await _db.Queryable<TbEvaluationEntity>()
101 123 .WhereIF(!string.IsNullOrEmpty(input.title), p => p.Title.Contains(input.title))
  124 + .WhereIF(!string.IsNullOrEmpty(input.detault), p => p.Detault.Equals(input.detault))
  125 +
102 126 .Select(it=> new TbEvaluationListOutput
103 127 {
104 128 id = it.Id,
... ... @@ -107,6 +131,7 @@ namespace NCC.Education.TbEvaluation
107 131 lastModifyTime=it.LastModifyTime,
108 132 editors = it.Editors,
109 133 img =it.Img,
  134 + detault=it.Detault,
110 135 }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize);
111 136 return PageResult<TbEvaluationListOutput>.SqlSugarPageResult(data);
112 137 }
... ... @@ -132,7 +157,12 @@ namespace NCC.Education.TbEvaluation
132 157 var userInfo = await _userManager.GetUserInfo();
133 158 var entity = input.Adapt<TbEvaluationEntity>();
134 159 entity.Id = YitIdHelper.NextId().ToString();
135   - entity.CreatorTime = DateTime.Now;
  160 + entity.CreatorTime = DateTime.Now;
  161 + if (entity.Detault == "1")
  162 + {
  163 + var result = await _db.Updateable<TbEvaluationEntity>().SetColumns(it => new TbEvaluationEntity { Detault = "2" }).Where(o => o.Detault == "1").ExecuteCommandAsync();
  164 + if (!(result > 0)) throw NCCException.Oh($"更改默认值失败");
  165 + }
136 166 var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync();
137 167 if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000);
138 168 }
... ... @@ -158,12 +188,15 @@ namespace NCC.Education.TbEvaluation
158 188 var sidx = input.sidx == null ? "id" : input.sidx;
159 189 var data = await _db.Queryable<TbEvaluationEntity>()
160 190 .WhereIF(!string.IsNullOrEmpty(input.title), p => p.Title.Contains(input.title))
  191 + .WhereIF(!string.IsNullOrEmpty(input.detault), p => p.Detault.Equals(input.detault))
  192 +
161 193 .Select(it=> new TbEvaluationListOutput
162 194 {
163 195 id = it.Id,
164 196 title=it.Title,
165 197 creatorTime=it.CreatorTime,
166 198 lastModifyTime=it.LastModifyTime,
  199 + detault=it.Detault,
167 200 }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync();
168 201 return data;
169 202 }
... ... @@ -187,7 +220,7 @@ namespace NCC.Education.TbEvaluation
187 220 {
188 221 exportData = await this.GetNoPagingList(input);
189 222 }
190   - List<ParamsModel> paramList = "[{\"value\":\"标题\",\"field\":\"title\"},{\"value\":\"创建时间\",\"field\":\"creatorTime\"},{\"value\":\"修改时间\",\"field\":\"lastModifyTime\"},]".ToList<ParamsModel>();
  223 + List<ParamsModel> paramList = "[{\"value\":\"标题\",\"field\":\"title\"},{\"value\":\"创建时间\",\"field\":\"creatorTime\"},{\"value\":\"修改时间\",\"field\":\"lastModifyTime\"},{\"value\":\"是否默认\",\"field\":\"detault\"},]".ToList<ParamsModel>();
191 224 ExcelConfig excelconfig = new ExcelConfig();
192 225 excelconfig.FileName = "测评信息.xls";
193 226 excelconfig.HeadFont = "微软雅黑";
... ... @@ -273,7 +306,12 @@ namespace NCC.Education.TbEvaluation
273 306 });
274 307 _db.ChangeDatabase(dbLink.Id);
275 308 var entity = input.Adapt<TbEvaluationEntity>();
276   - entity.LastModifyTime = DateTime.Now;
  309 + entity.LastModifyTime = DateTime.Now;
  310 + if (entity.Detault == "1")
  311 + {
  312 + var result = await _db.Updateable<TbEvaluationEntity>().SetColumns(it => new TbEvaluationEntity { Detault = "2" }).Where(o => o.Detault == "1").ExecuteCommandAsync();
  313 + if (!(result > 0)) throw NCCException.Oh($"更改默认值失败");
  314 + }
277 315 var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
278 316 if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001);
279 317 }
... ...
antis-ncc-net-core/NCC.Education/题库信息/TbQuestionService.cs
... ... @@ -54,6 +54,32 @@ namespace NCC.Education.TbQuestion
54 54 _dataBaseService = dataBaseService;
55 55 _userManager = userManager;
56 56 }
  57 + /// <summary>
  58 + /// 根据ID设定题库默认
  59 + /// </summary>
  60 + /// <param name="id"></param>
  61 + /// <returns></returns>
  62 + [HttpPost("ConfirmDefault")]
  63 + public async Task ConfirmDefault(string id)
  64 + {
  65 + var model = _db.Queryable<TbQuestionEntity>().Where(o => o.Id == id).First();
  66 + if (model == null) throw NCCException.Oh($"暂无此数据");
  67 + try
  68 + {
  69 + _db.BeginTran();
  70 +
  71 + var result =await _db.Updateable<TbQuestionEntity>().SetColumns(it => new TbQuestionEntity { Detault = "2" }).Where(o => o.Detault == "1").ExecuteCommandAsync();
  72 + model.Detault = "1";
  73 + var data =await _db.Updateable(model).ExecuteCommandAsync();
  74 + _db.CommitTran();
  75 + }catch(Exception ex)
  76 + {
  77 + _db.RollbackTran();
  78 + }
  79 + }
  80 +
  81 +
  82 +
57 83  
58 84 /// <summary>
59 85 /// 获取题库信息
... ... @@ -99,12 +125,18 @@ namespace NCC.Education.TbQuestion
99 125 var sidx = input.sidx == null ? "id" : input.sidx;
100 126 var data = await _db.Queryable<TbQuestionEntity>()
101 127 .WhereIF(!string.IsNullOrEmpty(input.title), p => p.Title.Contains(input.title))
  128 + .WhereIF(!string.IsNullOrEmpty(input.detault), p => p.Detault.Equals(input.detault))
  129 +
102 130 .Select(it=> new TbQuestionListOutput
103 131 {
104 132 id = it.Id,
105 133 title=it.Title,
106 134 creatorTime=it.CreatorTime,
  135 + img=it.Img,
107 136 lastModifyTime=it.LastModifyTime,
  137 + detault = it.Detault,
  138 + editors= it.Editors,
  139 +
108 140 }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize);
109 141 return PageResult<TbQuestionListOutput>.SqlSugarPageResult(data);
110 142 }
... ... @@ -130,7 +162,12 @@ namespace NCC.Education.TbQuestion
130 162 var userInfo = await _userManager.GetUserInfo();
131 163 var entity = input.Adapt<TbQuestionEntity>();
132 164 entity.Id = YitIdHelper.NextId().ToString();
133   - entity.CreatorTime = DateTime.Now;
  165 + entity.CreatorTime = DateTime.Now;
  166 + if (entity.Detault == "1")
  167 + {
  168 + var result =await _db.Updateable<TbQuestionEntity>().SetColumns(it => new TbQuestionEntity { Detault = "2" }).Where(o => o.Detault == "1").ExecuteCommandAsync();
  169 + if (!(result > 0)) throw NCCException.Oh($"更改默认值失败");
  170 + }
134 171 var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync();
135 172 if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000);
136 173 }
... ... @@ -156,12 +193,16 @@ namespace NCC.Education.TbQuestion
156 193 var sidx = input.sidx == null ? "id" : input.sidx;
157 194 var data = await _db.Queryable<TbQuestionEntity>()
158 195 .WhereIF(!string.IsNullOrEmpty(input.title), p => p.Title.Contains(input.title))
  196 + .WhereIF(!string.IsNullOrEmpty(input.detault), p => p.Detault.Equals(input.detault))
  197 +
159 198 .Select(it=> new TbQuestionListOutput
160 199 {
161 200 id = it.Id,
162 201 title=it.Title,
163 202 creatorTime=it.CreatorTime,
164 203 lastModifyTime=it.LastModifyTime,
  204 + detault = it.Detault,
  205 +
165 206 }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync();
166 207 return data;
167 208 }
... ... @@ -185,7 +226,7 @@ namespace NCC.Education.TbQuestion
185 226 {
186 227 exportData = await this.GetNoPagingList(input);
187 228 }
188   - List<ParamsModel> paramList = "[{\"value\":\"标题\",\"field\":\"title\"},{\"value\":\"创建时间\",\"field\":\"creatorTime\"},{\"value\":\"修改时间\",\"field\":\"lastModifyTime\"},]".ToList<ParamsModel>();
  229 + List<ParamsModel> paramList = "[{\"value\":\"标题\",\"field\":\"title\"},{\"value\":\"创建时间\",\"field\":\"creatorTime\"},{\"value\":\"修改时间\",\"field\":\"lastModifyTime\"},{\"value\":\"是否默认\",\"field\":\"detault\"},]".ToList<ParamsModel>();
189 230 ExcelConfig excelconfig = new ExcelConfig();
190 231 excelconfig.FileName = "题库信息.xls";
191 232 excelconfig.HeadFont = "微软雅黑";
... ... @@ -271,7 +312,12 @@ namespace NCC.Education.TbQuestion
271 312 });
272 313 _db.ChangeDatabase(dbLink.Id);
273 314 var entity = input.Adapt<TbQuestionEntity>();
274   - entity.LastModifyTime = DateTime.Now;
  315 + entity.LastModifyTime = DateTime.Now;
  316 + if (entity.Detault == "1")
  317 + {
  318 + var result =await _db.Updateable<TbQuestionEntity>().SetColumns(it => new TbQuestionEntity { Detault = "2" }).Where(o => o.Detault == "1").ExecuteCommandAsync();
  319 + if (!(result > 0)) throw NCCException.Oh($"更改默认值失败");
  320 + }
275 321 var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
276 322 if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001);
277 323 }
... ...