feat: 0516优化

演示数据2.0
chenhc 11 months ago
parent 4249e1bdd6
commit 9e36fe67e4

@ -0,0 +1,194 @@
<template>
<div>
<el-upload
:disabled="disabledUp"
:action="uploadFileUrl"
list-type="picture-card"
:before-upload="beforeUpload"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:on-exceed="handleExceed"
:multiple="false"
:file-list="fileList"
:headers="headers"
:on-success="onSuccess"
:data="{type:this.type}"
:limit="maxFiles"
>
<i class="el-icon-plus" />
</el-upload>
<span class="msg" v-show="isShowTip">{{this.limit}},{{this.fileSize}}MB</span>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import store from "@/store";
export default {
name: 'localImageUpload',
props: {
uploadedFileNames: {
type: String,
default: '',
},
type: {
type: String,
default: "device",
},
//
maxFiles: {
type: Number,
default: 3,
},
// (MB)
fileSize: {
type: Number,
default: 5,
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
},
//
isShowTip: {
type: Boolean,
default: true
},
//
disabledUp: {
type: Boolean,
default: false
}
},
data() {
return {
BASE_URL: process.env.VUE_APP_BASE_API,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/udiwms/upload/register/file",
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [], //
dialogImageUrl: '',
dialogVisible: false,
uploadDisabled: false,
}
},
methods:{
beforeUpload(file) {
const isJPG = false;
if (this.fileType.find(type => type === file.type)) {
return true;
}
const isLt2M = file.size / 1024 / 1024 < this.fileSize;
if (!isJPG) {
let extensionsString = this.fileType.join(',');
this.$message.error('上传图片只能是【 '+extensionsString+' 】格式!');
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 ' + this.fileSize + 'MB!');
}
return isJPG && isLt2M
},
handleExceed(file, fileList) {
//
this.$message.warning(`最多可上传3张现场照片!`);
},
//
onSuccess(response, file, fileList) {
if (response.code === 20000) {
fileList[fileList.length - 1].url = this.BASE_URL + "/udiwms/image/register/file/getImage?type="+this.type+ "&name=" + response.data.name
fileList[fileList.length - 1].upName = response.data.name
this.updateUploadedFileNames(response.data.name);
if(fileList.length >=3){ this.uploadDisabled = true; }else {this.uploadDisabled = false;}
} else {
this.$message.error(response.msg)
}
this.$emit("changeComponent1Data", this.uploadedFileNames)
},
//
updateUploadedFileNames(name) {
if (this.uploadedFileNames) {
this.uploadedFileNames += ',' + name
} else {
this.uploadedFileNames = name
}
//
this.uploadedFileNames = this.uploadedFileNames.trim().replace(/(^,)|(,$)/g, '');
},
//
handleRemove(file, fileList) {
// if (!fileList.some(files => files.upName.includes(file.upName))) return;
// console.log("fileList1",fileList)
// console.log("file1",file)
// console.log("this.uploadedFileNames1",this.uploadedFileNames)
this.uploadedFileNames = ''
fileList.map((fileName) => {
//
this.uploadedFileNames += ',' + fileName.upName.trim()
return;
})
this.uploadedFileNames = this.uploadedFileNames.trim().replace(/(^,)|(,$)/g, '');
// console.log("fileList2",fileList)
// console.log("file2",file)
// console.log("this.uploadedFileNames2",this.uploadedFileNames)
// // uploadedFileNames
// const names = this.uploadedFileNames.split(',');
// names.splice(file.index, 1); // index fileList names
// this.uploadedFileNames = names.join(',');
// this.uploadedFileNames = this.uploadedFileNames.trim().replace(/(^,)|(,$)/g, '');
//
if (fileList.length >= 3) {
this.uploadDisabled = true
} else {
this.uploadDisabled = false
}
this.$emit("changeComponent1Data", this.uploadedFileNames)
},
//
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
// fileList
parseFileNames() {
//
if (this.uploadedFileNames != null && this.uploadedFileNames != '' && this.uploadedFileNames != "null"){
const fileNames = this.uploadedFileNames.split(',');
//
this.fileList = fileNames.map((fileName) => {
//
const trimmedFileName = fileName.trim();
//
return {
name: trimmedFileName,
url: this.BASE_URL + "/udiwms/image/register/file/getImage?type="+this.type+ "&name=" + trimmedFileName,
// idsizetype
// id: someUniqueIdGenerator(),
// size: 0,
// type: 'image/jpeg', //
// ...
};
});
}
},
},
created() {
this.headers = {
ADMINID: store.getters.adminId,
ADMINTOKEN: store.getters.token,
};
this.parseFileNames()
},
}
</script>
<style scoped>
</style>

