|
@@ -61,7 +61,7 @@
|
|
|
<div class="card-header">
|
|
<div class="card-header">
|
|
|
<span>传感器台账</span>
|
|
<span>传感器台账</span>
|
|
|
<div>
|
|
<div>
|
|
|
- <el-button type="primary" @click="inportSensor">导入</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" @click="handleImport">导入</el-button>
|
|
|
<el-button type="primary" @click="goadd">添加</el-button>
|
|
<el-button type="primary" @click="goadd">添加</el-button>
|
|
|
<el-button type="danger" @click="deleteall">批量删除</el-button>
|
|
<el-button type="danger" @click="deleteall">批量删除</el-button>
|
|
|
<el-button type="primary" plain @click="ziduanshow = true">显示字段</el-button>
|
|
<el-button type="primary" plain @click="ziduanshow = true">显示字段</el-button>
|
|
@@ -266,17 +266,42 @@
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
|
- <div style="margin-top: 10px" v-if="currentname != ''">变量 {{currentname}} 数值曲线</div>
|
|
|
|
|
|
|
+ <div style="margin-top: 10px" v-if="currentname != ''">变量 {{ currentname }} 数值曲线</div>
|
|
|
<!-- 显示历史数据 折线图-->
|
|
<!-- 显示历史数据 折线图-->
|
|
|
<div ref="chartlinediv" style="height: 250px" v-loading="isloading"></div>
|
|
<div ref="chartlinediv" style="height: 250px" v-loading="isloading"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
|
|
|
|
+ <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
|
|
|
|
+ :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
|
|
|
|
+ :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag
|
|
|
|
|
+ :data="{deviceId:uploadParams}">
|
|
|
|
|
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
+ <template #tip>
|
|
|
|
|
+ <div class="el-upload__tip text-center">
|
|
|
|
|
+ <span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
|
|
+ <!-- <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
|
|
|
|
+ @click="importTemplate">下载模板</el-link> -->
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <div class="dialog-footer">
|
|
|
|
|
+ <el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
|
|
+ <el-button @click="upload.open = false">取 消</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
|
|
+// import { ElMessage } from 'element-plus'
|
|
|
import { onMounted, ref, watch, watchEffect } from "vue";
|
|
import { onMounted, ref, watch, watchEffect } from "vue";
|
|
|
import { LayTree } from "@layui/layui-vue";
|
|
import { LayTree } from "@layui/layui-vue";
|
|
|
import "@layui/layui-vue/lib/index.css";
|
|
import "@layui/layui-vue/lib/index.css";
|
|
@@ -303,6 +328,8 @@ const ziduanshow = ref(false);
|
|
|
|
|
|
|
|
const tableref = ref(null);
|
|
const tableref = ref(null);
|
|
|
|
|
|
|
|
|
|
+const uploadParams = ref();
|
|
|
|
|
+
|
|
|
const cloumdata = ref([
|
|
const cloumdata = ref([
|
|
|
{ label: '传感器编号', prop: 'sn', visible: true },
|
|
{ label: '传感器编号', prop: 'sn', visible: true },
|
|
|
{ label: '传感器名称', prop: 'name', visible: true },
|
|
{ label: '传感器名称', prop: 'name', visible: true },
|
|
@@ -311,6 +338,22 @@ const cloumdata = ref([
|
|
|
{ label: '类型', prop: 'sensorType', visible: true },
|
|
{ label: '类型', prop: 'sensorType', visible: true },
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
|
|
+/*** 用户导入参数 */
|
|
|
|
|
+const upload = reactive({
|
|
|
|
|
+ // 是否显示弹出层(用户导入)
|
|
|
|
|
+ open: false,
|
|
|
|
|
+ // 弹出层标题(用户导入)
|
|
|
|
|
+ title: "",
|
|
|
|
|
+ // 是否禁用上传
|
|
|
|
|
+ isUploading: false,
|
|
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
|
|
+ updateSupport: 0,
|
|
|
|
|
+ // 设置上传的请求头部
|
|
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
|
|
+ // 上传的地址
|
|
|
|
|
+ url: import.meta.env.VITE_APP_BASE_API + "/data/sensor/invoke"
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
|
|
|
const onchangepage = (page) => {
|
|
const onchangepage = (page) => {
|
|
|
pagedata.value.pageNum = page;
|
|
pagedata.value.pageNum = page;
|
|
@@ -359,6 +402,49 @@ const deleteall = () => {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 导入按钮操作 */
|
|
|
|
|
+const handleImport = () => {
|
|
|
|
|
+ const getdeviceid = (node) => {
|
|
|
|
|
+ if (node.children) {
|
|
|
|
|
+ return node.children.map(item => {
|
|
|
|
|
+ return getdeviceid(item);
|
|
|
|
|
+ }).join(",")
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ((node.id + "").indexOf("device") > -1) {
|
|
|
|
|
+ return node.id;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (currentnode.value != null) {
|
|
|
|
|
+ let deviceids = getdeviceid(currentnode.value).split(",").filter(i => i != "").join(",");
|
|
|
|
|
+ console.log(deviceids.split(',').length == 1)
|
|
|
|
|
+ if (deviceids != null && deviceids.split(',').length == 1) {
|
|
|
|
|
+ uploadParams.value = deviceids.replaceAll("device_", '');
|
|
|
|
|
+ console.log(uploadParams.value)
|
|
|
|
|
+ upload.title = "传感器导入";
|
|
|
|
|
+ upload.open = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: '请选择传感器所属设备',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: '请选择传感器所属设备',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+function submitFileForm() {
|
|
|
|
|
+ proxy.$refs["uploadRef"].submit();
|
|
|
|
|
+ upload.open = false;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
const initdata = () => {
|
|
const initdata = () => {
|
|
|
searchform.value.sn = '';
|
|
searchform.value.sn = '';
|
|
@@ -405,6 +491,7 @@ const getalldata = () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
let deviceids = getdeviceid(currentnode.value).split(",").filter(i => i != "").join(",");
|
|
let deviceids = getdeviceid(currentnode.value).split(",").filter(i => i != "").join(",");
|
|
|
|
|
+ console.log(deviceids)
|
|
|
if (deviceids != "") {
|
|
if (deviceids != "") {
|
|
|
deviceids = deviceids.replaceAll("device_", "")
|
|
deviceids = deviceids.replaceAll("device_", "")
|
|
|
listSensor({ ...pagedata.value, params: { deviceids: deviceids, ...searchform.value } }).then(res => {
|
|
listSensor({ ...pagedata.value, params: { deviceids: deviceids, ...searchform.value } }).then(res => {
|
|
@@ -606,8 +693,8 @@ const doshowhistory = (row) => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const inportSensor = () =>{
|
|
|
|
|
-
|
|
|
|
|
|
|
+const inportSensor = () => {
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|