Files
aida_front/src/component/Detail/model/index.vue

233 lines
6.2 KiB
Vue
Raw Normal View History

2025-01-23 09:36:21 +08:00
<template>
<div class="modelindex">
2025-02-17 09:34:28 +08:00
<div class="modelindex_left">
2025-08-26 10:14:34 +08:00
<div class="back" v-show="isEditPattern.value">
<i class="fi fi-br-angle-left" @click="setBack"></i>
</div>
2025-03-03 14:52:05 +08:00
<modelNav @canvasReload="()=>$emit('canvasReload')" @addSketch="()=>$emit('addSketch')" @deleteItem="deleteItem"></modelNav>
2025-01-24 13:41:13 +08:00
</div>
2025-02-17 09:34:28 +08:00
<div class="modelindex_right">
<div class="detail_btn">
<!-- 全屏 -->
2025-02-25 15:32:55 +08:00
<!-- <i class="fi fi-bs-expand-arrows-alt" @click="showDesignImgDetail('2')"></i> -->
2025-03-03 14:52:05 +08:00
<i v-show="true" class="icon iconfont icon-chehui" @click="revocation"></i>
<i v-show="true" class="icon iconfont icon-fanchehui" @click="oppositeRevocation"></i>
2025-02-17 09:34:28 +08:00
<!-- 编辑 -->
2025-02-25 15:32:55 +08:00
<i class="fi fi-rr-edit" :title="$t('DesignDetail.editTitle')" :class="{active:isEditPattern.value}" @click="showDesignImgDetail('edit')"></i>
2025-04-09 14:09:19 +08:00
<!-- <i class="fi fi-rr-copy" :title="$t('DesignDetail.compareTitle')" :class="{active:imgDesignImg}" @click="mousedownDesignImg"></i> -->
2025-02-17 09:34:28 +08:00
<!-- <i v-show="!body && !deleteShow" :title="$t('DesignDetail.DetailTitle')" class="fi fi-rr-trash" @click="deleteNav(0)"></i>
<i v-show="!body && deleteShow" class="fi fi-br-check" @click="deleteNav(1)"></i> -->
<!-- -->
2025-04-09 14:09:19 +08:00
<i class="fi fi-rr-copy" :title="$t('DesignDetail.compareTitle')" @mousedown="mousedownDesignImg" @mouseup="mousedownDesignImg" @touchstart="mousedownDesignImg" @touchend="mousedownDesignImg"></i>
2025-03-03 14:52:05 +08:00
2025-02-17 09:34:28 +08:00
</div>
2025-03-03 14:52:05 +08:00
<position ref="position" @canvasReload="()=>$emit('canvasReload')" :imgDesignImg=imgDesignImg></position>
2025-01-23 09:36:21 +08:00
</div>
2025-02-17 09:34:28 +08:00
2025-01-23 09:36:21 +08:00
</div>
</template>
<script lang="ts">
2025-04-30 14:01:52 +08:00
import { defineComponent,computed,ref,inject,onBeforeUnmount,createVNode,toRefs, reactive, onMounted} from 'vue'
2025-01-23 09:36:21 +08:00
// import setDesignItem from '@/component/Detail/setDesignItem2.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { Https } from "@/tool/https";
import { useStore } from "vuex";
2025-04-09 14:09:19 +08:00
import { Modal,message } from 'ant-design-vue';
2025-01-23 09:36:21 +08:00
import { useI18n } from 'vue-i18n'
2025-01-24 13:41:13 +08:00
import position from './modelPosition.vue';
2025-02-17 09:34:28 +08:00
import modelNav from './modelNav.vue';
2025-01-23 09:36:21 +08:00
export default defineComponent({
components:{
2025-02-17 09:34:28 +08:00
position,modelNav
2025-01-23 09:36:21 +08:00
},
2025-03-03 14:52:05 +08:00
emits:['detailEdit','canvasReload','addSketch','revocation','oppositeRevocation'],
2025-01-23 09:36:21 +08:00
setup(props,{emit}) {
2025-04-09 14:09:19 +08:00
const {t} = useI18n()
2025-01-23 09:36:21 +08:00
const store = useStore();
const detailData = reactive({
2025-04-09 14:09:19 +08:00
getCanvasIfEdit:inject('getCanvasIfEdit')as any,
2025-01-23 09:36:21 +08:00
})
2025-03-03 14:52:05 +08:00
const setRevocation:any = inject('setRevocation')
2025-01-23 09:36:21 +08:00
const getDetailListData = reactive({
2025-08-22 10:27:48 +08:00
designDetail:computed(()=>store.state.DesignDetail.designDetail),
2025-02-25 15:32:55 +08:00
isEditPattern:inject('isEditPattern') as any,
imgDesignImg:false,
2025-01-23 09:36:21 +08:00
})
const getDetailListDom = reactive({
libraryList:null as any,
2025-02-17 09:34:28 +08:00
position:null as any,
2025-01-23 09:36:21 +08:00
})
2025-02-17 09:34:28 +08:00
const getSubmitData = (value:any)=>{
return getDetailListDom.position.getSubmitData(value)
}
2025-02-17 15:24:01 +08:00
const showDesignImgDetail = (str:any)=>{
2025-04-09 14:09:19 +08:00
new Promise((resolve, reject) => {
2025-08-22 10:27:48 +08:00
// if(
// getDetailListData.isEditPattern.value&&
// detailData?.getCanvasIfEdit?.fun&&detailData?.getCanvasIfEdit?.fun() > 0
// ){
// Modal.confirm({
// title: t('collectionModal.jsContent2'),
// icon: createVNode(ExclamationCircleOutlined),
// okText: 'Yes',
// cancelText: 'No',
// mask:false,
// centered:true,
// onOk() {
// resolve(true)
// emit('detailEdit',str)
// },
// onCancel(){
// resolve(false)
// }
// });
// }else{
2025-04-09 14:09:19 +08:00
resolve(true)
emit('detailEdit',str)
2025-08-22 10:27:48 +08:00
// }
2025-04-09 14:09:19 +08:00
})
2025-01-23 09:36:21 +08:00
}
2025-03-03 14:52:05 +08:00
const deleteItem = ()=>{
setRevocation()
}
const revocation = ()=>{//撤回
emit('revocation')
getDetailListDom.position.updataPosition()
}
const oppositeRevocation = ()=>{//反撤回
emit('oppositeRevocation')
getDetailListDom.position.updataPosition()
}
2025-02-25 15:32:55 +08:00
//图片按下样子
const mousedownDesignImg = ()=>{
getDetailListData.imgDesignImg = !getDetailListData.imgDesignImg
2025-01-23 09:36:21 +08:00
}
2025-04-30 14:01:52 +08:00
let time = null as any
const handleResize = ()=>{
clearTimeout(time)
time = setTimeout(()=>{
2025-08-22 10:27:48 +08:00
store.commit('DesignDetail/setDesignDetail',getDetailListData.designDetail)
2025-04-30 14:01:52 +08:00
getDetailListDom.position.updataPosition()
},1000)
}
2025-08-26 10:14:34 +08:00
const setBack = ()=>{
emit('detailEdit','edit')
}
2025-04-30 14:01:52 +08:00
onMounted(()=>{
window.addEventListener('resize', handleResize);
})
onBeforeUnmount(()=>{
window.removeEventListener('resize', handleResize);
})
2025-01-23 09:36:21 +08:00
return{
...toRefs(detailData),
...toRefs(getDetailListData),
...toRefs(getDetailListDom),
2025-02-17 09:34:28 +08:00
getSubmitData,
2025-01-23 09:36:21 +08:00
showDesignImgDetail,
2025-03-03 14:52:05 +08:00
revocation,
deleteItem,
oppositeRevocation,
2025-02-25 15:32:55 +08:00
mousedownDesignImg,
2025-08-26 10:14:34 +08:00
setBack,
2025-01-23 09:36:21 +08:00
}
},
provide() {
return {
}
},
})
</script>
<style lang="less" scoped>
.modelindex{
2025-02-17 09:34:28 +08:00
width: 100%;
2025-01-23 09:36:21 +08:00
height: 100%;
display: flex;
2025-03-03 14:52:05 +08:00
// padding-top: 3rem;
2025-02-17 09:34:28 +08:00
flex: 1;
2025-02-03 13:22:34 +08:00
overflow: hidden;
2025-02-17 09:34:28 +08:00
.modelindex_right,.modelindex_left{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
> .modelindex_right{
flex: 1;
overflow: hidden;
2025-03-03 14:52:05 +08:00
2025-02-17 09:34:28 +08:00
> .detail_btn{
width: 100%;
display: flex;
justify-content: space-between;
2025-02-17 15:24:01 +08:00
border-radius: 1rem;
padding: .7rem ;
2025-03-03 14:52:05 +08:00
flex-shrink: 0;
2025-04-30 14:01:52 +08:00
overflow: hidden;
2025-05-28 10:28:07 +08:00
// max-height: 4rem;
2025-06-26 15:41:08 +08:00
position: relative;
z-index: 99;
2025-02-17 09:34:28 +08:00
> i{
font-size: 2rem;
2025-02-17 15:24:01 +08:00
cursor: pointer;
2025-05-28 10:28:07 +08:00
// padding: 1.5rem;
2025-02-17 15:24:01 +08:00
display: flex;
align-items: center;
border-radius: .6rem;
overflow: hidden;
transition: all .3s;
2025-05-28 10:28:07 +08:00
width: 4rem;
height: 4rem;
justify-content: center;
2025-07-19 14:04:48 +08:00
@media (min-width: 1024px) {
font-size: 2.4rem;
}
2025-02-17 15:24:01 +08:00
}
> i:hover{
background: #000000;
color: #fff;
2025-02-17 09:34:28 +08:00
}
2025-02-17 15:24:01 +08:00
> .active{
background: #000000;
color: #fff;
}
2025-02-17 09:34:28 +08:00
}
}
.modelindex_left{
justify-content: center;
2025-08-26 10:14:34 +08:00
position: relative;
> .back{
position: absolute;
font-size: 3.6rem;
font-weight: 500;
display: flex;
align-items: center;
margin-bottom: 1.2rem;
top: 8rem;
left: 0;
> i {
margin-right: 2.8rem;
font-size: 2rem;
display: flex;
cursor: pointer;
align-items: center;
width: 4.6rem;
height: 4.6rem;
border-radius: 1.2rem;
display: flex;
justify-content: center;
border: 1px solid #D8DADC;
}
}
2025-02-17 09:34:28 +08:00
}
2025-02-17 15:24:01 +08:00
2025-01-23 09:36:21 +08:00
}
</style>