|
@@ -7,7 +7,7 @@
|
|
|
</n-space>
|
|
|
<n-space class="w-full pt-16px" :size="25" justify="end">
|
|
|
<n-button class="w-72px" @click="closeModal">取消</n-button>
|
|
|
- <n-button class="w-72px" type="primary" @click="handleSubmit">保持</n-button>
|
|
|
+ <n-button class="w-72px" type="primary" @click="handleSubmit">保存</n-button>
|
|
|
</n-space>
|
|
|
</n-form>
|
|
|
</n-modal>
|
|
@@ -16,7 +16,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import { computed, h, reactive, ref, watch } from 'vue';
|
|
|
import type { FormInst, DataTableColumns } from 'naive-ui';
|
|
|
-import { NButton, NSelect, NTag, NSpace } from 'naive-ui';
|
|
|
+import { NButton, NSelect, NTag, NSpace, NInput } from 'naive-ui';
|
|
|
export interface Props {
|
|
|
/** 弹窗可见性 */
|
|
|
settingVisible: boolean;
|
|
@@ -87,7 +87,7 @@ const createColumns = (): DataTableColumns<RowField.Data> => [
|
|
|
{ label: 'No', value: '2' }
|
|
|
],
|
|
|
// value: tableData.value[index].column_name,
|
|
|
- onUpdateTableValue(value: string) {
|
|
|
+ onUpdateValue(value: string) {
|
|
|
console.log('选择事件', value);
|
|
|
}
|
|
|
});
|
|
@@ -99,16 +99,23 @@ const createColumns = (): DataTableColumns<RowField.Data> => [
|
|
|
maxWidth: 200,
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
render(row, index) {
|
|
|
- return h(NSelect, {
|
|
|
- options: [
|
|
|
- { label: 'OK', value: '1' },
|
|
|
- { label: 'No', value: '2' }
|
|
|
- ],
|
|
|
- // value: tableData.value[index].column_name,
|
|
|
- onUpdateTableValue(value: string) {
|
|
|
- console.log('选择事件', value);
|
|
|
- }
|
|
|
- });
|
|
|
+ return [
|
|
|
+ h(NSelect, {
|
|
|
+ options: [
|
|
|
+ { label: 'OK', value: '1' },
|
|
|
+ { label: 'No', value: '2' }
|
|
|
+ ],
|
|
|
+ // value: tableData.value[index].column_name,
|
|
|
+ onUpdateValue(value: string) {
|
|
|
+ console.log('选择事件', value);
|
|
|
+ },
|
|
|
+ style: { width: '30%' }
|
|
|
+ }),
|
|
|
+ h(NInput, {
|
|
|
+ size: 'small',
|
|
|
+ style: { width: '30%' }
|
|
|
+ })
|
|
|
+ ];
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -123,7 +130,7 @@ const createColumns = (): DataTableColumns<RowField.Data> => [
|
|
|
{ label: 'No', value: '2' }
|
|
|
],
|
|
|
// value: tableData.value[index].column_name,
|
|
|
- onUpdateTableValue(value: string) {
|
|
|
+ onUpdateValue(value: string) {
|
|
|
console.log('选择事件', value);
|
|
|
}
|
|
|
});
|
|
@@ -141,7 +148,7 @@ const createColumns = (): DataTableColumns<RowField.Data> => [
|
|
|
{ label: 'No', value: '2' }
|
|
|
],
|
|
|
// value: tableData.value[index].column_name,
|
|
|
- onUpdateTableValue(value: string) {
|
|
|
+ onUpdateValue(value: string) {
|
|
|
console.log('选择事件', value);
|
|
|
}
|
|
|
});
|
|
@@ -150,15 +157,14 @@ const createColumns = (): DataTableColumns<RowField.Data> => [
|
|
|
{
|
|
|
title: '操作',
|
|
|
key: 'actions',
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
- render(row, index) {
|
|
|
+ render: row => {
|
|
|
return [
|
|
|
h(
|
|
|
NButton,
|
|
|
{
|
|
|
type: 'info',
|
|
|
size: 'small',
|
|
|
- onClick: () => editData(index) // 点击按钮后的回调
|
|
|
+ onClick: () => editData(row) // 点击按钮后的回调
|
|
|
},
|
|
|
{ default: () => '编辑' } // 按钮显示名称
|
|
|
),
|
|
@@ -167,7 +173,7 @@ const createColumns = (): DataTableColumns<RowField.Data> => [
|
|
|
{
|
|
|
type: 'error',
|
|
|
size: 'small',
|
|
|
- onClick: () => deleteData(index) // 点击按钮后的回调
|
|
|
+ onClick: () => deleteData(row) // 点击按钮后的回调
|
|
|
},
|
|
|
{ default: () => '删除' } // 按钮显示名称
|
|
|
)
|
|
@@ -233,12 +239,12 @@ function createDefaultFormModel(): FormModel {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-function deleteData(index: number) {
|
|
|
- console.log('==index=====', index);
|
|
|
+function deleteData(row: RowField.Data) {
|
|
|
+ console.log('==index=====', row);
|
|
|
}
|
|
|
|
|
|
-function editData(index: number) {
|
|
|
- console.log('==index=====', index);
|
|
|
+function editData(row: RowField.Data) {
|
|
|
+ console.log('==index=====', row);
|
|
|
}
|
|
|
|
|
|
function handleUpdateFormModelByModalType() {
|