|
@@ -0,0 +1,309 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <el-card :bordered="false" class="proCard" style="position: relative">
|
|
|
|
|
+ <div style="position: relative"
|
|
|
|
|
+ ><div style="display: flex; position: relative">
|
|
|
|
|
+ <img src="~@/assets/icons/back.png" alt="" @click="backPage" class="back-btn" />
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="companySelet"
|
|
|
|
|
+ class="m-2"
|
|
|
|
|
+ placeholder="请选择相关公司"
|
|
|
|
|
+ style="width: 216px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in companyList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.value"
|
|
|
|
|
+ :value="item.value"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <div v-if="companySelet" style="display: flex; margin-top: 8px">
|
|
|
|
|
+ <div style="font-size: 20px; margin-left: 29px; margin-right: 4px">选择标签</div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-radio-group v-model="label" size="10px" :border="true" style="display: flex">
|
|
|
|
|
+ <el-radio-button
|
|
|
|
|
+ v-for="item in labelList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.id!"
|
|
|
|
|
+ class="label-select"
|
|
|
|
|
+ >{{ item.value }}</el-radio-button
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-radio-group></div
|
|
|
|
|
+ >
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-upload
|
|
|
|
|
+ ref="upload"
|
|
|
|
|
+ class="upload-demo"
|
|
|
|
|
+ :limit="1"
|
|
|
|
|
+ :show-file-list="false"
|
|
|
|
|
+ :on-exceed="handleExceed"
|
|
|
|
|
+ :on-change="onSelectfile"
|
|
|
|
|
+ :auto-upload="false"
|
|
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #trigger>
|
|
|
|
|
+ <el-button :icon="Refresh" plain class="btn-top-refresh">替换照片</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ <!-- <el-button type="info" :icon="Refresh" plain class="btn-top-refresh" @click="replacePic"
|
|
|
|
|
+ >替换照片</el-button
|
|
|
|
|
+ > -->
|
|
|
|
|
+ <el-button type="info" plain class="btn-top-save" @click="saveConfig">保存为主页</el-button>
|
|
|
|
|
+ <!-- <div>按钮</div> -->
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="display: flex">
|
|
|
|
|
+ <div class="workshop-content">
|
|
|
|
|
+ <div class="workshop-title">车间列表</div>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="searchWorkshop"
|
|
|
|
|
+ class="w-50 m-2"
|
|
|
|
|
+ placeholder="搜索功能"
|
|
|
|
|
+ :prefix-icon="Search"
|
|
|
|
|
+ style="width: 255px; margin-top: 11px"
|
|
|
|
|
+ />
|
|
|
|
|
+ <ul
|
|
|
|
|
+ ><li
|
|
|
|
|
+ v-for="item in workshopList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ class="workshop-list"
|
|
|
|
|
+ :class="{ 'active-workshop': activeId === item.id }"
|
|
|
|
|
+ @click="configWorkshop(item)"
|
|
|
|
|
+ >{{ item.value }}</li
|
|
|
|
|
+ ></ul
|
|
|
|
|
+ >
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div class="upload" :class="{ 'avatar-show': imageUrl }">
|
|
|
|
|
+ <el-upload
|
|
|
|
|
+ class="avatar-uploader"
|
|
|
|
|
+ list-type="picture-card"
|
|
|
|
|
+ :auto-upload="false"
|
|
|
|
|
+ :on-change="onSelectfile"
|
|
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-icon class="avatar-uploader-icon"><Plus /></el-icon>
|
|
|
|
|
+ <div class="uploader-text">上传照片</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> -->
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ <div class="upload-tip">只支持.jpg格式</div></div
|
|
|
|
|
+ >
|
|
|
|
|
+
|
|
|
|
|
+ <img v-if="imageUrl" :src="imageUrl" class="preview-image" />
|
|
|
|
|
+ <!-- <div>222</div> -->
|
|
|
|
|
+ </div></div
|
|
|
|
|
+ >
|
|
|
|
|
+ <ConfigDrawer
|
|
|
|
|
+ ref="configDrawer"
|
|
|
|
|
+ :title="configTitle"
|
|
|
|
|
+ @on-close="visibleDrawer = false"
|
|
|
|
|
+ class="drawer-position"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script lang="ts" setup>
|
|
|
|
|
+ import { ref } from 'vue';
|
|
|
|
|
+ import { Refresh, Search, Delete, Plus } from '@element-plus/icons-vue';
|
|
|
|
|
+ import ConfigDrawer from './component/ConfigDrawer.vue';
|
|
|
|
|
+ // import { picList } from '../constant';
|
|
|
|
|
+ import { labelList, companyList, workshopList } from './constant';
|
|
|
|
|
+ import { ElMessage, genFileId } from 'element-plus';
|
|
|
|
|
+ import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
|
|
|
|
|
+ // import upload, { UploadRawFile, genFileId } from 'element-plus/es/components/upload';
|
|
|
|
|
+ import { useRouter } from 'vue-router';
|
|
|
|
|
+ const router = useRouter();
|
|
|
|
|
+
|
|
|
|
|
+ const props = defineProps<{
|
|
|
|
|
+ pageShow: boolean;
|
|
|
|
|
+ // workshopTemplateList: WorkshopModuleType[];
|
|
|
|
|
+ }>();
|
|
|
|
|
+
|
|
|
|
|
+ // const emit = defineEmits<{
|
|
|
|
|
+ // // (e: 'update:modelValue'): unknown;
|
|
|
|
|
+ // (e: 'onClose'): unknown;
|
|
|
|
|
+ // }>();
|
|
|
|
|
+
|
|
|
|
|
+ const label = ref('');
|
|
|
|
|
+
|
|
|
|
|
+ const companySelet = ref('');
|
|
|
|
|
+
|
|
|
|
|
+ const searchWorkshop = ref('');
|
|
|
|
|
+
|
|
|
|
|
+ // const replacePic = () => {};
|
|
|
|
|
+ const saveConfig = () => {
|
|
|
|
|
+ // router.push('/page-config/config');
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const imageUrl = ref('');
|
|
|
|
|
+ const configDrawer = ref();
|
|
|
|
|
+
|
|
|
|
|
+ const backPage = () => {
|
|
|
|
|
+ router.push('/page-config/layout');
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const beforeAvatarUpload = (rawFile) => {
|
|
|
|
|
+ if (rawFile.type !== 'image/jpeg') {
|
|
|
|
|
+ ElMessage.error('Avatar picture must be JPG format!');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // else if (rawFile.size / 1024 / 1024 > 2) {
|
|
|
|
|
+ // ElMessage.error('Avatar picture size can not exceed 2MB!');
|
|
|
|
|
+ // return false;
|
|
|
|
|
+ // }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const onSelectfile = (uploadFile) => {
|
|
|
|
|
+ imageUrl.value = URL.createObjectURL(uploadFile.raw!);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const upload = ref<UploadInstance>();
|
|
|
|
|
+ const handleExceed: UploadProps['onExceed'] = (files) => {
|
|
|
|
|
+ upload.value!.clearFiles();
|
|
|
|
|
+ const file = files[0] as UploadRawFile;
|
|
|
|
|
+ file.uid = genFileId();
|
|
|
|
|
+ upload.value!.handleStart(file);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const activeId = ref();
|
|
|
|
|
+ const configTitle = ref();
|
|
|
|
|
+ const visibleDrawer = ref();
|
|
|
|
|
+ //编辑车间
|
|
|
|
|
+ const configWorkshop = (item) => {
|
|
|
|
|
+ configDrawer.value.openDialog();
|
|
|
|
|
+ visibleDrawer.value = true;
|
|
|
|
|
+ configTitle.value = item.value;
|
|
|
|
|
+ activeId.value = item.id;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // const label = ref('');
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+ .back-btn {
|
|
|
|
|
+ width: 32px;
|
|
|
|
|
+ height: 32px;
|
|
|
|
|
+ margin-top: 7px;
|
|
|
|
|
+ margin-right: 20px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .btn-top-refresh {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ margin-top: 19px;
|
|
|
|
|
+ right: 130px;
|
|
|
|
|
+ // left: 1437px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .btn-top-save {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ margin-top: 8px;
|
|
|
|
|
+ right: 46px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .workshop-content {
|
|
|
|
|
+ margin-top: 34px;
|
|
|
|
|
+ margin-left: 10px;
|
|
|
|
|
+ margin-right: 10px;
|
|
|
|
|
+ width: 271px;
|
|
|
|
|
+ height: 780px;
|
|
|
|
|
+ border: 1px solid #b3b3b3;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .workshop-title {
|
|
|
|
|
+ font-size: 20px;
|
|
|
|
|
+ margin-top: 15px;
|
|
|
|
|
+ margin-left: 13px;
|
|
|
|
|
+ font-weight: 900;
|
|
|
|
|
+ color: #3d3d3d;
|
|
|
|
|
+ opacity: 0.4;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .workshop-list {
|
|
|
|
|
+ font-size: 20px;
|
|
|
|
|
+ width: 211px;
|
|
|
|
|
+ margin-top: 15px;
|
|
|
|
|
+ margin-left: 13px;
|
|
|
|
|
+ font-weight: 350;
|
|
|
|
|
+ color: #3d3d3d;
|
|
|
|
|
+ opacity: 0.4;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ .active-workshop {
|
|
|
|
|
+ background: rgba(24, 144, 255, 0.502);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .avatar-uploader .el-upload {
|
|
|
|
|
+ border: 1px dashed var(--el-border-color);
|
|
|
|
|
+ border-radius: 6px;
|
|
|
|
|
+ width: 260px;
|
|
|
|
|
+ height: 280px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ color: #8c939d;
|
|
|
|
|
+ transition: var(--el-transition-duration-fast);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .avatar-uploader .el-upload:hover {
|
|
|
|
|
+ border-color: var(--el-color-primary);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .el-icon.avatar-uploader-icon {
|
|
|
|
|
+ font-size: 28px;
|
|
|
|
|
+ color: #8c939d;
|
|
|
|
|
+ width: 178px;
|
|
|
|
|
+ height: 178px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ margin-top: -60px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .upload {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 635px;
|
|
|
|
|
+ top: 201px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .upload-tip {
|
|
|
|
|
+ margin-top: 5px;
|
|
|
|
|
+ font-size: 22px;
|
|
|
|
|
+ font-weight: 350;
|
|
|
|
|
+ color: #3d3d3d;
|
|
|
|
|
+ opacity: 0.4;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .uploader-text {
|
|
|
|
|
+ margin-top: -60px;
|
|
|
|
|
+ margin-left: 50px;
|
|
|
|
|
+ font-size: 22px;
|
|
|
|
|
+ font-weight: 350;
|
|
|
|
|
+ color: #3d3d3d;
|
|
|
|
|
+ opacity: 0.4;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // .preview-container {
|
|
|
|
|
+ // width: 178px;
|
|
|
|
|
+ // height: 178px;
|
|
|
|
|
+ // position: relative;
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ .preview-image {
|
|
|
|
|
+ min-width: 100%;
|
|
|
|
|
+ min-height: 100%;
|
|
|
|
|
+ object-fit: contain;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .avatar-show {
|
|
|
|
|
+ display: none;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .drawer-position {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 1150px;
|
|
|
|
|
+ top: 80px;
|
|
|
|
|
+ z-index: 99;
|
|
|
|
|
+ opacity: 1;
|
|
|
|
|
+ background: #ffffff;
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|