浏览代码

Merge branch 'develop3.0-tmd' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0-tmd

liqk 4 年之前
父节点
当前提交
27075d7aa5

+ 0 - 1
TEAMModelOS/ClientApp/src/components/vote/BaseVoteBar.vue

@@ -116,7 +116,6 @@
         },
         watch: {
             pieData: {
-                deep: true,
                 handler(val) {
                     console.log(val)
                     let arr = []

+ 7 - 6
TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.vue

@@ -1,12 +1,13 @@
 <template>
 	<div class="component-vote-form">
-		<Form ref="voteForm" :model="voteForm" label-position="top" :rules="ruleValidate" :disabled="!voteFormEdit" hide-required-mark>
+		<Form ref="voteForm" :model="voteForm" label-position="top" :rules="ruleValidate" :disabled="!voteFormEdit"
+		 hide-required-mark>
 			<FormItem :label="$t('vote.form.name')" prop="name">
 				<Input :class="!voteFormEdit ? 'vote-form-disabled':''" v-model="voteForm.name" placeholder="请输入投票名称"></Input>
 			</FormItem>
 			<FormItem :label="$t('vote.form.target')" prop="classes">
 				<RadioGroup v-model="classType" @on-change="onClassTypeChange" v-if="voteFormEdit">
-					<Radio label="private">{{ $t('vote.form.privateClass') }}</Radio>
+					<Radio label="private" v-if="getCurScope === 'private'">{{ $t('vote.form.privateClass') }}</Radio>
 					<Radio label="school">{{ $t('vote.form.schoolClass') }}</Radio>
 				</RadioGroup>
 				<div v-if="!voteFormEdit && curVoteItem" class="vote-class">
@@ -210,7 +211,7 @@
 				if (arr[0] === '') {
 					this.voteForm.rangeTime = null
 					this.ruleValidate.rangeTime[0].message = '日期不能为空!'
-				}else if(this.getTimestampByString(arr[0]) < Date.now()){
+				} else if (this.getTimestampByString(arr[0]) < Date.now()) {
 					this.voteForm.rangeTime = null
 					this.ruleValidate.rangeTime[0].message = '开始时间不能早于当前时间!'
 				} else {
@@ -241,9 +242,9 @@
 						let target = []
 						let fileName = this.$tools.guid()
 						let isReset = this.voteForm.isReset.length > 0
-						params.code = this.getCurCode,
-							params.scope = this.getCurScope,
-							params.name = this.voteForm.name
+						params.code = this.getCurCode
+						params.scope = this.$route.name === 'personalVote' && this.classType === 'school' ? 'teacher' : this.getCurScope
+						params.name = this.voteForm.name
 						params.startTime = this.voteForm.startTime
 						params.endTime = this.voteForm.endTime
 						params.description = this.voteForm.description

+ 135 - 151
TEAMModelOS/ClientApp/src/components/vote/BaseVotePie.vue

@@ -1,170 +1,154 @@
 <template>
-    <div :id="pieId" class="myPie"></div>
+	<div :id="pieId" class="myPie"></div>
 </template>
 
 <script>
-    export default {
-        name: 'BasePie',
-        props: ['pieId', 'pieData'],
-        data() {
-            return {
-                pieDatas: [],
-                noChooseNum: 0,
-                chooseNum: 0
-            }
-        },
-        methods: {
+	export default {
+		name: 'BasePie',
+		props: ['pieId', 'pieData'],
+		data() {
+			return {
+				pieDatas: [],
+				noChooseNum: 0,
+				chooseNum: 0
+			}
+		},
+		methods: {
 
-            drawLine(data) {
-                let that = this
-                // 基于准备好的dom,初始化echarts实例
-                let myPie = this.$echarts.init(document.getElementById(this.pieId), 'chalk')
+			drawLine(data) {
+				let that = this
+				// 基于准备好的dom,初始化echarts实例
+				let myPie = this.$echarts.init(document.getElementById(this.pieId), 'chalk')
 
-                // 指定图表的配置项和数据
-                var option = {
-                    legend: {
-                        y: 'bottom',
-                        textStyle: { color: '#c3cad9' },
-                    },
-                    title: {
-                        text: '选项分布饼图',
-                        left: 'center',
-                        top: 20,
-                        textStyle: {
-                            color: 'White',
-                            fontFamily: '微軟正黑體'
-                        }
-                    },
+				// 指定图表的配置项和数据
+				var option = {
+					legend: {
+						y: 'bottom',
+						textStyle: {
+							color: '#c3cad9'
+						},
+					},
+					title: {
+						text: '选项分布饼图',
+						left: 'center',
+						top: 20,
+						textStyle: {
+							color: 'White',
+							fontFamily: '微軟正黑體'
+						}
+					},
 
-                    tooltip: {
-                        trigger: 'item',
-                        formatter: "{b} : {c} ({d}%)"
-                    },
+					tooltip: {
+						trigger: 'item',
+						formatter: "{b} : {c} ({d}%)"
+					},
 
-                    visualMap: {
-                        show: false,
-                        min: 500,
-                        max: 600,
-                        inRange: {
-                            //colorLightness: [0, 1]
-                        }
-                    },
-                    series: [{
-                        name: '访问来源',
-                        type: 'pie',
-                        radius: '50%',
-                        selectedMode: 'single',
-                        selectedOffset: 10,
-                        clockwise: true,
-                        center: ['50%', '50%'],
-                        color: ['#43cadd', '#3893e5', '#FCC708', '#03B48E'], //'#FBFE27','rgb(11,228,96)','#FE5050'
-                        data: [{
-                            name: '未投票',
-                            value: this.noChooseNum
-                        }, {
-                            name: '已投票',
-                            value: this.chooseNum
-                        }],
-                        roseType: 'radius',
+					visualMap: {
+						show: false,
+						min: 500,
+						max: 600,
+						inRange: {
+							//colorLightness: [0, 1]
+						}
+					},
+					series: [{
+						type: 'pie',
+						radius: '50%',
+						selectedMode: 'single',
+						selectedOffset: 10,
+						clockwise: true,
+						center: ['50%', '50%'],
+						color: ['#567c94', '#11d8ff', '#FCC708', '#03B48E'], //'#FBFE27','rgb(11,228,96)','#FE5050'
+						data: [{
+							name: '未投票',
+							value: this.noChooseNum
+						}, {
+							name: '已投票',
+							value: this.chooseNum
+						}],
 
-                        label: {
-                            normal: {
-                                // formatter: ['{c|{b}{d}%}', '{b|{b}}'].join('\n'),
-                                // formatter: ['{b|{b}{d}%}', '{c|{c}万元}'].join('\n'),
-                                rich: {
-                                    b: {
-                                        color: '#d9efff',
-                                        fontSize: 15,
-                                        height: 40
-                                    },
-                                    c: {
-                                        color: '#fff',
-                                        fontSize: 14,
-                                        fontWeight: 'bold',
-                                        lineHeight: 5
-                                    },
-                                },
-                            }
-                        },
-                        itemStyle: {
-                            borderWidth: '5',
-                        },
-                        labelLine: {
-                            normal: {
-                                backgroundColor: 'yellow',
-                                borderColor: 'skyblue',
-                                borderWidth: 10,
-                                lineStyle: {
-                                    borderColor: 'skyblue',
-                                    borderWidth: 10,
-                                    backgroundColor: 'yellow',
-                                }
-                            },
+						label: {
+							normal: {
+								rich: {
+									b: {
+										color: '#d9efff',
+										fontSize: 15,
+										height: 40
+									},
+									c: {
+										color: '#fff',
+										fontSize: 14,
+										fontWeight: 'bold',
+										lineHeight: 5
+									},
+								},
+							}
+						},
+						itemStyle: {
+							borderWidth: '5',
+						},
+						labelLine: {
+							normal: {
+								backgroundColor: 'yellow',
+								borderColor: 'skyblue',
+								borderWidth: 10,
+								lineStyle: {
+									borderColor: 'skyblue',
+									borderWidth: 10,
+									backgroundColor: 'yellow',
+								}
+							},
+						}
+					}]
+				};
 
-
-
-                        }
-                    }]
-                };
-
-                // 绘制图表
-                myPie.setOption(option)
-				this.$nextTick(()=>{
+				// 绘制图表
+				myPie.setOption(option)
+				this.$nextTick(() => {
 					myPie.resize()
 				})
-                window.addEventListener('resize', function () {
-                    myPie.resize()
-                })
-            }
-        },
-        mounted() {
-
-            if (this.pieData.length) {
-                let val = this.pieData
-                this.noChooseNum = val.filter(item => item.key === '').length ? val.filter(item => item.key === '')[0].result.length : 0
-                let sum = 0
-                val.forEach(item => {
-                    sum += item.result.length
-                })
-                this.chooseNum = sum - this.noChooseNum
-                this.drawLine(val)
-            }
-        },
-        computed: {
-            // 获取最新知识点占比饼图数据
-            getPieData() {
-                return this.$store.state.totalAnalysis.knowledgeData
-            }
-        },
-        watch: {
-            pieData: {
-                deep: true,
-                handler(val) {
-                    if (val.length) {
-						console.log("11111111111111111")
-                        this.noChooseNum = val.filter(item => item.key === '').length ? val.filter(item => item.key === '')[0].result.length : 0
-                        let sum = 0
-                        val.forEach(item => {
-                            sum += item.result.length
-                        })
-                        this.chooseNum = sum - this.noChooseNum
-                        this.drawLine(val)
+				window.addEventListener('resize', function() {
+					myPie.resize()
+				})
+			}
+		},
+		mounted() {
 
-                    }
-                }
-            }
-        }
+			if (this.pieData.length) {
+				let val = this.pieData
+				this.noChooseNum = val.filter(item => item.option === null).length
+				this.chooseNum = val.length - this.noChooseNum
+				this.drawLine(val)
+			}
+		},
+		computed: {
+			// 获取最新知识点占比饼图数据
+			getPieData() {
+				return this.$store.state.totalAnalysis.knowledgeData
+			}
+		},
+		watch: {
+			pieData: {
+				deep: true,
+				handler(val) {
+					if (val.length) {
+						this.noChooseNum = val.filter(item => item.option === null).length
+						this.chooseNum = val.length - this.noChooseNum
+						this.drawLine(val)
+					}
+				}
+			}
+		}
 
-    }
+	}
 </script>
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style scoped>
-
-    .myPie {
-        width: 50%;
-        height: 380px;
-        margin: 0 auto;
-        display: block;
-    }
+	.myPie {
+		width: 50%;
+		height: 380px;
+		margin: 0 auto;
+		display: block;
+	}
 </style>

+ 1 - 1
TEAMModelOS/ClientApp/src/components/vote/BaseVoteSsTable.vue

@@ -36,7 +36,7 @@
                     {
                         title: '班级',
                         render: (h, params) => {
-                            return h('span', params.row.className)
+                            return h('span', params.row.classroomName)
                         },
                     },
                     {

+ 1 - 1
TEAMModelOS/ClientApp/src/components/vote/BaseVoteTable.vue

@@ -68,7 +68,7 @@
                         }
                     },
                     {
-                        title: '数',
+                        title: '数',
                         render: (h, params) => {
                             return h('span', params.row.result.length)
                         },

+ 18 - 5
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseImport.vue

@@ -15,11 +15,11 @@
                     </div>
                 </Upload>
 				<div class="import-tips">
-					<div style="display: flex;margin-bottom: 20px;">
+					<div style="display: flex;margin-bottom: 20px;justify-content: space-around;">
 						<Dropdown @on-click="onTemplateSelect">
 						        <Button type="primary">
 									<Icon type="md-cloud-download"  style="margin-right: 5px;"/>
-						            {{$t('evaluation.importFile.templateDownload')}}
+						            Word {{$t('evaluation.importFile.templateDownload')}}
 						            <Icon type="ios-arrow-down"></Icon>
 						        </Button>
 						        <DropdownMenu slot="list">
@@ -27,8 +27,18 @@
 						            <DropdownItem :name="1">中文繁体(zh-TW)</DropdownItem>
 						            <DropdownItem :name="2">英文(en-US)</DropdownItem>
 						        </DropdownMenu>
-						    </Dropdown>
-						<Button type="primary" icon="md-cloud-download" style="margin-left: 20px;" @click="onDownloadDetails">{{$t('evaluation.importFile.downloadDetails')}}</Button>	
+						</Dropdown>
+						<Dropdown @on-click="onTemplateSelect" style="margin-left: 15px;">
+						        <Button type="primary">
+									<Icon type="md-cloud-download"  style="margin-right: 5px;"/>
+						            Excel {{$t('evaluation.importFile.templateDownload')}}
+						            <Icon type="ios-arrow-down"></Icon>
+						        </Button>
+						        <DropdownMenu slot="list">
+						            <DropdownItem :name="3">中文简体(zh-CN)</DropdownItem>
+						        </DropdownMenu>
+						</Dropdown>
+						<Button type="primary" icon="md-cloud-download" style="margin-left: 15px;" @click="onDownloadDetails">{{$t('evaluation.importFile.downloadDetails')}}</Button>	
 					</div>
 					
 					<p style="font-size:18px;font-weight:bold;color: #fff;">{{$t('evaluation.importFile.importTips')}}</p>
@@ -77,7 +87,10 @@
 					fileName:'題目範本(繁体).docx'
 				},{
 					url:'/download/%E9%A2%98%E7%9B%AE%E6%A8%A1%E6%9D%BF%E8%8B%B1%E8%AF%AD.docx',
-					fileName:'TitleTemplate.docx'
+					fileName:'題目範本(英语).docx'
+				},{
+					url:'/download/%E9%A2%98%E7%9B%AE%E6%A8%A1%E6%9D%BF.xls',
+					fileName:'題目範本.xls'
 				}],
 				hostName:'',
 				fieldArr:['記憶记忆1','理解2','應用应用3','分析4','评价評鑒5','创造創造6']

+ 11 - 9
TEAMModelOS/ClientApp/src/view/vote/ManageVote.vue

@@ -76,8 +76,8 @@
 										<BaseVoteTable :tableDatas="tableData" v-show="isOptionView"></BaseVoteTable>
 										<BaseVoteSsTable :tableDatas="studentsTable" v-show="!isOptionView"></BaseVoteSsTable>
 										<div style="display:flex">
-											<BaseVotePie pieId="votePie" :pieData="tableData" v-show="tableData.length"></BaseVotePie>
-											<BaseVoteBar pieId="votePie2" v-show="tableData.length" :pieData="tableData"></BaseVoteBar>
+											<BaseVotePie pieId="votePie" :pieData="studentsTable" v-show="studentsTable.length"></BaseVotePie>
+											<BaseVoteBar pieId="votePie2" v-if="tableData.length" :pieData="tableData"></BaseVoteBar>
 										</div>
 									</vuescroll>
 								</div>
@@ -221,6 +221,7 @@
 					"easeInQuad"
 				);
 				this.hasNewAdd = false
+				this.isOptionView = true
 			},
 			
 			/* 获取投票活动的详细数据 */
@@ -342,12 +343,13 @@
 								})
 							})
 						})
