|
@@ -1,22 +1,23 @@
|
|
|
<template>
|
|
|
<div class="mainContentBox">
|
|
|
<avue-crud
|
|
|
- ref="crudRef"
|
|
|
- v-model:search="search"
|
|
|
- v-model="form"
|
|
|
- :data="data"
|
|
|
- :option="option"
|
|
|
- v-model:page="page"
|
|
|
- @row-save="createRow"
|
|
|
- @row-update="updateRow"
|
|
|
- @row-del="deleteRow"
|
|
|
- @search-change="searchChange"
|
|
|
- @search-reset="resetChange"
|
|
|
- @size-change="dataList"
|
|
|
- @current-change="dataList"
|
|
|
- @selection-change="selectionChange"
|
|
|
+ ref="crudRef"
|
|
|
+ v-model:search="search"
|
|
|
+ v-model="form"
|
|
|
+ :data="data"
|
|
|
+ :option="option"
|
|
|
+ v-model:page="page"
|
|
|
+ @row-save="createRow"
|
|
|
+ @row-update="updateRow"
|
|
|
+ @row-del="deleteRow"
|
|
|
+ :permission="permission"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="resetChange"
|
|
|
+ @size-change="dataList"
|
|
|
+ @current-change="dataList"
|
|
|
+ @selection-change="selectionChange"
|
|
|
>
|
|
|
-<!-- <template #collect="scope">
|
|
|
+ <!-- <template #collect="scope">
|
|
|
<el-switch
|
|
|
active-value="1"
|
|
|
inactive-value="0"
|
|
@@ -29,7 +30,7 @@
|
|
|
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
|
|
/>
|
|
|
</template>-->
|
|
|
-<!-- <template #menu="{size,row,index}">
|
|
|
+ <!-- <template #menu="{size,row,index}">
|
|
|
<el-button
|
|
|
v-hasPerm="[buttonPermission.DEVICE.BTNS.maintenance_edit]"
|
|
|
type="primary"
|
|
@@ -51,11 +52,11 @@
|
|
|
</template>
|
|
|
<template #menu-right="{}">
|
|
|
<el-dropdown split-button
|
|
|
- >导入
|
|
|
+ >导入
|
|
|
<template #dropdown>
|
|
|
<el-dropdown-menu>
|
|
|
<el-dropdown-item
|
|
|
- @click="downloadTemplate('/api/v1/device/template')"
|
|
|
+ @click="downloadTemplate('/api/v1/device/template')"
|
|
|
>
|
|
|
<i-ep-download />下载模板
|
|
|
</el-dropdown-item>
|
|
@@ -65,62 +66,64 @@
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
|
</el-dropdown>
|
|
|
- <el-button
|
|
|
- class="ml-3"
|
|
|
- @click="exportData('/api/v1/device/export')"
|
|
|
- >
|
|
|
+ <el-button class="ml-3" @click="exportData('/api/v1/device/export')">
|
|
|
<template #icon> <i-ep-download /> </template>导出
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
<el-dialog
|
|
|
- v-model="dialog.visible"
|
|
|
- :title="dialog.title"
|
|
|
- width="30%"
|
|
|
- @close="dialog.visible = false"
|
|
|
+ v-model="dialog.visible"
|
|
|
+ :title="dialog.title"
|
|
|
+ width="30%"
|
|
|
+ @close="dialog.visible = false"
|
|
|
>
|
|
|
- <el-button type="primary" @click="addItem" icon="el-icon-plus" style="margin-left:15px;width:25px;height:25px;" circle />
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="addItem"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ style="margin-left: 15px; width: 25px; height: 25px"
|
|
|
+ circle
|
|
|
+ />
|
|
|
<el-table
|
|
|
- v-loading="loading"
|
|
|
- ref="ruleListRef"
|
|
|
- :data="pageData"
|
|
|
- style="height: 280px"
|
|
|
+ v-loading="loading"
|
|
|
+ ref="ruleListRef"
|
|
|
+ :data="pageData"
|
|
|
+ style="height: 280px"
|
|
|
>
|
|
|
- <el-table-column
|
|
|
- label="参数"
|
|
|
- prop="fieldCode"
|
|
|
- >
|
|
|
- <template v-slot="{ row}">
|
|
|
- <el-input v-model="row.fieldCode"/>
|
|
|
+ <el-table-column label="参数" prop="fieldCode">
|
|
|
+ <template v-slot="{ row }">
|
|
|
+ <el-input v-model="row.fieldCode" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="参数名称"
|
|
|
- prop="fieldLabel"
|
|
|
- >
|
|
|
- <template v-slot="{ row}">
|
|
|
- <el-input v-model="row.fieldLabel"/>
|
|
|
+ <el-table-column label="参数名称" prop="fieldLabel">
|
|
|
+ <template v-slot="{ row }">
|
|
|
+ <el-input v-model="row.fieldLabel" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="参数值"
|
|
|
- prop="fieldValue"
|
|
|
- >
|
|
|
- <template v-slot="{ row}">
|
|
|
- <el-input v-model="row.fieldValue"/>
|
|
|
+ <el-table-column label="参数值" prop="fieldValue">
|
|
|
+ <template v-slot="{ row }">
|
|
|
+ <el-input v-model="row.fieldValue" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="操作"
|
|
|
- align="center"
|
|
|
- >
|
|
|
- <template v-slot="{ row}">
|
|
|
- <el-button type="danger" @click="minusItem(row)" icon="el-icon-minus" style="margin-left:15px;width:25px;height:25px;" circle />
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
+ <template v-slot="{ row }">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ @click="minusItem(row)"
|
|
|
+ icon="el-icon-minus"
|
|
|
+ style="margin-left: 15px; width: 25px; height: 25px"
|
|
|
+ circle
|
|
|
+ />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <div class="dialog-footer" style="margin-top:20px" align="center">
|
|
|
- <el-button type="primary" v-if="pageData.length>0" @click="handleSubmit">保 存</el-button>
|
|
|
+ <div class="dialog-footer" style="margin-top: 20px" align="center">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ v-if="pageData.length > 0"
|
|
|
+ @click="handleSubmit"
|
|
|
+ >保 存</el-button
|
|
|
+ >
|
|
|
<el-button @click="dialog.visible = false">取消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -130,10 +133,11 @@
|
|
|
<script setup>
|
|
|
import { ref, getCurrentInstance } from "vue";
|
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
|
-import buttonPermission from "@/common/configs/buttonPermission";
|
|
|
-import {configSave,configList,deviceUpdateCollect} from "@/api/device";
|
|
|
+import { checkPerm } from "@/directive/permission";
|
|
|
+import { configSave, configList, deviceUpdateCollect } from "@/api/device";
|
|
|
import { useCommonStoreHook } from "@/store";
|
|
|
import dictDataUtil from "@/common/configs/dictDataUtil";
|
|
|
+import ButtonPermKeys from "@/common/configs/buttonPermission";
|
|
|
const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
|
const test = () => {
|
|
|
isShowTable.value = true;
|
|
@@ -141,64 +145,79 @@ const test = () => {
|
|
|
};
|
|
|
const pageData = ref([]);
|
|
|
const loading = ref(false); // 加载状态
|
|
|
-const addItem = () =>{
|
|
|
- pageData.value.push({deviceType: clickRow.value.deviceType,deviceNo: clickRow.value.deviceNo,type: 1})
|
|
|
-}
|
|
|
-const minusItem = (row) =>{
|
|
|
- pageData.value = pageData.value.filter(item=>item.fieldCode !== row.fieldCode)
|
|
|
-}
|
|
|
-const changeItem =(obj,row) => {
|
|
|
- deviceUpdateCollect({id: row.id,collect: row.collect,deviceNo: row.deviceNo}).then((data)=>{
|
|
|
- if(data.code === '200'){
|
|
|
- ElMessage.success(data.msg);
|
|
|
- }else{
|
|
|
- ElMessage.error(data.msg);
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
-const clickRow = ref(null)
|
|
|
-const showParamsPage = (row)=>{
|
|
|
- clickRow.value = row
|
|
|
- configList({deviceNo: row.deviceNo}).then((data)=>{
|
|
|
- pageData.value = data.data
|
|
|
- dialog.visible = true
|
|
|
- })
|
|
|
-}
|
|
|
+const addItem = () => {
|
|
|
+ pageData.value.push({
|
|
|
+ deviceType: clickRow.value.deviceType,
|
|
|
+ deviceNo: clickRow.value.deviceNo,
|
|
|
+ type: 1,
|
|
|
+ });
|
|
|
+};
|
|
|
+const minusItem = (row) => {
|
|
|
+ pageData.value = pageData.value.filter(
|
|
|
+ (item) => item.fieldCode !== row.fieldCode
|
|
|
+ );
|
|
|
+};
|
|
|
+const permission = reactive({
|
|
|
+ editBtn: checkPerm(ButtonPermKeys.DEVICE.BTNS.device_edit),
|
|
|
+ menu: true,
|
|
|
+});
|
|
|
+const changeItem = (obj, row) => {
|
|
|
+ deviceUpdateCollect({
|
|
|
+ id: row.id,
|
|
|
+ collect: row.collect,
|
|
|
+ deviceNo: row.deviceNo,
|
|
|
+ }).then((data) => {
|
|
|
+ if (data.code === "200") {
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ } else {
|
|
|
+ ElMessage.error(data.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+const clickRow = ref(null);
|
|
|
+const showParamsPage = (row) => {
|
|
|
+ clickRow.value = row;
|
|
|
+ configList({ deviceNo: row.deviceNo }).then((data) => {
|
|
|
+ pageData.value = data.data;
|
|
|
+ dialog.visible = true;
|
|
|
+ });
|
|
|
+};
|
|
|
const dialog = reactive({
|
|
|
title: "模型设置",
|
|
|
visible: false,
|
|
|
});
|
|
|
const handleSubmit = () => {
|
|
|
//判断参数
|
|
|
- let errorData = pageData.value.filter(item=>!item.fieldCode)
|
|
|
- if(errorData.length > 0){
|
|
|
+ let errorData = pageData.value.filter((item) => !item.fieldCode);
|
|
|
+ if (errorData.length > 0) {
|
|
|
ElMessage.warning("请填写参数");
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- errorData = pageData.value.filter(item=>!item.fieldLabel)
|
|
|
- if(errorData.length > 0){
|
|
|
+ errorData = pageData.value.filter((item) => !item.fieldLabel);
|
|
|
+ if (errorData.length > 0) {
|
|
|
ElMessage.warning("请填写参数名");
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- errorData = pageData.value.filter(item=>!item.fieldValue)
|
|
|
- if(errorData.length > 0){
|
|
|
+ errorData = pageData.value.filter((item) => !item.fieldValue);
|
|
|
+ if (errorData.length > 0) {
|
|
|
ElMessage.warning("请填写参数值");
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- configSave(pageData.value).then((data)=>{
|
|
|
- if(data.code === '200'){
|
|
|
+ configSave(pageData.value).then((data) => {
|
|
|
+ if (data.code === "200") {
|
|
|
ElMessage.success(data.msg);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
ElMessage.error(data.msg);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
};
|
|
|
// 传入一个url,后面不带/
|
|
|
const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
useCrud({
|
|
|
src: "/api/v1/device",
|
|
|
});
|
|
|
-const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
|
|
|
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
|
|
|
+ Methords; //增删改查
|
|
|
const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
|
const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
|
|
|
const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
@@ -274,8 +293,8 @@ option.value = Object.assign(option.value, {
|
|
|
prop: "serialDate",
|
|
|
type: "date",
|
|
|
width: 100,
|
|
|
- format: 'YYYY-MM-DD',
|
|
|
- valueFormat: 'YYYY-MM-DD',
|
|
|
+ format: "YYYY-MM-DD",
|
|
|
+ valueFormat: "YYYY-MM-DD",
|
|
|
overHidden: true,
|
|
|
},
|
|
|
{
|
|
@@ -283,8 +302,8 @@ option.value = Object.assign(option.value, {
|
|
|
prop: "activationDate",
|
|
|
type: "date",
|
|
|
width: 100,
|
|
|
- format: 'YYYY-MM-DD',
|
|
|
- valueFormat: 'YYYY-MM-DD',
|
|
|
+ format: "YYYY-MM-DD",
|
|
|
+ valueFormat: "YYYY-MM-DD",
|
|
|
overHidden: true,
|
|
|
},
|
|
|
{
|
|
@@ -332,9 +351,7 @@ option.value = Object.assign(option.value, {
|
|
|
width: 120,
|
|
|
overHidden: true,
|
|
|
search: true,
|
|
|
- dicUrl:
|
|
|
- dictDataUtil.request_url +
|
|
|
- dictDataUtil.TYPE_CODE.device_status,
|
|
|
+ dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.device_status,
|
|
|
props: {
|
|
|
label: "dictLabel",
|
|
|
value: "dictValue",
|
|
@@ -375,9 +392,7 @@ option.value = Object.assign(option.value, {
|
|
|
width: 130,
|
|
|
overHidden: true,
|
|
|
search: true,
|
|
|
- dicUrl:
|
|
|
- dictDataUtil.request_url +
|
|
|
- dictDataUtil.TYPE_CODE.device_type,
|
|
|
+ dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.device_type,
|
|
|
props: {
|
|
|
label: "dictLabel",
|
|
|
value: "dictValue",
|
|
@@ -424,8 +439,8 @@ option.value = Object.assign(option.value, {
|
|
|
prop: "meteringDate",
|
|
|
type: "date",
|
|
|
width: 160,
|
|
|
- format: 'YYYY-MM-DD',
|
|
|
- valueFormat: 'YYYY-MM-DD',
|
|
|
+ format: "YYYY-MM-DD",
|
|
|
+ valueFormat: "YYYY-MM-DD",
|
|
|
overHidden: true,
|
|
|
rules: [
|
|
|
{
|
|
@@ -435,7 +450,7 @@ option.value = Object.assign(option.value, {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
- /* {
|
|
|
+ /* {
|
|
|
label: "所属PAC",
|
|
|
prop: "terminal",
|
|
|
type: "select",
|