用户增加导出、操作日志添加条件,导出、修复svg无法设置fill属性问题等

This commit is contained in:
吕金泽
2022-04-04 00:50:10 +08:00
parent 782484259d
commit f85efa67d0
18 changed files with 163 additions and 32 deletions
@@ -17,6 +17,9 @@
:placeholder="it.type.startsWith('datetime') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'"
>
</el-date-picker>
<span v-if="it.type == 'inputrange'">
<mb-inputrange v-model="it.value" />
</span>
<component v-else :is="it.type" v-model="it.value" v-bind="it.properties" />
</el-form-item>
</span>
@@ -27,8 +30,6 @@
<el-button class="filter-item" icon="ElDelete" @click="reset">
清空
</el-button>
</el-form-item>
<el-form-item>
<slot name="btns" />
</el-form-item>
</el-form>
@@ -67,7 +68,7 @@ function input(input){
function search(){
for(var key in props.where){
if(props.where[key] instanceof Object){
if(props.where[key].type && props.where[key].type.startsWith('date') && props.where[key].value instanceof Array){
if(props.where[key].type && props.where[key].type.startsWith('date') && props.where[key].value instanceof Array && props.where[key].value.join(',')){
props.where[key].value = props.where[key].value.join(',')
}
}
@@ -76,7 +77,7 @@ function search(){
emit('search')
for(var key in props.where){
if(props.where[key] instanceof Object){
if(props.where[key].type && props.where[key].type.startsWith('date')){
if(props.where[key].type && props.where[key].type.startsWith('date') && props.where[key].value){
props.where[key].value = props.where[key].value.split(',')
}
}
@@ -38,7 +38,7 @@
<script setup>
import { ref, reactive, watch, onMounted, getCurrentInstance,defineExpose } from 'vue'
import request from '@/scripts/request'
import common from "../../../scripts/common";
const { proxy } = getCurrentInstance()
@@ -163,6 +163,53 @@ function reload() {
}
}
function renderExportData(sourceData){
var data = []
var fields = props.cols.filter(it => it.type != 'btns')
sourceData.forEach(it => {
var row = {}
fields.forEach(f => {
if(f.exportTemplet){
row[f.label] = f.exportTemplet(it)
}else if(f.templet){
row[f.label] = f.templet(it)
}else{
row[f.label] = it[f.field]
}
})
data.push(row)
})
return data
}
function exportExcel(){
if(props.url){
var where = proxy.$common.renderWhere(props.where)
where.size = 99999999
var then = (res) => {
const { data } = res
proxy.$common.exportExcel({
data: renderExportData(data.list),
fileName: '用户数据'
})
}
if(props.method.toLowerCase() == 'post'){
proxy.$post(props.url, where).then(res => {
then(res)
})
}else{
proxy.$get(props.url, where).then(res => {
then(res)
})
}
}else if(props.data){
proxy.$common.exportExcel({
data: props.data,
fileName: '用户数据'
})
}
}
function handlerData() {
listLoading.value = true
total.value = props.data.length
@@ -225,7 +272,7 @@ onMounted(() => {
}
})
defineExpose({ reload })
defineExpose({ reload, exportExcel })
</script>
@@ -0,0 +1,31 @@
<template>
<el-input v-model="input1" /> - <el-input v-model="input2" />
</template>
<script setup>
import { ref, watch } from 'vue'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: {
type: String,
default: ''
}
})
const input1 = ref('')
const input2 = ref('')
if(props.modelValue){
input1.value = props.modelValue.split(',')[0]
input2.value = props.modelValue.split(',')[1]
}
watch([input1, input2], () => {
emit('update:modelValue', input1.value + ',' + input2.value)
})
</script>
<style scoped>
.el-input{
display: inline-block;
width: 48%;
}
</style>
@@ -16,7 +16,7 @@
:before-upload="beforeAvatarUpload"
:on-success="handleAvatarSuccess"
>
<el-button type="primary" :loading="uploadLoading" :disabled="!multiple && fileList.length == 1">{{ label }}</el-button>
<el-button type="primary" icon="ElUploadFilled" :loading="uploadLoading" :disabled="!multiple && fileList.length == 1">{{ label }}</el-button>
<div slot="tip" v-if="showTip" class="el-upload__tip">支持上传{{ getSettingSuffixs().replaceAll(',', '') }}文件且不超过{{ maxFileSize }}MB</div>
</el-upload>
</template>