页面接口推介
This commit is contained in:
@@ -99,7 +99,12 @@
|
||||
</template>
|
||||
<script>
|
||||
import list from '../../common/js/list'
|
||||
import { queryTopologyDiagramPage, deleteAppTopologyDiagram, addAppTopologyDiagram } from '../../common/api/project'
|
||||
import {
|
||||
queryTopologyDiagramPage,
|
||||
deleteAppTopologyDiagram,
|
||||
addAppTopologyDiagram,
|
||||
deleteProject,
|
||||
} from '../../common/api/project'
|
||||
export default {
|
||||
mixins: [list],
|
||||
data() {
|
||||
@@ -178,6 +183,21 @@ export default {
|
||||
uni.navigateTo({
|
||||
url: '/pages/project/new?project=' + encodeURIComponent(JSON.stringify(this.project)),
|
||||
})
|
||||
} else if (e.item.text == '删除') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '删除项目后不可恢复,是否继续?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
deleteProject(this.project.id).then((res) => {
|
||||
this.$util.toast('删除成功')
|
||||
this.$util.refreshPrePage()
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
navMenuClick(index) {
|
||||
@@ -233,16 +253,20 @@ export default {
|
||||
iconPath: '/static/share.png',
|
||||
text: '编辑',
|
||||
})
|
||||
this.content.push({
|
||||
iconPath: '/static/delate.png',
|
||||
text: '删除',
|
||||
})
|
||||
this.content.push({
|
||||
iconPath: '/static/transfer.png',
|
||||
text: '移交',
|
||||
})
|
||||
this.content.push({
|
||||
iconPath: '/static/share.png',
|
||||
text: '分享',
|
||||
})
|
||||
if (userInfo.authorities == '3') {
|
||||
this.content.push({
|
||||
iconPath: '/static/transfer.png',
|
||||
text: '移交',
|
||||
})
|
||||
} else if (userInfo.authorities == '4') {
|
||||
this.content.push({
|
||||
iconPath: '/static/share.png',
|
||||
text: '分享',
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
|
||||
@@ -88,7 +88,9 @@
|
||||
<view
|
||||
class="temp-list-item"
|
||||
:class="{
|
||||
'temp-list-item-active': formData.tempFiles.some((item2) => item2.id === item.id),
|
||||
'temp-list-item-active': formData.tempFiles.some(
|
||||
(item2) => item2.id === item.id || item2.topoId === item.id,
|
||||
),
|
||||
}"
|
||||
v-for="(item, index) in tempList"
|
||||
@click="chooseTempItem(item)"
|
||||
@@ -104,7 +106,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
import { addAppProject } from '../../common/api/project'
|
||||
import { addAppProject, updateAppProject } from '../../common/api/project'
|
||||
import { getTopoTemplate } from '../../common/api/device'
|
||||
import { queryEngineering } from '@/common/api/engineering.js'
|
||||
export default {
|
||||
@@ -125,7 +127,7 @@ export default {
|
||||
},
|
||||
engineeringList: [],
|
||||
tempList: [],
|
||||
project: '',
|
||||
project: null,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -150,6 +152,9 @@ export default {
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.project) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '编辑项目',
|
||||
})
|
||||
this.project = JSON.parse(decodeURIComponent(options.project))
|
||||
console.log(this.project)
|
||||
for (let key in this.formData) {
|
||||
@@ -172,6 +177,20 @@ export default {
|
||||
getTopoTemplate().then((res) => {
|
||||
console.log(res)
|
||||
this.tempList = res.data
|
||||
if (this.project) {
|
||||
this.project.topologyDiagramPaths.forEach((item) => {
|
||||
if (this.tempList.some((item2) => item2.id === item.topoId)) {
|
||||
this.formData.tempFiles.push(item)
|
||||
} else {
|
||||
this.formData.files.push({
|
||||
url: item.filePath,
|
||||
extname: item.name.split('.')[1],
|
||||
name: item.name,
|
||||
...item,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
@@ -179,8 +198,10 @@ export default {
|
||||
this.formData.tempFiles.splice(index, 1)
|
||||
},
|
||||
chooseTempItem(item) {
|
||||
if (this.formData.tempFiles.some((item2) => item2.id === item.id)) {
|
||||
this.formData.tempFiles = this.formData.tempFiles.filter((item2) => item2.id !== item.id)
|
||||
if (this.formData.tempFiles.some((item2) => item2.id === item.id || item2.topoId === item.id)) {
|
||||
this.formData.tempFiles = this.formData.tempFiles.filter(
|
||||
(item2) => item2.id !== item.id && item2.topoId !== item.id,
|
||||
)
|
||||
} else {
|
||||
this.formData.tempFiles.push(item)
|
||||
}
|
||||
@@ -243,27 +264,33 @@ export default {
|
||||
uri: item.url,
|
||||
})
|
||||
}
|
||||
this.formData.topoIds = this.formData.tempFiles.map((item) => item.id)
|
||||
this.formData.topoIds = this.formData.tempFiles.map((item) => (item.topoId ? item.topoId : item.id))
|
||||
let data = JSON.parse(JSON.stringify(this.formData))
|
||||
delete data.files
|
||||
addAppProject(data, arr).then((res) => {
|
||||
console.warn(res)
|
||||
if (res.length === 1) {
|
||||
this.$util.toast(res[0].message)
|
||||
return
|
||||
}
|
||||
console.log(res)
|
||||
let result = JSON.parse(res[1].data)
|
||||
if (result.code === 'A0000') {
|
||||
this.$util.toast('项目创建成功')
|
||||
this.$util.prePage().store?.reload()
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}, 1500)
|
||||
let res = {}
|
||||
if (this.project) {
|
||||
data.id = this.project.id
|
||||
res = await updateAppProject(data, arr)
|
||||
} else {
|
||||
res = await addAppProject(data, arr)
|
||||
}
|
||||
console.log(res)
|
||||
if (res.length === 1) {
|
||||
this.$util.toast(res[0].message)
|
||||
return
|
||||
}
|
||||
let result = JSON.parse(res[1].data)
|
||||
if (result.code === 'A0000') {
|
||||
if (this.project) {
|
||||
this.$util.toast('项目修改成功')
|
||||
this.$util.refreshPrePage(2)
|
||||
} else {
|
||||
this.$util.toast(result.message)
|
||||
this.$util.toast('项目创建成功')
|
||||
this.$util.refreshPrePage()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$util.toast(result.message)
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<template>
|
||||
<Cn-page :loading='loading'>
|
||||
<view slot='body'>
|
||||
<view class='transfer'>
|
||||
<image class="transfer-img" src="/static/transfer.png" mode="scaleToFill" />
|
||||
<Cn-page :loading="loading">
|
||||
<view slot="body">
|
||||
<view class="transfer">
|
||||
<!-- <div class="transfer-img" ref="qrCodeUrl" /> -->
|
||||
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }"></uqrcode>
|
||||
<canvas id="qrcode" width="200" height="200"></canvas>
|
||||
<view class="transfer-text">请让接收人员扫码接收</view>
|
||||
<view class="transfer-btn">
|
||||
<button class="transfer-btn-item" style="background-color:#fff;color:#111" @click="back">返回</button>
|
||||
<button class="transfer-btn-item" style="background-color: #fff; color: #111" @click="back">
|
||||
返回
|
||||
</button>
|
||||
<button class="transfer-btn-item ml20" @click="home">转移成功</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -13,27 +17,33 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
// import QRCode from 'qrcodejs2'
|
||||
// import UQRCode from '@/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
|
||||
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false
|
||||
loading: false,
|
||||
content: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
back () {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
back() {
|
||||
this.$util.refreshPrePage(2)
|
||||
},
|
||||
home () {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
home() {
|
||||
this.$util.refreshPrePage(2)
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
this.content = JSON.stringify({
|
||||
type: 'transferProject',
|
||||
id: options.id,
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
<style lang="scss">
|
||||
.transfer {
|
||||
padding: 200rpx 34rpx 0;
|
||||
display: flex;
|
||||
@@ -41,9 +51,6 @@ export default {
|
||||
align-items: center;
|
||||
|
||||
.transfer-img {
|
||||
width: 500rpx;
|
||||
height: 500rpx;
|
||||
background: $uni-theme-blue ;
|
||||
}
|
||||
|
||||
.transfer-text {
|
||||
@@ -72,4 +79,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user