lb #39

Merged
g7hoo merged 16 commits from lb into test 2023-10-11 10:33:08 +08:00
3 changed files with 66 additions and 46 deletions
Showing only changes of commit 723d83cc02 - Show all commits

View File

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

View File

@ -18,6 +18,7 @@
prop="code" prop="code"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input <el-input
:disabled="disabled"
v-model="dataForm.code" v-model="dataForm.code"
@change="$emit('update', dataForm)" @change="$emit('update', dataForm)"
placeholder="请输入工段排序" /> placeholder="请输入工段排序" />
@ -46,6 +47,7 @@
prop="type" prop="type"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
:disabled="disabled"
v-model="dataForm.type" v-model="dataForm.type"
placeholder="请选择报警类型" placeholder="请选择报警类型"
@change="$emit('update', dataForm)"> @change="$emit('update', dataForm)">
@ -68,6 +70,7 @@
prop="grade" prop="grade"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
:disabled="disabled"
v-model="dataForm.grade" v-model="dataForm.grade"
placeholder="请选择报警级别" placeholder="请选择报警级别"
@change="$emit('update', dataForm)"> @change="$emit('update', dataForm)">
@ -86,6 +89,7 @@
label="设备报警编码" label="设备报警编码"
prop="alarmCode"> prop="alarmCode">
<el-input <el-input
:disabled="disabled"
v-model="dataForm.alarmCode" v-model="dataForm.alarmCode"
@change="$emit('update', dataForm)" @change="$emit('update', dataForm)"
placeholder="请输入设备报警编码" /> placeholder="请输入设备报警编码" />
@ -99,6 +103,7 @@
prop="plcParamName" prop="plcParamName"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input <el-input
:disabled="disabled"
v-model="dataForm.plcParamName" v-model="dataForm.plcParamName"
placeholder="请输入参数列名" placeholder="请输入参数列名"
@change="$emit('update', dataForm)"></el-input> @change="$emit('update', dataForm)"></el-input>
@ -110,6 +115,7 @@
prop="alarmContent" prop="alarmContent"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input <el-input
:disabled="disabled"
v-model="dataForm.alarmContent" v-model="dataForm.alarmContent"
placeholder="请输入报警内容" placeholder="请输入报警内容"
@change="$emit('update', dataForm)"></el-input> @change="$emit('update', dataForm)"></el-input>
@ -133,6 +139,10 @@ export default {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
disabled: {
type: Boolean,
default: false,
},
}, },
data() { data() {
return { return {

View File

@ -18,24 +18,25 @@
prop="code" prop="code"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input <el-input
:disabled="disabled"
v-model="dataForm.code" v-model="dataForm.code"
@change="$emit('update', dataForm)" @change="$emit('update', dataForm)"
placeholder="请输入工段排序" /> placeholder="请输入工段排序" />
</el-form-item> </el-form-item>
<!-- <!--
<el-form-item <el-form-item
label="报警编码" label="报警编码"
prop="code" prop="code"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="dataForm.code" v-model="dataForm.code"
placeholder="请选择产线" placeholder="请选择产线"
@change="handleProductlineChange"> @change="handleProductlineChange">
<el-option <el-option
v-for="opt in productionLineList" v-for="opt in productionLineList"
:key="opt.value" :key="opt.value"
:label="opt.label" :label="opt.label"
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</el-form-item> --> </el-form-item> -->
</el-col> </el-col>
@ -47,6 +48,7 @@
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="dataForm.type" v-model="dataForm.type"
:disabled="disabled"
placeholder="请选择报警类型" placeholder="请选择报警类型"
@change="$emit('update', dataForm)"> @change="$emit('update', dataForm)">
<el-option <el-option
@ -68,6 +70,7 @@
prop="grade" prop="grade"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
:disabled="disabled"
v-model="dataForm.grade" v-model="dataForm.grade"
placeholder="请选择报警级别" placeholder="请选择报警级别"
@change="$emit('update', dataForm)"> @change="$emit('update', dataForm)">
@ -86,6 +89,7 @@
label="设备报警编码" label="设备报警编码"
prop="alarmCode"> prop="alarmCode">
<el-input <el-input
:disabled="disabled"
v-model="dataForm.alarmCode" v-model="dataForm.alarmCode"
@change="$emit('update', dataForm)" @change="$emit('update', dataForm)"
placeholder="请输入设备报警编码" /> placeholder="请输入设备报警编码" />
@ -99,6 +103,7 @@
prop="plcParamName" prop="plcParamName"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input <el-input
:disabled="disabled"
v-model="dataForm.plcParamName" v-model="dataForm.plcParamName"
placeholder="请输入参数列名" placeholder="请输入参数列名"
@change="$emit('update', dataForm)"></el-input> @change="$emit('update', dataForm)"></el-input>
@ -110,6 +115,7 @@
prop="alarmContent" prop="alarmContent"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input <el-input
:disabled="disabled"
v-model="dataForm.alarmContent" v-model="dataForm.alarmContent"
placeholder="请输入报警内容" placeholder="请输入报警内容"
@change="$emit('update', dataForm)"></el-input> @change="$emit('update', dataForm)"></el-input>
@ -133,6 +139,10 @@ export default {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
disabled: {
type: Boolean,
default: false,
},
}, },
data() { data() {
return { return {