@ -39,6 +39,8 @@ import Editor from "@/components/Editor";
import FileUpload from "@/components/FileUpload";
// 图片上传组件
import ImageUpload from "@/components/ImageUpload";
// 图片上传组件
import LocalImageUpload from "@/components/LocalImageUpload";
// 图片预览组件
import ImagePreview from "@/components/ImagePreview";
// 字典标签组件
@ -94,6 +96,7 @@ Vue.component("RightToolbar", RightToolbar);
Vue.component("Editor", Editor);
Vue.component("FileUpload", FileUpload);
Vue.component("ImageUpload", ImageUpload);
Vue.component("LocalImageUpload", LocalImageUpload);
Vue.component("ImagePreview", ImagePreview);
Vue.component('split-pane', splitPane);
Vue.component("cusEditor", cusEditor)

@ -8,6 +8,11 @@ export default {
props: {repairId: {require: true}},
data() {
return {
maxFiles: 3, // 允许同时上传的最大文件数
fileSizeLimit: 5, // 允许上传的文件大小限制MB
uploadedFileNames: '', // 存储已上传文件名,逗号隔开
info: null
}
},
@ -24,6 +29,13 @@ export default {
this.getInfo()
},
methods: {
/**
* 父组件处理子组件发送的数据更改
* @param params
*/
component1DataChange(params) {
this.uploadedFileNames = params;
},
getInfo() {
let load = getLoading(this)
deviceRepairInfo(this.repairId).then(res => {

@ -36,6 +36,18 @@
<el-descriptions-item label="问题描述" :label-style="{'height': '100px'}" :span="4">
{{ info.description }}
</el-descriptions-item>
<el-descriptions-item label="维修前现场图片" :span="4" label-style="height:100px">
<localImageUpload
:fileType="['image/jpeg','image/png','image/gif']"
:maxFiles= "this.maxFiles"
:fileSizeLimit="this.fileSizeLimit"
:type="deptDeviceCheck"
:uploadedFileNames="info.livePath"
:isShowTip="false"
@changeComponent1Data="component1DataChange"
></localImageUpload>
</el-descriptions-item>
<el-descriptions-item label="诊断信息" :label-style="{'height': '100px'}" :span="4">
{{ info.diagnosisInfo }}
</el-descriptions-item>

@ -293,14 +293,18 @@
maxlength="300" v-model.trim="repairRow.description"/>
</el-form-item>
</el-descriptions-item>
<!-- <el-descriptions-item label="维修方式" :span="3">-->
<!-- <el-form-item label=" " prop="innerFlag" style="margin-bottom: 0">-->
<!-- <el-radio-group v-model="repairRow.innerFlag">-->
<!-- <el-radio :label="true">内部维修</el-radio>-->
<!-- <el-radio :label="false">外部维修</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-descriptions-item>-->
<el-descriptions-item label="报修现场图片" :span="3" label-style="height:100px">
<localImageUpload
:fileType="['image/jpeg','image/png','image/gif']"
:maxFiles= "this.maxFiles"
:fileSizeLimit="this.fileSizeLimit"
:type="deptDeviceCheck"
:uploadedFileNames="this.uploadedFileNames"
:isShowTip="false"
@changeComponent1Data="component1DataChange"
></localImageUpload>
</el-descriptions-item>
<!-- <el-descriptions-item label="维修部门" :span="3">-->
<!-- <el-form-item label=" " prop="repairDeptCode" style="margin-bottom: 10px">-->
<!-- <deptSelect :value.sync="repairRow.repairDeptCode" :maintenance="true" placeholder="请选择报修部门" />-->
@ -348,8 +352,6 @@
</el-dialog>
<el-dialog
visible
v-if="applyId"
@ -384,6 +386,18 @@
maxlength="300" v-model.trim="selectRepairRow.description"/>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="报修现场图片" :span="3" label-style="height:100px">
<localImageUpload
:fileType="['image/jpeg','image/png','image/gif']"
:maxFiles= "this.maxFiles"
:fileSizeLimit="this.fileSizeLimit"
:type="deptDeviceCheck"
:uploadedFileNames="selectRepairRow.livePath"
:isShowTip="false"
@changeComponent1Data="component1DataChange"
></localImageUpload>
</el-descriptions-item>
<el-descriptions-item label="报修人电话" :span="3">
<el-form-item label=" " prop="repairUserPhone" style="margin-bottom: 10px">
<el-input v-model.trim="selectRepairRow.repairUserPhone" placeholder="请输入报修人电话"/>
@ -462,6 +476,10 @@ export default {
},
data() {
return {
maxFiles: 3, //
fileSizeLimit: 5, // MB
uploadedFileNames: '', //
clickRow: null,
showSearch: true,
loading: false,
@ -534,6 +552,13 @@ watch: {
}
},
methods: {
/**
* 父组件处理子组件发送的数据更改
* @param params
*/
component1DataChange(params) {
this.uploadedFileNames = params;
},
applyIdSelect(row){
this.applyId = row.applyId;
//
@ -563,7 +588,8 @@ watch: {
}
pData.details.push({
deviceCode: this.repairRow.deviceCode,
description: this.repairRow.description
description: this.repairRow.description,
livePath: this.uploadedFileNames
})
pData.applyUserPhone = this.repairRow.repairUserPhone
pData.taskId = this.repairRow.taskId
@ -584,6 +610,7 @@ watch: {
},
createRepair(row) {
let data = copyProperties(row, {...repairData});
this.uploadedFileNames = ""
this.repairRow = _.extend({}, row, data)
},
commitItemCheck() {
@ -631,6 +658,7 @@ watch: {
closeCheckDialog() {
this.checkTipDialogVisible = false
this.getList()
this.getDetailItemList()
},

@ -57,30 +57,16 @@
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="现场图片" :span="2" label-style="height:100px">
<el-upload
multiple
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="fileList"
:limit="limit"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
:show-file-list="false"
:headers="headers"
class="upload-file-uploader"
ref="fileUpload"
>
<!-- 上传按钮 -->
<el-button size="mini" type="primary">选取文件</el-button>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b></template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
的文件
</div>
</el-upload>
<localImageUpload
:fileType="['image/jpeg','image/png','image/gif']"
:maxFiles= "this.maxFiles"
:fileSizeLimit="this.fileSizeLimit"
:type="deptDeviceCheck"
:uploadedFileNames="this.uploadedFileNames"
:isShowTip="false"
@changeComponent1Data="component1DataChange"
></localImageUpload>
</el-descriptions-item>
<el-descriptions-item label="巡检结果" :span="2">
<el-form-item label=" " prop="normalFlag" style="margin-bottom: 0px">
@ -130,6 +116,10 @@ export default {
},
data() {
return {
maxFiles: 3, //
fileSizeLimit: 5, // MB
uploadedFileNames: '', //
itemRow: {},
itemLoading: false,
itemList: [],
@ -142,7 +132,14 @@ export default {
}
},
methods: {
commitItemCheck() {
/**
* 父组件处理子组件发送的数据更改
* @param params
*/
component1DataChange(params) {
this.uploadedFileNames = params;
},
commitItemCheck() {
this.$refs.itemForm.validate(b => {
if (!b) {
return
@ -159,7 +156,8 @@ export default {
deviceCode: this.itemRow.deviceCode,
suggestion: this.itemRow.suggestion,
normalFlag: this.itemRow.normalFlag,
detailItemEntities: this.itemList
detailItemEntities: this.itemList,
livePath: this.uploadedFileNames
}
deviceCheckDetailFinish(itemParam).then(res => {
load.close()
@ -199,10 +197,10 @@ export default {
this.itemRow = this.originData
this.itemQuery = {...itemQuery, deviceCode: this.itemRow.deviceCode, taskId: this.itemRow.taskId}
this.getDetailItemList()
this.uploadedFileNames = this.itemRow.livePath
},
}
</script>
<style scoped>
/* 假设你想要更改表格的字体大小 */

@ -13,6 +13,20 @@
<el-input v-model="query.productName" clearable/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="设备状态">
<el-select v-model="query.status"
style="width: 90%"
clearable>
<el-option
v-for="item in deviceStatus"
:key="item.key"
:label="item.desc"
:value="item.key">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
@ -70,15 +84,22 @@
import {deviceDetailInfo} from "@/api/dev/deviceInfoApi";
import {getLoading} from "@/utils";
import {devicePlanDetailAdd} from "@/api/dev/devicePlanDetailApi";
import { deviceStatus} from "@/utils/enum";
let query = {
page: 1,
limit: 10,
productName: null,
status: "NORMAL",
deviceCode: null,
planId: null,
}
export default {
computed: {
deviceStatus() {
return deviceStatus
},
},
name: "deviceAdd",
props: {
planId: {required: true},

@ -133,12 +133,38 @@
<el-descriptions-item label="问题描述" :label-style="{'height': '100px'}" :span="4">
{{ currentRow.description }}
</el-descriptions-item>
<el-descriptions-item label="维修前现场图片" :span="4" label-style="height:100px">
<localImageUpload
:fileType="['image/jpeg','image/png','image/gif']"
:maxFiles= "this.maxFiles"
:fileSizeLimit="this.fileSizeLimit"
:type="deptDeviceCheck"
:uploadedFileNames="currentRow.livePath"
:isShowTip="false"
:disabledUp="true"
@changeComponent1Data="component1DataChange"
></localImageUpload>
</el-descriptions-item>
<el-descriptions-item label="诊断信息" :label-style="{'height': '100px'}" :span="4">
{{ currentRow.diagnosisInfo }}
</el-descriptions-item>
<el-descriptions-item label="维修内容" :label-style="{'height': '100px'}" :span="4" >
<el-input type="textarea" resize="none" :autosize="{ minRows: 4, maxRows: 4 }" clearable v-model.trim="currentRow.repairDescription" :disabled="currentRow.finishFlag"></el-input>
</el-descriptions-item>
<el-descriptions-item label="维修后现场图片" :span="4" label-style="height:100px">
<localImageUpload
:fileType="['image/jpeg','image/png','image/gif']"
:maxFiles= "this.maxFiles"
:fileSizeLimit="this.fileSizeLimit"
:type="deptDeviceCheck"
:uploadedFileNames="currentRow.serviceLivePath"
:isShowTip="false"
:disabledUp="currentRow.finishFlag"
@changeComponent1Data="component1DataChange"
></localImageUpload>
</el-descriptions-item>
</el-descriptions>
</el-card>
</el-dialog>

@ -16,6 +16,10 @@ export default {
name: "deviceRepair",
data() {
return {
maxFiles: 3, // 允许同时上传的最大文件数
fileSizeLimit: 5, // 允许上传的文件大小限制MB
uploadedFileNames: '', // 存储已上传文件名,逗号隔开
showSearch: true,
loading: false,
finishFlag: false,
@ -31,6 +35,13 @@ export default {
this.getList()
},
methods: {
/**
* 父组件处理子组件发送的数据更改
* @param params
*/
component1DataChange(params) {
this.currentRow.serviceLivePath = params;
},
finishFuncFlag(row){
this.finishFlag = true
this.currentRow = row

Loading…
Cancel
Save