|
@@ -31,6 +31,29 @@
|
|
|
<img w-full :src="dialogImageUrl" alt="Preview Image" />
|
|
<img w-full :src="dialogImageUrl" alt="Preview Image" />
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item class="pic-form-item" label="问题视频:" prop="videos">
|
|
|
|
|
+ <p>(仅支持上传1条视频,大小50M以内)</p>
|
|
|
|
|
+ <el-upload v-if="formData.videos === undefined || formData.videos.length === 0" class="avatar-uploader"
|
|
|
|
|
+ action="/skyeye-admin-api/issue/uploadPicture" :show-file-list="false" :on-success="handleUploadVideo"
|
|
|
|
|
+ :headers="getHeaders()" :data="{ bizType: 'PROBLEM_REPORT' }" :before-upload="beforeUploadVideo">
|
|
|
|
|
+ <el-icon class="avatar-uploader-icon">
|
|
|
|
|
+ <Plus />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ <div class="upload-success" v-else>
|
|
|
|
|
+ <img src="@/assets/images/alert/video-play.png" @click="videoDialogVisible = true"
|
|
|
|
|
+ style="cursor: pointer;" />
|
|
|
|
|
+ <el-icon class="clear-video" @click="handleDeleteVideo" :size="15" color="#fff">
|
|
|
|
|
+ <CloseBold />
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ <el-dialog v-model="videoDialogVisible">
|
|
|
|
|
+ <video type="video/mp4" muted="true" preload="auto" :controls="true" autoplay
|
|
|
|
|
+ style="height: 500px;object-fit: fill;">
|
|
|
|
|
+ <source :src="formData.videos![0]" />
|
|
|
|
|
+ </video>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="问题地点:" prop="workspaceId" :rules="{ required: true, message: '请完成必填项' }">
|
|
<el-form-item label="问题地点:" prop="workspaceId" :rules="{ required: true, message: '请完成必填项' }">
|
|
|
<el-cascader v-model="workLocation" :options="locationOptions" :props="location" placeholder="请选择问题地点"
|
|
<el-cascader v-model="workLocation" :options="locationOptions" :props="location" placeholder="请选择问题地点"
|
|
|
clearable @change="handleCascaderChange" />
|
|
clearable @change="handleCascaderChange" />
|
|
@@ -57,8 +80,8 @@
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { computed, onBeforeMount, onMounted, reactive, ref } from 'vue';
|
|
import { computed, onBeforeMount, onMounted, reactive, ref } from 'vue';
|
|
|
-import type { FormInstance, UploadProps, UploadUserFile } from 'element-plus';
|
|
|
|
|
-import { Plus } from '@element-plus/icons-vue';
|
|
|
|
|
|
|
+import { ElMessage, type FormInstance, type UploadProps, type UploadUserFile } from 'element-plus';
|
|
|
|
|
+import { Plus, CloseBold } from '@element-plus/icons-vue';
|
|
|
import { IssueState, sourceOptions, issueStateOptionsAdd } from './constant.question';
|
|
import { IssueState, sourceOptions, issueStateOptionsAdd } from './constant.question';
|
|
|
import { useIssueType } from '../../hooks/useIssueType';
|
|
import { useIssueType } from '../../hooks/useIssueType';
|
|
|
import { useWorkLocation } from '../../hooks/useWorkLocation';
|
|
import { useWorkLocation } from '../../hooks/useWorkLocation';
|
|
@@ -79,6 +102,7 @@ interface FormModel {
|
|
|
issueType?: number, // 类型
|
|
issueType?: number, // 类型
|
|
|
description?: string, // 描述
|
|
description?: string, // 描述
|
|
|
pictures?: string[], // 图片
|
|
pictures?: string[], // 图片
|
|
|
|
|
+ videos?: string[],
|
|
|
workshopId?: number, // 车间id
|
|
workshopId?: number, // 车间id
|
|
|
workshopName?: string,
|
|
workshopName?: string,
|
|
|
workspaceId?: number, // 工位id
|
|
workspaceId?: number, // 工位id
|
|
@@ -101,6 +125,7 @@ const formData = reactive<FormModel>({
|
|
|
issueType: undefined,
|
|
issueType: undefined,
|
|
|
description: '',
|
|
description: '',
|
|
|
pictures: [],
|
|
pictures: [],
|
|
|
|
|
+ videos: [],
|
|
|
workshopId: undefined,
|
|
workshopId: undefined,
|
|
|
workspaceId: undefined,
|
|
workspaceId: undefined,
|
|
|
createdAt: '',
|
|
createdAt: '',
|
|
@@ -110,6 +135,7 @@ const formData = reactive<FormModel>({
|
|
|
const location = { expandTrigger: 'hover' as const };
|
|
const location = { expandTrigger: 'hover' as const };
|
|
|
const workLocation = ref<[number | undefined, number | undefined] | []>([]);
|
|
const workLocation = ref<[number | undefined, number | undefined] | []>([]);
|
|
|
|
|
|
|
|
|
|
+
|
|
|
const handleSelectChange = () => {
|
|
const handleSelectChange = () => {
|
|
|
formData.issueType = undefined;
|
|
formData.issueType = undefined;
|
|
|
};
|
|
};
|
|
@@ -142,10 +168,11 @@ const handleCopyData = () => {
|
|
|
formData.issueType = props.initialData?.issueType;
|
|
formData.issueType = props.initialData?.issueType;
|
|
|
formData.description = props.initialData?.description;
|
|
formData.description = props.initialData?.description;
|
|
|
formData.pictures = props.initialData?.pictures;
|
|
formData.pictures = props.initialData?.pictures;
|
|
|
|
|
+ formData.videos = props.initialData?.videos;
|
|
|
formData.workshopId = props.initialData?.workshopId;
|
|
formData.workshopId = props.initialData?.workshopId;
|
|
|
formData.workspaceId = props.initialData?.workspaceId;
|
|
formData.workspaceId = props.initialData?.workspaceId;
|
|
|
formData.createdAt = props.initialData?.createdAt;
|
|
formData.createdAt = props.initialData?.createdAt;
|
|
|
- console.log(props.initialData?.issueState);
|
|
|
|
|
|
|
+
|
|
|
switch (props.initialData?.issueState) {
|
|
switch (props.initialData?.issueState) {
|
|
|
case IssueState.toAuth0:
|
|
case IssueState.toAuth0:
|
|
|
formData.issueState = 2;
|
|
formData.issueState = 2;
|
|
@@ -163,7 +190,6 @@ const handleCopyData = () => {
|
|
|
formData.issueState = props.initialData?.issueState;
|
|
formData.issueState = props.initialData?.issueState;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- console.log(formData.issueState);
|
|
|
|
|
|
|
|
|
|
workLocation.value = [props.initialData?.workshopId, props.initialData?.workspaceId!];
|
|
workLocation.value = [props.initialData?.workshopId, props.initialData?.workspaceId!];
|
|
|
fileList.value = props.initialData?.pictures?.map(str => ({ name: str, url: str })) || [];
|
|
fileList.value = props.initialData?.pictures?.map(str => ({ name: str, url: str })) || [];
|
|
@@ -208,6 +234,26 @@ const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
|
|
dialogVisible.value = true;
|
|
dialogVisible.value = true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 视频上传
|
|
|
|
|
+const videoDialogVisible = ref(false);
|
|
|
|
|
+const handleUploadVideo = (res) => {
|
|
|
|
|
+ if (!formData.videos) formData.videos = [];
|
|
|
|
|
+ formData.videos.push(res.data.url);
|
|
|
|
|
+};
|
|
|
|
|
+const handleDeleteVideo = () => {
|
|
|
|
|
+ formData.videos = [];
|
|
|
|
|
+}
|
|
|
|
|
+const beforeUploadVideo: UploadProps['beforeUpload'] = (rawFile) => {
|
|
|
|
|
+ if (rawFile.type !== 'video/mp4') {
|
|
|
|
|
+ ElMessage.error('上传视频仅支持mp4格式');
|
|
|
|
|
+ return false
|
|
|
|
|
+ } else if (rawFile.size / 1024 / 1024 > 50) {
|
|
|
|
|
+ ElMessage.error('上传视频大小不能超过50MB');
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ return true
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
handleCopyData();
|
|
handleCopyData();
|
|
|
});
|
|
});
|
|
@@ -248,10 +294,62 @@ onBeforeMount(() => {
|
|
|
:deep(.el-form-item__content) {
|
|
:deep(.el-form-item__content) {
|
|
|
display: block;
|
|
display: block;
|
|
|
}
|
|
}
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+p {
|
|
|
|
|
+ font-size: 10px;
|
|
|
|
|
+ color: #A8ABB2;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+:deep(.avatar-uploader .el-upload) {
|
|
|
|
|
+ border: 1px dashed #cdd0d6;
|
|
|
|
|
+ border-radius: 6px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ transition: var(--el-transition-duration-fast);
|
|
|
|
|
+ background-color: #fafafa;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+:deep(.avatar-uploader .el-upload:hover) {
|
|
|
|
|
+ border-color: var(--el-color-primary);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.el-icon.avatar-uploader-icon {
|
|
|
|
|
+ font-size: 28px;
|
|
|
|
|
+ color: #909399;
|
|
|
|
|
+ width: 148px;
|
|
|
|
|
+ height: 148px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.upload-success {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+
|
|
|
|
|
+ .clear-video {
|
|
|
|
|
+ width: 25px;
|
|
|
|
|
+ height: 25px;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ left: 129px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ background-color: #000;
|
|
|
|
|
+ border-radius: 0 0 0 25px;
|
|
|
|
|
+ opacity: 0.7;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-dialog) {
|
|
|
|
|
+ width: 960px;
|
|
|
|
|
+ height: 540px;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ background-color: #000;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- p {
|
|
|
|
|
- font-size: 10px;
|
|
|
|
|
- color: #A8ABB2;
|
|
|
|
|
|
|
+ :deep(.el-dialog__header) {
|
|
|
|
|
+ display: none;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|