<!--
|
项目团队子表的一行
|
|
成员 / 角色下拉由父级统一拉取后传入(多个行共用一份选项,不重复请求)。
|
提交时后端不反查 userName / userRoleName,所以选中后要把 label 一起记在 row 上。
|
-->
|
<template>
|
<view class="team-card">
|
<view class="team-header">
|
<text class="team-title">成员 {{ index + 1 }}</text>
|
<up-icon name="trash"
|
color="#ee0a24"
|
size="18"
|
@click="$emit('remove')"></up-icon>
|
</view>
|
<up-divider></up-divider>
|
|
<view class="team-body">
|
<view class="field-row">
|
<text class="field-label">姓名</text>
|
<FormPicker v-model="row.memberId"
|
type="select"
|
title="选择项目成员"
|
:options="userOptions"
|
placeholder="请选择成员"
|
@change="onMemberChange" />
|
</view>
|
|
<view class="field-row">
|
<text class="field-label">项目组角色</text>
|
<FormPicker v-model="row.roleId"
|
type="select"
|
title="选择项目组角色"
|
:options="roleOptions"
|
placeholder="请选择角色"
|
@change="onRoleChange" />
|
</view>
|
|
<view class="field-row">
|
<text class="field-label">进入日期</text>
|
<FormPicker v-model="row.enterDate"
|
type="date"
|
placeholder="请选择进入日期" />
|
</view>
|
|
<view class="field-row">
|
<text class="field-label">离开日期</text>
|
<FormPicker v-model="row.leaveDate"
|
type="date"
|
placeholder="请选择离开日期" />
|
</view>
|
|
<view class="field-row">
|
<text class="field-label">联系方式</text>
|
<u-input v-model="row.phone"
|
placeholder="请输入联系方式"
|
border="none"
|
inputAlign="right" />
|
</view>
|
|
<view class="field-row">
|
<text class="field-label">备注</text>
|
<u-input v-model="row.remark"
|
placeholder="请输入备注"
|
border="none"
|
inputAlign="right" />
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import FormPicker from "@/components/FormPicker.vue";
|
|
const props = defineProps({
|
row: {
|
type: Object,
|
required: true,
|
},
|
index: {
|
type: Number,
|
default: 0,
|
},
|
userOptions: {
|
type: Array,
|
default: () => [],
|
},
|
roleOptions: {
|
type: Array,
|
default: () => [],
|
},
|
});
|
|
defineEmits(["remove"]);
|
|
// 选中后把 label 记到行上,提交时随 payload 一起发给后端
|
const onMemberChange = (value, item) => {
|
props.row.memberName = item?.name || props.row.memberName || "";
|
};
|
|
const onRoleChange = (value, item) => {
|
props.row.roleName = item?.name || props.row.roleName || "";
|
};
|
</script>
|
|
<style scoped lang="scss">
|
.team-card {
|
background: #fff;
|
border-radius: 12px;
|
padding: 0 12px 12px;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
}
|
|
.team-header {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
padding: 12px 0;
|
}
|
|
.team-title {
|
font-size: 14px;
|
font-weight: 600;
|
color: #22324d;
|
}
|
|
.team-body {
|
padding-top: 4px;
|
}
|
|
.field-row {
|
display: flex;
|
align-items: center;
|
min-height: 44px;
|
border-bottom: 1px solid #f5f6fa;
|
}
|
|
.field-row:last-child {
|
border-bottom: none;
|
}
|
|
.field-label {
|
width: 96px;
|
flex-shrink: 0;
|
font-size: 14px;
|
color: #606266;
|
}
|
</style>
|