update table修改

This commit is contained in:
小陌 2023-09-05 15:23:52 +08:00
parent 56e68109d5
commit 57a5d52a2c
5 changed files with 37 additions and 20 deletions

View File

@ -40,6 +40,10 @@
<template v-else-if="item.component=='upload'"> <template v-else-if="item.component=='upload'">
<x-upload v-model="data[item.name]" v-bind="item.options"></x-upload> <x-upload v-model="data[item.name]" v-bind="item.options"></x-upload>
</template> </template>
<!-- uploadfile -->
<template v-else-if="item.component=='uploadfile'">
<x-upload-file v-model="data[item.name]" draggable v-bind="item.options"></x-upload-file>
</template>
<!-- updatemultiple --> <!-- updatemultiple -->
<template v-else-if="item.component=='updatemultiple'"> <template v-else-if="item.component=='updatemultiple'">
<x-upload-multiple v-model="data[item.name]" draggable v-bind="item.options"></x-upload-multiple> <x-upload-multiple v-model="data[item.name]" draggable v-bind="item.options"></x-upload-multiple>

View File

@ -23,16 +23,17 @@
</p> </p>
<p v-else-if="item.columntype=='button' && item.options.items && item.options.items.length>0"> <p v-else-if="item.columntype=='button' && item.options.items && item.options.items.length>0">
<template v-for="{ value, type = 'warning', size = 'small', label, icon, link } in item.options.items"> <template v-for="op in item.options.items">
<el-button <el-button
@click="handleClick(row, item)" @click="handleClick(row, op.options || item)"
:key="value" :key="op.value"
:type="type" :type="op.type || 'warning'"
:size="size" :size="op.size || 'small'"
:link="link" :link="op.link"
:icon="icon" :icon="op.icon"
:circle="op.circle || false"
v-if="value === row[item.name]"> v-if="value === row[item.name]">
{{ label }} {{ op.label }}
</el-button> </el-button>
</template> </template>
</p> </p>
@ -63,6 +64,7 @@
}, },
methods: { methods: {
handleClick(row, item){ handleClick(row, item){
// //
if (item.open && item.open.name && row[item.open.name]?.trim()) { if (item.open && item.open.name && row[item.open.name]?.trim()) {
window.open(row[item.open.name], "_blank"); window.open(row[item.open.name], "_blank");
@ -83,14 +85,21 @@
remoteurl: item.table.url || 'table/get?name='+item.table.name remoteurl: item.table.url || 'table/get?name='+item.table.name
}, item.table.type || 'dialog', 'table'); }, item.table.type || 'dialog', 'table');
return ; return ;
}else if(item.http && item.http.url && item.http.key && row[item.http.key]?.trim()){ }else if(item.http && item.http.url && item.http.key && String(row[item.http.key])?.trim()){
this.$http.post(item.http.url, {[item.http.key]: row[item.http.key]}).then((res) => {
if (res.code == 200 ) { this.$confirm( item.http.title || '确定要执行?', '提示', { type: item.http.type || 'warning' }).then(() => {
this.$message.success(res.message || '操作成功') const loading = this.$loading();
return; this.$http.post(item.http.url, {[item.http.key]: row[item.http.key]}).then((res) => {
} loading.close();
this.$alert(res.message || '操作失败', "提示", {type: 'error'}); if (res.code == 200 ) {
}); this.$message.success(res.message || '操作成功')
return;
}
this.$alert(res.message || '操作失败', "提示", {type: 'error'});
});
}).catch(() => {
})
} }
}, },
getType(value) { getType(value) {

View File

@ -59,7 +59,7 @@
</div> </div>
</div> </div>
<x-update v-if="tableUpdateKey" :name="tableUpdateKey" ref="xtableupdate" @success="handleSuccess" @closed="tableUpdateKey=''"></x-update> <x-update v-if="tableUpdateKey" :name="tableUpdateKey" ref="xtableupdate" @success="handleSuccess" @closed="tableUpdateKey=''"></x-update>
<xTabledialog v-if="xtabledialog" ref="xtabledialog" v-model="xtabledialog"></xTabledialog> <xTabledialog v-if="xtabledialog" :name="xtabledialog" ref="xtabledialog" v-model="xtabledialog"></xTabledialog>
</template> </template>
@ -195,7 +195,7 @@
this.xtabledialog = options.name || this.name; this.xtabledialog = options.name || this.name;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.xtabledialog.open().getComponentType(componenttype).setConfig(options); this.$refs.xtabledialog.open().setData(row).getComponentType(componenttype).setConfig(options);
}) })
}, },
// //

View File

@ -4,7 +4,6 @@
--> -->
<template> <template>
<div class="x-tabledialog"> <div class="x-tabledialog">
<component :is="componentType" :title="(config.name || titleMap[mode]) || '编辑'" v-model="visible" :size="size" :style="style" @closed="$emit('closed')" width="80%"> <component :is="componentType" :title="(config.name || titleMap[mode]) || '编辑'" v-model="visible" :size="size" :style="style" @closed="$emit('closed')" width="80%">
<div style="padding:0 6px 6px 6px" class="pagetable"> <div style="padding:0 6px 6px 6px" class="pagetable">
<xTable <xTable
@ -26,7 +25,6 @@
</xTable> </xTable>
</div> </div>
<template #footer> <template #footer>
<el-pagination <el-pagination
style="float: right;" style="float: right;"
background background
@ -122,6 +120,9 @@
// //
if (this.config.remoteurl) { if (this.config.remoteurl) {
this.loading = true; this.loading = true;
this.key = this.config.key || this.key;
setTimeout(async ()=>{ setTimeout(async ()=>{
var res = await this.$http.get(this.config.remoteurl, {[this.key]: this.data[this.key]}) var res = await this.$http.get(this.config.remoteurl, {[this.key]: this.data[this.key]})

View File

@ -108,6 +108,9 @@
// //
if (this.config.remoteurl) { if (this.config.remoteurl) {
this.loading = true; this.loading = true;
this.key = this.config.key || this.key;
setTimeout(async ()=>{ setTimeout(async ()=>{
var res = await this.$http.get(this.config.remoteurl, {[this.key]: this.data[this.key]}) var res = await this.$http.get(this.config.remoteurl, {[this.key]: this.data[this.key]})
if (res.code == 200 ) { if (res.code == 200 ) {