add selectComponent & search form styles

This commit is contained in:
lb 2023-01-30 14:12:45 +08:00
parent f80cc652ad
commit ff77ab8546
6 changed files with 55 additions and 10 deletions

View File

@ -10,13 +10,14 @@
:prop="opt.prop ?? '' + index" :prop="opt.prop ?? '' + index"
:rules="opt.bind?.rules ? opt.bind.rules : undefined" :rules="opt.bind?.rules ? opt.bind.rules : undefined"
> >
<el-input v-if="opt.input" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable /> <el-input v-if="opt.input" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small" />
<el-select v-if="opt.select" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable> <el-select v-if="opt.select" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small">
<el-option v-for="item in opt.select" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in opt.select" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
<el-date-picker v-if="opt.timerange" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable /> <el-date-picker v-if="opt.timerange" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small" />
<el-upload <el-upload
v-if="opt.upload" v-if="opt.upload"
size="small"
:key="'upload_' + Math.random().toString()" :key="'upload_' + Math.random().toString()"
class="inline-block pl-3" class="inline-block pl-3"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
@ -26,7 +27,9 @@
<el-button <el-button
v-if="opt.button && (!opt.button.permission || $hasPermission(opt.button.permission))" v-if="opt.button && (!opt.button.permission || $hasPermission(opt.button.permission))"
:key="'button' + Math.random().toString()" :key="'button' + Math.random().toString()"
size="small"
:type="opt.button.type" :type="opt.button.type"
v-bind="opt.bind"
@click="handleBtnClick(opt.button.name)" @click="handleBtnClick(opt.button.name)"
>{{ opt.button.name }}</el-button >{{ opt.button.name }}</el-button
> >
@ -37,7 +40,7 @@
<script> <script>
export default { export default {
name: "", name: "BaseSearchForm",
props: { props: {
headConfig: { headConfig: {
type: Object, type: Object,
@ -65,7 +68,7 @@ export default {
console.log("[BaseSearchForm] configs:", JSON.parse(JSON.stringify(this.headConfig))); console.log("[BaseSearchForm] configs:", JSON.parse(JSON.stringify(this.headConfig)));
this.headConfig.fields.forEach((field, index) => { this.headConfig.fields.forEach((field, index) => {
// field.prop // field.prop
if (!field.prop) return; if (!field.prop) return;
if (!this.dataForm[field.prop]) { if (!this.dataForm[field.prop]) {

View File

@ -0,0 +1,30 @@
// import i18n from '@/i18n'
export default {
name: 'SelectComponent',
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
// TODO: i18n
defaultText: '查看详情'
}
},
methods: {
emitClick() {
// console.log('inject data:' ,this.injectData)
this.$emit('emit-data', {
type: this.injectData.head?.actionName || 'select-change-action',
data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id
})
}
},
render: function (h) {
// console.log('button content:', this.injectData)
return h('span', null, [h('el-button', { props: { type: 'text' }, style: { paddingLeft: 0 }, on: { click: this.emitClick } }, this.injectData.head?.buttonContent || this.defaultText)])
}
}

View File

@ -42,9 +42,12 @@ export default function () {
}, },
{ {
button: { button: {
type: 'plain', type: 'primary',
name: '新增', name: '新增',
permission: '' permission: ''
},
bind: {
plain: true,
} }
} }
] ]

View File

@ -40,9 +40,12 @@ export default function () {
}, },
{ {
button: { button: {
type: 'plain', type: 'primary',
name: '新增', name: '新增',
permission: 'pms:materialType:save' permission: 'pms:materialType:save'
},
bind: {
plain: true,
} }
} }
] ]

View File

@ -39,10 +39,13 @@ export default function () {
}, },
{ {
button: { button: {
type: "plain", type: "primary",
name: "新增", name: "新增",
permission: "pms:productionLine:save", permission: "pms:productionLine:save"
}, },
bind: {
plain: true,
}
}, },
]; ];

View File

@ -37,9 +37,12 @@ export default function () {
}, },
{ {
button: { button: {
type: 'plain', type: 'primary',
name: '新增', name: '新增',
permission: 'pms:workSequence:save' permission: 'pms:workSequence:save'
},
bind: {
plain: true,
} }
} }
] ]