diff --git a/common/http.api.js b/common/http.api.js index 59711f5..0ee9140 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -53,6 +53,9 @@ const install = (Vue, vm) => { let oplLists = (data = {}) => vm.$u.get('/opm/opl/', data); //作业许可证 let oplCate = (data = {}) => vm.$u.get('/opm/opl_cate/', data); //作业许可证类型 let oplCateItem = (id) => vm.$u.get(`/opm/opl_cate/${id}/`); //作业许可证类型详情 + let oplCreate = (data = {}) => vm.$u.post('/opm/opl/', data); //添加新许可证 + let oplUpdate = (id,data = {}) => vm.$u.put(`/opm/opl/${id}/`, data); //编辑许可证 + let oplWorker = (data = {}) => vm.$u.get('/opl_worker/', data); //作业许可证类型 let rpjList = (data = {}) => vm.$u.get(`/rpm/rpj/`, data); //rpj查询 let rpjItem = (id) => vm.$u.get(`/rpm/rpj/${id}`); //rpj查询 @@ -113,6 +116,9 @@ const install = (Vue, vm) => { oplLists, oplItem, oplCate, + oplCreate, + oplUpdate, + oplWorker, areaLists }; diff --git a/pages.json b/pages.json index 00973e9..91b3a2f 100644 --- a/pages.json +++ b/pages.json @@ -148,6 +148,14 @@ "enablePullDownRefresh": false } }, + { + "path": "pages/workSpace/operation/workerList", + "style": { + "navigationBarTitleText": "选择工作人员", + "navigationStyle": "custom", + "enablePullDownRefresh": false + } + }, { "path": "pages/workSpace/visit/visitList", "style": { diff --git a/pages/workSpace/operation/oplCate.vue b/pages/workSpace/operation/oplCate.vue index 5aabc0e..06953ac 100644 --- a/pages/workSpace/operation/oplCate.vue +++ b/pages/workSpace/operation/oplCate.vue @@ -2,11 +2,28 @@ - - + + 已添加许可证: + - {{row.name}} + {{item.name}} + {{item.cate_name}} + {{item.level}} + + + + + + + + 添加新许可证: + + + {{row.name}} + + + - - - - @@ -132,9 +133,9 @@ - + - + @@ -162,6 +163,7 @@ risks_checked: [], measures_checked: [], }, + oplId: null, operationName: '', oplCateName: '', risklist: [], @@ -190,6 +192,11 @@ console.log(params) this.operationId = params.operationId; this.oplcateId = params.oplcateId; + this.type = params.type; + if (params.oplId) { + this.oplId = params.oplId; + this.formData.id = params.oplId; + } this.formData.cate = this.oplcateId; this.formData.operation = this.operationId; }, @@ -212,39 +219,70 @@ console.log(res); }); }, + // getOplDetail(){ + // let that = this; + // that.$u.api.oplItem(that.oplId).then((res) => { + // that.formData = res; //作业开始时间 + // debugger; + // console.log(res); + // }); + // }, //根据作业许可证类别ID获取,风险、措施===>作业许可证类别详情 getOplcates() { let that = this; that.$u.api.oplCateItem(that.oplcateId).then((res) => { console.log(res); // + that.risklist = []; + that.measurelist = []; that.oplCateName = res.name; that.oplcateCode = res.code; - let risklist = res.risk_options_; //风险缝隙 - that.risklist = []; - risklist.forEach(item=>{ + if (that.oplId !== null) { + that.editCheckShow(res.risk_options_, res.measure_options_); + } + }); + }, + editCheckShow(risklist, measurelist) { + let that = this; + that.$u.api.oplItem(that.oplId).then((res) => { + that.formData = res; //作业开始时间 + risklist.forEach(item => { let obj = {}; - obj=item; - obj.checked = false; + obj = item; + if (res.risks_checked.indexOf(item.id) > -1) { + obj.checked = true; + } else { + obj.checked = false; + } that.risklist.push(obj) }) - let measurelist = res.measure_options_; //风险缝隙 - that.measurelist = []; - measurelist.forEach(item=>{ + measurelist.forEach(item => { let obj = {}; - obj=item; - obj.checked = false; + obj = item; + if (res.measures_checked.indexOf(item.id) > -1) { + obj.checked = true; + } else { + obj.checked = false; + } that.measurelist.push(obj) }) + debugger; + console.log(res); }); + }, //获取作业区域 getRange() { - this.$u.api.areaLists({page: 0}).then(res => { + this.$u.api.areaLists({ + page: 0 + }).then(res => { let range = []; let obj = {}; res.forEach(item => { - obj = {value: null,text: ''}; + obj = { + value: null, + text: '' + }; obj.value = item.id; obj.text = item.name; range.push(obj); @@ -254,11 +292,16 @@ }, //获取用户 getUserRange() { - this.$u.api.userList({page: 0}).then(res => { + this.$u.api.userList({ + page: 0 + }).then(res => { let user = []; let obj = {}; res.forEach(item => { - obj = {value: null,text: ''}; + obj = { + value: null, + text: '' + }; obj.value = item.id; obj.text = item.name; user.push(obj); @@ -269,9 +312,11 @@ //获取dept getdept() { let that = this; - that.$u.api.deptList({page: 0}).then(res => { + that.$u.api.deptList({ + page: 0 + }).then(res => { that.depRange = that.redata(res); - + console.log(that.depRange) }) }, @@ -301,21 +346,44 @@ console.log(arr); return arr; }, + checkboxRiskChange(e) { + let values = e.detail.value; + this.formData.risks_checked = values; + // debugger; + // console.log(this.formData.risks_checked); + }, + checkboxMeasuresChange(e) { + let values = e.detail.value; + this.formData.measures_checked = values; + // debugger; + // console.log(this.formData.measures_checked); + }, select(row) {}, goBack() { uni.navigateBack({ delta: 1 }) }, - - add() { - uni.navigateTo({ - url: '/pages/workSpace/newWork/addUser' - }) - }, edit(row) {}, - saveSubmit(){ - //添加人员 + saveSubmit() { + debugger; + let that = this; + let params=null; + console.log(this.formData); + if (that.oplId !== null) { + that.$u.api.oplUpdate(that.oplId,that.formData).then(res=>{ + params = `?oplId=${that.oplId}`; + uni.navigateTo({ + url:'/pages/workSpace/operation/workerList'+params + }) + + }) + }else{ + that.$u.api.oplCreate(that.formData).then(res=>{ + + }) + } + }, } } @@ -414,10 +482,11 @@ .form-date>>>.uni-icons { display: none; } - .form-right>>>.uni-label-pointer{ + + .form-right>>>.uni-label-pointer { min-width: 50%; - display: inline-block; - margin-bottom: 20rpx; + display: inline-block; + margin-bottom: 20rpx; } .apply-reason-text { diff --git a/static/common/addIcon.png b/static/common/addIcon.png new file mode 100644 index 0000000..46c13fd Binary files /dev/null and b/static/common/addIcon.png differ diff --git a/static/common/home.png b/static/common/home.png deleted file mode 100644 index 47ac732..0000000 Binary files a/static/common/home.png and /dev/null differ diff --git a/static/common/homec.png b/static/common/homec.png deleted file mode 100644 index 51669e3..0000000 Binary files a/static/common/homec.png and /dev/null differ diff --git a/static/common/me.png b/static/common/me.png deleted file mode 100644 index aa8f6af..0000000 Binary files a/static/common/me.png and /dev/null differ diff --git a/static/common/mec.png b/static/common/mec.png deleted file mode 100644 index 2c52ba9..0000000 Binary files a/static/common/mec.png and /dev/null differ diff --git a/static/common/play.png b/static/common/play.png deleted file mode 100644 index 0b1f8dc..0000000 Binary files a/static/common/play.png and /dev/null differ diff --git a/static/common/playc.png b/static/common/playc.png deleted file mode 100644 index 2dc5f1d..0000000 Binary files a/static/common/playc.png and /dev/null differ diff --git a/static/workSpace/new_apply/update.png b/static/workSpace/new_apply/update.png index 9dffb45..2ebad50 100644 Binary files a/static/workSpace/new_apply/update.png and b/static/workSpace/new_apply/update.png differ diff --git a/static/workSpace/new_apply/updateActive.png b/static/workSpace/new_apply/updateActive.png new file mode 100644 index 0000000..4a7cb90 Binary files /dev/null and b/static/workSpace/new_apply/updateActive.png differ