|
@@ -42,15 +42,22 @@
|
|
<div class="page page-full">
|
|
<div class="page page-full">
|
|
<el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange" row-key="id" v-loading="loading">
|
|
<el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange" row-key="id" v-loading="loading">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
- <el-table-column prop="deviceName" v-col="'deviceName'" label="设备名称" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
|
- <el-table-column prop="deviceKey" v-col="'deviceKey'" label="设备KEY" show-overflow-tooltip></el-table-column>
|
|
|
|
- <el-table-column prop="deviceNumber" v-col="'deviceNumber'" label="设备编码" show-overflow-tooltip></el-table-column>
|
|
|
|
- <el-table-column prop="deviceCategory" v-col="'deviceCategory'" label="设备类型" show-overflow-tooltip></el-table-column>
|
|
|
|
- <el-table-column prop="installTime" v-col="'installTime'" label="安装时间" width="160" align="center"></el-table-column>
|
|
|
|
- <el-table-column label="操作" width="120" align="center">
|
|
|
|
|
|
+ <el-table-column prop="assetInfo.deviceName" v-col="'deviceName'" label="设备名称" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
|
+ <el-table-column prop="assetInfo.deviceKey" v-col="'deviceKey'" label="设备KEY" min-width="90" show-overflow-tooltip></el-table-column>
|
|
|
|
+ <el-table-column prop="assetInfo.deviceNumber" v-col="'deviceNumber'" label="设备编码" show-overflow-tooltip></el-table-column>
|
|
|
|
+ <el-table-column prop="assetInfo.deviceCategory" v-col="'deviceCategory'" label="设备类型" show-overflow-tooltip></el-table-column>
|
|
|
|
+ <el-table-column prop="assetInfo.installTime" v-col="'installTime'" label="安装时间" width="160" align="center"></el-table-column>
|
|
|
|
+ <el-table-column prop="status" label="状态" width="70" v-col="'status'" align="center">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-button size="small" text type="warning" v-auth="'edit'" @click="addOrEdit(scope.row)">编辑</el-button>
|
|
|
|
|
|
+ <el-switch v-model="scope.row.status" v-auth="'change-status'" inline-prompt :active-value="1" :inactive-value="0" active-text="启" inactive-text="禁" @change="handleStatusChange(scope.row)">
|
|
|
|
+ </el-switch>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" width="170" v-col="'handle'" align="center">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <el-button size="small" text type="warning" v-auth="'unbind'" @click="unbind(scope.row)">解绑</el-button>
|
|
<el-button size="small" text type="info" v-auth="'del'" @click="del(scope.row)">删除</el-button>
|
|
<el-button size="small" text type="info" v-auth="'del'" @click="del(scope.row)">删除</el-button>
|
|
|
|
+ <el-button size="small" text type="primary" v-auth="'set'" @click="set(scope.row)">设置筛选条件</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -59,6 +66,7 @@
|
|
</el-card>
|
|
</el-card>
|
|
</div>
|
|
</div>
|
|
<EditForm ref="editFormRef" @getList="getList(1)"></EditForm>
|
|
<EditForm ref="editFormRef" @getList="getList(1)"></EditForm>
|
|
|
|
+ <FilterVue ref="filterRef" @getList="getList(1)"></FilterVue>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -69,6 +77,7 @@ import { useSearch } from '/@/hooks/useCommon'
|
|
|
|
|
|
import { ElMessageBox, ElMessage } from 'element-plus'
|
|
import { ElMessageBox, ElMessage } from 'element-plus'
|
|
import EditForm from './edit.vue'
|
|
import EditForm from './edit.vue'
|
|
|
|
+import FilterVue from './filter.vue'
|
|
|
|
|
|
import { ref, onMounted } from 'vue'
|
|
import { ref, onMounted } from 'vue'
|
|
const defaultProps = {
|
|
const defaultProps = {
|
|
@@ -77,6 +86,7 @@ const defaultProps = {
|
|
}
|
|
}
|
|
|
|
|
|
const queryRef = ref()
|
|
const queryRef = ref()
|
|
|
|
+const filterRef = ref()
|
|
const treeData = ref()
|
|
const treeData = ref()
|
|
const editFormRef = ref()
|
|
const editFormRef = ref()
|
|
const productIno = ref()
|
|
const productIno = ref()
|
|
@@ -93,14 +103,12 @@ const handleSelectionChange = (selection: any[]) => {
|
|
ids.value = selection.map((item) => item.id);
|
|
ids.value = selection.map((item) => item.id);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+const addOrEdit = () => {
|
|
|
|
+ editFormRef.value.open()
|
|
|
|
+}
|
|
|
|
|
|
-const addOrEdit = async (row?: any) => {
|
|
|
|
- if (row) {
|
|
|
|
- editFormRef.value.open(row, productIno.value)
|
|
|
|
- return
|
|
|
|
- } else {
|
|
|
|
- editFormRef.value.open({}, productIno.value)
|
|
|
|
- }
|
|
|
|
|
|
+const set = (row: any) => {
|
|
|
|
+ filterRef.value.open(row.id)
|
|
}
|
|
}
|
|
|
|
|
|
const handleNodeClick = (data: any) => {
|
|
const handleNodeClick = (data: any) => {
|
|
@@ -114,24 +122,55 @@ const batchdel = () => {
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
type: 'warning',
|
|
}).then(async () => {
|
|
}).then(async () => {
|
|
- await device.dev_asset.delete({ ids: ids.value })
|
|
|
|
|
|
+ await device.assetRelationship.delete(ids.value)
|
|
ElMessage.success('删除成功')
|
|
ElMessage.success('删除成功')
|
|
getList()
|
|
getList()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
const del = (row: any) => {
|
|
const del = (row: any) => {
|
|
- ElMessageBox.confirm('是否确认删除名称为:"' + row.deviceName + '"的数据项?', '提示', {
|
|
|
|
|
|
+ ElMessageBox.confirm('是否确认删除该设备档案', '提示', {
|
|
confirmButtonText: '确认',
|
|
confirmButtonText: '确认',
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
type: 'warning',
|
|
}).then(async () => {
|
|
}).then(async () => {
|
|
- await device.dev_asset.delete({ ids: row.id })
|
|
|
|
|
|
+ await device.assetRelationship.delete([row.id])
|
|
ElMessage.success('删除成功')
|
|
ElMessage.success('删除成功')
|
|
getList()
|
|
getList()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 状态修改
|
|
|
|
+const handleStatusChange = (row: any) => {
|
|
|
|
+ let text = row.status === 1 ? '启用' : '停用';
|
|
|
|
+ ElMessageBox.confirm('确认要【' + text + '】吗?', '警告', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ .then(function () {
|
|
|
|
+ return device.assetRelationship.editStatus(row.id, row.status);
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ ElMessage.success(text + '成功');
|
|
|
|
+ })
|
|
|
|
+ .catch(function () {
|
|
|
|
+ row.status = row.status === 0 ? 1 : 0;
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const unbind = (row: any) => {
|
|
|
|
+ ElMessageBox.confirm('是否确认解绑', '提示', {
|
|
|
|
+ confirmButtonText: '确认',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ }).then(async () => {
|
|
|
|
+ await device.assetRelationship.unBind(row.id)
|
|
|
|
+ ElMessage.success('解绑成功')
|
|
|
|
+ getList()
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
// getCateList()
|
|
// getCateList()
|
|
</script>
|
|
</script>
|