liqk пре 3 година
родитељ
комит
4463fb27d4

+ 3 - 1
TEAMModelOS/ClientApp/src/locale/lang/en-US/cusMgt.js

@@ -10,6 +10,8 @@ export default {
     nameHolder:'Please enter course name',
     cusCode:'Course ID',
     codeHolder:'Please enter course ID',
+    cusDesc:'課程描述',
+    descHolder:'請輸入課程描述',
     cusPd:"School System",
     pdHolder:'Please choose school system',
     cusSubject:"School System",
@@ -32,7 +34,7 @@ export default {
     addErr:'Failed to add!',
     editOk:'Modified successfully!',
     editErr:'Failure to modify!',
-    formTips:'Please complete the information first, then save!',
+    formTips:'Please check the course information!',
     noSchool:'Not yet joined any schools, no school data available',
     sltCusTips:'Please enter course',
 

+ 3 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/cusMgt.js

@@ -10,6 +10,8 @@ export default {
     cNameHolder:'请输入课程名称',
     cusCode:'课程编码',
     codeHolder:'请输入课程编码',
+    cusDesc:'课程描述',
+    descHolder:'请输入课程描述',
     cusPd:'课程学段',
     pdHolder:'请选择学段',
     cusSubject:'课程学科',
@@ -32,7 +34,7 @@ export default {
     addErr:'添加成功!',
     editOk:'修改成功!',
     editErr:'修改失败!',
-    formTips:'请先完善信息,再保存!',
+    formTips:'请检查课程信息!',
     noSchool:'尚未加入学校,没有学校数据',
     sltCusTips:'请选择课程',
 

+ 3 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/cusMgt.js

@@ -10,6 +10,8 @@ export default {
     cNameHolder: '請輸入課程名稱',
     cusCode: '課程編碼',
     codeHolder: '請輸入課程編碼',
+    cusDesc:'課程描述',
+    descHolder:'請輸入課程描述',
     cusPd: '課程學制',
     pdHolder: '請選擇學制',
     cusSubject: '課程學科',
@@ -32,7 +34,7 @@ export default {
     addErr: '新增失敗!',
     editOk: '修改成功!',
     editErr: '修改失敗!',
-    formTips: '請先完善資訊,再儲存!',
+    formTips: '請檢查課程資訊!',
     noSchool: '尚未加入學校,沒有學校數據',
     sltCusTips: '請選擇課程',
 

+ 55 - 104
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -246,36 +246,6 @@
                 <TeaTable :schedData="schdData" :teacher="$store.state.userInfo.TEAMModelId" :periodId="curPd" mode="view"></TeaTable>
             </vuescroll>
         </div>
-        <Drawer :title="$t('cusMgt.cusInfo')" class-name="dark-iview-drawer" width="450" :closable="false" v-model="showCusInfo" @on-close="baseEditStatus = true">
-            <!--基础信息-->
-            <div class="course-base-info-content dark-iview-form disabled-iview-select dark-wang-editor">
-                <Form ref="courseBaseInfo" label-position="top">
-                    <FormItem :label="$t('cusMgt.cusName')" prop="name" class="disabled-iview-select">
-                        <Input v-if="listType == 'school' && courseListShow[curCusIndex]" v-model="courseListShow[curCusIndex].name" :disabled="true" style="width:100%" :placeholder="$t('cusMgt.cusName')" :clearable="true"></Input>
-                        <Input v-else-if="listType == 'private' && courseListShow[curCusIndex]" v-model="courseListShow[curCusIndex].name" :disabled="baseEditStatus" style="width:100%" :placeholder="$t('cusMgt.cusName')" :clearable="true"></Input>
-                    </FormItem>
-                    <FormItem :label="$t('cusMgt.cusCode')" prop="no" class="disabled-iview-select">
-                        <Input v-if="listType == 'school' && courseListShow[curCusIndex]" v-model="courseListShow[curCusIndex].no" :disabled="true" style="width:100%" :placeholder="$t('cusMgt.cusCode')" :clearable="true"></Input>
-                        <Input v-else-if="listType == 'private' && courseListShow[curCusIndex]" v-model="courseListShow[curCusIndex].no" :disabled="baseEditStatus" style="width:100%" :placeholder="$t('cusMgt.cusCode')" :clearable="true"></Input>
-                    </FormItem>
-                    <FormItem :label="$t('courseManage.base.courseNotice')">
-                        <!-- 暂时注释课程公告功能 -->
-                        <!-- <span>课程公告暂未处理</span> -->
-                        <!-- <div ref="courseNotice" v-show="!baseEditStatus"></div>
-                        <div v-show="baseEditStatus" style="height:fit-content;color:white;font-size:16px;padding-left:10px;width:100%;">
-                            <vuescroll>
-                                <div v-if="listType == 'school' && courseListS[curCusIndex] && checkNotice(courseListS[curCusIndex].notice)" v-html="courseListS[curCusIndex][0].notice" style=""></div>
-                                <div v-else-if="listType == 'private' && courseListP[curCusIndex] && checkNotice(courseListP[curCusIndex].notice)" v-html="courseListP[curCusIndex].notice" style=""></div>
-                                <div v-else style="">{{$t('cusMgt.noNotice')}}</div>
-                            </vuescroll>
-                        </div> -->
-                    </FormItem>
-                    <FormItem label="">
-                        <Button style="width:100%;margin-top:10px;" @click="edNotice">{{baseEditStatus ? $t('cusMgt.edit') : $t('cusMgt.save')}}</Button>
-                    </FormItem>
-                </Form>
-            </div>
-        </Drawer>
         <!-- 创建名单 -->
         <Modal v-model="newSlStatus" width="600" @on-ok="confirmCreateList" class-name="dark-iview-modal dark-iview-form" :loading="modalLoading">
             <div slot="header">
@@ -302,19 +272,18 @@
                 </FormItem>
             </Form>
             <span class="create-list-tips">{{$store.state.userInfo.hasSchool ? $t('cusMgt.createTips1') : $t('cusMgt.createTips2')}}</span>
-            <!-- <StudentList v-if="$store.state.userInfo.hasSchool" @getSelectInfo="(selction)=>{createStuList = selction}"></StudentList>
-            <p v-else class="no-school-tips">
-                {{$t('cusMgt.noSchoolStu')}}
-            </p> -->
         </Modal>
-        <Modal v-model="addCusStatus" :title="$t('cusMgt.addCus')" @on-ok="confirmAddCus" class-name="dark-iview-modal dark-iview-form">
+        <Modal v-model="addCusStatus" :title="$t('cusMgt.addCus')" @on-ok="confirmAddCus" class-name="dark-iview-modal dark-iview-form" :loading="modalLoading">
             <Form ref="addCusInfo" :model="addCusInfo" :rules="ruleAddCus">
                 <FormItem prop="name" :label="$t('cusMgt.cusName')">
                     <Input type="text" v-model="addCusInfo.name" :placeholder="$t('cusMgt.nameHolder')"></Input>
                 </FormItem>
-                <FormItem :label="$t('cusMgt.cusCode')">
+                <FormItem :label="$t('cusMgt.cusCode')" prop="no">
                     <Input type="text" v-model="addCusInfo.no" :placeholder="$t('cusMgt.codeHolder')"></Input>
                 </FormItem>
+                <FormItem :label="$t('cusMgt.cusDesc')" prop="desc">
+                    <Input v-model="addCusInfo.desc" type="textarea" :maxlength="200" show-word-limit :autosize="{ minRows: 4, maxRows: 6 }" :placeholder="$t('cusMgt.descHolder')" />
+                </FormItem>
             </Form>
         </Modal>
         <Modal v-model="addStuStatus" :title="$t('cusMgt.addStu')" width="1200" @on-ok="confirmAddStu" class-name="dark-iview-modal">
@@ -347,7 +316,6 @@
 import { mapGetters } from 'vuex'
 import QRCode from 'qrcodejs2'
 import PersonalPhoto from '@/components/public/personalPhoto/Index.vue'
-import E from '@/utils/wangEditor.js'
 import StudentList from '@/components/coursemgt/StudentList.vue'
 import TeaTable from './TeaTable.vue'
 export default {
@@ -358,14 +326,11 @@ export default {
     data() {
         // 验证只能是字母和数字
         const validateCode = (rule, value, callback) => {
-            if (!value) {
-                return callback(new Error(this.$t('cusMgt.codeErr1')))
-            }
             let zg = /^[0-9a-zA-Z]+$/
-            if (zg.test(value)) {
-                callback()
-            } else {
+            if (value && !zg.test(value)) {
                 callback(new Error(this.$t('cusMgt.codeErr2')))
+            } else {
+                callback()
             }
         }
         return {
@@ -378,10 +343,6 @@ export default {
             cusType: [],
             curPd: '',
             isShowSchd: false,
-            // schoolBase: {
-            //     period: []
-            // },
-            // classList: [],
             split1: 0.2,
             split2: 0.2,
             acTypeList: [
@@ -497,7 +458,6 @@ export default {
             editClassStatus: false,
             baseEditStatus: true,
             showQrStatus: false,
-            showCusInfo: false,
             listLoading: false,
             newSlStatus: false,
             stuLoading: false,
@@ -513,7 +473,8 @@ export default {
             addCusInfo: {
                 name: '',
                 no: '',
-                id: ''
+                id: '',
+                desc: ''
             },
             listName: '',
             ruleAddCus: {
@@ -521,7 +482,7 @@ export default {
                     { required: true, message: this.$t('cusMgt.nameHolder'), trigger: 'change' }
                 ],
                 no: [
-                    { required: true, validator: validateCode, trigger: 'change' }
+                    { validator: validateCode, trigger: 'change' }
                 ]
             },
             stuList: []
@@ -638,7 +599,7 @@ export default {
                                 try {
                                     let listRes = await this.getListInfo([...ids])
                                     if (listRes) {
-                                        let already = this.stuList.map(item=>{
+                                        let already = this.stuList.map(item => {
                                             return item.id
                                         })
                                         listRes.stuList.forEach(item => {
@@ -997,47 +958,8 @@ export default {
             })
         },
         editCus() {
-            this.toggleCusInfo()
-            this.edNotice()
-        },
-        toggleCusInfo() {
-            this.showCusInfo = !this.showCusInfo
-        },
-        edNotice() {
-            if (this.baseEditStatus) {
-                this.baseEditStatus = !this.baseEditStatus
-                this.initEditor()
-            } else {
-                this.updCusInfo()
-                this.baseEditStatus = !this.baseEditStatus
-            }
-        },
-
-        //初始化富文本编辑器
-        initEditor() {
-            if (!this.noticeEditor) {
-                let noticeEditor = new E(this.$refs.courseNotice)
-                noticeEditor.customConfig.onchange = (html) => {
-                    //TODO 设置课程公告
-                }
-                noticeEditor.customConfig.menus = [
-                    'bold', // 粗体
-                    'italic', // 斜体
-                    'underline', // 下划线
-                    'list', // 列表
-                    'link', // 插入链接
-                    'image' // 插入图片
-                ],
-                    noticeEditor.customConfig.showLinkImg = false
-                noticeEditor.customConfig.uploadFileName = 'files'
-                noticeEditor.create()
-                noticeEditor.txt.html(this.courseListShow[this.curCusIndex].notice)
-                this.noticeEditor = noticeEditor
-            } else {
-                let schoolNotice = this.courseListShow[this.curCusIndex][0].notice ? this.courseListShow[this.curCusIndex][0].notice : ''
-                this.noticeEditor.txt.html(this.listType == 'school' ? schoolNotice : this.courseListShow[this.curCusIndex].notice)
-            }
-
+            this.addCusInfo = this._.cloneDeep(this.courseListShow[this.curCusIndex])
+            this.addCusStatus = true
         },
         //创建二维码
         createQRCode(url) {
@@ -1310,36 +1232,65 @@ export default {
             this.$refs['addCusInfo'].validate((valid) => {
                 if (valid) {
                     let requestData = {
-                        option: 'insert',
+                        option: this.addCusInfo.id ? 'update' : 'insert',
                         scope: 'private',
                         course: {
                             name: this.addCusInfo.name,
                             no: this.addCusInfo.no,
-                            id: this.$tools.guid(),
+                            desc: this.addCusInfo.desc,
+                            id: this.addCusInfo.id || this.$tools.guid(),
                             code: this.$store.state.userInfo.TEAMModelId,
-                            schedule: [],
+                            schedule: this.addCusInfo.schedule || [],
                             scope: 'private',
-                            // school: this.$store.state.userInfo.schoolCode,
                             creatorId: this.$store.state.userInfo.schoolCode
                         }
                     }
                     this.$api.courseMgmt.saveOrUpdateCourse(requestData).then(
                         (res) => {
-                            if (res.error == null) {
-                                this.$Message.success(this.$t('cusMgt.addOk'))
-                                // this.courseListP.push(requestData.course)
-                                this.courseList.push(requestData.course)
-                                this.courseListShow.push(requestData.course)
+                            if (!res.error) {
+                                this.$Message.success(this.addCusInfo.id ? this.$t('cusMgt.editOk') : this.$t('cusMgt.addOk'))
+                                //新增课程
+                                if (!this.addCusInfo.id) {
+                                    this.courseList.push(requestData.course)
+                                    this.courseListShow.push(requestData.course)
+                                }
+                                // 修改课程
+                                else {
+                                    let index = this.courseListShow.findIndex(item => {
+                                        return item.id == this.addCusInfo.id
+                                    })
+                                    if (index > -1) {
+                                        this.courseListShow.splice(index, 1, requestData.course)
+                                    }
+                                    let oraginIndex = this.courseList.findIndex(item => {
+                                        return item.id == this.addCusInfo.id
+                                    })
+                                    if (index > -1) {
+                                        this.courseList.splice(oraginIndex, 1, requestData.course)
+                                    }
+                                }
+                                this.addCusStatus = false
                             } else {
-                                this.$Message.success(this.$t('cusMgt.addErr'))
+                                this.$Message.error(this.addCusInfo.id ? this.$t('cusMgt.editErr') : this.$t('cusMgt.addErr'))
+                                this.modalLoading = false
+                                setTimeout(() => {
+                                    this.modalLoading = true
+                                }, 0)
                             }
                         },
                         (err) => {
-
+                            this.modalLoading = false
+                            setTimeout(() => {
+                                this.modalLoading = true
+                            }, 0)
                         }
                     )
                 } else {
                     this.$Message.error(this.$t('cusMgt.formTips'));
+                    this.modalLoading = false
+                    setTimeout(() => {
+                        this.modalLoading = true
+                    }, 0)
                 }
             })
         },
@@ -1433,7 +1384,7 @@ export default {
                                 try {
                                     let listRes = await this.getListInfo([...ids])
                                     if (listRes) {
-                                        let already = this.stuList.map(item=>{
+                                        let already = this.stuList.map(item => {
                                             return item.id
                                         })
                                         listRes.stuList.forEach(item => {

+ 4 - 0
TEAMModelOS/ClientApp/src/view/newcourse/NewCusMgt.vue

@@ -243,6 +243,9 @@
                 <FormItem :label="$t('cusMgt.cusCode')" prop="no">
                     <Input v-model="courseBaseInfo.no" :placeholder="$t('cusMgt.codeHolder')"></Input>
                 </FormItem>
+                <FormItem :label="$t('cusMgt.cusDesc')" prop="desc">
+                    <Input v-model="courseBaseInfo.desc" type="textarea" :maxlength="200" show-word-limit :autosize="{ minRows: 4, maxRows: 6 }" :placeholder="$t('cusMgt.descHolder')" />
+                </FormItem>
                 <!-- <FormItem :label="$t('cusMgt.cusPd')" prop="period.id">
                     <Select v-model="courseBaseInfo.period.id" :placeholder="$t('cusMgt.pdHolder')">
                         <Option v-for="(item,index) in schoolBase.period" :value="item.id" :key="index" @click.native="courseBaseInfo.period = { id: item.id, name: item.name }">
@@ -465,6 +468,7 @@ export default {
                 id: '',
                 no: '',
                 name: '',
+                desc:'',
                 period: {
                     id: '',
                     name: ''