帮扶任务分配
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<AppLayout :title="title" :show-bg-image="false" >
|
||||
<view class="main-list" :style="getBackgroundStyle('k.png')">
|
||||
<view class="main-list" :style="getBackgroundStyle('k.png')" v-if="showVue=='main'">
|
||||
<view class="list-top">
|
||||
<view class="list-title">
|
||||
<text>创建任务</text>
|
||||
@@ -19,16 +19,16 @@
|
||||
<uni-data-select v-model="formData.priority" placeholder="请选择优先级" :localdata="priorityOptions" @change="priorityChange"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标人员:" required >
|
||||
<button class="choice-btn">从帮扶人员库选择目标人员</button>
|
||||
<button class="choice-btn" @click="choicePerson">从帮扶人员库选择目标人员</button>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="目标人数:" name="goalPersonCount" required>
|
||||
<uni-easyinput v-model="formData.taskAllocation.goalPersonCount" ></uni-easyinput>
|
||||
<uni-forms-item label="目标人数:" name="taskAllocation.goalPersonCount" required>
|
||||
<uni-easyinput v-model="formData.taskAllocation.goalPersonCount" disabled></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="执行区域:" name="executeDeptId" required >
|
||||
<uni-forms-item label="执行区域:" name="taskAllocation.executeDeptId" required >
|
||||
<uni-data-select v-model="formData.taskAllocation.executeDeptId" placeholder="请选择执行区域" :localdata="executeDeptOptions" @change="executeDeptChange"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="截止时间:" name="deadline" required>
|
||||
<uni-datetime-picker class="picker-value" type="date" placeholder="请选择截止时间" v-model="formData.taskAllocation.deadline" @change="onDateChange" />
|
||||
<uni-forms-item label="截止时间:" name="taskAllocation.deadline" required>
|
||||
<uni-datetime-picker class="picker-value" type="date" placeholder="请选择截止时间" v-model="formData.taskAllocation.deadline" @change="onDateChange" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="分配说明:" name="allocationNote" >
|
||||
<uni-easyinput type="textarea" v-model="formData.taskAllocation.allocationNote" placeholder="请输入分配说明"></uni-easyinput>
|
||||
@@ -41,6 +41,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" v-else>
|
||||
<target-personel-choice @update:show-vue="handleShowVueChange"></target-personel-choice>
|
||||
</view>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
@@ -49,6 +52,7 @@ import { inject, ref, reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
const { $api, navTo, navBack } = inject('globalFunction');
|
||||
import config from "@/config.js"
|
||||
import targetPersonelChoice from './targetPersonnelChoice.vue'
|
||||
|
||||
const props = defineProps({
|
||||
taskTypeOptions: {
|
||||
@@ -105,19 +109,19 @@ const rules = {
|
||||
errorMessage: '请选择优先级'
|
||||
}]
|
||||
},
|
||||
goalPersonCount: {
|
||||
'taskAllocation.goalPersonCount': {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请选择目标人员'
|
||||
}]
|
||||
},
|
||||
executeDeptId: {
|
||||
'taskAllocation.executeDeptId': {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请选择执行区域'
|
||||
}]
|
||||
},
|
||||
deadline:{
|
||||
'taskAllocation.deadline':{
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请选择截止时间'
|
||||
@@ -131,25 +135,71 @@ const getBackgroundStyle = (imageName) => ({
|
||||
backgroundPosition: 'center', // 居中
|
||||
backgroundRepeat: 'no-repeat'
|
||||
});
|
||||
const showVue=ref('main')
|
||||
const emit = defineEmits(['update:showView'])
|
||||
|
||||
function choicePerson(){
|
||||
showVue.value='choice'
|
||||
}
|
||||
// 事件处理
|
||||
function onDateChange(){}
|
||||
function taskTypeChange(){}
|
||||
function priorityChange(){}
|
||||
function executeDeptChange(){}
|
||||
function onDateChange(e){
|
||||
formData.taskAllocation.deadline=e
|
||||
}
|
||||
function taskTypeChange(e){
|
||||
formData.taskType=e
|
||||
}
|
||||
function priorityChange(e){
|
||||
formData.priority=e
|
||||
}
|
||||
function executeDeptChange(e){
|
||||
formData.taskAllocation.executeDeptId=e
|
||||
formData.taskAllocation.executeDeptName=getLabelByValue(e,props.executeDeptOptions)
|
||||
formData.taskAllocation.executeDeptAncestors=getAncestorsByValue(e,props.executeDeptOptions)
|
||||
}
|
||||
function getLabelByValue(value,arr) {
|
||||
if (!Array.isArray(arr)) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const item = arr.find(item => item.value === value)
|
||||
return item ? item.text : '暂无'
|
||||
}
|
||||
function getAncestorsByValue(value,arr){
|
||||
if (!Array.isArray(arr)) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const item = arr.find(item => item.value === value)
|
||||
return item ? item.ancestors : ''
|
||||
}
|
||||
function normalizePersonData(dataList) {
|
||||
if (!Array.isArray(dataList)) return [];
|
||||
return dataList.map(obj => {
|
||||
const fullValue = obj;
|
||||
return {
|
||||
personId: String(fullValue) // 确保转为字符串,防止意外类型
|
||||
};
|
||||
});
|
||||
}
|
||||
function handleShowVueChange(newValue){
|
||||
showVue.value=newValue.showVue
|
||||
if(newValue.selectedPersonIds&&newValue.selectedPersonIds.length>0){
|
||||
formData.taskAllocation.goalPersonList = normalizePersonData(newValue.selectedPersonIds)
|
||||
formData.taskAllocation.goalPersonCount=newValue.selectedPersonIds.length
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
const handleSubmit = () => {
|
||||
formRef.value?.validate()
|
||||
.then(() => {
|
||||
let header={
|
||||
'Authorization':uni.getStorageSync('fourLevelLinkage-token')
|
||||
'Authorization':uni.getStorageSync('Padmin-Token')
|
||||
}
|
||||
$api.myRequest('/dispatch/assist/records/addRecords', formData,'post',9100,header).then((resData) => {
|
||||
console.log("resData",resData)
|
||||
$api.myRequest('/dispatch/assist/task/add', formData,'post',9100,header).then((resData) => {
|
||||
if(resData && resData.code == 200){
|
||||
handleReset()
|
||||
handleCancel()
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
title: '创建成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user