Explorar o código

courseware search update

hare8999@163.com %!s(int64=2) %!d(string=hai) anos
pai
achega
1344d3fdcc

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 347 - 365
src/components/formSearch/index.vue


+ 23 - 41
src/views/accurateTeaching/custom/custom.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <form-search :searchformShow="searchformShow" @handleQuery="handleQuery" @change="formChange"
+    <form-search :searchformShow="searchformShow" :validate-rules="searchRules" @handleQuery="handleQuery"
                  @resetQuery="resetQuery"></form-search>
     <el-card class="box-card" style="margin-bottom:30px">
       <el-row :gutter="24">
@@ -120,6 +120,7 @@ export default {
       },
       treeLoading: false,
       searchformShow: {},
+      searchRules: {},
       dialogVisible: false,
       treeProps: {
         children: 'children',
@@ -206,6 +207,7 @@ export default {
         edition: '',
         slipid: ''
       }
+      this.searchRules = {}
     } else if (this.viewName == 'Courseware') {
       this.searchformShow = {
         subjectid: '',
@@ -213,14 +215,14 @@ export default {
         slipid: '',
         coursewareType: ''
       }
+      this.searchRules = this.createCoursewareRules()
     } else {
       this.searchformShow = {
         subjectid: '',
         resourceType: ''
       }
+      this.searchRules = {}
     }
-    this.getList()
-    // this.getTreeselect();
     this.getDicts('resource_type').then((response) => {
       this.typeOptions = response.data
     })
@@ -352,12 +354,12 @@ export default {
       }
     },
     /** 搜索按钮操作 */
