diff --git a/pages/investigation/components/investigation-item.vue b/pages/investigation/components/investigation-item.vue index 7ce7f82..253ad71 100644 --- a/pages/investigation/components/investigation-item.vue +++ b/pages/investigation/components/investigation-item.vue @@ -82,7 +82,7 @@ } }, // 页面显示 - onShow() {}, + onShow() { }, // 计算属性 computed: {}, // 方法 @@ -95,7 +95,7 @@ uuid(len, binary) { len = !len ? 36 : len; binary = !binary ? 16 : binary; - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * binary | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(binary); @@ -148,7 +148,13 @@ getData() { this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangers', {}, 'GET').then(res => { if (res.code == 200) { - this.investigationList = res.result + for (let i = 0; i < res.result.length; i++) { + for (let j = 0; j < res.result[i].dangerItems.length; j++) { + res.result[i].dangerItems[j].nid = res.result[i].nid + } + // this.getInvestigationListDangerInfo(res.result[i].nid) + } + this.investigationList = res.result; } }) }, @@ -185,16 +191,16 @@ handleSelect(item, index) { this.investigationSelect = index this.investigationDetailTitle = item.name - this.showInvestigationDetail = true - this.getData2(item.nid) - // this.$emit('select', this.investigationSelect, this.investigationList[index]) + // this.showInvestigationDetail = true + // this.getData2(item.nid) + this.$emit('select', this.investigationSelect, this.investigationList[index]) }, investigationDetailHandle() { this.showInvestigationDetail = false this.$emit('select', this.investigationList[this.investigationSelect], this.investigationDetailList) } }, - onReady() {}, + onReady() { }, // 页面卸载 onUnload() { @@ -207,7 +213,7 @@ }, 1500); }, // 页面上拉触底事件的处理函数 - onReachBottom() {}, + onReachBottom() { }, } @@ -252,7 +258,7 @@ /deep/ .uni-forms-item__label { font-size: 32rpx; - height:auto; + height: auto; margin-bottom: 20rpx; } } diff --git a/pages/investigation/components/investigation-item2.vue b/pages/investigation/components/investigation-item2.vue index 1bf3441..3e4fec0 100644 --- a/pages/investigation/components/investigation-item2.vue +++ b/pages/investigation/components/investigation-item2.vue @@ -35,6 +35,19 @@ @delete="(e) => deletePic(e, item)" name="1" :maxCount="1"> + + + + + + + + + + + + @@ -62,7 +75,16 @@ investigationList: [], showInvestigationDetail: false, investigationDetailTitle: '', - investigationDetailList: [] + investigationDetailList: [], + formData: { + bigCategory: '', + smallCategory: '', + hdTerm: '', + hdPic: '', + hdDesc: '', + hdInfo: '', + }, + fileList: [], } }, // 页面加载 @@ -70,6 +92,7 @@ // this.getData() }, mounted() { + if (this.json.name) { this.investigationDetailList = this.json.extraConfigs.map(item => { if (!item.fileList) { @@ -110,11 +133,12 @@ } }, // 页面显示 - onShow() {}, + onShow() { }, // 计算属性 computed: {}, // 方法 methods: { + // 删除图片 deletePic(event, item) { item.fileList.splice(event.index, 1) @@ -123,7 +147,7 @@ uuid(len, binary) { len = !len ? 36 : len; binary = !binary ? 16 : binary; - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * binary | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(binary); @@ -131,7 +155,7 @@ }, // 新增图片 async afterRead(event, item) { - + // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 const id = this.uuid() item.fileList.push({ @@ -170,6 +194,45 @@ }); }) }, + // 删除图片 + deletePic2(event, key) { + this[key].splice(event.index, 1) + this.formData.hdPic = this[key].filter(item => item.status === 'success').map(item => item.url).toString() + this.changeEmit() + }, + // 新增图片 + async afterRead2(event, key) { + // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 + const id = this.uuid() + this[key].push({ + id, + ...event.file, + status: 'uploading', + message: '上传中' + }) + const result = await this.uploadFilePromise(this[key][0].url) + const resultInfo = JSON.parse(result) + const index = this[key].findIndex(v => v.id === id) + if (resultInfo.code == 200) { + this[key].splice(index, 1, Object.assign(this[key][index], { + status: 'success', + message: '', + result: resultInfo, + url: resultInfo.result + })) + } else { + this.$.toast('上传失败') + this[key].splice(index, 1, Object.assign(this[key][index], { + status: 'error', + message: '失败', + })) + } + this.formData.hdPic = this[key].filter(item => item.status === 'success').map(item => item.url).toString() + this.changeEmit() + }, + changeEmit() { + this.$emit('change', this.formData) + }, getData() { this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangerInfo', { sid: this.$props.sid @@ -211,10 +274,10 @@ // this.$emit('select', this.investigationSelect, this.investigationList[index]) }, investigationDetailHandle() { - this.$emit('select', this.json) + // this.$emit('select', this.json) } }, - onReady() {}, + onReady() { }, // 页面卸载 onUnload() { @@ -227,7 +290,7 @@ }, 1500); }, // 页面上拉触底事件的处理函数 - onReachBottom() {}, + onReachBottom() { }, } @@ -298,5 +361,4 @@ color: #2663BF; } } - \ No newline at end of file diff --git a/pages/investigation/components/problem-box.vue b/pages/investigation/components/problem-box.vue index 8fcc7d9..1cdd9e1 100644 --- a/pages/investigation/components/problem-box.vue +++ b/pages/investigation/components/problem-box.vue @@ -84,7 +84,6 @@ export default { }, // 页面加载 onLoad(e) { - console.log(12312312312) // this.getData() }, mounted(){ diff --git a/pages/investigation/task-zancun.vue b/pages/investigation/task-zancun.vue index 5e4de1b..22f6649 100644 --- a/pages/investigation/task-zancun.vue +++ b/pages/investigation/task-zancun.vue @@ -273,10 +273,7 @@ export default { showInvestigation: false, investigationSelectList: [], investigationSelectIDList: [], - investigationList: [ - { name: '基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息', value: 1 }, - { name: 'xxxxx', value: 2 }, - ], + investigationList: [], investigationSelect: 1, showInvestigationDetail: false, investigationDetailList: [ @@ -398,7 +395,7 @@ export default { }, investigationHandle() { - console.log(this.investigationSelect) + // console.log(this.investigationSelect) if(!this.investigationSelectIDList.includes(this.investigationList[this.investigationSelect].nid)){ this.investigationSelectList.push(this.investigationList[this.investigationSelect].name) this.investigationSelectIDList.push(this.investigationList[this.investigationSelect].nid) diff --git a/pages/investigation/task.vue b/pages/investigation/task.vue index f3d6ff0..3bc67d1 100644 --- a/pages/investigation/task.vue +++ b/pages/investigation/task.vue @@ -37,8 +37,8 @@ {{ - formData.roadType - }} + formData.roadType + }} {{ - formData.roadStructure - }} + formData.roadStructure + }} {{ - formData.sideProtec - }} + formData.sideProtec + }} {{ - formData.centerSeparate - }} + formData.centerSeparate + }} - {{ formData.designSpeed }}Km/h + {{ formData.designSpeed + }}Km/h - {{ formData.limitSpeed }}Km/h + {{ formData.limitSpeed + }}Km/h @@ -107,26 +107,26 @@ {{ - formData.peakHours - }} + formData.peakHours + }} - {{ formData.normalTraffic }}辆 + {{ formData.normalTraffic + }}辆 - {{ formData.largeVehicleRate }}% + {{ formData.largeVehicleRate + }}% - {{ formData.nonvehicleTraffic }}辆 + {{ formData.nonvehicleTraffic + }}辆 @@ -146,6 +146,10 @@ + + + @@ -258,8 +262,8 @@ {{ hiddenDangerList2[0].itemname }}/{{ - hiddenDangerList2[1].itemname - }}/{{ hiddenDangerList2[2].itemname }} + hiddenDangerList2[1].itemname + }}/{{ hiddenDangerList2[2].itemname }} {{ - dangerProblem - }} + dangerProblem + }} 请选择 @@ -359,60 +363,60 @@ investigationSelectList: [], investigationSelectIDList: [], investigationList: [{ - name: "基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息", - value: 1, - }, - { - name: "xxxxx", - value: 2 - }, + name: "基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息", + value: 1, + }, + { + name: "xxxxx", + value: 2 + }, ], investigationSelect: 1, showInvestigationDetail: false, investigationDetailList: [{ - type: "check", - value: "" - }, - { - type: "text", - value: "" - }, - { - type: "number", - value: "" - }, - { - type: "upload", - value: "" - }, + type: "check", + value: "" + }, + { + type: "text", + value: "" + }, + { + type: "number", + value: "" + }, + { + type: "upload", + value: "" + }, ], investigationDetailTitle: "title", isEdit: false, isEditStep2: false, active: 1, tablist: [{ - title: "基本信息", - type: "item", - i: 1 - }, - { - title: "基本信息", - type: "point" - }, - { - title: "统计信息", - type: "item", - i: 2 - }, - { - title: "统计信息", - type: "point" - }, - { - title: "隐患排查", - type: "item", - i: 3 - }, + title: "基本信息", + type: "item", + i: 1 + }, + { + title: "基本信息", + type: "point" + }, + { + title: "统计信息", + type: "item", + i: 2 + }, + { + title: "统计信息", + type: "point" + }, + { + title: "隐患排查", + type: "item", + i: 3 + }, ], formData: { roadType: "", @@ -476,29 +480,29 @@ showProblemTreeSelect: false, problemTreeSelect: 0, problemTreeSelectList: [{ - name: "ashfjshfjsd1" - }, - { - name: "ashfjshfjsd2" - }, - { - name: "ashfjshfjs3d" - }, - { - name: "ashfjshfjsd4" - }, - { - name: "ashfjshfjsd5" - }, - { - name: "ashfjshfjsd6" - }, - { - name: "ashfjshfjsd8" - }, - { - name: "ashfjshfjsd7" - }, + name: "ashfjshfjsd1" + }, + { + name: "ashfjshfjsd2" + }, + { + name: "ashfjshfjs3d" + }, + { + name: "ashfjshfjsd4" + }, + { + name: "ashfjshfjsd5" + }, + { + name: "ashfjshfjsd6" + }, + { + name: "ashfjshfjsd8" + }, + { + name: "ashfjshfjsd7" + }, ], problemTreeSelectConfirmList: [], hiddenDangerList: [], @@ -509,7 +513,10 @@ addInvestigationInfo: { type: '', index: 0 - } + }, + //选中排查数据 + troubleshootingData: [], + checked: [], }; }, methods: { @@ -519,19 +526,43 @@ this.showInvestigation2Item = v; }, select2(v, list) { - this.showInvestigation = false; - let id = 0; - this.investigationSelectList.map((r) => { - if (r.nid == v.nid) { - id = r.nid; + // this.showInvestigation = false; + // let id = 0; + // this.investigationSelectList.map((r) => { + // if (r.nid == v.nid) { + // id = r.nid; + // } + // }); + // if (!id) { + // v.extraConfigs = list; + // this.investigationSelectList.push(v); + // this.showInvestigation = false; + // } else { + // this.$.toast("已添加"); + // } + list.dangerItems.forEach(item => { + // 假设this.troubleshootingData中没有与当前item.id相同的id + let found = false; + + // 遍历this.troubleshootingData数组来查找id + this.troubleshootingData.forEach(item2 => { + if (item.id === item2.id) { + // 如果找到了,设置found为true并退出循环 + found = true; + return; + } + }); + + // 如果在this.troubleshootingData中没有找到相同的id,则将其添加到result数组中 + if (!found) { + this.troubleshootingData.push(item); } }); - if (!id) { - v.extraConfigs = list; - this.investigationSelectList.push(v); - this.showInvestigation = false; - } else { - this.$.toast("已添加"); + // this.troubleshootingData = result + this.showInvestigation = false + let isId = this.investigationSelectList.some(item => item.nid === list.nid); + if (!isId) { + this.investigationSelectList.push(list) } }, select3(v) { @@ -566,28 +597,28 @@ newArr = ['', '', ''] } this.hiddenDangerList2 = [{ - id: v.bigCategory, - itemname: newArr[0] - }, - { - id: v.smallCategory, - itemname: newArr[1] - }, - { - id: v.hdTerm, - itemname: newArr[2] - } + id: v.bigCategory, + itemname: newArr[0] + }, + { + id: v.smallCategory, + itemname: newArr[1] + }, + { + id: v.hdTerm, + itemname: newArr[2] + } ] // console.log(this.hiddenDangerList2) - - if(v.hdPic){ + + if (v.hdPic) { this.fileList = [{ url: v.hdPic }]; - }else{ + } else { this.fileList = []; } - + }, add() { // this.addInvestigationInfo.type='add' @@ -622,9 +653,9 @@ this.$request .globalRequest( "/hiddenDanger/highDanger/getSectionInfo", { - nuserid: this.$.getData("token"), - businessId - }, + nuserid: this.$.getData("token"), + businessId + }, "GET" ) .then((res) => { @@ -638,9 +669,9 @@ this.$request .globalRequest( "/hiddenDanger/highDanger/getSectionTraffic", { - nuserid: this.$.getData("token"), - businessId - }, + nuserid: this.$.getData("token"), + businessId + }, "GET" ) .then((res) => { @@ -655,9 +686,9 @@ this.$request .globalRequest( "/hiddenDanger/highDanger/getImportDangerDisplay", { - sid: "02", - businessId - }, + sid: "02", + businessId + }, "GET" ) .then((res) => { @@ -667,9 +698,10 @@ this.$request .globalRequest( "/hiddenDanger/highDanger/getImportDangerDisplayDetail", { - nuserid: this.$.getData("token"), - businessId - }, + nuserid: this.$.getData("token"), + businessId, + dangerId: '26' + }, "GET" ) .then((res) => { @@ -689,9 +721,9 @@ this.$request .globalRequest( "/hiddenDanger/highDanger/getImportDangers", { - nuserid: this.$.getData("token"), - businessId - }, + nuserid: this.$.getData("token"), + businessId + }, "GET" ) .then((res) => { @@ -702,9 +734,9 @@ this.$request .globalRequest( "/hiddenDanger/highDanger/getUserHiddenDangerList", { - nuserid: this.$.getData("token"), - businessId - }, + nuserid: this.$.getData("token"), + businessId + }, "GET" ) .then((res) => { @@ -716,9 +748,9 @@ this.$request .globalRequest( "/hiddenDanger/highDanger/getDangerItems", { - nuserid: this.$.getData("token"), - businessId - }, + nuserid: this.$.getData("token"), + businessId + }, "GET" ) .then((res) => { @@ -814,20 +846,20 @@ let res = { categories: ["2018", "2019", "2020", "2021", "2022", "2023"], series: [{ - name: "总量", - legendShape: "line", - data: [35, 8, 25, 37, 4, 20], - }, - { - name: "大车", - legendShape: "line", - data: [70, 40, 65, 100, 44, 68], - }, - { - name: "小车", - legendShape: "line", - data: [100, 80, 95, 150, 112, 132], - }, + name: "总量", + legendShape: "line", + data: [35, 8, 25, 37, 4, 20], + }, + { + name: "大车", + legendShape: "line", + data: [70, 40, 65, 100, 44, 68], + }, + { + name: "小车", + legendShape: "line", + data: [100, 80, 95, 150, 112, 132], + }, ], }; this.chartData = JSON.parse(JSON.stringify(res)); @@ -841,7 +873,7 @@ len = !len ? 36 : len; binary = !binary ? 16 : binary; return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" - .replace(/[xy]/g, function(c) { + .replace(/[xy]/g, function (c) { var r = (Math.random() * binary) | 0, v = c == "x" ? r : (r & 0x3) | 0x8; return v.toString(binary); @@ -929,7 +961,7 @@ if (item.businessId) { delete item.businessId } - if (item.pcCount||item.pcCount==null) { + if (item.pcCount || item.pcCount == null) { delete item.pcCount } if (item.dangerProblem) { @@ -943,34 +975,34 @@ this.$request .globalRequest( "/hiddenDanger/highDanger/saveManualInvestigation", { - ...this.formData, - businessId: this.businessId, - extraConfigs: extraConfigs, - describe:describe, -// describe: [{ -// "bigCategory": "1", -// "bigCategoryName": "道路线性断面", -// "smallCategory": "2", -// "smallCategoryName": "平面线形", -// "hdTerm": "4", -// "hdTermName": "急弯接桥、隧道、涵洞的", -// "hdDesc": "", -// "hdPic": "", -// "hdInfo": "" -// }], - temporary, - }, + ...this.formData, + businessId: this.businessId, + extraConfigs: extraConfigs, + describe: describe, + // describe: [{ + // "bigCategory": "1", + // "bigCategoryName": "道路线性断面", + // "smallCategory": "2", + // "smallCategoryName": "平面线形", + // "hdTerm": "4", + // "hdTermName": "急弯接桥、隧道、涵洞的", + // "hdDesc": "", + // "hdPic": "", + // "hdInfo": "" + // }], + temporary, + }, "POST" ) .then((res) => { console.log(res); if (res.code === 200) { this.$.toast("保存成功"); - setTimeout(() => { - uni.navigateBack({ - delta: 2, // 默认值是1,表示返回的页面层数 - }); - }, 1000); + // setTimeout(() => { + // uni.navigateBack({ + // delta: 2, // 默认值是1,表示返回的页面层数 + // }); + // }, 1000); // this.data = res.result; // this.rname = this.data[0].name; @@ -1275,4 +1307,12 @@ padding: 0 20rpx; overflow-x: auto; } + .u-checkbox-group--row { + flex-direction: column; + padding: 0 20rpx; + + .u-checkbox { + margin-bottom: 30rpx; + } + } \ No newline at end of file diff --git a/uni_modules/uview-ui/components/u-checkbox-group/props.js b/uni_modules/uview-ui/components/u-checkbox-group/props.js index 2f818a1..4a5f72e 100644 --- a/uni_modules/uview-ui/components/u-checkbox-group/props.js +++ b/uni_modules/uview-ui/components/u-checkbox-group/props.js @@ -5,6 +5,11 @@ export default { type: String, default: uni.$u.props.checkboxGroup.name }, + // 标识符 + obj: { + type: [Object], + default: uni.$u.props.checkboxGroup.item + }, // 绑定的值 value: { type: Array, diff --git a/uni_modules/uview-ui/components/u-checkbox/props.js b/uni_modules/uview-ui/components/u-checkbox/props.js index 93f4fd9..be1d842 100644 --- a/uni_modules/uview-ui/components/u-checkbox/props.js +++ b/uni_modules/uview-ui/components/u-checkbox/props.js @@ -1,69 +1,74 @@ export default { - props: { - // checkbox的名称 - name: { - type: [String, Number, Boolean], - default: uni.$u.props.checkbox.name - }, - // 形状,square为方形,circle为圆型 - shape: { - type: String, - default: uni.$u.props.checkbox.shape - }, - // 整体的大小 - size: { - type: [String, Number], - default: uni.$u.props.checkbox.size - }, - // 是否默认选中 - checked: { - type: Boolean, - default: uni.$u.props.checkbox.checked - }, - // 是否禁用 - disabled: { - type: [String, Boolean], - default: uni.$u.props.checkbox.disabled - }, - // 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 - activeColor: { - type: String, - default: uni.$u.props.checkbox.activeColor - }, - // 未选中的颜色 - inactiveColor: { - type: String, - default: uni.$u.props.checkbox.inactiveColor - }, - // 图标的大小,单位px - iconSize: { - type: [String, Number], - default: uni.$u.props.checkbox.iconSize - }, - // 图标颜色 - iconColor: { - type: String, - default: uni.$u.props.checkbox.iconColor - }, - // label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式 - label: { - type: [String, Number], - default: uni.$u.props.checkbox.label - }, - // label的字体大小,px单位 - labelSize: { - type: [String, Number], - default: uni.$u.props.checkbox.labelSize - }, - // label的颜色 - labelColor: { - type: String, - default: uni.$u.props.checkbox.labelColor - }, - // 是否禁止点击提示语选中复选框 - labelDisabled: { - type: [String, Boolean], - default: uni.$u.props.checkbox.labelDisabled - } - } -} + props: { + // checkbox的名称 + name: { + type: [String, Number, Boolean], + default: uni.$u.props.checkbox.name, + }, + // item + obj: { + type: [ Object], + default: uni.$u.props.checkbox.obj, + }, + // 形状,square为方形,circle为圆型 + shape: { + type: String, + default: uni.$u.props.checkbox.shape, + }, + // 整体的大小 + size: { + type: [String, Number], + default: uni.$u.props.checkbox.size, + }, + // 是否默认选中 + checked: { + type: Boolean, + default: uni.$u.props.checkbox.checked, + }, + // 是否禁用 + disabled: { + type: [String, Boolean], + default: uni.$u.props.checkbox.disabled, + }, + // 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 + activeColor: { + type: String, + default: uni.$u.props.checkbox.activeColor, + }, + // 未选中的颜色 + inactiveColor: { + type: String, + default: uni.$u.props.checkbox.inactiveColor, + }, + // 图标的大小,单位px + iconSize: { + type: [String, Number], + default: uni.$u.props.checkbox.iconSize, + }, + // 图标颜色 + iconColor: { + type: String, + default: uni.$u.props.checkbox.iconColor, + }, + // label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式 + label: { + type: [String, Number], + default: uni.$u.props.checkbox.label, + }, + // label的字体大小,px单位 + labelSize: { + type: [String, Number], + default: uni.$u.props.checkbox.labelSize, + }, + // label的颜色 + labelColor: { + type: String, + default: uni.$u.props.checkbox.labelColor, + }, + // 是否禁止点击提示语选中复选框 + labelDisabled: { + type: [String, Boolean], + default: uni.$u.props.checkbox.labelDisabled, + }, + }, +}; diff --git a/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue b/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue index 6429cca..b9f3d6b 100644 --- a/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue +++ b/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue @@ -2,12 +2,12 @@ @@ -21,7 +21,7 @@