Files
aida_front/src/component/home/batchGeneration/index.vue

584 lines
15 KiB
Vue
Raw Normal View History

2025-04-16 10:43:54 +08:00
<template>
<div class="uploading">
<div class="title">
<div class="list">
<div
class="titleItem active"
>
<span class="detailText">All</span>
</div>
</div>
2025-05-28 10:28:07 +08:00
<div class="searchObject generalModel_state">
2025-06-11 15:08:17 +08:00
<div class="generalModel_state_item smail" style="margin-right: 1rem;">
2025-06-26 15:41:08 +08:00
<span>{{$t('batchGeneration.Project')}} :</span>
2025-05-28 10:28:07 +08:00
<a-select
2025-06-09 10:25:54 +08:00
v-model:value="projectData"
2025-05-28 10:28:07 +08:00
show-search
allowClear
2025-06-09 10:25:54 +08:00
size="large"
:show-arrow="false"
:default-active-first-option="false"
:not-found-content="null"
:filter-option="false"
style="width: 16rem"
:fieldNames="{ label: 'name', value: 'value'}"
2025-05-28 10:28:07 +08:00
placeholder="Please select"
:options="objectList"
2025-06-09 10:25:54 +08:00
@search="getHistoryProjectList"
2025-05-28 10:28:07 +08:00
@change="handleChange"
2025-06-09 10:25:54 +08:00
>
<template #option="{ value: val, label, icon,updateTime }">
<span :title="updateTime.replace('T', ' ')">{{ label }}</span>
</template>
</a-select>
2025-05-28 10:28:07 +08:00
</div>
</div>
2025-06-09 10:25:54 +08:00
<div class="createCloud">
2025-06-26 15:41:08 +08:00
<div class="gallery_btn" style="margin-right: 2rem;" @click="pagination">{{$t('batchGeneration.Search')}}</div>
<div class="gallery_btn white" @click="createClound">{{$t('batchGeneration.Create')}}</div>
2025-04-16 10:43:54 +08:00
</div>
</div>
<div class="contentList">
<div class="title">
<div class="titleItem" v-for="item in cloudTiltleList" :key="item.value">
{{ item.name }}
</div>
</div>
2025-04-16 15:08:59 +08:00
<div class="content">
<tr v-for="(row, index) in contentList" :key="index">
<td v-for="header in cloudTiltleList" :key="header.value">
2025-06-18 11:05:23 +08:00
<div v-if="header.value != 'operation' && header.value != 'name'">
2025-04-23 09:39:24 +08:00
{{header?.fun?header.fun(row[header.value]) : row[header.value]}}
2025-06-18 11:05:23 +08:00
</div>
<div v-if="header.value == 'name'">
<div v-if="row.id == renameId" class="rename">
<input type="text" v-model="renameText">
<i class="fi fi-br-check" @click="submitRename(row)"></i>
</div>
2025-07-19 14:04:48 +08:00
<div v-else :title="header?.fun?header.fun(row[header.value]) : row[header.value]" style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;width: 15rem;">
2025-06-18 11:05:23 +08:00
{{header?.fun?header.fun(row[header.value]) : row[header.value]}}
</div>
</div>
<span style="color: #007EE5; cursor: pointer; margin-right: 1rem;" v-show="header.value == 'operation'" @click="setRename(row)">
2025-06-26 15:41:08 +08:00
{{$t('batchGeneration.Rename')}}
2025-04-16 15:08:59 +08:00
</span>
2025-07-19 14:04:48 +08:00
<span style="color: #007EE5; cursor: pointer; margin-right: 1rem;" :style="{opacity:row.status == 1?1:.5}" v-show="header.value == 'operation'" @click="detailIamge(row)">
2025-06-26 15:41:08 +08:00
{{$t('batchGeneration.Review')}}
2025-04-16 15:08:59 +08:00
</span>
2025-06-18 11:05:23 +08:00
<span style="color: #007EE5; cursor: pointer;" v-show="header.value == 'operation'" @click="deleteRom(row)">
2025-06-26 15:41:08 +08:00
{{$t('batchGeneration.Delete')}}
2025-06-18 11:05:23 +08:00
</span>
2025-04-16 15:08:59 +08:00
</td>
</tr>
</div>
2025-06-11 15:08:17 +08:00
<a-pagination style="text-align: center;" @change="pagination" v-model:current="currentPage" :total="total" show-less-items />
2025-04-16 10:43:54 +08:00
</div>
2025-06-18 11:05:23 +08:00
<div class="mark_loading" v-show="loadingShow">
<a-spin size="large" />
</div>
2025-06-09 10:25:54 +08:00
<createCloud ref="createCloud" :cloudList="generateList.seriesDesign" @getContentList="submitGetContentList"></createCloud>
2025-04-16 10:43:54 +08:00
</div>
</template>
<script lang="ts">
2025-06-11 15:08:17 +08:00
import { defineComponent,computed,ref,onMounted,nextTick,createVNode,toRefs, reactive, onBeforeUnmount, inject} from 'vue'
2025-04-16 10:43:54 +08:00
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { Https } from "@/tool/https";
import { useStore } from "vuex";
import { useI18n } from 'vue-i18n'
import createCloud from "./createCloud.vue";
2025-04-23 09:39:24 +08:00
import { da } from 'element-plus/es/locale';
2025-06-09 10:25:54 +08:00
import { useRouter,useRoute } from 'vue-router'
2025-04-16 10:43:54 +08:00
export default defineComponent({
components:{
createCloud,
},
2025-04-23 09:39:24 +08:00
emits:['retrieve'],
2025-04-16 10:43:54 +08:00
setup(props,{emit}) {
2025-06-26 15:41:08 +08:00
const {t} = useI18n()
2025-04-16 10:43:54 +08:00
const store = useStore();
2025-06-11 15:08:17 +08:00
const router = useRouter()
2025-06-09 10:25:54 +08:00
const route = useRoute()
2025-04-16 10:43:54 +08:00
const data = reactive({
pageType:'list',
2025-04-23 09:39:24 +08:00
pageSize:10,
currentPage:1,
total:0,
selectObject:computed(()=>store.state.Workspace.probjects),//选择的项目
2025-06-09 10:25:54 +08:00
projectData:null as any,//批量id
createData:null as any,
2025-06-11 15:08:17 +08:00
settingGetHistory:inject('settingGetHistory') as any,
2025-04-16 10:43:54 +08:00
generateList:{
seriesDesign:[
2025-06-09 10:25:54 +08:00
{
2025-06-26 15:41:08 +08:00
label:t('newProjectg.SeriesDesign'),
2025-06-09 10:25:54 +08:00
// value:'SERIES_DESIGN',
2025-04-23 09:39:24 +08:00
consumption:0,
2025-06-09 10:25:54 +08:00
value:'SERIES_DESIGN',
},{
2025-06-26 15:41:08 +08:00
label:t('newProjectg.SingleDesign'),
2025-06-09 10:25:54 +08:00
// value:'SINGLE_DESIGN',
consumption:0,
value:'SINGLE_DESIGN',
2025-04-23 09:39:24 +08:00
},{
2025-06-26 15:41:08 +08:00
label:t('Header.toolsToProduct'),
2025-06-09 10:25:54 +08:00
// value:'toProductImage',
2025-04-23 09:39:24 +08:00
consumption:5,
2025-06-09 10:25:54 +08:00
value:'TO_PRODUCT_IMAGE',
2025-04-23 09:39:24 +08:00
},{
2025-06-26 15:41:08 +08:00
label:t('Header.toolsRelight'),
2025-06-09 10:25:54 +08:00
// value:'relight',
2025-04-23 09:39:24 +08:00
consumption:5,
2025-06-09 10:25:54 +08:00
value:'RELIGHT',
2025-04-23 09:39:24 +08:00
},{
2025-06-26 15:41:08 +08:00
label:t('Header.toolsToTransferPose'),
2025-06-09 10:25:54 +08:00
// value:'poseTransfer',
2025-04-23 09:39:24 +08:00
consumption:10,
2025-06-09 10:25:54 +08:00
value:'POSE_TRANSFER',
2025-04-23 09:39:24 +08:00
},
2025-04-16 10:43:54 +08:00
],
singleProductDesign:[
{
label:'Design',
value:'design',
consumption:0,
},{
label:'To Product Image',
value:'toProductImage',
consumption:5,
},
2025-04-16 10:43:54 +08:00
],
// printDesign:[
// {
// label:'1',
// value:100,
// }
// ],
2025-04-16 10:43:54 +08:00
productDrawingDesign:[
{
label:'To Product Image',
value:'toProductImage',
consumption:5,
},{
label:'Relight',
value:'relight',
consumption:5,
},{
label:'Transfer Pose',
value:'poseTransfer',
consumption:10,
},
2025-04-16 10:43:54 +08:00
],
// printingDesign3D:[
// {
// label:'1',
// value:100,
// }
// ],
// sketchDesign:[]
2025-04-16 10:43:54 +08:00
},
cloudTiltleList:[
2025-07-19 14:04:48 +08:00
{
name:computed(()=>t('batchGeneration.sequence')),
value:'sequence',
},
2025-04-16 10:43:54 +08:00
{
2025-06-26 15:41:08 +08:00
name:computed(()=>t('batchGeneration.TaskName')),
2025-06-18 11:05:23 +08:00
value:'name',
},{
2025-06-26 15:41:08 +08:00
name:computed(()=>t('batchGeneration.TaskType')),
2025-04-23 09:39:24 +08:00
value:'buildType',
fun:(value:any)=>{
let str = ''
if(value == 'design')str = 'Design'
if(value == 'toProductImage')str = 'To Product Image'
if(value == 'relight')str = 'Relight'
if(value == 'poseTransfer')str = 'Transfer Pose'
return str
}
2025-04-16 10:43:54 +08:00
},{
2025-06-26 15:41:08 +08:00
name:computed(()=>t('batchGeneration.QuantityGenerated')),
2025-04-23 09:39:24 +08:00
value:'nums',
},
{
2025-06-26 15:41:08 +08:00
name:computed(()=>t('batchGeneration.CreationTime')),
value:'createTime',
fun:(value:any)=>{
if(!value)return
return value.split('T')[0] + ' ' + value.split('T')[1].split('.')[0]
}
},
{
2025-06-26 15:41:08 +08:00
name:computed(()=>t('batchGeneration.StartTime')),
2025-07-19 14:04:48 +08:00
value:'startTime',
fun:(value:any)=>{
//没开始内容为 -
if(!value)return
return value.split('T')[0] + ' ' + value.split('T')[1].split('.')[0]
}
},{
2025-06-26 15:41:08 +08:00
name:computed(()=>t('batchGeneration.UpdateTime')),
2025-04-23 09:39:24 +08:00
value:'updateTime',
fun:(value:any)=>{
if(!value)return
return value.split('T')[0] + ' ' + value.split('T')[1].split('.')[0]
}
},{
2025-06-26 15:41:08 +08:00
name:computed(()=>t('batchGeneration.Status')),
2025-04-23 09:39:24 +08:00
value:'process',
fun:(value:any)=>{
if(value == '100.00%'){
return 'Completed'
}else{
return value
}
}
2025-04-16 15:08:59 +08:00
},{
2025-06-26 15:41:08 +08:00
name:computed(()=>t('batchGeneration.Operation')),
2025-04-16 15:08:59 +08:00
value:'operation',
2025-04-16 10:43:54 +08:00
},
2025-04-16 15:08:59 +08:00
] as any,
contentList:[
] as any,
2025-06-09 10:25:54 +08:00
objectList:[],
2025-04-23 09:39:24 +08:00
isGetContentList:false as any,
2025-06-18 11:05:23 +08:00
renameId:-1 as any,
renameText:'',
loadingShow:false,
2025-04-16 10:43:54 +08:00
})
const dataDom = reactive({
createCloud,
})
2025-07-19 14:04:48 +08:00
const getNextSequence = ()=>{
return new Promise((resolve, reject) => {
data.loadingShow = true
Https.axiosGet(Https.httpUrls.getNextSequence).then((rv)=>{
data.loadingShow = false
data.isGetContentList = false
resolve(rv)
}).catch(()=>{
data.loadingShow = false
resolve('')
})
})
}
2025-04-16 10:43:54 +08:00
const createClound = ()=>{
2025-06-09 10:25:54 +08:00
let obj = {}
if(data.createData){
data.generateList.seriesDesign.forEach((item:any)=>{
if((item.value == data.createData.process)){
obj = item
}
})
}
2025-07-19 14:04:48 +08:00
console.log(obj)
getNextSequence().then((rv)=>{
dataDom.createCloud.init(data.createData,obj,rv)
})
2025-04-16 15:08:59 +08:00
}
2025-06-11 15:08:17 +08:00
const createData = ()=>{
store.commit("createProbject");
store.commit("clearAllData");
store.commit("clearAllCollection");
store.commit("setAllBoardDataChoose",{});
store.commit("clearShowSketchboard",{});
store.commit("clearAllCollection");
}
2025-04-23 09:39:24 +08:00
const detailIamge = (item:any)=>{
//去除里面的T2025-04-17T13:45:43
if(item.process == '100.00%' || item.status == 1){
let value = {
taskId:item.taskId,
page:1,
size:10,
buildType:item.buildType,
}
2025-06-11 15:08:17 +08:00
createData()
2025-07-19 14:04:48 +08:00
if(item.buildType == 'design'){
router.push(`/home?history=${item.projectId}&source=batch`)
}else if(item.buildType == 'toProductImage'){
router.push(`/home/tools?tools=toProduct&id=${item.projectId}&source=batch`)
}else if(item.buildType == 'relight'){
router.push(`/home/tools?tools=${item.buildType}&id=${item.projectId}&source=batch`)
}else if(item.buildType == 'poseTransfer'){
router.push(`/home/tools?tools=${item.buildType}&id=${item.projectId}&source=batch`)
}
data.isGetContentList = false
2025-04-23 09:39:24 +08:00
Https.axiosPost(Https.httpUrls.getDesignCloudResult,value).then((rv)=>{
2025-06-11 15:08:17 +08:00
if(item.buildType == 'design'){
2025-04-23 09:39:24 +08:00
store.commit('addDesignCollectionList',rv.design)
2025-06-11 15:08:17 +08:00
router.push(`/home?history=${item.projectId}&source=batch`)
}else if(item.buildType == 'toProductImage'){
2025-04-23 09:39:24 +08:00
store.commit('setCloudList',{str:'toProduct',list:rv.toProductImage})
2025-06-11 15:08:17 +08:00
router.push(`/home/tools?tools=toProduct&id=${item.projectId}&source=batch`)
}else if(item.buildType == 'relight'){
2025-04-23 09:39:24 +08:00
store.commit('setCloudList',{str:'relight',list:rv.relight})
2025-06-11 15:08:17 +08:00
router.push(`/home/tools?tools=${item.buildType}&id=${item.projectId}&source=batch`)
}else if(item.buildType == 'poseTransfer'){
2025-06-18 11:05:23 +08:00
let list = {
list:rv.poseTransfer,
str:'add',
index:-1,
}
store.commit("setPoseTransfer", list);
// store.commit('setCloudList',{str:'poseTransfer',list:rv.poseTransfer})
2025-06-11 15:08:17 +08:00
router.push(`/home/tools?tools=${item.buildType}&id=${item.projectId}&source=batch`)
2025-04-23 09:39:24 +08:00
}
data.isGetContentList = false
})
}
2025-04-16 10:43:54 +08:00
}
2025-06-11 15:08:17 +08:00
const pagination = ()=>{
data.isGetContentList = true
2025-06-18 11:05:23 +08:00
data.renameId = -1
2025-06-11 15:08:17 +08:00
getContentList()
}
let time = null as any
2025-04-23 09:39:24 +08:00
const getContentList = ()=>{
if(data.isGetContentList){
2025-06-11 15:08:17 +08:00
clearTimeout(time)
2025-04-23 09:39:24 +08:00
let value = {
page:data.currentPage,
size:data.pageSize,
2025-06-18 11:05:23 +08:00
projectId: data.projectData?.value?data.projectData?.value:'',
2025-04-23 09:39:24 +08:00
}
Https.axiosPost(Https.httpUrls.cloudPage,value).then((rv)=>{
data.contentList = rv.content
data.total = rv.total
let arr = rv.content
let result = arr.some((item:any) => (item.process !== '100.00%' && item.status !== 1));
if(!result)data.isGetContentList = false
2025-06-11 15:08:17 +08:00
time = setTimeout(()=>{
2025-04-23 09:39:24 +08:00
getContentList()
},1500)
})
}
}
2025-06-09 10:25:54 +08:00
let getHistoryTime = null as any
const getHistoryProjectList = (event:any)=>{
clearTimeout(getHistoryTime)
if(!event){
data.objectList = []
return
}
getHistoryTime = setTimeout(()=>{
let value = {
projectName:event,
page:1,
size:9999,
asc:0,
process:'',
}
Https.axiosPost(Https.httpUrls.historyProject,value).then((rv)=>{
rv.content.forEach((item:any)=>{
item.value = item.id
item.label = item.name
})
data.objectList = rv.content
})
},1000)
}
2025-06-11 15:08:17 +08:00
const submitGetContentList = (project:any)=>{
2025-06-26 15:41:08 +08:00
data.isGetContentList = true
// if(project){
// data.projectData = project
// }else{
// data.projectData = null
// }
// data.currentPage = 1
2025-06-26 15:41:08 +08:00
getContentList()
2025-06-11 15:08:17 +08:00
if(data.settingGetHistory)data.settingGetHistory()
2025-04-23 09:39:24 +08:00
}
2025-06-09 10:25:54 +08:00
const handleChange = (event:any,value:any)=>{
data.createData = value
}
2025-06-18 11:05:23 +08:00
const setRename = (item:any)=>{
data.renameId = item.id
data.renameText = item.name
}
const submitRename = (item:any)=>{
data.renameId = -1
data.loadingShow = true
let value = {
id:item.id,
name:data.renameText,
}
Https.axiosPost(Https.httpUrls.cloudTaskNameUpdate,value).then((rv)=>{
data.loadingShow = false
data.renameText = ''
data.isGetContentList = true
getContentList()
}).catch((err)=>{
data.loadingShow = false
})
}
const deleteRom = (item:any)=>{
let value = {
id:item.id
}
Https.axiosPost(Https.httpUrls.cloudTaskDelete,value).then((rv)=>{
data.loadingShow = false
data.isGetContentList = true
getContentList()
}).catch((err)=>{
data.loadingShow = false
})
}
2025-04-23 09:39:24 +08:00
onBeforeUnmount(()=>{
data.isGetContentList = false
})
2025-07-19 14:04:48 +08:00
watch(()=>route.query.id,(newValue,oldValue)=>{
2025-06-09 10:25:54 +08:00
if(route.query?.id){
2025-06-11 15:08:17 +08:00
data.projectData = {
value:route.query?.id,
label:route.query?.name,
}
2025-07-19 14:04:48 +08:00
data.createData = {
label:route.query?.name,
id:route.query?.id,
process:route.query?.process
}
createClound()
2025-06-09 10:25:54 +08:00
}
2025-07-19 14:04:48 +08:00
},{immediate:true})
onMounted(()=>{
data.isGetContentList = true
2025-06-11 15:08:17 +08:00
getContentList()
2025-06-09 10:25:54 +08:00
// if(route.query?.type == 'creation')dataDom.createCloud.init(data.projectData)
2025-04-23 09:39:24 +08:00
})
2025-04-16 10:43:54 +08:00
return{
...toRefs(dataDom),
...toRefs(data),
createClound,
2025-04-23 09:39:24 +08:00
detailIamge,
getContentList,
submitGetContentList,
2025-06-09 10:25:54 +08:00
handleChange,
getHistoryProjectList,
2025-06-11 15:08:17 +08:00
pagination,
2025-06-18 11:05:23 +08:00
setRename,
submitRename,
deleteRom,
2025-04-16 10:43:54 +08:00
}
},
provide() {
return {
}
},
})
</script>
<style lang="less" scoped>
.uploading{
width: 100%;
height: 100%;
position: relative;
padding-top: 3rem;
display: flex;
flex-direction: column;
> .title{
width: 100%;
display: flex;
> .list{
display: flex;
margin-bottom: 2.5rem;
> .titleItem:last-child{
margin-right: 0;
}
> .titleItem{
position: relative;
cursor: pointer;
margin-right: 6.5rem;
}
> .titleItem::before {
position: absolute;
content: "";
display: block;
background: #000;
height: calc(.4rem*1.2);
left: 50%;
transform: translateX(-50%);
bottom: -.5rem;
width: 0px;
transition: 0.3s all;
}
> .active {
color: #000;
font-weight: 600;
}
> .active::before {
width: 100%;
}
}
> .createCloud{
}
2025-05-28 10:28:07 +08:00
> .searchObject{
margin-left: auto;
}
2025-04-16 10:43:54 +08:00
}
> .contentList{
flex: 1;
overflow: hidden;
padding-top: 2.5rem;
2025-04-23 09:39:24 +08:00
display: flex;
flex-direction: column;
2025-04-16 15:08:59 +08:00
> .content tr , > .title{
display: flex;
justify-content: space-between;
padding: 0 1.2rem;
}
2025-04-16 10:43:54 +08:00
> .title{
2025-04-16 15:08:59 +08:00
background: #F7F7F7;
> .titleItem{
line-height: 4.6rem;
font-size: 2rem;
color: #666666;
2025-07-19 14:04:48 +08:00
// width: calc(100% / 4);
width: 20rem;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
2025-04-16 15:08:59 +08:00
text-align: center;
}
}
2025-04-23 09:39:24 +08:00
.content{
flex: 1;
overflow: hidden;
> tr{
> td{
text-align: center;
width: calc(100% / 4);
line-height: 4.6rem;
2025-06-18 11:05:23 +08:00
font-size: 1.6rem;
display: flex;
align-items: center;
justify-content: center;
.rename{
display: flex;
align-items: center;
input{
height: 100%;
padding: .8rem;
width: 12rem;
}
> i{
margin-left: 1rem;
cursor: pointer;
width: 3rem;
height: 3rem;
background: #000;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
border-radius: 2rem;
}
}
2025-04-23 09:39:24 +08:00
}
2025-04-16 15:08:59 +08:00
}
2025-04-16 10:43:54 +08:00
}
}
}
</style>