diff --git a/src/views/task_template/dialog_index_personnel.vue b/src/views/task_template/dialog_index_personnel.vue new file mode 100644 index 0000000..70b7b10 --- /dev/null +++ b/src/views/task_template/dialog_index_personnel.vue @@ -0,0 +1,102 @@ +<template> + <div> + <el-card class="!border-none" shadow="never"> + <el-form class="mb-[-16px]" :model="queryParams" inline> + <el-form-item label="负责人名称" prop="name"> + <el-input + class="w-[280px]" + v-model="queryParams.name" + clearable + placeholder="请输入负责人名称" + /> + </el-form-item> + <el-form-item label="请选择负责人角色" prop="role_id"> + <el-select class="w-[280px]" v-model="queryParams.role_id"> + <el-option label="全部" value /> + <el-option + v-for="(item, index) in optionsData.role" + :key="index" + :label="item.name" + :value="item.id" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button 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"> + <div class="mt-4"> + <el-table :data="pager.lists" @cell-click="handleCurrentChange"> + <el-table-column label="账号" prop="account" min-width="120" /> + <el-table-column label="名称" prop="name" min-width="100" /> + <el-table-column + label="角色" + prop="role_name" + min-width="140" + show-tooltip-when-overflow + /> + <el-table-column + label="部门" + prop="dept_name" + min-width="100" + show-tooltip-when-overflow + /> + <el-table-column + label="创建时间" + prop="create_time" + min-width="180" + /> + <el-table-column + label="最近登录时间" + prop="login_time" + min-width="180" + /> + <el-table-column label="最近登录IP" prop="login_ip" min-width="120" /> + </el-table> + </div> + <div class="flex mt-4 justify-end"> + <pagination v-model="pager" @change="getLists" /> + </div> + </el-card> + </div> +</template> + +<script lang="ts" setup name="companyLists"> +import { usePaging } from "@/hooks/usePaging"; +import { roleAll } from "@/api/perms/role"; +import { useDictData, useDictOptions } from "@/hooks/useDictOptions"; +import { adminLists } from "@/api/perms/admin"; +import Popup from "@/components/popup/index.vue"; +import { defineEmits } from "vue"; +const { optionsData } = useDictOptions<{ + role: any[]; +}>({ + role: { + api: roleAll, + }, +}); +// 查询条件 +const queryParams = reactive({ + name: "", + role_id: "", +}); + +// 选中数据 +const emits = defineEmits(["customEvent"]); + +// 选中数据子父传递 +const handleCurrentChange = (value: any) => { + emits("customEvent", value); +}; + +// 分页相关 +const { pager, getLists, resetParams, resetPage } = usePaging({ + fetchFun: adminLists, + params: queryParams, +}); + +getLists(); +</script> diff --git a/src/views/task_template/edit.vue b/src/views/task_template/edit.vue index 6514909..09e4ed3 100644 --- a/src/views/task_template/edit.vue +++ b/src/views/task_template/edit.vue @@ -65,6 +65,18 @@ :value="formData.extend?.terminus?.address" /> </el-form-item> + <el-form-item + v-if="formData.type == 35" + label="负责人" + prop="task_admin" + @click="clickTaskAdmin" + > + <el-input + placeholder="请选择负责人" + readonly + v-model="formData.task_admin_name" + /> + </el-form-item> <el-form-item label="阶段类型" prop="types"> <el-select v-model="formData.types" @@ -155,6 +167,14 @@ @success="setMap" @close="" ></taskMap> + <el-dialog + v-model="personnelShow" + ref="personnelRef" + title="选择负责人" + width="60%" + > + <personnelPopup @custom-event="changePersonner"></personnelPopup> + </el-dialog> </popup> </div> </template> @@ -171,6 +191,7 @@ import { timeFormat } from "@/utils/util"; import type { PropType } from "vue"; import { dictDataLists } from "@/api/setting/dict"; import taskMap from "./map.vue"; +import personnelPopup from "./dialog_index_personnel.vue"; defineProps({ dictData: { type: Object as PropType<Record<string, any[]>>, @@ -204,6 +225,8 @@ const formData = reactive({ money_two: 0, // 二阶段金额 money_three: 0, // 长期金额 types: "", //阶段类型 + task_admin: "", //任务负责人 + task_admin_name: "", //任务负责人 extend: { // origin: { // address: "", @@ -264,6 +287,13 @@ const formRules = reactive<any>({ trigger: ["blur"], }, ], + task_admin: [ + { + required: true, + message: "请选择负责人", + trigger: ["blur"], + }, + ], "extend.origin.address": [ { required: true, @@ -349,6 +379,19 @@ const setMap = (e: any) => { formData.extend[mapType.value] = e[0]; }; +// 选择负责人 +const personnelShow = ref(false); +const personnelRef = shallowRef<InstanceType<typeof personnelPopup>>(); +const changePersonner = (e: any) => { + formData.task_admin = e.id; + formData.task_admin_name = e.name; + personnelShow.value = false; +}; + +const clickTaskAdmin = async () => { + personnelShow.value = true; +}; + // 提交按钮 const handleSubmit = async () => { await formRef.value?.validate();