优化巡检计划

This commit is contained in:
java110 2020-04-04 19:05:24 +08:00
parent 8d7fec66b3
commit 0dcfa315a2
6 changed files with 40 additions and 58 deletions

View File

@ -10,7 +10,9 @@
orgName: '',
companyId:'',
departmentId:'',
departmentName:'',
staffId: '',
staffName:'',
departmentSelector: {}
}
},
@ -40,6 +42,7 @@
companyId:'',
staffId: '',
departmentId:'',
departmentName:'',
departmentSelector: {}
};
});

View File

@ -14,21 +14,17 @@
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">-->
<!--&lt;!&ndash; <input v-model="editInspectionPlanInfo.inspectionRouteId" type="text"&ndash;&gt;-->
<!--&lt;!&ndash; placeholder="必填,请填写巡检路线" class="form-control">&ndash;&gt;-->
<!-- <div class="col-sm-10">-->
<!-- <vc:create name="inspectionRouteSelect2"-->
<!-- parentModal="editInspectionPlanModel"-->
<!-- callBackListener="editInspectionPlanInfo"-->
<!-- callBackFunction="notify"-->
<!-- namespace="editInspectionPlan"-->
<!-- ></vc:create>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group row">
<label class="col-sm-2 col-form-label">巡检路线</label>
<div class="col-sm-10">
<vc:create name="inspectionRouteSelect2"
parentModal="editInspectionPlanModel"
callBackListener="editInspectionPlanInfo"
callBackFunction="notify"
namespace="editInspectionPlan"
></vc:create>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">执行周期</label>
<div class="col-sm-10">

View File

@ -49,26 +49,30 @@
vc.emit('editInspectionPlan', 'orgSelect2', 'setOrg', {
orgId: vc.component.editInspectionPlanInfo.companyId,
orgName: vc.component.editInspectionPlanInfo.companyName,
});
//部门select2
vc.emit('editInspectionPlan', 'departmentSelect2', 'setDepartment', {
departmentId: vc.component.editInspectionPlanInfo.departmentId,
departmentName: vc.component.editInspectionPlanInfo.departmentName,
});
//员工select2
vc.emit('editInspectionPlan', 'staffSelect2', 'setStaff', {
staffId: vc.component.editInspectionPlanInfo.staffId,
staffName: vc.component.editInspectionPlanInfo.staffName,
});
// //传输数据到machineSelect2组件
// vc.emit('editInspectionPlan', 'inspectionRouteSelect2', 'setInspectionRoute', {
// inspectionRouteId: vc.component.editInspectionPlanInfo.inspectionRouteId,
// routeName: vc.component.editInspectionPlanInfo.inspectionRouteName,
//部门select2
// vc.emit('editInspectionPlan', 'departmentSelect2', 'setDepartment', {
// departmentId: vc.component.editInspectionPlanInfo.departmentId,
// departmentName: vc.component.editInspectionPlanInfo.departmentName,
// });
//员工select2
// vc.emit('editInspectionPlan', 'staffSelect2', 'setStaff', {
// staffId: vc.component.editInspectionPlanInfo.staffId,
// staffName: vc.component.editInspectionPlanInfo.staffName,
// });
// //传输数据到machineSelect2组件
vc.emit('editInspectionPlan', 'inspectionRouteSelect2', 'setInspectionRoute', {
inspectionRouteId: vc.component.editInspectionPlanInfo.inspectionRouteId,
routeName: vc.component.editInspectionPlanInfo.inspectionRouteName,
});

View File

@ -1,4 +1,4 @@
<select class="form-control" id = "inspectionRouteSelector" multiple="multiple">
<select class="form-control" id = "inspectionRouteSelector">
<option value="">请选择巡检路线</option>

View File

@ -27,22 +27,9 @@
_initEvent: function () {
vc.on('inspectionRouteSelect2', 'setInspectionRoute', function (_param) {
vc.copyObject(_param, this.inspectionRouteSelect2Info);
$("#inspectionRouteSelector").val(null).trigger('change');
var name = _param.routeName.split(",");
var ids = _param.inspectionRouteId.split(",");
for( var i = 0; i < name.length; i++){
var option = new Option(name[i],ids[i], true, true);
console.log(option);
var option = new Option(_param.routeName,_param.inspectionRouteId, true, true);
this.inspectionRouteSelect2Info.inspectionRouteSelector.append(option);
}
//var option = new Option(_param.routeName, _param.inspectionRouteId, true, true);
// var routeIds = _param.inspectionRouteId.split(",");
// var routeIdArray = new Array()
// for( var i = 0; i < routeIds.length; i++){
// routeIdArray[i] = routeIds[i];
// }
// $("#inspectionRouteSelector").val(routeIdArray).trigger("change");
});
vc.on('inspectionRouteSelect2', 'clearInspectionRoute', function (_param) {
@ -52,7 +39,6 @@
routeName: '',
inspectionRouteSelector: {}
};
$("#inspectionRouteSelector").val(null).trigger('change');
});
},
methods: {
@ -96,24 +82,13 @@
//evt.params.data 是选中项的信息
this.inspectionRouteSelect2Info.inspectionRouteId = evt.params.data.id;
this.inspectionRouteSelect2Info.routeName = evt.params.data.text;
var inspectionRouteIds= $('#inspectionRouteSelector').select2('val');
var routeIds = '';
for( var i = 0; i < inspectionRouteIds.length; i++){
routeIds +=","+inspectionRouteIds[i];
}
this.inspectionRouteSelect2Info.inspectionRouteId = routeIds.substr(1);
});
$('#inspectionRouteSelector').on("select2:unselect", function (evt) {
//这里是取消选中触发的事件
//如配置allowClear: true后触发
var inspectionRouteIds= $('#inspectionRouteSelector').select2('val');
var routeIds = '';
for( var i = 0; i < inspectionRouteIds.length; i++){
routeIds +=","+inspectionRouteIds[i];
}
this.inspectionRouteSelect2Info.inspectionRouteId = routeIds.substr(1);
//this.inspectionRouteSelect2Info.routeName = '';
//如配置allowClear: true后触发
this.inspectionRouteSelect2Info.inspectionRouteId = '';
this.inspectionRouteSelect2Info.routeName = '';
});
},

View File

@ -9,6 +9,10 @@
orgId: '-1',
orgName: '',
companyId:'',
departmentId:'',
departmentName:'',
staffId: '',
staffName:'',
orgSelector: {}
}
},