| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137 |
- <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="getOssPath(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>
- <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 {
- oss,
- devUrl,
- prodUrl,
- } from '@/common/setting'
- export default {
- components: {
- pageNav
- },
- onLoad(option) {
- console.log(option.id);
- this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
- //记录ID
- this.recordId = option.id;
- const id = option.id;
- const that = this;
- //查询问题详情信息
- http.request({
- url: '/blade-business/report/failure/detail',
- method: 'GET',
- params: {
- id
- }
- }).then(res => {
- console.log("detail " + res)
- if (res.code == 200) {
- that.checkNo = res.data['failureCheckNo'];
- that.recordInfo = res.data;
- that.failureCheckPointDesc = res.data['failureCheckPointDesc'];
- that.failureHiddenDangerDesc = res.data['failureHiddenDangerDesc'];
- that.failureCorrectiveSuggest = res.data['failureCorrectiveSuggest'];
- that.initProjectInfo(res.data['failureProjectId']);
- that.initCheckArea(res.data['failureCheckArea']);
- that.initCheckItemType(res.data['failureCheckHiddenDangerType']);
- that.initCheckItemLabel(res.data['failureCheckHiddenDanger']);
- this.initCheckStandard(res.data['failureCheckHiddenDangerItemPoint']);
- this.initCheckStandardBasis(res.data['failureCheckHiddenDangerStandard']);
- that.initHiddenDangerLevelRadio(res.data['failureHiddenDangerLevel']);
- that.initPlanTimeRadio(res.data['failureCorrectivePlanTime']);
- that.initPhoto(res.data['failureCheckNo']);
- }
- }).catch(err => {
- console.log(err)
- })
- },
- data() {
- return {
- baseURL: '',
- checkNo: '',
- recordInfo: {},
- 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: {
- getOssPath(imageInfo) {
- if (null != imageInfo && undefined != imageInfo && imageInfo.local) {
- return imageInfo.photoPath;
- } else {
- return oss + imageInfo.photoPath;
- }
- },
- 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)
- })
- },
- 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)
- })
- },
- initPhoto(failureCheckNo) {
- const that = this;
- http.request({
- url: '/blade-business/report/failure/photo/list',
- method: 'GET',
- params: {
- failureCheckNo
- }
- }).then(res => {
- console.log("detail " + res)
- if (res.success) {
- if (res.data != null && res.data.length > 0) {
- res.data.forEach(d => {
- let imageInfo = {
- id: d.id,
- photoPath: d.photoPath,
- failureCheckNo: d.failureCheckNo,
- local: false,
- }
- that.localImageList.push(imageInfo);
- })
- }
- }
- }).catch(err => {
- console.log(err)
- })
- },
- onDeleteClick(index) {
- this.localImageList.splice(index, 1);
- },
- 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;
- if (this.localImageList.length > 9) {
- uni.showModal({
- content: '一次最多上传9张图片,请检查!',
- showCancel: false
- });
- } else {
- uni.chooseImage({
- sourceType: ['album', 'camera'],
- success: async (res) => {
- const len = res.tempFilePaths.length;
- if (len > 0) {
- if (len + that.localImageList.length > 9) {
- uni.showModal({
- content: '一次最多上传9张图片,请检查!',
- showCancel: false
- });
- } else {
- let text = "";
- let pathList = [];
- res.tempFilePaths.forEach(async path => {
- let imageInfo = {
- id: '',
- photoPath: path,
- failureCheckNo: that.checkNo,
- local: true,
- }
- pathList.push(imageInfo);
- text += path + " ";
- })
- that.localImageList = that.localImageList.concat(pathList);
- }
- }
- }
- })
- }
- },
- async upload(formdata) {
- if (this.localImageList.length > 0) {
- var tempImageList = [];
- this.localImageList.forEach(image => {
- if (image.local) {
- tempImageList.push(image.photoPath);
- } else {
- this.uploadImageList.push(image);
- }
- })
- if (tempImageList.length > 0) {
- await this.uploadFile(tempImageList).then(names => {
- names.forEach(name => {
- console.log("image path " + name);
- let p = {
- failureCheckNo: this.checkNo,
- photoPath: name,
- id: ''
- }
- this.uploadImageList.push(p);
- })
- formdata['photoPaths'] = this.uploadImageList;
- http.request({
- url: '/blade-business/report/failure/update',
- method: 'POST',
- data: formdata
- }).then(res => {
- if (res.success) {
- 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 {
- formdata['photoPaths'] = this.uploadImageList;
- http.request({
- url: '/blade-business/report/failure/update',
- method: 'POST',
- data: formdata
- }).then(res => {
- if (res.success) {
- 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/update',
- method: 'POST',
- data: formdata
- }).then(res => {
- if (res.success) {
- 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)
- })
- }
- },
- 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()
- }
- });
- });
- })
- },
- formSubmit: function(e) {
- console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
- var formdata = 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'] = formdata['failureCheckPointDesc'];
- this.recordInfo['failureHiddenDangerDesc'] = formdata['failureHiddenDangerDesc'];
- this.recordInfo['failureCorrectiveSuggest'] = formdata['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>
|