JImageupload,JUpload组件修改,清除没必要的log

This commit is contained in:
yaoyanan
2021-04-08 18:44:24 +08:00
parent a39835ef6b
commit fd67747c58
15 changed files with 47 additions and 124 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ window._CONFIG = {}
window._CONFIG['domianURL'] = '/jero-boot' // 路由转发 devServer
window._CONFIG['domianWebSocketURL'] = 'http://localhost:8080/jero-boot'
// 单点登录地址
window._CONFIG['staticDomainURL'] = window._CONFIG['domianURL'] + '/sys/common/static'
window._CONFIG['staticDomainURL'] = window._CONFIG['domianURL'] + '/sys/common/download'
window._CONFIG['pdfDomainURL'] = window._CONFIG['domianURL'] + '/sys/common/pdf/pdfPreviewIframe'
window._CONFIG['casPrefixUrl'] = 'http://cas.example.org:8443/cas'
// 预览文件地址
-1
View File
@@ -69,7 +69,6 @@ export const ajaxGetDictItems = (code, params)=>getAction(`/sys/dict/getDictItem
function getDictItemsFromCache(dictCode) {
if (Vue.ls.get(UI_CACHE_DB_DICT_DATA) && Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode]) {
let dictItems = Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode];
console.log("-----------getDictItemsFromCache----------dictCode="+dictCode+"---- dictItems=",dictItems)
return dictItems;
}
}
+12 -26
View File
@@ -19,6 +19,7 @@
:class="!isMultiple?'imgupload':''">
<div :style="{'width':(!isMultiple?'104px':'auto'),'height':(!isMultiple?'104px':'auto')}">
<img v-if="!isMultiple && picUrl" :src="getAvatarView()" style="width:100%;height:100%"/>
<!--<img v-if="!isMultiple && picUrl" src="http://localhost:3000/jero-boot/sys/common/download/1379989167782797313?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MTc4NTA1OTgsInVzZXJuYW1lIjoiYWRtaW4ifQ.1xRpivI0TzTqAnISJICNm-PoMxSDUITH5uaEcvwheIQ&fullfilename=3.jpeg" style="width:100%;height:100%"/>-->
<div v-else class="iconp">
<a-icon :type="uploadLoading ? 'loading' : 'plus'" />
<div class="ant-upload-text">{{ text }}</div>
@@ -39,13 +40,6 @@
const uidGenerator=()=>{
return '-'+parseInt(Math.random()*10000+1,10);
}
const getFileName=(path)=>{
if(path.lastIndexOf("\\")>=0){
let reg=new RegExp("\\\\","g");
path = path.replace(reg,"/");
}
return path.substring(path.lastIndexOf("/")+1);
}
export default {
name: 'JImageUpload',
data(){
@@ -115,27 +109,20 @@
},
methods:{
initFileList(paths){
if(!paths || paths.length==0){
if(!paths || paths.length === 0){
this.fileList = [];
return;
}
this.picUrl = true;
let fileList = [];
let arr = paths.split(",")
let arr = paths.join(",")
for(var a=0;a<arr.length;a++){
let url = getFileAccessHttpUrl(arr[a]);
fileList.push({
uid: uidGenerator(),
name: getFileName(arr[a]),
status: 'done',
url: url,
response:{
status:"history",
message:arr[a]
this.fileList.forEach((item)=>{
if (item.url === arr[a]){
item.uid = uidGenerator()
item.response.status = 'history'
}
})
}
this.fileList = fileList
},
beforeUpload: function(file){
var fileType = file.type;
@@ -157,7 +144,7 @@
this.picUrl = true;
fileList = fileList.map((file) => {
if (file.response) {
file.url = file.response.message;
file.url = `${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.response.result.fileName}`;
}
return file;
});
@@ -180,8 +167,8 @@
},
getAvatarView(){
if(this.fileList.length>0){
let url = this.fileList[0].url
return url
let url = this.fileList[this.fileList.length-1].url
return getFileAccessHttpUrl(url)
}
},
handlePathChange(){
@@ -192,12 +179,12 @@
}
let arr = [];
if(!this.isMultiple){
arr.push(uploadFiles[uploadFiles.length-1].response.message)
arr.push(uploadFiles[uploadFiles.length-1].url)
}else{
for(let a=0;a<uploadFiles.length;a++){
// update-begin-author:taoyan date:20200819 for:【开源问题z】上传图片组件 LOWCOD-783
if(uploadFiles[a].status === 'done' ) {
arr.push(uploadFiles[a].response.message)
arr.push(uploadFiles[a].url)
}else{
return;
}
@@ -211,7 +198,6 @@
},
handleDelete(file){
//如有需要新增 删除逻辑
console.log(file)
},
handleCancel() {
this.close();
+28 -53
View File
@@ -46,6 +46,7 @@
import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import { getFileAccessHttpUrl } from '@/api/manage';
const Base64 = require('js-base64').Base64
const FILE_TYPE_ALL = "all"
const FILE_TYPE_IMG = "image"
@@ -53,13 +54,6 @@
const uidGenerator=()=>{
return '-'+parseInt(Math.random()*10000+1,10);
}
const getFileName=(path)=>{
if(path.lastIndexOf("\\")>=0){
let reg=new RegExp("\\\\","g");
path = path.replace(reg,"/");
}
return path.substring(path.lastIndexOf("/")+1);
}
export default {
name: 'JUpload',
data(){
@@ -176,46 +170,29 @@
this.fileList = [];
return;
}
let fileList = [];
for(var a=0;a<val.length;a++){
let url = getFileAccessHttpUrl(val[a].filePath);
fileList.push({
uid:uidGenerator(),
name:val[a].fileName,
status: 'done',
url: url,
response:{
status:"history",
message:val[a].filePath
this.fileList.forEach((item)=>{
if (item.url === val[a]){
item.uid = uidGenerator()
item.response.status = 'done'
}
})
}
this.fileList = fileList
},
initFileList(paths){
if(!paths || paths.length==0){
//return [];
// update-begin- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
this.fileList = [];
return;
// update-end- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
}
let fileList = [];
let arr = paths.split(",")
for(var a=0;a<arr.length;a++){
let url = getFileAccessHttpUrl(arr[a]);
fileList.push({
uid:uidGenerator(),
name:getFileName(arr[a]),
status: 'done',
url: url,
response:{
status:"history",
message:arr[a]
this.fileList.forEach((item)=>{
if (item.url === arr[a]){
item.uid = uidGenerator()
item.response.status = 'history'
}
})
}
this.fileList = fileList
},
handlePathChange(){
let uploadFiles = this.fileList
@@ -226,13 +203,11 @@
let arr = [];
for(var a=0;a<uploadFiles.length;a++){
// update-begin-author:lvdandan date:20200603 for:【TESTA-514】【开源issue】多个文件同时上传时,控制台报错
if(uploadFiles[a].status === 'done' ) {
arr.push(uploadFiles[a].response.message)
arr.push(uploadFiles[a].url)
}else{
return;
}
// update-end-author:lvdandan date:20200603 for:【TESTA-514】【开源issue】多个文件同时上传时,控制台报错
}
if(arr.length>0){
path = arr.join(",")
@@ -253,7 +228,6 @@
return true
},
handleChange(info) {
console.log("--文件列表改变--")
if(!info.file.status && this.uploadGoOn === false){
info.fileList.pop();
}
@@ -265,7 +239,7 @@
if(info.file.response.success){
fileList = fileList.map((file) => {
if (file.response) {
let reUrl = file.response.message;
let reUrl = `${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.response.result.fileName}`;
file.url = getFileAccessHttpUrl(reUrl);
}
return file;
@@ -290,7 +264,7 @@
if(fileList[a].status === 'done' ) {
var fileJson = {
fileName:fileList[a].name,
filePath:fileList[a].response.message,
filePath:fileList[a].url,
fileSize:fileList[a].size
};
this.newFileList.push(fileJson);
@@ -307,12 +281,16 @@
//如有需要新增 删除逻辑
console.log(file)
},
handlePreview(file){
handlePreview(file) {
if(this.fileType === FILE_TYPE_IMG){
this.previewImage = file.url || file.thumbUrl;
this.previewVisible = true;
}else{
location.href=file.url
if (file && file.url) {
var fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url)
}
}
},
handleCancel(){
@@ -320,20 +298,17 @@
},
//---------------------------- begin 图片左右换位置 -------------------------------------
moveLast(){
//console.log(ev)
//console.log(this.fileList)
//console.log(this.currentImg)
let index = this.getIndexByUrl();
if(index==0){
if(index == 0){
this.$message.warn('未知的操作')
}else{
let curr = this.fileList[index].url;
let last = this.fileList[index-1].url;
let arr =[]
for(let i=0;i<this.fileList.length;i++){
if(i==index-1){
if(i == index-1){
arr.push(curr)
}else if(i==index){
}else if(i == index){
arr.push(last)
}else{
arr.push(this.fileList[i].url)
@@ -345,16 +320,16 @@
},
moveNext(){
let index = this.getIndexByUrl();
if(index==this.fileList.length-1){
if(index == this.fileList.length-1){
this.$message.warn('已到最后~')
}else{
let curr = this.fileList[index].url;
let next = this.fileList[index+1].url;
let arr =[]
for(let i=0;i<this.fileList.length;i++){
if(i==index+1){
if(i === index+1){
arr.push(curr)
}else if(i==index){
}else if(i == index){
arr.push(next)
}else{
arr.push(this.fileList[i].url)
@@ -366,7 +341,7 @@
},
getIndexByUrl(){
for(let i=0;i<this.fileList.length;i++){
if(this.fileList[i].url === this.currentImg || encodeURI(this.fileList[i].url) === this.currentImg){
if(this.fileList[i].url == this.currentImg || encodeURI(this.fileList[i].url) == this.currentImg){
return i;
}
}
@@ -390,7 +365,7 @@
picList[0].addEventListener('mouseover',(ev)=>{
ev = ev || window.event;
let target = ev.target || ev.srcElement;
if('ant-upload-list-item-info' == target.className){
if('ant-upload-list-item-info' === target.className){
this.showMoverTask=false
let item = target.parentElement
this.left = item.offsetLeft
@@ -405,14 +380,14 @@
ev = ev || window.event;
let target = ev.target || ev.srcElement;
//console.log('移除',target)
if('ant-upload-list-item-info' == target.className){
if('ant-upload-list-item-info' === target.className){
this.showMoverTask=true
setTimeout(()=>{
if(this.moverHold === false)
this.moveDisplay = 'none';
},100)
}
if('ant-upload-list-item ant-upload-list-item-done' == target.className || 'ant-upload-list ant-upload-list-picture-card'== target.className){
if('ant-upload-list-item ant-upload-list-item-done' === target.className || 'ant-upload-list ant-upload-list-picture-card'=== target.className){
this.moveDisplay = 'none';
}
})
@@ -88,7 +88,6 @@
//返回字段不为id时,根据返回字段获取id
if(this.customReturnField !== 'id' && this.value){
const dataList = this.$refs.innerDepartSelectModal.dataList;
console.log('this.value',this.value)
this.departIds = this.value.split(',').map(item => {
const data = dataList.filter(d=>d[this.customReturnField] === item)
return data.length > 0 ? data[0].id : ''
@@ -31,9 +31,6 @@
{ title: '角色编码', dataIndex: 'roleCode', align: 'center', width: 120 }
]
}
},
created(){
console.log(this.$attrs)
}
}
</script>
@@ -17,17 +17,13 @@
//update-begin--Author:scott Date:20201015 for:路由缓存问题,关闭了tab页时再打开就不刷新 #842
includedComponents() {
const includedRouters = Vue.ls.get(CACHE_INCLUDED_ROUTES)
console.log("includedRouters" + includedRouters)
//如果是缓存路由,则加入到 cache_included_routes
if (this.$route.meta.keepAlive && this.$route.meta.componentName) {
let cacheRouterArray = Vue.ls.get(CACHE_INCLUDED_ROUTES) || []
if(!cacheRouterArray.includes(this.$route.meta.componentName)){
cacheRouterArray.push(this.$route.meta.componentName)
// cacheRouterArray.push("OnlCgformHeadList")
console.log("Vue ls set componentName " + this.$route.meta.componentName)
Vue.ls.set(CACHE_INCLUDED_ROUTES, cacheRouterArray)
console.log("Vue ls includedRouterArrays " + Vue.ls.get(CACHE_INCLUDED_ROUTES))
return cacheRouterArray;
}
}
+1 -2
View File
@@ -54,7 +54,6 @@ export const JeroListMixin = {
},
created() {
if(!this.disableMixinCreated){
console.log(' -- mixin created -- ')
this.loadData();
//初始化字典配置 在自己页面定义
this.initDictConfig();
@@ -102,7 +101,7 @@ export const JeroListMixin = {
})
},
initDictConfig(){
console.log("--这是一个假的方法!")
},
handleSuperQuery(params, matchType) {
//高级查询方法
-2
View File
@@ -22,9 +22,7 @@ router.beforeEach((to, from, next) => {
} else {
if (store.getters.permissionList.length === 0) {
store.dispatch('GetPermissionList').then(res => {
// console.log(res)
const menuData = res.result.menu;
//console.log(res.message)
if (menuData === null || menuData === "" || menuData === undefined) {
return;
}
-4
View File
@@ -60,17 +60,14 @@ const permission = {
SET_ROUTERS: (state, data) => {
state.addRouters = data
state.routers = constantRouterMap.concat(data)
//console.log('-----mutations---SET_ROUTERS----', data)
}
},
actions: {
GenerateRoutes({ commit }, data) {
return new Promise(resolve => {
const { roles } = data
console.log('-----mutations---data----', data)
let accessedRouters
accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
console.log('-----mutations---accessedRouters----', accessedRouters)
commit('SET_ROUTERS', accessedRouters)
resolve()
})
@@ -80,7 +77,6 @@ const permission = {
return new Promise(resolve => {
//const [ roles ] = routes.constRoutes
let routelist = routes.constRoutes;
console.log(routelist)
commit('SET_ROUTERS', routelist)
resolve()
})
-1
View File
@@ -22,7 +22,6 @@ Vue.filter('ellipsis', function (value, vlength = 25) {
if(!value){
return "";
}
console.log('vlength: '+ vlength);
if (value.length > vlength) {
return value.slice(0, vlength) + '...'
}
-2
View File
@@ -2,7 +2,6 @@ import { USER_AUTH,SYS_BUTTON_AUTH } from "@/store/mutation-types"
const hasPermission = {
install (Vue, options) {
//console.log(options);
Vue.directive('has', {
inserted: (el, binding, vnode)=>{
console.log("页面权限控制----");
@@ -11,7 +10,6 @@ const hasPermission = {
if(!filterNodePermission(el, binding, vnode)){
filterGlobalPermission(el, binding, vnode);
}
//console.timeEnd() //计时结束并输出时长
}
});
}
+5 -14
View File
@@ -178,7 +178,7 @@
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="过长剪切">
<j-ellipsis :value="jellipsis.value" :length="20" @text-change="selectChange"/>
<j-ellipsis :value="jellipsis.value" :length="20"/>
</a-form-item>
</a-col>
<a-col :span="12">过长剪切:{{ jellipsis.value }}</a-col>
@@ -198,7 +198,7 @@
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="多选下拉框">
<j-select-multiple v-model="jselectMultiple.value" :options="jselectMultiple.options" @change="selectChange"/>
<j-select-multiple v-model="jselectMultiple.value" :options="jselectMultiple.options"/>
</a-form-item>
</a-col>
<a-col :span="12">多选下拉框(v-model){{ jselectMultiple.value }}</a-col>
@@ -331,7 +331,7 @@
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="图片上传">
<j-image-upload v-model="imgList" title="22"></j-image-upload>
<j-image-upload v-model="imgList" :isMultiple="true"></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="12">选中的值(v-model){{ imgList }}</a-col>
@@ -339,7 +339,7 @@
<a-row :gutter="24" style="margin-top: 65px;margin-bottom:50px;">
<a-col :span="12">
<a-form-item label="文件上传">
<j-upload v-model="fileList" title="ddd" :multiple="true"></j-upload>
<j-upload v-model="fileList" :multiple="true" :fileType="'image'"></j-upload>
</a-form-item>
</a-col>
<a-col :span="12">
@@ -598,9 +598,6 @@ sayHi('hello, world!')`
],
}
},
created(){
console.log(this.formData.jInput)
},
computed: {
nameList: function() {
@@ -612,12 +609,6 @@ sayHi('hello, world!')`
}
},
methods: {
as(){
this.ss = true
},
selectChange(){
console.log("ok")
},
getDepartIdValue() {
return this.form.getFieldValue('departId')
},
@@ -625,7 +616,7 @@ sayHi('hello, world!')`
return this.form.getFieldValue('orgCodes')
},
changeMe() {
console.log('you so ... , change Me')
},
selectOK: function(data) {
this.selectList = data
@@ -106,7 +106,6 @@
if(res.success){
let formData = {userId:res.result,
departIdList:this.departList}
console.log(formData)
that.$emit('ok', formData);
}
}).finally(() => {
@@ -117,7 +116,6 @@
}else {
let formData = {userId:this.userId,
departIdList:this.departList}
console.log(formData)
that.departList = [];
that.$emit('ok', formData);
that.confirmLoading = false;
@@ -143,7 +141,6 @@
depart.title = de.title;
this.departList.push(depart);
}
console.log('onCheck', checkedKeys, info);
},
queryDepartTree(){
queryIdTree().then((res)=>{
@@ -236,8 +236,6 @@
var that = this;
queryTreeList().then((res)=>{
if(res.success){
console.log('----queryTreeList---')
console.log(res)
that.treeData = [];
let treeList = res.result.treeList
for(let a=0;a<treeList.length;a++){
@@ -258,7 +256,6 @@
this.model = Object.assign({}, record);
//--------------------------------------------------------------------------------------------------
//根据菜单类型,动态展示页面字段
console.log(record)
this.alwaysShow = !record.alwaysShow?false:true;
this.menuHidden = !record.hidden?false:true;
@@ -281,7 +278,6 @@
/*update_end author:wuxianquan date:20190908 for:编辑初始化数据*/
//console.log('record.menuType', record.menuType);
this.show = record.menuType==2?false:true;
this.menuLabel = record.menuType==2?'按钮/权限':'菜单名称';
@@ -326,7 +322,6 @@
that.validateStatus = 'success';
}
that.confirmLoading = true;
console.log(formData);
let obj;
if (!this.model.id) {
obj = addPermission(formData);
@@ -378,7 +373,6 @@
}
},
onChangeMenuType(e) {
//console.log('localMenuType checked', e.target.value)
this.localMenuType=e.target.value
if(e.target.value == 2){
this.show = false;
@@ -398,7 +392,6 @@
this.iconChooseVisible = false
},
handleIconChoose (value) {
console.log(value)
this.model.icon = value
this.form.icon = value
this.iconChooseVisible = false