106 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			106 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <ai-list v-if="!isShowDetail">
 | |
|     <template slot="title">
 | |
|       <ai-title title="招工就业" :isShowBottomBorder="false"></ai-title>
 | |
|     </template>
 | |
|     <template slot="tabs">
 | |
|       <el-tabs v-model="currIndex">
 | |
|         <el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
 | |
|           <component :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/>
 | |
|         </el-tab-pane>
 | |
|       </el-tabs>
 | |
|     </template>
 | |
|   </ai-list>
 | |
|   <AddJob v-else-if="componentName === 'AddJob' && isShowDetail" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></AddJob>
 | |
|   <Add v-else-if="componentName === 'Add' && isShowDetail" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Add>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
|   import List from './components/List.vue'
 | |
|   import JobList from './components/JobList'
 | |
|   import Add from './components/Add'
 | |
|   import AddJob from './components/AddJob'
 | |
|   import { mapState } from 'vuex'
 | |
| 
 | |
|   export default {
 | |
|     name: 'AppJob',
 | |
|     label: '招工就业',
 | |
| 
 | |
|     components: {
 | |
|       JobList,
 | |
|       AddJob,
 | |
|       List,
 | |
|       Add
 | |
|     },
 | |
| 
 | |
|     props: {
 | |
|       instance: Function,
 | |
|       dict: Object,
 | |
|       permissions: Function
 | |
|     },
 | |
| 
 | |
|     computed: {
 | |
|       ...mapState(['user']),
 | |
| 
 | |
|       tabs () {
 | |
|         const tabList = [
 | |
|           {label: '找能人', name: 'List', comp: List, permission: ''},
 | |
|           {label: '找工作', name: 'Statistics', comp: JobList, permission: ''}
 | |
|         ].filter(item => {
 | |
|           return true
 | |
|         })
 | |
| 
 | |
|         return tabList
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     data () {
 | |
|       return {
 | |
|         activeName: 'List',
 | |
|         currIndex: '0',
 | |
|         componentName: '',
 | |
|         params: {},
 | |
|         isShowDetail: false
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     created () {
 | |
|       if (this.$route.query.id) {
 | |
|         this.componentName = this.$route.query?.type
 | |
|         this.params = {id: this.$route.query?.id}
 | |
|         this.isShowDetail = true
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     methods: {
 | |
|       onChange (data) {
 | |
|         if (data.type === 'List') {
 | |
|           this.componentName = 'List'
 | |
|           this.isShowDetail = false
 | |
|           this.params = data.params
 | |
|         }
 | |
| 
 | |
|         if (data.type === 'Add') {
 | |
|           this.componentName = 'Add'
 | |
|           this.isShowDetail = true
 | |
|           this.params = data.params
 | |
|         }
 | |
|         if (data.type === 'JobList') {
 | |
|           this.componentName = 'JobList'
 | |
|           this.isShowDetail = false
 | |
|           this.params = data.params
 | |
|         }
 | |
| 
 | |
|         if (data.type === 'AddJob') {
 | |
|           this.componentName = 'AddJob'
 | |
|           this.isShowDetail = true
 | |
|           this.params = data.params
 | |
|         }
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
| </style>
 |