Browse Source

文件上传后 向父组件返回上传的信息

master
[li_she] 4 years ago
parent
commit
1ccf950c0b
  1. 5
      src/views/modules/base/calendar.vue
  2. 28
      src/views/modules/common/upload.vue
  3. 12
      src/views/modules/purchaseorder/purchaseRequisition.vue

5
src/views/modules/base/calendar.vue

@ -182,8 +182,9 @@
:label="this.timeArray[0]"> :label="this.timeArray[0]">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.val0" placeholder="请选择" style="height: 12px;padding: 0px " filterable allow-create> <el-select v-model="scope.row.val0" placeholder="请选择" style="height: 12px;padding: 0px " filterable allow-create>
 <el-option v-for="item in selectList " :key="index" :label="item.label" :value="item.value">
 </el-option>
<el-option v-for="item in selectList " :key="index" :label="item.label" :value="item.value">
</el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>

28
src/views/modules/common/upload.vue

@ -6,12 +6,10 @@
:before-upload="beforeUploadHandle" :before-upload="beforeUploadHandle"
:on-success="successHandle" :on-success="successHandle"
multiple multiple
style="text-align: center;"> <!--drag :file-list="fileList"-->
<!-- <i class="el-icon-upload"></i>-->
:show-file-list="false"
style="text-align: center;">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
<!--<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">只支持jpgpnggif格式的图片</div>-->
</el-upload> </el-upload>
</div> </div>
</template> </template>
@ -42,23 +40,23 @@
}, },
// //
successHandle (response, file, fileList) { successHandle (response, file, fileList) {
this.fileList = fileList
this.fileList = fileList.map(item => {
return item.response.ossEntity
})
console.log(this.fileList) console.log(this.fileList)
this.successNum++ this.successNum++
if (response && response.code === 0) { if (response && response.code === 0) {
/*if (this.num === this.successNum) {
this.$confirm('操作成功, 是否继续操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).catch(() => {
this.visible = false
})
}*/
this.childClick()
} else { } else {
this.$message.error(response.msg) this.$message.error(response.msg)
} }
}, },
childClick () {
// childByValueon
this.$emit('childByValue', this.fileList)
}
}, },
created() { created() {
this.init() this.init()

12
src/views/modules/purchaseorder/purchaseRequisition.vue

@ -204,7 +204,7 @@
:disabled="true"></el-input> :disabled="true"></el-input>
</el-form-item> </el-form-item>
<el-form-item style="margin-top: 10px"> <el-form-item style="margin-top: 10px">
<upload></upload>
<upload v-on:childByValue="childByValue"></upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -240,6 +240,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -274,13 +275,10 @@
} from '@/api/purchaseorder/purchaseRequisition.js' } from '@/api/purchaseorder/purchaseRequisition.js'
import upload from "../common/upload"; import upload from "../common/upload";
export default { export default {
// add,
// sub,
// mul,
// div,
components:{upload}, components:{upload},
data() { data() {
return { return {
fileList: [],
// table // table
height: 0, height: 0,
bannersBut: false, bannersBut: false,
@ -853,6 +851,10 @@
}, },
methods: { methods: {
childByValue (childValue) {
// childValue
this.fileList = childValue
},
updateAuthorizeFlag(row){ updateAuthorizeFlag(row){
let saveData = { let saveData = {
site : row.site, site : row.site,

Loading…
Cancel
Save