合并代码
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { PageParam } from '@/api';
|
||||
import { ProjectOrder } from "@/api/tower/project/order/model";
|
||||
import { ProjectPlace } from "@/api/tower/project/place/model";
|
||||
import { ProjectOrder } from '@/api/tower/project/order/model';
|
||||
import { ProjectPlace } from '@/api/tower/project/place/model';
|
||||
import { ProjectUser } from '@/api/tower/project/user/model';
|
||||
|
||||
interface FileItem {
|
||||
uid: number;
|
||||
@@ -38,8 +39,10 @@ export interface Project {
|
||||
userId?: number;
|
||||
comments?: string;
|
||||
sortNumber?: number;
|
||||
users?: ProjectUser[];
|
||||
orders?: ProjectOrder[];
|
||||
places?: ProjectPlace[];
|
||||
places1?: ProjectPlace[];
|
||||
places2?: ProjectPlace[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ export interface ProjectUser {
|
||||
avatar?: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
organizationName?: string;
|
||||
projectId?: number;
|
||||
status?: string;
|
||||
createTime?: string;
|
||||
|
||||
64
src/components/DictSelectMultiple/index.vue
Normal file
64
src/components/DictSelectMultiple/index.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<a-select
|
||||
show-search
|
||||
optionFilterProp="label"
|
||||
:options="data"
|
||||
allow-clear
|
||||
:value="value"
|
||||
mode="multiple"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { listDictionaryData } from '@/api/system/dictionary-data';
|
||||
import type { SelectProps } from 'ant-design-vue';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string): void;
|
||||
(e: 'blur'): void;
|
||||
}>();
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
dictCode?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择服务器厂商'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const data = ref<SelectProps['options']>([]);
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
/* 获取字典数据 */
|
||||
listDictionaryData({
|
||||
dictCode: props.dictCode
|
||||
})
|
||||
.then((list) => {
|
||||
data.value = list.map((d) => {
|
||||
return {
|
||||
value: d.dictDataCode,
|
||||
label: d.dictDataName
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
</script>
|
||||
@@ -106,6 +106,10 @@
|
||||
title: '部位名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '部位类型',
|
||||
dataIndex: 'type'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
|
||||
@@ -397,7 +397,6 @@
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
import DictSelect from '@/views/search/components/dict-select.vue';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { TOKEN_STORE_NAME } from '@/config/setting';
|
||||
import { Warehouse } from '@/api/tower/warehouse/model';
|
||||
|
||||
@@ -382,7 +382,6 @@
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
import DictSelect from '@/views/search/components/dict-select.vue';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { TOKEN_STORE_NAME } from '@/config/setting';
|
||||
import { Warehouse } from '@/api/tower/warehouse/model';
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
import type { ColumnsType } from 'ant-design-vue/es/table';
|
||||
import { ProjectOrder } from '@/api/tower/project/order/model';
|
||||
import { removeProjectOrder } from '@/api/tower/project/order';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -173,7 +174,7 @@
|
||||
key: 'startTime'
|
||||
},
|
||||
{
|
||||
title: '预计进场时间',
|
||||
title: '预计退场时间',
|
||||
align: 'center',
|
||||
dataIndex: 'endTime',
|
||||
key: 'endTime'
|
||||
@@ -249,8 +250,9 @@
|
||||
|
||||
/* 删除 */
|
||||
const remove = (_row: any, index: number) => {
|
||||
console.log(_row);
|
||||
removeProjectOrder(_row.projectOrderId);
|
||||
removeProjectOrder(_row.projectOrderId).then((msg) => {
|
||||
message.success(msg);
|
||||
});
|
||||
list.value.splice(index, 1);
|
||||
};
|
||||
|
||||
@@ -260,6 +262,7 @@
|
||||
if (value) {
|
||||
list.value = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<template>
|
||||
<a-spin :spinning="loading">
|
||||
<a-space style="margin-bottom: 10px">
|
||||
<TowerPlaceSelect
|
||||
:placeholder="`选择检查部位`"
|
||||
@done="chooseEquipmentName"
|
||||
/>
|
||||
<TowerPlaceSelect :placeholder="`选择检查部位`" @done="choosePlace" />
|
||||
<span>设备名称</span>
|
||||
<div style="width: 200px">
|
||||
<TowerEquipmentType
|
||||
@@ -38,10 +35,7 @@
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import type { ColumnsType } from 'ant-design-vue/es/table';
|
||||
import { ProjectPlace } from '@/api/tower/project/place/model';
|
||||
import {
|
||||
addProjectPlace,
|
||||
removeProjectPlace
|
||||
} from '@/api/tower/project/place';
|
||||
import { removeProjectPlace } from '@/api/tower/project/place';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -104,14 +98,9 @@
|
||||
}
|
||||
]);
|
||||
|
||||
const chooseEquipmentName = (data) => {
|
||||
addProjectPlace({
|
||||
projectId: props.projectId,
|
||||
placeId: data.placeId
|
||||
}).then((msg) => {
|
||||
message.success(msg);
|
||||
emit('done');
|
||||
});
|
||||
const choosePlace = (data) => {
|
||||
data.projectId = props.projectId;
|
||||
list.value.push(data);
|
||||
};
|
||||
|
||||
const onSearch = () => {
|
||||
@@ -120,9 +109,10 @@
|
||||
|
||||
/* 删除 */
|
||||
const remove = (_row: any, index: number) => {
|
||||
removeProjectPlace(_row.id).then(() => {
|
||||
list.value.splice(index, 1);
|
||||
removeProjectPlace(_row.id).then((msg) => {
|
||||
message.success(msg);
|
||||
});
|
||||
list.value.splice(index, 1);
|
||||
};
|
||||
|
||||
watch(
|
||||
@@ -131,6 +121,7 @@
|
||||
if (value) {
|
||||
list.value = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<template>
|
||||
<a-spin :spinning="loading">
|
||||
<a-space style="margin-bottom: 10px">
|
||||
<TowerPlaceSelect
|
||||
:placeholder="`选择保养部位`"
|
||||
@done="chooseEquipmentName"
|
||||
/>
|
||||
<TowerPlaceSelect :placeholder="`选择保养部位`" @done="choosePlace" />
|
||||
<span>设备名称</span>
|
||||
<div style="width: 200px">
|
||||
<TowerEquipmentType
|
||||
@@ -38,10 +35,7 @@
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import type { ColumnsType } from 'ant-design-vue/es/table';
|
||||
import { ProjectOrder } from '@/api/tower/project/order/model';
|
||||
import {
|
||||
addProjectPlace,
|
||||
removeProjectPlace
|
||||
} from '@/api/tower/project/place';
|
||||
import { removeProjectPlace } from '@/api/tower/project/place';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -104,15 +98,9 @@
|
||||
}
|
||||
]);
|
||||
|
||||
const chooseEquipmentName = (data) => {
|
||||
console.log(data);
|
||||
addProjectPlace({
|
||||
projectId: props.projectId,
|
||||
placeId: data.placeId
|
||||
}).then((msg) => {
|
||||
message.success(msg);
|
||||
emit('done');
|
||||
});
|
||||
const choosePlace = (data) => {
|
||||
data.projectId = props.projectId;
|
||||
list.value.push(data);
|
||||
};
|
||||
|
||||
const onSearch = () => {
|
||||
@@ -121,9 +109,10 @@
|
||||
|
||||
/* 删除 */
|
||||
const remove = (_row: any, index: number) => {
|
||||
removeProjectPlace(_row.id).then(() => {
|
||||
list.value.splice(index, 1);
|
||||
removeProjectPlace(_row.id).then((msg) => {
|
||||
message.success(msg);
|
||||
});
|
||||
list.value.splice(index, 1);
|
||||
};
|
||||
|
||||
watch(
|
||||
@@ -132,6 +121,7 @@
|
||||
if (value) {
|
||||
list.value = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -150,9 +150,8 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="汽吊规格" name="truckCraneSpecs">
|
||||
<DictSelect
|
||||
<DictSelectMultiple
|
||||
dict-code="TruckCraneSpecs"
|
||||
multiple="multiple"
|
||||
v-model:value="form.truckCraneSpecs"
|
||||
placeholder="选择汽吊规格"
|
||||
/>
|
||||
@@ -168,7 +167,7 @@
|
||||
v-bind="styleResponsive ? { md: 8, sm: 24, xs: 24 } : { span: 8 }"
|
||||
>
|
||||
<a-form-item label="项目负责人" name="director">
|
||||
<SelectUser
|
||||
<SelectStaff
|
||||
:placeholder="`请选择所属人员`"
|
||||
v-model:value="form.director"
|
||||
@done="chooseDirector"
|
||||
@@ -190,7 +189,7 @@
|
||||
v-bind="styleResponsive ? { md: 8, sm: 24, xs: 24 } : { span: 8 }"
|
||||
>
|
||||
<a-form-item label="业务负责人" name="salesman">
|
||||
<SelectUser
|
||||
<SelectStaff
|
||||
:placeholder="`请选择业务负责人`"
|
||||
v-model:value="form.salesman"
|
||||
@done="chooseSalesman"
|
||||
@@ -202,58 +201,7 @@
|
||||
|
||||
<a-divider style="height: 8px" />
|
||||
<a-card title="项目成员" :bordered="false">
|
||||
<div class="content">
|
||||
<a-space style="margin-bottom: 15px" v-if="isUpdate">
|
||||
<SelectStaff :placeholder="`添加可见成员`" @done="onViewUsers" />
|
||||
<SelectStaff
|
||||
:placeholder="`添加项目联系人`"
|
||||
@done="onContactUsers"
|
||||
/>
|
||||
</a-space>
|
||||
<table
|
||||
class="ele-table ele-table-border ele-table-stripe ele-table-medium"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>类型</th>
|
||||
<th>姓名</th>
|
||||
<th>手机号码</th>
|
||||
<th>加入时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="user in projectUsers">
|
||||
<td>
|
||||
<a-tag color="green" v-if="user.role === 10"
|
||||
>可见成员</a-tag
|
||||
>
|
||||
<a-tag color="orange" v-if="user.role === 20"
|
||||
>项目联系人</a-tag
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
<a-avatar :src="user.avatar">
|
||||
<template #icon>
|
||||
<user-outlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
<span style="padding-left: 5px">{{ user.nickname }}</span>
|
||||
</td>
|
||||
<td>{{ user.phone }}</td>
|
||||
<td>{{ user.createTime }}</td>
|
||||
<td>
|
||||
<div v-if="user.role !== 30">
|
||||
<a @click="removeUser(user)" v-if="user.status === 0">
|
||||
移除
|
||||
</a>
|
||||
<a v-else>待确认</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<UserList :project-id="form.projectId" v-model:value="form.users" />
|
||||
</a-card>
|
||||
|
||||
<a-divider style="height: 8px" />
|
||||
@@ -270,7 +218,7 @@
|
||||
<a-tab-pane key="1" tab="检查部位">
|
||||
<InspectList
|
||||
:project-id="form.projectId"
|
||||
v-model:value="form.places"
|
||||
v-model:value="form.places1"
|
||||
@done="reload"
|
||||
@search="onSearch"
|
||||
/>
|
||||
@@ -278,7 +226,7 @@
|
||||
<a-tab-pane key="2" tab="保养部位" force-render>
|
||||
<MaintenanceList
|
||||
:project-id="form.projectId"
|
||||
v-model:value="form.places"
|
||||
v-model:value="form.places2"
|
||||
@done="reload"
|
||||
@search="onSearch"
|
||||
/>
|
||||
@@ -302,8 +250,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addProject, updateProject } from '@/api/tower/project';
|
||||
import type { Project } from '@/api/tower/project/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
@@ -312,26 +259,21 @@
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { Customer } from '@/api/oa/customer/model';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import DictSelect from '@/views/search/components/dict-select.vue';
|
||||
import { User } from '@/api/system/user/model';
|
||||
import { uploadFile } from '@/api/system/file';
|
||||
import { FILE_SERVER } from '@/config/setting';
|
||||
import UserList from './user-list.vue';
|
||||
import EquipmentList from './equipment-list.vue';
|
||||
import InspectList from './inspect-list.vue';
|
||||
import MaintenanceList from './maintenance-list.vue';
|
||||
import { CenterPoint } from 'ele-admin-pro/es/ele-map-picker/types';
|
||||
import {
|
||||
addProjectUser,
|
||||
listProjectUser,
|
||||
removeProjectUser
|
||||
} from '@/api/tower/project/user';
|
||||
import { ProjectUser } from '@/api/tower/project/user/model';
|
||||
import { listProjectUser } from '@/api/tower/project/user';
|
||||
import { listProjectOrder } from '@/api/tower/project/order';
|
||||
import { listProjectPlace } from '@/api/tower/project/place';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
@@ -358,15 +300,13 @@
|
||||
const showMap = ref(false);
|
||||
const activeKey = ref<string>('1');
|
||||
const keywords = ref<string>();
|
||||
// 项目成员
|
||||
const projectUsers = ref<ProjectUser[]>([]);
|
||||
// 省市区
|
||||
const city = ref<string[]>([]);
|
||||
const { darkMode } = storeToRefs(themeStore);
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<Project>({
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Project>({
|
||||
projectId: undefined,
|
||||
projectName: '',
|
||||
projectImage: '',
|
||||
@@ -380,19 +320,22 @@
|
||||
superviseNo: '',
|
||||
licenceNo: '',
|
||||
securityStatus: undefined,
|
||||
competentDepartment: '',
|
||||
competentDepartment: undefined,
|
||||
dismantlingCompany: '',
|
||||
truckCraneSpecs: '',
|
||||
truckCraneSpecs: undefined,
|
||||
contract: '',
|
||||
director: '',
|
||||
projectDirector: '',
|
||||
projectStatus: '',
|
||||
projectStatus: undefined,
|
||||
salesman: '',
|
||||
status: 0,
|
||||
userId: 0,
|
||||
comments: '',
|
||||
sortNumber: 100,
|
||||
orders: []
|
||||
users: [],
|
||||
orders: [],
|
||||
places1: [],
|
||||
places2: []
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
@@ -488,52 +431,6 @@
|
||||
form.salesman = data.nickname;
|
||||
};
|
||||
|
||||
// 添加可见成员
|
||||
const onViewUsers = (data: User) => {
|
||||
console.log(data.userId);
|
||||
addProjectUser({
|
||||
userId: data.userId,
|
||||
projectId: props.data?.projectId,
|
||||
role: 10
|
||||
})
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
// 添加项目联系人
|
||||
const onContactUsers = (data: User) => {
|
||||
console.log(data.userId);
|
||||
addProjectUser({
|
||||
userId: data.userId,
|
||||
projectId: props.data?.projectId,
|
||||
role: 20
|
||||
})
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
// 移除成员
|
||||
const removeUser = (data: ProjectUser) => {
|
||||
removeProjectUser(data.id)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 地图选择后回调 */
|
||||
const onDone = (location: CenterPoint) => {
|
||||
console.log(location);
|
||||
@@ -543,9 +440,6 @@
|
||||
`${location.city?.district}`
|
||||
];
|
||||
form.projectRegion = `${location.city?.city} ${location.city?.district}`;
|
||||
// form.province = `${location.city?.province}`;
|
||||
// form.city = `${location.city?.city}`;
|
||||
// form.region = `${location.city?.district}`;
|
||||
form.projectAddress = `${location.address}`;
|
||||
form.latitude = `${location.lat}`;
|
||||
form.longitude = `${location.lng}`;
|
||||
@@ -596,8 +490,6 @@
|
||||
reload();
|
||||
};
|
||||
|
||||
const { resetFields, validate, validateInfos } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
@@ -635,42 +527,60 @@
|
||||
if (activeKey.value == '2') {
|
||||
keywords.value = '保养';
|
||||
}
|
||||
reload();
|
||||
if (isUpdate.value) {
|
||||
reload();
|
||||
}
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
loading.value = true;
|
||||
// 加载项目成员
|
||||
listProjectUser({
|
||||
projectId: props.data?.projectId
|
||||
}).then((data) => {
|
||||
projectUsers.value = data;
|
||||
});
|
||||
// 加载项目合同预定设备清单
|
||||
listProjectOrder({ projectId: props.data?.projectId })
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
form.orders = data.map((d) => {
|
||||
return {
|
||||
...d,
|
||||
isEdit: false
|
||||
};
|
||||
if (props.data?.projectId) {
|
||||
// 加载项目成员
|
||||
listProjectUser({
|
||||
projectId: props.data?.projectId
|
||||
})
|
||||
.then((data) => {
|
||||
form.users = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
// 加载项目合同预定设备清单
|
||||
listProjectOrder({ projectId: props.data?.projectId })
|
||||
.then((data) => {
|
||||
form.orders = data.map((d) => {
|
||||
return {
|
||||
...d,
|
||||
isEdit: false
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
// 加载检查/保养部位配置
|
||||
listProjectPlace({
|
||||
projectId: props.data?.projectId,
|
||||
keywords: '巡检'
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
// 加载检查/保养部位配置
|
||||
listProjectPlace({
|
||||
projectId: props.data?.projectId,
|
||||
keywords: keywords.value
|
||||
})
|
||||
.then((data) => {
|
||||
form.places = data;
|
||||
.then((data) => {
|
||||
form.places1 = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
// 加载检查/保养部位配置
|
||||
listProjectPlace({
|
||||
projectId: props.data?.projectId,
|
||||
keywords: '保养'
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
.then((data) => {
|
||||
form.places2 = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
};
|
||||
reload();
|
||||
|
||||
@@ -679,8 +589,9 @@
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
|
||||
assignFields({
|
||||
...props.data
|
||||
});
|
||||
images.value = [];
|
||||
if (props.data.projectImage) {
|
||||
const arr = JSON.parse(props.data.projectImage);
|
||||
@@ -698,6 +609,11 @@
|
||||
reload();
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
images.value = [];
|
||||
form.places1 = [];
|
||||
form.places2 = [];
|
||||
form.users = [];
|
||||
form.orders = [];
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
|
||||
142
src/views/tower/project/components/user-list.vue
Normal file
142
src/views/tower/project/components/user-list.vue
Normal file
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<a-spin :spinning="loading">
|
||||
<!-- <a-button type="primary" style="margin-bottom: 10px" @click="add">-->
|
||||
<!-- <span>添加</span>-->
|
||||
<!-- </a-button>-->
|
||||
<a-space style="margin-bottom: 15px">
|
||||
<SelectStaff :placeholder="`添加可见成员`" @done="addUsers10" />
|
||||
<SelectStaff :placeholder="`添加项目联系人`" @done="addUsers20" />
|
||||
</a-space>
|
||||
<a-table
|
||||
size="middle"
|
||||
row-key="projectOrderId"
|
||||
:pagination="false"
|
||||
:data-source="list"
|
||||
:columns="columns"
|
||||
>
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'role'">
|
||||
<a-tag color="green" v-if="record.role === 10">可见成员</a-tag>
|
||||
<a-tag color="orange" v-if="record.role === 20">项目联系人</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a class="ele-text-danger" @click="remove(record, index)">移除</a>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import type { ColumnsType } from 'ant-design-vue/es/table';
|
||||
import { ProjectUser } from '@/api/tower/project/user/model';
|
||||
import { removeProjectUser } from '@/api/tower/project/user';
|
||||
import { User } from '@/api/system/user/model';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value?: ProjectUser[];
|
||||
projectId?: number;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择数据'
|
||||
}
|
||||
);
|
||||
|
||||
// 已添加成员
|
||||
const list = ref<ProjectUser[]>([]);
|
||||
// 请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 列
|
||||
const columns = reactive<ColumnsType>([
|
||||
{
|
||||
key: 'index',
|
||||
align: 'center',
|
||||
width: 48,
|
||||
customRender: ({ index }) => index + 1,
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
align: 'center',
|
||||
dataIndex: 'role',
|
||||
key: 'role'
|
||||
},
|
||||
{
|
||||
title: '所在部门',
|
||||
align: 'center',
|
||||
dataIndex: 'organizationName'
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
align: 'center',
|
||||
dataIndex: 'nickname',
|
||||
key: 'nickname'
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
align: 'center',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone'
|
||||
},
|
||||
{
|
||||
title: '加入时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
align: 'center',
|
||||
width: 100
|
||||
}
|
||||
]);
|
||||
|
||||
// 添加可见成员
|
||||
const addUsers10 = (data: User) => {
|
||||
list.value.push({
|
||||
userId: data.userId,
|
||||
nickname: data.nickname,
|
||||
role: 10,
|
||||
phone: data.phone,
|
||||
projectId: props.projectId,
|
||||
organizationName: data.organizationName
|
||||
});
|
||||
};
|
||||
// 添加项目联系人
|
||||
const addUsers20 = (data: User) => {
|
||||
list.value.push({
|
||||
userId: data.userId,
|
||||
nickname: data.nickname,
|
||||
role: 20,
|
||||
phone: data.phone,
|
||||
projectId: props.projectId,
|
||||
organizationName: data.organizationName
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除 */
|
||||
const remove = (_row: any, index: number) => {
|
||||
removeProjectUser(_row.id).then((msg) => {
|
||||
message.success(msg);
|
||||
});
|
||||
list.value.splice(index, 1);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
(value) => {
|
||||
if (value) {
|
||||
list.value = value;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
@@ -10,6 +10,8 @@
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
:customRow="customRow"
|
||||
:height="tableHeight"
|
||||
:full-height="fixedHeight ? 'calc(100vh - 100px)' : void 0"
|
||||
tool-class="ele-toolbar-form"
|
||||
:scroll="{ x: 1200 }"
|
||||
class="sys-org-table"
|
||||
@@ -21,7 +23,6 @@
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@advanced="openAdvanced"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
@@ -33,9 +34,9 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">库存查看</a>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="openEdit(record)">项目年报</a>
|
||||
<a @click="openEdit(record)">库存查看</a>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
@@ -50,7 +51,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { createVNode, computed, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
@@ -129,7 +130,7 @@
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 200,
|
||||
width: 150,
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
@@ -143,8 +144,12 @@
|
||||
const showInfo = ref(false);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示高级搜索
|
||||
const showAdvancedSearch = ref(false);
|
||||
// 表格固定高度
|
||||
const fixedHeight = ref(true);
|
||||
// 表格高度
|
||||
const tableHeight = computed(() => {
|
||||
return fixedHeight.value ? 'calc(100vh - 308px)' : void 0;
|
||||
});
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
@@ -195,11 +200,6 @@
|
||||
showInfo.value = true;
|
||||
};
|
||||
|
||||
/* 打开高级搜索 */
|
||||
const openAdvanced = () => {
|
||||
showAdvancedSearch.value = !showAdvancedSearch.value;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Project) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
|
||||
@@ -29,10 +29,9 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="企业类型" name="companyTypeMultiple">
|
||||
<DictSelect
|
||||
<DictSelectMultiple
|
||||
dict-code="CompanyType"
|
||||
placeholder="请选择企业类型"
|
||||
multiple="multiple"
|
||||
v-model:value="form.companyTypeMultiple"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -154,7 +153,6 @@ import {ref, reactive, watch, computed} from 'vue';
|
||||
import type { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FILE_SERVER, FILE_THUMBNAIL } from "@/config/setting";
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import DictSelect from "@/views/search/components/dict-select.vue";
|
||||
import {
|
||||
EnvironmentOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
Reference in New Issue
Block a user