mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
ad360e81cb
perf: 优化antdv4 示例授权页面tree的样式 build: publish success chore: 1 chore: 1 chore: 1 fix: getFileName支持item参数 https://github.com/fast-crud/fast-crud/issues/385 fix: fs-form独立使用支持插槽 https://github.com/fast-crud/fast-crud/issues/389 fix: 修复三级以上路由页面无法缓存的问题 https://github.com/fast-crud/fast-crud/issues/394 perf: form.wrapper.buttons支持compute动态计算 feat: 表单支持变更关闭前提醒保存,form.wrapper支持beforeClose事件 fix: 修复图片裁剪按钮上下和左右相反的bug https://github.com/fast-crud/fast-crud/issues/402 perf: alioss getAuthorization接口支持后台返回key https://github.com/fast-crud/fast-crud/issues/405 perf: alioss getAuthorization接口支持后台返回key https://github.com/fast-crud/fast-crud/issues/405 perf: fs-dict-tree支持插槽 https://github.com/fast-crud/fast-crud/issues/407 perf: 单选、多选、select、tree-select、table-select 都提供selected-change事件,可以获取选中的dict选项 feat: table-select 支持查看模式 https://github.com/fast-crud/fast-crud/issues/413 perf: 优化fs-admin可以在手机上操作 chore: pnpm workspace问题优化 docs: 1 chore: antdv4 支持主题色选择 ...
82 lines
2.8 KiB
Vue
82 lines
2.8 KiB
Vue
<template>
|
||
<fs-page>
|
||
<template #header>
|
||
<div class="title">可编辑</div>
|
||
<div class="more"><a target="_blank" href="http://fast-crud.docmirror.cn/api/crud-options/table.html#editable">文档</a></div>
|
||
</template>
|
||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||
<template #actionbar-right>
|
||
<!-- <fs-button class="ml-1" @click="addRow">添加行</fs-button>-->
|
||
<a-radio-group v-model:value="crudBinding.table.editable.enabled" class="ml-5">
|
||
<a-radio-button :value="true">启用编辑</a-radio-button>
|
||
<a-radio-button :value="false">退出编辑</a-radio-button>
|
||
</a-radio-group>
|
||
<a-radio-group v-model:value="crudBinding.table.editable.showAction" class="ml-1">
|
||
<a-radio-button :value="true">显示操作按钮</a-radio-button>
|
||
<a-radio-button :value="false">不显示</a-radio-button>
|
||
</a-radio-group>
|
||
<a-radio-group v-model:value="crudBinding.table.editable.activeDefault" class="ml-1">
|
||
<a-radio-button :value="true">默认激活</a-radio-button>
|
||
<a-radio-button :value="false">默认不激活</a-radio-button>
|
||
</a-radio-group>
|
||
<template v-if="crudBinding.table.editable.enabled">
|
||
<fs-button class="ml-5" @click="save">保存</fs-button>
|
||
<fs-button class="ml-5" @click="log">log</fs-button>
|
||
</template>
|
||
</template>
|
||
</fs-crud>
|
||
</fs-page>
|
||
</template>
|
||
|
||
<script lang="ts">
|
||
import { defineComponent, onMounted, ref } from "vue";
|
||
import createCrudOptions from "./crud";
|
||
import { useFs, utils } from "@fast-crud/fast-crud";
|
||
import { message } from "ant-design-vue";
|
||
|
||
export default defineComponent({
|
||
name: "EditableFree",
|
||
setup() {
|
||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||
|
||
// 页面打开后获取列表数据
|
||
onMounted(() => {
|
||
crudExpose.doRefresh();
|
||
crudExpose.editable.enable({ mode: "free" });
|
||
});
|
||
|
||
return {
|
||
crudBinding,
|
||
crudRef,
|
||
active() {
|
||
crudExpose.editable.active({});
|
||
},
|
||
inactive() {
|
||
crudExpose.editable.inactive();
|
||
},
|
||
async save() {
|
||
const res = await crudExpose.editable.validate();
|
||
if (res !== true) {
|
||
console.error("validate error:", res);
|
||
message.error("validate error:" + JSON.stringify(res));
|
||
return;
|
||
}
|
||
message.success("保存,修改行:" + JSON.stringify(crudBinding.value.data));
|
||
},
|
||
log() {
|
||
utils.logger.info("table data:", crudBinding.value.data, crudExpose.getTableData());
|
||
},
|
||
cancel() {
|
||
crudExpose.editable.resume();
|
||
},
|
||
addRow() {
|
||
crudExpose.editable.addRow();
|
||
},
|
||
editCol() {
|
||
crudExpose.editable.activeCols({ cols: ["radio"] });
|
||
}
|
||
};
|
||
}
|
||
});
|
||
</script>
|