update table修改
This commit is contained in:
parent
56e68109d5
commit
57a5d52a2c
@ -40,6 +40,10 @@
|
||||
<template v-else-if="item.component=='upload'">
|
||||
<x-upload v-model="data[item.name]" v-bind="item.options"></x-upload>
|
||||
</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 -->
|
||||
<template v-else-if="item.component=='updatemultiple'">
|
||||
<x-upload-multiple v-model="data[item.name]" draggable v-bind="item.options"></x-upload-multiple>
|
||||
|
@ -23,16 +23,17 @@
|
||||
</p>
|
||||
|
||||
<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
|
||||
@click="handleClick(row, item)"
|
||||
:key="value"
|
||||
:type="type"
|
||||
:size="size"
|
||||
:link="link"
|
||||
:icon="icon"
|
||||
@click="handleClick(row, op.options || item)"
|
||||
:key="op.value"
|
||||
:type="op.type || 'warning'"
|
||||
:size="op.size || 'small'"
|
||||
:link="op.link"
|
||||
:icon="op.icon"
|
||||
:circle="op.circle || false"
|
||||
v-if="value === row[item.name]">
|
||||
{{ label }}
|
||||
{{ op.label }}
|
||||
</el-button>
|
||||
</template>
|
||||
</p>
|
||||
@ -63,6 +64,7 @@
|
||||
},
|
||||
methods: {
|
||||
handleClick(row, item){
|
||||
|
||||
// 打开新窗口链接
|
||||
if (item.open && item.open.name && row[item.open.name]?.trim()) {
|
||||
window.open(row[item.open.name], "_blank");
|
||||
@ -83,14 +85,21 @@
|
||||
remoteurl: item.table.url || 'table/get?name='+item.table.name
|
||||
}, item.table.type || 'dialog', 'table');
|
||||
return ;
|
||||
}else if(item.http && item.http.url && item.http.key && 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.$message.success(res.message || '操作成功')
|
||||
return;
|
||||
}
|
||||
this.$alert(res.message || '操作失败', "提示", {type: 'error'});
|
||||
});
|
||||
}else if(item.http && item.http.url && item.http.key && String(row[item.http.key])?.trim()){
|
||||
|
||||
this.$confirm( item.http.title || '确定要执行?', '提示', { type: item.http.type || 'warning' }).then(() => {
|
||||
const loading = this.$loading();
|
||||
this.$http.post(item.http.url, {[item.http.key]: row[item.http.key]}).then((res) => {
|
||||
loading.close();
|
||||
if (res.code == 200 ) {
|
||||
this.$message.success(res.message || '操作成功')
|
||||
return;
|
||||
}
|
||||
this.$alert(res.message || '操作失败', "提示", {type: 'error'});
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
getType(value) {
|
||||
|
@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@
|
||||
|
||||
this.xtabledialog = options.name || this.name;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.xtabledialog.open().getComponentType(componenttype).setConfig(options);
|
||||
this.$refs.xtabledialog.open().setData(row).getComponentType(componenttype).setConfig(options);
|
||||
})
|
||||
},
|
||||
//获取数据
|
||||
|
@ -4,7 +4,6 @@
|
||||
-->
|
||||
<template>
|
||||
<div class="x-tabledialog">
|
||||
|
||||
<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">
|
||||
<xTable
|
||||
@ -26,7 +25,6 @@
|
||||
</xTable>
|
||||
</div>
|
||||
<template #footer>
|
||||
|
||||
<el-pagination
|
||||
style="float: right;"
|
||||
background
|
||||
@ -122,6 +120,9 @@
|
||||
// 远程读取数据
|
||||
if (this.config.remoteurl) {
|
||||
this.loading = true;
|
||||
|
||||
this.key = this.config.key || this.key;
|
||||
|
||||
setTimeout(async ()=>{
|
||||
var res = await this.$http.get(this.config.remoteurl, {[this.key]: this.data[this.key]})
|
||||
|
||||
|
@ -108,6 +108,9 @@
|
||||
// 远程读取数据
|
||||
if (this.config.remoteurl) {
|
||||
this.loading = true;
|
||||
|
||||
this.key = this.config.key || this.key;
|
||||
|
||||
setTimeout(async ()=>{
|
||||
var res = await this.$http.get(this.config.remoteurl, {[this.key]: this.data[this.key]})
|
||||
if (res.code == 200 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user