|
@@ -1,72 +1,92 @@
|
|
|
<template>
|
|
|
- <el-dialog v-loading.fullscreen.lock="fullscreenLoading" :close-on-click-modal = "false"
|
|
|
+ <el-dialog class="resultDiv" @mouseenter="handleEnter" @paste="(e)=>handlePase(e)" v-loading.fullscreen.lock="fullscreenLoading" :close-on-click-modal = "false"
|
|
|
v-model="outerVisible" title="任务结果" width="600">
|
|
|
<el-form :model="sumbitForm" label-width="auto" ref="workDetailForm" style="max-width: 600px">
|
|
|
- <div v-if="handlerId !== useUserStore().user.userId && (sumbitForm.recordStatus === 3 || sumbitForm.recordStatus === 4) ">
|
|
|
- <el-form-item>
|
|
|
- 任务结果:{{sumbitForm.resultStatus === 2?'暂停办理':sumbitForm.resultStatus === 0?'终止任务':'完成任务'}}
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
+ <div v-if="falg">
|
|
|
+ <el-form-item>
|
|
|
+ 任务结果:{{sumbitForm.resultStatus === 2?'暂停办理':sumbitForm.resultStatus === 0?'终止任务':'完成任务'}}
|
|
|
+ </el-form-item>
|
|
|
</div>
|
|
|
- <el-form-item v-if="handlerId === useUserStore().user.userId" prop="resultStatus" label="任务结果">
|
|
|
- <div v-if="sumbitForm.recordStatus === 3 || sumbitForm.recordStatus === 4 ">
|
|
|
- {{sumbitForm.resultStatus === 2?'暂停办理':sumbitForm.resultStatus === 0?'终止任务':'完成任务'}}
|
|
|
- </div>
|
|
|
- <div v-else>
|
|
|
- <el-select
|
|
|
- v-model="sumbitForm.resultStatus"
|
|
|
- placeholder="任务结果"
|
|
|
- size="large"
|
|
|
- style="width: 240px"
|
|
|
- :disabled ="formHidden ==3"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in selectStatus"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if=" handlerId === useUserStore().user.userId">
|
|
|
- <el-upload
|
|
|
- v-if="formHidden !==3 && formHidden !==4"
|
|
|
- ref="upload"
|
|
|
- class="upload-demo"
|
|
|
- style="flex: auto;"
|
|
|
- drag
|
|
|
- action=""
|
|
|
- v-model:file-list="fileList"
|
|
|
- :multiple="false"
|
|
|
- :auto-upload="false"
|
|
|
- :before-upload="handleBeforeUpload"
|
|
|
- :http-request="httpRequest"
|
|
|
- >
|
|
|
- <el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
- <div class="el-upload__text">
|
|
|
- 将文件拖入此处, <em>或点击上传</em>
|
|
|
+ <div v-else>
|
|
|
+ <el-form-item v-if="handlerId === useUserStore().user.userId" prop="resultStatus" label="任务结果">
|
|
|
+ <div>
|
|
|
+ <el-select
|
|
|
+ v-model="sumbitForm.resultStatus"
|
|
|
+ placeholder="任务结果"
|
|
|
+ size="large"
|
|
|
+ style="width: 240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in selectStatus"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</div>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div class="imgClass" v-if="falg">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col v-for="(o, index) in filesTable" :key="o.id" :span="8"
|
|
|
+ style="margin-bottom: 10px; position: relative">
|
|
|
+ <el-card :body-style="{ padding: '0px' }">
|
|
|
+ <!-- <img :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px" @click="handleImageView(o.fileUrl)" /> -->
|
|
|
+ <el-image :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px"
|
|
|
+ :preview-teleported="true" fit="contain" :preview-src-list="preList" :initial-index="index"
|
|
|
+ />
|
|
|
|
|
|
- </el-upload>
|
|
|
- </el-form-item>
|
|
|
- <el-table v-if="(sumbitForm.recordStatus === 3 || sumbitForm.recordStatus === 4)" ref="Table" :data="filesTable" size="small" height="100%" border
|
|
|
- header-row-class-name="list-header-row">
|
|
|
- <el-table-column type="index" label="序号" width="47" align="center" />
|
|
|
- <el-table-column label="文件名" prop="originalFileName" align="center">
|
|
|
- <template #default="scope">
|
|
|
- <el-link :href="`${baseUrl}${scope.row.fileUrl}`" :underline="false" target="_blank"
|
|
|
- type="primary">
|
|
|
- {{ scope.row.originalFileName }}
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div ref="uploadDiv" v-else>
|
|
|
+ <el-form-item v-if="handlerId === useUserStore().user.userId">
|
|
|
+ <el-upload
|
|
|
+ v-if="formHidden !==3 "
|
|
|
+ v-show="uploadHidden"
|
|
|
+ ref="upload"
|
|
|
+ class="upload-demo"
|
|
|
+ style="flex: auto;"
|
|
|
+ drag
|
|
|
+ action=""
|
|
|
+ accept=".jpg,.jpeg,.png,.gif,.webp"
|
|
|
+ v-model:file-list="fileList"
|
|
|
+ :multiple="true"
|
|
|
+ :auto-upload="false"
|
|
|
+ :before-upload="handleBeforeUpload"
|
|
|
+ :http-request="httpRequest"
|
|
|
+ >
|
|
|
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ 将文件拖入此处, <em>或点击上传</em>(文件可以多选)
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ <el-col v-show="!uploadHidden" :span="24">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col v-for="(o, index) in fileEntityList" :key="o.id" :span="8"
|
|
|
+ style="margin-bottom: 10px; position: relative">
|
|
|
+ <el-card :body-style="{ padding: '0px' }">
|
|
|
+ <!-- <img :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px" @click="handleImageView(o.fileUrl)" /> -->
|
|
|
+ <el-image :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px"
|
|
|
+ :preview-teleported="true" fit="contain" :preview-src-list="viewList" :initial-index="index"
|
|
|
+ />
|
|
|
+ <Delete style="width: 130px; height: 20px;" />
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ <input type="text" style="opacity: 0" ref="fileIpt">
|
|
|
+ </div>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="outerVisible = false">关闭</el-button>
|
|
|
- <el-button type="primary" v-if="handlerId === useUserStore().user.userId && (formHidden !== 3 && formHidden !==4)" v-hasPermi="['business:production:onceWork:finished']" @click="onsumbit">提交</el-button>
|
|
|
+ <el-button type="primary" v-if="!falg && handlerId === useUserStore().user.userId" v-hasPermi="['business:production:onceWork:finished']" @click="onsumbit">提交</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
@@ -75,11 +95,11 @@
|
|
|
import {ElButton, ElTable} from "element-plus";
|
|
|
import {ref} from "@vue/reactivity";
|
|
|
import { uploadFile } from "@/api/tool/file";
|
|
|
-import {defineProps, getCurrentInstance, reactive, toRefs} from "vue";
|
|
|
+import {defineProps, getCurrentInstance, onMounted, reactive, toRefs} from "vue";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
import {
|
|
|
updateRecordStatus,
|
|
|
- FileList
|
|
|
+ FileList,uploadFiles
|
|
|
} from "@/api/business/production/onceWorkOrder";
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const props = defineProps({
|
|
@@ -89,7 +109,8 @@ const props = defineProps({
|
|
|
},
|
|
|
});
|
|
|
const { getList } = toRefs(props);
|
|
|
-
|
|
|
+const uploadDiv = ref(null);
|
|
|
+const fileIpt = ref(null);
|
|
|
const fileList = ref([]);
|
|
|
const outerVisible = ref(false);
|
|
|
const currentRow = ref();
|
|
@@ -100,10 +121,18 @@ const filesTable = ref<Ifile[]>();
|
|
|
const handlerId = ref();
|
|
|
const tenantId = ref();
|
|
|
const formHidden = ref();
|
|
|
+const preList = ref([]);
|
|
|
+const pasteList =ref([]);
|
|
|
+const uploadHidden = ref(true);
|
|
|
+const fileEntityList = ref([]);
|
|
|
+const viewList = ref([]);
|
|
|
+//真为查看,假为编辑
|
|
|
+const falg = ref(false);
|
|
|
let refile = null;
|
|
|
let fileEntity = {};
|
|
|
|
|
|
interface Ifile{
|
|
|
+ id?:number;
|
|
|
fileName?:string;
|
|
|
url?:string;
|
|
|
originalFileName?:string;
|
|
@@ -129,14 +158,15 @@ const data = reactive({
|
|
|
|
|
|
],
|
|
|
});
|
|
|
-
|
|
|
+const count = ref(1);
|
|
|
+const sumbitCount = ref(1);
|
|
|
const { selectStatus } = toRefs(data);
|
|
|
|
|
|
|
|
|
const form = reactive({
|
|
|
- recordStatus:0,
|
|
|
- file:Blob,
|
|
|
- resultStatus:-1
|
|
|
+ recordStatus:0,
|
|
|
+ file:Blob,
|
|
|
+ resultStatus:-1
|
|
|
})
|
|
|
type Tform = typeof form;
|
|
|
const sumbitForm = reactive<Tform>({
|
|
@@ -145,6 +175,7 @@ const sumbitForm = reactive<Tform>({
|
|
|
resultStatus:null
|
|
|
});
|
|
|
const httpRequest = (parm) => {
|
|
|
+ let fileEntity = {};
|
|
|
const formData2 = new FormData();
|
|
|
formData2.append("file", parm.file);
|
|
|
// const formData = new FormData();
|
|
@@ -158,61 +189,58 @@ const httpRequest = (parm) => {
|
|
|
fileEntity.originalFileName = res.originalFilename;
|
|
|
fileEntity.fileUrl = res.fileName;
|
|
|
}
|
|
|
- updateRecordStatus(workOrderId.value,sumbitForm.resultStatus,fileEntity).then(response => {
|
|
|
- proxy.$alert(
|
|
|
- "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
- "提交完成" +
|
|
|
- "</div>",
|
|
|
- { dangerouslyUseHTMLString: true }
|
|
|
- );
|
|
|
- fileEntity= {};
|
|
|
- FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
|
|
|
- filesTable.value = response.data
|
|
|
- })
|
|
|
- //outerVisible.value = false;
|
|
|
- //getList.value();
|
|
|
- })
|
|
|
+ fileEntityList.value.push(fileEntity);
|
|
|
}).then((res) => {
|
|
|
proxy.$refs['upload'].clearFiles();
|
|
|
}).catch((err) => {
|
|
|
proxy.$refs['upload'].clearFiles();
|
|
|
})
|
|
|
}
|
|
|
-function openView(id,status,userId,resultStatus){
|
|
|
+function openView(id,status,userId,resultStatus,view){
|
|
|
outerVisible.value = true;
|
|
|
+ uploadHidden.value = true;
|
|
|
workOrderId.value = id;
|
|
|
sumbitForm.recordStatus = status;
|
|
|
sumbitForm.resultStatus = resultStatus;
|
|
|
sumbitForm.file = null;
|
|
|
formHidden.value = status;
|
|
|
+ falg.value = view;
|
|
|
fileEntity.fileName = null;
|
|
|
fileEntity.url = null;
|
|
|
fileEntity.originalFileName = null;
|
|
|
fileEntity.fileUrl = null;
|
|
|
handlerId.value = userId;
|
|
|
filesTable.value = null;
|
|
|
+ pasteList.value =[];
|
|
|
+ fileEntityList.value = [];
|
|
|
FileList({"masterTableName":"biz_work_order_record","masterId":id}).then((response) => {
|
|
|
filesTable.value = response.data
|
|
|
+ filesTable.value.forEach((file)=>{
|
|
|
+ preList.value.push(baseUrl+file.fileUrl)
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
const onsumbit = () => {
|
|
|
- console.log(sumbitForm.resultStatus)
|
|
|
+
|
|
|
if(sumbitForm.resultStatus != -1){
|
|
|
- if(fileList.value.length===0){
|
|
|
- updateRecordStatus(workOrderId.value,sumbitForm.resultStatus,fileEntity).then(response => {
|
|
|
- proxy.$alert(
|
|
|
- "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
- "提交完成" +
|
|
|
- "</div>",
|
|
|
- { dangerouslyUseHTMLString: true }
|
|
|
- );
|
|
|
- outerVisible.value = false;
|
|
|
- fileEntity= {};
|
|
|
- FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
|
|
|
- filesTable.value = response.data
|
|
|
+ updateRecordStatus(workOrderId.value,sumbitForm.resultStatus).then(response => {
|
|
|
+ proxy.$alert(
|
|
|
+ "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
+ "提交完成" +
|
|
|
+ "</div>",
|
|
|
+ { dangerouslyUseHTMLString: true }
|
|
|
+ );
|
|
|
+ outerVisible.value = false;
|
|
|
+ fileEntity= {};
|
|
|
+ console.log(fileEntityList.value);
|
|
|
+ uploadFiles(workOrderId.value,fileEntityList.value);
|
|
|
+ FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
|
|
|
+ filesTable.value = response.data
|
|
|
+ filesTable.value.forEach((file)=>{
|
|
|
+ preList.value.push(baseUrl+file.fileUrl)
|
|
|
})
|
|
|
})
|
|
|
- }
|
|
|
+ })
|
|
|
}else{
|
|
|
proxy.$alert(
|
|
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
@@ -221,7 +249,11 @@ const onsumbit = () => {
|
|
|
{ dangerouslyUseHTMLString: true }
|
|
|
);
|
|
|
}
|
|
|
- proxy.$refs['upload'].submit()
|
|
|
+ if(fileList.value.length > 0){
|
|
|
+ proxy.$refs['upload'].submit()
|
|
|
+ }if(pasteList.value.length > 0) {
|
|
|
+ //uploadFiles(workOrderId.value,fileEntityList)
|
|
|
+ }
|
|
|
getList.value();
|
|
|
outerVisible.value = false;
|
|
|
}
|
|
@@ -231,11 +263,59 @@ function handleBeforeUpload(file) {
|
|
|
// formData.append("file", file);
|
|
|
|
|
|
}
|
|
|
+const handlePase = (e)=>{
|
|
|
+ pasteList.value = [];
|
|
|
+ for(let i =0 ;i<e.clipboardData.files.length;i++){
|
|
|
+ pasteList.value.push(e.clipboardData.files[i])
|
|
|
+
|
|
|
+ }
|
|
|
+ if(pasteList.value.length > 0) {
|
|
|
+ pasteList.value.forEach((file)=>{
|
|
|
+ const formData2 = new FormData();
|
|
|
+ formData2.append("file", file);
|
|
|
+ uploadFile(formData2).then((res) => {
|
|
|
+ let fileEntity = {};
|
|
|
+ if (res.code === 200) {
|
|
|
+ fileEntity.id = res.id;
|
|
|
+ fileEntity.fileName = res.newFileName;
|
|
|
+ fileEntity.url = res.url;
|
|
|
+ fileEntity.originalFileName = res.originalFilename;
|
|
|
+ fileEntity.fileUrl = res.fileName;
|
|
|
+ }
|
|
|
+ viewList.value.push(`${baseUrl}+${res.url}`);
|
|
|
+ fileEntityList.value.push(fileEntity);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
|
|
|
+ // filesTable.value = response.data
|
|
|
+ // filesTable.value.forEach((file)=>{
|
|
|
+ // preList.value.push(baseUrl+file.fileUrl)
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ uploadHidden.value = false;
|
|
|
+}
|
|
|
+const handleEnter = ()=>{
|
|
|
+ fileIpt.value.focus();
|
|
|
+ //document.getElementsByClassName("resultDiv")[0].click();
|
|
|
+}
|
|
|
defineExpose({
|
|
|
openView,
|
|
|
});
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
-
|
|
|
+.imgClass{
|
|
|
+ display: flex;
|
|
|
+ .el-image{
|
|
|
+ background: #1f2d3d;
|
|
|
+ margin: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.inputClass{
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ opacity: 0;
|
|
|
+}
|
|
|
|
|
|
</style>
|