|
@@ -16,6 +16,19 @@
|
|
|
@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"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
<template #menu-left="{ size }">
|
|
|
<el-button
|
|
|
:disabled="toDeleteIds.length < 1"
|
|
@@ -32,8 +45,7 @@
|
|
|
<script setup>
|
|
|
import { ref, getCurrentInstance } from "vue";
|
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
|
-import buttonPermission from "@/common/configs/buttonPermission";
|
|
|
-import {configList} from "@/api/device";
|
|
|
+import {configSave,configList,deviceUpdateCollect} from "@/api/device";
|
|
|
import { useCommonStoreHook } from "@/store";
|
|
|
import dictDataUtil from "@/common/configs/dictDataUtil";
|
|
|
const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
@@ -59,7 +71,16 @@ const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
|
|
|
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'){
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ }else{
|
|
|
+ row.collect = row.collect === '0' ? '1' : '0'
|
|
|
+ ElMessage.error(data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
// 设置表格列或者其他自定义的option
|
|
|
option.value = Object.assign(option.value, {
|
|
|
delBtn: false,
|
|
@@ -98,8 +119,8 @@ option.value = Object.assign(option.value, {
|
|
|
prop: "deviceType",
|
|
|
type: "select",
|
|
|
width: 130,
|
|
|
+ editDisabled: true,
|
|
|
overHidden: true,
|
|
|
- search: true,
|
|
|
dicUrl:
|
|
|
dictDataUtil.request_url +
|
|
|
dictDataUtil.TYPE_CODE.device_type,
|
|
@@ -152,6 +173,14 @@ option.value = Object.assign(option.value, {
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
+ label: "是否采集",
|
|
|
+ prop: "collect",
|
|
|
+ editDisplay: false,
|
|
|
+ addDisplay: false,
|
|
|
+ slot: true,
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
label: "负责人",
|
|
|
prop: "head",
|
|
|
width: 160,
|