|
@@ -22,21 +22,48 @@
|
|
</uni-card>
|
|
</uni-card>
|
|
</uni-collapse-item>
|
|
</uni-collapse-item>
|
|
</uni-collapse>
|
|
</uni-collapse>
|
|
|
|
+ <view class="add">
|
|
|
|
+ <uni-forms
|
|
|
|
+ label-position="top"
|
|
|
|
+ class="form"
|
|
|
|
+ ref="form"
|
|
|
|
+ :modelValue="formData"
|
|
|
|
+ :rules="rules"
|
|
|
|
+ >
|
|
|
|
+ <uni-forms-item label="添加成员" name="member">
|
|
|
|
+ <uni-data-picker
|
|
|
|
+ ref="member"
|
|
|
|
+ class="depSelect"
|
|
|
|
+ :localdata="depUserTree"
|
|
|
|
+ @change="changeMember"
|
|
|
|
+ />
|
|
|
|
+ </uni-forms-item>
|
|
|
|
+ </uni-forms>
|
|
|
|
+ <button class="button" @click="onAddMember">添加</button>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
-import { queryMember, deleteMember } from "@/services/project";
|
|
|
|
|
|
+import { queryMember, deleteMember, addMember } from "@/services/project";
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
memberList: [],
|
|
memberList: [],
|
|
|
|
+ formData: {
|
|
|
|
+ member: "",
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ member: {
|
|
|
|
+ rules: [{ required: true, errorMessage: "请选择成员" }],
|
|
|
|
+ },
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState(["currentProject"]),
|
|
|
|
|
|
+ ...mapState(["currentProject", "depUserTree"]),
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
this.init();
|
|
this.init();
|
|
@@ -78,6 +105,32 @@ export default {
|
|
},
|
|
},
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ changeMember(e) {
|
|
|
|
+ if (e.detail.value.length > 0)
|
|
|
|
+ this.formData.member = e.detail.value[e.detail.value.length - 1].value;
|
|
|
|
+ else this.formData.member = "";
|
|
|
|
+ },
|
|
|
|
+ onAddMember() {
|
|
|
|
+ this.$refs.form.validate(async (err) => {
|
|
|
|
+ if (!err) {
|
|
|
|
+ const member_id = this.formData.member.split("-")[1];
|
|
|
|
+ let payload = {
|
|
|
|
+ project_code_id: this.currentProject.id,
|
|
|
|
+ user_id: Number(member_id),
|
|
|
|
+ };
|
|
|
|
+ await addMember(payload);
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "添加成功",
|
|
|
|
+ });
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ uni.hideToast();
|
|
|
|
+ this.init();
|
|
|
|
+ this.$refs.member.clear();
|
|
|
|
+ this.formData.member = "";
|
|
|
|
+ }, 1800);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -95,6 +148,9 @@ export default {
|
|
.list {
|
|
.list {
|
|
margin: 0 5% 20px 5%;
|
|
margin: 0 5% 20px 5%;
|
|
width: 100%;
|
|
width: 100%;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
+ justify-content: center;
|
|
}
|
|
}
|
|
.actions {
|
|
.actions {
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
@@ -104,6 +160,31 @@ export default {
|
|
justify-content: flex-end;
|
|
justify-content: flex-end;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+.add {
|
|
|
|
+ width: 90%;
|
|
|
|
+ margin-top: 20px;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.form {
|
|
|
|
+ width: 100%;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.depSelect {
|
|
|
|
+ background: #fff;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.button {
|
|
|
|
+ width: 60px;
|
|
|
|
+ height: 40px;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ background: #1890ff;
|
|
|
|
+ color: #fff;
|
|
|
|
+ margin: 0;
|
|
|
|
+}
|
|
|
|
+
|
|
::v-deep {
|
|
::v-deep {
|
|
.uni-collapse-item__title-text {
|
|
.uni-collapse-item__title-text {
|
|
font-size: 16px;
|
|
font-size: 16px;
|