Browse Source

完善公共组件

master
yunuo970428 2 years ago
parent
commit
66488643b4
  1. 20
      anrui-riskcenter-ui/src/api/Common/Upload.js
  2. 26
      anrui-riskcenter-ui/src/api/Common/dictcommons.js
  3. 231
      anrui-riskcenter-ui/src/components/uploadFile/uploadImg.vue
  4. 2
      anrui-riskcenter-ui/src/layout/components/Sidebar/index.vue
  5. 12
      anrui-riskcenter-ui/src/styles/index.scss

20
anrui-riskcenter-ui/src/api/Common/Upload.js

@ -1,20 +1,4 @@
import request from '@/utils/request'
// 上传图片
export function imageUpload(data){
return request({
url: '/jlcyry/file/upload',
method: 'post',
data,
headers:{'Content-Type':'multipart/form-data'}
})
}
// export function uploadFile(data){
// return request({
// url: '/portal/file/upload',
// method: 'post',
// data,
// headers:{'Content-Type':'multipart/form-data'}
// })
// }
//
export const uploadFile = '/api/portal/file/upload'
export const uploadFile = '/api/portal/file/upload'

26
anrui-riskcenter-ui/src/api/Common/dictcommons.js

@ -16,3 +16,29 @@ export function getOrgSidByPath(data) {
params: data
})
}
// 根据分公司sid查询分公司名称
export function fetchBySid(sid) {
return request({
url: 'portal/v1/sysorganization/fetchBySid/' + sid,
method: 'get'
})
}
// 根据当前登录用户sid获取本分公司下的销售部门和销售专员
export function selectOrgList(data) {
return request({
url: '/portal/v1/sysorganization/selectOrgList',
method: 'get',
params: data
})
}
// 根据当前登录用户全路径sidPath获取本分公司下的资方信息
export function selectListByOrgPath(data) {
return request({
url: '/riskcenter/v1/loanfinbank/selectListByOrgPath',
method: 'get',
params: data
})
}

231
anrui-riskcenter-ui/src/components/uploadFile/uploadImg.vue

