From 0dcfa315a2b8b6950e86406b8c183ba9a70ecffe Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Sat, 4 Apr 2020 19:05:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B7=A1=E6=A3=80=E8=AE=A1?= =?UTF-8?q?=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../departmentSelect2/departmentSelect2.js | 3 ++ .../editInspectionPlan.html | 26 ++++++-------- .../editInspectionPlan/editInspectionPlan.js | 28 ++++++++------- .../inspectionRouteSelect2.html | 2 +- .../inspectionRouteSelect2.js | 35 +++---------------- public/components/orgSelect2/orgSelect2.js | 4 +++ 6 files changed, 40 insertions(+), 58 deletions(-) diff --git a/public/components/departmentSelect2/departmentSelect2.js b/public/components/departmentSelect2/departmentSelect2.js index 59988de28..b99f2d42a 100644 --- a/public/components/departmentSelect2/departmentSelect2.js +++ b/public/components/departmentSelect2/departmentSelect2.js @@ -10,7 +10,9 @@ orgName: '', companyId:'', departmentId:'', + departmentName:'', staffId: '', + staffName:'', departmentSelector: {} } }, @@ -40,6 +42,7 @@ companyId:'', staffId: '', departmentId:'', + departmentName:'', departmentSelector: {} }; }); diff --git a/public/components/editInspectionPlan/editInspectionPlan.html b/public/components/editInspectionPlan/editInspectionPlan.html index 0ca62dd24..a49d0c05f 100644 --- a/public/components/editInspectionPlan/editInspectionPlan.html +++ b/public/components/editInspectionPlan/editInspectionPlan.html @@ -14,21 +14,17 @@ placeholder="必填,请填写计划名称" class="form-control"> - - - - - - - - - - - - - - - +
+ +
+ +
+
diff --git a/public/components/editInspectionPlan/editInspectionPlan.js b/public/components/editInspectionPlan/editInspectionPlan.js index 152c37cf3..5172a6f1b 100644 --- a/public/components/editInspectionPlan/editInspectionPlan.js +++ b/public/components/editInspectionPlan/editInspectionPlan.js @@ -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, + }); + diff --git a/public/components/inspectionRouteSelect2/inspectionRouteSelect2.html b/public/components/inspectionRouteSelect2/inspectionRouteSelect2.html index b66ae49e5..942e5221f 100644 --- a/public/components/inspectionRouteSelect2/inspectionRouteSelect2.html +++ b/public/components/inspectionRouteSelect2/inspectionRouteSelect2.html @@ -1,4 +1,4 @@ - diff --git a/public/components/inspectionRouteSelect2/inspectionRouteSelect2.js b/public/components/inspectionRouteSelect2/inspectionRouteSelect2.js index 4d068a91b..43a69b081 100644 --- a/public/components/inspectionRouteSelect2/inspectionRouteSelect2.js +++ b/public/components/inspectionRouteSelect2/inspectionRouteSelect2.js @@ -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 = ''; }); }, diff --git a/public/components/orgSelect2/orgSelect2.js b/public/components/orgSelect2/orgSelect2.js index 7688ed84f..10316f070 100644 --- a/public/components/orgSelect2/orgSelect2.js +++ b/public/components/orgSelect2/orgSelect2.js @@ -9,6 +9,10 @@ orgId: '-1', orgName: '', companyId:'', + departmentId:'', + departmentName:'', + staffId: '', + staffName:'', orgSelector: {} } },