优化巡检点

This commit is contained in:
java110 2020-07-24 16:00:29 +08:00
parent cc1502ce9a
commit d17baa54e5
5 changed files with 117 additions and 41 deletions

View File

@ -1,5 +1,5 @@
<div id="addInspectionPointModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
@ -11,34 +11,50 @@
<label class="col-sm-2 col-form-label">巡检点名称</label>
<div class="col-sm-10">
<input v-model="addInspectionPointInfo.inspectionName" type="text"
placeholder="必填,请填写巡检点名称" class="form-control">
placeholder="必填,请填写巡检点名称" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">巡检类型</label>
<div class="col-sm-10">
<select class="custom-select" v-model="addInspectionPlanInfo.pointObjType">
<option selected disabled value="">必填,请选择巡检类型</option>
<option value="2002">环境</option>
<option value="1001">设备</option>
</select>
</div>
</div>
<div class="form-group row" v-if="addInspectionPlanInfo.pointObjType == '2002'">
<label class="col-sm-2 col-form-label">位置</label>
<div class="col-sm-10">
<input v-model="addInspectionPointInfo.pointObjName" type="text"
placeholder="必填,请填写巡检点名称" class="form-control">
</div>
</div>
<div class="form-group row" v-else>
<label class="col-sm-2 col-form-label">巡检设备</label>
<div class="col-sm-10">
<vc:create path="property/machineSelect2"
parentModal="addInspectionPointModel"
callBackListener="addInspectionPointInfo"
callBackFunction="notify"
namespace="addInspectionPoint"
></vc:create>
<vc:create path="property/machineSelect2" parentModal="addInspectionPointModel"
callBackListener="addInspectionPointInfo" callBackFunction="notify"
namespace="addInspectionPoint"></vc:create>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">备注</label>
<div class="col-sm-10">
<input v-model="addInspectionPointInfo.remark" type="text" placeholder="选填,请填写备注"
class="form-control">
class="form-control">
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="saveInspectionPointInfo()"><i class="fa fa-check"></i>&nbsp;保存
v-on:click="saveInspectionPointInfo()"><i class="fa fa-check"></i>&nbsp;保存
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消
data-dismiss="modal">取消
</button>
</div>
</div>
@ -47,4 +63,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -8,7 +8,9 @@
data: {
addInspectionPointInfo: {
inspectionId: '',
machineId: '',
pointObjId: '',
pointObjType: '',
pointObjName: '',
inspectionName: '',
remark: ''
}
@ -21,8 +23,9 @@
$('#addInspectionPointModel').modal('show');
});
vc.on("addInspectionPointInfo", "notify", function (_param) {
if (_param.hasOwnProperty("machineId")) {
vc.component.addInspectionPointInfo.machineId = _param.machineId;
if (_param.hasOwnProperty("machineId") && $that.addInspectionPointInfo.pointObjType == '1001') {
vc.component.addInspectionPointInfo.pointObjId = _param.machineId;
vc.component.addInspectionPointInfo.pointObjName = _param.machineName;
}
});
},
@ -43,11 +46,25 @@
errInfo: "巡检点名称不能超过100位"
},
],
'addInspectionPointInfo.machineId': [
'addInspectionPointInfo.pointObjId': [
{
limit: "required",
param: "",
errInfo: "设备信息不能为空"
errInfo: "位置信息不能为空"
},
],
'addInspectionPointInfo.pointObjType': [
{
limit: "required",
param: "",
errInfo: "巡检类型不能为空"
},
],
'addInspectionPointInfo.pointObjName': [
{
limit: "required",
param: "",
errInfo: "巡检位置不能为空"
},
],
'addInspectionPointInfo.remark': [
@ -61,13 +78,15 @@
});
},
saveInspectionPointInfo: function () {
if ($that.addInspectionPointInfo.pointObjType == '2002') {
$that.addInspectionPointInfo.pointObjId = '-1';
}
if (!vc.component.addInspectionPointValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
vc.component.addInspectionPointInfo.communityId = vc.getCurrentCommunity().communityId;
vc.component.addInspectionPointInfo.machineId = vc.component.addInspectionPointInfo.machineId;
//不提交数据将数据 回调给侦听处理
if (vc.notNull($props.callBackListener)) {
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addInspectionPointInfo);
@ -104,8 +123,12 @@
},
clearAddInspectionPointInfo: function () {
vc.component.addInspectionPointInfo = {
inspectionId: '',
pointObjId: '',
pointObjType: '',
pointObjName: '',
inspectionName: '',
remark: '',
remark: ''
};
}

View File

@ -15,6 +15,23 @@
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">巡检类型</label>
<div class="col-sm-10">
<select class="custom-select" v-model="editInspectionPointInfo.pointObjType">
<option selected disabled value="">必填,请选择巡检类型</option>
<option value="2002">环境</option>
<option value="1001">设备</option>
</select>
</div>
</div>
<div class="form-group row" v-if="editInspectionPointInfo.pointObjType == '2002'">
<label class="col-sm-2 col-form-label">位置</label>
<div class="col-sm-10">
<input v-model="editInspectionPointInfo.pointObjName" type="text"
placeholder="必填,请填写巡检点名称" class="form-control">
</div>
</div>
<div class="form-group row" v-else>
<label class="col-sm-2 col-form-label">巡检设备</label>
<div class="col-sm-10">
<vc:create path="property/machineSelect2"

View File

@ -4,10 +4,11 @@
data: {
editInspectionPointInfo: {
inspectionId: '',
machineId: '',
machineName: '',
pointObjId: '',
pointObjType: '',
pointObjName: '',
inspectionName: '',
communityId:'',
communityId: '',
remark: '',
}
},
@ -20,16 +21,20 @@
$('#editInspectionPointModel').modal('show');
vc.copyObject(_params, vc.component.editInspectionPointInfo);
//传输数据到machineSelect2组件
vc.emit('editInspectionPoint', 'machineSelect2', 'setMachine', {
machineId: vc.component.editInspectionPointInfo.machineId,
machineName: vc.component.editInspectionPointInfo.machineName,
});
if ($that.editInspectionPointInfo.pointObjType == '1001') { //设备时设置
vc.emit('editInspectionPoint', 'machineSelect2', 'setMachine', {
machineId: vc.component.editInspectionPointInfo.pointObjId,
machineName: vc.component.editInspectionPointInfo.pointObjName,
});
}
vc.component.editInspectionPointInfo.communityId = vc.getCurrentCommunity().communityId;
});
vc.on("editInspectionPointInfo", "notify", function (_param) {
if (_param.hasOwnProperty("machineId")) {
vc.component.editInspectionPointInfo.machineId = _param.machineId;
if (_param.hasOwnProperty("machineId") && $that.editInspectionPointInfo.pointObjType == '1001') {
vc.component.editInspectionPointInfo.pointObjId = _param.machineId;
vc.component.editInspectionPointInfo.pointObjName = _param.machineName;
}
});
},
@ -50,11 +55,25 @@
errInfo: "巡检点名称不能超过100位"
},
],
'editInspectionPointInfo.machineId': [
'editInspectionPointInfo.pointObjId': [
{
limit: "required",
param: "",
errInfo: "设备信息不能为空"
errInfo: "位置信息不能为空"
},
],
'editInspectionPointInfo.pointObjType': [
{
limit: "required",
param: "",
errInfo: "巡检类型不能为空"
},
],
'editInspectionPointInfo.pointObjName': [
{
limit: "required",
param: "",
errInfo: "巡检位置不能为空"
},
],
'editInspectionPointInfo.remark': [
@ -74,6 +93,9 @@
});
},
editInspectionPoint: function () {
if ($that.editInspectionPointInfo.pointObjType == '2002') {
$that.editInspectionPointInfo.pointObjId = '-1';
}
if (!vc.component.editInspectionPointValidate()) {
vc.toast(vc.validate.errInfo);
return;
@ -105,10 +127,11 @@
refreshEditInspectionPointInfo: function () {
vc.component.editInspectionPointInfo = {
inspectionId: '',
machineId: '',
machineName: '',
pointObjId: '',
pointObjType: '',
pointObjName: '',
inspectionName: '',
communityId:'',
communityId: '',
remark: '',
}

View File

@ -64,10 +64,9 @@
<thead>
<tr>
<th class="text-center">巡检点名称</th>
<th class="text-center">巡检类型</th>
<th class="text-center">巡检位置</th>
<th class="text-center">巡检点ID</th>
<th class="text-center">设备位置</th>
<th class="text-center">设备编码</th>
<th class="text-center">设备名称</th>
<th class="text-center">操作</th>
@ -76,11 +75,9 @@
<tbody>
<tr v-for="inspectionPoint in inspectionPointManageInfo.inspectionPoints">
<td class="text-center">{{inspectionPoint.inspectionName}}</td>
<td class="text-center">{{inspectionPoint.pointObjType=='1001'?'设备':'环境'}}</td>
<td class="text-center">{{inspectionPoint.pointObjName}}</td>
<td class="text-center">{{inspectionPoint.inspectionId}}</td>
<td class="text-center">{{inspectionPoint.locationObjName}}</td>
<td class="text-center">{{inspectionPoint.machineCode}}</td>
<td class="text-center">{{inspectionPoint.machineName}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"