update 设备分组

This commit is contained in:
lb
2023-10-10 09:40:22 +08:00
parent 769830c448
commit 723d83cc02
3 changed files with 66 additions and 46 deletions

View File

@@ -31,10 +31,11 @@
<div class="form-part" v-if="section.key == 'base'">
<el-skeleton v-if="!showForm" animated />
<DialogForm
<BaseInfoForm
key="drawer-dialog-form"
v-if="showForm"
ref="form"
:disabled="mode.includes('detail')"
:dataForm="form"
:rows="formRows" />
</div>
@@ -69,22 +70,20 @@
</div>
<div class="drawer-body__footer">
<el-button style="margin-right: 10px" @click="handleCancel">
返回
<el-button style="" @click="handleCancel">
取消
</el-button>
<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
编辑
</el-button>
<span v-else>
<el-button type="primary" @click="handleSave">保存</el-button>
<!-- sections的第二项必须是 属性列表 -->
<el-button
<el-button v-else type="primary" @click="handleSave">保存</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button>
</span>
</el-button> -->
</div>
</div>
@@ -102,14 +101,15 @@
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
:dataForm="attrForm"
:disabled="mode.includes('detail')"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
// import DialogForm from '@/components/DialogForm';
import BaseInfoForm from '@/components/DialogForm';
import DialogForm from './dialogForm';
const SmallTitle = {
@@ -138,7 +138,7 @@ const SmallTitle = {
};
export default {
components: { SmallTitle, DialogForm },
components: { SmallTitle, DialogForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'dataId'], // dataId 作为一个通用的存放id的字段
data() {
return {
@@ -151,9 +151,13 @@ export default {
attrTitle: '',
attrForm: {
id: null,
equipmentId: null,
name: '',
value: '',
equipmentGroupId: '',
code: '',
type: '',
grade: '',
alarmCode: '',
alarmContent: '',
plcParamName: '',
},
attrFormVisible: false,
attrRows: [
@@ -207,8 +211,8 @@ export default {
attrQuery: {
params: {
pageNo: 1,
pageSize: 10
}
pageSize: 10,
},
}, // 属性列表的请求
infoQuery: null, // 基本信息的请求
attrFormSubmitting: false,
@@ -318,14 +322,18 @@ export default {
// 新增属性
handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备信息');
if (!this.dataId) return this.$message.error('请先创建设备分组信息');
this.attrForm = {
id: null,
equipmentId: this.dataId,
name: '',
value: '',
equipmentGroupId: this.dataId,
code: '',
type: '',
grade: '',
alarmCode: '',
alarmContent: '',
plcParamName: '',
};
this.attrTitle = '添加设备属性';
this.attrTitle = '添加设备分组报警';
this.attrFormVisible = true;
},
@@ -338,14 +346,14 @@ export default {
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备属性';
this.attrTitle = '编辑设备分组报警';
this.attrFormVisible = true;
}
},
// 删除属性
handleDeleteAttr(attrId) {
this.$confirm('确定删除该属性?', '提示', {
this.$confirm('确定删除该分组报警?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@@ -406,19 +414,11 @@ export default {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
this.$confirm(`确定删除该报警?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
deleteProductAttr(raw.data.id).then(({ data }) => {
this.$message({