Commit d178de9b by 温丽香

数据列表修改

1 parent b8a5458d
Pipeline #3855 passed
in 1 minute 51 seconds
...@@ -56,7 +56,7 @@ module.exports = { ...@@ -56,7 +56,7 @@ module.exports = {
'no-unneeded-ternary': 2, // 禁止不必要的嵌套 'no-unneeded-ternary': 2, // 禁止不必要的嵌套
'no-nested-ternary': 2, // 禁用嵌套的三目运算符 'no-nested-ternary': 0, // 禁用嵌套的三目运算符
'no-const-assign': 2, // 禁止修改 const 变量 'no-const-assign': 2, // 禁止修改 const 变量
......
...@@ -17,7 +17,9 @@ const TABLE = '/table' ...@@ -17,7 +17,9 @@ const TABLE = '/table'
export const getTable = data => axios(GET, FRONT + TABLE + '/query_list', data) export const getTable = data => axios(GET, FRONT + TABLE + '/query_list', data)
export const createTable = data => axios(POST, FRONT + TABLE + '/create', data) export const createTable = data => axios(POST, FRONT + TABLE + '/create', data)
export const deleteTable = data => axios(GET, FRONT + TABLE + '/delete', data) export const deleteTable = data => axios(GET, FRONT + TABLE + '/delete', data)
export const insertTable = data => axios(POST, FRONT + TABLE + '/insert', data) export const addData = data => axios(POST, FRONT + TABLE + '/data/insert', data)
export const getData = data => axios(GET, FRONT + TABLE + '/data/query_list', data)
export const deleteData = data => axios(POST, FRONT + TABLE + '/data/delete', data)
const APPID = '/appid' const APPID = '/appid'
export const getApp = data => axios(GET, FRONT + APPID + '/query_list', data) export const getApp = data => axios(GET, FRONT + APPID + '/query_list', data)
......
...@@ -36,8 +36,9 @@ export const stringToBase64 = str => { ...@@ -36,8 +36,9 @@ export const stringToBase64 = str => {
export const base64ToString = base64 => { export const base64ToString = base64 => {
// 对base64转编码 // 对base64转编码
const decode = atob(base64) const decode = atob(base64)
const temp = decode.replace(/%/g, '%25')
// 编码转字符串 // 编码转字符串
const str = decodeURI(decode) const str = decodeURI(temp)
return str return str
} }
......
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
:data="{ :data="{
list: tokenList, list: tokenList,
total: total, total: total,
}"> }"
:outerLoading="loadingStatus">
<div slot="operate" slot-scope="row"> <div slot="operate" slot-scope="row">
<span class="operate" @click="handleEdit(row)">编辑</span> <span class="operate" @click="handleEdit(row)">编辑</span>
<span class="operate operate-delete" @click="handleDelete(row)">删除</span> <span class="operate operate-delete" @click="handleDelete(row)">删除</span>
......
...@@ -12,15 +12,16 @@ ...@@ -12,15 +12,16 @@
:data="{ :data="{
list: tokenList, list: tokenList,
total: total, total: total,
}"> }"
:outerLoading="loadingStatus">
<div slot="secret" slot-scope="row"> <div slot="secret" slot-scope="row">
<span v-if="showSecret === row.number" class="secret-box">{{row.desc}}</span> <span v-if="showSecret === row.appid" class="secret-box">{{row.secret}}</span>
<span v-else class="secret-box">********</span> <span v-else class="secret-box">********</span>
<i class="el-icon-view eye-btn" @mousedown="showSecret = row.number" @mouseup="showSecret = ''"></i> <i class="el-icon-view eye-btn" @mousedown="showSecret = row.appid" @mouseup="showSecret = ''"></i>
</div> </div>
<div slot="operate" slot-scope="row"> <div slot="operate" slot-scope="row">
<span class="operate" v-if="row.number === 1" @click="setHostApp">设置为主应用</span> <span class="operate" v-if="row.number === 1" @click="setHostApp(row)">设置为主应用</span>
<span class="operate" v-else @click="cancelHostApp">取消设置为主应用</span> <span class="operate" v-else @click="setHostApp(row)">取消设置为主应用</span>
<span class="operate operate-delete" @click="handleDelete(row)">删除</span> <span class="operate operate-delete" @click="handleDelete(row)">删除</span>
</div> </div>
</st-table> </st-table>
...@@ -31,16 +32,17 @@ ...@@ -31,16 +32,17 @@
</template> </template>
<script> <script>
import { getApp } from '@/axios' import { getApp, deleteApp, setApp } from '@/axios'
import Dialog from '@/helpers/dialog' import Dialog from '@/helpers/dialog'
export default { export default {
data() { data() {
return { return {
showSecret: '', showSecret: '',
loadingStatus: false,
definitions: [ definitions: [
{ {
label: 'APPID', label: 'APPID',
render: 'number' render: 'appid'
}, },
{ {
label: 'Secret', label: 'Secret',
...@@ -49,15 +51,15 @@ export default { ...@@ -49,15 +51,15 @@ export default {
}, },
{ {
label: '创建时间', label: '创建时间',
render: 'type' render: 'create_date'
}, },
{ {
label: '设备数量', label: '设备数量',
render: 'desc' render: 'devices'
}, },
{ {
label: '说明', label: '说明',
render: 'desc' render: 'description'
}, },
{ {
label: '操作', label: '操作',
...@@ -67,7 +69,7 @@ export default { ...@@ -67,7 +69,7 @@ export default {
}, },
], ],
tokenList: [], tokenList: [],
total: 34 total: 0
} }
}, },
mounted() { mounted() {
...@@ -75,24 +77,31 @@ export default { ...@@ -75,24 +77,31 @@ export default {
}, },
methods: { methods: {
async getData() { async getData() {
this.loadingStatus = true
const res = await getApp({ pages: 0, pagesize: 10 }) const res = await getApp({ pages: 0, pagesize: 10 })
if (res && res.data && res.data.code === 0) { if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.apps this.tokenList = res.data.data.apps
this.total = res.data.data.total this.total = res.data.data.total
} }
this.loadingStatus = false
}, },
async handleDelete(row) { async handleDelete(row) {
console.log(row)
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此应用?' }) const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此应用?' })
if (!confirmDelete) return if (!confirmDelete) return
const res = await this.getData() const res = await deleteApp({ appid: row.appid })
if (res) { if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
this.getData()
}
},
async setHostApp(row) {
const res = await setApp({ appid: row.appid, mainapp: 1, username: 'test' })
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功') Toast.success('操作成功')
this.getData() this.getData()
} }
}, },
setHostApp() {},
cancelHostApp() {} cancelHostApp() {}
} }
} }
......
...@@ -20,9 +20,10 @@ ...@@ -20,9 +20,10 @@
:data="{ :data="{
list: tokenList, list: tokenList,
total: total, total: total,
}"> }"
:outerLoading="loadingStatus">
<div slot="operate" slot-scope="row"> <div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/data/edit' })">编辑</span> <span class="operate" @click="$router.push({ path: '/data/edit', query: { name: row.name, columns: row.columns } })">编辑</span>
<span class="operate operate-delete" @click="handleDelete(row)">删除</span> <span class="operate operate-delete" @click="handleDelete(row)">删除</span>
</div> </div>
</st-table> </st-table>
...@@ -66,6 +67,7 @@ export default { ...@@ -66,6 +67,7 @@ export default {
return { return {
inputVal: '', inputVal: '',
showDialog: false, showDialog: false,
loadingStatus: false,
form: {}, form: {},
definitions: [ definitions: [
{ {
...@@ -126,11 +128,13 @@ export default { ...@@ -126,11 +128,13 @@ export default {
}, },
methods: { methods: {
async getData() { async getData() {
this.loadingStatus = true
const res = await getTable({ pages: this.currentPage - 1, pagesize: this.currentSize }) const res = await getTable({ pages: this.currentPage - 1, pagesize: this.currentSize })
if (res && res.data && res.data.code === 0) { if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.tables this.tokenList = res.data.data.tables
this.total = res.data.data.total this.total = res.data.data.total
} }
this.loadingStatus = false
}, },
cancelSubmit() { cancelSubmit() {
this.form = {} this.form = {}
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
:data="{ :data="{
list: tokenList, list: tokenList,
total: total, total: total,
}"> }"
:outerLoading="loadingStatus">
<div slot="value" slot-scope="row"> <div slot="value" slot-scope="row">
<span v-if="row.type === 'number' || row.type === 'string'">{{row.value}}</span> <span v-if="row.type === 'number' || row.type === 'string'">{{row.value}}</span>
<span v-if="row.type === 'blob'" style="line-height: 28px"> <span v-if="row.type === 'blob'" style="line-height: 28px">
...@@ -54,6 +55,7 @@ export default { ...@@ -54,6 +55,7 @@ export default {
data() { data() {
return { return {
form: {}, form: {},
loadingStatus: false,
definitions: [ definitions: [
{ {
label: '字段', label: '字段',
...@@ -74,6 +76,7 @@ export default { ...@@ -74,6 +76,7 @@ export default {
} }
}, },
async mounted() { async mounted() {
this.loadingStatus = true
const res = await detailParameter({ name: this.$route.query.name }) const res = await detailParameter({ name: this.$route.query.name })
if (res && res.data && res.data.code === 0) { if (res && res.data && res.data.code === 0) {
this.form = res.data this.form = res.data
...@@ -90,6 +93,7 @@ export default { ...@@ -90,6 +93,7 @@ export default {
this.tokenList.push({ field: key, type: 'table', value: tableObj[key] }) this.tokenList.push({ field: key, type: 'table', value: tableObj[key] })
} }
} }
this.loadingStatus = false
}, },
methods: { methods: {
calculateByte: base64 => calculateByte(base64), calculateByte: base64 => calculateByte(base64),
......
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
@row-click="rowClick" @row-click="rowClick"
@cell-click="cellClick" @cell-click="cellClick"
style="width: 100%"> style="width: 100%"
v-loading="loadingStatus">
<el-table-column label="字段"> <el-table-column label="字段">
<template slot-scope="scope"> <template slot-scope="scope">
<input type="text" v-model="scope.row.field" @blur="handleBlur" placeholder="请输入"> <input type="text" v-model="scope.row.field" @blur="handleBlur" placeholder="请输入">
...@@ -134,6 +135,7 @@ export default { ...@@ -134,6 +135,7 @@ export default {
form: {}, form: {},
rules: [], rules: [],
file: '', file: '',
loadingStatus: false,
typeOptions: [{ typeOptions: [{
value: 'number', value: 'number',
label: 'number' label: 'number'
...@@ -184,6 +186,7 @@ export default { ...@@ -184,6 +186,7 @@ export default {
} }
}, },
async getData() { async getData() {
this.loadingStatus = true
const res = await detailParameter({ name: this.$route.query.name }) const res = await detailParameter({ name: this.$route.query.name })
if (res && res.data && res.data.code === 0) { if (res && res.data && res.data.code === 0) {
this.form = res.data this.form = res.data
...@@ -200,6 +203,7 @@ export default { ...@@ -200,6 +203,7 @@ export default {
this.tableData.push({ field: key, type: 'table', value: tableObj[key] }) this.tableData.push({ field: key, type: 'table', value: tableObj[key] })
} }
} }
this.loadingStatus = false
}, },
cancel() { cancel() {
this.$router.push({ path: '/params' }) this.$router.push({ path: '/params' })
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
}" }"
:pagination="false" :pagination="false"
highlight-current-row highlight-current-row
@row-click="handleClickRow"> @row-click="handleClickRow"
:outerLoading="loadingOne">
<div slot="operate" slot-scope="row"> <div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name }})">详情</span> <span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name }})">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit', query: { name: row.name, level: 1 } })">编辑</span> <span class="operate" @click="$router.push({ path: '/params/edit', query: { name: row.name, level: 1 } })">编辑</span>
...@@ -58,7 +59,8 @@ ...@@ -58,7 +59,8 @@
:data="{ :data="{
list: twoList, list: twoList,
total: twoTotal, total: twoTotal,
}"> }"
:outerLoading="loadingTwo">
<div slot="operate" slot-scope="row"> <div slot="operate" slot-scope="row">
<span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name } })">详情</span> <span class="operate" @click="$router.push({ path: '/params/detail', query: { name: row.name } })">详情</span>
<span class="operate" @click="$router.push({ path: '/params/edit', query: { name: row.name, level: 2 } })">编辑</span> <span class="operate" @click="$router.push({ path: '/params/edit', query: { name: row.name, level: 2 } })">编辑</span>
...@@ -91,6 +93,9 @@ export default { ...@@ -91,6 +93,9 @@ export default {
twoTotal: 0, twoTotal: 0,
oneCurrentPage: 1, oneCurrentPage: 1,
twoCurrentPage: 1, twoCurrentPage: 1,
loadingOne: false,
loadingTwo: false,
parentLevel: '',
definitions: [ definitions: [
{ {
label: '序号', label: '序号',
...@@ -123,18 +128,22 @@ export default { ...@@ -123,18 +128,22 @@ export default {
}, },
methods: { methods: {
async getOneData() { async getOneData() {
this.loadingOne = true
const oneLevel = await getParameter({ base: 1, pages: this.oneCurrentPage - 1, pagesize: 10 }) const oneLevel = await getParameter({ base: 1, pages: this.oneCurrentPage - 1, pagesize: 10 })
if (oneLevel && oneLevel.data && oneLevel.data.code === 0) { if (oneLevel && oneLevel.data && oneLevel.data.code === 0) {
this.oneList = oneLevel.data.parameters.datas this.oneList = oneLevel.data.parameters.datas
this.oneTotal = oneLevel.data.parameters.total this.oneTotal = oneLevel.data.parameters.total
} }
this.loadingOne = false
}, },
async getTwoData() { async getTwoData() {
const twoLevel = await getParameter({ base: 0, pages: this.twoCurrentPage - 1, pagesize: 10 }) this.loadingTwo = true
const twoLevel = await getParameter({ base: 0, parent: this.parentLevel, pages: this.twoCurrentPage - 1, pagesize: 10 })
if (twoLevel && twoLevel.data && twoLevel.data.code === 0) { if (twoLevel && twoLevel.data && twoLevel.data.code === 0) {
this.twoList = twoLevel.data.parameters.datas this.twoList = twoLevel.data.parameters.datas
this.twoTotal = twoLevel.data.parameters.total this.twoTotal = twoLevel.data.parameters.total
} }
this.loadingTwo = false
}, },
async handleDelete(row, level) { async handleDelete(row, level) {
const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此模板?' }) const confirmDelete = await Dialog.confirm('提示', { message: '是否删除此模板?' })
...@@ -148,7 +157,8 @@ export default { ...@@ -148,7 +157,8 @@ export default {
} }
}, },
handleClickRow(row, column, event) { handleClickRow(row, column, event) {
console.log(row) this.parentLevel = row.name
this.getTwoData()
}, },
handleOneCurrentChange(val) { handleOneCurrentChange(val) {
this.oneCurrentPage = val this.oneCurrentPage = val
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!