冲突合并

This commit is contained in:
BianLzhaoMin 2025-04-14 16:19:28 +08:00
commit a7b5eb355f
2 changed files with 211 additions and 0 deletions

View File

@ -0,0 +1,47 @@
import request from '@/utils/request';
// 查询设备类型列表
export function getPageList(query) {
return request({
url: '/smart-site/devType/list',
method: 'get',
params: query
})
}
// 新增设备类型
export function addDevType(data) {
return request({
url: '/smart-site/devType/insertData',
method: 'post',
data
})
}
// 视频设备详情
export function queryDetail(data) {
return request({
url: '/smart-site/devType/queryDetail',
method: 'post',
data
})
}
// 修改设备类型
export function updateDevType(data) {
return request({
url: '/smart-site/devType/updateData',
method: 'post',
data
})
}
// 视频设备-删除
export function deleteData(data) {
return request({
url: '/smart-site/devType/deleteData',
method: 'post',
data
})
}

View File

@ -0,0 +1,164 @@
<template>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px">
<el-form-item label="类型名称" prop="typeName">
<el-input style="width:100%" v-model="form.typeName" placeholder="请输入设备类型" maxlength="64"></el-input>
</el-form-item>
<el-form-item label="类型编码" prop="typeCode">
<el-input style="width:100%" v-model="form.typeCode" placeholder="请输入类型编码" maxlength="32"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" style="width:100%" v-model="form.remark" placeholder="请输入备注" maxlength="255"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
<el-button type="primary" class="search-btn" :disabled="disabled" @click="submitForm('ruleForm')">确认</el-button>
</span>
</el-dialog>
</template>
<script>
import { addDevType,updateDevType ,queryDetail} from "@/api/base-type/dev-type/devType.js";
export default {
name: "devicepop",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
dicts: ['video_device'],
data() {
return {
roles: [],
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
typeName: null,
typeCode: null,
remark: null,
},
rules: {
typeName: [
{ required: true, message: '类型名称不能为空', trigger: 'blur' }
],
typeCode: [
{ required: true, message: '类型编码不能为空', trigger: 'blur' }
]
},
};
},
mounted() {
if (this.isAdd === 'add') { //
} else if (this.isAdd === 'edit') { //
this.queryDetailDev();
}
},
methods: {
/**详情*/
queryDetailDev() {
queryDetail({ id: this.rowData.id }).then(res => {
console.log(res);
this.form = res.data;
}).catch(error => {
})
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
setTimeout(() => {
this.dialogVisible = true;
});
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
setTimeout(() => {
this.dialogVisible = true;
});
},
/**重置表单*/
reset() {
this.form = {
typeName: null,
typeCode: null,
remark: null,
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
let loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.2)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addDevType(params).then(res => {
loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
loading.close();
});
} else {
updateDevType(params).then(res => {
loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
loading.close();
});
}
}
});
}
}
};
</script>
<style lang="scss">
.w700 .el-dialog {
width: 700px;
}
.w500 .el-dialog {
width: 500px;
}
.w500 .el-dialog__header,
.w700 .el-dialog__header {
background: #eeeeee;
.el-dialog__title {
font-size: 16px;
}
}
.yxq .el-range-separator {
margin-right: 7px !important;
}
.el-date-editor--daterange.el-input__inner {
width: 260px;
}
</style>