数通互联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
3.3 KiB

2 years ago
<!--
@ 作者: 秦东
@ 时间: 2024-05-29 13:25:09
@ 备注: 应用发布页面
-->
<script lang='ts' setup>
import { gainAppPageInfo,setCustomerFormState } from '@/api/DesignForm/requestapi'
const props = defineProps({
appCont:{
type:Object,
default(){
return {}
}
},
groupKey:{
type:String,
default:""
}
});
const appStatue = ref(true)
const isEdit = ref(false)
onMounted(()=>{
gainAppPageInfo({id:props.appCont.uuid})
.then((data)=>{
// console.log("获取初始化表单数据",data)
2 years ago
if(data.data.appForm.states == 1){
appStatue.value = true
props.appCont.state = 1
}else{
appStatue.value = false
props.appCont.state = 2
}
})
.finally(()=>{
isEdit.value = true;
})
})
2 years ago
// watch(()=>appStatue.value,(val:boolean) => {
2 years ago
2 years ago
// let sta = 1
// if(val){
// props.appCont.state = 1
// sta = 1
// }else{
// props.appCont.state = 2
// sta = 2
// }
2 years ago
2 years ago
// setUpState(sta)
2 years ago
2 years ago
// })
2 years ago
/**
@ 作者: 秦东
@ 时间: 2024-05-29 14:38:01
@ 功能: 设置状态
*/
const setUpState = (val:number) => {
setCustomerFormState({id:props.appCont.uuid,state:val})
.then((data)=>{
2 years ago
props.appCont.state = appStatue.value
2 years ago
// ElMessage({
// showClose: true,
// message: data.msg,
// type: 'success',
// })
})
}
2 years ago
const switchChang = () =>{
if(appStatue.value == 1){
setUpState(1)
}else{
setUpState(2)
}
}
2 years ago
</script>
<template>
<div class="appBox">
<el-card class="appCardBox" shadow="always">
<table>
<tr>
<td width="100px" align="center">
<el-image :src="props.appCont.appSvg">
<template #error>
<div class="image-slot">
<el-icon><icon-picture /></el-icon>
</div>
</template>
</el-image>
</td>
<td width="150px" align="center">
<el-text v-if="appStatue" class="mx-1 bigWord" type="success">已启用</el-text>
<el-text v-else class="mx-1 bigWord" type="danger">已停用</el-text>
</td>
<td align="left" >
<el-text v-if="appStatue" class="mx-1" type="success">应用已启用为可用状态</el-text>
<el-text v-else class="mx-1" type="danger">应用已停用不可使用此App</el-text>
</td>
<td width="100px" align="right">
<el-switch
v-model="appStatue"
class="ml-2"
inline-prompt
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
active-text="已启用"
inactive-text="已停用"
2 years ago
@change="switchChang"
2 years ago
/>
</td>
</tr>
</table>
</el-card>
</div>
</template>
<style lang='scss' scoped>
.appBox{
width:100%;
background-color : #F5F7FA;
height: calc(100vh - 40px);
text-align: center;
.appCardBox{
max-width: 60%;
min-width: 40%;
margin: 20px auto;
td{
vertical-align: middle;
.bigWord{
font-size:30px;
}
}
.el-image {
padding: 0 5px;
max-width: 80px;
max-height: 70px;
width: 100%;
height: 70px;
border: 1px solid #F0F2F5;
border-radius: 5px;
background: var(--el-fill-color-light);
}
.image-slot {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background: var(--el-fill-color-light);
color: var(--el-text-color-secondary);
font-size: 30px;
}
.image-slot .el-icon {
font-size: 30px;
}
}
}
</style>