1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003 |
- <template>
- <view>
- <view class="background">
- <view class="uni-list">
- <view class="container">
- <view>
- 工程类型
- </view>
- <view v-if="this.isEmpty(this.projectType.dictValue)" style="margin-top: 10;"
- @click="pickerShow('gclx',0)">
- <span style="color: darkgray;">请选择工程类型</span>
- <image src="../../static/images/icon_right.png"
- style=" position: absolute; width: 15px;height: 15px;"></image>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gclx',0)">
- <span style="color: black;">{{projectType.dictLabel}}</span>
- <image src="../../static/images/icon_right.png"
- style=" position: absolute; width: 15px;height: 15px;"></image>
- </view>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <view>
- 工程名称
- </view>
- <view v-if="this.isEmpty(this.projectName.id)" style="margin-top: 10;"
- @click="pickerShow('gcmc',0)">
- <span style="color: darkgray;">请选择工程名称</span>
- <image src="../../static/images/icon_right.png"
- style=" position: absolute; width: 15px;height: 15px;"></image>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gcmc',0)">
- <span style="color: black;">{{projectName.name}}</span>
- <image src="../../static/images/icon_right.png"
- style=" position: absolute; width: 15px;height: 15px;"></image>
- </view>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>建设单位</text>
- <input class="uni-input" type="text" v-model="jsdwValue" maxlength="100" disabled="true"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>项目负责人</text>
- <input class="uni-input" type="text" v-model="xmfzrValue" maxlength="16" disabled="true"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>现场负责人</text>
- <input class="uni-input" type="text" v-model="xcfzrValue" maxlength="16" disabled="true"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>设计单位</text>
- <input class="uni-input" type="text" v-model="sjdwValue" maxlength="100" disabled="true"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>设计负责人</text>
- <input class="uni-input" type="text" v-model="sjfzrValue" maxlength="16" disabled="true"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>设计联系电话</text>
- <input class="uni-input" type="number" v-model="sjPhoneValue" disabled="true" maxlength="11"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>监理单位</text>
- <input class="uni-input" type="text" v-model="jldwValue" maxlength="100" disabled="true"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>监理负责人</text>
- <input class="uni-input" type="text" v-model="jlfzrValue" maxlength="16" disabled="true"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <text>监理联系电话</text>
- <input class="uni-input" type="number" v-model="jlPhoneValue" disabled="true" maxlength="11"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- <view class="uni-list">
- <view class="align-items" style="margin-bottom: 20px;">
- <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
- <view v-for="(item,index) in fileArr" :key="index" style="position: relative;">
- <view style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
- @click="chooseModel(item.picUrl,item.fileName)">
- {{item.fileName}}
- </view>
- <view @click="removeFile(index)" v-if="this.$user.state.name==this.createBy"
- style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
- <image src="../../static/images/icon_close.png" style=" width: 15px; height: 15px;">
- </image>
- </view>
- </view>
- </view>
- </view>
- </view>
- <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
- subtitleKey="id" v-model="name"></SelectPicker>
- <SelectPicker :list="dictOptions" @change="changeSelectDict" v-if="openDict" @close="closeDict"
- titleKey="dictLabel" subtitleKey="dictValue" v-model="dictLabel"></SelectPicker>
- </view>
- <view class="background">
- <view>
- <view class="uni-list">
- <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
- {{objValue.value}}
- <span
- style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;"
- @click="history">历史</span>
- </view>
- <view class="container">
- <view>
- 施工时间
- </view>
- <view @click="openDatetimePicker()">
- <span style="color: black;">{{time}}</span>
- <image src="../../static/images/icon_right.png"
- style=" position: absolute; width: 15px;height: 15px;"></image>
- </view>
- </view>
- <view v-for="(a,index) in czggslList" :key="index">
- <view class="container">
- <view>
- 材质
- </view>
- <view class="uni-list-cell-db" @click="pickerShow('cz',index)">
- <span style="color: black;">{{a.cz.id==''?'请选择材质':a.cz.name}}</span>
- <image src="../../static/images/icon_right.png"
- style=" position: absolute; width: 15px;height: 15px;"></image>
- </view>
- </view>
- <view class="container">
- <view>
- 规格
- </view>
- <view class="uni-list-cell-db" @click="pickerShow('gg',index)">
- <span style="color: black;">{{a.gg.id==''?'请选择规格':a.gg.name}}</span>
- <image src="../../static/images/icon_right.png"
- style=" position: absolute; width: 15px;height: 15px;"></image>
- </view>
- </view>
- <view class="container">
- <text>数量</text>
- <input class="uni-input" type="number" v-model="a.sl" placeholder="请填写数量" maxlength="11"
- style="margin-left: 10px;text-align: right;"></input>
- <image src="../../static/images/icon_right.png"
- style=" position: absolute; width: 15px;height: 15px;"></image>
- </view>
- <button v-if="index!=0" @click="this.czggslList.splice(index,1)">删除</button>
- </view>
- <button
- @click="this.czggslList.push({cz:{id: '',name: ''},gg:{id: '',name: ''},sl:''})">添加</button>
- </view>
- <view class="align-items" style="margin-top: 20px;margin-bottom: 20px;">
- <view class="container" style="color: gainsboro;">*请上传照片</view>
- <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
- <image src="/static/images/chooseimg.png" mode=""
- style="width: 100rpx; height: 100rpx; margin: 0 12rpx;; " @click="choose()"></image>
- <view v-for="(item,index) in imgArr" :key="index" style="position: relative;">
- <view
- v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ">
- <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
- @click="showPhoto(index)">
- </image>
- </view>
- <view v-else>
- <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
- </view>
- <view @click="remove(index)"
- style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
- <image src="../../../static/images/icon_close.png" style=" width: 15px; height: 15px;">
- </image>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="action-btn">
- <button @click="submit" class="btn cu-btn block bg-blue lg round">确认上传</button>
- </view>
- <bottom-sheet ref="refShare" :data="historyList" :TitleType="objValue.value"></bottom-sheet>
- <yt-dateTimePicker ref="myPicker" @submit="handleSubmit" :start-year="2024" :end-year="2099"
- :time-hide="[true, true, true, true, true, true]" :time-label="['年', '月', '日', '时', '分', '秒']" />
- <!-- 下载提示页面 -->
- <mypopup :show="show_loding" :popupText="popupText" :titleText="titleText" :cancelText="cancelText"
- :confirmText="confirmText" @close="cancel_loding" @confirm="confirm_loding">
- </mypopup>
- </view>
- </template>
- <script>
- import SelectPicker from '../../components/selectPicker/select_picker.vue'
- import bottomSheet from '../../components/bottomSheet/bottomSheetMore.vue'
- import mypopup from '../../components/mypopup/mypopup.vue'
- import {
- getDicts
- } from "@/api/system/dict/data";
- import {
- getEnginMaterialQualityList,
- getEnginSpecificationsList,
- getRoomProjectList,
- getRoomProjectId,
- Submitengineering,
- getengineeringNameList,
- getEngineeringDetails,
- getEngineeringHistoryList,
- } from '@/api/common'
- import {
- getToken
- } from '../../utils/auth';
- import storage from '../../utils/storage';
- export default {
- components: {
- SelectPicker,
- bottomSheet,
- mypopup
- },
- data() {
- return {
- user: {
- nickName: "",
- phonenumber: "",
- email: "",
- sex: ""
- },
- historyList: {}, //历史数据
- show_loding: false,
- popupText: '', //对话框内容
- titleText: '',
- cancelText: '',
- confirmText: '',
- zEngineeringMaterialBo: [], //给后台传的值 用料列表
- czggslList: [{
- cz: {
- id: '',
- name: ''
- },
- gg: {
- id: '',
- name: ''
- },
- sl: ''
- }, ],
- conLists: [],
- headers: {
- Authorization: "Bearer " + getToken()
- },
- time: '', //施工时间
- loading: false,
- loadingFile: false,
- projectType: {}, //工程类型
- open: false,
- objValue: '', //上一页面传过来的值 新增接口用
- openDict: false,
- specificationValue: {}, //规格
- projectContent: '', //施工内容
- materialValue: {}, //材质
- selectList: [],
- dictOptions: [],
- imgArr: [],
- fileArr: [],
- fileNameArr: [],
- type: '',
- jlPhoneValue: '', //监理电话
- jlfzrValue: '', //监理负责人
- jldwValue: '', //监理单位
- sjPhoneValue: '', //设计电话
- sjfzrValue: '', //设计负责人
- sjdwValue: '', //设计单位
- xcfzrValue: '', //现场负责人
- xmfzrValue: '', //项目负责人
- jsdwValue: '', //建设单位
- projectName: '', //工程名称
- SelectIndex: '', //选择的索引值
- fileUrl: '', //点击的文件地址
- fileName: '', //点击的文件名称
- enginList: {}, //工程信息
- enginId: '', //工程id
- createTime: '',
- infonId: '', //info id
- createBy: '',
- }
- },
- created() {
- this.time = this.traversalTime(new Date().getTime()) //在data里定义变量-nowTime
- console.log(this.time)
- },
- onLoad(options) {
- if ('params' in options) {
- this.objValue = JSON.parse(decodeURIComponent(options.params));
- // if (this.objValue.enginType == `old_renovation`) {
- // this.title = '旧改工程-庭院'
- // } else if (this.objValue.enginType == `new_built`) {
- // this.title = '新建工程-庭院'
- // }
- // uni.setNavigationBarTitle({
- // title: this.title
- // })
- }
- },
- methods: {
- //判断是否选择
- // getUser() {
- // console.log("aaaa", this.$user.state.name)
- // getUserProfile().then(response => {
- // //this.user = response.data.user
- // console.log("dddd", response.data)
- // })
- // },
- isEmpty(str) {
- return (!str || 0 === str.length);
- },
- handleSubmit(e) {
- this.time = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
- },
- //获取当前时间
- traversalTime(timestamp) {
- //timestamp(时间戳)是整数,否则要parseInt转换
- let time = new Date(timestamp);
- let y = time.getFullYear();
- let m = time.getMonth() + 1;
- let d = time.getDate();
- let h = time.getHours();
- let mm = time.getMinutes();
- let s = time.getSeconds();
- return y + '-' + this.addTimes(m) + '-' + this.addTimes(d) + ' ' + this.addTimes(h) + ':' + this
- .addTimes(
- mm) + ':' + this.addTimes(s);
- },
- addTimes(m) {
- return m < 10 ? '0' + m : m
- },
- // 打开picker
- openDatetimePicker() {
- this.$refs.myPicker.show();
- },
- // 关闭picker
- closeDatetimePicker() {
- this.$refs.myPicker.hide();
- },
- pickerShow(e, index) {
- this.SelectIndex = index;
- this.type = e; //赋值类型
- if (e == 'cz') { //材质
- this.open = true;
- getEnginMaterialQualityList("工业工程").then(response => {
- this.selectList = response.data;
- });
- } else if (e == 'gg') { //规格
- if (this.isEmpty(this.czggslList[index].cz.id)) {
- this.$modal.msg('请选择材质')
- // this.czggslList[index].cz = this.materialValue.id
- } else {
- this.open = true;
- this.selectList = this.materialList;
- }
- } else if (e == 'gclx') { //工程类型
- this.openDict = true;
- getDicts("industry_engin_type").then(response => {
- this.dictOptions = response.data;
- });
- } else if (e == 'gcmc') { //工程名称
- if (this.isEmpty(this.projectType.dictValue)) {
- this.$modal.msg('请选择工程类型')
- return
- }
- this.open = true;
- //请求
- console.log("sss", this.objValue.value)
- getengineeringNameList(this.projectType.dictValue, "1", this.objValue.value).then(
- response => {
- this.selectList = response.data;
- });
- }
- },
- showPhoto(index) {
- uni.previewImage({
- current: index,
- urls: this.imgArr,
- })
- },
- removeFile(index) {
- uni.showModal({
- title: '提示',
- content: '是否删除该文件?',
- success: (res) => {
- if (res.confirm) {
- this.fileArr.splice(index, 1)
- this.fileNameArr.splice(index, 1)
- console.log('this.fileArr', this.fileArr)
- }
- }
- })
- },
- remove(index) {
- uni.showModal({
- title: '提示',
- content: '是否删除该图片或视频?',
- success: (res) => {
- if (res.confirm) {
- this.imgArr.splice(index, 1)
- console.log('this.imgarr', this.imgArr)
- // if (this.imgArr.length <= 0) {
- // this.photo = true;
- // }
- }
- }
- })
- },
- choose() {
- let _this = this;
- uni.showActionSheet({
- title: '上传',
- itemList: ['图片', '视频'],
- success: (res) => {
- console.log(res)
- if (res.tapIndex == 0) {
- this.chooseimage()
- } else {
- this.choosevideo()
- }
- }
- })
- },
- chooseimage() {
- let _this = this;
- console.log('图片', _this.headers)
- uni.chooseImage({
- sizeType: ['album', 'camera'],
- success(resp) {
- resp.tempFiles.forEach((item, index) => {
- const task = uni.uploadFile({
- url: _this.$HTTP + `/obs`,
- filePath: item.path,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- console.log("结果", res)
- // let data = _this.$u.test.jsonString(res
- // .data) ? JSON.parse(res.data) : res.data;
- let data = JSON.parse(res.data);
- if (![200].includes(data.code)) {
- // this.uploadError(index, data);
- _this.$modal.msg(data.msg)
- } else {
- if (_this.progress === 100) {
- console.log('_this.progress', _this
- .progress)
- //console.log('data----', data)data
- console.log('res--', res)
- _this.imgArr.push(data.data.url)
- console.log('imgArr', _this.imgArr)
- _this.$modal.msg('上传成功!')
- //_this.photo = false;
- }
- }
- },
- fail: e => {
- console.log(e)
- _this.$modal.msg('上传失败!')
- //_this.uploadError(index, e);
- },
- complete: res => {
- uni.hideLoading();
- _this.uploading = false;
- }
- });
- task.onProgressUpdate(res => {
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- console.log('task.onProgressUpdate', _this.progress)
- uni.showLoading({
- title: '上传中'
- })
- if (_this.progress != 100) {
- _this.loading = false
- console.log('_this.loading false', _this.loading)
- } else {
- _this.loading = true
- console.log('_this.loading true', _this.loading)
- }
- });
- })
- },
- })
- },
- choosevideo() {
- let _this = this;
- console.log('视频')
- uni.chooseVideo({
- sourceType: ['album', 'camera'],
- maxDuration: 30,
- success(resp) {
- const task = uni.uploadFile({
- url: _this.$HTTP + `/obs`,
- filePath: resp.tempFilePath,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = JSON.parse(res.data);
- if (![200].includes(res.statusCode)) {
- this.uploadError(index, data);
- } else {
- //上传成功
- if (_this.progress === 100) {
- console.log('_this.progress', _this.progress)
- _this.imgArr.push(data.data.url)
- console.log('imgArr', _this.imgArr)
- _this.$modal.msg('上传成功!')
- //_this.photo = false;
- }
- }
- },
- fail: e => {
- _this.$modal.msg('上传失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- uni.hideLoading();
- _this.uploading = false;
- }
- });
- task.onProgressUpdate(res => {
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '上传中'
- })
- if (_this.progress != 100) {
- _this.loadingFile = false
- console.log('_this.loading false', _this.loading)
- } else {
- _this.loadingFile = true
- console.log('_this.loading true', _this.loading)
- }
- });
- },
- })
- },
- changeSelectDict(item, index) {
- this.openDict = false;
- this.projectType = item
- this.projectName = ''; //重置工程名称
- this.jlPhoneValue = ''; //重置监理电话
- this.jlfzrValue = ''; //重置监理负责人
- this.jldwValue = ''; //重置监理单位
- this.sjPhoneValue = ''; //重置设计电话
- this.sjfzrValue = ''; //重置设计负责人
- this.sjdwValue = ''; //重置设计单位
- this.xcfzrValue = ''; //重置现场负责人
- this.xmfzrValue = ''; //重置项目负责人
- this.jsdwValue = ''; //重置建设单位
- this.enginId = ''; //重置工程id
- this.fileArr = ''
- this.createTime = '';
- this.infonId = '';
- this.createBy = '';
- },
- changeSelect(item, index) {
- // this.index = index;
- // this.address = item.communityName;
- this.open = false;
- if (this.type == 'cz') {
- this.materialValue = item;
- this.specificationValue = ''; //重置规格
- //根据材质ID 获取规格数据
- getEnginSpecificationsList(item.id).then(res => {
- this.materialList = res.data
- this.czggslList[this.SelectIndex].cz.id = this.materialValue.id
- this.czggslList[this.SelectIndex].cz.name = this.materialValue.name
- })
- } else if (this.type == 'gg') {
- this.specificationValue = item;
- this.czggslList[this.SelectIndex].gg.id = this.specificationValue.id
- this.czggslList[this.SelectIndex].gg.name = this.specificationValue.name
- } else if (this.type == 'gcmc') {
- this.projectName = item
- //根据工程id 获取工程信息
- uni.showLoading({
- title: '加载中'
- })
- getEngineeringDetails(item.id).then(response => {
- uni.hideLoading();
- console.log("res", response)
- // this.enginList = response.data
- this.createBy = response.data.createBy;
- this.jlPhoneValue = response.data.supervisionPhone; //监理电话
- this.jlfzrValue = response.data.supervisionHead; //监理负责人
- this.jldwValue = response.data.supervisionUnit; //监理单位
- this.sjPhoneValue = response.data.designPhone; //设计电话
- this.sjfzrValue = response.data.designHead; //设计负责人
- this.sjdwValue = response.data.designUnit; //设计单位
- this.xcfzrValue = response.data.sceneHead; //现场负责人
- this.xmfzrValue = response.data.projectHead; //项目负责人
- this.jsdwValue = response.data.constructUnit; //建设单位
- this.enginId = response.data.id; //工程id
- this.fileArr = response.data.pics
- this.createTime = response.data.createTime;
- this.infonId = response.data.zEngineeringNodeBoList[0].zEngineeringInfoBoList[0]
- .id
- });
- }
- },
- //关闭弹窗
- close(e) {
- this.open = false
- },
- //关闭弹窗
- closeDict(e) {
- this.openDict = false
- },
- chooseModel(url, name) {
- this.cancelText = '复制';
- this.confirmText = "下载";
- this.titleText = "温馨提示"
- this.popupText = "下载或者复制链接";
- this.show_loding = true;
- this.fileName = name;
- this.fileUrl = url; //文件名称和下载地址赋值
- },
- //取消按钮
- cancel_loding() {
- let _this = this;
- _this.show_loding = false;
- console.log("复制")
- if (!_this.isEmpty(_this.fileUrl)) {
- console.log(_this.fileUrl)
- console.log(_this.fileName)
- uni.setClipboardData({
- data: _this.fileUrl,
- success() {
- uni.showToast({
- title: '已复制' + _this.fileName + '地址成功 请在浏览器打开',
- icon: 'none'
- });
- },
- fail(e) {
- console.log("失败", e)
- uni.showToast({
- title: '复制失败',
- icon: 'none'
- });
- }
- });
- }
- },
- //确定按钮
- confirm_loding() {
- this.show_loding = false;
- console.log("下载")
- this.download(this.fileUrl, this.fileName);
- },
- getDownLoadFilePath() {
- let cachePath = `${uni.env.USER_DATA_PATH}/downloads`
- let fm = uni.getFileSystemManager()
- try {
- // 访问成功则存在
- fm.accessSync(cachePath)
- } catch (error) {
- // 不存在则新建
- fm.mkdirSync(cachePath, true)
- }
- return cachePath
- },
- download(url, name) {
- let savePath = this.getDownLoadFilePath();
- console.log('点击下载', url);
- console.log('点击下载333', savePath);
- //var savePath = uni.env.USER_DATA_PATH + '/savePath'
- uni.downloadFile({
- url: url,
- success: response => {
- if (response.statusCode === 200) {
- console.log("数据", response)
- uni.getFileSystemManager().saveFile({
- tempFilePath: response.tempFilePath,
- filePath: `${savePath}/${name}`,
- success: (resData) => {
- console.log('保存路径', resData.savedFilePath)
- console.log("dd", resData)
- uni.showToast({
- title: '下载成功'
- })
- },
- fail: error => {
- console.log('error: ', error)
- }
- })
- }
- }
- })
- },
- //历史
- history() {
- if (this.isEmpty(this.projectType.dictValue)) {
- this.$modal.msg('请选择工程类型')
- return
- }
- if (this.isEmpty(this.projectName.id)) {
- this.$modal.msg('请选择工程名称')
- return
- }
- getEngineeringHistoryList(this.enginId, this.objValue.value).then(response => {
- console.log("历史", response)
- this.historyList = response.data
- if (response.data.zEngineeringNodeBo.zEngineeringInfoBoList != null) {
- this.$refs.refShare.handleShowShare();
- } else {
- this.$modal.msg("暂无历史信息")
- }
- });
- },
- submit() {
- console.log("文件", this.fileArr)
- if (this.isEmpty(this.projectType.dictValue)) {
- this.$modal.msg('请选择工程类型')
- return
- }
- if (this.isEmpty(this.projectName.id)) {
- this.$modal.msg('请选择工程名称')
- return
- }
- try {
- //console.log("刚开始", this.czggslList);
- this.czggslList.forEach((list) => {
- if (this.isEmpty(list.cz.id)) {
- this.$modal.msg('材质不能为空')
- throw new Error('End Loop')
- }
- if (this.isEmpty(list.gg.id)) {
- this.$modal.msg('规格不能为空')
- throw new Error('End Loop')
- }
- if (this.isEmpty(list.sl)) {
- this.$modal.msg('数量不能为空')
- throw new Error('End Loop')
- }
- })
- } catch (e) {
- if (e.message === 'End Loop') throw e
- }
- if (this.imgArr.length <= 0) {
- this.$modal.msg('请上传照片或视频')
- return
- }
- if (this.loading == false) {
- this.$modal.msg('照片或视频未上传完毕,无法提交!')
- return
- }
- this.zEngineeringMaterialBo = [];
- this.czggslList.forEach((list) => {
- this.zEngineeringMaterialBo.push({
- materialQuality: list.cz.id,
- specifications: list.gg.id,
- number: list.sl
- })
- }),
- console.log("数据", this.zEngineeringMaterialBo)
- let param = {
- //files: this.fileArr, //文件
- id: this.enginId, //工程id
- type: '1', // 用来区分工业工程=1、市政工程=2
- enginName: this.projectName.name, //工程名称
- enginType: this.projectType.dictValue, // 工程类型
- constructUnit: this.jsdwValue, // 建筑单位
- projectHead: this.xmfzrValue, // 项目负责人
- sceneHead: this.xcfzrValue, // 现场负责人
- designUnit: this.sjdwValue, // 设计单位
- designHead: this.sjfzrValue, // 设计负责人
- designPhone: this.sjPhoneValue, // 设计联系电话
- supervisionUnit: this.jldwValue, // 监理单位
- supervisionHead: this.jlfzrValue, // 监理负责人
- supervisionPhone: this.jlPhoneValue, // 监理联系电话
- enginClassification: this.objValue.value, // 工程分类 上一页面传过来的
- zEngineeringNodeBo: {
- createTime: this.createTime,
- type: '工业工程', // 写死
- zEngineeringInfoBo: {
- engInfoId: this.infonId,
- constructTime: this.time, //施工时间
- zEngiineeringPhotoBoList: this.imgArr, //照片集合
- zEngineeringMaterialBo: this.zEngineeringMaterialBo // 用料对象
- }
- }
- }
- Submitengineering(param).then(res => {
- if (res.code == '200') {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- //显示持续时间为 3秒
- duration: 2000
- });
- setTimeout(function() {
- uni.navigateBack();
- }, 1000)
- }
- })
- }
- }
- }
- </script>
- <style>
- .container {
- display: flex;
- margin-left: 10px;
- margin-top: 10px;
- margin-right: 10px;
- align-items: flex-start;
- justify-content: space-between;
- }
- .text {
- font-size: 16px;
- color: #333;
- }
- .background {
- border: 15px solid hsla(0, 0%, 100%, .5);
- background: white;
- background-clip: padding-box;
- padding-left: 5px;
- padding-right: 10px;
- /*从padding开始往外面裁剪背景*/
- }
- .btn {
- margin-top: 40px;
- margin-right: 20px;
- margin-bottom: 120px;
- margin-left: 20px;
- height: 45px;
- }
- .number {
- display: flex;
- /* 水平居中显示子元素 */
- align-items: flex-start;
- /* 垂直居中显示子元素 */
- justify-content: space-between;
- /* 左右间距等于间距大小 */
- padding: 10px;
- /* 设置padding以提高视觉效果 */
- }
- .textarea {
- margin-top: 10upx;
- width: 100%;
- border: 1rpx solid red;
- min-height: 100upx;
- line-height: 20px;
- }
- </style>
|