新建工成

This commit is contained in:
仲么了
2023-04-12 18:39:52 +08:00
parent d6b2c98d1f
commit ff2fd537ec
11 changed files with 1105 additions and 1071 deletions

View File

@@ -8,12 +8,12 @@
v-for="(item, index) in store.data" :key="index">
<view class="term-list-bottom">
<view class="term-list-bottom-item">
<view>设备个数</view>
<view>3</view>
<view>区域</view>
<view>{{ item.province +item.city}}</view>
</view>
<view class="term-list-bottom-item">
<view>用户个数</view>
<view>1</view>
<view>创建时间</view>
<view>{{ item.createTime}}</view>
</view>
</view>
</uni-card>
@@ -35,7 +35,7 @@ export default {
},
methods: {
init () {
this.store = this.DataSource('/engineering/queryEngineering')
this.store = this.DataSource('/engineering/queryEngineeringPage')
this.store.params.userId = uni.getStorageSync('userInfo').id
this.store.reload()
},

View File

@@ -5,15 +5,16 @@
<view class="content">
<uni-forms :label-width="80">
<uni-forms-item label="工程名称">
<uni-easyinput type="number" v-model="formData.name" placeholder="请输入工程名称" />
<uni-easyinput type="text" v-model="formData.name" placeholder="请输入工程名称" />
</uni-forms-item>
<uni-forms-item label="位置">
<view style="display:flex;">
<!-- <view style="display:flex;">
<uni-easyinput :clearable="false" type="textarea" autoHeight v-model="formData.area"
placeholder="请输入位置信息" />
<uni-icons type="location" color="#007aff" size="26" class="ml20"
@click="chooseLocation"></uni-icons>
</view>
</view> -->
<uni-data-picker :localdata="localdata" @change="areaChange"> </uni-data-picker>
</uni-forms-item>
<uni-forms-item label="描述">
<uni-easyinput type="textarea" autoHeight v-model="formData.description"
@@ -29,35 +30,22 @@
</Cn-page>
</template>
<script>
import { addAppProject } from '../../common/api/project'
// import area from '../../common/js/area.json'
import { addEngineering } from '../../common/api/gc'
import area from '../../common/js/area.json'
export default {
data () {
data() {
return {
localdata: area,
loading: false,
formData: {
area: "",
files: [],
description: '',
projectType: '1',
name: '',
userId: '123456',
lat: '2',
lng: '3'
city: "",
description: "",
name: "",
province: "",
},
TypeRange: [
{
text: '监测',
value: '1'
},
{
text: '用能',
value: '2'
}
]
}
},
onLoad () {
onLoad() {
uni.getLocation({
type: 'wgs84',
success: function (res) {
@@ -69,10 +57,15 @@ export default {
// console.log(area);
},
methods: {
select (e) {
areaChange(e) {
console.log(e);
this.formData.province = e.detail.value[0].value
this.formData.city = e.detail.value[1].value
},
select(e) {
console.log(e);
},
chooseLocation () {
chooseLocation() {
uni.chooseLocation({
success: function (res) {
@@ -84,43 +77,26 @@ export default {
}
});
},
async submit () {
async submit() {
if (!this.formData.name) {
this.$util.toast('请输入工程名称')
return
}
if (!this.formData.projectType) {
this.$util.toast('请选择工程类别')
return
}
if (!this.formData.area) {
this.$util.toast('请输入区域信息')
if (!this.formData.province) {
this.$util.toast('请选择区域信息')
return
}
if (!this.formData.description) {
this.$util.toast('请输入工程描述')
return
}
if (!this.formData.files.length) {
this.$util.toast('请上传拓扑图')
return
}
let arr = []
for (let i = 0; i < this.formData.files.length; i++) {
let item = this.formData.files[i]
arr.push({
name: 'files',
url: item.url
})
}
let data = JSON.parse(JSON.stringify(this.formData))
delete data.files
addAppProject(data, arr).then(res => {
addEngineering(this.formData).then(res => {
console.log(res)
this.$util.toast('工程创建成功')
// setTimeout(() => {
// uni.navigateBack({ delta: 1 })
// }, 1500);
setTimeout(() => {
uni.navigateBack({ delta: 1 })
}, 1500);
})
}
}

View File

@@ -47,6 +47,7 @@
</template>
<script>
import { pinyin } from 'pinyin-pro';
import { queryEngineering } from '@/common/api/gc.js'
export default {
data() {
@@ -133,47 +134,7 @@ export default {
}
],
gcList: [
'南京灿能',
'南京灿能',
'南京灿能',
'南京灿能',
'南京灿能',
'北京灿能',
'北京灿能',
'北京灿能',
'北京灿能',
'北京灿能',
'上海灿能',
'上海灿能',
'上海灿能',
'上海灿能',
'上海灿能',
'上海灿能',
'广州灿能',
'广州灿能',
'广州灿能',
'广州灿能',
'广州灿能',
'深圳灿能',
'深圳灿能',
'深圳灿能',
'深圳灿能',
'深圳灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
]
}
},
@@ -202,17 +163,17 @@ export default {
let result = []
this.gcList.forEach(item => {
let arr = pinyin(item[0], { toneType: 'none', type: 'array' })
let arr = pinyin(item.name[0], { toneType: 'none', type: 'array' })
let letter = arr[0][0].toUpperCase()
console.log(letter);
let index = result.findIndex(item => item.letter === letter)
if (index === -1) {
result.push({
letter,
data: [item]
data: [item.name]
})
} else {
result[index].data.push(item)
result[index].data.push(item.name)
}
})
return result
@@ -234,7 +195,9 @@ export default {
showDrawer() {
this.$refs.showRight.open();
},
closeDrawer() {
closeDrawer(e) {
console.log(e);
this.$refs.showRight.close();
},
submitFeedBack() { uni.navigateTo({ url: '/pages/home/feedback' }) },
@@ -304,10 +267,16 @@ export default {
})
}
},
init(){
queryEngineering().then(res => {
this.gcList = res.data
})
}
},
mounted() {
this.userInfo = uni.getStorageSync('userInfo')
setTimeout(() => {
this.init()
// 获取nav高度
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
this.navHeight = rect.height

View File

@@ -33,7 +33,7 @@
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
</view>
<view class="mine-nav" @click="jump('gc')"
v-if="userInfo.role == 4 || userInfo.role == 3 || userInfo.role == 2">
v-if="userInfo.role == 4 || userInfo.role == 3 ">
<image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" />
<view class="mine-nav-label">工程管理</view>
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>