第一次提交
This commit is contained in:
@@ -0,0 +1,454 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<div class="page">
|
||||
<a-page-header :ghost="false" title="提交工单">
|
||||
<div class="ele-text-secondary">
|
||||
请把您的问题工程师排查问题需要一定时间,如有新消息将通过短信等方式通知您。如需补充信息,请继续留言。
|
||||
</div>
|
||||
</a-page-header>
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
<a-form
|
||||
:label-col="{ md: { span: 8 }, sm: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 24 }, sm: { span: 24 } }"
|
||||
layout="vertical"
|
||||
>
|
||||
<a-form-item label="标题" v-bind="validateInfos.name">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入工单名称"
|
||||
v-model:value="form.name"
|
||||
@blur="validate('name', { trigger: 'blur' }).catch(() => {})"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="问题描述" v-bind="validateInfos.content">
|
||||
<!-- 编辑器 -->
|
||||
<byte-md-editor
|
||||
v-model:value="content"
|
||||
placeholder="请输入您的工单内容,图片请直接粘贴"
|
||||
:locale="zh_Hans"
|
||||
:plugins="plugins"
|
||||
height="300px"
|
||||
:editorConfig="{ lineNumbers: true }"
|
||||
@paste="onPaste"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<a-space>
|
||||
<a-button
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
@click="save"
|
||||
>
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>提交问题</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
class="ele-btn-icon"
|
||||
@click="push('/user/task/index')"
|
||||
>
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>查看工单</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, reactive, watch, computed} from 'vue';
|
||||
import {Form, message, Modal, SelectProps} from 'ant-design-vue';
|
||||
import {useUserStore} from '@/store/modules/user';
|
||||
import {assignObject, htmlToText} from 'ele-admin-pro';
|
||||
import type {Task} from '@/api/oa/task/model';
|
||||
import {addTask, updateTask} from '@/api/oa/task';
|
||||
import {FILE_SERVER} from "@/config/setting";
|
||||
import {uploadFile} from "@/api/system/file";
|
||||
import {RuleObject} from "ant-design-vue/es/form";
|
||||
import { getDictionaryOptions, isImage, selectProject } from "@/utils/common";
|
||||
import SelectStaff from '@/components/SelectStaff/index.vue';
|
||||
import SelectCompany from '@/components/SelectCompany/index.vue';
|
||||
import SelectApp from '@/components/SelectApp/index.vue';
|
||||
import 'bytemd/dist/index.min.css';
|
||||
import highlight from '@bytemd/plugin-highlight-ssr'
|
||||
import 'highlight.js/styles/default.css'
|
||||
import ByteMdEditor from '@/components/ByteMdEditor/index.vue';
|
||||
// import highlight from '@bytemd/plugin-highlight';
|
||||
// 中文语言文件
|
||||
import zh_Hans from 'bytemd/locales/zh_Hans.json';
|
||||
// 链接、删除线、复选框、表格等的插件
|
||||
import gfm from '@bytemd/plugin-gfm';
|
||||
// 插件的中文语言文件
|
||||
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
|
||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
const useForm = Form.useForm;
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Task | null;
|
||||
}>();
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前登录用户信息
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const disabled = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxAble = ref(true);
|
||||
// 选项卡位置
|
||||
const activeKey = ref('1');
|
||||
const promoter = ref<any>(undefined);
|
||||
const commander = ref(undefined);
|
||||
const appid = ref(undefined);
|
||||
// 字典数据
|
||||
const taskType = getDictionaryOptions('taskType');
|
||||
const progress = getDictionaryOptions('taskProgress');
|
||||
const priority = getDictionaryOptions('taskPriority');
|
||||
const quality = getDictionaryOptions('taskQuality');
|
||||
/* 打开选择弹窗 */
|
||||
const showUser = ref(false);
|
||||
const showProject = ref(false);
|
||||
const content = ref('');
|
||||
const files = ref<ItemType[]>([]);
|
||||
const fileList = ref<ItemType[]>([]);
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
// 已上传数据, 可赋初始值用于回显
|
||||
const avatar = ref(<any>[]);
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
const { push } = useRouter();
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<Task>({
|
||||
// 工单名称
|
||||
name: '',
|
||||
appId: undefined,
|
||||
// 工单类型
|
||||
taskType: '普通工单',
|
||||
// 项目ID
|
||||
projectId: '',
|
||||
// 客户ID
|
||||
customerId: '',
|
||||
// 资产ID
|
||||
assetsId: '',
|
||||
// 开始时间
|
||||
startTime: '',
|
||||
// 结束时间
|
||||
endTime: '',
|
||||
// 工单内容
|
||||
content: '',
|
||||
// 工单发起人
|
||||
promoter: undefined,
|
||||
// 负责人
|
||||
commander: undefined,
|
||||
// 工单状态
|
||||
progress: 0,
|
||||
// 优先级
|
||||
priority: '中',
|
||||
// 品质要求
|
||||
quality: 'B级',
|
||||
// 期限(天)
|
||||
day: '',
|
||||
files: '',
|
||||
// 排序
|
||||
sortNumber: 100,
|
||||
// 备注
|
||||
comments: '',
|
||||
// 创建时间
|
||||
createTime: '',
|
||||
// 状态
|
||||
status: 0,
|
||||
// 发布者
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入工单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
taskType: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择工单类型',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
// promoter: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'number',
|
||||
// message: '请选择发起人',
|
||||
// trigger: 'blur',
|
||||
// validator: async (_rule: RuleObject, value: number) => {
|
||||
// if (promoter.value == undefined) {
|
||||
// return Promise.reject('请选择发起人');
|
||||
// }
|
||||
// return Promise.resolve();
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
// commander: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'number',
|
||||
// message: '请选择受理人',
|
||||
// trigger: 'blur',
|
||||
// validator: async (_rule: RuleObject, value: number) => {
|
||||
// if (commander.value == undefined) {
|
||||
// return Promise.reject('请选择受理人');
|
||||
// }
|
||||
// return Promise.resolve();
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
content: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入工单内容',
|
||||
trigger: 'blur',
|
||||
validator: async (_rule: RuleObject, value: string) => {
|
||||
if (content.value == '') {
|
||||
return Promise.reject('请输入文字内容');
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const onPromoter = (userId) => {
|
||||
promoter.value = userId
|
||||
}
|
||||
|
||||
const onCommander = (userId) => {
|
||||
commander.value = userId
|
||||
}
|
||||
|
||||
const onApp = (appId) => {
|
||||
appid.value = appId
|
||||
}
|
||||
|
||||
/* 图片上传事件 */
|
||||
const uploadHandler = (file: File) => {
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).uid,
|
||||
name: file.name
|
||||
};
|
||||
if (!file.type.startsWith("image")) {
|
||||
message.error("只能选择图片");
|
||||
return;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 2) {
|
||||
message.error("大小不能超过 2MB");
|
||||
return;
|
||||
}
|
||||
onUpload(item);
|
||||
};
|
||||
|
||||
// 文件上传事件
|
||||
const beforeUpload = (file: File) => {
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).uid,
|
||||
name: file.name
|
||||
}
|
||||
if (!file.type.startsWith("image")) {
|
||||
if (file.size / 1024 / 1024 > 100) {
|
||||
message.error("大小不能超过 100MB");
|
||||
return;
|
||||
}
|
||||
}
|
||||
onUpload(item);
|
||||
return false;
|
||||
};
|
||||
|
||||
const onUpload = (d: ItemType) => {
|
||||
console.log(d);
|
||||
uploadFile(<File>d.file)
|
||||
.then((result) => {
|
||||
files.value.push({
|
||||
uid: result.id,
|
||||
url: FILE_SERVER + result.path,
|
||||
name: isImage(result.path) ? 'image' : result.name,
|
||||
status: "done"
|
||||
});
|
||||
message.success("上传成功");
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
const {resetFields, validate, validateInfos} = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const data = {
|
||||
...form,
|
||||
// 处理工单内容
|
||||
content: content.value,
|
||||
appId: appid.value,
|
||||
promoter: promoter.value,
|
||||
commander: commander.value,
|
||||
files: JSON.stringify(files.value)
|
||||
};
|
||||
// 转字符串
|
||||
const saveOrUpdate = isUpdate.value ? updateTask : addTask;
|
||||
saveOrUpdate(data)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
content.value = '';
|
||||
message.success('提交成功');
|
||||
push('/user/task/index')
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
// 插件
|
||||
const plugins = ref([
|
||||
gfm({
|
||||
locale: zh_HansGfm
|
||||
}),
|
||||
highlight()
|
||||
]);
|
||||
|
||||
/* 粘贴图片上传服务器并插入编辑器 */
|
||||
const onPaste = (e) => {
|
||||
console.log(e);
|
||||
const items = (e.clipboardData || e.originalEvent.clipboardData).items;
|
||||
console.log(items);
|
||||
let hasFile = false;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i].type.indexOf('image') !== -1) {
|
||||
let file = items[i].getAsFile();
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).lastModified,
|
||||
name: file.name
|
||||
};
|
||||
uploadFile(<File>item.file)
|
||||
.then((result) => {
|
||||
const addPath = '\n\r';
|
||||
content.value = content.value + addPath
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
hasFile = true;
|
||||
}
|
||||
}
|
||||
if (hasFile) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(form, props.data);
|
||||
// 头像赋值
|
||||
avatar.value = [];
|
||||
if (props.data.images) {
|
||||
avatar.value.push({uid: 1, url: FILE_SERVER + props.data.images, status: ''});
|
||||
}
|
||||
if (props.data.content) {
|
||||
content.value = props.data.content;
|
||||
}
|
||||
form.sortNumber = Number(props.data.sortNumber);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
content.value = '';
|
||||
avatar.value = [];
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.form-item-help {
|
||||
font-size: 12px;
|
||||
// line-height: 2;
|
||||
line-height: 1.5;
|
||||
padding-top: 4px;
|
||||
min-height: 22px;
|
||||
// margin-top: -2px;
|
||||
transition: color 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
|
||||
|
||||
a {
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
.extra,
|
||||
small {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 12.5px !important;
|
||||
}
|
||||
|
||||
.extra {
|
||||
margin-bottom: 4px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.select-shop {
|
||||
min-width: 120px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.upload-list-inline :deep(.ant-upload-list-item) {
|
||||
float: left;
|
||||
width: 200px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.upload-list-inline [class*='-upload-list-rtl'] :deep(.ant-upload-list-item) {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,104 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<plus-outlined />
|
||||
</template>
|
||||
<span>提交工单</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
danger
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
:disabled="selection.length === 0"
|
||||
@click="removeBatch"
|
||||
>
|
||||
<template #icon>
|
||||
<delete-outlined />
|
||||
</template>
|
||||
<span>批量删除</span>
|
||||
</a-button>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入关键词"
|
||||
v-model:value="searchText"
|
||||
@pressEnter="search"
|
||||
@search="search"
|
||||
/>
|
||||
<a-button @click="reload">刷新</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import useSearch from '@/utils/use-search';
|
||||
import type { CustomerParam } from '@/api/oa/customer/model';
|
||||
import { ref, watch } from 'vue';
|
||||
import { TaskParam } from '@/api/oa/task/model';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import {
|
||||
PlusOutlined,
|
||||
EditOutlined,
|
||||
SearchOutlined,
|
||||
DeleteOutlined,
|
||||
UpSquareOutlined,
|
||||
DownSquareOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: CustomerParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<TaskParam>({
|
||||
taskId: undefined,
|
||||
name: undefined,
|
||||
userId: undefined,
|
||||
nickname: undefined
|
||||
});
|
||||
// 下来选项
|
||||
const type = ref('keywords');
|
||||
// 搜索内容
|
||||
const searchText = ref('');
|
||||
const { push } = useRouter();
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
assignObject(where, {});
|
||||
if (type.value == 'keywords') {
|
||||
where.keywords = searchText.value;
|
||||
}
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
push('/user/task/add');
|
||||
};
|
||||
|
||||
// 批量删除
|
||||
const removeBatch = () => {
|
||||
emit('remove');
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
// 刷新当前路由
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
@@ -0,0 +1,502 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="980px"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maxable="maxAble"
|
||||
:title="isUpdate ? '编辑工单' : '添加工单'"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
:maskClosable="false"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
:label-col="{ md: { span: 8 }, sm: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 24 }, sm: { span: 24 } }"
|
||||
layout="vertical"
|
||||
>
|
||||
<a-form-item label="工单名称" v-bind="validateInfos.name">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入工单名称"
|
||||
v-model:value="form.name"
|
||||
@blur="validate('name', { trigger: 'blur' }).catch(() => {})"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="工单内容" v-bind="validateInfos.content">
|
||||
<!-- 编辑器 -->
|
||||
<byte-md-editor
|
||||
v-model:value="content"
|
||||
placeholder="请输入您的工单内容,图片请直接粘贴"
|
||||
:locale="zh_Hans"
|
||||
:plugins="plugins"
|
||||
height="300px"
|
||||
:editorConfig="{ lineNumbers: true }"
|
||||
@paste="onPaste"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-row :gutter="16">
|
||||
<a-col :md="12" :sm="24" :xs="24">
|
||||
<a-form-item label="工单类型" v-bind="validateInfos.taskType">
|
||||
<a-select
|
||||
optionFilterProp="label"
|
||||
placeholder="请选择工单类型"
|
||||
:options="taskType"
|
||||
allow-clear
|
||||
v-model:value="form.taskType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="指派给" v-bind="validateInfos.commander">-->
|
||||
<!-- <SelectStaff v-model:value="commander" @done="onCommander" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="发起人" v-bind="validateInfos.promoter">
|
||||
<SelectCompany v-model:value="promoter" @done="onPromoter" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="12" :sm="24" :xs="24">
|
||||
<a-form-item label="关联应用(选填)" v-bind="validateInfos.appId">
|
||||
<SelectApp v-model:value="appId" @done="onApp" />
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="品质要求" v-bind="validateInfos.quality">-->
|
||||
<!-- <a-select-->
|
||||
<!-- optionFilterProp="label"-->
|
||||
<!-- placeholder="请选择品质要求"-->
|
||||
<!-- :options="quality"-->
|
||||
<!-- allow-clear-->
|
||||
<!-- v-model:value="form.quality"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col :md="12" :sm="24" :xs="24">
|
||||
<a-form-item label="上传附件" v-bind="validateInfos.files">
|
||||
<a-upload
|
||||
v-model:file-list="fileList"
|
||||
class="upload-list-inline"
|
||||
list-type="picture"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<a-button>
|
||||
<UploadOutlined />
|
||||
上传附件
|
||||
</a-button>
|
||||
</a-upload>
|
||||
<!-- <ele-image-upload-->
|
||||
<!-- v-model:value="files"-->
|
||||
<!-- :limit="9"-->
|
||||
<!-- :drag="true"-->
|
||||
<!-- :multiple="true"-->
|
||||
<!-- :upload-handler="uploadHandler"-->
|
||||
<!-- @upload="onUpload"-->
|
||||
<!-- />-->
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="12" :sm="24" :xs="24">
|
||||
<!-- <a-form-item label="优先级" v-bind="validateInfos.priority">-->
|
||||
<!-- <a-select-->
|
||||
<!-- optionFilterProp="label"-->
|
||||
<!-- placeholder="请选择优先级"-->
|
||||
<!-- :options="priority"-->
|
||||
<!-- allow-clear-->
|
||||
<!-- v-model:value="form.priority"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, reactive, watch, computed} from 'vue';
|
||||
import {Form, message, Modal, SelectProps} from 'ant-design-vue';
|
||||
import {useUserStore} from '@/store/modules/user';
|
||||
import {assignObject, htmlToText} from 'ele-admin-pro';
|
||||
import type {Task} from '@/api/oa/task/model';
|
||||
import {addTask, updateTask} from '@/api/oa/task';
|
||||
import {FILE_SERVER} from "@/config/setting";
|
||||
import {uploadFile} from "@/api/system/file";
|
||||
import {RuleObject} from "ant-design-vue/es/form";
|
||||
import { getDictionaryOptions, isImage, selectProject } from "@/utils/common";
|
||||
import SelectStaff from '@/components/SelectStaff/index.vue';
|
||||
import SelectCompany from '@/components/SelectCompany/index.vue';
|
||||
import SelectApp from '@/components/SelectApp/index.vue';
|
||||
import 'bytemd/dist/index.min.css';
|
||||
import highlight from '@bytemd/plugin-highlight-ssr'
|
||||
import 'highlight.js/styles/default.css'
|
||||
import ByteMdEditor from '@/components/ByteMdEditor/index.vue';
|
||||
// import highlight from '@bytemd/plugin-highlight';
|
||||
// 中文语言文件
|
||||
import zh_Hans from 'bytemd/locales/zh_Hans.json';
|
||||
// 链接、删除线、复选框、表格等的插件
|
||||
import gfm from '@bytemd/plugin-gfm';
|
||||
// 插件的中文语言文件
|
||||
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
|
||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Task | null;
|
||||
}>();
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前登录用户信息
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const disabled = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxAble = ref(true);
|
||||
// 选项卡位置
|
||||
const activeKey = ref('1');
|
||||
const promoter = ref<any>(undefined);
|
||||
const commander = ref(undefined);
|
||||
const appid = ref(undefined);
|
||||
// 字典数据
|
||||
const taskType = getDictionaryOptions('taskType');
|
||||
const progress = getDictionaryOptions('taskProgress');
|
||||
const priority = getDictionaryOptions('taskPriority');
|
||||
const quality = getDictionaryOptions('taskQuality');
|
||||
/* 打开选择弹窗 */
|
||||
const showUser = ref(false);
|
||||
const showProject = ref(false);
|
||||
const content = ref('');
|
||||
const files = ref<ItemType[]>([]);
|
||||
const fileList = ref<ItemType[]>([]);
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
// 已上传数据, 可赋初始值用于回显
|
||||
const avatar = ref(<any>[]);
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 用户信息
|
||||
const form = reactive<Task>({
|
||||
// 工单名称
|
||||
name: '',
|
||||
appId: undefined,
|
||||
// 工单类型
|
||||
taskType: '普通工单',
|
||||
// 项目ID
|
||||
projectId: '',
|
||||
// 客户ID
|
||||
customerId: '',
|
||||
// 资产ID
|
||||
assetsId: '',
|
||||
// 开始时间
|
||||
startTime: '',
|
||||
// 结束时间
|
||||
endTime: '',
|
||||
// 工单内容
|
||||
content: '',
|
||||
// 工单发起人
|
||||
promoter: undefined,
|
||||
// 负责人
|
||||
commander: undefined,
|
||||
// 工单状态
|
||||
progress: 0,
|
||||
// 优先级
|
||||
priority: '中',
|
||||
// 品质要求
|
||||
quality: 'B级',
|
||||
// 期限(天)
|
||||
day: '',
|
||||
files: '',
|
||||
// 排序
|
||||
sortNumber: 100,
|
||||
// 备注
|
||||
comments: '',
|
||||
// 创建时间
|
||||
createTime: '',
|
||||
// 状态
|
||||
status: 0,
|
||||
// 发布者
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入工单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
taskType: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择工单类型',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
// promoter: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'number',
|
||||
// message: '请选择发起人',
|
||||
// trigger: 'blur',
|
||||
// validator: async (_rule: RuleObject, value: number) => {
|
||||
// if (promoter.value == undefined) {
|
||||
// return Promise.reject('请选择发起人');
|
||||
// }
|
||||
// return Promise.resolve();
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
// commander: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'number',
|
||||
// message: '请选择受理人',
|
||||
// trigger: 'blur',
|
||||
// validator: async (_rule: RuleObject, value: number) => {
|
||||
// if (commander.value == undefined) {
|
||||
// return Promise.reject('请选择受理人');
|
||||
// }
|
||||
// return Promise.resolve();
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
content: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入工单内容',
|
||||
trigger: 'blur',
|
||||
validator: async (_rule: RuleObject, value: string) => {
|
||||
if (content.value == '') {
|
||||
return Promise.reject('请输入文字内容');
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const onPromoter = (userId) => {
|
||||
promoter.value = userId
|
||||
}
|
||||
|
||||
const onCommander = (userId) => {
|
||||
commander.value = userId
|
||||
}
|
||||
|
||||
const onApp = (appId) => {
|
||||
appid.value = appId
|
||||
}
|
||||
|
||||
/* 图片上传事件 */
|
||||
const uploadHandler = (file: File) => {
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).uid,
|
||||
name: file.name
|
||||
};
|
||||
if (!file.type.startsWith("image")) {
|
||||
message.error("只能选择图片");
|
||||
return;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 2) {
|
||||
message.error("大小不能超过 2MB");
|
||||
return;
|
||||
}
|
||||
onUpload(item);
|
||||
};
|
||||
|
||||
// 文件上传事件
|
||||
const beforeUpload = (file: File) => {
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).uid,
|
||||
name: file.name
|
||||
}
|
||||
if (!file.type.startsWith("image")) {
|
||||
if (file.size / 1024 / 1024 > 100) {
|
||||
message.error("大小不能超过 100MB");
|
||||
return;
|
||||
}
|
||||
}
|
||||
onUpload(item);
|
||||
return false;
|
||||
};
|
||||
|
||||
const onUpload = (d: ItemType) => {
|
||||
console.log(d);
|
||||
uploadFile(<File>d.file)
|
||||
.then((result) => {
|
||||
files.value.push({
|
||||
uid: result.id,
|
||||
url: FILE_SERVER + result.path,
|
||||
name: isImage(result.path) ? 'image' : result.name,
|
||||
status: "done"
|
||||
});
|
||||
message.success("上传成功");
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
const {resetFields, validate, validateInfos} = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const data = {
|
||||
...form,
|
||||
// 处理工单内容
|
||||
content: content.value,
|
||||
appId: appid.value,
|
||||
promoter: promoter.value,
|
||||
commander: commander.value,
|
||||
files: JSON.stringify(files.value)
|
||||
};
|
||||
// 转字符串
|
||||
const saveOrUpdate = isUpdate.value ? updateTask : addTask;
|
||||
saveOrUpdate(data)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
content.value = '';
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
// 插件
|
||||
const plugins = ref([
|
||||
gfm({
|
||||
locale: zh_HansGfm
|
||||
}),
|
||||
highlight()
|
||||
]);
|
||||
|
||||
/* 粘贴图片上传服务器并插入编辑器 */
|
||||
const onPaste = (e) => {
|
||||
console.log(e);
|
||||
const items = (e.clipboardData || e.originalEvent.clipboardData).items;
|
||||
console.log(items);
|
||||
let hasFile = false;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i].type.indexOf('image') !== -1) {
|
||||
let file = items[i].getAsFile();
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).lastModified,
|
||||
name: file.name
|
||||
};
|
||||
uploadFile(<File>item.file)
|
||||
.then((result) => {
|
||||
const addPath = '\n\r';
|
||||
content.value = content.value + addPath
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
hasFile = true;
|
||||
}
|
||||
}
|
||||
if (hasFile) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(form, props.data);
|
||||
// 头像赋值
|
||||
avatar.value = [];
|
||||
if (props.data.images) {
|
||||
avatar.value.push({uid: 1, url: FILE_SERVER + props.data.images, status: ''});
|
||||
}
|
||||
if (props.data.content) {
|
||||
content.value = props.data.content;
|
||||
}
|
||||
|
||||
form.sortNumber = Number(props.data.sortNumber);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
content.value = '';
|
||||
avatar.value = [];
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.form-item-help {
|
||||
font-size: 12px;
|
||||
// line-height: 2;
|
||||
line-height: 1.5;
|
||||
padding-top: 4px;
|
||||
min-height: 22px;
|
||||
// margin-top: -2px;
|
||||
transition: color 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
|
||||
|
||||
a {
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
.extra,
|
||||
small {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 12.5px !important;
|
||||
}
|
||||
|
||||
.extra {
|
||||
margin-bottom: 4px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.select-shop {
|
||||
min-width: 120px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.upload-list-inline :deep(.ant-upload-list-item) {
|
||||
float: left;
|
||||
width: 200px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.upload-list-inline [class*='-upload-list-rtl'] :deep(.ant-upload-list-item) {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,51 @@
|
||||
<!-- 角色选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
optionFilterProp="label"
|
||||
:options="data"
|
||||
allow-clear
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@blur="onBlur"
|
||||
@change="onChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string): void;
|
||||
(e: 'blur'): void;
|
||||
(e: 'change'): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择客户跟进状态'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const data = getDictionaryOptions('customerFollowStatus');
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
|
||||
/* 选择事件 */
|
||||
const onChange = (e) => {
|
||||
emit('change', e);
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,51 @@
|
||||
<!-- 客户来源选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
optionFilterProp="label"
|
||||
:options="data"
|
||||
allow-clear
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@blur="onBlur"
|
||||
@change="onChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string): void;
|
||||
(e: 'blur'): void;
|
||||
(e: 'change'): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择客户来源'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const data = getDictionaryOptions('customerSource');
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
|
||||
/* 选择事件 */
|
||||
const onChange = (e) => {
|
||||
emit('change', e);
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,45 @@
|
||||
<!-- 角色选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
show-search
|
||||
optionFilterProp="label"
|
||||
:options="data"
|
||||
allow-clear
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string): void;
|
||||
(e: 'blur'): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择状态'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const data = getDictionaryOptions('status');
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,44 @@
|
||||
<!-- 角色选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
optionFilterProp="label"
|
||||
:options="data"
|
||||
allow-clear
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string): void;
|
||||
(e: 'blur'): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择客户类型'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const data = getDictionaryOptions('customerType');
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,76 @@
|
||||
<!-- 角色选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
show-search
|
||||
optionFilterProp="label"
|
||||
:options="data"
|
||||
allow-clear
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@search="onSearch"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { listUsers } from '@/api/system/user';
|
||||
import type { SelectProps } from 'ant-design-vue';
|
||||
import { UserParam } from '@/api/system/user/model';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string): void;
|
||||
(e: 'blur'): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择客户类型'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const data = ref<SelectProps['options']>([]);
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
|
||||
// 默认搜索条件
|
||||
const where = ref<UserParam>({});
|
||||
|
||||
const search = () => {
|
||||
/* 获取用户列 */
|
||||
listUsers({ ...where?.value })
|
||||
.then((result) => {
|
||||
data.value = result?.map((d) => {
|
||||
return {
|
||||
value: d.userId,
|
||||
label: d.nickname
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
const onSearch = (e) => {
|
||||
where.value.nickname = e;
|
||||
search();
|
||||
};
|
||||
|
||||
search();
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,749 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<a-drawer
|
||||
width="75%"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
v-if="detail && data"
|
||||
:title="`工单详情(${detail.taskId}):${data.name}`"
|
||||
:maxable="true"
|
||||
:body-style="{ paddingBottom: '8px', backgroundColor: '#f3f3f3' }"
|
||||
@update:visible="updateVisible"
|
||||
@close="onClose"
|
||||
:footer="null"
|
||||
>
|
||||
<a-card class="task-card" :bordered="false">
|
||||
<a-steps
|
||||
:current="active"
|
||||
direction="horizontal"
|
||||
:responsive="styleResponsive"
|
||||
>
|
||||
<template v-for="item in taskProgressDict">
|
||||
<a-step :title="item.label" />
|
||||
</template>
|
||||
</a-steps>
|
||||
</a-card>
|
||||
<a-spin :spinning="loading" v-if="appId > 0">
|
||||
<a-collapse class="task-card" v-model:activeKey="activeKey" :bordered="false">
|
||||
<a-collapse-panel key="1" header="应用详情">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '16px' }"
|
||||
>
|
||||
<div class="content">
|
||||
<div class="app-item-list">
|
||||
<div class="ele-cell">
|
||||
<div class="ele-cell-content">
|
||||
<div class="ele-cell-desc">AppID(应用ID)</div>
|
||||
<div class="ele-cell-title">{{ appInfo.appId }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-divider />
|
||||
<div class="ele-cell">
|
||||
<div class="ele-cell-content">
|
||||
<div class="ele-cell-desc">小程序名称</div>
|
||||
<div class="ele-cell-title">
|
||||
{{ appInfo.appName }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-divider />
|
||||
<div class="ele-cell">
|
||||
<div class="ele-cell-content">
|
||||
<div class="ele-cell-desc">小程序描述</div>
|
||||
<div class="ele-cell-title">{{ appInfo.comments }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-divider />
|
||||
<div class="ele-cell">
|
||||
<div class="ele-cell-content">
|
||||
<div class="ele-cell-desc">小程序码</div>
|
||||
<div class="ele-cell-title">
|
||||
<a-image
|
||||
:height="120"
|
||||
:width="120"
|
||||
:preview="false"
|
||||
:src="appInfo.appQrcode"
|
||||
fallback="https://file.wsdns.cn/20230218/550e610d43334dd2a7f66d5b20bd58eb.svg"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-divider />
|
||||
<div class="ele-cell">
|
||||
<div class="ele-cell-content">
|
||||
<div class="ele-cell-desc">应用图标</div>
|
||||
<div class="ele-cell-title">
|
||||
<a-image
|
||||
:height="70"
|
||||
:width="70"
|
||||
:preview="false"
|
||||
:src="appInfo.appIcon"
|
||||
fallback="https://file.wsdns.cn/20230218/550e610d43334dd2a7f66d5b20bd58eb.svg"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ele-cell">
|
||||
<div class="ele-cell-content">
|
||||
<div class="ele-cell-desc">状态</div>
|
||||
<div class="ele-cell-title">{{
|
||||
appInfo.status === 1 ? '开发中' : '已上线'
|
||||
}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel key="2" header="开发资料">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '16px' }"
|
||||
>
|
||||
<byte-md-viewer :value="appInfo.requirement" :plugins="plugins" />
|
||||
</a-card>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
</a-spin>
|
||||
<a-spin :spinning="loading" v-if="detail">
|
||||
<!-- 回复列表 -->
|
||||
<a-card class="task-card replay-bg"
|
||||
:bordered="false"
|
||||
v-for="(item, index) in record"
|
||||
:key="index">
|
||||
<a-page-header
|
||||
:title="item.nickname"
|
||||
:sub-title="`${item.createTime}`"
|
||||
:avatar="{ src: item.avatar ? item.avatar : 'https://file.gxwebsoft.com/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
||||
>
|
||||
<template #extra>
|
||||
<a-button key="2" href="#bottom" @click="onReply(item)">回复</a-button>
|
||||
<template v-for="(role,index) in loginUser.roles" :key="index">
|
||||
<a-button key="1" v-if="role.roleCode === 'admin'" @click="remove(item)">删除</a-button>
|
||||
</template>
|
||||
|
||||
</template>
|
||||
<div class="content">
|
||||
<template v-if="item.content">
|
||||
<byte-md-viewer :value="item.content" :plugins="plugins" />
|
||||
</template>
|
||||
<!-- 附件列表 -->
|
||||
<a-space v-if="item.files && item.files != '[]'">
|
||||
<template v-for="file in JSON.parse(item.files)">
|
||||
<a-button v-if="file.name && file.name != 'image'" :href="file.url">{{ file.name }}</a-button>
|
||||
<a-image v-else :height="120" :width="120" :src="file.url" />
|
||||
</template>
|
||||
</a-space>
|
||||
<!-- 二级回复 -->
|
||||
<template v-if="item.children">
|
||||
<a-card class="task-card replay-bg"
|
||||
v-for="(item, index) in item.children"
|
||||
:key="index">
|
||||
<a-page-header
|
||||
:title="item.nickname"
|
||||
:sub-title="`${item.createTime}`"
|
||||
:avatar="{ src: item.avatar ? item.avatar : 'https://file.gxwebsoft.com/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
||||
>
|
||||
<template #extra>
|
||||
<template v-for="(role,index) in loginUser.roles" :key="index">
|
||||
<a-button key="1" v-if="role.roleCode === 'admin'" @click="remove(item)">删除</a-button>
|
||||
</template>
|
||||
</template>
|
||||
<div class="content">
|
||||
<template v-if="item.content">
|
||||
<byte-md-viewer :value="item.content" :plugins="plugins" />
|
||||
</template>
|
||||
<template v-if="item.children">
|
||||
{{ item.children }}
|
||||
</template>
|
||||
</div>
|
||||
<!-- 附件列表 -->
|
||||
<a-space v-if="item.files && item.files != '[]'">
|
||||
<template v-for="file in JSON.parse(item.files)">
|
||||
<a-button v-if="file.name && file.name != 'image'" :href="file.url">{{ file.name }}</a-button>
|
||||
<a-image v-else :height="120" :width="120" :src="file.url" />
|
||||
</template>
|
||||
</a-space>
|
||||
</a-page-header>
|
||||
</a-card>
|
||||
</template>
|
||||
</div>
|
||||
</a-page-header>
|
||||
</a-card>
|
||||
<!-- 操作按钮 -->
|
||||
<div class="task-btn" v-if="detail.status === 0">
|
||||
<a-space>
|
||||
<a-button type="primary" ghost size="large" @click="complete">
|
||||
已解决
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
danger
|
||||
ghost
|
||||
size="large"
|
||||
href="#bottom"
|
||||
@click="showEdit"
|
||||
>
|
||||
我要回复
|
||||
</a-button>
|
||||
<a-button type="primary" ghost size="large" @click="completedTask">
|
||||
已完结
|
||||
</a-button>
|
||||
<a-button type="primary" ghost size="large" @click="closeTask">
|
||||
关单
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="task-btn" v-if="detail.status === 1">
|
||||
<a-button type="primary" ghost size="large" @click="openTask">
|
||||
开启工单
|
||||
</a-button>
|
||||
</div>
|
||||
</a-spin>
|
||||
<!-- 回复表单 -->
|
||||
<div id="bottom">
|
||||
<a-card :title="replyName ? `回复${replyName}` : `处理结果`" :bordered="false" v-if="openEdit">
|
||||
<a-space direction="vertical" style="width: 100%;">
|
||||
<!-- 编辑器 -->
|
||||
<byte-md-editor
|
||||
v-model:value="content"
|
||||
placeholder="请输入您的回复内容,图片请直接粘贴"
|
||||
:locale="zh_Hans"
|
||||
:plugins="plugins"
|
||||
height="300px"
|
||||
:editorConfig="{ lineNumbers: true }"
|
||||
contenteditable="true"
|
||||
@paste="onPaste"
|
||||
/>
|
||||
<!-- <ele-image-upload-->
|
||||
<!-- v-model:value="files"-->
|
||||
<!-- :limit="9"-->
|
||||
<!-- :drag="true"-->
|
||||
<!-- :multiple="true"-->
|
||||
<!-- :upload-handler="uploadHandler"-->
|
||||
<!-- @upload="onUpload"-->
|
||||
<!-- />-->
|
||||
<a-upload
|
||||
v-model:file-list="fileList"
|
||||
class="upload-list-inline"
|
||||
list-type="picture"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<a-button>
|
||||
<UploadOutlined />
|
||||
上传附件
|
||||
</a-button>
|
||||
</a-upload>
|
||||
<a-button type="primary" style="margin-top: 20px" @click="save">提交</a-button>
|
||||
</a-space>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 成员管理 -->
|
||||
<div id="users">
|
||||
<a-card title="移交给" :bordered="false" v-if="openUsers">
|
||||
<a-space style="margin-bottom: 15px">
|
||||
<SelectStaff v-model:value="commander" @done="onSelect" />
|
||||
<a-button
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
@click="onUpdateTask"
|
||||
>
|
||||
<template #icon>
|
||||
<plus-outlined />
|
||||
</template>
|
||||
<span>确定</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-card>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import "bytemd/dist/index.min.css";
|
||||
import { createVNode, reactive, ref, watch, nextTick, computed } from "vue";
|
||||
import "github-markdown-css/github-markdown-light.css";
|
||||
// // 链接、删除线、复选框、表格等的插件
|
||||
import gfm from "@bytemd/plugin-gfm";
|
||||
// // 插件的中文语言文件
|
||||
import zh_HansGfm from "@bytemd/plugin-gfm/locales/zh_Hans.json";
|
||||
// 中文语言文件
|
||||
import zh_Hans from "bytemd/locales/zh_Hans.json";
|
||||
import "bytemd/dist/index.min.css";
|
||||
import highlight from "@bytemd/plugin-highlight-ssr";
|
||||
import "highlight.js/styles/default.css";
|
||||
import { Form, message, Modal, UploadProps } from "ant-design-vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useThemeStore } from "@/store/modules/theme";
|
||||
import { uploadFile } from "@/api/system/file";
|
||||
import type { Task } from "@/api/oa/task/model";
|
||||
import { updateTask, getTask } from "@/api/oa/task";
|
||||
import { RuleObject } from "ant-design-vue/es/form";
|
||||
import { FILE_SERVER } from "@/config/setting";
|
||||
import { getDictionaryOptions, isImage, openUrl } from "@/utils/common";
|
||||
import { TaskRecord } from "@/api/oa/task-record/model";
|
||||
import { App } from "@/api/app/model"
|
||||
import { ItemType } from "ele-admin-pro/es/ele-image-upload/types";
|
||||
import { addTaskRecord, listTaskRecord, removeTaskRecord } from "@/api/oa/task-record";
|
||||
import SelectStaff from '@/components/SelectStaff/index.vue';
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
// 当前用户信息
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { Notice } from "@/api/oa/notice/model";
|
||||
import { messageLoading, toTreeData } from "ele-admin-pro";
|
||||
import { removeNotice } from "@/api/oa/notice";
|
||||
import { Menu } from "@/api/system/menu/model";
|
||||
import { getApp, getAppSecret } from "@/api/app";
|
||||
import {
|
||||
PlusOutlined,
|
||||
EyeOutlined,
|
||||
EyeInvisibleOutlined,
|
||||
UserOutlined,
|
||||
ExclamationCircleOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Task | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "done"): void;
|
||||
(e: "update:visible", visible: boolean): void;
|
||||
}>();
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit("update:visible", value);
|
||||
};
|
||||
|
||||
// 插件
|
||||
const plugins = ref([
|
||||
gfm({
|
||||
locale: zh_HansGfm
|
||||
}),
|
||||
highlight()
|
||||
]);
|
||||
|
||||
// 表单数据
|
||||
const form = reactive<TaskRecord>({
|
||||
taskRecordId: undefined,
|
||||
taskId: 0,
|
||||
content: '',
|
||||
files: "",
|
||||
userId: 0
|
||||
});
|
||||
const useForm = Form.useForm;
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
content: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请输入工单内容",
|
||||
trigger: "blur",
|
||||
validator: async (_rule: RuleObject, value: string) => {
|
||||
if (content.value == "") {
|
||||
return Promise.reject("请输入文字内容");
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
const userStore = useUserStore();
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
const detail = ref<Task | null>(null);
|
||||
const appId = ref<number>(0);
|
||||
const appInfo = ref<App | null>({});
|
||||
const taskId = ref(0);
|
||||
const parentId = ref<any>(0);
|
||||
const replyName = ref<string>();
|
||||
const activeKey = ref([]);
|
||||
const showAppSecret = ref(false);
|
||||
const taskProgressDict = getDictionaryOptions("taskProgress");
|
||||
const record = ref<TaskRecord[] | undefined>([]);
|
||||
const content = ref('');
|
||||
const files = ref<ItemType[]>([]);
|
||||
const fileList = ref<ItemType[]>([]);
|
||||
const openEdit = ref(false);
|
||||
const openUsers = ref(false);
|
||||
const showAddUserForm = ref(false);
|
||||
const developerId = ref();
|
||||
const commander = ref<any>();
|
||||
// 选中步骤
|
||||
const active = ref(0);
|
||||
|
||||
const { resetFields, validate, validateInfos } = useForm(form, rules);
|
||||
|
||||
/* 图片上传事件 */
|
||||
const uploadHandler = (file: File) => {
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).uid,
|
||||
name: file.name
|
||||
};
|
||||
if (!file.type.startsWith("image")) {
|
||||
message.error("只能选择图片");
|
||||
return;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 2) {
|
||||
message.error("大小不能超过 2MB");
|
||||
return;
|
||||
}
|
||||
onUpload(item);
|
||||
};
|
||||
|
||||
// 文件上传事件
|
||||
const beforeUpload = (file: File) => {
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).uid,
|
||||
name: file.name
|
||||
}
|
||||
if (!file.type.startsWith("image")) {
|
||||
if (file.size / 1024 / 1024 > 100) {
|
||||
message.error("大小不能超过 100MB");
|
||||
return;
|
||||
}
|
||||
}
|
||||
onUpload(item);
|
||||
return false;
|
||||
};
|
||||
|
||||
const onUpload = (d: ItemType) => {
|
||||
uploadFile(<File>d.file)
|
||||
.then((result) => {
|
||||
files.value.push({
|
||||
uid: result.id,
|
||||
url: FILE_SERVER + result.path,
|
||||
name: isImage(result.path) ? 'image' : result.name,
|
||||
status: "done"
|
||||
});
|
||||
console.log(files.value);
|
||||
message.success("上传成功");
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
const complete = () => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定问题已解决?",
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
updateTask({ taskId: taskId.value, progress: 3 }).then((res) => {
|
||||
message.success(res);
|
||||
updateVisible(false);
|
||||
emit("done");
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const closeTask = () => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定关闭工单吗?",
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
updateTask({ taskId: taskId.value, status: 1, progress: 5 }).then((res) => {
|
||||
message.success(res);
|
||||
updateVisible(false);
|
||||
emit("done");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const completedTask = () => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定工单已完接了吗?",
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
updateTask({ taskId: taskId.value, status: 1, progress: 4 }).then((res) => {
|
||||
message.success(res);
|
||||
updateVisible(false);
|
||||
emit("done");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const openTask = () => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "重新开启后可以继续追加内容,需要重新开启工单吗?",
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
updateTask({ taskId: taskId.value, status: 0, progress: 2 }).then((res) => {
|
||||
message.success(res);
|
||||
updateVisible(false);
|
||||
emit("done");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const showEdit = () => {
|
||||
replyName.value = '';
|
||||
parentId.value = 0;
|
||||
openEdit.value = true;
|
||||
openUsers.value = false;
|
||||
};
|
||||
const showUsers = () => {
|
||||
openUsers.value = true;
|
||||
openEdit.value = false;
|
||||
}
|
||||
|
||||
const onReply = (row: TaskRecord) => {
|
||||
parentId.value = row.taskRecordId;
|
||||
replyName.value = row.nickname;
|
||||
openEdit.value = true;
|
||||
}
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: TaskRecord) => {
|
||||
removeTaskRecord(row.taskRecordId)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
// 加载工单明细
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
// 指派工单
|
||||
const onUpdateTask = () => {
|
||||
updateTask({
|
||||
commander: commander.value,
|
||||
taskId: taskId.value,
|
||||
progress: 1
|
||||
}).then(() => {
|
||||
message.success("操作成功");
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
}).catch(err => {
|
||||
message.error(err.message)
|
||||
})
|
||||
};
|
||||
|
||||
// 选择用户
|
||||
const onSelect = (userId) => {
|
||||
commander.value = userId;
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if(content.value == ''){
|
||||
message.error('请填写回复内容!');
|
||||
return false;
|
||||
}
|
||||
validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const data = {
|
||||
...form,
|
||||
taskId: taskId.value,
|
||||
parentId: parentId.value,
|
||||
// 处理工单内容
|
||||
content: content.value,
|
||||
files: JSON.stringify(files.value)
|
||||
};
|
||||
// 转字符串
|
||||
addTaskRecord(data)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
files.value = [];
|
||||
content.value = '';
|
||||
fileList.value = [];
|
||||
// 加载工单明细
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
const onClose = () => {
|
||||
emit("done");
|
||||
}
|
||||
|
||||
/* 粘贴图片上传服务器并插入编辑器 */
|
||||
const onPaste = (e) => {
|
||||
const items = (e.clipboardData || e.originalEvent.clipboardData).items;
|
||||
let hasFile = false;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i].type.indexOf('image') !== -1) {
|
||||
let file = items[i].getAsFile();
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).lastModified,
|
||||
name: file.name
|
||||
};
|
||||
uploadFile(<File>item.file)
|
||||
.then((result) => {
|
||||
const addPath = '\n\r';
|
||||
content.value = content.value + addPath
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
hasFile = true;
|
||||
}
|
||||
}
|
||||
if (hasFile) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
const reload = () => {
|
||||
// 加载工单明细
|
||||
listTaskRecord({ taskId: taskId.value }).then((data) => {
|
||||
record.value = toTreeData({
|
||||
data: data.map((d) => {
|
||||
return { ...d, key: d.taskRecordId, value: d.taskRecordId };
|
||||
}),
|
||||
idField: 'taskRecordId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
loading.value = false;
|
||||
});
|
||||
// 加载应用信息
|
||||
if (appId.value) {
|
||||
getApp(appId.value).then(result => {
|
||||
appInfo.value = result;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 查看秘钥
|
||||
const onAppSecret = (appId) => {
|
||||
getAppSecret({ appId }).then((res) => {
|
||||
showAppSecret.value = !showAppSecret.value;
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
detail.value = props.data;
|
||||
appId.value = Number(props.data.appId);
|
||||
active.value = Number(props.data.progress);
|
||||
taskId.value = Number(props.data.taskId);
|
||||
commander.value = props.data.commanderName;
|
||||
reload();
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "TaskDetailContent"
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.content {
|
||||
background-color: #ffffff;
|
||||
padding: 10px 0;
|
||||
min-height: 40px;
|
||||
max-width: 80%;
|
||||
overflow: hidden;
|
||||
.edit-md {
|
||||
margin-top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.screenshot {
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.task-card {
|
||||
background-color: var(--body-background);
|
||||
margin-bottom: 20px;
|
||||
//margin: 20px auto;
|
||||
|
||||
.comment {
|
||||
}
|
||||
}
|
||||
|
||||
.task-btn {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 20px;
|
||||
}
|
||||
.ant-page-header{
|
||||
padding: 0 !important;
|
||||
}
|
||||
.replay-bg{
|
||||
//box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.upload-list-inline :deep(.ant-upload-list-item) {
|
||||
float: left;
|
||||
width: 200px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.upload-list-inline [class*='-upload-list-rtl'] :deep(.ant-upload-list-item) {
|
||||
float: right;
|
||||
}
|
||||
/* 应用详情字段列表 */
|
||||
.app-item-list {
|
||||
& > .ele-cell {
|
||||
padding: 16px 8px;
|
||||
.ele-cell-content {
|
||||
.ele-cell-desc {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.ele-cell-title {
|
||||
max-width: 900px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-item-icon {
|
||||
color: #fff;
|
||||
padding: 8px;
|
||||
font-size: 26px;
|
||||
border-radius: 50%;
|
||||
|
||||
&.anticon-qq {
|
||||
background: #3492ed;
|
||||
}
|
||||
|
||||
&.anticon-wechat {
|
||||
background: #4daf29;
|
||||
}
|
||||
|
||||
&.anticon-alipay {
|
||||
background: #1476fe;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,85 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="500px"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:title="`添加成员`"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
:label-col="{ sm: 5, xs: 24 }"
|
||||
:wrapper-col="{ sm: 19, xs: 24 }"
|
||||
layout="horizontal"
|
||||
>
|
||||
<a-form-item>
|
||||
<a-input
|
||||
placeholder="请输入开发者账号"
|
||||
v-model:value="content"
|
||||
@pressEnter="save"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addTaskUser } from '@/api/oa/task-user';
|
||||
import { reloadPageTab } from '@/utils/page-tab-util';
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
taskId?: number | 10;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
const content = ref('');
|
||||
const role = ref(20);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
console.log('sdfsdfdsfds');
|
||||
loading.value = true;
|
||||
addTaskUser({
|
||||
username: content.value,
|
||||
role: role.value,
|
||||
taskId: props.taskId
|
||||
})
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 300px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<a-tabs
|
||||
type="card"
|
||||
tabPosition="top"
|
||||
v-model:activeKey="activeKey"
|
||||
@change="query"
|
||||
>
|
||||
<a-tab-pane
|
||||
v-for="(item, index) in data"
|
||||
:key="index"
|
||||
:tab="`${item.tab}(${item.count})`"
|
||||
>
|
||||
<list :data="item" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import List from './list.vue';
|
||||
import { getCount } from '@/api/oa/task';
|
||||
import { TabsParam } from '@/api/tabs';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
|
||||
// 当前选项卡
|
||||
const activeKey = ref(0);
|
||||
|
||||
// 获取字典数据
|
||||
const data = ref<TabsParam | null>(null);
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
const userStore = useUserStore();
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
getCount({ userId: loginUser.value.userId }).then((result) => {
|
||||
data.value = result;
|
||||
});
|
||||
};
|
||||
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'Task'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.sys-organization-list {
|
||||
padding: 12px 6px;
|
||||
height: calc(100vh - 242px);
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,425 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="taskId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
:customRow="customRow"
|
||||
:scroll="{ x: 1200 }"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'name'">
|
||||
<a-tooltip title="查看详情">
|
||||
<span href="#">{{ record.name }}</span>
|
||||
</a-tooltip>
|
||||
<!-- <div class="ele-text-placeholder">{{ record.comments }}</div>-->
|
||||
</template>
|
||||
<template v-if="column.key === 'progress'">
|
||||
<template v-for="(item, index) in taskProgress" :key="index">
|
||||
<a-badge
|
||||
:dot="
|
||||
record.isRead === 0 && loginUser.userId !== record.lastReadUser
|
||||
"
|
||||
v-if="Number(item.value) === Number(record.progress)"
|
||||
>
|
||||
<a-tag v-if="record.status === 0" color="orange">
|
||||
{{ item.label }}
|
||||
</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="green">
|
||||
{{ item.label }}
|
||||
</a-tag>
|
||||
</a-badge>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="column.key === 'taskType'">
|
||||
<div v-for="(d, i) in JSON.parse(taskType)" :key="i">
|
||||
<span v-if="d.value === record.taskType">{{ d.value }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.progress === 0" color="red">待处理</a-tag>
|
||||
<a-tag v-if="record.progress === 1" color="green">已完成</a-tag>
|
||||
<a-tag v-if="record.progress === 2" color="purple">已回复</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'promoter'">
|
||||
<div class="user-box">
|
||||
<a-tooltip :title="`ID:${record.promoter}`">
|
||||
<a-avatar
|
||||
:size="30"
|
||||
:src="`${record.promoterAvatar}`"
|
||||
style="margin-right: 4px"
|
||||
>
|
||||
<template #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
</a-tooltip>
|
||||
<div class="user-info" @click="onPromoter(record)">
|
||||
<span>{{ record.promoterAlias }}</span>
|
||||
<span class="ele-text-placeholder">
|
||||
{{ record.promoterName }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'commander'">
|
||||
<div class="user-box" v-if="record.commander">
|
||||
<a-tooltip :title="`ID:${record.commander}`">
|
||||
<a-avatar
|
||||
:size="30"
|
||||
:src="`${record.commanderAvatar}`"
|
||||
style="margin-right: 4px"
|
||||
>
|
||||
<template #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
</a-tooltip>
|
||||
<div class="user-info" @click="onCommander(record)">
|
||||
<span>{{ record.commanderAlias }}</span>
|
||||
<span class="ele-text-placeholder">
|
||||
{{ record.commanderName }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<a-tag v-if="record.commander === 0" color="red">工单退回</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'createTime'">
|
||||
<a-tooltip :title="`${toDateString(record.createTime)}`">
|
||||
<span class="ele-text-placeholder">
|
||||
{{ timeAgo(record.createTime) }}
|
||||
</span>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<template v-if="column.key === 'updateTime'">
|
||||
<div class="user-box">
|
||||
<a-tooltip :title="`ID:${record.lastReadUser}`">
|
||||
<a-avatar
|
||||
:size="30"
|
||||
v-if="record.lastReadUser > 0"
|
||||
:src="`${record.lastAvatar}`"
|
||||
style="margin-right: 4px"
|
||||
>
|
||||
<template #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
</a-tooltip>
|
||||
<div class="user-info">
|
||||
<span class="ele-text-placeholder">
|
||||
{{ record.lastNickname }}
|
||||
</span>
|
||||
<span class="ele-text-placeholder">
|
||||
{{ timeAgo(record.updateTime) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'users'">
|
||||
<a-space>
|
||||
<ele-avatar-list :data="record.users" :size="22" />
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button @click="openInfo(record)">查看</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
<!-- 编辑弹窗 -->
|
||||
<TaskEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 用户详情 -->
|
||||
<TaskInfo v-model:visible="showInfo" :data="current" @done="reload" />
|
||||
<!-- 成员管理 -->
|
||||
<TaskUser v-model:visible="showUsers" :data="current" @done="reload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, computed, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import {
|
||||
UserOutlined,
|
||||
ExclamationCircleOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import Search from './components/search.vue';
|
||||
import TaskEdit from './components/task-edit.vue';
|
||||
import TaskInfo from './components/task-info.vue';
|
||||
import { pageTask, removeTask, removeBatchTask } from '@/api/oa/task';
|
||||
import { timeAgo } from 'ele-admin-pro';
|
||||
import type { Task, TaskParam } from '@/api/oa/task/model';
|
||||
import TaskUser from '@/views/oa/task/components/task-user.vue';
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前用户信息
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
const taskType = localStorage.getItem('taskType');
|
||||
const props = defineProps<{
|
||||
// 机构 id
|
||||
data?: any;
|
||||
}>();
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Task[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<Task | null>(null);
|
||||
// const users = ref()
|
||||
// 获取字典数据
|
||||
const taskProgress = getDictionaryOptions('taskProgress');
|
||||
const filters = getDictionaryOptions('taskType');
|
||||
|
||||
// 是否显示资产详情
|
||||
const showInfo = ref(false);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
const showUsers = ref(false);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.progress = filters.progress;
|
||||
where.taskSource = filters.taskSource;
|
||||
where.taskType = filters.taskType;
|
||||
where.status = filters.status;
|
||||
}
|
||||
// 搜索条件
|
||||
if (props.data.key) {
|
||||
where.status = props.data.key;
|
||||
}
|
||||
where.userId = loginUser.value.userId;
|
||||
return pageTask({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
// {
|
||||
// key: 'index',
|
||||
// width: 48,
|
||||
// align: 'center',
|
||||
// fixed: 'left',
|
||||
// hideInSetting: true,
|
||||
// customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||
// },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
hideInSetting: true
|
||||
},
|
||||
{
|
||||
title: '工单号',
|
||||
dataIndex: 'taskId',
|
||||
width: 90,
|
||||
align: 'center',
|
||||
key: 'taskId'
|
||||
},
|
||||
{
|
||||
title: '工单标题',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '工单类型',
|
||||
dataIndex: 'taskType',
|
||||
key: 'taskType',
|
||||
align: 'center',
|
||||
filters: filters.value
|
||||
},
|
||||
{
|
||||
title: '受理人',
|
||||
dataIndex: 'commander',
|
||||
key: 'commander',
|
||||
hideInSetting: true
|
||||
},
|
||||
{
|
||||
title: '工单状态',
|
||||
dataIndex: 'progress',
|
||||
key: 'progress',
|
||||
align: 'center',
|
||||
filters: taskProgress.value
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text)
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text)
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: TaskParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Task) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开用户详情弹窗 */
|
||||
const openInfo = (row?: Task) => {
|
||||
current.value = row ?? null;
|
||||
showInfo.value = true;
|
||||
};
|
||||
|
||||
const onPromoter = (row?: Task) => {
|
||||
reload({
|
||||
promoter: row?.promoter
|
||||
});
|
||||
};
|
||||
|
||||
const onCommander = (row?: Task) => {
|
||||
reload({
|
||||
commander: row?.commander
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Task) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeTask(row.taskId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchTask(selection.value.map((d) => d.taskId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: Task) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openInfo(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.data,
|
||||
(visible) => {
|
||||
reload();
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
reload();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'Task'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.sys-org-table :deep(.ant-table-body) {
|
||||
overflow: auto !important;
|
||||
overflow: overlay !important;
|
||||
}
|
||||
|
||||
.sys-org-table :deep(.ant-table-pagination.ant-pagination) {
|
||||
padding: 0 4px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.user-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user