Commit d178de9b by 温丽香

数据列表修改

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