send2Printer-modal.vue 8.83 KB
<template>
    <section class="send-2printer" v-show="isSendToPrinterModalVisible">
        <Card :title="$t('sliceModalTitle')" customClass="send-2printer-card">
            <template v-slot:extend>
                <el-icon class="icon" :size="24" @click="onCloseModal">
                    <Close />
                </el-icon>
            </template>
            <template v-slot:component>
                <div class="parameter">
                    <div style="flex: 1">
                        <span class="title" v-text="`${$t('device')}: `" />
                        <span v-text="deviceStore.selecteditem.name" />
                    </div>
                    <div style="flex: 1">
                        <span class="title" v-text="`${$t('material')}: `" />
                        <span v-text="materialsStore.selecteditem" />
                    </div>
                </div>
                <div class="send-method">
                    <div v-if="account === 'aaa'">
                        <el-radio-group v-model="selecteditem">
                            <div class="radio-item">
                                <el-radio label="queue">{{ $t('sendToTask') }}</el-radio>
                                <span style="flex: 1" />
                            </div>
                        </el-radio-group>
                    </div>
                    <div v-else>
                        <el-radio-group v-model="selecteditem" @change="handleChange">
                            <div class="radio-item">
                                <el-radio label="auto">{{ $t('sendAuto') }}</el-radio>
                                <el-radio label="choose">{{ $t('sendChoosePrinter') }}</el-radio>
                            </div>
                        </el-radio-group>
                    </div>
                </div>
                <div class="choose-printer" v-if="account !== 'aaa'">
                    <div style="padding-bottom: 8px">
                        <span style="font-size: 14px; font-weight: 400" v-text="$t('sendChoosePrinterTitle')" />
                        <div style="padding-top: 8px">
                            <Select
                                :items="printeritems"
                                :selecteditem="selectedPrinter"
                                :handleSelect="handleSelectPrinter"
                                selecteditemsWidth="602px"
                                :placeholder="$t('sendChoosePrinter')"
                            />
                        </div>
                    </div>
                </div>
                <div class="statistics">
                    <el-collapse @change="handleChange">
                        <el-collapse-item :title="$t('sendModalOthers')" name="1">
                            <div class="statics-item">
                                <div style="flex: 1">
                                    <div style="padding-bottom: 8px">
                                        <Select
                                            :items="purposeitems"
                                            :selecteditem="selectedPurpose"
                                            :handleSelect="handleSelectPurpose"
                                            selecteditemsWidth="292.5px"
                                            :placeholder="$t('sendChoosePurpose')"
                                        />
                                    </div>
                                    <div style="padding-bottom: 8px">
                                        <Select
                                            :items="productitems"
                                            :selecteditem="selectedProduct"
                                            :handleSelect="handleSelectProduct"
                                            selecteditemsWidth="292.5px"
                                            :placeholder="$t('sendChooseProduct')"
                                        />
                                    </div>
                                </div>
                                <div style="flex: 1">
                                    <el-input
                                        v-model="remarks"
                                        autosize
                                        type="textarea"
                                        :placeholder="$t('sendPrintRemarks')"
                                    />
                                </div>
                            </div>
                        </el-collapse-item>
                    </el-collapse>
                </div>
                <div class="button">
                    <span class="button-hollow" @click="onCloseModal">
                        {{ $t('cancel') }}
                    </span>
                    <span class="button-big" @click="onSendToPrinter">
                        {{ $t('sliceModalButton') }}
                    </span>
                </div>
            </template>
        </Card>
    </section>
</template>
<script setup>
import { storeToRefs } from 'pinia';
import Card from '@/components/simple-card.vue';
import { Close } from '@element-plus/icons-vue';
import Select from '@/views/viewer/components/common/select.vue';
import { useCanvasHeaderMachineStore } from '@/views/stores/header/useCanvasHeaderMachineStore';
import { useMaterialsStore } from '@/views/stores/applications/useMaterialsStore';
import { useApplicationSettingIndexStore } from '@/views/stores/applications/useApplicationSettingIndexStore';
import { useSendToPrinterStore } from '@/views/stores/applications/useSendToPrinterStore';
import { watch, ref } from 'vue';

const store = useApplicationSettingIndexStore();
const { setSendToPrinterModalVisible, handeSendToPrinter } = store;
const { isSendToPrinterModalVisible } = storeToRefs(store);

const deviceStore = useCanvasHeaderMachineStore();
const materialsStore = useMaterialsStore();

const sendStore = useSendToPrinterStore();

const { account, selecteditem, remarks, printeritems, selectedPurpose, selectedProduct, selectedPrinter } =
    storeToRefs(sendStore);
const { purposeitems, productitems, handleSelectPurpose, handleSelectProduct, handleSelectPrinter } = sendStore;

const onCloseModal = () => {
    setSendToPrinterModalVisible(false);
};

const onSendToPrinter = () => {
    handeSendToPrinter();
};

const handleChange = () => {};

const marginRight = ref('32px');

watch(
    () => account.value,
    () => {
        marginRight.value = account.value === 'aaa' ? '32px' : 'unset';
    }
);
</script>
<style lang="less" scoped>
.send-2printer-card {
    position: absolute;
    background-color: #fff;
    box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.1);
    border: 1px solid #cdd1d5;
    top: 40%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    z-index: 201;
    width: 600px !important;
    :deep(.el-upload-list__item .el-icon--close) {
        display: unset;
    }
    :deep(.el-upload-list) {
        overflow-y: auto;
        height: 140px;
        display: v-bind('uploadlistVisible');
        top: 10px;
    }
    .icon {
        cursor: pointer;
        &:hover {
            background-color: rgb(246, 247, 248);
        }
        &:active {
            background-color: #eef0f2;
        }
    }
    .choose-printer {
    }
    .parameter {
        display: flex;
        font-weight: 300;
        .title {
            color: #c0c1c2;
        }
        span {
            font-size: 14px;
            width: 220px;
        }
    }
    .send-method {
        padding: 24px 0 12px 0px;
        .el-radio-group {
            display: unset !important;
        }
        .radio-item {
            height: 60px;
            display: flex;
            gap: 15px;
            :deep(.el-radio) {
                height: 60px !important;
                flex: 1;
                border-radius: 8px;
                border: 1px solid @main-color;
                padding: 0 16px;
                color: @main-color;
                margin-right: v-bind('marginRight') !important;
                &:hover {
                    background-color: @main-modellist-selected-color;
                    cursor: pointer;
                }
            }
        }
    }
    .statistics {
        .statics-item {
            display: flex;
            justify-content: space-between;
            gap: 15px;
        }
    }
    .button {
        display: flex;
        justify-content: space-between;
        button-big {
            &:hover {
                background-color: @color-button-main-hover;
            }
            &:active {
                background-color: @color-button-main-active;
            }
        }
    }
}
.upload-demo {
    padding: 20px 0;
}
</style>

<style lang="less">
.send-2printer-card.card {
    padding: 22px !important;
    .header .title {
        margin: 0px;
        font-size: 20px;
        line-height: 34px;
        font-weight: 700;
    }
}
</style>