-						console.log(records)
+						console.log('所有学生名单',list)
+						console.log('已投票学生名单',records.records)
 						
 						// 要根据作答情况 结合两张表 处理表格显示的数据 
 						if (records.options.length) {
 							let arr = []
-							this.studentsTable = records.records
+							this.studentsTable = list
 							records.options.forEach((item, index) => {
 								arr.push({
 									// option: this.getSimpleText(item.optionValue),
@@ -356,14 +358,14 @@
 									result: new Array(item.count).fill('1')
 								})
 							})
-							console.log(this.studentsTable)
 							this.studentsTable.forEach(i => {
-								let matchList = list.filter(j => j.id === i.userid)
-								i.name = matchList.length ? matchList[0].name : this.$t('vote.noData')
-								i.classroomName = matchList.length ? matchList[0].classroomName : this.$t('vote.noData')
-								i.option = i.opt.join(',')
+								let matchList = records.records.filter(j => j.userid === i.id)
+								i.option = matchList.length ? matchList[0].opt.join(',') : null
+								// i.classroomName = matchList.length ? matchList[0].classroomName : this.$t('vote.noData')
+								// i.option = i.opt.join(',')
 							})
 							console.log(arr)
+							console.log(this.studentsTable)
 							this.tableData = arr
 						} else {
 							this.tableData = []

+ 15 - 15
TEAMModelOS/Services/Common/ActivityStudentService.cs

@@ -223,7 +223,7 @@ namespace TEAMModelOS.Services.Common
             }
             //开始时间,默认最近三十天
             var stimestamp = DateTimeOffset.UtcNow.AddDays(-30).ToUnixTimeMilliseconds();
