|
@@ -1,294 +1,331 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <el-dialog
|
|
|
- :center="true"
|
|
|
- :visible.sync="dialogVisible"
|
|
|
- :close-on-click-modal="false"
|
|
|
- width="500px"
|
|
|
- class="bindingFormDialog"
|
|
|
- >
|
|
|
- <div class="a-d-top">
|
|
|
- <div class="a-d-topTit">
|
|
|
- <div>另存为模板</div>
|
|
|
- </div>
|
|
|
- <div class="a-d-t-right">
|
|
|
- <span @click.stop="close()">×</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="bfd_box" v-loading="loading" label-position="top">
|
|
|
- <el-form :model="form" :rules="rules" ref="ruleForm">
|
|
|
- <div style="display: flex;width: 100%;justify-content: space-between;">
|
|
|
- <el-form-item label="模板名称" prop="name">
|
|
|
- <el-input v-model="form.name" placeholder="请输入模板名称" style="width: 300px;"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="所属学科" prop="subject">
|
|
|
- <el-select v-model="form.subject" placeholder="请选择所属学科" style="width: 300px;">
|
|
|
- <el-option
|
|
|
- v-for="item in subjectList"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- <!-- <el-input v-model="form.subject" placeholder="请输入所属学科" style="width: 300px;"></el-input> -->
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- <el-form-item label="模板简介(40字以内)" prop="brief">
|
|
|
- <el-input type="textarea" v-model="form.brief" style="width: 100%;" :rows="3" :maxlength="40" resize="none" placeholder="请输入模板简介"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="权限管理" style="display: flex;flex-direction: column;align-items: flex-start;">
|
|
|
- <div>公开到社区:<el-switch v-model="form.permissions"></el-switch></div>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- <div class="bfd_bottom" v-loading="loading">
|
|
|
- <el-button @click="close()">取消</el-button>
|
|
|
- <el-button type="primary" @click="submitBtn('ruleForm')">保存</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
+ <div>
|
|
|
+ <el-dialog
|
|
|
+ :center="true"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ width="500px"
|
|
|
+ class="bindingFormDialog"
|
|
|
+ >
|
|
|
+ <div class="a-d-top">
|
|
|
+ <div class="a-d-topTit">
|
|
|
+ <div>另存为模板</div>
|
|
|
+ </div>
|
|
|
+ <div class="a-d-t-right">
|
|
|
+ <span @click.stop="close()">×</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="bfd_box" v-loading="loading" label-position="top">
|
|
|
+ <el-form :model="form" :rules="rules" ref="ruleForm">
|
|
|
+ <div
|
|
|
+ style="display: flex;width: 100%;justify-content: space-between;"
|
|
|
+ >
|
|
|
+ <el-form-item label="模板名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="form.name"
|
|
|
+ placeholder="请输入模板名称"
|
|
|
+ style="width: 300px;"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属学科" prop="subject">
|
|
|
+ <el-select
|
|
|
+ v-model="form.subject"
|
|
|
+ placeholder="请选择所属学科"
|
|
|
+ style="width: 300px;"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in subjectList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <!-- <el-input v-model="form.subject" placeholder="请输入所属学科" style="width: 300px;"></el-input> -->
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <el-form-item label="模板简介(40字以内)" prop="brief">
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ v-model="form.brief"
|
|
|
+ style="width: 100%;"
|
|
|
+ :rows="3"
|
|
|
+ :maxlength="40"
|
|
|
+ resize="none"
|
|
|
+ placeholder="请输入模板简介"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="权限管理"
|
|
|
+ style="display: flex;flex-direction: column;align-items: flex-start;"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ 公开到社区:<el-switch v-model="form.permissions"></el-switch>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="bfd_bottom" v-loading="loading">
|
|
|
+ <el-button @click="close()">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitBtn('ruleForm')"
|
|
|
+ >保存</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
var OpenCC = require("opencc-js");
|
|
|
let converter = OpenCC.Converter({
|
|
|
- from:'hk',
|
|
|
- to:'cn'
|
|
|
-})
|
|
|
+ from: "hk",
|
|
|
+ to: "cn"
|
|
|
+});
|
|
|
export default {
|
|
|
- emits: ["success"],
|
|
|
- props: {
|
|
|
- dataList:{
|
|
|
- type:Array,
|
|
|
- default:()=>{return []}
|
|
|
- },
|
|
|
- bmData:{
|
|
|
- type:Object,
|
|
|
- default:()=>{return {}}
|
|
|
- },
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- loading: false,
|
|
|
- dialogVisible: false,
|
|
|
- userId: this.$route.query["userid"],
|
|
|
- oid: this.$route.query["oid"],
|
|
|
- org: this.$route.query["org"],
|
|
|
- subjectList:[
|
|
|
- {value:'1',label:'语文'},
|
|
|
- {value:'2',label:'数学'},
|
|
|
- {value:'3',label:'英语'},
|
|
|
- {value:'4',label:'科学'},
|
|
|
- {value:'5',label:'物理'},
|
|
|
- {value:'6',label:'化学'},
|
|
|
- {value:'7',label:'生物'},
|
|
|
- {value:'8',label:'历史'},
|
|
|
- {value:'9',label:'地理'},
|
|
|
- {value:'10',label:'政治'},
|
|
|
-
|
|
|
- ],
|
|
|
- form:{
|
|
|
- name:"",
|
|
|
- subject:"",
|
|
|
- brief:"",
|
|
|
- permissions:false,
|
|
|
- },
|
|
|
- rules:{
|
|
|
- name:[{required:true,message:"请输入课程名称",trigger:"blur"}],
|
|
|
- subject:[{required:true,message:"请输入所属学科",trigger:"blur"}]
|
|
|
- },
|
|
|
+ emits: ["success"],
|
|
|
+ props: {
|
|
|
+ dataList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ bmData: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {};
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ dialogVisible: false,
|
|
|
+ userId: this.$route.query["userid"],
|
|
|
+ oid: this.$route.query["oid"],
|
|
|
+ org: this.$route.query["org"],
|
|
|
+ subjectList: [
|
|
|
+ { value: "1", label: "语文" },
|
|
|
+ { value: "2", label: "数学" },
|
|
|
+ { value: "3", label: "英语" },
|
|
|
+ { value: "4", label: "科学" },
|
|
|
+ { value: "5", label: "物理" },
|
|
|
+ { value: "6", label: "化学" },
|
|
|
+ { value: "7", label: "生物" },
|
|
|
+ { value: "8", label: "历史" },
|
|
|
+ { value: "9", label: "地理" },
|
|
|
+ { value: "10", label: "政治" }
|
|
|
+ ],
|
|
|
+ form: {
|
|
|
+ name: "",
|
|
|
+ subject: "",
|
|
|
+ brief: "",
|
|
|
+ permissions: false
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ name: [{ required: true, message: "请输入课程名称", trigger: "blur" }],
|
|
|
+ subject: [
|
|
|
+ { required: true, message: "请输入所属学科", trigger: "blur" }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ open(_json) {
|
|
|
+ this.form = {
|
|
|
+ name: "",
|
|
|
+ subject: "",
|
|
|
+ brief: "",
|
|
|
+ permissions: false
|
|
|
+ };
|
|
|
+ this.loading = false;
|
|
|
+ this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ close() {
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.form = {
|
|
|
+ name: "",
|
|
|
+ subject: "",
|
|
|
+ brief: "",
|
|
|
+ permissions: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ submitBtn(ref) {
|
|
|
+ this.$refs[ref].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true;
|
|
|
+ let _data = JSON.parse(JSON.stringify(this.dataList));
|
|
|
+ let _result = [];
|
|
|
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
- open(_json) {
|
|
|
- this.form = {
|
|
|
- name:"",
|
|
|
- subject:"",
|
|
|
- brief:"",
|
|
|
- permissions:false,
|
|
|
- }
|
|
|
- this.loading = false;
|
|
|
- this.dialogVisible = true;
|
|
|
- },
|
|
|
- close() {
|
|
|
- this.dialogVisible = false;
|
|
|
- this.form = {
|
|
|
- name:"",
|
|
|
- subject:"",
|
|
|
- brief:"",
|
|
|
- permissions:false,
|
|
|
- };
|
|
|
- },
|
|
|
- submitBtn(ref) {
|
|
|
- this.$refs[ref].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.loading = true;
|
|
|
- let _data = JSON.parse(JSON.stringify(this.dataList));
|
|
|
- let _result = [];
|
|
|
-
|
|
|
- _data.forEach(i=>{
|
|
|
- if(converter(i.jsonData.name)==converter('词频词汇分析')){
|
|
|
- return
|
|
|
- }else{
|
|
|
- i.jsonData.content = "";
|
|
|
- i.jsonData.dataFileList = [];
|
|
|
- i.jsonData.fileList = [];
|
|
|
- i.createtime = "";
|
|
|
- i.id = "",
|
|
|
- i.tId = "",
|
|
|
- i.userid = "";
|
|
|
- _result.push(i)
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- })
|
|
|
+ _data.forEach(i => {
|
|
|
+ if (converter(i.jsonData.name) == converter("词频词汇分析")) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ i.jsonData.content = "";
|
|
|
+ i.jsonData.dataFileList = [];
|
|
|
+ i.jsonData.fileList = [];
|
|
|
+ i.createtime = "";
|
|
|
+ (i.id = ""), (i.tId = ""), (i.userid = "");
|
|
|
+ if (i.jsonData.eChartData) {
|
|
|
+ delete i.jsonData.eChartData;
|
|
|
+ }
|
|
|
+ if (i.jsonData.RT && i.jsonData.CH) {
|
|
|
+ delete i.jsonData.RT;
|
|
|
+ delete i.jsonData.CH;
|
|
|
+ }
|
|
|
+ _result.push(i);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- let otherData = {
|
|
|
- isOtherData:true,
|
|
|
- dialogTagList:this.bmData.jsonData.dialogTagList,
|
|
|
- }
|
|
|
- _result.push(otherData)
|
|
|
- // console.log(_result)
|
|
|
- // this.loading = false
|
|
|
- // return
|
|
|
- let params = [{
|
|
|
- title:this.form.name,
|
|
|
- subject:this.form.subject,
|
|
|
- uid:this.userId,
|
|
|
- brief:this.form.brief,
|
|
|
- per:this.form.permissions?1:0,
|
|
|
- jsonData:JSON.stringify(_result),
|
|
|
- }]
|
|
|
- // this.loading = false;
|
|
|
- // return console.log(params);
|
|
|
- this.ajax.post(this.$store.state.api+"insertClassroomTemplate",params).then(res=>{
|
|
|
- console.log(res)
|
|
|
- this.$message.success("另存模板成功");
|
|
|
- this.loading = false;
|
|
|
- this.close();
|
|
|
- }).catch(e=>{
|
|
|
- console.log(e);
|
|
|
- this.$message.error("另存失败");
|
|
|
- this.loading = false;
|
|
|
- })
|
|
|
- // return console.log(params)
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- },
|
|
|
+ let otherData = {
|
|
|
+ isOtherData: true,
|
|
|
+ dialogTagList: this.bmData.jsonData.dialogTagList
|
|
|
+ };
|
|
|
+ _result.push(otherData);
|
|
|
+ // console.log(_result)
|
|
|
+ // this.loading = false
|
|
|
+ // return
|
|
|
+ let params = [
|
|
|
+ {
|
|
|
+ title: this.form.name,
|
|
|
+ subject: this.form.subject,
|
|
|
+ uid: this.userId,
|
|
|
+ brief: this.form.brief,
|
|
|
+ per: this.form.permissions ? 1 : 0,
|
|
|
+ jsonData: JSON.stringify(_result)
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ // this.loading = false;
|
|
|
+ // return console.log(params);
|
|
|
+ this.ajax
|
|
|
+ .post(this.$store.state.api + "insertClassroomTemplate", params)
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.$message.success("另存模板成功");
|
|
|
+ this.loading = false;
|
|
|
+ this.close();
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ this.$message.error("另存失败");
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ // return console.log(params)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
.bindingFormDialog >>> .el-dialog {
|
|
|
- min-width: 700px;
|
|
|
+ min-width: 700px;
|
|
|
|
|
|
- height: 500px;
|
|
|
- box-shadow: 0px 0 8px 0px #555555;
|
|
|
- border-radius: 8px;
|
|
|
- background-color: #fff;
|
|
|
- /* top: 0px; */
|
|
|
- /* margin: 0 auto; */
|
|
|
- overflow: hidden;
|
|
|
+ height: 500px;
|
|
|
+ box-shadow: 0px 0 8px 0px #555555;
|
|
|
+ border-radius: 8px;
|
|
|
+ background-color: #fff;
|
|
|
+ /* top: 0px; */
|
|
|
+ /* margin: 0 auto; */
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
.bindingFormDialog >>> .el-dialog__body {
|
|
|
- height: 100%;
|
|
|
- min-width: 700px;
|
|
|
- flex-shrink: 0;
|
|
|
- box-sizing: border-box;
|
|
|
- padding-bottom: 50px;
|
|
|
- padding-top: 10px;
|
|
|
+ height: 100%;
|
|
|
+ min-width: 700px;
|
|
|
+ flex-shrink: 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-bottom: 50px;
|
|
|
+ padding-top: 10px;
|
|
|
}
|
|
|
.bindingFormDialog >>> .el-dialog__header {
|
|
|
- display: none !important;
|
|
|
+ display: none !important;
|
|
|
}
|
|
|
|
|
|
.a-d-top {
|
|
|
- /* background: #adadad; */
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- flex-wrap: nowrap;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- height: 54px;
|
|
|
- border-radius: 8px 8px 0 0;
|
|
|
- user-select: none;
|
|
|
- border-bottom: 1px #ccc solid;
|
|
|
+ /* background: #adadad; */
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ height: 54px;
|
|
|
+ border-radius: 8px 8px 0 0;
|
|
|
+ user-select: none;
|
|
|
+ border-bottom: 1px #ccc solid;
|
|
|
}
|
|
|
.a-d-top >>> .el-input__inner {
|
|
|
- width: 320px;
|
|
|
- height: 32px;
|
|
|
+ width: 320px;
|
|
|
+ height: 32px;
|
|
|
}
|
|
|
.a-d-top >>> .el-input__icon {
|
|
|
- line-height: 32px;
|
|
|
+ line-height: 32px;
|
|
|
}
|
|
|
|
|
|
.a-d-topTit {
|
|
|
- /* width: 171px; */
|
|
|
- /* margin-left: 20px; */
|
|
|
- height: 32px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- font-family: PingFang SC;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 5px;
|
|
|
- line-height: 22px;
|
|
|
- justify-content: center;
|
|
|
- /* text-align: left; */
|
|
|
+ /* width: 171px; */
|
|
|
+ /* margin-left: 20px; */
|
|
|
+ height: 32px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 5px;
|
|
|
+ line-height: 22px;
|
|
|
+ justify-content: center;
|
|
|
+ /* text-align: left; */
|
|
|
}
|
|
|
|
|
|
.a-d-t-right {
|
|
|
- width: 40px;
|
|
|
- height: 40px;
|
|
|
- margin-right: 10px;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- color: black !important;
|
|
|
+ width: 40px;
|
|
|
+ height: 40px;
|
|
|
+ margin-right: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ color: black !important;
|
|
|
}
|
|
|
|
|
|
.a-d-t-right > span {
|
|
|
- width: 25px;
|
|
|
- height: 25px;
|
|
|
- border-radius: 25px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- /* align-items: center; */
|
|
|
- font-size: 22px;
|
|
|
- color: #fff;
|
|
|
- /* background-color: #adadad; */
|
|
|
- cursor: pointer;
|
|
|
- /* background-color: #e6e6e6; */
|
|
|
- color: #adadad;
|
|
|
+ width: 25px;
|
|
|
+ height: 25px;
|
|
|
+ border-radius: 25px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ /* align-items: center; */
|
|
|
+ font-size: 22px;
|
|
|
+ color: #fff;
|
|
|
+ /* background-color: #adadad; */
|
|
|
+ cursor: pointer;
|
|
|
+ /* background-color: #e6e6e6; */
|
|
|
+ color: #adadad;
|
|
|
}
|
|
|
|
|
|
.bfd_box {
|
|
|
- width: 100%;
|
|
|
- height: calc(100% - 80px);
|
|
|
- overflow: hidden;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 80px);
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.bfd_bottom {
|
|
|
- width: 100%;
|
|
|
- height: calc(40px);
|
|
|
- margin-top: 10px;
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(40px);
|
|
|
+ margin-top: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
}
|
|
|
|
|
|
.bfd_b_left {
|
|
|
- flex: 1;
|
|
|
- height: 100%;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
+ flex: 1;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
|
|
|
.a_d_t_input {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
|
|
|
/* .bfd_b_right {
|