提交
This commit is contained in:
parent
269457045e
commit
d654db7fff
93
src/views/task/editTow.vue
Normal file
93
src/views/task/editTow.vue
Normal file
@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
title="创建日程安排"
|
||||
:async="true"
|
||||
width="800px"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form class="formdata" :model="detailsdt" label-width="120px">
|
||||
<el-form-item label="任务日期">
|
||||
<el-date-picker
|
||||
v-model="formData.time"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务模板">
|
||||
<el-input v-model="formData.template_id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务排期">
|
||||
<el-input v-model="formData.scheduling_id" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="taskEidt">
|
||||
import type { FormInstance } from "element-plus";
|
||||
import Popup from "@/components/popup/index.vue";
|
||||
import { apiTaskCreat, apiTaskView } from "@/api/task";
|
||||
import { apiTaskTemplateLists } from "@/api/task_template";
|
||||
import { timeFormat } from "@/utils/util";
|
||||
import { reactive, onUpdated, type PropType } from "vue";
|
||||
import DialogIndexMan from "./dialog_index_man.vue";
|
||||
|
||||
const emit = defineEmits(["success", "close"]);
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>();
|
||||
const mode = ref("add");
|
||||
const detailsdt = ref({});
|
||||
const datetime = ref([]);
|
||||
|
||||
const templateList = ref([]);
|
||||
const getTemplateList = () => {
|
||||
apiTaskTemplateLists().then((res) => {
|
||||
templateList.value = res;
|
||||
console.log(templateList.value);
|
||||
});
|
||||
};
|
||||
getTemplateList();
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
time: "",
|
||||
template_id: "",
|
||||
scheduling_id: "",
|
||||
});
|
||||
|
||||
// 提交按钮
|
||||
// const handleSubmit = async () => {
|
||||
// const data = { ...formData };
|
||||
// mode.value == "edit" ? await apiTaskCreat(data) : await apiTaskCreat(data);
|
||||
// popupRef.value?.close();
|
||||
// emit("success");
|
||||
// };
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = "add") => {
|
||||
mode.value = type;
|
||||
popupRef.value?.open();
|
||||
};
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit("close");
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.formdata {
|
||||
.el-form-item {
|
||||
.el-date-picker {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none" v-loading="loading" shadow="never">
|
||||
<!-- <el-button v-perms="['flow_type/add']" type="primary" @click="handleAdd">
|
||||
<el-button v-perms="['flow_type/add']" type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button> -->
|
||||
</el-button>
|
||||
<div class="mt-4">
|
||||
<el-calendar v-model="dateValue">
|
||||
<template #dateCell="{ data }">
|
||||
@ -48,6 +48,14 @@
|
||||
@success="loadTask"
|
||||
@close="showEdit = false"
|
||||
/>
|
||||
<EditTowPopup
|
||||
ref="editTowRef"
|
||||
:dict-data="dictData"
|
||||
:dateValue="dateValue"
|
||||
:detailsdata="detailsdata"
|
||||
@success="loadTask"
|
||||
@close="showEditTow = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -58,8 +66,11 @@ import { timeFormat } from "@/utils/util";
|
||||
import feedback from "@/utils/feedback";
|
||||
// import { getRoutePath } from "router";
|
||||
import EditPopup from "./edit.vue";
|
||||
import EditTowPopup from "./editTow.vue";
|
||||
import { reactive, watch } from "vue";
|
||||
import { apiTaskList, apiTaskDetails } from "@/api/task";
|
||||
import { apiTaskSchedulingPlanAdd } from "@/api/task_scheduling_plan";
|
||||
|
||||
const dateValue = ref(new Date());
|
||||
const detailsdata = reactive({
|
||||
create_time: "",
|
||||
@ -92,16 +103,18 @@ const detailsdata = reactive({
|
||||
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())
|
||||
)?.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()));
|
||||
}
|
||||
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
@ -110,8 +123,10 @@ watch(
|
||||
const loading = ref(true);
|
||||
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>();
|
||||
const editTowRef = shallowRef<InstanceType<typeof EditPopup>>();
|
||||
// 是否显示编辑框
|
||||
const showEdit = ref(false);
|
||||
const showEditTow = ref(false);
|
||||
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
@ -168,9 +183,9 @@ const dateNow = (day) => {
|
||||
|
||||
// 添加
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true;
|
||||
showEditTow.value = true;
|
||||
await nextTick();
|
||||
editRef.value?.open("add");
|
||||
editTowRef.value?.open("add");
|
||||
};
|
||||
|
||||
// 编辑
|
||||
|
@ -1,186 +1,248 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form
|
||||
class="mb-[-16px] formtabel"
|
||||
:model="queryParams"
|
||||
inline
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="创建人" prop="create_user_id">
|
||||
<el-input class="w-[280px]" v-model="queryParams.create_user_id" clearable placeholder="请输入创建人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板" prop="template_id">
|
||||
<el-select v-model="queryParams.template_id" clearable placeholder="请输入模板" >
|
||||
<el-option
|
||||
v-for="item in datalist"
|
||||
:key="item.label"
|
||||
:value="item.id"
|
||||
:label="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="公司" prop="company_id">
|
||||
<el-input class="w-[280px]" v-model="queryParams.company_id" clearable placeholder="请输入公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下发公司类型" prop="type">
|
||||
<el-input class="w-[280px]" v-model="queryParams.template_id" clearable placeholder="请输入下发公司类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" clearable placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="item in statusdata"
|
||||
:key="item.label"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button class="el-btn" type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<el-button v-perms="['task_scheduling.task_scheduling/add']" type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form
|
||||
class="mb-[-16px] formtabel"
|
||||
:model="queryParams"
|
||||
inline
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="创建人" prop="create_user_id">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.create_user_id"
|
||||
clearable
|
||||
placeholder="请输入创建人"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板" prop="template_id">
|
||||
<el-select
|
||||
v-model="queryParams.template_id"
|
||||
clearable
|
||||
placeholder="请输入模板"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in datalist"
|
||||
:key="item.label"
|
||||
:value="item.id"
|
||||
:label="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="公司" prop="company_id">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.company_id"
|
||||
clearable
|
||||
placeholder="请输入公司"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="下发公司类型" prop="type">
|
||||
<el-input
|
||||
class="w-[280px]"
|
||||
v-model="queryParams.template_id"
|
||||
clearable
|
||||
placeholder="请输入下发公司类型"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
clearable
|
||||
placeholder="请选择状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in statusdata"
|
||||
:key="item.label"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button class="el-btn" type="primary" @click="resetPage"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<el-button
|
||||
v-perms="['task_scheduling.task_scheduling/add']"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['task_scheduling.task_scheduling/delete']"
|
||||
:disabled="!selectData.length"
|
||||
@click="handleDelete(selectData)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column
|
||||
label="创建人"
|
||||
prop="admin_name"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="模板"
|
||||
prop="type_name"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="公司"
|
||||
prop="company_name"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="下发公司类型"
|
||||
prop="template_name"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="状态" prop="status" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.status == "1" ? "显示" : "隐藏" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-perms="['flow/edit']" type="primary" link>
|
||||
<router-link
|
||||
:to="{
|
||||
path: 'calendar',
|
||||
query: {
|
||||
id: row.id,
|
||||
},
|
||||
}"
|
||||
>任务日程</router-link
|
||||
>
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['task_scheduling.task_scheduling/edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['task_scheduling.task_scheduling/delete']"
|
||||
:disabled="!selectData.length"
|
||||
@click="handleDelete(selectData)"
|
||||
>
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="创建人" prop="admin_name" show-overflow-tooltip />
|
||||
<el-table-column label="模板" prop="type_name" show-overflow-tooltip />
|
||||
<el-table-column label="公司" prop="company_name" show-overflow-tooltip />
|
||||
<el-table-column label="下发公司类型" prop="template_name" show-overflow-tooltip />
|
||||
<el-table-column label="状态" prop="status" show-overflow-tooltip>
|
||||
<template #default="{row}">
|
||||
<span>{{row.status=="1"?"显示":"隐藏"}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['task_scheduling.task_scheduling/edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['task_scheduling.task_scheduling/delete']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
||||
</div>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup
|
||||
v-if="showEdit"
|
||||
ref="editRef"
|
||||
:dict-data="dictData"
|
||||
@success="getLists"
|
||||
@close="showEdit = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="taskSchedulingLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { apiTaskSchedulingLists, apiTaskSchedulingDelete } from '@/api/task_scheduling'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
import { usePaging } from "@/hooks/usePaging";
|
||||
import { useDictData } from "@/hooks/useDictOptions";
|
||||
import {
|
||||
apiTaskSchedulingLists,
|
||||
apiTaskSchedulingDelete,
|
||||
} from "@/api/task_scheduling";
|
||||
import { timeFormat } from "@/utils/util";
|
||||
import feedback from "@/utils/feedback";
|
||||
import EditPopup from "./edit.vue";
|
||||
import { dictDataLists } from "@/api/setting/dict";
|
||||
const datalist=ref([])
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
import { getRoutePath } from "@/router";
|
||||
const datalist = ref([]);
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>();
|
||||
// 是否显示编辑框
|
||||
const showEdit = ref(false)
|
||||
|
||||
const showEdit = ref(false);
|
||||
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
create_user_id: '',
|
||||
template_id: '',
|
||||
company_id: '',
|
||||
type: '',
|
||||
status: ''
|
||||
})
|
||||
create_user_id: "",
|
||||
template_id: "",
|
||||
company_id: "",
|
||||
type: "",
|
||||
status: "",
|
||||
});
|
||||
|
||||
const statusdata=reactive(
|
||||
[
|
||||
{value:"1",label:'显示'},
|
||||
{value:"0",label:"隐藏"},
|
||||
]
|
||||
)
|
||||
const statusdata = reactive([
|
||||
{ value: "1", label: "显示" },
|
||||
{ value: "0", label: "隐藏" },
|
||||
]);
|
||||
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
const selectData = ref<any[]>([]);
|
||||
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
selectData.value = val.map(({ id }) => id);
|
||||
};
|
||||
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('')
|
||||
const { dictData } = useDictData("");
|
||||
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: apiTaskSchedulingLists,
|
||||
params: queryParams
|
||||
})
|
||||
fetchFun: apiTaskSchedulingLists,
|
||||
params: queryParams,
|
||||
});
|
||||
|
||||
// 添加
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
showEdit.value = true;
|
||||
await nextTick();
|
||||
editRef.value?.open("add");
|
||||
};
|
||||
|
||||
// 编辑
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.setFormData(data)
|
||||
}
|
||||
showEdit.value = true;
|
||||
await nextTick();
|
||||
editRef.value?.open("edit");
|
||||
editRef.value?.setFormData(data);
|
||||
};
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (id: number | any[]) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await apiTaskSchedulingDelete({ id })
|
||||
getLists()
|
||||
}
|
||||
await feedback.confirm("确定要删除?");
|
||||
await apiTaskSchedulingDelete({ id });
|
||||
getLists();
|
||||
};
|
||||
dictDataLists({ type_id: 10 }).then((res) => {
|
||||
datalist.value = res.lists;
|
||||
});
|
||||
|
||||
getLists()
|
||||
getLists();
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.formtabel{
|
||||
.el-form-item{
|
||||
width: 20%;
|
||||
.el-btn{
|
||||
margin-left: 100px;
|
||||
}
|
||||
.formtabel {
|
||||
.el-form-item {
|
||||
width: 20%;
|
||||
.el-btn {
|
||||
margin-left: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user