|
@@ -0,0 +1,306 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-row>
|
|
|
+ <el-input v-model="filterText" placeholder="关键词过滤" style="margin-bottom:30px;width:60%;"/>
|
|
|
+ </el-row>
|
|
|
+ <el-tree
|
|
|
+ ref="tree"
|
|
|
+ :data="data"
|
|
|
+ :props="defaultProps"
|
|
|
+ :filter-node-method="filterNode"
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ class="filter-tree"
|
|
|
+ default-expand-all
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-tabs v-model="activeName" type="card">
|
|
|
+ <el-tab-pane label="部门管理" name="first">
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ v-loading="page.loading"
|
|
|
+ :data="page.data"
|
|
|
+ element-loading-text="Loading"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ @sort-change="sortChange"
|
|
|
+ >
|
|
|
+ <el-table-column label="名称" prop="title" sortable="custom">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.title }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="排序" prop="sort" sortable="custom">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.sort }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column align="center" label="操作" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" @click="departmentEdit(scope.row.id)">编辑</el-button>
|
|
|
+ <el-button size="mini" type="danger" @click="departmentDelete(scope.row.id)"><i
|
|
|
+ class="icon-delete"></i>删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination v-show="page.total>0" :total="page.total" :page.sync="page.param.index"
|
|
|
+ :limit.sync="page.param.length" @pagination="departmentFetchData"/>
|
|
|
+
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="用户管理" name="second">
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col style="text-align: left;margin-bottom: 5px;">
|
|
|
+ <el-button @click="userAdd()">添加</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ v-loading="userPage.loading"
|
|
|
+ :data="userPage.data"
|
|
|
+ element-loading-text="Loading"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ @sort-change="userSortChange"
|
|
|
+ >
|
|
|
+ <el-table-column label="账号" prop="userName" sortable="custom">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.userName }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="电话" prop="mobile" sortable="custom">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.mobile }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="部门" prop="departmentId" sortable="custom">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.real_name }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column align="center" prop="status" label="状态" width="80" sortable="custom">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.status == 1">正常</span>
|
|
|
+ <span v-if="scope.row.status == 2">临时</span>
|
|
|
+ <span v-if="scope.row.status == 3">停用</span>
|
|
|
+ <span v-if="scope.row.status == 4">锁定</span>
|
|
|
+ <span v-if="scope.row.status == 5">删除</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column align="center" label="操作" width="240">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" @click="userRes(scope.row.acc_id)">授权</el-button>
|
|
|
+ <el-button size="mini" @click="userEdit(scope.row.acc_id)">编辑</el-button>
|
|
|
+ <el-button size="mini" type="danger" @click="userDelete(scope.row.acc_id)"><i class="icon-delete"></i>删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination v-show="userPage.total>0" :total="userPage.total" :page.sync="userPage.param.index"
|
|
|
+ :limit.sync="userPage.param.length" @pagination="userFetchData"/>
|
|
|
+
|
|
|
+ </el-tab-pane>
|
|
|
+
|
|
|
+ </el-tabs>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+ import { postJson, getSort } from '@/api/page'
|
|
|
+ import Pagination from '@/components/Pagination'
|
|
|
+ import { getToken } from '@/utils/auth'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ components: { Pagination },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filterText: '',
|
|
|
+ checked: false,
|
|
|
+ data: [],
|
|
|
+ activeName: 'first',
|
|
|
+ orgId: '',
|
|
|
+ header: { 'X-Token': getToken() },
|
|
|
+ defaultProps: {
|
|
|
+ children: 'children',
|
|
|
+ label: 'label'
|
|
|
+ },
|
|
|
+
|
|
|
+ page: {
|
|
|
+ loading: false,
|
|
|
+ data: null,
|
|
|
+ total: 0,
|
|
|
+ param: {
|
|
|
+ index: 1,
|
|
|
+ length: 10,
|
|
|
+ sort: 'updateTime desc',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ userPage: {
|
|
|
+ loading: false,
|
|
|
+ data: null,
|
|
|
+ total: 0,
|
|
|
+ param: {
|
|
|
+ index: 1,
|
|
|
+ length: 10,
|
|
|
+ sort: 'updateTime desc',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ excelImport: {
|
|
|
+ url: '',
|
|
|
+ templateUrl: '/api/v1/machine/excelTemplate?name=machine.xls'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ filterText(val) {
|
|
|
+ this.$refs.tree.filter(val)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.fetchTreeData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ filterNode(value, data) {
|
|
|
+ if (!value) return true
|
|
|
+ return data.label.indexOf(value) !== -1
|
|
|
+ },
|
|
|
+ handleNodeClick(data) {
|
|
|
+ this.page.param.parentId = data.id
|
|
|
+ this.userPage.param.departmentId = data.id
|
|
|
+ this.excelImport.url = '/api/v1/machine/excelImport/' + data.id
|
|
|
+ this.departmentFetchData()
|
|
|
+ this.userFetchData()
|
|
|
+ },
|
|
|
+ fetchTreeData() {
|
|
|
+ postJson('/api/v1/sys/department/tree').then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.data = response.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ change(){
|
|
|
+ this.fetchTreeData()
|
|
|
+ },
|
|
|
+ sortChange(data) {
|
|
|
+ this.page.param.index = 1
|
|
|
+ this.page.param.sort = getSort(data)
|
|
|
+ this.departmentFetchData()
|
|
|
+ },
|
|
|
+ departmentFetchData() {
|
|
|
+ this.page.loading = true
|
|
|
+ postJson('/api/v1/sys/department/pageQuery', this.page.param).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.page.data = response.data
|
|
|
+ this.page.total = response.total
|
|
|
+ this.page.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ departmentEdit(val) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/data/org/add',
|
|
|
+ query: { id: val, pageIndex: this.page.param.index, word: this.page.param.title }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ departmentDelete(val) {
|
|
|
+ this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ postJson('/api/v1/org/delete', { id: val }).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.fetchData()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ userFetchData() {
|
|
|
+ this.userPage.loading = true
|
|
|
+ postJson('/api/v1/sys/user/pageQuery', this.userPage.param).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.userPage.data = response.data
|
|
|
+ this.userPage.total = response.total
|
|
|
+ this.userPage.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ userSortChange(data) {
|
|
|
+ this.userPage.param.index = 1
|
|
|
+ this.userPage.param.sort = getSort(data)
|
|
|
+ this.userFetchData()
|
|
|
+ },
|
|
|
+ userAdd() {
|
|
|
+ this.$router.push('/data/account/add')
|
|
|
+ },
|
|
|
+ userEdit(val) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/data/account/add',
|
|
|
+ query: { id: val, pageIndex: this.userPage.param.index, word: this.userPage.param.title }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ userRes(val) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/data/account/res',
|
|
|
+ query: { id: val, pageIndex: this.userPage.param.index, word: this.userPage.param.title }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ userDelete(val) {
|
|
|
+ this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ postJson('/api/v1/account/delete', { id: val }).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.userFetchData()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ onSuccess(data) {
|
|
|
+ if (data.code === 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '导入成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.deviceFetchData()
|
|
|
+ this.carFetchData()
|
|
|
+ } else {
|
|
|
+ this.$message.error(data.message)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 下载模板
|
|
|
+ */
|
|
|
+ getTemplate() {
|
|
|
+ window.location.href = this.excelImport.templateUrl
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|