|
@@ -1,78 +1,181 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <el-input v-model="filterText" placeholder="Filter keyword" style="margin-bottom:30px;" />
|
|
|
+ <div class="system-container">
|
|
|
+ <el-card class="type-box">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>Test</span>
|
|
|
+ </div>
|
|
|
+ <el-radio-group v-model="formData.appType">
|
|
|
+ <el-radio-button label="">All</el-radio-button>
|
|
|
+ <el-radio-button v-for="item in typeData" :key="item.id" :label="item.value">{{ item.label }}</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-card>
|
|
|
+ <div class="system-box">
|
|
|
+ <div class="list-filter">
|
|
|
+ <el-form ref="filterForm" :model="formData" inline label-width="100px">
|
|
|
+ <el-form-item label="name">
|
|
|
+ <el-input v-model="formData.systemName" class="filter-item" clearable />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="dept">
|
|
|
+ <el-input v-model="formData.deptName" class="filter-item" clearable />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="searchTable">Search</el-button>
|
|
|
+ <el-button type="danger" @click="resetTable('filterForm')">Reset</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div class="item-button">
|
|
|
+ <el-button type="primary">Add</el-button>
|
|
|
+ <el-button type="primary">Upload</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="system-item-box">
|
|
|
+ <div v-for="item in tableData" :key="item.id">
|
|
|
+ <div>
|
|
|
+ <span>{{ item.appType }}</span>
|
|
|
+ <el-button type="text">detail</el-button>
|
|
|
+ <el-button type="text">Edit</el-button>
|
|
|
+ <el-button type="text">Delete</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <el-tree
|
|
|
- ref="tree2"
|
|
|
- :data="data2"
|
|
|
- :props="defaultProps"
|
|
|
- :filter-node-method="filterNode"
|
|
|
- class="filter-tree"
|
|
|
- default-expand-all
|
|
|
- />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-export default {
|
|
|
+import { fetchDictData } from '@/api/dict'
|
|
|
+import { fetchAllSystemList } from '@/api/system'
|
|
|
+
|
|
|
+import { hasValidRecords } from '@/utils/convert'
|
|
|
|
|
|
+export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- filterText: '',
|
|
|
- data2: [{
|
|
|
- id: 1,
|
|
|
- label: 'Level one 1',
|
|
|
- children: [{
|
|
|
- id: 4,
|
|
|
- label: 'Level two 1-1',
|
|
|
- children: [{
|
|
|
- id: 9,
|
|
|
- label: 'Level three 1-1-1'
|
|
|
- }, {
|
|
|
- id: 10,
|
|
|
- label: 'Level three 1-1-2'
|
|
|
- }]
|
|
|
- }]
|
|
|
- }, {
|
|
|
- id: 2,
|
|
|
- label: 'Level one 2',
|
|
|
- children: [{
|
|
|
- id: 5,
|
|
|
- label: 'Level two 2-1'
|
|
|
- }, {
|
|
|
- id: 6,
|
|
|
- label: 'Level two 2-2'
|
|
|
- }]
|
|
|
- }, {
|
|
|
- id: 3,
|
|
|
- label: 'Level one 3',
|
|
|
- children: [{
|
|
|
- id: 7,
|
|
|
- label: 'Level two 3-1'
|
|
|
- }, {
|
|
|
- id: 8,
|
|
|
- label: 'Level two 3-2'
|
|
|
- }]
|
|
|
- }],
|
|
|
- defaultProps: {
|
|
|
- children: 'children',
|
|
|
- label: 'label'
|
|
|
- }
|
|
|
+ // type
|
|
|
+ dictType: 'system_type',
|
|
|
+ typeData: [],
|
|
|
+ // table
|
|
|
+ current: 1,
|
|
|
+ size: 20,
|
|
|
+ total: 0,
|
|
|
+ pageSizeAll: [10, 20, 50, 100, 200, 500],
|
|
|
+ tableData: [],
|
|
|
+ // filter
|
|
|
+ formData: {
|
|
|
+ appType: null,
|
|
|
+ systemName: '',
|
|
|
+ deptName: ''
|
|
|
+ },
|
|
|
+ // others
|
|
|
+ loading: false
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- filterText(val) {
|
|
|
- this.$refs.tree2.filter(val)
|
|
|
- }
|
|
|
+ created() {
|
|
|
+ this.getTypeData()
|
|
|
+ this.searchTable()
|
|
|
},
|
|
|
-
|
|
|
methods: {
|
|
|
- filterNode(value, data) {
|
|
|
- if (!value) return true
|
|
|
- return data.label.indexOf(value) !== -1
|
|
|
+ // 改变每页显示条数
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.current = 1
|
|
|
+ this.size = val
|
|
|
+ this.getTablelist()
|
|
|
+ },
|
|
|
+ // 切换第几页
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.current = val
|
|
|
+ this.getTablelist()
|
|
|
+ },
|
|
|
+ // 重置搜索项
|
|
|
+ resetTable(formName) {
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
+ this.getTablelist()
|
|
|
+ },
|
|
|
+ // 点击搜索按钮
|
|
|
+ searchTable() {
|
|
|
+ this.current = 1
|
|
|
+ this.getTablelist()
|
|
|
+ },
|
|
|
+ // 获取table数据
|
|
|
+ getTablelist() {
|
|
|
+ this.loading = true
|
|
|
+ const params = {
|
|
|
+ current: this.current,
|
|
|
+ size: this.size,
|
|
|
+ params: {
|
|
|
+ delFlag: 0,
|
|
|
+ systemName: this.formData.systemName,
|
|
|
+ deptName: this.formData.deptName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ fetchAllSystemList(params).then(response => {
|
|
|
+ this.loading = false
|
|
|
+ if (hasValidRecords(response)) {
|
|
|
+ this.tableData = response.data.records
|
|
|
+ this.total = response.data.total
|
|
|
+ } else {
|
|
|
+ this.tableData = []
|
|
|
+ this.total = 0
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.loading = false
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: ': ' + error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getTypeData() {
|
|
|
+ fetchDictData(this.dictType).then(response => {
|
|
|
+ if (hasValidRecords(response)) {
|
|
|
+ this.typeData = response.data.records
|
|
|
+ } else {
|
|
|
+ this.typeData = []
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: ': ' + error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
+.system-container {
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ .type-box, .system-box {
|
|
|
+ }
|
|
|
+ .type-box {
|
|
|
+ width: 300px;
|
|
|
+ margin-right: 5px;
|
|
|
+
|
|
|
+ .el-radio-button {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .el-radio-button__inner {
|
|
|
+ width: 100%;
|
|
|
+ border: 0;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .system-box {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|