|
@@ -1,6 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<div class="tab-content">
|
|
<div class="tab-content">
|
|
- <div class="subtitle">网关 <el-button type="primary" size="small" @click="addDevice()">添加网关</el-button></div>
|
|
|
|
|
|
+ <div class="subtitle"><span></span> <el-button type="primary" size="small" @click="addDevice()">添加网关</el-button></div>
|
|
<el-table :data="tableData" style="width: 100%" v-loading="loading">
|
|
<el-table :data="tableData" style="width: 100%" v-loading="loading">
|
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
|
<el-table-column prop="id" label="ID" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="id" label="ID" show-overflow-tooltip></el-table-column>
|
|
@@ -18,26 +18,6 @@
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
<pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum" v-model:limit="params.pageSize" @pagination="getList()" />
|
|
<pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum" v-model:limit="params.pageSize" @pagination="getList()" />
|
|
- <el-divider></el-divider>
|
|
|
|
- <div class="subtitle">设备 <el-button type="primary" size="small">添加设备</el-button></div>
|
|
|
|
- <el-table :data="tableData" style="width: 100%" v-loading="loading">
|
|
|
|
- <el-table-column type="index" label="序号" width="60" align="center" />
|
|
|
|
- <el-table-column prop="id" label="ID" show-overflow-tooltip></el-table-column>
|
|
|
|
- <el-table-column prop="projectName" label="大屏名称" show-overflow-tooltip></el-table-column>
|
|
|
|
- <el-table-column prop="remarks" label="描述" show-overflow-tooltip></el-table-column>
|
|
|
|
- <el-table-column prop="createdAt" label="创建时间" min-width="100" align="center"></el-table-column>
|
|
|
|
- <el-table-column prop="updatedAt" label="更新时间" min-width="100" align="center"></el-table-column>
|
|
|
|
- <el-table-column label="操作" width="200" align="center">
|
|
|
|
- <template #default="scope">
|
|
|
|
- <!-- <el-button size="small" text type="primary" @click="preview(scope.row)">预览</el-button>
|
|
|
|
- <el-button size="small" text type="warning" v-auth="'edit'" @click="addOrEdit(scope.row)">编辑</el-button>
|
|
|
|
- <el-button size="small" text type="warning" @click="edit(scope.row)">设计大屏</el-button>
|
|
|
|
- <el-button size="small" text type="info" v-auth="'del'" @click="onDel(scope.row)">删除</el-button> -->
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- <pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum" v-model:limit="params.pageSize" @pagination="getList()" />
|
|
|
|
-
|
|
|
|
<el-dialog title="添加网关" v-model="isShowDialog" width="400">
|
|
<el-dialog title="添加网关" v-model="isShowDialog" width="400">
|
|
<el-form>
|
|
<el-form>
|
|
<el-form-item label="产品">
|
|
<el-form-item label="产品">
|
|
@@ -45,54 +25,75 @@
|
|
<el-option v-for="item in productList" :key="item.value" :label="item.label" :value="item.value" />
|
|
<el-option v-for="item in productList" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="设备">
|
|
|
|
|
|
+ <el-form-item label="设备" style="margin-bottom: 0;">
|
|
<el-select v-model="form.resourcesTypes" filterable placeholder="选择设备" :clearable="false" style="width: 100%">
|
|
<el-select v-model="form.resourcesTypes" filterable placeholder="选择设备" :clearable="false" style="width: 100%">
|
|
<el-option v-for="item in deviceList" :key="item.value" :label="item.label" :value="item.value" />
|
|
<el-option v-for="item in deviceList" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
+ <el-button @click="onCancel">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="onSubmit">确 定</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { reactive, ref } from 'vue';
|
|
import { reactive, ref } from 'vue';
|
|
-import api from '/@/api/device';
|
|
|
|
|
|
+import deviceApi from '/@/api/device';
|
|
|
|
+import api from '/@/api/projects';
|
|
import { useSearch } from '/@/hooks/useCommon';
|
|
import { useSearch } from '/@/hooks/useCommon';
|
|
import { useRoute } from 'vue-router';
|
|
import { useRoute } from 'vue-router';
|
|
|
|
+import { ElMessage } from 'element-plus';
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
|
|
|
|
const isShowDialog = ref(false)
|
|
const isShowDialog = ref(false)
|
|
const productList = ref<any[]>([])
|
|
const productList = ref<any[]>([])
|
|
const deviceList = ref<any[]>([])
|
|
const deviceList = ref<any[]>([])
|
|
|
|
|
|
|
|
+const projectsCode = route.params.id
|
|
|
|
+
|
|
const form = reactive({
|
|
const form = reactive({
|
|
productKey: '',
|
|
productKey: '',
|
|
- projectsCode: route.params.id,
|
|
|
|
|
|
+ projectsCode,
|
|
resourcesKey: '1',
|
|
resourcesKey: '1',
|
|
resourcesTypes: '',
|
|
resourcesTypes: '',
|
|
})
|
|
})
|
|
|
|
|
|
-const { params, tableData, getList, loading } = useSearch<any[]>(api.product.getList, 'data', { pageSize: 5, status: 1 });
|
|
|
|
|
|
+const { params, tableData, getList, loading } = useSearch<any[]>(api.getProjectResourcesByCode, '', { projectsCode });
|
|
|
|
|
|
getList();
|
|
getList();
|
|
getProducts();
|
|
getProducts();
|
|
|
|
|
|
-
|
|
|
|
function getProducts() {
|
|
function getProducts() {
|
|
- api.product.getList({ pageSize: 500, status: 1 }).then((res: any) => {
|
|
|
|
- productList.value = (res?.product || []).map(item => ({ label: item.name, value: item.key }))
|
|
|
|
|
|
+ deviceApi.product.getList({ pageSize: 500, status: 1 }).then((res: any) => {
|
|
|
|
+ productList.value = (res?.product || []).map((item: any) => ({ label: item.name, value: item.key }))
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function onCancel() {
|
|
|
|
+ isShowDialog.value = false
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function onSubmit() {
|
|
|
|
+ api.bindResources(form).then((res: any) => {
|
|
|
|
+ getList()
|
|
|
|
+ isShowDialog.value = false
|
|
|
|
+ ElMessage.success('添加成功')
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-function addDevice(type: string) {
|
|
|
|
|
|
+function addDevice() {
|
|
isShowDialog.value = true
|
|
isShowDialog.value = true
|
|
}
|
|
}
|
|
|
|
|
|
function getDivices(productKey: string) {
|
|
function getDivices(productKey: string) {
|
|
form.resourcesTypes = ''
|
|
form.resourcesTypes = ''
|
|
- api.device.allList({ productKey }).then((res: any) => {
|
|
|
|
- deviceList.value = (res?.device || []).map(item => ({ label: item.name, value: item.key }))
|
|
|
|
|
|
+ deviceApi.device.allList({ productKey }).then((res: any) => {
|
|
|
|
+ deviceList.value = (res?.device || []).map((item: any) => ({ label: item.name, value: item.id }))
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|