| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190 |
- <template>
- <view class="wrap">
- <page-nav :desc="desc" :title="title"></page-nav>
- <view>
- <form @submit="formSubmit" @reset="formReset">
- <!-- 项目信息项 -->
- <view class="uni-form-item">
- <view class="view-flex-rs line-body">
- <view class="view-flex-cc">
- <text class="required-star">*</text>
- </view>
- <view style="width: 200rpx;" class="view-flex-cc item-title">
- <text>当前项目:</text>
- </view>
- <view style="flex-grow: 0.9;" class="view-flex-cc">
- <text>{{projectInfo.title}}</text>
- </view>
- <view style="width: 200rpx;" class="view-flex-cc">
- <button style="height: 80rpx;font-size: medium;" type="primary"
- @click="goto('/pages/checkReport/checkProjectSelect?model=1')">重新选择</button>
- </view>
- </view>
- </view>
- <!-- 检查区域信息项 -->
- <view class="uni-form-item" style="margin-top: 10px;">
- <view class="line-body view-flex-rs">
- <text class="required-star">*</text>
- <text class="item-title">检查区域</text>
- </view>
- <view>
- <uni-list-item @click="selectCheckArea()" :clickable="true" :ellipsis="1"
- :show-extra-icon="true" showArrow
- :extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
- v-bind:title="checkAreaDict.dictValue" />
- </view>
- <!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkAreaDict.dictValue"
- hover-class="cell-hover-class" @click="selectCheckArea()"></u-cell-item> -->
- </view>
- <!-- 检查点位文本信息项 -->
- <view class="uni-form-item uni-column" style="margin-top: 10rpx;">
- <view class="line-body item-title">
- 具体位置
- </view>
- <view class="line-body">
- <uni-easyinput errorMessage v-model="failureCheckPointDesc" placeholder="请输入内容"></uni-easyinput>
- </view>
- </view>
- <!-- 安全隐患问题类型信息项,字典 -->
- <view class="uni-form-item" style="margin-top: 10px;">
- <view class="line-body view-flex-rs">
- <text class="required-star">*</text>
- <text class="item-title">安全问题隐患类型</text>
- </view>
- <view>
- <uni-list-item @click="selectCheckItemType()" :clickable="true" :ellipsis="1"
- :show-extra-icon="true" showArrow
- :extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
- v-bind:title="checkItemTypeDict.dictValue" />
- </view>
- <!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkItemTypeDict.dictValue"
- hover-class="cell-hover-class" @click="selectCheckItemType()"></u-cell-item> -->
- </view>
- <!-- 安全隐患问题标签信息项,字典 -->
- <view class="uni-form-item" style="margin-top: 10px;">
- <view class="line-body view-flex-rs">
- <text class="required-star">*</text>
- <text class="item-title">检查部位</text>
- </view>
- <view>
- <uni-list-item @click="selectCheckItemLabel()" :clickable="true" :ellipsis="1"
- :show-extra-icon="true" showArrow
- :extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
- v-bind:title="checkItemLabelDict.dictValue" />
- </view>
- <!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkItemLabelDict.dictValue"
- hover-class="cell-hover-class" @click="selectCheckItemLabel()"></u-cell-item> -->
- </view>
- <!-- 安全隐患问题排查标准信息项,字典 -->
- <view class="uni-form-item uni-column" style="margin-top: 10px;">
- <view class="line-body view-flex-rs">
- <text class="required-star">*</text>
- <text class="item-title">问题隐患标签</text>
- </view>
- <view>
- <uni-list-item @click="selectCheckStandard()" :clickable="true" :ellipsis="1"
- :show-extra-icon="true" showArrow
- :extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
- v-bind:title="checkStandardDict.dictValue" />
- </view>
- <!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkStandardDict.dictValue"
- hover-class="cell-hover-class" @click="selectCheckStandard()"></u-cell-item> -->
- </view>
- <view class="uni-form-item uni-column" style="margin-top: 10px;">
- <view class="line-body item-title">
- 法律法规
- </view>
- <view class="line-body">
- <textarea disabled v-model="checkItemStandardBasisDict.dictValue" class="mline-text" />
- <!-- <uni-easyinput disabled v-model="checkItemStandardBasisDict.dictValue"></uni-easyinput> -->
- </view>
- </view>
- <!-- 安全隐患问题描述信息项,文本 -->
- <view class="uni-form-item uni-column" style="margin-top: 10px;">
- <view class="line-body item-title">
- 安全问题隐患描述
- </view>
- <view class="line-body">
- <textarea v-model="failureHiddenDangerDesc" name="failureCorrectiveSuggest"
- class="mline-text" />
- </view>
- </view>
- <!-- 隐患等级信息项,字典 -->
- <view class="uni-form-item" style="margin-top: 15px;">
- <view class="view-flex-rs">
- <view class="uni-title line-body"><text class="required-star">*</text><text
- class="item-title">隐患等级</text></view>
- <view class="line-body">
- <radio-group @change="hiddenDangerRadioChange"
- style="display: flex;flex-direction: row;justify-content: flex-start;">
- <label style="margin-top: 2px;margin-right: 5px;" class="view-flex-rs"
- v-for="(item, index) in hiddenDangerRadio.items" :key="item.id">
- <view>
- <radio :value="item.id" :checked="index === hiddenDangerRadio.current" />
- </view>
- <view style="font-size: 12px;">{{item.dictValue}}</view>
- </label>
- </radio-group>
- </view>
- </view>
- </view>
- <!-- 整改建议信息项,文本 -->
- <view class="uni-form-item uni-column" style="margin-top: 10px;">
- <view class="line-body item-title">
- 整改建议
- </view>
- <view class="line-body">
- <textarea v-model="failureCorrectiveSuggest" name="failureCorrectiveSuggest"
- class="mline-text" />
- </view>
- </view>
- <!-- 整改期限信息项,字典 -->
- <view class="uni-form-item" style="margin-top: 15px;">
- <view class="view-flex-rs">
- <view class="uni-title line-body"><text class="required-star">*</text><text
- class="item-title">整改期限</text></view>
- <view class="line-body">
- <radio-group @change="planTimeRadioChange"
- style="display: flex;flex-direction: row;justify-content: flex-start;">
- <label style="margin-top: 2px; margin-right: 5px;" class="view-flex-rs"
- v-for="(item, index) in planTimeRadio.items" :key="item.id">
- <view>
- <radio :value="item.id" :checked="index === planTimeRadio.current" />
- </view>
- <view style="font-size: 12px;">{{item.dictValue}}</view>
- </label>
- </radio-group>
- </view>
- </view>
- </view>
- <!-- 图片信息项 -->
- <view class="uni-form-item" style="margin-top: 10px;">
- <view class="view-flex-rs line-body">
- <view class="view-flex-cc" style="height: 40px;">
- <text class="item-title">安全隐患问题图片</text>
- </view>
- </view>
- </view>
- <view class="uni-form-item" style="margin-top: 10px;">
- <view class="img-container">
- <view class="note-image-box">
- <view class="note-image-item" v-for="(item , index) in localImageList" :key="index">
- <view class="close-icon" @click="onDeleteClick(index)">
- <uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
- </view>
- <view class="image-box">
- <image :src="item" mode="widthFix"></image>
- </view>
- </view>
- <view v-if="localImageList.length < 9" class="note-image-item" @click="getPhoto()">
- <view class="image-box">
- <uni-icons type="plusempty" size="50" color="#eee"></uni-icons>
- </view>
- </view>
- </view>
- </view>
- </view>
- <u-gap height="50"></u-gap>
- <view class="uni-form-item uni-column">
- <view class="line-body">
- <button type="primary" form-type="submit">提交</button>
- </view>
- <view class="line-body" style="margin-top: 10px;">
- <button type="default" @click="onSaveClick">保存</button>
- </view>
- </view>
- <u-gap height="50"></u-gap>
- </form>
- </view>
- </view>
- </template>
- <script>
- import pageNav from '@/components/page-nav/page-nav.vue';
- import http from '@/http/api.js';
- import {
- devUrl,
- prodUrl,
- oss
- } from '@/common/setting';
- export default {
- components: {
- pageNav
- },
- onLoad(option) {
- console.log(option.checkNo);
- this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
- this.checkNo = option.checkNo;
- //问题详情信息
- var data = uni.getStorageSync('check_report_storage_' + this.checkNo);
- if (data != null) {
- console.log("detail " + data)
- this.recordInfo = data;
- this.failureCheckPointDesc = data['failureCheckPointDesc']
- this.failureHiddenDangerDesc = data['failureHiddenDangerDesc']
- this.failureCorrectiveSuggest = data['failureCorrectiveSuggest']
- this.initProjectInfo(data['failureProjectId']);
- this.initCheckArea(data['failureCheckArea']);
- this.initCheckItemType(data['failureCheckHiddenDangerType']);
- this.initCheckItemLabel(data['failureCheckHiddenDanger']);
- this.initCheckStandard(data['failureCheckHiddenDangerItemPoint']);
- this.initCheckStandardBasis(data['failureCheckHiddenDangerStandard']);
- this.initHiddenDangerLevelRadio(data['failureHiddenDangerLevel']);
- this.initPlanTimeRadio(data['failureCorrectivePlanTime']);
- this.initPhoto()
- }
- },
- data() {
- return {
- baseURL: '',
- checkNo: '',
- recordInfo: {},
- savedImageList: [],
- planTimeRadio: {
- items: [],
- current: 0,
- },
- hiddenDangerRadio: {
- items: [],
- current: 0,
- },
- localImageList: [],
- uploadImageList: [],
- checkAreaDict: {
- id: '',
- dictKey: '',
- dictValue: '请点击选择'
- },
- checkItemTypeDict: {
- id: '',
- dictKey: '',
- dictValue: '请点击选择'
- },
- checkItemLabelDict: {
- id: '',
- dictKey: '',
- dictValue: '请点击选择'
- },
- checkStandardDict: {
- id: '',
- dictKey: '',
- dictValue: '请点击选择'
- },
- checkItemStandardBasisDict: {
- id: '',
- dictKey: '',
- dictValue: ''
- },
- title: '问题编辑',
- desc: '',
- projectInfo: {
- 'projectId': '',
- 'title': ''
- },
- failureHiddenDangerDesc: '',
- failureCheckPointDesc: '',
- failureCorrectiveSuggest: '',
- }
- },
- computed: {
- getIcon() {
- return path => {
- return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
- }
- },
- },
- onShow() {
- uni.setNavigationBarTitle({
- title: "问题编辑"
- });
- //项目选择结果监听
- uni.$on("handClickProjectSelect", res => {
- console.log(res);
- this.projectInfo = {
- projectId: res.projectId,
- title: '重新选择的项目名'
- }
- // 清除监听
- uni.$off('handClickProjectSelect');
- })
- //检查区域选择结果监听
- uni.$on("handClickAreaSelect", res => {
- console.log(res);
- this.checkAreaDict = {
- dictValue: res.dictValue,
- dictKey: res.dictKey,
- id: res.id
- }
- // 清除监听
- uni.$off('handClickAreaSelect');
- })
- //安全隐患问题分类选择结果监听
- uni.$on("handClickItemSelect", res => {
- console.log("callback " + res);
- if (this.checkItemTypeDict.id == null || this.checkItemTypeDict.id.length == 0 || this
- .checkItemTypeDict.id !== res.id) {
- this.checkItemLabelDict = {
- id: '',
- dictKey: '',
- dictValue: '请点击选择'
- }
- this.checkStandardDict = {
- id: '',
- dictKey: '',
- dictValue: '请点击选择'
- }
- this.failureHiddenDangerDesc = "";
- this.checkItemStandardBasisDict = {
- id: '',
- dictKey: '',
- dictValue: ''
- }
- }
- this.checkItemTypeDict = {
- dictValue: res.dictValue,
- dictKey: res.dictKey,
- id: res.id
- }
- // 清除监听
- uni.$off('handClickItemSelect');
- })
- //安全隐患标签选择结果监听
- uni.$on("handClickItemLabelSelect", res => {
- console.log("handClickItemLabelSelect" + res);
- if (this.checkItemLabelDict.id == null || this.checkItemLabelDict.id.length == 0 || this
- .checkItemLabelDict.id !== res.id) {
- this.checkStandardDict = {
- id: '',
- dictKey: '',
- dictValue: '请点击选择'
- }
- this.failureHiddenDangerDesc = "";
- this.checkItemStandardBasisDict = {
- id: '',
- dictKey: '',
- dictValue: ''
- }
- }
- this.checkItemLabelDict = {
- dictValue: res.dictValue,
- dictKey: res.dictKey,
- id: res.id
- }
- // 清除监听
- uni.$off('handClickItemLabelSelect');
- })
- //安全隐患排查标准选择结果监听
- uni.$on("handClickStandardSelect", res => {
- console.log(res);
- if (this.checkStandardDict.id == null || this.checkStandardDict.id.length == 0 || this
- .checkStandardDict.id !== res.id) {
- this.failureHiddenDangerDesc = "";
- this.checkItemStandardBasisDict = {
- id: '',
- dictKey: '',
- dictValue: ''
- }
- }
- this.checkStandardDict = {
- dictValue: res.dictValue,
- dictKey: res.dictKey,
- id: res.id
- }
- this.failureHiddenDangerDesc = res.dictValue;
- this.checkItemStandardBasisDict = {
- dictValue: res.subDict.dictValue,
- dictKey: res.subDict.dictKey,
- id: res.subDict.id
- }
- // 清除监听
- uni.$off('handClickStandardSelect');
- })
- },
- created() {
- },
- methods: {
- initProjectInfo(failureProjectId) {
- const that = this;
- const id = failureProjectId;
- http.request({
- url: '/blade-business/report/projectInfo/detail',
- method: 'GET',
- params: {
- id
- }
- }).then(res => {
- console.log(res.data)
- that.projectInfo = {
- projectId: res.data.id,
- title: res.data.projectName
- }
- }).catch(err => {
- console.log(err)
- })
- },
- initCheckArea(dictId) {
- const that = this;
- const id = dictId;
- http.request({
- url: '/galaxy-system/dict-biz/detail',
- method: 'GET',
- params: {
- id
- }
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- that.checkAreaDict = {
- id: res.data['id'],
- dictKey: res.data['dictKey'],
- dictValue: res.data['dictValue'],
- };
- }
- }).catch(err => {
- console.log(err)
- })
- },
- initCheckItemType(dictId) {
- const that = this;
- const id = dictId;
- http.request({
- url: '/galaxy-system/dict-biz/detail',
- method: 'GET',
- params: {
- id
- }
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- that.checkItemTypeDict = {
- id: res.data['id'],
- dictKey: res.data['dictKey'],
- dictValue: res.data['dictValue'],
- };
- }
- }).catch(err => {
- console.log(err)
- })
- },
- initCheckItemLabel(dictId) {
- const that = this;
- const id = dictId;
- http.request({
- url: '/galaxy-system/dict-biz/detail',
- method: 'GET',
- params: {
- id
- }
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- that.checkItemLabelDict = {
- id: res.data['id'],
- dictKey: res.data['dictKey'],
- dictValue: res.data['dictValue'],
- };
- }
- }).catch(err => {
- console.log(err)
- })
- },
- initCheckStandard(dictId) {
- const that = this;
- const id = dictId;
- http.request({
- url: '/galaxy-system/dict-biz/detail',
- method: 'GET',
- params: {
- id
- }
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- that.checkStandardDict = {
- id: res.data['id'],
- dictKey: res.data['dictKey'],
- dictValue: res.data['dictValue'],
- };
- }
- }).catch(err => {
- console.log(err)
- })
- },
- initCheckStandardBasis(dictId) {
- if (null != dictId && undefined != dictId && dictId.length > 0) {
- const that = this;
- const id = dictId;
- http.request({
- url: '/galaxy-system/dict-biz/detail',
- method: 'GET',
- params: {
- id
- }
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- that.checkItemStandardBasisDict = {
- id: res.data['id'],
- dictKey: res.data['dictKey'],
- dictValue: res.data['dictValue'],
- };
- }
- }).catch(err => {
- console.log(err)
- })
- }
- },
- initHiddenDangerLevelRadio(dictId) {
- const that = this;
- //查询隐患等级
- http.request({
- url: '/galaxy-system/dict-biz/dictionary?code=danger_level',
- method: 'GET'
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- var dangerLevelList = [];
- var index = 0;
- const dictLength = res.data['length'];
- for (var i = 0; i < dictLength; i++) {
- let dict = res.data['' + i];
- if (dict['id'] == dictId) {
- index = i;
- }
- dangerLevelList.push(dict);
- }
- that.hiddenDangerRadio = {
- current: index,
- items: dangerLevelList
- }
- }
- }).catch(err => {
- console.log(err)
- })
- },
- initHiddenDangerLevelRadio(dictId) {
- const that = this;
- //查询隐患等级
- http.request({
- url: '/galaxy-system/dict-biz/dictionary?code=danger_level',
- method: 'GET'
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- var dangerLevelList = [];
- var index = 0;
- const dictLength = res.data['length'];
- for (var i = 0; i < dictLength; i++) {
- let dict = res.data['' + i];
- if (dict['id'] == dictId) {
- index = i;
- }
- dangerLevelList.push(dict);
- }
- that.hiddenDangerRadio = {
- current: index,
- items: dangerLevelList
- }
- }
- }).catch(err => {
- console.log(err)
- })
- },
- initPlanTimeRadio(dictId) {
- const that = this;
- //查询整改期限
- http.request({
- url: '/galaxy-system/dict-biz/dictionary?code=plan_time',
- method: 'GET'
- }).then(res => {
- console.log(res.data)
- if (res.data != null) {
- var planTimeList = [];
- var index = 0;
- const dictLength = res.data['length'];
- for (var i = 0; i < dictLength; i++) {
- let dict = res.data['' + i];
- if (dict['id'] == dictId) {
- index = i;
- }
- planTimeList.push(dict);
- }
- that.planTimeRadio = {
- current: index,
- items: planTimeList,
- }
- }
- }).catch(err => {
- console.log(err)
- })
- },
- getOssPath(imagePath) {
- if (null != imagePath && imagePath.indexOf("blob") == 0) {
- return imagePath;
- } else {
- return oss + imagePath;
- }
- },
- initPhoto() {
- var saveFilePaths = uni.getStorageSync('check_report_storage_image_' + this.checkNo);
- this.localImageList = this.localImageList.concat(saveFilePaths);
- },
- onDeleteClick(index) {
- this.localImageList.splice(index, 1);
- },
- removeRecord() {
- var tempIndexList = [];
- var list = uni.getStorageSync('check_report_storage_index');
- if (list != null && list.length > 0) {
- list.forEach(itemKey => {
- if (itemKey !== this.checkNo) {
- tempIndexList.push(itemKey);
- }
- });
- }
- uni.setStorageSync('check_report_storage_index', tempIndexList);
- uni.removeStorageSync('check_report_storage_' + this.checkNo);
- },
- planTimeRadioChange: function(evt) {
- for (let i = 0; i < this.planTimeRadio.items.length; i++) {
- if (this.planTimeRadio.items[i].id === evt.detail.value) {
- this.planTimeRadio.current = i;
- break;
- }
- }
- },
- hiddenDangerRadioChange: function(evt) {
- for (let i = 0; i < this.hiddenDangerRadio.items.length; i++) {
- if (this.hiddenDangerRadio.items[i].id === evt.detail.value) {
- this.hiddenDangerRadio.current = i;
- break;
- }
- }
- },
- getPhoto() {
- const that = this;
- uni.chooseImage({
- sourceType: ['album', 'camera'],
- success: (res) => {
- const len = res.tempFilePaths.length;
- if (len > 0) {
- if (len + that.localImageList.length > 9) {
- uni.showModal({
- content: '一次最多上传9张图片,请检查!',
- showCancel: false
- });
- } else {
- let pathList = [];
- res.tempFilePaths.forEach(path => {
- that.localImageList.push(path);
- })
- }
- }
- }
- })
- },
- saveLocalFile(paths) {
- var returnFileList = [];
- var count = 0;
- return new Promise((resolve, reject) => {
- paths.forEach(imagePath => {
- console.log("path " + imagePath);
- uni.saveFile({
- tempFilePath: imagePath,
- success: (res) => {
- var savedFilePath = res.savedFilePath;
- returnFileList.push(savedFilePath);
- count += 1;
- if (count == paths.length) {
- resolve(returnFileList);
- }
- },
- fail: (e) => {
- reject('err')
- }
- })
- });
- })
- },
- async saveLocalFiles(tempImageList) {
- if (tempImageList.length > 0) {
- await this.saveLocalFile(tempImageList).then(files => {
- files.forEach(f => {
- this.savedImageList.push(f);
- })
- });
- }
- },
- onSaveClick(e) {
- if ((this.projectInfo.projectId != null && this.projectInfo.projectId.length > 0) &&
- (this.checkAreaDict.id != null && this.checkAreaDict.id.length > 0) &&
- (this.checkItemTypeDict.id != null && this.checkItemTypeDict.id.length > 0) &&
- (this.checkItemLabelDict.id != null && this.checkItemLabelDict.id.length > 0) &&
- (this.checkStandardDict.id != null && this.checkStandardDict.id.length > 0)) {
- try {
- var data = {};
- data['failureHiddenDangerDesc'] = this.failureHiddenDangerDesc;
- data['failureCheckPointDesc'] = this.failureCheckPointDesc;
- data['failureCorrectiveSuggest'] = this.failureCorrectiveSuggest;
- data['failureCheckNo'] = this.checkNo;
- data['failureProjectId'] = this.projectInfo.projectId;
- data['failureCheckArea'] = this.checkAreaDict.id;
- data['failureCheckHiddenDangerType'] = this.checkItemTypeDict.id;
- data['failureCheckHiddenDanger'] = this.checkItemLabelDict.id;
- data['failureCheckHiddenDangerItemPoint'] = this.checkStandardDict.id;
- data['failureCheckHiddenDangerStandard'] = this.checkItemStandardBasisDict.id;
- data['failureHiddenDangerLevel'] = this.hiddenDangerRadio.items[this.hiddenDangerRadio.current]
- .id;
- data['failureCorrectivePlanTime'] = this.planTimeRadio.items[this.planTimeRadio.current]
- .id;
- var tempImageList = [];
- this.savedImageList = [];
- this.localImageList.forEach(path => {
- var text = String(path);
- if (text.indexOf("blob") == 0) {
- tempImageList.push(text);
- } else {
- this.savedImageList.push(text);
- }
- })
- this.saveLocalFiles(tempImageList);
- uni.setStorageSync('check_report_storage_image_' + this
- .checkNo, this.savedImageList);
- console.log("save " + data);
- uni.setStorageSync('check_report_storage_' + this.checkNo, data);
- uni.navigateBack();
- } catch (e) {
- console.log(e);
- uni.showModal({
- content: '保存失败!' + e.message,
- showCancel: false
- });
- }
- } else {
- uni.showModal({
- content: '请检查必填项',
- showCancel: false
- });
- }
- },
- uploadFile(imagePaths) {
- var returnImagePathList = [];
- var count = 0;
- console.log("accessToken:" + uni.getStorageSync('accessToken'));
- return new Promise((resolve, reject) => {
- imagePaths.forEach(imagePath => {
- console.log("path " + imagePath);
- uni.showLoading({
- title: '上传中'
- });
- uni.uploadFile({
- url: this.baseURL +
- '/galaxy-resource/oss/endpoint/put-file-attach?Blade-Auth=' +
- uni.getStorageSync('accessToken'),
- fileType: 'image',
- filePath: imagePath,
- name: 'file',
- success: (uploadFileRes) => {
- console.log(uploadFileRes);
- if (uploadFileRes.statusCode == 200) {
- let data = JSON.parse(uploadFileRes.data);
- if (data.success) {
- let name = data.data['name'];
- returnImagePathList.push(name);
- }
- }
- count += 1;
- if (count == imagePaths.length) {
- resolve(returnImagePathList);
- }
- },
- fail: (err) => {
- console.log(err);
- reject('err')
- },
- complete() {
- uni.hideLoading()
- }
- });
- });
- })
- },
- async upload(formdata) {
- const that = this;
- if (this.localImageList.length > 0) {
- await this.uploadFile(this.localImageList).then(names => {
- names.forEach(name => {
- console.log("image path " + name);
- this.uploadImageList.push(name);
- })
- var photoPaths = [];
- this.uploadImageList.forEach(name => {
- let p = {
- failureCheckNo: this.checkNo,
- photoPath: name
- }
- photoPaths.push(p);
- })
- formdata['photoPaths'] = photoPaths;
- http.request({
- url: '/blade-business/report/failure/save',
- method: 'POST',
- data: formdata
- }).then(res => {
- if (res.success) {
- that.removeRecord();
- uni.showModal({
- content: '上传成功',
- showCancel: false,
- success(res) {
- if (res.confirm) {
- uni.navigateBack();
- }
- }
- });
- } else {
- uni.showModal({
- content: '' + res.msg,
- showCancel: false
- });
- }
- }).catch(err => {
- console.log(err)
- })
- })
- } else {
- http.request({
- url: '/blade-business/report/failure/save',
- method: 'POST',
- data: formdata
- }).then(res => {
- if (res.success) {
- that.removeRecord();
- uni.showModal({
- content: '上传成功',
- showCancel: false,
- success(res) {
- if (res.confirm) {
- uni.navigateBack();
- }
- }
- });
- } else {
- uni.showModal({
- content: '' + res.msg,
- showCancel: false
- });
- }
- }).catch(err => {
- console.log(err)
- })
- }
- },
- formSubmit: function(e) {
- console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
- if ((this.projectInfo.projectId != null && this.projectInfo.projectId.length > 0) &&
- (this.checkAreaDict.id != null && this.checkAreaDict.id.length > 0) &&
- (this.checkItemTypeDict.id != null && this.checkItemTypeDict.id.length > 0) &&
- (this.checkItemLabelDict.id != null && this.checkItemLabelDict.id.length > 0) &&
- (this.checkStandardDict.id != null && this.checkStandardDict.id.length > 0)) {
- this.recordInfo['failureCheckPointDesc'] = this.failureCheckPointDesc;
- this.recordInfo['failureHiddenDangerDesc'] = this.failureHiddenDangerDesc;
- this.recordInfo['failureCorrectiveSuggest'] = this.failureCorrectiveSuggest;
- this.recordInfo['failureProjectId'] = this.projectInfo.projectId;
- this.recordInfo['failureCheckArea'] = this.checkAreaDict.id;
- this.recordInfo['failureCheckHiddenDangerType'] = this.checkItemTypeDict.id;
- this.recordInfo['failureCheckHiddenDanger'] = this.checkItemLabelDict.id;
- this.recordInfo['failureCheckHiddenDangerItemPoint'] = this.checkStandardDict.id;
- this.recordInfo['failureCheckHiddenDangerStandard'] = this.checkItemStandardBasisDict.id;
- this.recordInfo['failureHiddenDangerLevel'] = this.hiddenDangerRadio.items[this
- .hiddenDangerRadio.current]
- .id;
- this.recordInfo['failureCorrectivePlanTime'] = this.planTimeRadio.items[this.planTimeRadio
- .current]
- .id;
- this.upload(this.recordInfo);
- } else {
- uni.showModal({
- content: '请检查必填项',
- showCancel: false
- });
- }
- },
- formReset: function(e) {
- console.log('清空数据')
- },
- selectCheckArea() {
- this.$u.route({
- url: '/pages/checkReport/checkAreaSelect'
- })
- },
- selectCheckItemType() {
- uni.navigateTo({
- url: '/pages/checkReport/checkItemSelect'
- })
- },
- selectCheckItemLabel() {
- if (this.checkItemTypeDict.id.length > 0) {
- uni.navigateTo({
- url: '/pages/checkReport/checkItemLabelSelect?id=' + this.checkItemTypeDict.id
- })
- } else {
- uni.showModal({
- content: '请先选择安全隐患问题类型',
- showCancel: false
- });
- }
- },
- selectCheckStandard() {
- if (this.checkItemLabelDict.id.length > 0) {
- uni.navigateTo({
- url: '/pages/checkReport/checkStandardSelect?id=' + this.checkItemLabelDict.id
- })
- } else {
- uni.showModal({
- content: '请先选择安全隐患问题标签',
- showCancel: false
- });
- }
- },
- openPage(path) {
- this.$u.route({
- url: path
- })
- },
- getGroupTitle(item) {
- return item.groupName
- },
- getFieldTitle(item) {
- return item.title
- },
- goto(url) {
- console.log(url);
- uni.navigateTo({
- url: url
- })
- }
- }
- }
- </script>
- <style>
- /* page {
- background-color: rgb(240, 242, 244);
- } */
- .cell-hover-class {
- background-color: rgb(235, 237, 238);
- }
- .view-flex-rs {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .view-flex-rc {
- display: flex;
- flex-direction: row;
- justify-content: center;
- }
- .view-flex-re {
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- }
- .view-flex-cs {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- }
- .view-flex-cc {
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .view-flex-ce {
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- }
- .line-body {
- padding-left: 10px;
- padding-right: 10px;
- }
- .required-star {
- color: #FF0000;
- font-size: 15px;
- width: 20px;
- text-align: center;
- padding-left: 0px;
- padding-right: 2px;
- }
- .item-title {
- color: #909399;
- font-size: 15px;
- }
- .mline-text {
- padding-left: 2px;
- width: 100%;
- /* background-color:#909399; */
- height: 100px;
- border: 1px solid #FF5A5F;
- border-radius: 5px;
- }
- </style>
- <style lang="scss" scoped>
- .u-cell-icon {
- width: 36rpx;
- height: 36rpx;
- margin-right: 8rpx;
- }
- .slot-box {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- align-items: center;
- }
- .slot-image {
- /* #ifndef APP-NVUE */
- display: block;
- /* #endif */
- margin-right: 10px;
- width: 30px;
- height: 30px;
- }
- .slot-text {
- flex: 1;
- font-size: 14px;
- color: #4cd964;
- margin-right: 10px;
- }
- .img-container {
- margin-bottom: 20px;
- .note-image-box {
- margin-top: 5px;
- display: flex;
- flex-wrap: wrap;
- padding: 10px;
- .note-image-item {
- position: relative;
- width: 33.3%;
- height: 0;
- padding-top: 33.3%;
- box-sizing: border-box;
- // background-color: #18B566;
- .close-icon {
- display: flex;
- justify-content: center;
- align-items: center;
- position: absolute;
- right: 0px;
- top: 0px;
- width: 22px;
- height: 22px;
- border-radius: 50%;
- background-color: #d5d5d5;
- z-index: 2;
- }
- .image-box {
- display: flex;
- justify-content: center;
- align-items: center;
- position: absolute;
- top: 5px;
- right: 5px;
- border: 5px;
- left: 5px;
- border: 1px #eee solid;
- border-radius: 5px;
- overflow: hidden;
- width: 95%;
- height: 95%;
- }
- }
- }
- }
- </style>
|