Commit a884876e authored by leidahong's avatar leidahong

附件

parent 7f0cdc6a
......@@ -92,17 +92,17 @@
</div>
</div>
</div>
<!-- <div class="detail-item">
<div class="detail-item">
<div class="label">附件</div>
<div class="val">
<div class="file-list">
<div class="file-item" v-for="item in 1">
<div class="file-name">附件名称.doc</div>
<div class="file-item" v-for="item in info.fileUrlList">
<div class="file-name">{{ item }}</div>
<div class="check-btn">查看附件</div>
</div>
</div>
</div>
</div> -->
</div>
</div>
<div
class="handle-btn-box"
......
......@@ -38,14 +38,16 @@
:border="false"
show-word-limit
class="textarea"
/><van-uploader
class="uploader"
v-model="fileList"
multiple
:after-read="afterRead"
:before-delete="beforeDelete"
@click-preview="clickPreview"
/>
<van-cell @click="changeUploadType('img')" :border="false">
<van-uploader
class="uploader"
v-model="imgList"
multiple
:after-read="afterRead"
:before-delete="beforeDelete"
@click-preview="clickPreview"
/></van-cell>
</div>
<van-field
v-model="form.involvedNumber"
......@@ -71,6 +73,21 @@
@click="popupChange('rankNo')"
/>
<van-field v-model="form.expectedDays" v-bind="field('expectedDays')" />
<van-cell
readonly
title="上传附件"
@click="changeUploadType('file')"
:border="false"
>
<van-uploader
v-model="fileList"
:after-read="afterRead"
:before-delete="beforeDelete"
upload-icon="description"
>
</van-uploader
></van-cell>
<van-field readonly />
</van-cell-group>
<div class="btn">
......@@ -125,6 +142,7 @@ export default {
reportDate: "",
expectedDays: "1",
imgUrlList: [],
fileUrlList: [],
status: "待处理",
},
fieldMap: {
......@@ -142,6 +160,7 @@ export default {
rankNo: "事件等级",
expectedDays: "处理天数",
},
imgList: [],
fileList: [],
popupShow: false,
popupType: "",
......@@ -161,6 +180,7 @@ export default {
community: [],
},
isPreview: false,
uploadType: "img",
};
},
created() {
......@@ -174,9 +194,14 @@ export default {
},
methods: {
async onSubmit() {
console.log(this.form);
this.form.imgUrlList = this.form.imgUrlList.join(",");
this.form.imgUrlList =
this.form.imgUrlList instanceof Array
? this.form.imgUrlList.join(",")
: "";
this.form.fileUrlList =
this.form.fileUrlList instanceof Array
? this.form.fileUrlList.join(",")
: "";
if (this.isDisabled) return;
this.isDisabled = true;
const res = await addEvent(this.form);
......@@ -247,7 +272,10 @@ export default {
let formData = new FormData();
formData.append("file", file.file);
const res = await uploadImg(formData);
this.form.imgUrlList.push(res.data.url);
if (this.uploadType == "img") this.form.imgUrlList.push(res.data.url);
if (this.uploadType == "file") this.form.fileUrlList.push(res.data.url);
if (res.code == 200) {
file.status = "done";
file.message = "上传成功";
......@@ -258,14 +286,22 @@ export default {
});
},
beforeDelete(file, detail) {
this.form.photo.splice(detail.index, 1);
const handle = {
file: () => this.form.fileUrlList.splice(detail.index, 1),
img: () => this.form.imgUrlList.splice(detail.index, 1),
};
handle[this.uploadType]();
return true;
},
changeUploadType(e) {
this.uploadType = e;
},
field(key, required) {
const data = {
label: this.fieldMap[key],
placeholder: `请填写${this.fieldMap[key]}`,
required: required,
required: required ? true : false,
};
if (required) data.rules = [{ required: true }];
......@@ -311,13 +347,18 @@ export default {
border-radius: 8px;
border: 1px solid #ebedf0;
overflow: hidden;
.uploader {
margin: 0 16px;
}
}
}
.btn {
margin: 0px 30px;
}
::v-deep .van-cell__title {
flex: none;
width: 110px;
color: #646566;
}
::v-deep .van-cell__value {
text-align: left;
}
</style>
......@@ -29,8 +29,8 @@ module.exports = {
proxy: {
"/proxyApi": {
// target: 'http://192.168.10.12:18001/hmit-api',
target: "http://192.168.10.4:10024/",
// target: "https://xcsq.zjhmit.com/api",
// target: "http://192.168.10.4:10024/",
target: "https://xcsq.zjhmit.com/api",
changeOrigin: true,
pathRewrite: {
"^/proxyApi": "",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment