From fcb6cfdbdb5fbce7d02d8513719237e65a72f474 Mon Sep 17 00:00:00 2001 From: odc.xiaohui <xiaohui@Q1> Date: 星期四, 09 三月 2023 16:45:20 +0800 Subject: [PATCH] 修改报案人材料图片 --- src/views/common/Audit.vue | 112 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 82 insertions(+), 30 deletions(-) diff --git a/src/views/common/Audit.vue b/src/views/common/Audit.vue index b8f503c..871ebd2 100644 --- a/src/views/common/Audit.vue +++ b/src/views/common/Audit.vue @@ -28,11 +28,10 @@ <el-button type="primary" @click="addAduitDialogOpen">娣诲姞</el-button> </el-form-item> <el-form-item> - <el-upload name="multipartFile" class="upload-demo" action="/api/cause/reporterUpload" - :show-file-list="false" :before-upload="beforeAvatarUpload" - :on-success="reporterRespond" :limit="1"> - <el-button type="primary">瀵煎叆</el-button> - </el-upload> + <el-upload name="multipartFile" class="upload-demo" action="/api/report/reporterUpload" + :show-file-list="false" :before-upload="beforeAvatarUpload" :on-success="reporterRespond" :limit="1"> +<!-- <el-button type="primary">瀵煎叆</el-button>--> + </el-upload> </el-form-item> </el-form> </template> @@ -87,13 +86,13 @@ <el-row :gutter="15"> <el-form ref="addAduitForm" :model="auditFrom" :rules="rules" size="medium" label-width="100px"> <el-col :span="12"> - <!-- <el-form-item label="澶村儚" prop="pic" required> + <el-form-item label="澶村儚" prop="pic" required> <el-upload ref="pic" action="/api/minio/upload" :show-file-list="false" :on-success="handleAvatarSuccess" - list-type="picture-card" accept="image/*"> + list-type="picture-card" accept="image/*"> <img v-if="picShow" :src="picShow" style="width: 145px;height: 145px"> <i v-else class="el-icon-plus"></i> </el-upload> - </el-form-item> --> + </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="鎶ユ浜� " prop="reporterName"> @@ -115,8 +114,9 @@ </el-col> <el-col :span="12"> <el-form-item label="琚獥鏃堕棿" prop="cheatTime"> - <el-date-picker v-model="auditFrom.cheatTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" :style="{ width: '100%' }" - format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker> + <el-date-picker v-model="auditFrom.cheatTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" + :style="{ width: '100%' }" format="yyyy-MM-dd HH:mm:ss" + value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker> </el-form-item> </el-col> <el-col :span="12"> @@ -127,7 +127,8 @@ </el-col> <el-col :span="24"> <el-form-item label="妗堜欢鎻忚堪" prop="reportDescription"> - <el-input v-model="auditFrom.reportDescription" placeholder="璇疯緭鍏ユ浠舵弿杩�" clearable :style="{ width: '100%' }"> + <el-input v-model="auditFrom.reportDescription" placeholder="璇疯緭鍏ユ浠舵弿杩�" clearable + :style="{ width: '100%' }"> </el-input> </el-form-item> </el-col> @@ -138,7 +139,7 @@ </el-form-item> </el-col> <el-col :span="24"> - <el-form-item label="涓婁紶" prop="fileList" > + <el-form-item label="涓婁紶" prop="fileList"> <el-upload ref="reportMaterials" :file-list="auditFrom.fileList" action="/api/minio/upload" list-type="picture" :on-success="handleMaterialSuccess"> <el-button size="small" type="primary" icon="el-icon-upload">鐐瑰嚮涓婁紶</el-button> @@ -164,7 +165,7 @@ <!--瀹℃牳寮圭獥--> <el-dialog title="瀹℃牳" :visible.sync="checkVisible" width="50%" :before-close="infoAduitClose"> <el-row :gutter="15"> - <el-form ref="infoAduitForm" :model="auditInfo" size="medium" label-width="100px"> + <el-form ref="infoAduitForm" :rules="rules2" :model="auditInfo" size="medium" label-width="100px"> <el-col :span="12"> <el-form-item label="澶村儚" prop="pic" required> <el-upload ref="pic" action="/api/minio/upload" :show-file-list="false" :on-success="handleAvatarSuccess" @@ -193,8 +194,9 @@ </el-col> <el-col :span="12"> <el-form-item label="琚獥鏃堕棿"> - <el-date-picker v-model="auditInfo.tmpTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" :style="{ width: '100%' }" - format="yyyy-MM-dd HH:mm:ss" :value-format="auditFrom.cheatTime" disabled></el-date-picker> + <el-date-picker v-model="auditInfo.tmpTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" + :style="{ width: '100%' }" format="yyyy-MM-dd HH:mm:ss" :value-format="auditFrom.cheatTime" + disabled></el-date-picker> </el-form-item> </el-col> <el-col :span="12"> @@ -217,7 +219,9 @@ </el-col> <el-col :span="24"> <el-form-item label="鏉愭枡"> - <div class="metalL"></div> + <div class="metalL"> + <el-image v-for="(img, index) in reportData" :src="img" style="height: 200px;width: 200px;"></el-image> + </div> </el-form-item> </el-col> <el-col :span="24"> @@ -268,8 +272,9 @@ </el-col> <el-col :span="12"> <el-form-item label="琚獥鏃堕棿"> - <el-date-picker v-model="auditInfo.tmpTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" :style="{ width: '100%' }" - format="yyyy-MM-dd HH:mm:ss" :value-format="auditFrom.cheatTime" disabled></el-date-picker> + <el-date-picker v-model="auditInfo.tmpTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" + :style="{ width: '100%' }" format="yyyy-MM-dd HH:mm:ss" :value-format="auditFrom.cheatTime" + disabled></el-date-picker> </el-form-item> </el-col> <el-col :span="12"> @@ -292,7 +297,9 @@ </el-col> <el-col :span="24"> <el-form-item label="鏉愭枡"> - <div class="metalL"></div> + <div class="metalL"> + <el-image v-for="(img, index) in reportData" :src="img" style="height: 200px;width: 200px;"></el-image> + </div> </el-form-item> </el-col> <!-- <el-col :span="24"> @@ -340,7 +347,9 @@ tmpTime: '', }, auditInfo: {}, + picShow: "", + reportData: [], optionsGroup: [ { value: null, @@ -381,7 +390,7 @@ message: '璇疯緭鍏ユ姤妗堜汉 ', trigger: 'blur' }], - mobile: + mobile: [{ required: true, message: '璇疯緭鍏ユ墜鏈哄彿鐮�', trigger: 'blur' }, { validator: function (rule, value, callback) { @@ -425,6 +434,11 @@ trigger: 'change' }], }, + rules2:{ + causeId: [ + { required: true, message: '璇烽�夋嫨娲诲姩鍖哄煙', trigger: 'change' } + ] + } } }, created() { @@ -433,7 +447,7 @@ }, methods: { - //妗堜欢浜哄憳瀵煎叆鎴愬姛鍚� + //妗堜欢浜哄憳瀵煎叆鎴愬姛鍚� reporterRespond(res) { if (res.code == 200) { this.$message({ @@ -447,9 +461,9 @@ type: 'error' }) } - this.getList() + this.getList() }, - beforeAvatarUpload(file) { + beforeAvatarUpload(file) { let Xls = file.name.split('.'); if (Xls[1] === 'xls' || Xls[1] === 'xlsx') { return file @@ -462,11 +476,19 @@ checkAdd() { let form = null; form = this.auditInfo; - checkPass(form).then(res => { - this.$message.success('鎻愪氦鎴愬姛') - this.getList() - this.checkVisible = false; + this.$refs.infoAduitForm.validate((valid)=>{ + if(valid){ + checkPass(form).then(res => { + this.$message.success('鎻愪氦鎴愬姛') + this.getList() + this.checkVisible = false; + }) + }else{ + return false; + } + }) + }, //瀹℃牳 check(val) { @@ -479,16 +501,34 @@ this.picShow = res }) } + if (res.reportMaterials) { + var addressList = res.reportMaterials.split(",") + for (let item of addressList) { + if (item === '' || item === null) { + // this.reportData.push('./logo.jpg'); + } else { + this.reportData=[]; + getImgUrl(item).then(res => { + this.reportData.push(res); + }) + } + } + } + this.checkVisible = true }) }, infoAduitClose() { this.checkVisible = false this.$refs.infoAduitForm.resetFields() + this.reportData = [] + this.picShow = "" }, - detailsClose() { + detailsClose() { this.infoAduitDialogVisible = false this.$refs.infoAduitForm.resetFields() + this.reportData = [] + this.picShow = "" }, addAduit() { this.$refs.addAduitForm.validate(async (vaild) => { @@ -510,7 +550,6 @@ }, handleAvatarSuccess(res, file) { this.auditFrom.pic = res.data - console.log(res.data) getImgUrl(res.data).then(res => { this.picShow = res }) @@ -524,8 +563,8 @@ }, addAduitClose() { this.addAduitDialogVisible = false - this.$refs.addAduitForm.resetFields() this.picShow = "" + this.$refs.addAduitForm.resetFields() }, getList() { let param = {} @@ -573,6 +612,19 @@ this.picShow = res }) } + if (res.reportMaterials) { + var addressList = res.reportMaterials.split(",") + for (let item of addressList) { + if (item === '' || item === null) { + // this.reportData.push('./logo.jpg'); + } else { + getImgUrl(item).then(res => { + this.reportData.push(res); + }) + } + } + } + this.infoAduitDialogVisible = true }) }, -- Gitblit v1.8.0