|
|
@ -10,17 +10,17 @@
|
|
|
|
<template v-slot:body-cell-status="props">
|
|
|
|
<template v-slot:body-cell-status="props">
|
|
|
|
<q-td :props="props">
|
|
|
|
<q-td :props="props">
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<q-chip outline :color="statusOpts[props.row.status][1]" text-color="white" icon="event">
|
|
|
|
<q-chip outline :color="auOpts[props.row.au][1]" text-color="white" icon="event">
|
|
|
|
{{ statusOpts[props.row.status][0] }}
|
|
|
|
{{ auOpts[props.row.au][0] }}
|
|
|
|
</q-chip>
|
|
|
|
</q-chip>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<q-popup-edit v-model="props.row.status" v-slot="scope" buttons
|
|
|
|
<q-popup-edit v-model="props.row.au" v-slot="scope" buttons
|
|
|
|
@save="update_status(props.row.id, $event, props.row.status)" label-set="确定" label-cancel="取消">
|
|
|
|
@save="update_status(props.row.id, $event, props.row.au)" label-set="确定" label-cancel="取消">
|
|
|
|
<div class="mt-4 mb-2">切换状态至</div>
|
|
|
|
<div class="mt-4 mb-2">切换状态至</div>
|
|
|
|
<div class="q-gutter-sm">
|
|
|
|
<div class="q-gutter-sm">
|
|
|
|
|
|
|
|
|
|
|
|
<q-radio :key="i" v-for="i in [0, 1, 2, 3]" keep-color v-model="scope.value" :val="i"
|
|
|
|
<q-radio :key="i" v-for="i in [0, 1, 2, 3]" keep-color v-model="scope.value" :val="i" :label="auOpts[i][0]"
|
|
|
|
:label="statusOpts[i][0]" :color="statusOpts[i][1]" />
|
|
|
|
:color="auOpts[i][1]" />
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</q-popup-edit>
|
|
|
|
</q-popup-edit>
|
|
|
@ -31,18 +31,18 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted, ref } from 'vue';
|
|
|
|
import { computed, inject, onMounted, Ref, ref, watch } from 'vue';
|
|
|
|
import { AUStatus, modelsAppUser } from 'src/models';
|
|
|
|
import { AUStatus, modelsAppUser, modelsUser, modelsApp } from 'src/models';
|
|
|
|
import { QTableProps } from 'quasar';
|
|
|
|
|
|
|
|
import api from 'src/boot/api';
|
|
|
|
import api from 'src/boot/api';
|
|
|
|
import { useAppStore } from 'src/stores/app';
|
|
|
|
import msg from '@veypi/msg';
|
|
|
|
|
|
|
|
|
|
|
|
const statusOpts: { [index: number]: any } = {
|
|
|
|
const auOpts: { [index: number]: any } = {
|
|
|
|
[AUStatus.OK]: ['正常', 'positive'],
|
|
|
|
[AUStatus.OK]: ['正常', 'positive'],
|
|
|
|
[AUStatus.Deny]: ['拒绝', 'warning'],
|
|
|
|
[AUStatus.Deny]: ['拒绝', 'warning'],
|
|
|
|
[AUStatus.Applying]: ['申请中', 'primary'],
|
|
|
|
[AUStatus.Applying]: ['申请中', 'primary'],
|
|
|
|
[AUStatus.Disabled]: ['禁用', 'warning'],
|
|
|
|
[AUStatus.Disabled]: ['禁用', 'warning'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let app = inject('app') as Ref<modelsApp>
|
|
|
|
const columns = [
|
|
|
|
const columns = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: 'id',
|
|
|
|
name: 'id',
|
|
|
@ -64,23 +64,35 @@ const columns = [
|
|
|
|
{ name: 'action', field: 'action', align: 'center', label: '操作' },
|
|
|
|
{ name: 'action', field: 'action', align: 'center', label: '操作' },
|
|
|
|
] as any
|
|
|
|
] as any
|
|
|
|
|
|
|
|
|
|
|
|
const rows = ref([
|
|
|
|
const rows = ref([] as modelsUser[])
|
|
|
|
{
|
|
|
|
|
|
|
|
id: '1', username: 'name', nickname: 'asd', created: 'asdsss',
|
|
|
|
|
|
|
|
status: 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const update_status = (d, s) => {
|
|
|
|
const update_status = (id: string, n: number, old: number) => {
|
|
|
|
|
|
|
|
api.app.user(app.value.id).update(id, n).then(e => {
|
|
|
|
|
|
|
|
msg.Info('修改成功')
|
|
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
|
|
let a = rows.value.find(a => a.id = id) || {} as any
|
|
|
|
|
|
|
|
a.status = old
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
console.log([d, s])
|
|
|
|
console.log([id, n, old])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
const sync = () => {
|
|
|
|
api.app.user(useAppStore().id).list('-', { user: true }).then((e:
|
|
|
|
if (!app.value.id) {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
api.app.user(app.value.id).list('-', { user: true }).then((e:
|
|
|
|
modelsAppUser[]) => {
|
|
|
|
modelsAppUser[]) => {
|
|
|
|
rows.value = e.map(i => i.user)
|
|
|
|
rows.value = e.map(i => {
|
|
|
|
|
|
|
|
i.user.au = i.status
|
|
|
|
|
|
|
|
return i.user
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
watch(computed(() => app.value.id), () => sync())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
|
|
sync()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|