Kaynağa Gözat

修改问题

natasha 1 yıl önce
ebeveyn
işleme
fdf5bb7104

+ 15 - 6
src/views/content_manage/newspaper_manage/ChannelList.vue

@@ -166,7 +166,7 @@
         <div class="channel-header">
             {{channelForm.id?'编辑模板':'创建模版'}}
         </div>
-        <el-form :model="channelForm" :rules="rulesChannelForm" ref="channelForm" label-width="100px" class="channelForm">
+        <el-form :model="channelForm" :rules="rulesChannelForm" ref="channelForm" label-width="100px" class="channelForm" v-loading="pageLoading">
             <el-form-item label="模板名称" prop="tpl_name">
                 <el-input v-model="channelForm.tpl_name" placeholder="请输入模板名称" @blur="handleTrim('channelForm','tpl_name')" maxlength="200"></el-input>
             </el-form-item>
@@ -225,7 +225,7 @@ export default {
   data() {
     //这里存放数据
     return {
-        resourceFlag: false,
+        pageLoading: false,
         searchInput: '',
         searchStudy: -1,
         searchStatus: '',
@@ -282,7 +282,8 @@ export default {
         },
         channelFlag: false,
         loading: false,
-        tableLoading: false
+        tableLoading: false,
+        oldInfo: null,
     }
   },
   //计算属性 类似于data概念
@@ -443,6 +444,7 @@ export default {
     },
     // 提交表单
     onSubmit(formName){
+        this.channelForm.chn_data = this.channelForm.chn_data_str.split("\n")
         this.$refs[formName].validate((valid) => {
           if (valid) {
             this.loading = true
@@ -454,7 +456,7 @@ export default {
                 id: this.channelForm.id,
                 tpl_name: this.channelForm.tpl_name,
                 study_phase: this.channelForm.study_phase,
-                tpl_status: 0,
+                tpl_status: this.channelForm.id?this.oldInfo.tpl_status:1,
                 chn_data: this.channelForm.chn_data,
                 tpl_note: this.channelForm.tpl_note
             }
@@ -477,25 +479,32 @@ export default {
     },
     // 取消 恢复到修改前状态
     onCancel(formName){
-        this.$refs[formName].resetFields();
+        // this.$refs[formName].resetFields();
+        this.channelForm.tpl_name = JSON.parse(JSON.stringify(this.oldInfo.tpl_name))
+        this.channelForm.study_phase = JSON.parse(JSON.stringify(this.oldInfo.study_phase))
+        this.channelForm.chn_data_str = JSON.parse(JSON.stringify(this.oldInfo.chn_data.join("\n")))
+        this.channelForm.tpl_note = JSON.parse(JSON.stringify(this.oldInfo.tpl_note))
     },
     // 获取信息
     getInfo(){
+        this.pageLoading = true
         let MethodName = "/PaperServer/Manager/ChannelTplManager/FindChannelTplById";
         let data = {
             id: this.channelForm.id
         }
         getLogin(MethodName, data)
         .then((res) => {
+            this.pageLoading = false
             if(res.status===1){
                 this.channelForm.tpl_name = JSON.parse(JSON.stringify(res.data.tpl_name))
                 this.channelForm.study_phase = JSON.parse(JSON.stringify(res.data.study_phase))
                 this.channelForm.chn_data_str = JSON.parse(JSON.stringify(res.data.chn_data.join("\n")))
                 this.channelForm.tpl_note = JSON.parse(JSON.stringify(res.data.tpl_note))
+                this.oldInfo = res.data
             }
         })
         .catch(() => {
-            
+            this.pageLoading = false
         });
     }
   },

+ 10 - 5
src/views/content_manage/newspaper_manage/CreateNewspaper.vue

@@ -77,7 +77,7 @@
                             </el-date-picker>
                         </el-form-item>
                         <el-form-item label="学段" prop="study_phase">
-                            <el-select v-model="newspaperForm.study_phase" placeholder="请选择" @change="getVlList">
+                            <el-select v-model="newspaperForm.study_phase" placeholder="请选择" @change="getVlList(1)">
                                 <el-option
                                     v-for="item in $studyType"
                                     :key="item.study_phase"
@@ -488,6 +488,7 @@ export default {
     handleLinkChannel(){
         window.localStorage.setItem('newsForm',JSON.stringify(this.newspaperForm))
         window.localStorage.setItem('newsStep',0)
+        window.localStorage.setItem('clearForm',true)
         this.$router.push({
             path:'/channelList'
         })
@@ -560,10 +561,12 @@ export default {
         // });
     },
     // 课标词表
-    getVlList(){
-        this.newspaperForm.vl_id = ''
-        this.newspaperForm.chn_data = ''
-        this.newspaperForm.chn_data_str = ''
+    getVlList(flag){
+        if(flag){
+            this.newspaperForm.vl_id = ''
+            this.newspaperForm.chn_data = ''
+            this.newspaperForm.chn_data_str = ''
+        }
         let MethodName = "/PaperServer/Manager/VocListManager/FindSimplesByCond";
         let data = {
             study_phase: this.newspaperForm.study_phase
@@ -626,6 +629,7 @@ export default {
             if(res.status===1){
                 window.localStorage.removeItem('newsForm')
                 window.localStorage.removeItem('newsStep')
+                window.localStorage.removeItem('clearForm')
                 this.issueId = res.data.id
                 this.$router.replace('/createNewspaper?id='+res.data.id+'&isCreate=true')
                 this.stepIndex++
@@ -691,6 +695,7 @@ export default {
             if(res.status===1){
                 window.localStorage.removeItem('newsForm')
                 window.localStorage.removeItem('newsStep')
+                window.localStorage.removeItem('clearForm')
                 this.stepIndex++
                 let chn_art_data = []
                 if(res.data.chn_art_data){

+ 1 - 1
src/views/content_manage/newspaper_manage/Phrase.vue

@@ -194,7 +194,7 @@ export default {
                                 items.sel_token_idxes = flag?sel_token_idxes:[]
                                 this.$set(items,'show',searchSentence.length===0?true:false)
                                 searchSentence.push(items)
-                                // break
+                                break
                             }
                         }
                     }

+ 2 - 0
src/views/content_manage/newspaper_manage/index.vue

@@ -459,6 +459,7 @@ export default {
         window.localStorage.setItem('tabsIndex',this.tabsIndex)
         window.localStorage.removeItem('newsForm')
         window.localStorage.removeItem('newsStep')
+        window.localStorage.removeItem('clearForm')
         if(flag){
             window.localStorage.setItem('newsStep',1)
         }
@@ -480,6 +481,7 @@ export default {
         window.localStorage.setItem('tabsIndex',this.tabsIndex)
         window.localStorage.removeItem('newsForm')
         window.localStorage.removeItem('newsStep')
+        window.localStorage.removeItem('clearForm')
         this.$router.push({
             path: "/articleChecklist",
             query: {