This commit is contained in:
曹前明 2022-07-18 11:16:32 +08:00
parent 5d492ff497
commit 21434b4ef8
4 changed files with 34 additions and 20 deletions

View File

@ -310,7 +310,7 @@ export default {
this.$emit("dataChange", res, this.tableData); this.$emit("dataChange", res, this.tableData);
} catch (error) { } catch (error) {
this.loading = false; this.loading = false;
if(error.response.data){ if(error.response && error.response.data){
this.emptyText = error.response.data.err_msg; this.emptyText = error.response.data.err_msg;
}else{ }else{
this.emptyText = error.statusText || "数据格式错误"; this.emptyText = error.statusText || "数据格式错误";

View File

@ -2,6 +2,9 @@ import tool from '@/utils/tool';
export function permission(data) { export function permission(data) {
let permissions = tool.data.get("PERMISSIONS"); let permissions = tool.data.get("PERMISSIONS");
if (permissions.indexOf('superuser')>-1){
return true
}
if(!permissions){ if(!permissions){
return false; return false;
} }

View File

@ -2,34 +2,37 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" icon="el-icon-refresh" @click="syncData" <el-button type="primary" icon="el-icon-refresh" @click="syncData" :syncLoading="syncLoading"
>同步</el-button >同步</el-button
> >
</div> </div>
<div class="right-panel"> <div class="right-panel">
<el-input <!-- <el-input
v-model="search.keyword" v-model="query.code"
placeholder="编号" placeholder="编号"
clearable clearable
@click="upsearch" @click="handleQuery"
></el-input> ></el-input>
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="upsearch" @click="handleQuery"
></el-button> ></el-button> -->
</div> </div>
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
<scTable <scTable
ref="table" ref="table"
:apiObj="apiObj" :apiObj="apiObj"
:pageStr="pageStr"
:pageSizeStr="pageSizeStr"
:parseData="parseData"
row-key="id" row-key="id"
@selection-change="selectionChange" @selection-change="selectionChange"
stripe stripe
@resetQuery="resetQuery" @resetQuery="resetQuery"
> >
<el-table-column type="selection" width="50"></el-table-column> <!-- <el-table-column type="selection" width="50"></el-table-column> -->
<el-table-column label="序号" type="index" width="50"></el-table-column> <el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column <el-table-column
label="喇叭名称" label="喇叭名称"
@ -46,14 +49,14 @@
<el-table-column <el-table-column
label="设备sn" label="设备sn"
prop="sn" prop="sn"
min-width="90" min-width="150"
></el-table-column> ></el-table-column>
<el-table-column label="ip" prop="extra" min-width="90"> <el-table-column label="ip" prop="extra" min-width="90">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.extra">{{ scope.row.extra.ip }}</span> <span v-if="scope.row.extra">{{ scope.row.extra.ip }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" prop="extra" min-width="90"> <el-table-column label="在线状态" prop="extra" min-width="90">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.extra">{{ scope.row.extra.online }}</span> <span v-if="scope.row.extra">{{ scope.row.extra.online }}</span>
</template> </template>
@ -105,6 +108,15 @@ export default {
return { return {
syncLoading: false, syncLoading: false,
apiObj: this.$API.am.tdevice.speaker, apiObj: this.$API.am.tdevice.speaker,
pageStr: "page",
pageSizeStr: "pageSize",
parseData: (res) => {
return {
data: res, //
rows: res.rows, //
total: res.total, //
};
},
dialogSave: false, dialogSave: false,
limitedVisible: false, limitedVisible: false,
query: {}, query: {},
@ -128,7 +140,9 @@ export default {
}, },
// //
upsearch() {}, handleQuery() {
this.$refs.table.refresh();
},
resetQuery() { resetQuery() {
this.query = {}; this.query = {};

View File

@ -11,17 +11,17 @@
> >
</div> </div>
<div class="right-panel"> <div class="right-panel">
<el-input <!-- <el-input
v-model="search.keyword" v-model="query.channelCode"
placeholder="编号" placeholder="编号"
clearable clearable
@click="upsearch" @click="handleQuery"
></el-input> ></el-input>
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="upsearch" @click="handleQuery"
></el-button> ></el-button> -->
</div> </div>
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
@ -151,9 +151,6 @@ export default {
syncLoading: false, syncLoading: false,
query: {}, query: {},
selection: [], selection: [],
search: {
keyword: null,
},
channelId: "", channelId: "",
params: { params: {
json: { json: {
@ -246,7 +243,7 @@ export default {
}, },
// //
upsearch() {}, handleQuery() {this.$refs.table.refresh();},
resetQuery() { resetQuery() {
this.query = {}; this.query = {};