|
@@ -39,7 +39,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="文件上传">
|
|
|
- <myUpload :file-list="files" @on-change="onchange" @on-remove="onRemove" style="height: 180px;"></myUpload>
|
|
|
+ <myUpload :file-list="handleConcat(formData[0].systemFileList)" @on-change="onchange" @on-remove="onRemove" style="height: 180px;"></myUpload>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="事件描述" prop="description">
|
|
|
<el-input type="textarea" :rows="2" v-model="formData[0].description" autocomplete="off" placeholder="请输入事件描述"
|
|
@@ -116,7 +116,7 @@
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="handleClose()" style="width:100px">取消</el-button>
|
|
|
<el-button size="small" @click="resetForm()" style="width:100px">重置</el-button>
|
|
|
- <el-button type="primary" @click="submitForm1()" size="small" style="width:100px">确定</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm1()" size="small" v-loading="loading" style="width:100px">确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
@@ -129,6 +129,7 @@ export default {
|
|
|
props: [],
|
|
|
data() {
|
|
|
return {
|
|
|
+ loading:false,
|
|
|
//弹窗标题
|
|
|
title: '',
|
|
|
//弹窗状态
|
|
@@ -175,13 +176,26 @@ export default {
|
|
|
methods: {
|
|
|
// 自定义组件文件删除
|
|
|
onRemove(file, fileList) {
|
|
|
- let a=this.files.findIndex(item => {
|
|
|
- return item.size == file.size
|
|
|
- })
|
|
|
- this.files.splice(a,1)
|
|
|
+ console.log(file);
|
|
|
+
|
|
|
+ if (file.guid) {
|
|
|
+ let a = this.formData[0].systemFileList.findIndex(item => {
|
|
|
+ return item.guid == file.guid
|
|
|
+ })
|
|
|
+ this.formData[0].systemFileList.splice(a, 1)
|
|
|
+ } else {
|
|
|
+ let a=this.files.findIndex(item => {
|
|
|
+ return item.size == file.size
|
|
|
+ })
|
|
|
+ this.files.splice(a, 1)
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
// 自定义组件文件监听
|
|
|
- onchange(file,fileList) {
|
|
|
+ onchange(file, fileList) {
|
|
|
+ if (this.formData[0].systemFileList && this.formData[0].systemFileList.length>0) {
|
|
|
+
|
|
|
+ }
|
|
|
if (this.files && this.files.length>0) {
|
|
|
let a=this.files.findIndex(item => {
|
|
|
return item.size == file.size
|
|
@@ -197,7 +211,11 @@ export default {
|
|
|
}
|
|
|
|
|
|
},
|
|
|
-
|
|
|
+ // 合并已上传的文件和未上传的文件
|
|
|
+ handleConcat(arr) {
|
|
|
+ let files = (arr || []).concat(this.files)
|
|
|
+ return files
|
|
|
+ },
|
|
|
//获取客户信息
|
|
|
getAdminClientList() {
|
|
|
let params = {
|
|
@@ -241,7 +259,8 @@ export default {
|
|
|
// this.$refs.select2.blur()
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
}
|
|
|
- this.files=[]
|
|
|
+ this.files = []
|
|
|
+ this.loading=false
|
|
|
this.dialogVisible = false
|
|
|
},
|
|
|
// 请求应用场景(是通过字典还是接口待定)
|
|
@@ -310,10 +329,19 @@ export default {
|
|
|
},
|
|
|
//提交保存、编辑事件接口
|
|
|
addInterface(forms) {
|
|
|
+ this.loading=true
|
|
|
let formData = new FormData()
|
|
|
- if (this.files && this.files.length>0) {
|
|
|
- formData.append('guids',this.files)//文件数据
|
|
|
+ if (this.files && this.files.length > 0) {
|
|
|
+ for (var i = 0; i < this.files.length; i++) {
|
|
|
+ formData.append('files',this.files[i])//文件数据
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (forms[0].systemFileList && forms[0].systemFileList.length>0) {
|
|
|
+ forms[0].fileGuids=forms[0].systemFileList.map(item => {
|
|
|
+ return item.guid
|
|
|
+ })
|
|
|
}
|
|
|
+ console.log(forms);
|
|
|
formData.append('event', JSON.stringify(forms[0]))
|
|
|
if (forms[0].id) {//编辑
|
|
|
this.$api.updateEvent(formData).then(res => {
|
|
@@ -323,6 +351,7 @@ export default {
|
|
|
this.handleClose()
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
+ this.loading=false
|
|
|
this.$message.error(error.message)
|
|
|
})
|
|
|
} else {//新增
|
|
@@ -333,6 +362,7 @@ export default {
|
|
|
this.handleClose()
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
+ this.loading=false
|
|
|
this.$message.error(error.message)
|
|
|
})
|
|
|
}
|