1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<script setup lang="ts">
import { ref } from 'vue';
import { useQuasar } from 'quasar';
import emitter from '../../eventbus';
import ICONS from 'src/config/icons';
import { ComDialogTip } from 'src/components';
const props = defineProps<{
params: any;
}>();
const $q = useQuasar();
const prompt = ref(false);
const msg = ref(null);
function delCol() {
$q.dialog({
component: ComDialogTip,
componentProps: {
persistent: true,
text: `确定删除当前列 ${props.params.displayName}`,
color: 'negative',
},
}).onOk(() => {
emitter.emit('delCol', props.params);
});
}
function onDblclick() {
const data = props.params.column;
if (data.instanceId === 0 || data.colId === 'del') return;
msg.value = props.params.displayName;
prompt.value = true;
}
function oncancel() {
onreset();
}
function onok() {
const params = {
data: props.params,
value: msg.value,
};
emitter.emit('upDataHeader', params);
onreset();
}
function onreset() {
prompt.value = false;
msg.value = null;
}
</script>
<template>
<div class="ag-grid-head-cell">
<q-btn
flat
round
:icon="ICONS.delete"
size="11px"
v-if="
props.params.column.instanceId !== 0 &&
props.params.column.colId !== 'del'
"
@click="delCol"
/>
<div @dblclick="onDblclick">{{ props.params.displayName }}</div>
</div>
<q-dialog v-model="prompt" persistent>
<q-card style="min-width: 350px">
<q-card-section class="q-mt-lg">
<q-input dense v-model="msg" autofocus @keyup.enter="onok" />
</q-card-section>
<q-card-actions align="right" class="text-primary">
<q-btn label="取消" flat @click="oncancel" size="11px" />
<q-btn
label="确定"
unelevated
color="primary"
@click="onok"
size="11px"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<style lang="scss">
.ag-grid-head-cell {
width: 100%;
height: 100%;
// border: 1px solid red;
display: flex;
flex-direction: row;
align-items: center;
}
</style>