|
@@ -1,30 +1,43 @@
|
|
|
<template>
|
|
|
- <el-card>
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>Business</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text">More<i class="el-icon-arrow-right" /></el-button>
|
|
|
- </div>
|
|
|
+ <div>
|
|
|
+ <el-card>
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>我的业务</span>
|
|
|
+ <el-button style="float: right; padding: 3px 0" type="text">编辑</el-button>
|
|
|
+ </div>
|
|
|
|
|
|
- <el-scrollbar class="business-content">
|
|
|
- <el-tabs value="all">
|
|
|
- <el-tab-pane label="All" name="all">
|
|
|
- <div v-for="bizType in bizTypeData" :key="bizType" class="type-box">
|
|
|
- <div class="type-title">{{ bizType }}</div>
|
|
|
- <el-button v-for="item in bizData[bizType]" :key="item.id" type="test">{{ item.name }}</el-button>
|
|
|
- </div>
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane v-for="bizType in bizTypeData" :key="bizType" :label="bizType" :name="bizType">
|
|
|
- <div class="type-box">
|
|
|
- <el-button v-for="item in bizData[bizType]" :key="item.id" type="test">{{ item.name }}</el-button>
|
|
|
- </div>
|
|
|
- </el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
- </el-scrollbar>
|
|
|
- </el-card>
|
|
|
+ <el-scrollbar class="business-content">
|
|
|
+ <el-tabs v-loading="loading" value="all">
|
|
|
+ <el-tab-pane label="所有" name="all">
|
|
|
+ <div v-for="bizType in allBizTypeData" v-if="!isNull(bizData[bizType.value])" :key="bizType.id" class="type-box">
|
|
|
+ <div class="type-title">{{ bizType.label }}</div>
|
|
|
+ <el-button v-for="item in bizData[bizType.value]" :key="item.id" type="test">{{ item.businessName }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane v-for="bizType in bizTypeData" :key="bizType.id" :label="bizType.label" :name="bizType.type + bizType.value">
|
|
|
+ <div class="type-box">
|
|
|
+ <el-button v-for="item in bizData[bizType.value]" :key="item.id" type="test">{{ item.businessName }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-scrollbar>
|
|
|
+ </el-card>
|
|
|
+ <business-edit />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import BusinessEdit from './BusinessEdit'
|
|
|
+
|
|
|
+import { fetchDictData } from '@/api/dict'
|
|
|
+import { isNull } from '@/utils/convert'
|
|
|
+import { fetchTableList } from '@/api/biz'
|
|
|
+
|
|
|
export default {
|
|
|
+ name: 'HomeBusiness',
|
|
|
+ components: {
|
|
|
+ BusinessEdit
|
|
|
+ },
|
|
|
props: {
|
|
|
pageSize: {
|
|
|
type: Number,
|
|
@@ -37,63 +50,89 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- rawData: [
|
|
|
- { id: '0', code: '1', name: 'SystemSSSSSSSSSSSSSSSSSS1', type: 'type1', link: '', icon: 'icon-1' },
|
|
|
- { id: '1', code: '2', name: 'SystemA2', type: 'type1', link: '', icon: 'icon-2' },
|
|
|
- { id: '2', code: '3', name: 'SystemBC3', type: 'type1', link: '', icon: 'icon-3' },
|
|
|
- { id: '3', code: '4', name: 'SystemDEF4', type: 'type1', link: '', icon: 'icon-4' },
|
|
|
- { id: '4', code: '5', name: 'SystemGGGGGGGGG5', type: 'type2', link: '', icon: 'icon-5' },
|
|
|
- { id: '5', code: '6', name: 'SystemHH6', type: 'type2', link: '', icon: 'icon-6' },
|
|
|
- { id: '6', code: '7', name: 'System7', type: 'type2', link: '', icon: 'icon-7' },
|
|
|
- { id: '7', code: '8', name: 'System8', type: 'type3', link: '', icon: 'icon-8' },
|
|
|
- { id: '8', code: '9', name: 'System9', type: 'type3', link: '', icon: 'icon-9' },
|
|
|
- { id: '9', code: '10', name: 'System10', type: 'type3', link: '', icon: 'icon-10' },
|
|
|
- { id: '10', code: '11', name: 'System11', type: 'type3', link: '', icon: 'icon-11' },
|
|
|
- { id: '11', code: '12', name: 'System12', type: 'type4', link: '', icon: 'icon-12' },
|
|
|
- { id: '12', code: '13', name: 'System13', type: 'type3', link: '', icon: 'icon-13' },
|
|
|
- { id: '13', code: '1', name: 'SystemSSSSSSSSSSSSSSSSSS1', type: 'type1', link: '', icon: 'icon-1' },
|
|
|
- { id: '14', code: '2', name: 'SystemA2', type: 'type1', link: '', icon: 'icon-2' },
|
|
|
- { id: '15', code: '3', name: 'SystemBC3', type: 'type1', link: '', icon: 'icon-3' },
|
|
|
- { id: '16', code: '4', name: 'SystemDEF4', type: 'type1', link: '', icon: 'icon-4' },
|
|
|
- { id: '17', code: '5', name: 'SystemGGGGGGGGG5', type: 'type2', link: '', icon: 'icon-5' },
|
|
|
- { id: '18', code: '6', name: 'SystemHH6', type: 'type2', link: '', icon: 'icon-6' },
|
|
|
- { id: '19', code: '7', name: 'System7', type: 'type2', link: '', icon: 'icon-7' },
|
|
|
- { id: '20', code: '8', name: 'System8', type: 'type3', link: '', icon: 'icon-8' },
|
|
|
- { id: '21', code: '9', name: 'System9', type: 'type3', link: '', icon: 'icon-9' },
|
|
|
- { id: '22', code: '10', name: 'System10', type: 'type3', link: '', icon: 'icon-10' },
|
|
|
- { id: '23', code: '11', name: 'System11', type: 'type3', link: '', icon: 'icon-11' },
|
|
|
- { id: '24', code: '12', name: 'System12', type: 'type4', link: '', icon: 'icon-12' },
|
|
|
- { id: '25', code: '13', name: 'System13', type: 'type3', link: '', icon: 'icon-13' }
|
|
|
- ],
|
|
|
- bizTypeData: ['type1', 'type2', 'type3', 'type4']
|
|
|
+ dictType: 'bisiness_type',
|
|
|
+ // table
|
|
|
+ current: 1,
|
|
|
+ size: 20,
|
|
|
+ allBizTypeData: [],
|
|
|
+ bizTypeData: [],
|
|
|
+ bizData: {},
|
|
|
+ // others
|
|
|
+ loading: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- bizData() {
|
|
|
- const result = {}
|
|
|
- if (this.rawData && this.rawData.length > 0) {
|
|
|
- this.rawData.forEach(item => {
|
|
|
- const group = item.type
|
|
|
- result[group] = result[group] || []
|
|
|
- result[group].push(item)
|
|
|
- })
|
|
|
- }
|
|
|
- return result
|
|
|
- }
|
|
|
},
|
|
|
created() {
|
|
|
+ this.getBizTypeData()
|
|
|
// this.formatData()
|
|
|
},
|
|
|
methods: {
|
|
|
- formatData() {
|
|
|
- this.carouselData2 = []
|
|
|
- if (this.rawData && this.rawData.length > 0) {
|
|
|
- const len = this.rawData.length
|
|
|
- const page = Math.ceil(len / this.pageSize)
|
|
|
- for (var i = 0; i < page; i++) {
|
|
|
- this.carouselData2.push(this.rawData.slice(i * this.pageSize, (i + 1) * this.pageSize))
|
|
|
+ getBizTypeData() {
|
|
|
+ this.loading = true
|
|
|
+ fetchDictData(this.dictType).then(response => {
|
|
|
+ if (!isNull(response.data)) {
|
|
|
+ this.allBizTypeData = response.data
|
|
|
+ this.getBizData()
|
|
|
+ } else {
|
|
|
+ this.allBizTypeData = []
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.loading = false
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: '获取应用类型出错: ' + error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getBizData() {
|
|
|
+ const promises = []
|
|
|
+ for (let i = 0; i < this.allBizTypeData.length; i++) {
|
|
|
+ const type = this.allBizTypeData[i]
|
|
|
+ const params = {
|
|
|
+ page: this.current,
|
|
|
+ size: this.size,
|
|
|
+ params: {
|
|
|
+ businessType: type.value
|
|
|
+ }
|
|
|
}
|
|
|
+ promises.push(
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ fetchTableList(params).then(response => {
|
|
|
+ debugger
|
|
|
+ if (!isNull(response.data) && !isNull(response.data.records)) {
|
|
|
+ this.bizData[type.value] = response.data.records
|
|
|
+ this.bizTypeData.push(type)
|
|
|
+ } else {
|
|
|
+ this.bizData[type.value] = []
|
|
|
+ }
|
|
|
+ resolve()
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.loading = false
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: `获取${type.label}类型应用出错: ` + error.message
|
|
|
+ })
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ )
|
|
|
}
|
|
|
+ Promise.all(promises).then(res => {
|
|
|
+ debugger
|
|
|
+ this.loading = false
|
|
|
+ }).catch(error => {
|
|
|
+ debugger
|
|
|
+ console.log(error)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|