123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733 |
- <template>
- <view>
- <view class="background">
- <view class="uni-list">
- <view class="container">
- <view>
- 工程周期
- </view>
- <view v-if="this.isEmpty(this.projectValue.dictValue)" style="margin-top: 10;"
- @click="pickerShow('gczq')">
- <span style="color: darkgray;">请选择工程周期</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gczq')">
- <span style="color: black;">{{projectValue.dictLabel}}</span>
- </view>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <view>
- 行政区
- </view>
- <view v-if="this.isEmpty(this.XZQValue.dictValue)" style="margin-top: 10;"
- @click="pickerShow('xzq')">
- <span style="color: darkgray;">请选择行政区</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('xzq')">
- <span style="color: black;">{{XZQValue.dictLabel}}</span>
- </view>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <view>
- 小区
- </view>
- <view v-if="this.isEmpty(this.XQValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
- @click="pickerShow('xq')">
- <span style="color: darkgray;">请选择小区</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('xq')">
- <span style="color: black;">{{XQValue.name}}</span>
- </view>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <view class="uni-list-cell-left">
- 楼栋
- </view>
- <view v-if="this.isEmpty(this.LDValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
- @click="pickerShow('ld')">
- <span style="color: darkgray;">请选择楼栋</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('ld')">
- <span style="color: black;">{{LDValue.name}}</span>
- </view>
- </view>
- </view>
- <view class="uni-list" style="margin-top: 10;">
- <view class="container">
- <view class="uni-list-cell-left">
- 单元
- </view>
- <view v-if="this.isEmpty(this.DYValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
- @click="pickerShow('dy')">
- <span style="color: darkgray;">请选择单元</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('dy')">
- <span style="color: black;">{{DYValue.name}}</span>
- </view>
- </view>
- </view>
- <view class="uni-list">
- <view class="container">
- <view class="uni-list-cell-left">
- 房间
- </view>
- <view v-if="this.isEmpty(this.FJValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
- @click="pickerShow('fj')">
- <span style="color: darkgray;">请选择房间</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('fj')">
- <span style="color: black;">{{FJValue.name}}</span>
- </view>
- </view>
- </view>
- <view class="container">
- <view class="title">是否按照施工图纸施工</view>
- <span style="color: black;">{{this.form}}</span>
- <switch style="transform: scale(0.6,0.6);" @change="switchChange" checked="isChick" />
- </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 v-if="objValue.enginClassValue=='dismantling_old_pipe'">
- <view class="uni-list">
- <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
- 拆旧管
- <span
- style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;">历史</span>
- </view>
- <view class="container" style="margin-bottom: 20PX;">
- <view>
- 腐蚀等级
- </view>
- <view v-if="this.isEmpty(this.LevelValue.dictValue)" style="margin-top: 10;"
- @click="pickerShow('fsdj')">
- <span style="color: darkgray;">请选择腐蚀等级</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('fsdj')">
- <span style="color: black;">{{LevelValue.dictLabel}}</span>
- </view>
- </view>
- </view>
- </view>
- <view v-if="objValue.enginClassValue=='vertical_bar'">
- <view class="uni-list" style="margin-bottom: 20px;">
- <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
- 立杠
- <span
- style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;">历史</span>
- </view>
- <view class="container">
- <view>
- 材 质
- </view>
- <view v-if="this.isEmpty(this.materialValue.id)" style="margin-top: 10;"
- @click="pickerShow('cz')">
- <span style="color: darkgray;">请选择材质</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('cz')">
- <span style="color: black;">{{materialValue.name}}</span>
- </view>
- </view>
- <view class="container">
- <view>
- 规 格
- </view>
- <view v-if="this.isEmpty(this.specificationValue.id)" style="margin-top: 10;"
- @click="pickerShow('gg')">
- <span style="color: darkgray;">请选择规格</span>
- </view>
- <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gg')">
- <span style="color: black;">{{specificationValue.name}}</span>
- </view>
- </view>
- <view class="container">
- <text>数 量</text>
- <input class="uni-input" type="number" v-model="number" placeholder="请填写数量"
- style="margin-left: 10px;text-align: right;"></input>
- </view>
- </view>
- </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%;">
- <uni-icons type="close" color="darkgray" size="18"></uni-icons>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="action-btn">
- <button @click="submit" class="btn cu-btn block bg-blue lg round">确认上传</button>
- </view>
- </view>
- </template>
- <script>
- import SelectPicker from '../../../components/selectPicker/select_picker.vue'
- import uniIcons from '../../../uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
- import {
- getDicts
- } from "@/api/system/dict/data";
- import {
- getAreaList,
- getBuildingList,
- getUnitList,
- getHousesList,
- addTearOldPipe,
- getEnginMaterialQualityList,
- getEnginSpecificationsList,
- } from '@/api/common'
- import {
- getToken
- } from '../../../utils/auth';
- export default {
- components: {
- SelectPicker,
- uniIcons
- },
- data() {
- return {
- headers: {
- Authorization: "Bearer " + getToken()
- },
- type: '',
- open: false,
- objValue: '', //上一页面传过来的值 新增接口用
- openDict: false,
- selectList: [],
- dictOptions: [],
- imgArr: [],
- XQValue: {},
- XZQValue: {},
- projectValue: {},
- LevelValue: {},
- LDValue: {},
- DYValue: {},
- FJValue: {},
- FSValue: {},
- specificationValue: {}, //规格
- materialValue: {}, //材质
- materialList: '', //材质list
- XQList: '',
- LDList: '',
- DYList: '',
- FJList: '',
- progress: 0, //上传图片进度百分比
- loading: false,
- isCheck: true, //是否按照施工图纸施工
- number: '',
- title: '',
- }
- },
- created() {
- },
- onLoad(options) {
- if ('params' in options) {
- this.objValue = JSON.parse(decodeURIComponent(options.params));
- if (this.objValue.enginType == `old_renovation` && this.objValue.enginClassification == 'indoor_engin') {
- this.title = '旧改工程-室内'
- } else {
- this.title = '新建工程-室内'
- }
- uni.setNavigationBarTitle({
- title: this.title
- })
- }
- },
- methods: {
- //判断是否选择
- isEmpty(str) {
- return (!str || 0 === str.length);
- },
- showPhoto(index) {
- uni.previewImage({
- current: index,
- urls: this.imgArr,
- })
- },
- 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.$UTILS.showPrompt('上传成功!')
- _this.photo = false;
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('上传失败!')
- 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.loading = false
- console.log('_this.loading false', _this.loading)
- } else {
- _this.loading = true
- console.log('_this.loading true', _this.loading)
- }
- });
- },
- })
- },
- pickerShow(e) {
- this.type = e; //赋值类型
- if (e == 'cz') { //材质
- this.open = true;
- getEnginMaterialQualityList("0").then(response => {
- console.log(response.data)
- this.selectList = response.data;
- });
- } else if (e == 'gg') { //规格
- if (this.isEmpty(this.materialValue.id)) {
- this.$modal.msg('请选择材质')
- } else {
- this.open = true;
- this.selectList = this.materialList;
- }
- } else if (e == 'fsdj') {
- //腐蚀等级
- this.openDict = true;
- //腐蚀等级
- getDicts("corrosion_level").then(response => {
- console.log(response)
- this.dictOptions = response.data;
- });
- } else if (e == 'gczq') { //工程周期
- this.openDict = true;
- getDicts("engin_cycle").then(response => {
- this.dictOptions = response.data;
- });
- } else if (e == 'xzq') { //行政区
- if (this.isEmpty(this.projectValue.dictValue)) {
- this.$modal.msg('请选择工程周期')
- } else {
- this.openDict = true;
- getDicts("district").then(response => {
- this.dictOptions = response.data;
- });
- }
- //this.selectList = this.dictOptions;
- } else if (e == 'xq') { //小区
- if (this.isEmpty(this.XZQValue.dictValue)) {
- this.$modal.msg('请选择行政区')
- } else {
- this.open = true;
- this.selectList = this.XQList;
- }
- } else if (e == 'ld') { //楼栋
- if (this.isEmpty(this.XQValue.id)) {
- this.$modal.msg('请选择小区')
- } else {
- this.open = true;
- this.selectList = this.LDList;
- }
- } else if (e == 'dy') { //单元
- if (this.isEmpty(this.LDValue.id)) {
- this.$modal.msg('请选择楼栋')
- } else {
- this.open = true;
- this.selectList = this.DYList;
- }
- } else if (e == 'fj') { //房间
- if (this.isEmpty(this.DYValue.id)) {
- this.$modal.msg('请选择单元')
- } else {
- this.open = true;
- this.selectList = this.FJList;
- }
- }
- },
- switchChange(e) {
- console.log('switch2 发生 change 事件,携带值为', e.detail.value)
- this.isCheck = e.detail.value;
- },
- changeSelectDict(item, index) {
- this.openDict = false;
- if (this.type == 'gczq') {
- this.projectValue = item
- } else if (this.type == 'xzq') {
- this.XZQValue = item;
- //根据行政区id获取小区数据
- this.XQValue = ''; //重置小区数据
- this.LDValue = ''; //重置楼栋数据
- this.DYValue = ''; //重置单元数据
- this.FJValue = ''; //重置房间数据
- getAreaList(item.dictValue).then(res => {
- this.XQList = res.data;
- })
- } else {
- this.LevelValue = item;
- }
- },
- changeSelect(item, index) {
- // this.index = index;
- // this.address = item.communityName;
- this.open = false;
- if (this.type == 'cz') {
- this.materialValue = item;
- this.specificationValue = ''; //重置规格
- //根据材质ID 获取规格数据
- console.log('材质id', item.id)
- getEnginSpecificationsList(item.id).then(res => {
- console.log("规格数据", res.data)
- this.materialList = res.data
- })
- } else if (this.type == 'gg') {
- this.specificationValue = item;
- } else if (this.type == 'xq') {
- this.XQValue = item;
- //根据小区id 获取楼栋数据
- this.LDValue = ''; //重置楼栋数据
- this.DYValue = ''; //重置单元数据
- this.FJValue = ''; //重置房间数据
- getBuildingList(item.id).then(res => {
- this.LDList = res.data
- // console.log("楼栋=", res)
- })
- } else if (this.type == 'ld') {
- this.LDValue = item;
- //根据楼栋ID 获取单元数据
- this.DYValue = ''; //重置单元数据
- this.FJValue = ''; //重置房间数据
- getUnitList(item.id).then(res => {
- this.DYList = res.data
- // console.log("单元=", res)
- })
- } else if (this.type == 'dy') {
- this.DYValue = item;
- //根据单元数据 获取房间数据
- this.FJValue = ''; //重置房间数据
- getHousesList(item.id).then(res => {
- this.FJList = res.data
- // console.log("房间=", res)
- })
- } else if (this.type == 'fj') {
- this.FJValue = item;
- }
- },
- //关闭弹窗
- close(e) {
- this.open = false
- },
- //关闭弹窗
- closeDict(e) {
- this.openDict = false
- },
- //提交数据
- submit() {
- if (this.isEmpty(this.projectValue.dictValue)) {
- this.$modal.msg("请选择工程周期")
- } else if (this.isEmpty(this.XZQValue.dictValue)) {
- this.$modal.msg("请选择行政区")
- } else if (this.isEmpty(this.XQValue.id)) {
- this.$modal.msg("请选择小区")
- } else if (this.isEmpty(this.LDValue.id)) {
- this.$modal.msg("请选择楼栋")
- } else if (this.isEmpty(this.DYValue.id)) {
- this.$modal.msg("请选择单元")
- } else if (this.isEmpty(this.FJValue.id)) {
- this.$modal.msg("请选择房间")
- } else if (this.isEmpty(this.LevelValue.dictValue)) {
- this.$modal.msg("请选择腐蚀等级")
- } else if (this.imgArr.length <= 0) {
- this.$modal.msg('请上传照片')
- } else if (this.loading == false) {
- this.$modal.msg('照片未上传完毕,无法提交!')
- } else {
- //提交
- let param = {
- district: this.XZQValue.dictValue,
- areaId: this.XQValue.id,
- buildingId: this.LDValue.id,
- unitId: this.DYValue.id,
- houseId: this.FJValue.id,
- enginType: this.objValue.enginType, //写死 上一页面传过来的
- enginClassification: this.objValue.enginClassification, //写死 上一页面传过来的 //室内 - 庭院 - 架空
- enginCycle: this.projectValue.dictValue, //工程周期
- zEngineeringNodeBo: {
- type: this.objValue.enginClassValue, //写死 上一页面传过来的 (拆旧管等 字典值)
- zEngineeringInfoBo: {
- constructAccordingDrawings: this.isCheck, //是否按图纸施工
- zEngiineeringPhotoBoList: this.imgArr, //照片集合
- zEngineeringMaterialBo: [{
- corrosionLevel: this.LevelValue.dictValue
- }]
- }
- }
- }
- addTearOldPipe(param).then(res => {
- if (res.code == '200') {
- uni.navigateBack();
- uni.showToast({
- title: res.msg,
- icon: 'none',
- //显示持续时间为 1秒
- duration: 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开始往外面裁剪背景*/
- }
- .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以提高视觉效果 */
- }
- </style>
|