|
@@ -14,12 +14,31 @@
|
|
<cUpload :model="`${'logo'}`" listType="picture" :limit="1" url="/files/ball/team/upload" :list="form.logo" @change="onUpload"></cUpload>
|
|
<cUpload :model="`${'logo'}`" listType="picture" :limit="1" url="/files/ball/team/upload" :list="form.logo" @change="onUpload"></cUpload>
|
|
</template>
|
|
</template>
|
|
<template #member>
|
|
<template #member>
|
|
- <cTable :fields="memberfields" :opera="opera" :list="form.member" :usePage="false" @del="toDel"> </cTable>
|
|
|
|
|
|
+ <el-col :span="24" class="button">
|
|
|
|
+ <el-button type="primary" @click="toAdd()" size="mini">新增</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <cTable :fields="memberfields" :opera="opera" :list="memberList" :usePage="false" @del="toDel"> </cTable>
|
|
</template>
|
|
</template>
|
|
</cForm>
|
|
</cForm>
|
|
</el-col>
|
|
</el-col>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
+ <cDialog :dialog="dialog" @toClose="toClose">
|
|
|
|
+ <template v-slot:info>
|
|
|
|
+ <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
|
|
|
|
+ <el-col :span="24" class="one">
|
|
|
|
+ <el-checkbox-group v-model="memberList">
|
|
|
|
+ <el-checkbox border v-for="item in personList" :label="item" :key="item._id">
|
|
|
|
+ {{ item.name }}
|
|
|
|
+ </el-checkbox>
|
|
|
|
+ </el-checkbox-group>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-button type="primary" @click="toClose" size="mini">保存</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-col>
|
|
|
|
+ </template>
|
|
|
|
+ </cDialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -56,7 +75,10 @@ let fields: Ref<any[]> = ref([
|
|
]);
|
|
]);
|
|
// 字典表
|
|
// 字典表
|
|
const userList: Ref<any> = ref([]);
|
|
const userList: Ref<any> = ref([]);
|
|
|
|
+const personList: Ref<any> = ref([]);
|
|
const genderList: Ref<any> = ref([]);
|
|
const genderList: Ref<any> = ref([]);
|
|
|
|
+// 成员
|
|
|
|
+const memberList: Ref<any> = ref([]);
|
|
|
|
|
|
const memberfields: Ref<any> = ref([
|
|
const memberfields: Ref<any> = ref([
|
|
{ label: '姓名', model: 'name' },
|
|
{ label: '姓名', model: 'name' },
|
|
@@ -66,6 +88,8 @@ const memberfields: Ref<any> = ref([
|
|
]);
|
|
]);
|
|
// 操作
|
|
// 操作
|
|
let opera: Ref<any[]> = ref([{ label: '删除', method: 'del', confirm: true, type: 'danger' }]);
|
|
let opera: Ref<any[]> = ref([{ label: '删除', method: 'del', confirm: true, type: 'danger' }]);
|
|
|
|
+// 弹框
|
|
|
|
+const dialog: Ref<any> = ref({ title: '团队成员选择', show: false, type: '1' });
|
|
// 请求
|
|
// 请求
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
loading.value = true;
|
|
loading.value = true;
|
|
@@ -79,6 +103,7 @@ const search = async () => {
|
|
let res: IQueryResult = await teamAxios.fetch(id);
|
|
let res: IQueryResult = await teamAxios.fetch(id);
|
|
if (res.errcode == '0') {
|
|
if (res.errcode == '0') {
|
|
let info: any = res.data as {};
|
|
let info: any = res.data as {};
|
|
|
|
+ memberList.value = info.member;
|
|
form.value = info;
|
|
form.value = info;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -94,14 +119,20 @@ const onUpload = (e: { model: string; value: Array<[]> }) => {
|
|
const { model, value } = e;
|
|
const { model, value } = e;
|
|
form.value[model] = value;
|
|
form.value[model] = value;
|
|
};
|
|
};
|
|
|
|
+const toAdd = async () => {
|
|
|
|
+ dialog.value = { title: '团队成员选择', show: true, type: '1' };
|
|
|
|
+};
|
|
// 删除
|
|
// 删除
|
|
const toDel = async (data: any) => {
|
|
const toDel = async (data: any) => {
|
|
- console.log(data);
|
|
|
|
- ElMessage({ type: `success`, message: `刪除信息成功` });
|
|
|
|
|
|
+ let list: any = form.value.member.filter((i: any) => i._id != data._id);
|
|
|
|
+ memberList.value = list;
|
|
|
|
+ form.value.number = list.length.toString();
|
|
|
|
+ ElMessage({ type: `success`, message: `删除信息成功` });
|
|
};
|
|
};
|
|
// 保存
|
|
// 保存
|
|
const toSave = async (data) => {
|
|
const toSave = async (data) => {
|
|
let res: IQueryResult;
|
|
let res: IQueryResult;
|
|
|
|
+ data.member = memberList.value;
|
|
if (data._id) res = await teamAxios.update(data);
|
|
if (data._id) res = await teamAxios.update(data);
|
|
else res = await teamAxios.create(data);
|
|
else res = await teamAxios.create(data);
|
|
if (res.errcode == 0) {
|
|
if (res.errcode == 0) {
|
|
@@ -109,12 +140,20 @@ const toSave = async (data) => {
|
|
toBack();
|
|
toBack();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+// 关闭弹框
|
|
|
|
+const toClose = () => {
|
|
|
|
+ form.value.number = memberList.value.length.toString();
|
|
|
|
+ dialog.value = { show: false };
|
|
|
|
+};
|
|
// 查询其他信息
|
|
// 查询其他信息
|
|
const searchOther = async () => {
|
|
const searchOther = async () => {
|
|
let res: IQueryResult;
|
|
let res: IQueryResult;
|
|
// 管理员
|
|
// 管理员
|
|
- res = await userAxios.query({ status: '1' });
|
|
|
|
|
|
+ res = await userAxios.query({ status: '1', type: '1' });
|
|
if (res.errcode == '0') userList.value = res.data;
|
|
if (res.errcode == '0') userList.value = res.data;
|
|
|
|
+ // 比赛人员
|
|
|
|
+ res = await userAxios.query({ status: '1', type: '0' });
|
|
|
|
+ if (res.errcode == '0') personList.value = res.data;
|
|
// 性别
|
|
// 性别
|
|
res = await dictAxios.query({ type: 'gender' });
|
|
res = await dictAxios.query({ type: 'gender' });
|
|
if (res.errcode == '0') genderList.value = res.data;
|
|
if (res.errcode == '0') genderList.value = res.data;
|
|
@@ -124,4 +163,14 @@ const toBack = () => {
|
|
window.history.go(-1);
|
|
window.history.go(-1);
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
-<style scoped lang="scss"></style>
|
|
|
|
|
|
+<style scoped lang="scss">
|
|
|
|
+.button {
|
|
|
|
+ margin: 5px 0;
|
|
|
|
+}
|
|
|
|
+.dialog_one {
|
|
|
|
+ text-align: center;
|
|
|
|
+ .one {
|
|
|
|
+ margin: 0 0 20px 0;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</style>
|