|  | @@ -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) {
 |