2024-01-16 16:31:11 +08:00
|
|
|
<template>
|
2024-09-24 14:20:12 +08:00
|
|
|
<div class="default-main" v-loading="loading">
|
2024-01-16 16:31:11 +08:00
|
|
|
<TableHeader>
|
|
|
|
|
<template v-slot:select>
|
2025-05-09 15:23:34 +08:00
|
|
|
<el-form-item label="关键字筛选">
|
2025-07-08 08:44:13 +08:00
|
|
|
<el-input
|
|
|
|
|
v-model.trim="tableStore.table.params.searchValue"
|
|
|
|
|
style="width: 200px"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请输入设备名称/网络设备ID"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
2025-07-09 16:48:18 +08:00
|
|
|
<el-form-item label="流程阶段">
|
2025-07-08 08:44:13 +08:00
|
|
|
<el-select v-model.trim="tableStore.table.params.process" clearable placeholder="请选择状态">
|
|
|
|
|
<el-option label="功能调试" :value="2"></el-option>
|
|
|
|
|
<el-option label="出厂调试" :value="3"></el-option>
|
|
|
|
|
<el-option label="正式投运" :value="4"></el-option>
|
|
|
|
|
</el-select>
|
2025-05-09 15:23:34 +08:00
|
|
|
</el-form-item>
|
2025-07-09 16:48:18 +08:00
|
|
|
<el-form-item label="物联状态">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model.trim="tableStore.table.params.connectStatus"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请选择物联状态"
|
|
|
|
|
>
|
|
|
|
|
<el-option label="已连接" :value="1"></el-option>
|
|
|
|
|
<el-option label="未连接" :value="0"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="设备状态">
|
|
|
|
|
<el-select v-model.trim="tableStore.table.params.runStatus" clearable placeholder="请选择状态">
|
|
|
|
|
|
|
|
|
|
<el-option label="在线" :value="2"></el-option>
|
|
|
|
|
<el-option label="离线" :value="1"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2025-07-08 08:44:13 +08:00
|
|
|
<!-- <el-form-item label="设备类型">
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-select
|
|
|
|
|
v-model.trim="tableStore.table.params.devType"
|
|
|
|
|
clearable
|
|
|
|
|
@change="devTypeChange"
|
|
|
|
|
placeholder="请选择设备类型"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in devTypeOptions"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
2024-01-16 16:31:11 +08:00
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-form-item label="设备型号">
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-select
|
|
|
|
|
v-model.trim="tableStore.table.params.devModel"
|
|
|
|
|
filterable
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请选择设备型号"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in devModelOptionsFilter"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
2024-01-16 16:31:11 +08:00
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-form-item label="通讯协议">
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-select
|
|
|
|
|
v-model.trim="tableStore.table.params.devAccessMethod"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请选择通讯协议"
|
|
|
|
|
>
|
2024-09-30 11:33:19 +08:00
|
|
|
<el-option label="MQTT" value="MQTT"></el-option>
|
|
|
|
|
<el-option label="CLD" value="CLD"></el-option>
|
2024-01-16 16:31:11 +08:00
|
|
|
</el-select>
|
2025-07-08 08:44:13 +08:00
|
|
|
</el-form-item>-->
|
2024-11-27 16:32:13 +08:00
|
|
|
<!-- <el-form-item label="状态">
|
2024-12-25 10:53:07 +08:00
|
|
|
<el-select v-model.trim="tableStore.table.params.status" clearable placeholder="请选择状态">
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-option label="未注册" :value="1"></el-option>
|
|
|
|
|
<el-option label="注册" :value="2"></el-option>
|
|
|
|
|
<el-option label="接入" :value="3"></el-option>
|
2024-01-16 16:31:11 +08:00
|
|
|
</el-select>
|
2024-11-27 16:32:13 +08:00
|
|
|
</el-form-item> -->
|
2024-01-16 16:31:11 +08:00
|
|
|
</template>
|
2024-01-17 14:29:31 +08:00
|
|
|
<template v-slot:operation>
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-button type="primary" @click="downLoadFile1" class="ml10" icon="el-icon-Download">
|
2024-01-17 14:29:31 +08:00
|
|
|
模版下载
|
|
|
|
|
</el-button>
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-upload
|
|
|
|
|
style="display: inline-block"
|
|
|
|
|
action=""
|
|
|
|
|
accept=".xlsx"
|
|
|
|
|
class="upload-demo"
|
|
|
|
|
:show-file-list="false"
|
|
|
|
|
:auto-upload="false"
|
|
|
|
|
:on-change="bulkImport"
|
|
|
|
|
>
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-button type="primary" class="ml10" icon="el-icon-Tickets">批量导入</el-button>
|
2024-01-17 14:29:31 +08:00
|
|
|
</el-upload>
|
2024-12-23 11:30:28 +08:00
|
|
|
<el-button type="primary" class="ml10" @click="add" icon="el-icon-Plus">新增设备</el-button>
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
class="ml10"
|
|
|
|
|
icon="el-icon-Download"
|
|
|
|
|
@click="downLoadQrCode"
|
|
|
|
|
v-if="showQrCode"
|
|
|
|
|
>
|
|
|
|
|
批量下载二维码
|
|
|
|
|
</el-button>
|
2024-01-17 14:29:31 +08:00
|
|
|
</template>
|
2024-01-16 16:31:11 +08:00
|
|
|
</TableHeader>
|
2025-04-28 09:14:56 +08:00
|
|
|
<Table ref="tableRef" :checkbox-config="checkboxConfig" :key="tableKey" @sort-change="handleSortChange"></Table>
|
2024-01-17 14:29:31 +08:00
|
|
|
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-dialog
|
|
|
|
|
:title="dialogTitle"
|
|
|
|
|
v-model.trim="dialogFormVisible"
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
:before-close="resetForm"
|
|
|
|
|
draggable
|
|
|
|
|
width="800px"
|
|
|
|
|
>
|
2024-09-30 15:37:33 +08:00
|
|
|
<el-form :model="form" label-width="auto" :rules="rules" ref="ruleFormRef" class="form-two">
|
2024-09-30 11:33:19 +08:00
|
|
|
<el-form-item label="设备名称:" prop="name">
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-input
|
|
|
|
|
maxlength="32"
|
|
|
|
|
show-word-limit
|
|
|
|
|
v-model.trim="form.name"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请输入(项目名称+设备名称)"
|
|
|
|
|
></el-input>
|
2024-01-17 14:29:31 +08:00
|
|
|
</el-form-item>
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-form-item label="网络设备ID:" prop="ndid" class="top">
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-input
|
|
|
|
|
maxlength="32"
|
|
|
|
|
show-word-limit
|
|
|
|
|
v-model.trim="form.ndid"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
></el-input>
|
2024-01-17 14:29:31 +08:00
|
|
|
</el-form-item>
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-form-item label="设备类型:" prop="devType" class="top">
|
2024-12-25 10:53:07 +08:00
|
|
|
<el-select v-model.trim="form.devType" placeholder="请选择" @change="formDevTypeChange" clearable>
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-option
|
|
|
|
|
v-for="item in devTypeOptions"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
></el-option>
|
2024-01-17 14:29:31 +08:00
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-form-item label="设备型号:" prop="devModel" class="top">
|
2024-12-25 10:53:07 +08:00
|
|
|
<el-select v-model.trim="form.devModel" filterable placeholder="请选择" clearable>
|
2025-04-22 08:46:51 +08:00
|
|
|
<el-option
|
|
|
|
|
v-for="item in formDevModelOptionsFilter"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
></el-option>
|
2024-01-17 14:29:31 +08:00
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-form-item label="通讯协议:" prop="devAccessMethod" class="top">
|
2024-12-25 10:53:07 +08:00
|
|
|
<el-select v-model.trim="form.devAccessMethod" placeholder="请选择" clearable>
|
2024-09-30 11:33:19 +08:00
|
|
|
<el-option label="MQTT" value="MQTT"></el-option>
|
|
|
|
|
<el-option label="CLD" value="CLD"></el-option>
|
2024-01-17 14:29:31 +08:00
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-12-17 20:57:07 +08:00
|
|
|
<el-form-item label="排序:" class="top" prop="sort">
|
|
|
|
|
<el-input maxlength="32" show-word-limit-number v-model.trim="form.sort" :min="0" />
|
|
|
|
|
</el-form-item>
|
2024-01-17 14:29:31 +08:00
|
|
|
|
2024-11-19 10:39:46 +08:00
|
|
|
<!-- <el-form-item label="合同号:" prop="cntractNo" class="top">
|
2024-12-25 10:53:07 +08:00
|
|
|
<el-input maxlength="32" show-word-limit v-model.trim="form.cntractNo" autocomplete="off" placeholder="请输入"></el-input>
|
2024-11-19 10:39:46 +08:00
|
|
|
</el-form-item> -->
|
2024-01-17 14:29:31 +08:00
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
2024-06-11 15:50:10 +08:00
|
|
|
<el-button @click="resetForm">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="onSubmit">确 定</el-button>
|
2024-01-17 14:29:31 +08:00
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
2024-06-11 15:50:10 +08:00
|
|
|
<div class="qrcode-label">
|
|
|
|
|
<div class="qrcode-label-title">{{ deivce.mac }}</div>
|
|
|
|
|
<img class="qrcode-label-img" alt="二维码加载失败" :src="deivce.qrPath" />
|
2024-01-17 14:29:31 +08:00
|
|
|
</div>
|
2025-04-22 08:46:51 +08:00
|
|
|
<div v-if="qrcodeFlag">
|
|
|
|
|
<div class="qrcode-label" :class="`qrcode${i}`" v-for="(item, i) in tableStore.table.selection">
|
|
|
|
|
<div class="qrcode-label-title">{{ item.mac }}</div>
|
|
|
|
|
<img class="qrcode-label-img" alt="二维码加载失败" :src="fullUrl(item.qrPath)" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-01-16 16:31:11 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2024-06-11 15:50:10 +08:00
|
|
|
<script setup lang="ts">
|
2024-01-18 15:50:17 +08:00
|
|
|
import { ref, onMounted, provide, computed, reactive, nextTick } from 'vue'
|
2024-01-16 16:31:11 +08:00
|
|
|
import TableStore from '@/utils/tableStore'
|
|
|
|
|
import Table from '@/components/table/index.vue'
|
|
|
|
|
import TableHeader from '@/components/table/header/index.vue'
|
2024-01-17 14:29:31 +08:00
|
|
|
import { queryByCode, queryByid, queryCsDictTree } from '@/api/system-boot/dictTree'
|
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
2024-11-27 16:01:08 +08:00
|
|
|
import { activateUser, deluser, passwordConfirm } from '@/api/user-boot/user'
|
2025-04-22 08:46:51 +08:00
|
|
|
import { downLoadFile } from '@/api/cs-system-boot/manage.ts'
|
2024-01-17 14:29:31 +08:00
|
|
|
import {
|
|
|
|
|
addEquipmentDelivery,
|
|
|
|
|
deleteEquipmentDelivery,
|
|
|
|
|
editEquipmentDelivery,
|
|
|
|
|
batchImportDevice,
|
2024-06-12 18:05:35 +08:00
|
|
|
resetEquipmentDelivery,
|
|
|
|
|
governDeviceRegister,
|
|
|
|
|
portableDeviceRegister,
|
2025-01-03 12:45:54 +08:00
|
|
|
portableDeviceAccess,
|
|
|
|
|
getExcelTemplate
|
2024-01-17 14:29:31 +08:00
|
|
|
} from '@/api/cs-system-boot/device'
|
|
|
|
|
import html2canvas from 'html2canvas'
|
2024-01-19 14:08:07 +08:00
|
|
|
import { fullUrl } from '@/utils/common'
|
2025-04-22 08:46:51 +08:00
|
|
|
import JSZip from 'jszip'
|
|
|
|
|
import { saveAs } from 'file-saver'
|
2024-01-16 16:31:11 +08:00
|
|
|
defineOptions({
|
2024-09-25 16:36:53 +08:00
|
|
|
name: 'govern/manage/factory'
|
2024-01-16 16:31:11 +08:00
|
|
|
})
|
2025-04-22 08:46:51 +08:00
|
|
|
const showQrCode = ref(false)
|
2024-01-16 16:31:11 +08:00
|
|
|
const devTypeOptions: any = ref([])
|
2024-01-17 14:29:31 +08:00
|
|
|
const deivce: any = ref({})
|
|
|
|
|
const ruleFormRef = ref()
|
|
|
|
|
const form = reactive({
|
|
|
|
|
cntractNo: '',
|
2024-09-30 11:33:19 +08:00
|
|
|
devAccessMethod: 'MQTT',
|
2024-01-17 14:29:31 +08:00
|
|
|
devModel: '',
|
|
|
|
|
devType: '',
|
|
|
|
|
name: '',
|
2024-12-17 20:57:07 +08:00
|
|
|
ndid: '',
|
|
|
|
|
sort: 0
|
2024-01-17 14:29:31 +08:00
|
|
|
})
|
|
|
|
|
const rules = reactive({
|
|
|
|
|
name: [{ required: true, message: '设备名不能为空', trigger: 'blur' }],
|
|
|
|
|
ndid: [{ required: true, message: '网络设备id不能为空', trigger: 'blur' }],
|
|
|
|
|
devType: [{ required: true, message: '设备类型不能为空', trigger: 'change' }],
|
|
|
|
|
devModel: [{ required: true, message: '设备型号不能为空', trigger: 'change' }],
|
|
|
|
|
devAccessMethod: [{ required: true, message: '接入方式不能为空', trigger: 'blur' }],
|
2024-12-17 20:57:07 +08:00
|
|
|
cntractNo: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
|
|
|
|
|
sort: [{ required: true, message: '排序不能为空', trigger: 'blur' }]
|
2024-01-17 14:29:31 +08:00
|
|
|
})
|
2025-04-22 08:46:51 +08:00
|
|
|
const qrcodeFlag = ref(false)
|
|
|
|
|
const tableKey = ref(0)
|
2024-01-17 14:29:31 +08:00
|
|
|
const dialogFormVisible = ref(false)
|
2024-12-23 11:30:28 +08:00
|
|
|
const dialogTitle = ref('新增设备')
|
2024-09-24 14:20:12 +08:00
|
|
|
const loading = ref<boolean>(false)
|
2024-01-17 14:29:31 +08:00
|
|
|
const devModelOptions: any = ref([])
|
2025-04-22 08:46:51 +08:00
|
|
|
const queryTheDictionary = () => {
|
|
|
|
|
queryByCode('Device_Type').then(async res => {
|
|
|
|
|
const id = res.data.id
|
|
|
|
|
await queryCsDictTree(id).then(res => {
|
|
|
|
|
devTypeOptions.value = res.data.map((item: any) => {
|
|
|
|
|
return {
|
|
|
|
|
value: item.id,
|
|
|
|
|
label: item.name,
|
|
|
|
|
...item
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// let index = devTypeOptions.value.findIndex((item: any) => {
|
|
|
|
|
// return item.name == '网关'
|
|
|
|
|
// })
|
|
|
|
|
// devTypeOptions.value.splice(index, 1)
|
2024-10-09 15:27:48 +08:00
|
|
|
})
|
2025-04-22 08:46:51 +08:00
|
|
|
await queryByid(id).then(res => {
|
|
|
|
|
res.data.map((item: any, index: any) => {
|
|
|
|
|
if (item.pid == id) {
|
|
|
|
|
res.data.splice(index, 1)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
devModelOptions.value = res.data.map((item: any, index: any) => {
|
|
|
|
|
return {
|
|
|
|
|
value: item.id,
|
|
|
|
|
label: item.name,
|
|
|
|
|
...item
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-01-18 15:50:17 +08:00
|
|
|
})
|
2025-04-22 08:46:51 +08:00
|
|
|
await tableStore.index()
|
2024-01-18 15:50:17 +08:00
|
|
|
})
|
2025-04-22 08:46:51 +08:00
|
|
|
}
|
2024-01-17 14:29:31 +08:00
|
|
|
const devModelOptionsFilter = computed(() => {
|
|
|
|
|
return devModelOptions.value.filter((item: any) => {
|
|
|
|
|
if (tableStore.table.params.devType) {
|
|
|
|
|
return item.pid == tableStore.table.params.devType
|
|
|
|
|
} else {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
const formDevModelOptionsFilter = computed(() => {
|
|
|
|
|
return devModelOptions.value.filter((item: any) => {
|
|
|
|
|
if (form.devType) {
|
|
|
|
|
return item.pid == form.devType
|
|
|
|
|
} else {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
2024-01-16 16:31:11 +08:00
|
|
|
const tableStore = new TableStore({
|
|
|
|
|
url: '/cs-device-boot/EquipmentDelivery/list',
|
|
|
|
|
method: 'POST',
|
2025-07-09 16:48:18 +08:00
|
|
|
|
2024-01-18 15:50:17 +08:00
|
|
|
column: [
|
2024-12-13 14:36:23 +08:00
|
|
|
{
|
2025-04-22 08:46:51 +08:00
|
|
|
width: '60',
|
|
|
|
|
type: 'checkbox'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '序号',
|
|
|
|
|
width: 80,
|
|
|
|
|
formatter: (row: any) => {
|
2024-12-13 14:36:23 +08:00
|
|
|
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-01-18 15:50:17 +08:00
|
|
|
{ title: '设备名称', field: 'name' },
|
2024-12-30 10:07:26 +08:00
|
|
|
{ title: '网络设备ID', field: 'ndid' },
|
2025-04-28 15:51:30 +08:00
|
|
|
|
2024-01-18 15:50:17 +08:00
|
|
|
{
|
|
|
|
|
title: '设备类型',
|
|
|
|
|
field: 'devType',
|
|
|
|
|
formatter: row => {
|
2025-04-22 08:46:51 +08:00
|
|
|
return devTypeOptions.value.find((item: any) => item.value == row.cellValue).label
|
2024-01-18 15:50:17 +08:00
|
|
|
}
|
|
|
|
|
},
|
2025-01-03 12:45:54 +08:00
|
|
|
|
2024-01-18 15:50:17 +08:00
|
|
|
{
|
|
|
|
|
title: '设备型号',
|
|
|
|
|
field: 'devModel',
|
|
|
|
|
formatter: row => {
|
2025-04-22 08:46:51 +08:00
|
|
|
return devModelOptions.value.find((item: any) => item.value == row.cellValue).label
|
2024-01-18 15:50:17 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '通讯协议',
|
|
|
|
|
field: 'devAccessMethod',
|
|
|
|
|
formatter: row => {
|
2024-09-30 11:33:19 +08:00
|
|
|
return row.cellValue === 'MQTT' ? 'MQTT' : row.cellValue === 'CLD' ? 'CLD' : row.cellValue
|
2024-01-18 15:50:17 +08:00
|
|
|
}
|
|
|
|
|
},
|
2025-04-28 15:51:30 +08:00
|
|
|
{ title: '录入时间', field: 'createTime', sortable: true },
|
2025-01-03 12:45:54 +08:00
|
|
|
|
2024-11-27 16:01:08 +08:00
|
|
|
{
|
|
|
|
|
title: '使用状态',
|
|
|
|
|
render: 'switch',
|
|
|
|
|
width: 100,
|
|
|
|
|
field: 'usageStatus',
|
|
|
|
|
activeText: '启用',
|
|
|
|
|
inactiveText: '停用',
|
|
|
|
|
inactiveValue: '0',
|
|
|
|
|
activeValue: '1',
|
|
|
|
|
onChangeField: (row: any, value: any) => {
|
2024-11-28 14:01:27 +08:00
|
|
|
// console.log("🚀 ~ row:", row)
|
2024-11-27 16:01:08 +08:00
|
|
|
ElMessageBox.prompt('二次校验密码确认', '', {
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
customClass: 'customInput',
|
2024-12-17 20:57:07 +08:00
|
|
|
inputType: 'text',
|
|
|
|
|
beforeClose: (action, instance, done) => {
|
|
|
|
|
if (action === 'confirm') {
|
|
|
|
|
if (instance.inputValue == null) {
|
|
|
|
|
return ElMessage.warning('请输入密码')
|
|
|
|
|
} else if (instance.inputValue?.length > 32) {
|
2025-04-22 08:46:51 +08:00
|
|
|
return ElMessage.warning(
|
|
|
|
|
'密码长度不能超过32位,当前密码长度为' + instance.inputValue.length
|
|
|
|
|
)
|
2024-12-17 20:57:07 +08:00
|
|
|
} else {
|
2025-04-22 08:46:51 +08:00
|
|
|
done()
|
2024-12-17 20:57:07 +08:00
|
|
|
}
|
|
|
|
|
} else {
|
2025-04-22 08:46:51 +08:00
|
|
|
done()
|
2024-12-17 20:57:07 +08:00
|
|
|
}
|
|
|
|
|
}
|
2024-11-27 16:01:08 +08:00
|
|
|
}).then(({ value }) => {
|
|
|
|
|
passwordConfirm(value).then(res => {
|
2025-04-22 08:46:51 +08:00
|
|
|
editEquipmentDelivery({
|
|
|
|
|
...row,
|
|
|
|
|
status: row.status == 5 ? 1 : row.status == 6 ? 2 : row.status,
|
|
|
|
|
usageStatus: row.usageStatus == 1 ? 0 : 1
|
|
|
|
|
}).then(res => {
|
2024-11-27 16:01:08 +08:00
|
|
|
ElMessage.success(row.usageStatus == 1 ? '设备停用成功!' : '设备启用成功!')
|
|
|
|
|
tableStore.index()
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-04-28 15:51:30 +08:00
|
|
|
// { title: 'MQTT状态', field: 'connectStatus', width: 100, },
|
|
|
|
|
{
|
2025-07-09 16:48:18 +08:00
|
|
|
title: '物联状态',
|
2025-04-28 15:51:30 +08:00
|
|
|
field: 'connectStatus',
|
|
|
|
|
width: 100,
|
|
|
|
|
render: 'tag',
|
|
|
|
|
custom: {
|
|
|
|
|
未连接: 'danger',
|
|
|
|
|
已连接: 'success'
|
|
|
|
|
},
|
|
|
|
|
replaceValue: {
|
|
|
|
|
未连接: '未连接',
|
|
|
|
|
已连接: '已连接'
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-07-08 08:44:13 +08:00
|
|
|
|
2024-01-18 15:50:17 +08:00
|
|
|
{
|
2025-07-09 16:48:18 +08:00
|
|
|
title: '设备状态',
|
2024-11-26 16:47:03 +08:00
|
|
|
field: 'runStatus',
|
2024-06-12 18:05:35 +08:00
|
|
|
width: 100,
|
2024-06-11 15:50:10 +08:00
|
|
|
render: 'tag',
|
|
|
|
|
custom: {
|
2025-04-22 08:46:51 +08:00
|
|
|
1: 'danger',
|
|
|
|
|
2: 'success'
|
2024-06-11 15:50:10 +08:00
|
|
|
},
|
|
|
|
|
replaceValue: {
|
2024-11-26 16:47:03 +08:00
|
|
|
1: '离线',
|
2025-04-22 08:46:51 +08:00
|
|
|
2: '在线'
|
2024-01-18 15:50:17 +08:00
|
|
|
}
|
|
|
|
|
},
|
2025-07-08 08:44:13 +08:00
|
|
|
{
|
2025-07-09 16:48:18 +08:00
|
|
|
title: '流程阶段',
|
2025-07-08 08:44:13 +08:00
|
|
|
field: 'process',
|
|
|
|
|
width: 100,
|
|
|
|
|
render: 'tag',
|
|
|
|
|
custom: {
|
|
|
|
|
2: 'warning',
|
|
|
|
|
3: 'warning',
|
|
|
|
|
4: 'success'
|
|
|
|
|
},
|
|
|
|
|
replaceValue: {
|
|
|
|
|
2: '功能调试',
|
|
|
|
|
3: '出厂调试',
|
|
|
|
|
4: '正式投运'
|
|
|
|
|
}
|
|
|
|
|
// formatter: row => {
|
|
|
|
|
// return row.cellValue == '1'
|
|
|
|
|
// ? '设备登记'
|
|
|
|
|
// : row.cellValue == '2'
|
|
|
|
|
// ? '功能调试'
|
|
|
|
|
// : row.cellValue == '3'
|
|
|
|
|
// ? '出厂调试'
|
|
|
|
|
// : row.cellValue == '4'
|
|
|
|
|
// ? '设备投运'
|
|
|
|
|
// : row.cellValue
|
|
|
|
|
// }
|
|
|
|
|
},
|
2024-01-18 15:50:17 +08:00
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
align: 'center',
|
2024-12-11 11:33:44 +08:00
|
|
|
width: '220',
|
2024-01-18 15:50:17 +08:00
|
|
|
render: 'buttons',
|
|
|
|
|
buttons: [
|
2024-06-12 18:05:35 +08:00
|
|
|
//直连装置注册
|
2024-11-27 16:01:08 +08:00
|
|
|
// {
|
|
|
|
|
// title: '注册',
|
|
|
|
|
// type: 'primary',
|
|
|
|
|
// icon: 'el-icon-Grid',
|
|
|
|
|
// render: 'basicButton',
|
|
|
|
|
// disabled: row => {
|
|
|
|
|
// return (
|
|
|
|
|
// (row.devType == '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
|
|
|
|
// row.devModel == 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
|
|
|
|
// row.status == '1'
|
|
|
|
|
// )
|
|
|
|
|
// },
|
|
|
|
|
// click: row => {
|
|
|
|
|
// // 直连设备注册
|
|
|
|
|
// ElMessageBox.confirm('确定注册该设备吗?', '提示', {
|
|
|
|
|
// confirmButtonText: '确认',
|
|
|
|
|
// cancelButtonText: '取消',
|
|
|
|
|
// type: 'warning'
|
|
|
|
|
// })
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// governDeviceRegister({
|
|
|
|
|
// nDid: row.ndid,
|
|
|
|
|
// type: '4'
|
|
|
|
|
// }).then(res => {
|
|
|
|
|
// ElMessage.success(res.message)
|
|
|
|
|
// tableStore.onTableAction('search', {})
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// .catch(e => {})
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// //便携式设备注册
|
|
|
|
|
// {
|
|
|
|
|
// title: '注册',
|
|
|
|
|
// type: 'primary',
|
|
|
|
|
// icon: 'el-icon-Grid',
|
|
|
|
|
// render: 'basicButton',
|
|
|
|
|
// disabled: row => {
|
|
|
|
|
// // return (
|
|
|
|
|
// // (row.devType != '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
|
|
|
|
// // row.devModel != 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
|
|
|
|
// // row.status != '1'
|
|
|
|
|
// // )
|
|
|
|
|
// return true
|
|
|
|
|
// },
|
|
|
|
|
// click: row => {
|
|
|
|
|
// // 便携式设备注册
|
|
|
|
|
// ElMessageBox.confirm('确定注册该设备吗?', '提示', {
|
|
|
|
|
// confirmButtonText: '确认',
|
|
|
|
|
// cancelButtonText: '取消',
|
|
|
|
|
// type: 'warning'
|
|
|
|
|
// })
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// portableDeviceRegister({
|
|
|
|
|
// nDid: row.ndid
|
|
|
|
|
// }).then(res => {
|
|
|
|
|
// ElMessage.success(res.message)
|
|
|
|
|
// tableStore.index()
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// .catch(e => {})
|
|
|
|
|
// }
|
|
|
|
|
// },
|
2024-06-12 18:05:35 +08:00
|
|
|
//直连设备接入
|
2024-07-24 14:54:53 +08:00
|
|
|
// {
|
|
|
|
|
// title: '接入',
|
|
|
|
|
// type: 'primary',
|
|
|
|
|
// icon: 'el-icon-Grid',
|
|
|
|
|
// render: 'basicButton',
|
|
|
|
|
// disabled: row => {
|
|
|
|
|
// return (
|
|
|
|
|
// (row.devType == '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
|
|
|
|
// row.devModel == 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
|
|
|
|
// row.status != '2'
|
|
|
|
|
// )
|
|
|
|
|
// },
|
|
|
|
|
// click: row => {
|
|
|
|
|
// // 直连设备接入
|
|
|
|
|
// ElMessageBox.confirm('确定接入该设备吗?', '提示', {
|
|
|
|
|
// confirmButtonText: '确认',
|
|
|
|
|
// cancelButtonText: '取消',
|
|
|
|
|
// type: 'warning'
|
|
|
|
|
// })
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// governDeviceRegister({
|
|
|
|
|
// nDid: row.ndid,
|
|
|
|
|
// type: '4'
|
|
|
|
|
// }).then(res => {
|
|
|
|
|
// ElMessage.success(res.message)
|
|
|
|
|
// tableStore.onTableAction('search', {})
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// .catch(e => {})
|
|
|
|
|
// }
|
|
|
|
|
// },
|
2024-09-24 09:58:25 +08:00
|
|
|
//便携式设备手动接入
|
|
|
|
|
{
|
2024-12-25 10:53:07 +08:00
|
|
|
title: '接入',
|
2024-09-24 09:58:25 +08:00
|
|
|
type: 'primary',
|
|
|
|
|
icon: 'el-icon-Grid',
|
|
|
|
|
render: 'basicButton',
|
|
|
|
|
disabled: row => {
|
|
|
|
|
return (
|
|
|
|
|
(row.devType != '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
|
|
|
|
row.devModel != 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
2024-12-25 10:53:07 +08:00
|
|
|
row.status != '6'
|
2024-09-24 09:58:25 +08:00
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
click: row => {
|
|
|
|
|
// 便携式设备手动接入
|
|
|
|
|
ElMessageBox.confirm('确定接入该设备吗?', '提示', {
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
|
|
|
|
portableDeviceAccess({
|
|
|
|
|
nDid: row.ndid
|
|
|
|
|
}).then(res => {
|
|
|
|
|
ElMessage.success(res.message)
|
|
|
|
|
tableStore.index()
|
|
|
|
|
})
|
|
|
|
|
})
|
2025-04-22 08:46:51 +08:00
|
|
|
.catch(e => {})
|
2024-09-24 09:58:25 +08:00
|
|
|
}
|
|
|
|
|
},
|
2024-01-18 15:50:17 +08:00
|
|
|
{
|
2024-12-25 10:53:07 +08:00
|
|
|
title: '接入',
|
2024-01-18 15:50:17 +08:00
|
|
|
type: 'primary',
|
2024-06-11 15:50:10 +08:00
|
|
|
icon: 'el-icon-Grid',
|
2024-01-30 14:11:29 +08:00
|
|
|
render: 'basicButton',
|
2024-06-11 15:50:10 +08:00
|
|
|
disabled: row => {
|
|
|
|
|
return (
|
|
|
|
|
(row.devType != '8b45cf6b7f5266e777d07c166ad5fa77' &&
|
2024-06-12 18:05:35 +08:00
|
|
|
row.devModel != 'a0d4da4b5c17b2172362a3f5a27bf217') ||
|
2024-12-25 10:53:07 +08:00
|
|
|
row.status != '5'
|
2024-06-11 15:50:10 +08:00
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
click: row => {
|
2024-06-12 18:05:35 +08:00
|
|
|
// 便携式设备接入
|
2024-09-23 19:48:24 +08:00
|
|
|
// portableDeviceAccess
|
2024-11-28 14:01:27 +08:00
|
|
|
|
2024-06-12 18:05:35 +08:00
|
|
|
ElMessageBox.confirm('确定接入该设备吗?', '提示', {
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
2024-11-28 14:01:27 +08:00
|
|
|
loading.value = true
|
2024-09-23 19:48:24 +08:00
|
|
|
portableDeviceRegister({
|
2024-06-12 18:05:35 +08:00
|
|
|
nDid: row.ndid
|
|
|
|
|
})
|
2024-09-24 14:20:12 +08:00
|
|
|
.then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
ElMessage.success(res.message)
|
|
|
|
|
tableStore.index()
|
|
|
|
|
})
|
|
|
|
|
.catch(e => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch(e => {
|
|
|
|
|
loading.value = false
|
2024-06-12 18:05:35 +08:00
|
|
|
})
|
2024-01-18 15:50:17 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-01-26 09:35:33 +08:00
|
|
|
title: '二维码',
|
2024-01-18 15:50:17 +08:00
|
|
|
type: 'primary',
|
|
|
|
|
icon: 'el-icon-Grid',
|
2024-01-30 14:11:29 +08:00
|
|
|
render: 'basicButton',
|
2024-06-11 15:50:10 +08:00
|
|
|
disabled: row => {
|
2025-04-22 08:46:51 +08:00
|
|
|
return !(row.devType == '2d4e186e2462590dedc765c5b6700a32')
|
|
|
|
|
},
|
2024-01-18 15:50:17 +08:00
|
|
|
click: row => {
|
|
|
|
|
deivce.value = row
|
2024-01-19 14:08:07 +08:00
|
|
|
deivce.value.qrPath = fullUrl(deivce.value.qrPath)
|
2025-04-22 08:46:51 +08:00
|
|
|
|
2024-01-18 15:50:17 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
|
html2canvas(document.querySelector('.qrcode-label'), {
|
|
|
|
|
useCORS: true
|
|
|
|
|
}).then(canvas => {
|
|
|
|
|
let url = canvas.toDataURL('image/png')
|
2025-04-22 08:46:51 +08:00
|
|
|
console.log('🚀 ~ html2canvas ~ url:', url)
|
2024-01-18 15:50:17 +08:00
|
|
|
// 下载图片
|
|
|
|
|
let a = document.createElement('a')
|
|
|
|
|
let event = new MouseEvent('click')
|
|
|
|
|
a.href = url
|
|
|
|
|
a.download = row.mac + '.png'
|
|
|
|
|
a.dispatchEvent(event)
|
|
|
|
|
})
|
|
|
|
|
}, 0)
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-06-11 15:50:10 +08:00
|
|
|
{
|
|
|
|
|
name: 'edit',
|
|
|
|
|
title: '编辑',
|
|
|
|
|
type: 'primary',
|
|
|
|
|
icon: 'el-icon-EditPen',
|
|
|
|
|
render: 'basicButton',
|
|
|
|
|
|
|
|
|
|
click: async row => {
|
|
|
|
|
dialogFormVisible.value = true
|
|
|
|
|
dialogTitle.value = '编辑设备'
|
|
|
|
|
for (let key in form) {
|
|
|
|
|
form[key] = row[key]
|
|
|
|
|
}
|
|
|
|
|
form.id = row.id
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-01-18 15:50:17 +08:00
|
|
|
{
|
|
|
|
|
name: 'del',
|
2024-01-26 09:35:33 +08:00
|
|
|
title: '删除',
|
2024-01-18 15:50:17 +08:00
|
|
|
type: 'danger',
|
|
|
|
|
icon: 'el-icon-Delete',
|
2024-01-30 14:11:29 +08:00
|
|
|
render: 'basicButton',
|
2024-01-18 15:50:17 +08:00
|
|
|
click: row => {
|
|
|
|
|
ElMessageBox.confirm('确定删除该设备吗?', '提示', {
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
2024-06-12 18:05:35 +08:00
|
|
|
.then(() => {
|
|
|
|
|
deleteEquipmentDelivery(row.id).then(res => {
|
|
|
|
|
ElMessage.success('删除成功!')
|
|
|
|
|
tableStore.onTableAction('search', {})
|
|
|
|
|
})
|
|
|
|
|
})
|
2025-04-22 08:46:51 +08:00
|
|
|
.catch(e => {})
|
2024-01-18 15:50:17 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
2024-01-17 14:29:31 +08:00
|
|
|
beforeSearchFun: () => {
|
2025-04-22 08:46:51 +08:00
|
|
|
showQrCode.value = false
|
|
|
|
|
tableStore.table.column[0].type == 'checkbox' ? tableStore.table.column.splice(0, 1) : ''
|
|
|
|
|
},
|
|
|
|
|
loadCallback: () => {
|
|
|
|
|
tableStore.table.data.forEach(item => {
|
|
|
|
|
if (item.devType == '2d4e186e2462590dedc765c5b6700a32') {
|
|
|
|
|
showQrCode.value = true
|
|
|
|
|
tableStore.table.column[0].type != 'checkbox'
|
|
|
|
|
? tableStore.table.column.unshift({ type: 'checkbox', width: '60' })
|
|
|
|
|
: ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
tableKey.value += 1
|
2024-01-16 16:31:11 +08:00
|
|
|
}
|
|
|
|
|
})
|
2024-01-17 14:29:31 +08:00
|
|
|
tableStore.table.params.orderBy = 'desc'
|
2024-09-30 11:33:19 +08:00
|
|
|
tableStore.table.params.devType = ''
|
|
|
|
|
tableStore.table.params.devModel = ''
|
2025-07-09 16:48:18 +08:00
|
|
|
tableStore.table.params.process = 2
|
2024-09-30 11:33:19 +08:00
|
|
|
tableStore.table.params.devAccessMethod = ''
|
|
|
|
|
tableStore.table.params.status = ''
|
2025-04-28 09:14:56 +08:00
|
|
|
tableStore.table.params.sortBy = ''
|
|
|
|
|
tableStore.table.params.orderBy = ''
|
2025-07-08 08:44:13 +08:00
|
|
|
tableStore.table.params.searchValue = ''
|
2025-07-09 16:48:18 +08:00
|
|
|
tableStore.table.params.connectStatus = ''
|
|
|
|
|
tableStore.table.params.runStatus = ''
|
2024-01-18 15:50:17 +08:00
|
|
|
|
2024-01-17 14:29:31 +08:00
|
|
|
// 设备类型
|
|
|
|
|
const devTypeChange = (e: any) => {
|
|
|
|
|
if (!e) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
tableStore.table.params.devModel = ''
|
|
|
|
|
}
|
|
|
|
|
// 下载模版
|
2025-04-22 08:46:51 +08:00
|
|
|
const downLoadFile1 = () => {
|
2025-01-03 12:45:54 +08:00
|
|
|
getExcelTemplate().then(res => {
|
|
|
|
|
let blob = new Blob([res], {
|
|
|
|
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
|
|
})
|
|
|
|
|
const url = window.URL.createObjectURL(blob)
|
|
|
|
|
const link = document.createElement('a') // 创建a标签
|
|
|
|
|
link.href = url
|
|
|
|
|
link.download = '设备导入模版.xlsx' // 设置下载的文件名
|
|
|
|
|
document.body.appendChild(link)
|
|
|
|
|
link.click() //执行下载
|
|
|
|
|
document.body.removeChild(link)
|
|
|
|
|
ElMessage.success('下载成功')
|
|
|
|
|
})
|
2024-01-17 14:29:31 +08:00
|
|
|
}
|
2025-04-22 08:46:51 +08:00
|
|
|
// 禁止点击
|
|
|
|
|
const checkboxConfig = reactive({
|
|
|
|
|
checkMethod: ({ row }) => {
|
|
|
|
|
return row.devType == '2d4e186e2462590dedc765c5b6700a32'
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-01-17 14:29:31 +08:00
|
|
|
// 导入模版
|
|
|
|
|
const bulkImport = (e: any) => {
|
|
|
|
|
batchImportDevice(e.raw).then((res: any) => {
|
|
|
|
|
if (res.type === 'application/json') {
|
|
|
|
|
const reader = new FileReader()
|
|
|
|
|
reader.readAsText(res)
|
|
|
|
|
reader.onload = (e: any) => {
|
|
|
|
|
let data = JSON.parse(e.target.result)
|
|
|
|
|
if (data.code === 'A0000') {
|
|
|
|
|
ElMessage.success(data.message)
|
|
|
|
|
tableStore.onTableAction('search', {})
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(data.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error('导入失败!')
|
|
|
|
|
let url = window.URL.createObjectURL(res)
|
|
|
|
|
let link = document.createElement('a')
|
|
|
|
|
link.style.display = 'none'
|
|
|
|
|
link.href = url
|
|
|
|
|
link.setAttribute('download', '导入失败.xlsx')
|
|
|
|
|
document.body.appendChild(link)
|
|
|
|
|
link.click()
|
|
|
|
|
document.body.removeChild(link)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2025-04-22 08:46:51 +08:00
|
|
|
// 批量下载
|
|
|
|
|
const downLoadQrCode = async () => {
|
|
|
|
|
if (tableStore.table.selection.length == 0) {
|
|
|
|
|
ElMessage.warning('请选择需要下载的设备')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
ElMessage.info('下载中,请稍后...')
|
|
|
|
|
qrcodeFlag.value = true
|
|
|
|
|
const zip = new JSZip()
|
|
|
|
|
|
|
|
|
|
// 创建一个数组来存储所有的异步操作
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
const promises = tableStore.table.selection.map(async (item: any, i: number) => {
|
|
|
|
|
// 等待 html2canvas 完成
|
|
|
|
|
const canvas = await html2canvas(document.querySelector(`.qrcode${i}`), {
|
|
|
|
|
useCORS: true
|
|
|
|
|
})
|
|
|
|
|
// 将 canvas 转换为 Base64
|
|
|
|
|
const url = canvas.toDataURL('image/png')
|
|
|
|
|
// 将文件添加到 ZIP 中
|
|
|
|
|
zip.file(item.mac + '.png', url.split(',')[1], { base64: true })
|
|
|
|
|
})
|
|
|
|
|
// 使用 Promise.all 等待所有异步操作完成
|
|
|
|
|
Promise.all(promises)
|
|
|
|
|
.then(() => {
|
|
|
|
|
// 所有文件都已添加到 ZIP 中,现在生成 ZIP 文件
|
|
|
|
|
zip.generateAsync({ type: 'blob' }).then(content => {
|
|
|
|
|
saveAs(content, `二维码.zip`) // 保存 ZIP 文件
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
console.error('生成 ZIP 文件时出错:', error)
|
|
|
|
|
})
|
|
|
|
|
qrcodeFlag.value = false
|
|
|
|
|
}, 500)
|
|
|
|
|
}
|
2025-04-28 09:14:56 +08:00
|
|
|
// 排序
|
|
|
|
|
const handleSortChange = ({ column, order }: { column: TableColumn; order: 'asc' | 'desc' | null }) => {
|
|
|
|
|
// console.log('排序列:', column?.property);
|
|
|
|
|
// console.log('排序顺序:', order);
|
|
|
|
|
// tableStore.onTableAction('sortable', { column, order })
|
|
|
|
|
tableStore.table.params.sortBy = column?.property
|
|
|
|
|
tableStore.table.params.orderBy = order
|
|
|
|
|
tableStore.table.params.pageNum = 1
|
2025-04-22 08:46:51 +08:00
|
|
|
|
2025-04-28 09:14:56 +08:00
|
|
|
tableStore.index()
|
|
|
|
|
// // 在这里可以根据 column 和 order 进行相应的数据排序操作
|
|
|
|
|
// if (order === 'asc') {
|
|
|
|
|
// } else if (order === 'desc') {
|
|
|
|
|
// }
|
|
|
|
|
}
|
2025-04-22 08:46:51 +08:00
|
|
|
// 示例用法
|
|
|
|
|
|
2024-01-17 14:29:31 +08:00
|
|
|
// 新增
|
|
|
|
|
const add = () => {
|
|
|
|
|
dialogFormVisible.value = true
|
2024-12-23 11:30:28 +08:00
|
|
|
dialogTitle.value = '新增设备'
|
2024-01-17 14:29:31 +08:00
|
|
|
}
|
2024-01-18 15:50:17 +08:00
|
|
|
|
2024-01-17 14:29:31 +08:00
|
|
|
// 确认
|
|
|
|
|
const onSubmit = () => {
|
|
|
|
|
ruleFormRef.value.validate((valid: any) => {
|
|
|
|
|
if (valid) {
|
2024-12-23 11:30:28 +08:00
|
|
|
if (dialogTitle.value == '新增设备') {
|
2024-01-17 14:29:31 +08:00
|
|
|
addEquipmentDelivery(form).then(res => {
|
|
|
|
|
ElMessage.success('新增成功')
|
2024-11-27 16:01:08 +08:00
|
|
|
if (devTypeOptions.value.filter((item: any) => item.value == form.devType)[0].code == 'Portable') {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
ElMessage.warning('设备正在接入中,请稍等。')
|
|
|
|
|
}, 3000)
|
|
|
|
|
portableDeviceRegister({
|
|
|
|
|
nDid: res.data.ndid
|
|
|
|
|
})
|
2025-04-22 08:46:51 +08:00
|
|
|
.then(pres => {
|
|
|
|
|
ElMessage.success(pres.message)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
tableStore.index()
|
|
|
|
|
}, 1000)
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
// clearTimeout (time)
|
|
|
|
|
})
|
2024-11-27 16:01:08 +08:00
|
|
|
}
|
|
|
|
|
|
2024-01-17 14:29:31 +08:00
|
|
|
resetForm()
|
|
|
|
|
tableStore.onTableAction('search', {})
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
editEquipmentDelivery(form).then(res => {
|
|
|
|
|
ElMessage.success('修改成功')
|
|
|
|
|
resetForm()
|
|
|
|
|
tableStore.onTableAction('search', {})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 清空表格
|
|
|
|
|
const resetForm = () => {
|
|
|
|
|
ruleFormRef.value.resetFields()
|
|
|
|
|
dialogFormVisible.value = false
|
2024-01-18 15:50:17 +08:00
|
|
|
nextTick(() => {
|
|
|
|
|
// 模拟待编辑数据
|
|
|
|
|
let user = {
|
|
|
|
|
cntractNo: '',
|
2024-09-30 11:33:19 +08:00
|
|
|
devAccessMethod: 'MQTT',
|
2024-01-18 15:50:17 +08:00
|
|
|
devModel: '',
|
|
|
|
|
devType: '',
|
|
|
|
|
name: '',
|
|
|
|
|
ndid: ''
|
|
|
|
|
}
|
|
|
|
|
Object.assign(form, user)
|
2024-01-17 14:29:31 +08:00
|
|
|
})
|
|
|
|
|
}
|
2024-01-16 16:31:11 +08:00
|
|
|
|
2024-01-17 14:29:31 +08:00
|
|
|
const formDevTypeChange = (e: any) => {
|
|
|
|
|
if (!e) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
form.devModel = ''
|
|
|
|
|
}
|
2024-01-16 16:31:11 +08:00
|
|
|
provide('tableStore', tableStore)
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
2025-04-22 08:46:51 +08:00
|
|
|
queryTheDictionary()
|
|
|
|
|
setTimeout(() => {}, 100)
|
2024-01-16 16:31:11 +08:00
|
|
|
})
|
|
|
|
|
|
2025-04-22 08:46:51 +08:00
|
|
|
const addMenu = () => {}
|
2024-01-16 16:31:11 +08:00
|
|
|
</script>
|
2024-06-11 15:50:10 +08:00
|
|
|
<style lang="scss" scoped>
|
2024-01-17 14:29:31 +08:00
|
|
|
.qrcode-label {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
z-index: -99;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
width: 180px;
|
|
|
|
|
height: 180px;
|
|
|
|
|
padding: 10px;
|
|
|
|
|
background: #fff;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
|
|
.qrcode-label-title {
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.qrcode-label-img {
|
|
|
|
|
width: 140px;
|
|
|
|
|
height: 140px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2024-11-27 16:01:08 +08:00
|
|
|
<style lang="scss">
|
|
|
|
|
.customInput {
|
|
|
|
|
.el-input__inner {
|
|
|
|
|
-webkit-text-security: disc !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|