接口对接修改
This commit is contained in:
@@ -7,7 +7,9 @@
|
||||
>{{ engineering.name }}
|
||||
<!-- <view class="header-title-extra">用能</view> -->
|
||||
</view>
|
||||
<view class="header-des-mini mb10">{{ engineering.provinceName + engineering.cityName }} {{ engineering.createTime }}</view>
|
||||
<view class="header-des-mini mb10"
|
||||
>{{ engineering.provinceName + engineering.cityName }} {{ engineering.createTime }}</view
|
||||
>
|
||||
<view class="header-des">{{ engineering.description }} </view>
|
||||
</view>
|
||||
<view class="nav">
|
||||
@@ -41,10 +43,19 @@
|
||||
</view>
|
||||
</uni-card>
|
||||
<Cn-empty v-if="store.empty"></Cn-empty>
|
||||
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
|
||||
<uni-load-more
|
||||
v-if="store.data && store.data.length > 0"
|
||||
:status="store.status"
|
||||
></uni-load-more>
|
||||
</view>
|
||||
<view style="padding: 0 20rpx" v-show="navMenuActive == 2">
|
||||
<image class="gplot gplot-box" mode="aspectFill" src="/static/test2.pic.png" v-for="(item, key) in 3" :key="key" />
|
||||
<image
|
||||
class="gplot gplot-box"
|
||||
mode="aspectFill"
|
||||
src="/static/test2.pic.png"
|
||||
v-for="(item, key) in 3"
|
||||
:key="key"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<uni-fab
|
||||
@@ -75,11 +86,16 @@ export default {
|
||||
{
|
||||
text: '项目',
|
||||
},
|
||||
// {
|
||||
// text: '拓扑图',
|
||||
// },
|
||||
],
|
||||
content: [
|
||||
{
|
||||
text: '拓扑图',
|
||||
iconPath: '/static/share.png',
|
||||
text: '编辑',
|
||||
},
|
||||
],
|
||||
content: [],
|
||||
navHeight: 0,
|
||||
navMenuActive: 0,
|
||||
}
|
||||
@@ -93,6 +109,10 @@ export default {
|
||||
})
|
||||
} else if (e.item.text == '分享') {
|
||||
this.$refs.share.open()
|
||||
} else if (e.item.text == '编辑') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/engineering/new?engineering=' + encodeURIComponent(JSON.stringify(this.engineering)),
|
||||
})
|
||||
}
|
||||
},
|
||||
navMenuClick(index) {
|
||||
@@ -124,7 +144,7 @@ export default {
|
||||
},
|
||||
jumpProject(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/project/detail?project=' + JSON.stringify(item),
|
||||
url: '/pages/project/detail?project=' + encodeURIComponent(JSON.stringify(item)),
|
||||
})
|
||||
},
|
||||
init() {
|
||||
@@ -134,7 +154,7 @@ export default {
|
||||
},
|
||||
},
|
||||
onLoad(option) {
|
||||
this.engineering = JSON.parse(option.engineering)
|
||||
this.engineering = JSON.parse(decodeURIComponent(option.engineering))
|
||||
let userInfo = uni.getStorageSync('userInfo')
|
||||
if (userInfo.authorities == '3') {
|
||||
this.content.push({
|
||||
|
||||
@@ -57,6 +57,12 @@ export default {
|
||||
let engineering = uni.getStorageSync('engineering')
|
||||
if (!engineering) {
|
||||
uni.setStorageSync('engineering',this.store.data[0])
|
||||
}else{
|
||||
this.store.data.forEach((item) => {
|
||||
if (item.id == engineering.id) {
|
||||
uni.setStorageSync('engineering',item)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -77,7 +83,7 @@ export default {
|
||||
},
|
||||
jump(engineering) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/engineering/detail?engineering=${JSON.stringify(engineering)}`,
|
||||
url: `/pages/engineering/detail?engineering=${encodeURIComponent(JSON.stringify(engineering))}`,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -14,10 +14,16 @@
|
||||
<uni-icons type="location" color="#007aff" size="26" class="ml20"
|
||||
@click="chooseLocation"></uni-icons>
|
||||
</view> -->
|
||||
<uni-data-picker :localdata="localdata" @change="areaChange"> </uni-data-picker>
|
||||
<uni-data-picker :localdata="localdata" @change="areaChange" v-model="value">
|
||||
</uni-data-picker>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="描述">
|
||||
<uni-easyinput type="textarea" autoHeight v-model="formData.description" placeholder="请输入工程描述" />
|
||||
<uni-easyinput
|
||||
type="textarea"
|
||||
autoHeight
|
||||
v-model="formData.description"
|
||||
placeholder="请输入工程描述"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
@@ -29,22 +35,36 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import { addEngineering } from '../../common/api/engineering'
|
||||
import { addEngineering, auditEngineering } from '../../common/api/engineering'
|
||||
import area from '../../common/js/area.json'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
localdata: area,
|
||||
loading: false,
|
||||
value: '',
|
||||
formData: {
|
||||
city: '',
|
||||
description: '',
|
||||
name: '',
|
||||
province: '',
|
||||
},
|
||||
engineering: {},
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
onLoad(options) {
|
||||
if (options.engineering) {
|
||||
this.engineering = JSON.parse(decodeURIComponent(options.engineering))
|
||||
console.log(this.engineering)
|
||||
for (let key in this.formData) {
|
||||
if (this.engineering[key]) {
|
||||
this.formData[key] = this.engineering[key]
|
||||
}
|
||||
}
|
||||
this.value = this.engineering.city
|
||||
this.formData.id = this.engineering.id
|
||||
uni.setNavigationBarTitle({ title: '工程编辑' })
|
||||
}
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
@@ -54,13 +74,17 @@ export default {
|
||||
},
|
||||
})
|
||||
// console.log(area);
|
||||
console.log( this.$util.prePage());
|
||||
console.log(this.$util.prePage())
|
||||
},
|
||||
methods: {
|
||||
areaChange(e) {
|
||||
console.log(e)
|
||||
this.formData.province = e.detail.value[0].value
|
||||
this.formData.city = e.detail.value[1].value
|
||||
if (e.detail.value.length) {
|
||||
this.formData.province = e.detail.value[0].value
|
||||
this.formData.city = e.detail.value[1].value
|
||||
} else {
|
||||
this.formData.province = ''
|
||||
this.formData.city = ''
|
||||
}
|
||||
},
|
||||
select(e) {
|
||||
console.log(e)
|
||||
@@ -91,14 +115,20 @@ export default {
|
||||
this.$util.toast('请输入工程描述')
|
||||
return
|
||||
}
|
||||
addEngineering(this.formData).then((res) => {
|
||||
console.log(res)
|
||||
this.$util.toast('工程创建成功')
|
||||
this.$util.prePage().store?.reload()
|
||||
if (this.formData.id) {
|
||||
await auditEngineering(this.formData)
|
||||
this.$util.toast('工程修改成功')
|
||||
let pages = getCurrentPages()
|
||||
let prePage = pages[pages.length -3]
|
||||
prePage.store.reload()
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
uni.navigateBack({ delta: 2 })
|
||||
}, 1500)
|
||||
})
|
||||
} else {
|
||||
await addEngineering(this.formData)
|
||||
this.$util.prePage().store?.reload()
|
||||
this.$util.toast('工程创建成功')
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user