-    handleQuery(data) {
+    async handleQuery(data, type) {
       this.pageNum = 1
       this.queryParams = Object.assign(this.queryParams, data)
       this.queryParams.wayType = data.wayType || '1'
+      await this.getTreeselect(type)
       this.getList()
-      // this.getTreeselect()
     },
     /** 重置按钮操作 */
     resetQuery(data) {
@@ -372,25 +374,12 @@ export default {
       this.single = selection.length !== 1
       this.multiple = !selection.length
     },
-    formChange(data, type) {
-      this.queryParams = data
-      this.queryParams.wayType = data.wayType || '1'
-      if (type == 'wayType') {
-        if (this.queryParams.wayType == 2) {
-          this.searchformShow = {
-            wayType: '1',
-            subjectid: ''
-          }
-        } else {
-          this.searchformShow = {
-            wayType: '1',
-            subjectid: '',
-            edition: '',
-            slipid: ''
-          }
-        }
+    createCoursewareRules() {
+      return {
+        subjectid: [{ required: true, message: '科目必选' }],
+        edition: [{ required: true, message: '版本必选' }],
+        slipid: [{ required: true, message: '学册必选' }]
       }
-      this.getTreeselect(type)
     },
     /** 新增按钮操作 */
     handleAdd() {
@@ -465,7 +454,8 @@ export default {
     },
 
     /** 查询章节下拉树结构 */
-    getTreeselect(type) {
+    async getTreeselect(type) {
+      if (type == 'coursewareType') return
       if (this.queryParams.wayType == 1) {
         if (type != 'slipid' || this.viewName == 'Custom') {
           this.deptOptions = []
@@ -483,14 +473,10 @@ export default {
         if (!Ajax.gradeId) return
         this.deptOptions = []
         this.treeLoading = true
-        treeList(Ajax)
-          .then((response) => {
-            this.deptOptions = response.data
-            this.treeLoading = false
-          })
-          .catch((response) => {
-            this.treeLoading = false
-          })
+        this.queryParams.chapterId = ''
+        const resTree = await treeList(Ajax)
+        this.deptOptions = resTree.data
+        this.treeLoading = false
       } else {
         if (
           (type != 'subjectid' && type != 'wayType') ||
@@ -508,15 +494,11 @@ export default {
         if (!Ajax.subjectId) return
         this.KnowledgeOptions = []
         this.treeLoading = true
-        knowledgeTree(Ajax)
-          .then((response) => {
-            let list = this.filterData(response.data, 0)
-            this.KnowledgeOptions = list
-            this.treeLoading = false
-          })
-          .catch((response) => {
-            this.treeLoading = false
-          })
+        this.queryParams.chapterId = ''
+        const resTree = await knowledgeTree(Ajax)
+        let list = this.filterData(resTree.data, 0)
+        this.KnowledgeOptions = list
+        this.treeLoading = false
       }
     },
 

+ 25 - 44
src/views/accurateTeaching/library/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
-    <form-search :searchformShow="searchformShow" :coursewareUpload="coursewareUpload" @handleQuery="handleQuery"
-                 @change="formChange" @resetQuery="resetQuery"></form-search>
+    <form-search :searchformShow="searchformShow" :validate-rules="searchRules" :coursewareUpload="coursewareUpload"
+                 @handleQuery="handleQuery" @resetQuery="resetQuery"></form-search>
     <el-card class="box-card" style="margin-bottom: 30px">
       <el-row :gutter="24">
         <el-col :span="4" v-if="viewName != 'Custom'">
@@ -186,6 +186,7 @@ export default {
       coursewareUpload: false,
       treeLoading: false,
       searchformShow: {},
+      searchRules: {},
       dialogVisible: false,
       img: {
         ship: require('@/assets/images/ship.png')
@@ -294,6 +295,7 @@ export default {
         edition: '',
         slipid: ''
       }
+      this.searchRules = {}
     } else if (this.viewName == 'Personal') {
       this.coursewareUpload = true
       this.searchformShow = {
@@ -302,15 +304,15 @@ export default {
         slipid: '',
         coursewareType: ''
       }
+      this.searchRules = this.createCoursewareRules()
     } else {
       this.coursewareUpload = true
       this.searchformShow = {
         subjectid: '',
         resourceType: ''
       }
+      this.searchRules = {}
     }
-    this.handleQuery(this.searchformShow)
-    // this.getTreeselect();
     this.getDicts('resource_type').then((response) => {
       this.typeOptions = response.data
     })
@@ -584,15 +586,15 @@ export default {
       }
     },
     /** 搜索按钮操作 */
-    handleQuery(data, type) {
+    async handleQuery(data, type) {
       this.pageNum = 1
       this.queryParams = Object.assign(this.queryParams, data)
       this.queryParams.wayType = data.wayType || '1'
+      await this.getTreeselect(type)
       this.getList()
-      // this.getTreeselect()
     },
     /** 重置按钮操作 */
-    resetQuery(data) {
+    resetQuery(data, type) {
       this.queryParams = data
       this.queryParams.chapterId = ''
       this.pageNum = 1
@@ -606,25 +608,12 @@ export default {
       this.single = selection.length !== 1
       this.multiple = !selection.length
     },
-    formChange(data, type) {
-      this.queryParams = data
-      this.queryParams.wayType = data.wayType || '1'
-      if (this.viewName == 'Index' && this.queryParams.wayType == 2) {
-        this.searchformShow = {
-          wayType: '1',
-          subjectid: ''
-        }
-      } else {
-        this.searchformShow = {
-          wayType: '1',
-          subjectid: '',
-          edition: '',
-          slipid: '',
-          coursewareType: '',
-          resourceType: ''
-        }
+    createCoursewareRules() {
+      return {
+        subjectid: [{ required: true, message: '科目必选' }],
+        edition: [{ required: true, message: '版本必选' }],
+        slipid: [{ required: true, message: '学册必选' }]
       }
-      if (type != 'coursewareType') this.getTreeselect(type)
     },
     /** 新增按钮操作 */
     handleAdd() {
@@ -699,9 +688,9 @@ export default {
           this.exportLoading = false
         })
     },
-
     /** 查询章节下拉树结构 */
-    getTreeselect(type) {
+    async getTreeselect(type) {
+      if (type == 'coursewareType') return
       if (this.queryParams.wayType == 1) {
         if (
           (type != 'slipid' && type != 'wayType') ||
@@ -722,14 +711,10 @@ export default {
         this.deptOptions = []
         if (!Ajax.gradeId) return
         this.treeLoading = true
-        treeList(Ajax)
-          .then((response) => {
-            this.deptOptions = response.data
-            this.treeLoading = false
-          })
-          .catch((response) => {
-            this.treeLoading = false
-          })
+        this.queryParams.chapterId = ''
+        const resTree = await treeList(Ajax)
+        this.deptOptions = resTree.data
+        this.treeLoading = false
       } else {
         if (
           (type != 'subjectid' && type != 'wayType') ||
@@ -747,15 +732,11 @@ export default {
         this.KnowledgeOptions = []
         if (!Ajax.subjectId) return
         this.treeLoading = true
-        knowledgeTree(Ajax)
-          .then((response) => {
-            let list = this.filterData(response.data, 0)
-            this.KnowledgeOptions = list
-            this.treeLoading = false
-          })
-          .catch((response) => {
-            this.treeLoading = false
-          })
+        this.queryParams.chapterId = ''
+        const resTree = await knowledgeTree(Ajax)
+        let list = this.filterData(resTree.data, 0)
+        this.KnowledgeOptions = list
+        this.treeLoading = false
       }
     },
     filterData(data, index) {

+ 19 - 12
src/views/cloudTank/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <form-search :searchformShow="searchformShow" @handleQuery="handleQuery" @change="formChange"
+    <form-search :searchformShow="searchformShow" :validate-rules="searchRules" @handleQuery="handleQuery"
                  @resetQuery="resetQuery"></form-search>
     <el-card class="box-card" style="margin-bottom:30px">
       <el-row :gutter="24">
@@ -107,6 +107,7 @@ export default {
   data() {
     return {
       searchformShow: {},
+      searchRules: {},
       dialogVisible: false,
       img: {
         ship: require('@/assets/images/ship.png')
@@ -204,6 +205,7 @@ export default {
         edition: '',
         slipid: ''
       }
+      this.searchRules = {}
     } else if (this.viewName == 'Courseware') {
       this.searchformShow = {
         province: '',
@@ -212,6 +214,7 @@ export default {
         slipid: '',
         coursewareType: ''
       }
+      this.searchRules = this.createCoursewareRules()
     }
     this.getList()
     this.getDicts('resource_type').then((response) => {
@@ -225,6 +228,13 @@ export default {
     })
   },
   methods: {
+    createCoursewareRules() {
+      return {
+        subjectid: [{ required: true, message: '科目必选' }],
+        edition: [{ required: true, message: '版本必选' }],
+        slipid: [{ required: true, message: '学册必选' }]
+      }
+    },
     /** 查询个人资源库列表 */
     getList() {
       this.loading = true
@@ -350,11 +360,11 @@ export default {
       this.getTreeselect(type)
     },
     /** 搜索按钮操作 */
-    handleQuery(data) {
+    handleQuery(data, type) {
       this.pageNum = 1
       this.queryParams = Object.assign(this.queryParams, data)
       this.getList()
-      // this.getTreeselect()
+      this.getTreeselect(type)
     },
     /** 重置按钮操作 */
     resetQuery(data) {
@@ -445,7 +455,8 @@ export default {
     },
 
     /** 查询部门下拉树结构 */
-    getTreeselect(type) {
+    async getTreeselect(type) {
+      if (type == 'coursewareType') return
       if (!this.queryParams.slipid) {
         this.deptOptions = []
         return
@@ -461,14 +472,10 @@ export default {
         // gradeid:301
       }
       this.treeLoading = true
-      treeList(Ajax)
-        .then((response) => {
-          this.deptOptions = response.data
-          this.treeLoading = false
-        })
-        .catch((response) => {
-          this.treeLoading = false
-        })
+      this.queryParams.chapterId = ''
+      const resTree = await treeList(Ajax)
+      this.deptOptions = resTree.data
+      this.treeLoading = false
     },
     // 筛选节点
     filterNode(value, data) {

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio