|
@@ -1,42 +1,42 @@
|
|
|
<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"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="resetChange"
|
|
|
+ @size-change="dataList"
|
|
|
+ @current-change="dataList"
|
|
|
+ @selection-change="selectionChange"
|
|
|
>
|
|
|
<template #collect="scope">
|
|
|
<el-switch
|
|
|
- active-value="1"
|
|
|
- inactive-value="0"
|
|
|
- inline-prompt
|
|
|
- active-text="是"
|
|
|
- inactive-text="否"
|
|
|
- v-model="scope.row.collect"
|
|
|
- @click="changeItem($event,scope.row)"
|
|
|
- class="ml-2"
|
|
|
- style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
|
|
+ active-value="1"
|
|
|
+ inactive-value="0"
|
|
|
+ inline-prompt
|
|
|
+ active-text="是"
|
|
|
+ inactive-text="否"
|
|
|
+ v-model="scope.row.collect"
|
|
|
+ @click="changeItem($event, scope.row)"
|
|
|
+ class="ml-2"
|
|
|
+ style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
|
|
/>
|
|
|
</template>
|
|
|
- <template #menu="{size,row,index}">
|
|
|
- <el-button
|
|
|
+ <template #menu="{ size, row, index }">
|
|
|
+ <!-- <el-button
|
|
|
type="primary"
|
|
|
link
|
|
|
size="small"
|
|
|
@click="restart(row)"
|
|
|
><i-ep-edit />重启
|
|
|
- </el-button>
|
|
|
+ </el-button> -->
|
|
|
</template>
|
|
|
<template #menu-left="{ size }">
|
|
|
<el-button
|
|
@@ -54,7 +54,7 @@
|
|
|
<script setup>
|
|
|
import { ref, getCurrentInstance } from "vue";
|
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
|
-import {configSave,deviceRestart,deviceUpdateCollect} from "@/api/device";
|
|
|
+import { configSave, deviceRestart, deviceUpdateCollect } from "@/api/device";
|
|
|
import { useCommonStoreHook } from "@/store";
|
|
|
import dictDataUtil from "@/common/configs/dictDataUtil";
|
|
|
const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
@@ -76,29 +76,38 @@ const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
useCrud({
|
|
|
src: "/api/v1/pac",
|
|
|
});
|
|
|
-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对象
|
|
|
-const changeItem =(obj,row) => {
|
|
|
- deviceUpdateCollect({id: row.id,collect: row.collect,deviceNo: row.deviceNo}).then((data)=>{
|
|
|
- if(data.code === '200'){
|
|
|
+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{
|
|
|
- row.collect = row.collect === '0' ? '1' : '0'
|
|
|
+ } else {
|
|
|
+ row.collect = row.collect === "0" ? "1" : "0";
|
|
|
ElMessage.error(data.msg);
|
|
|
}
|
|
|
- })
|
|
|
-}
|
|
|
-const restart =(row) => {
|
|
|
- deviceRestart({id: row.id,collect: row.collect,deviceNo: row.deviceNo}).then((data)=>{
|
|
|
- if(data.code === '200'){
|
|
|
+ });
|
|
|
+};
|
|
|
+const restart = (row) => {
|
|
|
+ deviceRestart({
|
|
|
+ id: row.id,
|
|
|
+ collect: row.collect,
|
|
|
+ deviceNo: row.deviceNo,
|
|
|
+ }).then((data) => {
|
|
|
+ if (data.code === "200") {
|
|
|
ElMessage.success(data.msg);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
ElMessage.error(data.msg);
|
|
|
}
|
|
|
- })
|
|
|
-}
|
|
|
+ });
|
|
|
+};
|
|
|
// 设置表格列或者其他自定义的option
|
|
|
option.value = Object.assign(option.value, {
|
|
|
delBtn: false,
|
|
@@ -139,9 +148,7 @@ option.value = Object.assign(option.value, {
|
|
|
width: 130,
|
|
|
editDisabled: true,
|
|
|
overHidden: true,
|
|
|
- dicUrl:
|
|
|
- dictDataUtil.request_url +
|
|
|
- dictDataUtil.TYPE_CODE.device_type,
|
|
|
+ dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.device_type,
|
|
|
props: {
|
|
|
label: "dictLabel",
|
|
|
value: "dictValue",
|
|
@@ -161,9 +168,7 @@ option.value = Object.assign(option.value, {
|
|
|
width: 160,
|
|
|
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",
|
|
@@ -227,7 +232,7 @@ option.value = Object.assign(option.value, {
|
|
|
props: {
|
|
|
label: "deptName",
|
|
|
value: "id",
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
label: "设备位置",
|