|
@@ -199,11 +199,11 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- async init (id, disabled) {
|
|
|
+ async init (id, display) {
|
|
|
this.dataForm = {}
|
|
|
this.visible = true
|
|
|
this.id = id || 0
|
|
|
- this.display = disabled
|
|
|
+ this.display = display
|
|
|
await getType().then(({data}) => {
|
|
|
if (data && data.code === '200') {
|
|
|
this.options = data.data
|
|
@@ -215,7 +215,7 @@
|
|
|
}
|
|
|
})
|
|
|
if (!id) return
|
|
|
- await getCoDetail().then(({data}) => {
|
|
|
+ await getCoDetail(this.id).then(({data}) => {
|
|
|
if (data && data.code === '200') {
|
|
|
this.dataForm = data.data
|
|
|
}
|
|
@@ -225,34 +225,51 @@
|
|
|
this.$refs.upload.submit()
|
|
|
},
|
|
|
handleRemove (file, fileList) {
|
|
|
- console.log(file, fileList)
|
|
|
+ let _tmp = this.fileList
|
|
|
+ // eslint-disable-next-line one-var
|
|
|
+ let i = 0, len = _tmp.length
|
|
|
+ for (; i < len; i++) {
|
|
|
+ // eslint-disable-next-line no-cond-assign
|
|
|
+ if (_tmp[i].name === file.name) {
|
|
|
+ _tmp.splice(i, 1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.fileList = _tmp
|
|
|
},
|
|
|
handlePreview (file) {
|
|
|
- let res = file.response
|
|
|
- if (res && res.code === '200') {
|
|
|
+ if (file && file.url) {
|
|
|
// 获取文件路径
|
|
|
- this.previewPath = downloadUrl + file.response.data.fileUrl
|
|
|
- this.previewName = file.response.data.originFileName
|
|
|
+ this.previewPath = downloadUrl + file.url
|
|
|
+ this.previewName = file.name
|
|
|
this.previewVisible = true
|
|
|
}
|
|
|
},
|
|
|
handleSuccess (response, file, fileList) {
|
|
|
- console.log(file)
|
|
|
- },
|
|
|
- uploadFiles (params) {
|
|
|
- let files = this.fileList
|
|
|
- console.log(params)
|
|
|
- console.log(files)
|
|
|
- },
|
|
|
- onChangeFiles (file, fileList) {
|
|
|
- this.fileList.push(file)
|
|
|
+ if (response && response.code === '200') {
|
|
|
+ let lst = response.data
|
|
|
+ for (let i = 0; i < lst.length; i++) {
|
|
|
+ this.fileList.push({
|
|
|
+ name: lst[i].originFileName,
|
|
|
+ url: lst[i].fileUrl
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 表单提交
|
|
|
dataFormSubmit () {
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
console.log('fileList = ' + this.fileList)
|
|
|
- // this.dataForm.attachList = this.fileList
|
|
|
+ if (this.fileList.length > 0) {
|
|
|
+ let fList = this.fileList
|
|
|
+ for (let i = 0; i < fList.length; i++) {
|
|
|
+ this.dataForm.attachList.push({
|
|
|
+ fileName: fList[i].originFileName,
|
|
|
+ url: fList[i].fileUrl
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
this.dataForm.cusRCommProductVOS = this.cusRCommProductVOS
|
|
|
this.$http({
|
|
|
url: this.$http.adornUrl(`/biz-service/cusCommunication/save`),
|