Browse Source

优化 添加组件能力

lincl 4 years ago
parent
commit
2fc74cb303

+ 5 - 10
src/components/Dialog/index.vue

@ -77,24 +77,19 @@ export default {
</script>
<style lang="scss">
.dialog-com-el-dialog{
.el-dialog.dialog-com-el-dialog{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
	margin-top: 0!important;
	// height: calc(100vh - 100px);
	.el-dialog__body{
		padding: 10px 10px 10px 15px;
		// >div{
			// height: calc(100% - 54px);
			>.el-scrollbar{
				// height: calc(100% - 56px);
				.el-scrollbar__wrap{
					overflow-x: hidden;
				}
		>.el-scrollbar{
			.el-scrollbar__wrap{
				overflow-x: hidden;
			}
		// }
		}
	}
	.el-dialog__header{
		padding: 15px;

+ 15 - 3
src/components/Form/Upload.vue

@ -56,13 +56,25 @@ export default {
				if(typeof n == 'string'){
					this.imgList = [n]
					list.push({
							name: '', url: this.setImgUrl(n)
						})
						name: '', 
						url: this.setImgUrl(n),
						response: {
							obj: {
								fullUri: n
							}
						}
					})
				} else {
					this.imgList = n
					this.imgList.forEach(v=>{
						list.push({
							name: '', url: this.setImgUrl(v)
							name: '', 
							url: this.setImgUrl(v),
							response: {
								obj: {
									fullUri: v
								}
							}
						})
					})
				}

+ 15 - 1
src/components/Form/index.vue

@ -70,6 +70,14 @@ export default {
			return !!this.configs.fields[0].groupTitle
		}
	},
	watch:{
		form:{
			handler(n){
				this.$emit('input', this.form)
			},
			deep: true
		}
	},
	data(){
		return {
			activeNames: [],
@ -160,10 +168,13 @@ export default {
			})
		},
		setValues(model){
			for(var k in this.form){
			for(var k in model){
				this.form[k] = model[k]
			}
		},
		setValue(id, value){
			this.form[id] = value
		},
		hasSlot(list, key){
			for(var i=0; i<list.length; i++){
				if(list[i].id == key){
@ -178,6 +189,9 @@ export default {
<style lang="scss">
.form-com{
	.el-collapse-item__header{
		font-size: 16px;
	}
	.el-collapse-item__content{
		padding-bottom: 0;
		padding-top: 10px;

+ 34 - 3
src/components/TablePage/index.vue

@ -1,7 +1,7 @@
<template>
	<div class="table-page-com">
		<template v-if="inited">
		<div class="search-bar">
		<div class="search-bar" v-if="showSearchBar">
			<el-form :inline="true">
				<template v-for="(item, i) in configs.columns">
					<el-form-item :label="item.label" :key="i" v-if="item.isSearch" :class="{'radioGroup-item':item.type=='radioGroup'}">
@ -46,8 +46,8 @@
						</el-radio-group>
					</el-form-item>
				</template>
				<el-form-item>
					<el-button type="primary" icon="el-icon-search" @click="emitLoad()">查询</el-button>
				<el-form-item class="mb22">
					<el-button v-if="showSearchButton" type="primary" icon="el-icon-search" @click="emitLoad()">查询</el-button>
					<el-button @click="$emit('onAdd')" v-if="configs.showAddButton" type="success" icon="el-icon-circle-plus-outline">新增</el-button>
					<slot name="topBanner"></slot>
				</el-form-item>
@ -58,6 +58,12 @@
			<div style="position:absolute;height:100%;width:100%">
				<el-table v-on="$listeners" v-bind="$attrs" v-loading="loading" border height="100%" style="width: 100%; ">
					<el-table-column
						v-if="configs.selection"
						type="selection"
						width="55">
					</el-table-column>
					<el-table-column
						v-else
						type="index"
						label="序号"
						align="center"
@ -148,6 +154,28 @@ export default {
			inited: true
		}
	},
	computed:{
		showSearchBar(){
			var res = _.filter(this.configs.columns, (item)=>{
				return item.isSearch
			})
			return this.showSearchButton || this.configs.showAddButton
		},
		showSearchButton(){
			var res = _.filter(this.configs.columns, (item)=>{
				return item.isSearch
			})
			return res.length>0
		}
	},
	watch: {
		searchForm: {
			handler(n){
				this.$emit('getSearchForm', n)
			},
			immediate: true
		},
	},
	created(){
		var searchForm = {}
		this.configs.columns.forEach(v => {
@ -212,6 +240,9 @@ export default {
		width: auto;
		margin-right: 40px;
	}
	.mb22{
		margin-bottom: 22px;
	}
}
</style>
<style lang="scss">

+ 7 - 0
src/utils/validateForm.js

@ -150,6 +150,13 @@ const validateForm = {
      callback(new Error($t('valid.formatError')))
    }
    callback()
  },
  digit: (rule, value, callback) => {
    let reg = /^[0-9]*$/
    if (!reg.test(value)) {
      callback(new Error("请输入整型数字"));
    }
    callback();
  }
}