修改测试bug
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.lineId"
|
||||
:label="item.name"
|
||||
:label="item.lineName"
|
||||
:value="item.lineId"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -34,7 +34,7 @@ import TableHeader from '@/components/table/header/index.vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import HarmonicRatio from '@/components/cockpit/gridSideStatistics/components/harmonicRatio.vue'
|
||||
import { cslineList } from '@/api/harmonic-boot/cockpit/cockpit'
|
||||
import { cslineList ,governLineList} from '@/api/harmonic-boot/cockpit/cockpit'
|
||||
|
||||
const dialogVisible: any = ref(false)
|
||||
const harmonicRatioRef: any = ref(null)
|
||||
@@ -139,8 +139,10 @@ const tableStore: any = new TableStore({
|
||||
provide('tableStore', tableStore)
|
||||
tableStore.table.params.sortBy = ''
|
||||
tableStore.table.params.orderBy = ''
|
||||
const time:any=ref([])
|
||||
const open = async (row: any,searchBeginTime:any,searchEndTime:any) => {
|
||||
dialogVisible.value = true
|
||||
time.value=[searchBeginTime,searchEndTime]
|
||||
initCSlineList()
|
||||
tableStore.table.params.lineId = row.lineId
|
||||
|
||||
@@ -175,8 +177,19 @@ const onHarmonicRatioClose = () => {
|
||||
}
|
||||
|
||||
const initCSlineList = async () => {
|
||||
const res = await cslineList({})
|
||||
options.value = res.data
|
||||
// const res = await cslineList({})
|
||||
const res = await governLineList({
|
||||
endTime:time.value[1],
|
||||
keywords:"",
|
||||
pageNum:1,
|
||||
pageSize:10000,
|
||||
searchBeginTime:time.value[0],
|
||||
searchEndTime:time.value[1],
|
||||
startTime:time.value[0],
|
||||
timeFlag:1
|
||||
})
|
||||
options.value = res.data.records
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
:showReset="false"
|
||||
@selectChange="selectChange"
|
||||
datePicker
|
||||
v-if="fullscreen" :timeKeyList="prop.timeKey"
|
||||
v-if="fullscreen"
|
||||
:timeKeyList="prop.timeKey"
|
||||
></TableHeader>
|
||||
<Table
|
||||
ref="tableRef"
|
||||
@@ -17,27 +18,29 @@
|
||||
<OverLimitDetails ref="OverLimitDetailsRef" />
|
||||
|
||||
<!-- 上传对话框 -->
|
||||
<el-dialog v-model="uploadDialogVisible" title="上传报告" width="500px" @closed="handleDialogClosed">
|
||||
<el-dialog v-model="uploadDialogVisible" title="上传报告" append-to-body width="500px" @closed="handleDialogClosed">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
class="upload-demo"
|
||||
:auto-upload="true"
|
||||
action=""
|
||||
accept=".doc,.docx,.PDF"
|
||||
:on-change="handleChange"
|
||||
:before-upload="beforeUpload"
|
||||
:http-request="handleUpload"
|
||||
:limit="1"
|
||||
:auto-upload="false"
|
||||
:on-exceed="handleExceed"
|
||||
:on-remove="handleRemove"
|
||||
:file-list="fileList"
|
||||
>
|
||||
<el-button type="primary">点击上传</el-button>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">只能上传Word或PDF文件,且不超过10MB</div>
|
||||
<div class="el-upload__tip">请上传Word或PDF文件</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="uploadDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="uploadDialogVisible = false">确定</el-button>
|
||||
<el-button type="primary" @click="handleUpload">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -59,7 +62,7 @@ const prop = defineProps({
|
||||
h: { type: [String, Number] },
|
||||
width: { type: [String, Number] },
|
||||
height: { type: [String, Number] },
|
||||
timeKey: { type: Array as () => string[] },
|
||||
timeKey: { type: Array as () => string[] },
|
||||
timeValue: { type: Object },
|
||||
interval: { type: Number }
|
||||
})
|
||||
@@ -279,14 +282,18 @@ const handleDialogClosed = () => {
|
||||
}
|
||||
|
||||
// 处理文件超出限制
|
||||
const handleExceed = (files: any, fileList: any) => {
|
||||
const handleExceed = (files: any) => {
|
||||
ElMessage.warning('只能上传一个文件,请先删除已选择的文件')
|
||||
}
|
||||
const handleRemove = (files: any) => {
|
||||
fileList.value = []
|
||||
}
|
||||
|
||||
// 文件变更处理函数
|
||||
const handleChange = (file: any, fileList: any) => {
|
||||
const handleChange = (file: any) => {
|
||||
// 在这里直接处理文件上传逻辑
|
||||
beforeUpload(file.raw) // 注意使用 file.raw 获取原始文件对象
|
||||
// beforeUpload(file.raw) // 注意使用 file.raw 获取原始文件对象
|
||||
fileList.value = [file] // 只保留最新选择的文件
|
||||
}
|
||||
|
||||
// 处理上传前检查
|
||||
@@ -303,11 +310,7 @@ const beforeUpload = (file: any) => {
|
||||
const isLt10M = file.size / 1024 / 1024 < 10
|
||||
|
||||
if (!isValidType) {
|
||||
ElMessage.error('上传文件只能是 Word 文档(.doc/.docx) 或 PDF 文件(.pdf)!')
|
||||
return false
|
||||
}
|
||||
if (!isLt10M) {
|
||||
ElMessage.error('上传文件大小不能超过 10MB!')
|
||||
ElMessage.error('请上传(.doc/.docx/.pdf)格式文件!')
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -315,10 +318,12 @@ const beforeUpload = (file: any) => {
|
||||
return true
|
||||
}
|
||||
|
||||
const handleUpload = async (options: any) => {
|
||||
const { file } = options
|
||||
const handleUpload = async () => {
|
||||
console.log(123, fileList.value)
|
||||
// return
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
formData.append('file', fileList.value[0]?.raw)
|
||||
formData.append('lineId', currentUploadRow.value?.lineId || currentUploadRow.value?.id || '')
|
||||
|
||||
try {
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<el-image
|
||||
:hide-on-click-modal="true"
|
||||
:preview-teleported="true"
|
||||
:preview-src-list="[fieldValue]"
|
||||
:src="fieldValue.length > 100 ? fieldValue : getUrl(fieldValue)"
|
||||
:preview-src-list="[imgList[fieldValue]]"
|
||||
:src="fieldValue.length > 100 ? fieldValue : getUrl(fieldValue) ? imgList[fieldValue] : ''"
|
||||
></el-image>
|
||||
</div>
|
||||
|
||||
@@ -226,10 +226,12 @@ const handlerCommand = (item: OptButton) => {
|
||||
break
|
||||
}
|
||||
}
|
||||
const imgList: any = ref({})
|
||||
const getUrl = (url: string) => {
|
||||
getFileUrl({ filePath: url }).then(res => {
|
||||
return res.data
|
||||
imgList.value[url] = res.data
|
||||
})
|
||||
return true
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ const config = useConfig()
|
||||
const tree = ref()
|
||||
const treRef = ref()
|
||||
const changeDeviceType = (val: any, obj: any) => {
|
||||
console.log('🚀 ~ changeDeviceType ~ val:', val, obj)
|
||||
emit('deviceTypeChange', val, obj)
|
||||
}
|
||||
getDeviceTree().then(res => {
|
||||
@@ -105,7 +104,6 @@ getDeviceTree().then(res => {
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log('🚀 ~ file: deviceTree.vue ~ line 18 ~ getDeviceTree ~ tree:', arr, arr2, arr3)
|
||||
tree.value = res.data
|
||||
|
||||
nextTick(() => {
|
||||
|
||||
@@ -1,109 +1,123 @@
|
||||
<template>
|
||||
<el-dialog draggable width="500px" v-model.trim="dialogVisible" :title="title">
|
||||
<el-scrollbar>
|
||||
<el-form :inline="false" :model="form" label-width="120px" :rules="rules" class="form-one" ref="formRef">
|
||||
<el-form-item label="校验密码:" prop="password">
|
||||
<el-input v-model.trim="form.password" type="password" placeholder="请输入校验密码" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码:" prop="newPwd">
|
||||
<el-input v-model.trim="form.newPwd" type="password" placeholder="请输入新密码" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码:" prop="confirmPwd">
|
||||
<el-input v-model.trim="form.confirmPwd" type="password" placeholder="请输入确认密码" show-password />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, inject } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { passwordConfirm, updatePassword } from '@/api/user-boot/user'
|
||||
import { validatePwd } from '@/utils/common'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
|
||||
const adminInfo = useAdminInfo()
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('修改密码')
|
||||
const formRef = ref()
|
||||
// 注意不要和表单ref的命名冲突
|
||||
const form = reactive({
|
||||
password: '',
|
||||
newPwd: '',
|
||||
confirmPwd: ''
|
||||
})
|
||||
const rules = {
|
||||
password: [
|
||||
{ required: true, message: '请输入校验密码', trigger: 'blur' },
|
||||
{
|
||||
min: 6,
|
||||
max: 16,
|
||||
message: '长度在 6 到 16 个字符',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
newPwd: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{
|
||||
min: 6,
|
||||
max: 16,
|
||||
message: '长度在 6 到 16 个字符',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{ validator: validatePwd, trigger: 'blur' }
|
||||
],
|
||||
confirmPwd: [
|
||||
{ required: true, message: '请确认密码', trigger: 'blur' },
|
||||
{
|
||||
min: 6,
|
||||
max: 16,
|
||||
message: '长度在 6 到 16 个字符',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
validator: (rule: any, value: string, callback: any) => {
|
||||
if (value === '') {
|
||||
callback(new Error('请再次输入密码'))
|
||||
} else if (value !== form.newPwd) {
|
||||
callback(new Error('两次输入密码不一致!'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
form.password = ''
|
||||
form.newPwd = ''
|
||||
form.confirmPwd = ''
|
||||
}
|
||||
const submit = () => {
|
||||
formRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
passwordConfirm(form.password).then(res => {
|
||||
updatePassword({
|
||||
id: adminInfo.$state.userIndex,
|
||||
newPassword: form.newPwd
|
||||
}).then((res: any) => {
|
||||
ElMessage.success('密码修改成功')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<template>
|
||||
<el-dialog draggable width="500px" v-model.trim="dialogVisible" :title="title">
|
||||
<el-scrollbar>
|
||||
<el-form :inline="false" :model="form" label-width="120px" :rules="rules" class="form-one" ref="formRef">
|
||||
<el-form-item label="校验密码:" prop="password">
|
||||
<el-input v-model.trim="form.password" type="password" placeholder="请输入校验密码" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码:" prop="newPwd">
|
||||
<el-input v-model.trim="form.newPwd" type="password" placeholder="请输入新密码" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码:" prop="confirmPwd">
|
||||
<el-input
|
||||
v-model.trim="form.confirmPwd"
|
||||
type="password"
|
||||
placeholder="请输入确认密码"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, inject } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { passwordConfirm, updatePassword } from '@/api/user-boot/user'
|
||||
import { validatePwd } from '@/utils/common'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import router from '@/router'
|
||||
import { useNavTabs } from '@/stores/navTabs'
|
||||
const adminInfo = useAdminInfo()
|
||||
const navTabs = useNavTabs()
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('修改密码')
|
||||
const formRef = ref()
|
||||
// 注意不要和表单ref的命名冲突
|
||||
const form = reactive({
|
||||
password: '',
|
||||
newPwd: '',
|
||||
confirmPwd: ''
|
||||
})
|
||||
const rules = {
|
||||
password: [
|
||||
{ required: true, message: '请输入校验密码', trigger: 'blur' },
|
||||
{
|
||||
min: 6,
|
||||
max: 16,
|
||||
message: '长度在 6 到 16 个字符',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
newPwd: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{
|
||||
min: 6,
|
||||
max: 16,
|
||||
message: '长度在 6 到 16 个字符',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{ validator: validatePwd, trigger: 'blur' }
|
||||
],
|
||||
confirmPwd: [
|
||||
{ required: true, message: '请确认密码', trigger: 'blur' },
|
||||
{
|
||||
min: 6,
|
||||
max: 16,
|
||||
message: '长度在 6 到 16 个字符',
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
validator: (rule: any, value: string, callback: any) => {
|
||||
if (value === '') {
|
||||
callback(new Error('请再次输入密码'))
|
||||
} else if (value !== form.newPwd) {
|
||||
callback(new Error('两次输入密码不一致!'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
required: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
form.password = ''
|
||||
form.newPwd = ''
|
||||
form.confirmPwd = ''
|
||||
}
|
||||
const submit = () => {
|
||||
formRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
passwordConfirm(form.password).then(res => {
|
||||
updatePassword({
|
||||
id: adminInfo.$state.userIndex,
|
||||
newPassword: form.newPwd
|
||||
}).then(async (res: any) => {
|
||||
ElMessage.success('密码修改成功')
|
||||
dialogVisible.value = false
|
||||
|
||||
setTimeout(() => {
|
||||
navTabs.closeTabs()
|
||||
window.localStorage.clear()
|
||||
adminInfo.reset()
|
||||
router.push({ name: 'login' })
|
||||
}, 0)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
@@ -65,6 +65,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
if (
|
||||
!(
|
||||
config.url == '/system-boot/file/upload' ||
|
||||
config.url == '/system-boot/file/getFileUrl' ||
|
||||
config.url == '/harmonic-boot/grid/getAssessOverview' ||
|
||||
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData' ||
|
||||
config.url == '/cs-device-boot/csline/list' ||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog class="cn-operate-dialog" v-model.trim="dialogVisible" :title="title">
|
||||
<el-form :model="form" label-width="auto" class="form-two" :rules="rules">
|
||||
<el-form :model="form" ref="formRef" label-width="auto" class="form-two" :rules="rules">
|
||||
<el-form-item label="用户名" prop="name">
|
||||
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入昵称" />
|
||||
</el-form-item>
|
||||
@@ -138,6 +138,7 @@ const form = reactive({
|
||||
emailNotice: 0,
|
||||
type: 0
|
||||
})
|
||||
const formRef = ref()
|
||||
const rules: Partial<Record<string, Arrayable<FormItemRule>>> = {
|
||||
name: [{ required: true, message: '用户名不能为空', trigger: 'blur' }],
|
||||
role: [{ required: true, message: '角色不能为空', trigger: 'blur' }],
|
||||
@@ -224,9 +225,10 @@ queryRole()
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('新增菜单')
|
||||
const open = (text: string, data?: anyObj) => {
|
||||
formRef.value?.resetFields()
|
||||
title.value = text
|
||||
dialogVisible.value = true
|
||||
console.log("🚀 ~ open ~ data:", data)
|
||||
|
||||
if (data) {
|
||||
for (let key in form) {
|
||||
form[key] = data[key]
|
||||
@@ -251,19 +253,23 @@ const open = (text: string, data?: anyObj) => {
|
||||
}
|
||||
}
|
||||
const submit = async () => {
|
||||
let obj = JSON.parse(JSON.stringify(form))
|
||||
obj.limitTime = obj.limitTime.join('-')
|
||||
delete obj.password
|
||||
if (form.id) {
|
||||
await edit(obj)
|
||||
ElMessage.success('修改成功')
|
||||
} else {
|
||||
form.type = adminInfo.$state.userType + 1
|
||||
await add(obj)
|
||||
ElMessage.success('新增成功')
|
||||
}
|
||||
tableStore.index()
|
||||
dialogVisible.value = false
|
||||
formRef.value.validate(async (valid: any) => {
|
||||
if (valid) {
|
||||
let obj = JSON.parse(JSON.stringify(form))
|
||||
obj.limitTime = obj.limitTime.join('-')
|
||||
delete obj.password
|
||||
if (form.id) {
|
||||
await edit(obj)
|
||||
ElMessage.success('修改成功')
|
||||
} else {
|
||||
form.type = adminInfo.$state.userType + 1
|
||||
await add(obj)
|
||||
ElMessage.success('新增成功')
|
||||
}
|
||||
tableStore.index()
|
||||
dialogVisible.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const changeValue = () => {}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<el-input
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
style="width: 200px; height: 32px"
|
||||
style="width: 240px; height: 32px"
|
||||
placeholder="请输入文件或文件夹名称"
|
||||
clearable
|
||||
v-model.trim="filterText"
|
||||
|
||||
@@ -1,108 +1,119 @@
|
||||
<template>
|
||||
<div class="default-main">
|
||||
<TableHeader>
|
||||
<template v-slot:operation>
|
||||
<el-upload
|
||||
action=""
|
||||
class="upload-demo"
|
||||
:show-file-list="false"
|
||||
:auto-upload="false"
|
||||
:on-change="chooseImage"
|
||||
>
|
||||
<el-button :icon="Plus" type="primary" class="ml10">新增拓扑图</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
<popupEdit ref="popupRef"></popupEdit>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { ref, onMounted, provide } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import popupEdit from './popupEdit.vue'
|
||||
import { deleteTopoTemplate, uploadTopo } from '@/api/cs-device-boot/topologyTemplate'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
defineOptions({
|
||||
name: 'govern/manage/gplot'
|
||||
})
|
||||
const tableRef = ref()
|
||||
const popupRef = ref()
|
||||
const tableStore = new TableStore({
|
||||
showPage: false,
|
||||
url: '/cs-device-boot/topologyTemplate/queryImage',
|
||||
method: 'POST',
|
||||
column: [
|
||||
{ title: '序号', width: 80,formatter: (row: any) => {
|
||||
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||
} },
|
||||
{ title: '拓扑图模版名称', field: 'name', align: 'center' },
|
||||
{ title: '监测点数量', field: 'pointNum', align: 'center' },
|
||||
{ title: '拓扑图', field: 'filePath', align: 'center', render: 'image' },
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
width: '180',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
popupRef.value.open( row)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除该菜单吗?'
|
||||
},
|
||||
click: row => {
|
||||
deleteTopoTemplate(row.id).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
loadCallback: () => {
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.pointNum = item.csLineTopologyTemplateVOList.length
|
||||
})
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
tableStore.table.ref = tableRef.value
|
||||
tableStore.index()
|
||||
tableStore.table.loading = false
|
||||
})
|
||||
const addMenu = () => {
|
||||
// console.log(popupRef)
|
||||
popupRef.value.open('新增菜单')
|
||||
}
|
||||
const chooseImage = e => {
|
||||
console.warn(e)
|
||||
uploadTopo(e.raw).then(res => {
|
||||
ElMessage.success('新增成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="default-main">
|
||||
<TableHeader>
|
||||
<template v-slot:operation>
|
||||
<el-upload
|
||||
action=""
|
||||
class="upload-demo"
|
||||
accept=".svg,.png,.jpg,.jpeg"
|
||||
:show-file-list="false"
|
||||
:auto-upload="false"
|
||||
:on-change="chooseImage"
|
||||
>
|
||||
<el-button :icon="Plus" type="primary" class="ml10">新增拓扑图</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
<popupEdit ref="popupRef"></popupEdit>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { ref, onMounted, provide } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import popupEdit from './popupEdit.vue'
|
||||
import { deleteTopoTemplate, uploadTopo } from '@/api/cs-device-boot/topologyTemplate'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
defineOptions({
|
||||
name: 'govern/manage/gplot'
|
||||
})
|
||||
const tableRef = ref()
|
||||
const popupRef = ref()
|
||||
const tableStore = new TableStore({
|
||||
showPage: false,
|
||||
url: '/cs-device-boot/topologyTemplate/queryImage',
|
||||
method: 'POST',
|
||||
column: [
|
||||
{
|
||||
title: '序号',
|
||||
width: 80,
|
||||
formatter: (row: any) => {
|
||||
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||
}
|
||||
},
|
||||
{ title: '拓扑图模版名称', field: 'name', align: 'center' },
|
||||
{ title: '监测点数量', field: 'pointNum', align: 'center' },
|
||||
{ title: '拓扑图', field: 'filePath', align: 'center', render: 'image' },
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
width: '180',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
popupRef.value.open(row)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除该菜单吗?'
|
||||
},
|
||||
click: row => {
|
||||
deleteTopoTemplate(row.id).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
loadCallback: () => {
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.pointNum = item.csLineTopologyTemplateVOList.length
|
||||
})
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
tableStore.table.ref = tableRef.value
|
||||
tableStore.index()
|
||||
tableStore.table.loading = false
|
||||
})
|
||||
const addMenu = () => {
|
||||
// console.log(popupRef)
|
||||
popupRef.value.open('新增菜单')
|
||||
}
|
||||
const chooseImage = e => {
|
||||
const isWord =
|
||||
e.name.endsWith('.svg') || e.name.endsWith('.png') || e.name.endsWith('.jpg') || e.name.endsWith('.jpeg')
|
||||
|
||||
if (!isWord) {
|
||||
return ElMessage.error('请上传图片或svg文件!')
|
||||
}
|
||||
|
||||
uploadTopo(e.raw).then(res => {
|
||||
ElMessage.success('新增成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,149 +1,154 @@
|
||||
<template>
|
||||
<el-dialog class="cn-operate-dialog" v-model.trim="dialogVisible" title="编辑拓扑图信息">
|
||||
<el-form :label-width="140">
|
||||
<el-form-item label="拓扑图:" style="height: auto !important">
|
||||
<div class="gplot-content">
|
||||
<VueDraggableResizable class-name-draggable="gplot-content-item"
|
||||
class-name-active="gplot-content-item-active" :active="editorIndex == index" :resizable="false"
|
||||
:parent="true" :x="item.left" :y="item.top" :w="item.width" :h="item.height"
|
||||
@dragStart="editorIndex = index" @dragging="resize" v-for="(item, index) in pointList"
|
||||
:key="index" :isResizable="false">
|
||||
<div class="text" style="line-height: 20px; white-space: nowrap"
|
||||
:style="{ color: item.name === '监测点' ? 'red' : 'black' }">
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</VueDraggableResizable>
|
||||
<img :src="imgUrl" class="gplot-content"
|
||||
style="border: 1px solid #dcdfe6; position: unset; user-select: none" draggable="false" />
|
||||
<div>注意监测点不要移出圈</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="监测点位置:" v-if="editorIndex > -1">
|
||||
<div style="display: flex">
|
||||
<el-select v-model.trim="pointList[editorIndex].position" placeholder="请选择" style="flex: 1"
|
||||
@change="positionChange">
|
||||
<el-option v-for="item in linePosition" :key="item.id" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button class="ml20" type="danger" @click="deletePoint" icon="el-icon-Delete">删除</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label=" ">
|
||||
<el-button type="primary" @click="addPoint">添加监测点</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, inject } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { fullUrl } from '@/utils/common'
|
||||
import VueDraggableResizable from 'vue-draggable-resizable'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { addLineTemplate } from '@/api/cs-device-boot/lineTemplate'
|
||||
|
||||
defineOptions({
|
||||
name: 'govern/manage/gplot/popupEdit'
|
||||
})
|
||||
const tableStore = inject('tableStore') as TableStore
|
||||
const editorIndex = ref(-1)
|
||||
const pointList = ref<any[]>([])
|
||||
const topoId = ref()
|
||||
const imgUrl = ref('')
|
||||
const linePosition = useDictData().getBasicData('Line_Position')
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const open = (data: anyObj) => {
|
||||
pointList.value = data.csLineTopologyTemplateVOList.map((item: any) => {
|
||||
return {
|
||||
name: linePosition.find(item2 => {
|
||||
return item2.id == item.linePostion
|
||||
})?.name,
|
||||
position: item.linePostion,
|
||||
width: 'auto',
|
||||
height: 20,
|
||||
top: item.lng,
|
||||
left: item.lat
|
||||
}
|
||||
})
|
||||
topoId.value = data.id
|
||||
imgUrl.value = fullUrl(data.filePath)
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const positionChange = (e: string) => {
|
||||
pointList.value[editorIndex.value].name = linePosition.find((item: any) => {
|
||||
return item.id == e
|
||||
})?.name
|
||||
}
|
||||
const resize = (left: number, top: number) => {
|
||||
const dom = pointList.value[editorIndex.value]
|
||||
dom.left = left
|
||||
dom.top = top
|
||||
}
|
||||
const addPoint = () => {
|
||||
pointList.value.push({
|
||||
name: '监测点',
|
||||
position: '',
|
||||
width: 'auto',
|
||||
height: 20,
|
||||
top: 100,
|
||||
left: 100
|
||||
})
|
||||
editorIndex.value = pointList.value.length - 1
|
||||
}
|
||||
const deletePoint = () => {
|
||||
pointList.value.splice(editorIndex.value, 1)
|
||||
editorIndex.value = -1
|
||||
}
|
||||
const submit = async () => {
|
||||
let allSelect = pointList.value.some(item => item.position === '')
|
||||
if (allSelect) {
|
||||
ElMessage.warning('请完善所有监测点位置')
|
||||
return
|
||||
}
|
||||
let arr = pointList.value.map(item => {
|
||||
return {
|
||||
linePostion: item.position,
|
||||
lat: item.left,
|
||||
lng: item.top,
|
||||
topoId: topoId.value
|
||||
}
|
||||
})
|
||||
addLineTemplate(arr).then(res => {
|
||||
ElMessage.success('保存成功')
|
||||
tableStore.index()
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import 'vue-draggable-resizable/style.css';
|
||||
|
||||
.gplot-content {
|
||||
position: relative;
|
||||
width: 375px;
|
||||
object-fit: cover;
|
||||
overflow: hidden;
|
||||
|
||||
.gplot-content-item {
|
||||
border-color: transparent;
|
||||
cursor: move;
|
||||
|
||||
&-active {
|
||||
border-color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<el-dialog class="cn-operate-dialog" v-model.trim="dialogVisible" title="编辑拓扑图信息">
|
||||
<el-form :label-width="140">
|
||||
<el-form-item label="拓扑图:" style="height: auto !important">
|
||||
<div class="gplot-content">
|
||||
<VueDraggableResizable class-name-draggable="gplot-content-item"
|
||||
class-name-active="gplot-content-item-active" :active="editorIndex == index" :resizable="false"
|
||||
:parent="true" :x="item.left" :y="item.top" :w="item.width" :h="item.height"
|
||||
@dragStart="editorIndex = index" @dragging="resize" v-for="(item, index) in pointList"
|
||||
:key="index" :isResizable="false">
|
||||
<div class="text" style="line-height: 20px; white-space: nowrap"
|
||||
:style="{ color: item.name === '监测点' ? 'red' : 'black' }">
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</VueDraggableResizable>
|
||||
<img :src="imgUrl" class="gplot-content"
|
||||
style="border: 1px solid #dcdfe6; position: unset; user-select: none" draggable="false" />
|
||||
<div>注意监测点不要移出圈</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="监测点位置:" v-if="editorIndex > -1">
|
||||
<div style="display: flex">
|
||||
<el-select v-model.trim="pointList[editorIndex].position" placeholder="请选择" style="flex: 1"
|
||||
@change="positionChange">
|
||||
<el-option v-for="item in linePosition" :key="item.id" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button class="ml20" type="danger" @click="deletePoint" icon="el-icon-Delete">删除</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label=" ">
|
||||
<el-button type="primary" @click="addPoint">添加监测点</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, inject } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { fullUrl } from '@/utils/common'
|
||||
import VueDraggableResizable from 'vue-draggable-resizable'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { addLineTemplate } from '@/api/cs-device-boot/lineTemplate'
|
||||
|
||||
defineOptions({
|
||||
name: 'govern/manage/gplot/popupEdit'
|
||||
})
|
||||
const tableStore = inject('tableStore') as TableStore
|
||||
const editorIndex = ref(-1)
|
||||
const pointList = ref<any[]>([])
|
||||
const topoId = ref()
|
||||
const imgUrl = ref('')
|
||||
const linePosition = useDictData().getBasicData('Line_Position')
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const open = (data: anyObj) => {
|
||||
pointList.value = data.csLineTopologyTemplateVOList.map((item: any) => {
|
||||
return {
|
||||
name: linePosition.find(item2 => {
|
||||
return item2.id == item.linePostion
|
||||
})?.name,
|
||||
position: item.linePostion,
|
||||
width: 'auto',
|
||||
height: 20,
|
||||
top: item.lng,
|
||||
left: item.lat
|
||||
}
|
||||
})
|
||||
topoId.value = data.id
|
||||
imgUrl.value = fullUrl(data.filePath)
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const positionChange = (e: string) => {
|
||||
pointList.value[editorIndex.value].name = linePosition.find((item: any) => {
|
||||
return item.id == e
|
||||
})?.name
|
||||
}
|
||||
const resize = (left: number, top: number) => {
|
||||
const dom = pointList.value[editorIndex.value]
|
||||
dom.left = left
|
||||
dom.top = top
|
||||
}
|
||||
const addPoint = () => {
|
||||
pointList.value.push({
|
||||
name: '监测点',
|
||||
position: '',
|
||||
width: 'auto',
|
||||
height: 20,
|
||||
top: 100,
|
||||
left: 100
|
||||
})
|
||||
editorIndex.value = pointList.value.length - 1
|
||||
}
|
||||
const deletePoint = () => {
|
||||
pointList.value.splice(editorIndex.value, 1)
|
||||
editorIndex.value = -1
|
||||
}
|
||||
const submit = async () => {
|
||||
let allSelect = pointList.value.some(item => item.position === '')
|
||||
|
||||
if (pointList.value.length == 0) {
|
||||
ElMessage.warning('请添加监测点!')
|
||||
return
|
||||
}
|
||||
if (allSelect) {
|
||||
ElMessage.warning('请完善所有监测点位置!')
|
||||
return
|
||||
}
|
||||
let arr = pointList.value.map(item => {
|
||||
return {
|
||||
linePostion: item.position,
|
||||
lat: item.left,
|
||||
lng: item.top,
|
||||
topoId: topoId.value
|
||||
}
|
||||
})
|
||||
addLineTemplate(arr).then(res => {
|
||||
ElMessage.success('保存成功')
|
||||
tableStore.index()
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import 'vue-draggable-resizable/style.css';
|
||||
|
||||
.gplot-content {
|
||||
position: relative;
|
||||
width: 375px;
|
||||
object-fit: cover;
|
||||
overflow: hidden;
|
||||
|
||||
.gplot-content-item {
|
||||
border-color: transparent;
|
||||
cursor: move;
|
||||
|
||||
&-active {
|
||||
border-color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="default-main">
|
||||
<TableHeader date-picker>
|
||||
<TableHeader :showReset="false">
|
||||
<template #operation>
|
||||
<el-button :icon="Plus" type="primary" @click="addMenu" class="ml10">新增</el-button>
|
||||
</template>
|
||||
@@ -21,7 +21,7 @@ import { Plus } from '@element-plus/icons-vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
|
||||
defineOptions({
|
||||
name: 'govern/device/sensitiveLoadMange'
|
||||
name: 'govern/sensitiveLoadMange/index'
|
||||
})
|
||||
const detail = ref()
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<template>
|
||||
<el-dialog width="500px" v-model.trim="dialogVisible" :title="title">
|
||||
|
||||
<el-form :model="form" class="form-one" label-width="auto">
|
||||
<el-form-item label="名称">
|
||||
<el-form :model="form" ref="formRef" class="form-one" label-width="auto" :rules="rules">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="编码">
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input maxlength="32" show-word-limit v-model.trim="form.code" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" v-if="title == '新增'|| title == '编辑'">
|
||||
<el-select v-model.trim="form.type" placeholder="请选择类型">
|
||||
<el-form-item label="类型" v-if="title == '新增' || title == '编辑'" >
|
||||
<el-select v-model.trim="form.type" placeholder="请选择类型" clearable>
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.name" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -17,10 +16,9 @@
|
||||
<el-input maxlength="32" show-word-limit v-model.trim="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="排序">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input maxlength="32" show-word-limit-number v-model.trim="form.sort" :min="0" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
@@ -49,29 +47,35 @@ const form = reactive({
|
||||
name: '',
|
||||
code: '',
|
||||
remark: '',
|
||||
// type: 2,
|
||||
type: 2,
|
||||
sort: 100,
|
||||
pid: '',
|
||||
id: ''
|
||||
})
|
||||
const formRef = ref()
|
||||
const rules = {
|
||||
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '请输入排序', trigger: 'blur' }]
|
||||
}
|
||||
const options = ref([
|
||||
{ name: '通用指标', value: 2 },
|
||||
{ name: 'APF模块', value: 3 },
|
||||
{ name: '星型接线', value: 4 },
|
||||
{ name: '角型接线', value: 5 },
|
||||
{ name: 'V型接线', value: 6 },
|
||||
{ name: '驾驶舱指标', value: 7 },
|
||||
{ name: '驾驶舱指标', value: 7 }
|
||||
])
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('新增菜单')
|
||||
const open = (text: string, data?: anyObj) => {
|
||||
formRef.value?.resetFields()
|
||||
title.value = text
|
||||
for (let key in form) {
|
||||
form[key] = data ? data[key] : ''
|
||||
|
||||
if (key == 'sort') {
|
||||
|
||||
form[key] = data?.sort ? data[key] : 100
|
||||
// console.log("🚀 ~ open ~ form[key]:", form[key])
|
||||
}
|
||||
@@ -80,28 +84,24 @@ const open = (text: string, data?: anyObj) => {
|
||||
}
|
||||
const submit = async () => {
|
||||
// 非空校验
|
||||
for (let key in form) {
|
||||
if (key != 'pid' && key != 'id' && key != 'sort') {
|
||||
if (!form[key]) {
|
||||
ElMessage.warning('请填写完整信息')
|
||||
return
|
||||
formRef.value.validate(async valid => {
|
||||
if (valid) {
|
||||
if (form.id) {
|
||||
await updateStatistical(form).then(res => {
|
||||
ElMessage.success('编辑成功')
|
||||
})
|
||||
} else {
|
||||
if (!form.pid) {
|
||||
form.pid = tableStore.table.params.pid
|
||||
}
|
||||
await addDictTree(form).then(res => {
|
||||
ElMessage.success('新增成功')
|
||||
})
|
||||
}
|
||||
emits('over')
|
||||
dialogVisible.value = false
|
||||
}
|
||||
}
|
||||
if (form.id) {
|
||||
await updateStatistical(form).then(res => {
|
||||
ElMessage.success('编辑成功')
|
||||
})
|
||||
} else {
|
||||
if (!form.pid) {
|
||||
form.pid = tableStore.table.params.pid
|
||||
}
|
||||
await addDictTree(form).then(res => {
|
||||
ElMessage.success('新增成功')
|
||||
})
|
||||
}
|
||||
emits('over')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
|
||||
Reference in New Issue
Block a user