|
@@ -0,0 +1,101 @@
|
|
|
+<template>
|
|
|
+ <el-dialog v-model="state.dialogVisible" width="500px" draggable title="分配回访人" @close="close" destroy-on-close>
|
|
|
+ <el-form :model="state.ruleForm" label-width="90px" ref="ruleFormRef">
|
|
|
+ <el-form-item label="平移人" prop="employee" :rules="[{ required: true, message: '请选择平移的人员', trigger: 'change' }]">
|
|
|
+ <el-select-v2
|
|
|
+ v-model="state.ruleForm.employee"
|
|
|
+ :options="options"
|
|
|
+ placeholder="请选择平移的人员"
|
|
|
+ value-key="value"
|
|
|
+ style="width: 240px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="closeDialog" class="default-button">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit(ruleFormRef)" :loading="loading">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { reactive, ref } from 'vue';
|
|
|
+import {ElNotification, FormInstance} from 'element-plus';
|
|
|
+import { throttle } from '@/utils/tools';
|
|
|
+import { queryUser } from '@/api/system/workflow';
|
|
|
+import { removeDuplicate } from '@/utils/arrayOperation';
|
|
|
+import { distribution } from '@/api/todo/visit';
|
|
|
+
|
|
|
+// 定义子组件向父组件传值/事件
|
|
|
+const emit = defineEmits(['updateList']);
|
|
|
+
|
|
|
+// 定义变量内容
|
|
|
+const state = reactive<any>({
|
|
|
+ dialogVisible: false,
|
|
|
+ ruleForm: {
|
|
|
+ employee: null, // 当前用户
|
|
|
+ },
|
|
|
+});
|
|
|
+const options = ref([]);
|
|
|
+let loading = ref<boolean>(false); // 加载状态
|
|
|
+// 打开弹窗
|
|
|
+const ruleFormRef = ref<RefType>();
|
|
|
+const openDialog = async (type:string,row:object) => {
|
|
|
+ try {
|
|
|
+ switch (type){
|
|
|
+ case '中心待办':
|
|
|
+
|
|
|
+ break;
|
|
|
+ case '发布待办':
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ state.ruleForm.ids = ids;
|
|
|
+ state.dialogVisible = true;
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+};
|
|
|
+// 关闭弹窗
|
|
|
+const closeDialog = () => {
|
|
|
+ state.dialogVisible = false;
|
|
|
+};
|
|
|
+const close = () => {
|
|
|
+ ruleFormRef.value?.resetFields();
|
|
|
+ ruleFormRef.value?.clearValidate();
|
|
|
+};
|
|
|
+// 保存
|
|
|
+const onSubmit = throttle(async (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ await formEl.validate((valid: boolean) => {
|
|
|
+ if (!valid) return;
|
|
|
+ loading.value = true;
|
|
|
+ const request = {
|
|
|
+ ids: state.ruleForm.ids,
|
|
|
+ employeeId: state.ruleForm.employee.id,
|
|
|
+ };
|
|
|
+ distribution(request)
|
|
|
+ .then((res) => {
|
|
|
+ loading.value = false;
|
|
|
+ closeDialog();
|
|
|
+ emit('updateList');
|
|
|
+ ElNotification({
|
|
|
+ title: '分配完成',
|
|
|
+ message: `成功分配${res.result?.successCount}条,失败${res.result?.errorCount}条`,
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
+ });
|
|
|
+}, 300);
|
|
|
+// 暴露变量
|
|
|
+defineExpose({
|
|
|
+ openDialog,
|
|
|
+ closeDialog,
|
|
|
+});
|
|
|
+</script>
|