|
|
@@ -12,7 +12,7 @@
|
|
|
<a-col :span="12">
|
|
|
<a-form-item
|
|
|
field="user"
|
|
|
- :label="t('dashboard.form.user')"
|
|
|
+ :label="t('dashboard.form.name')"
|
|
|
:rules="getRules(t).required"
|
|
|
>
|
|
|
<a-input v-model="form.user" />
|
|
|
@@ -38,13 +38,40 @@
|
|
|
<a-input v-model="form.location" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item field="hostName" :label="t('dashboard.form.hostName')">
|
|
|
+ <a-input v-model="form.hostName" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row :gutter="8">
|
|
|
<a-col :span="12">
|
|
|
<a-form-item
|
|
|
- field="hostName"
|
|
|
- :label="t('dashboard.form.hostName')"
|
|
|
+ field="userId"
|
|
|
+ :label="t('dashboard.form.user')"
|
|
|
:rules="getRules(t).required"
|
|
|
>
|
|
|
- <a-input v-model="form.hostName" />
|
|
|
+ <a-select
|
|
|
+ v-model="form.userId"
|
|
|
+ :placeholder="t('dashboard.form.user')"
|
|
|
+ allow-clear
|
|
|
+ @clear="form.userId = null"
|
|
|
+ >
|
|
|
+ <a-option
|
|
|
+ v-for="item of userList"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.user"
|
|
|
+ />
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item
|
|
|
+ field="password"
|
|
|
+ :label="t('dashboard.form.password')"
|
|
|
+ :rules="getRules(t).required"
|
|
|
+ >
|
|
|
+ <a-input v-model="form.password" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
@@ -56,9 +83,11 @@
|
|
|
import { reactive, ref, shallowRef, watch, getCurrentInstance } from 'vue';
|
|
|
import { getPluginDetails, savePluginDetails } from '@/api/dashboard';
|
|
|
import type { DataList } from '@/api/dashboard';
|
|
|
-import { privilegeList } from '@/utils/const';
|
|
|
+import { privilegeList, getRules } from '@/utils/const';
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
-import { getRules } from '@/utils/const';
|
|
|
+import type { UserData, UserParams } from '@/api/user';
|
|
|
+import { getUserList, fetchDeleteUser } from '@/api/user';
|
|
|
+
|
|
|
const formRef = ref();
|
|
|
const { t } = useI18n();
|
|
|
|
|
|
@@ -78,7 +107,7 @@ const props = withDefaults(defineProps<EditDialogProps>(), {
|
|
|
});
|
|
|
const emit = defineEmits<EditDialogEmits>();
|
|
|
const visible = shallowRef<boolean>(false);
|
|
|
-
|
|
|
+const userList = ref<UserData[]>([] as UserData[]);
|
|
|
watch(
|
|
|
() => props.modelValue,
|
|
|
value => {
|
|
|
@@ -92,18 +121,22 @@ watch(
|
|
|
);
|
|
|
const formModel = () => {
|
|
|
return {
|
|
|
+ id: 0,
|
|
|
+ userId: null,
|
|
|
server: '',
|
|
|
user: '',
|
|
|
- password: '',
|
|
|
location: '',
|
|
|
hostName: '',
|
|
|
} as DataList;
|
|
|
};
|
|
|
const form = ref<DataList>(formModel());
|
|
|
-
|
|
|
+getUserList({}).then(res => {
|
|
|
+ userList.value.push(...res.data);
|
|
|
+});
|
|
|
const handleBeforeOk = (done: (closed: boolean) => void) => {
|
|
|
formRef.value.validate().then((data: DataList) => {
|
|
|
if (!data) {
|
|
|
+ form.value.id = props.id || 0;
|
|
|
savePluginDetails(form.value)
|
|
|
.then(res => {
|
|
|
if (res.success) {
|