@ -0,0 +1,231 @@
<template>
<div>
<el-upload ref="imgUpload" v-loading="loadding" class="avatar-uploader" :headers="accessToken"
:action="uploadFile" accept="accept" list-type="picture-card"
:file-list="files" :on-remove="removeImage" :on-preview="handlePictureCardPreview"
:on-progress="uploadProgrees"
:on-error="uploadError" :on-success="uploadImgSuccess_FuJian">
<i class="el-icon-plus avatar-uploader-icon"/>
</el-upload>
<el-dialog :visible.sync="dialogVisible" :append-to-body="true" title="查看图片">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
<script>
import { uploadFile } from '@/api/Common/Upload'
import { getStorage } from '@/utils/auth.js'
export default {
model: {
prop: 'name',
event: 'change'
},
props: {
placeholder: {
type: String,
default: ''
},
bucket: {
type: String,
default: 'abc'
},
//
width: {
type: String,
default: '270px'
},
limit: {
type: Number,
default: 1
},
accept: {
type: String,
default:
'.jpg,.jpeg,.png,.bmp,.pdf,.JPG,.JPEG,.BMP,.PDF,.xls,.docx,.xlsx,.ppt,.pptx'
},
//
name: {
type: Array,
required: true
},
uploadData: {
type: Object,
default: {}
}
},
data() {
return {
dialogImageUrl: '',
dialogVisible: false,
accessToken: null,
uploadFile: uploadFile,
fileList_FuJian: [],
enclosure: '',
file_add: '',
file_catch: '',
files: [],
files_list: [],
filedUrl: '',
// fileUrl: fileUrl,
// showpicture:false,
isview: false,
nameArr: '',
loadding: false,
stateName: ''
}
},
watch: {
name: {
deep: true,
immediate: true,
handler(newVal, oldVal) {
console.log('aaaa1', newVal)
console.log('aaaa2', oldVal)
this.files = newVal
console.log('aaaa2this.files', this.files)
}
}
},
mounted() {
this.$nextTick(() => {
this.Init()
})
},
created() {
this.uploadFile = uploadFile //
this.accessToken = {
token: getStorage()
}
},
methods: {
showImg(imgList) {
this.stateName = 'xunidingjinAdd'
this.files = imgList
console.log('回显图片', this.files)
},
view() {
// window.open(this.filedUrl)
},
//
Init() {
if (this.name !== undefined) {
this.files = []
for (var i = 0; i < this.name.length; i++) {
this.files.push({
name: this.name[i],
url: this.name[i]
})
}
}
},
// --
uploadImgSuccess_FuJian(response, file, fileList) {
console.log('您选择的file:', file)
if (file.response.code === '200') {
this.loadding = false
//
this.filedUrl = this.fileUrl + file.response.data
// var uid = file.response.data
this.files.push({
name: file.response.data.sourceFileName,
url: file.response.data.fullUrl,
filePath: file.response.data.filePath,
size: file.response.data.size
})
this.$emit('change', this.files)
this.$emit('eett', this.files)
}
},
removeImage(file, ImageFileList) {
this.files.splice(this.files.indexOf(file), 1)
const imgFiles = []
this.files.forEach((o) => {
imgFiles.push(o.url)
})
this.$emit('fileChange', this.files)
},
handleRemove(file, fileList) {
console.log('file:' + JSON.stringify(file))
console.log('fileList:' + JSON.stringify(fileList))
this.enclosure = ''
// 1. id(this.file_add)
this.getNewFileId(fileList)
// 2. id(this.file_catch)
this.getCatchFileId(file)
// 3. id
this.getFileId()
// 4. id
this.$emit('change', this.enclosure)
},
// this.file_add(id)
getNewFileId(fileList) {
// debugger
this.file_add = ''
for (var i = 0; i < fileList.length; i++) {
if (fileList[i].response && fileList[i].response.code === '200') {
this.file_add = this.file_add + fileList[i].response.data + ','
}
}
if (this.file_add !== '') {
this.file_add = this.file_add.substring(0, this.file_add.length - 1)
}
// console.log('1. this.file_add: ' + this.file_add)
},
// this.file_catchid
getCatchFileId(file) {
for (var i = 0; i < this.files_list.length; i++) {
if (this.file_catch !== '') {
// 1. id
if (this.files_list[i].name === file.name) {
// 2. file_catchfils_arry
var fils_arry = this.file_catch.split(',')
// 3. fils_arry this.files_list[i].id
var arry = []
fils_arry.forEach((element) => {
//
if (element !== this.files_list[i].id) {
arry.push(element)
}
})
// 4. file_catch
this.file_catch = arry.join(',')
}
}
}
// console.log('2. this.file_catch:' + this.file_catch)
},
// id
getFileId() {
// console.log('3. this.file_catch:' + this.file_catch + ',this.file_add:' + this.file_add)
if (this.file_catch !== '') {
if (this.file_add !== '') {
this.enclosure = this.file_catch + ',' + this.file_add
} else {
this.enclosure = this.file_catch
}
} else {
this.enclosure = this.file_add
}
},
handlePictureCardPreview(file) {
this.dialogVisible = true
this.dialogImageUrl = file.url
},
//
uploadError() {
this.loadding = false
},
uploadProgrees(event, file, fileList) {
if (Number(event.percent) > 0) {
this.loadding = true
}
}
}
}
</script>
<style lang="scss" scoped></style>

2
anrui-riskcenter-ui/src/layout/components/Sidebar/index.vue

@ -35,7 +35,7 @@
YongHuid: [],
routes: [],
params: {
sourceSid: '20221d77-239e-4e4a-bdec-3266478dfdc3',
sourceSid: '0c6dbca4-4325-4db2-ae47-b645b7174552',
userSid: '',
}
}

12
anrui-riskcenter-ui/src/styles/index.scss

@ -430,3 +430,15 @@ div:focus {
.bordertopline{ border-top: 1px solid $table-border-color;}
.lookimg img{width: 250px;margin: 10px;}
.listimg{width: 80px;}
.tleftb {
text-align: right;
font-size: 14px;
color: #606266;
line-height: 40px !important;
font-weight: 600;
}
.icon {
color: #e84026;
margin-right: 4px;
}

Loading…
Cancel
Save