-            if (!requert.TryGetProperty("stime", out JsonElement stime))
+            if (requert.TryGetProperty("stime", out JsonElement stime))
             {
                 if (!stime.ValueKind.Equals(JsonValueKind.Undefined) && !stime.ValueKind.Equals(JsonValueKind.Null) &&stime.TryGetInt64(out long data))
                 {
@@ -235,28 +235,28 @@ namespace TEAMModelOS.Services.Common
             var etimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             string etimesql = $" and c.startTime <= {etimestamp}   ";
             var progresssql = "";
-            if (!requert.TryGetProperty("progress", out JsonElement progress))
+            if (requert.TryGetProperty("progress", out JsonElement progress))
             {
 
                 if (!progress.ValueKind.Equals(JsonValueKind.Undefined) && !progress.ValueKind.Equals(JsonValueKind.Null) && progress.ValueKind.Equals(JsonValueKind.String))
                 {
-                    progresssql = $" and c.progress='{progresssql}' ";
+                    progresssql = $" and c.progress='{progress}' ";
                 }
             }
             var typesql = "";
-            if (!requert.TryGetProperty("type", out JsonElement type))
+            if (requert.TryGetProperty("type", out JsonElement type))
             {
 
                 if (!type.ValueKind.Equals(JsonValueKind.Undefined) && !type.ValueKind.Equals(JsonValueKind.Null) && type.ValueKind.Equals(JsonValueKind.String))
                 {
-                    typesql = $" and c.type='{typesql}' ";
+                    typesql = $" and c.type='{type}' ";
                 }
             }
             string continuationTokenSchool = null;
             string continuationTokenTeacher = null;
             //默认不指定返回大小
             int? topcout = null;
-            if (!requert.TryGetProperty("count", out JsonElement jcount))
+            if (requert.TryGetProperty("count", out JsonElement jcount))
             {
                 if (!jcount.ValueKind.Equals(JsonValueKind.Undefined) && !jcount.ValueKind.Equals(JsonValueKind.Null) && jcount.TryGetInt32(out int data))
                 {
@@ -266,7 +266,7 @@ namespace TEAMModelOS.Services.Common
             //是否需要进行分页查询,默认不分页
             bool iscontinuation = false;
             //如果指定了返回大小
-            if (!requert.TryGetProperty("continuationTokenSchool", out JsonElement continuationSchool))
+            if (requert.TryGetProperty("continuationTokenSchool", out JsonElement continuationSchool))
             {
                 //指定了cancellationToken continuationSchool
                 if (!continuationSchool.ValueKind.Equals(JsonValueKind.Null) && continuationSchool.ValueKind.Equals(JsonValueKind.String))
@@ -276,7 +276,7 @@ namespace TEAMModelOS.Services.Common
                 }
             }
             //如果指定了返回大小
-            if (!requert.TryGetProperty("continuationTokenTeacher", out JsonElement continuationTeacher))
+            if (requert.TryGetProperty("continuationTokenTeacher", out JsonElement continuationTeacher))
             {
                 //指定了cancellationToken 表示需要进行分页
                 if (!continuationTeacher.ValueKind.Equals(JsonValueKind.Null) && continuationTeacher.ValueKind.Equals(JsonValueKind.String))
@@ -375,9 +375,9 @@ namespace TEAMModelOS.Services.Common
                 }
             }
             bool tips = false;
-            if (!requert.TryGetProperty("tips", out JsonElement jtips))
+            if (requert.TryGetProperty("tips", out JsonElement jtips))
             {
-                if (!jtips.ValueKind.Equals(JsonValueKind.Undefined) && !jtips.ValueKind.Equals(JsonValueKind.Null) && !jtips.ValueKind.Equals(JsonValueKind.True))
+                if (!jtips.ValueKind.Equals(JsonValueKind.Undefined) && !jtips.ValueKind.Equals(JsonValueKind.Null) && (jtips.ValueKind.Equals(JsonValueKind.True)|| jtips.ValueKind.Equals(JsonValueKind.False)))
                 {
                     tips = jtips.GetBoolean();
                 }
@@ -396,32 +396,32 @@ namespace TEAMModelOS.Services.Common
                             activityTips = DoVoteTips;
                             //msgid, //0不能投票,1可以投票,2不在时间范围内,3周期内的可投票数不足
                             //voteCount 可用投票数
-                            res = activityTips(data, _azureCosmos, id, _azureRedis);
+                            res =await activityTips(data, _azureCosmos, id, _azureRedis);
                             break;
                         //问卷
                         case "survey":
                             //msgid 0 已作答, 1未作答,2,未完成
                             activityTips = DoSurveyTips;
-                            res = activityTips(data, _azureCosmos, id, _azureRedis);
+                            res = await activityTips(data, _azureCosmos, id, _azureRedis);
                             break;
                         //评测
                         case "exam":
                             //msgid 0 已作答, 1未作答,2,未完成, 用时间控制 相关发布状态,并且展示相应的结果
                             activityTips = DoExamTips;
-                            res = activityTips(data, _azureCosmos, id, _azureRedis);
+                            res = await activityTips(data, _azureCosmos, id, _azureRedis);
                             break;
                         //学习活动
                         case "learn":
                             //msgid 0 已完成, 1未开始,2,未完成
                             activityTips = DoLearnTips;
-                            res = activityTips(data, _azureCosmos, id, _azureRedis);
+                            res = await activityTips(data, _azureCosmos, id, _azureRedis);
                             break;
                         //作业活动
                         case "homework":
                             //msgid 0 已作答, 1未作答,2,未完成,3已批改,且有错误,4已批改,已完成
                             //index:0,1,5 错误题序
                             activityTips = DoHomeworkTips;
-                            res = activityTips(data, _azureCosmos, id, _azureRedis);
+                            res = await activityTips(data, _azureCosmos, id, _azureRedis);
                             break;
                         default: break;
                     }