更新
This commit is contained in:
parent
392006ad66
commit
a8ebb37b22
@ -8,21 +8,15 @@
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form class="formdata" ref="formRef" :model="formData" label-width="120px">
|
||||
<el-form-item required label="时间日程范围">
|
||||
<el-date-picker
|
||||
v-model="datetime"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
/>
|
||||
<el-form class="formdata" :model="detailsdt" label-width="120px">
|
||||
<el-form-item class="datatime" label="时间日程范围">
|
||||
<el-input v-model="detailsdt.start_time" />
|
||||
</el-form-item>
|
||||
<el-form-item required label="日程内容">
|
||||
<el-input v-model="content"/>
|
||||
<el-form-item label="日程内容">
|
||||
<el-input v-model="detailsdt.task_info.content"/>
|
||||
</el-form-item>
|
||||
<el-form-item required label="日程描述">
|
||||
<el-input type="textarea" v-model="content"/>
|
||||
<el-form-item label="日程描述">
|
||||
<el-input type="textarea" v-model="detailsdt.task_info.title"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@ -35,7 +29,7 @@ import type { FormInstance } from "element-plus";
|
||||
import Popup from "@/components/popup/index.vue";
|
||||
import { apiTaskCreat, apiTaskView } from "@/api/task";
|
||||
import { timeFormat } from "@/utils/util";
|
||||
import { reactive, onMounted, type PropType } from "vue";
|
||||
import { reactive,onUpdated , type PropType } from "vue";
|
||||
import DialogIndexMan from "./dialog_index_man.vue";
|
||||
const props = defineProps({
|
||||
dictData: {
|
||||
@ -57,14 +51,17 @@ const popupRef = shallowRef<InstanceType<typeof Popup>>();
|
||||
const mode = ref("add");
|
||||
const datetime = ref(null);
|
||||
const detailsdt = ref({});
|
||||
const defaultTime = ref({
|
||||
starttime:"",
|
||||
endtime:""
|
||||
});
|
||||
// 弹窗标题
|
||||
// const popupTitle = computed(() => {
|
||||
// return mode.value == "edit" ? "创建日程安排" : "新增任务";
|
||||
// });
|
||||
|
||||
onMounted(() => {
|
||||
// props.detailsdata?.toDateString()? (detailsdt = props.detailsdata):null;
|
||||
|
||||
onUpdated(() => {
|
||||
detailsdt.value=props.detailsdata
|
||||
});
|
||||
|
||||
const priorityList = reactive([
|
||||
@ -163,12 +160,12 @@ function customEventManThe(data: any) {
|
||||
}
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
const data = { ...formData };
|
||||
mode.value == "edit" ? await apiTaskCreat(data) : await apiTaskCreat(data);
|
||||
popupRef.value?.close();
|
||||
emit("success");
|
||||
};
|
||||
// const handleSubmit = async () => {
|
||||
// const data = { ...formData };
|
||||
// mode.value == "edit" ? await apiTaskCreat(data) : await apiTaskCreat(data);
|
||||
// popupRef.value?.close();
|
||||
// emit("success");
|
||||
// };
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = "add") => {
|
||||
|
@ -18,7 +18,7 @@
|
||||
{{ data.day.split("-").slice(1).join("-") }}
|
||||
<!-- {{ data.isSelected ? '✔️' : '' }} -->
|
||||
</p>
|
||||
<div>{{dateNow(data.day)}}</div>
|
||||
<div>{{ dateNow(data.day) }}</div>
|
||||
<div
|
||||
class="task"
|
||||
:class="{
|
||||
@ -48,7 +48,6 @@
|
||||
@success="loadTask"
|
||||
@close="showEdit = false"
|
||||
/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -60,18 +59,53 @@ import feedback from "@/utils/feedback";
|
||||
// import { getRoutePath } from "router";
|
||||
import EditPopup from "./edit.vue";
|
||||
import { reactive, watch } from "vue";
|
||||
import { apiTaskList ,apiTaskDetails} from '@/api/task'
|
||||
import { apiTaskList, apiTaskDetails } from "@/api/task";
|
||||
const dateValue = ref(new Date());
|
||||
watch(() => dateValue, async(newValue, oldValue) => {
|
||||
editRef.value?.open("add");
|
||||
const detailsdata = reactive({
|
||||
create_time: "",
|
||||
create_user_id: 0,
|
||||
delete_time: "",
|
||||
end_time: "",
|
||||
extend: "",
|
||||
id: "",
|
||||
scheduling_id: "",
|
||||
sn: "",
|
||||
start_time: "",
|
||||
status: "",
|
||||
task_id: "",
|
||||
task_info: {
|
||||
admin_id: 0,
|
||||
content: "",
|
||||
create_time: "",
|
||||
delete_time: "",
|
||||
id: 0,
|
||||
money: "",
|
||||
status: 0,
|
||||
title: "",
|
||||
type: 0,
|
||||
type_name: "",
|
||||
update_time: "",
|
||||
},
|
||||
template_id: 0,
|
||||
update_time: "",
|
||||
});
|
||||
watch(
|
||||
() => dateValue,
|
||||
async (newValue, oldValue) => {
|
||||
const id = taskList.value.find((item) =>item.start_time.split(" ")[0] == timeFormat(newValue.value.getTime()))?.id;
|
||||
if(id){
|
||||
const res = await apiTaskDetails({ id });
|
||||
Object.keys(detailsdata).forEach((key) => {
|
||||
res[key] ? (detailsdata[key] = res[key]) : null;
|
||||
});
|
||||
editRef.value?.open("add");
|
||||
initShowDate(timeFormat(newValue.value.getTime()));
|
||||
const id=taskList.value.find((item)=>item.start_time.split(' ')[0]==timeFormat(newValue.value.getTime())).template_id
|
||||
const detailsdata = await apiTaskDetails({id})
|
||||
}
|
||||
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
|
||||
// 加载
|
||||
const loading = ref(true);
|
||||
|
||||
@ -93,9 +127,9 @@ const taskList = ref<any>([]);
|
||||
const loadTask = async () => {
|
||||
// let res: any = await apiTaskIndex(queryParams);
|
||||
// taskList.value = res.lists;
|
||||
apiTaskList(queryParams).then((res)=>{
|
||||
taskList.value = res.lists
|
||||
})
|
||||
apiTaskList(queryParams).then((res) => {
|
||||
taskList.value = res.lists;
|
||||
});
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
@ -124,10 +158,10 @@ const initShowDate = (dateStr = "") => {
|
||||
}
|
||||
};
|
||||
initShowDate();
|
||||
const dateNow = (day)=>{
|
||||
return taskList.value.find((item)=>item.start_time.split(' ')[0]==day)?.template_name;
|
||||
}
|
||||
|
||||
const dateNow = (day) => {
|
||||
return taskList.value.find((item) => item.start_time.split(" ")[0] == day)
|
||||
?.template_name;
|
||||
};
|
||||
|
||||
// 获取字典数据
|
||||
// const { dictData } = useDictData("");
|
||||
@ -147,7 +181,6 @@ const handleAdd = async () => {
|
||||
// editRef.value?.setFormData(data);
|
||||
// };
|
||||
|
||||
|
||||
// 删除
|
||||
// const handleDelete = async (id: number | any[]) => {
|
||||
// await feedback.confirm("确定要删除?");
|
||||
|
Loading…
x
Reference in New Issue
Block a user