提交 fc9d3541 authored 作者: liuluyu's avatar liuluyu

增加计划执行表单

上级 56fa3c83
...@@ -7,73 +7,88 @@ export const columns: BasicColumn[] = [ ...@@ -7,73 +7,88 @@ export const columns: BasicColumn[] = [
title: '计划名称', title: '计划名称',
align: 'left', align: 'left',
dataIndex: 'projectName', dataIndex: 'projectName',
width: 150, width: 200,
ellipsis: true,
}, },
{ {
title: '类型', title: '类型',
align: 'center', align: 'center',
dataIndex: 'projectTypeName', dataIndex: 'projectTypeName',
width: 150, width: 120,
}, ellipsis: true,
{
title: '执行部门',
align: 'center',
dataIndex: 'execDepName',
width: 100,
}, },
// {
// title: '执行部门',
// align: 'center',
// dataIndex: 'execDepName',
// width: 150,
// ellipsis: true,
// },
{ {
title: '负责人', title: '负责人',
align: 'center', align: 'center',
dataIndex: 'headName', dataIndex: 'headName',
width: 100, width: 100,
ellipsis: true,
}, },
{ {
title: '计划开始日期', title: '计划开始日期',
align: 'center', align: 'center',
dataIndex: 'planStartDate', dataIndex: 'planStartDate',
width: 130,
ellipsis: true,
customRender: ({ text }) => { customRender: ({ text }) => {
return !text ? '' : text.length > 10 ? text.substr(0, 10) : text; return !text ? '-' : text.length > 10 ? text.substr(0, 10) : text;
}, },
width: 130,
}, },
{ {
title: '计划结束日期', title: '计划结束日期',
align: 'center', align: 'center',
dataIndex: 'planEndDate', dataIndex: 'planEndDate',
width: 130,
ellipsis: true,
customRender: ({ text }) => { customRender: ({ text }) => {
return !text ? '' : text.length > 10 ? text.substr(0, 10) : text; return !text ? '-' : text.length > 10 ? text.substr(0, 10) : text;
}, },
width: 130,
},
{
title: '状态',
align: 'center',
dataIndex: 'statusName',
width: 100,
}, },
{ {
title: '执行规则', title: '执行规则',
align: 'center', align: 'center',
dataIndex: 'exeRule', dataIndex: 'exeRule',
width: 100,
ellipsis: true,
customRender: ({ text }) => { customRender: ({ text }) => {
return !text ? '' : text==1? "每发生": text==2?"周期性":"一次性"; const ruleMap = {
1: '每发生',
2: '周期性',
3: '一次性',
};
return ruleMap[text] || '-';
}, },
},
{
title: '状态',
align: 'center',
dataIndex: 'statusName',
width: 100, width: 100,
ellipsis: true,
}, },
{ {
title: '流程状态', title: '流程状态',
align: 'center', align: 'center',
dataIndex: 'bpmStatus', dataIndex: 'bpmStatus',
width: 100, width: 120,
ellipsis: true,
customRender: ({ text }) => { customRender: ({ text }) => {
return render.renderDict(text, 'bpm_status'); return render.renderDict(text, 'bpm_status') || '-';
}, },
}, },
// 隐藏列,用于内部使用
{ {
title: '', title: '',
align: 'center',
dataIndex: 'projectType', dataIndex: 'projectType',
width: 0, width: 0,
ellipsis: false,
}, },
]; ];
//查询数据 //查询数据
...@@ -87,8 +102,12 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -87,8 +102,12 @@ export const searchFormSchema: FormSchema[] = [
{ {
label: '类型', label: '类型',
field: 'projectType', field: 'projectType',
component: 'Input', component: 'Select',
colProps: { span: 6 }, colProps: { span: 6 },
componentProps: {
allowClear: true,
placeholder: '请选择类型',
},
}, },
{ {
label: '执行部门', label: '执行部门',
...@@ -97,6 +116,7 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -97,6 +116,7 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 6 }, colProps: { span: 6 },
}, },
]; ];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
...@@ -115,7 +135,7 @@ export const formSchema: FormSchema[] = [ ...@@ -115,7 +135,7 @@ export const formSchema: FormSchema[] = [
component: 'JCategorySelect', component: 'JCategorySelect',
componentProps: { componentProps: {
pcode: 'B09', pcode: 'B09',
valueType: 'code' valueType: 'code',
}, },
colProps: { lg: 12 }, colProps: { lg: 12 },
itemProps: { labelCol: { xs: { span: 24 }, sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 18 } } }, itemProps: { labelCol: { xs: { span: 24 }, sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 18 } } },
...@@ -151,8 +171,8 @@ export const formSchema: FormSchema[] = [ ...@@ -151,8 +171,8 @@ export const formSchema: FormSchema[] = [
slot: 'planBasis', slot: 'planBasis',
itemProps: { itemProps: {
labelCol: { xs: { span: 24 }, sm: { span: 3 } }, labelCol: { xs: { span: 24 }, sm: { span: 3 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 21 } } wrapperCol: { xs: { span: 24 }, sm: { span: 21 } },
} },
}, },
{ {
label: '要求', label: '要求',
......
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
<JSearchSelect placeholder="请输入" v-model:value="queryParam[searchFormSchema[1].field]" dict="projecttype" /> <JSearchSelect placeholder="请输入" v-model:value="queryParam[searchFormSchema[1].field]" dict="projecttype" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6"> <!-- <a-col :lg="6">
<a-form-item :label="searchFormSchema[2].label"> <a-form-item :label="searchFormSchema[2].label">
<JSelectDept placeholder="请输入" v-model:value="jSelectDeptVal" :multiple="false" @change="updateJSelectDept" /> <JSelectDept placeholder="请输入" v-model:value="jSelectDeptVal" :multiple="false" @change="updateJSelectDept" />
</a-form-item> </a-form-item>
</a-col> </a-col> -->
<a-col :lg="6"> <a-col :lg="6">
<a-form-item> <a-form-item>
<a-space :size="5"> <a-space :size="5">
...@@ -59,10 +59,6 @@ ...@@ -59,10 +59,6 @@
<template #htmlSlot="{ text }"> <template #htmlSlot="{ text }">
<div v-html="text"></div> <div v-html="text"></div>
</template> </template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{ text }">
{{ getAreaTextByCode(text) }}
</template>
<template #fileSlot="{ text }"> <template #fileSlot="{ text }">
<span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span> <span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)" <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)"
...@@ -144,7 +140,7 @@ ...@@ -144,7 +140,7 @@
const isShowDrawer = ref(false); const isShowDrawer = ref(false);
const startUser = ref<string>(''); const startUser = ref<string>('');
const taskName = ref<string>(''); const taskName = ref<string>('');
const showUpBtn = ref(false); const showUpBtn = ref(true);
const taskCache = new Map<string, any>(); const taskCache = new Map<string, any>();
const userStore = useUserStore(); const userStore = useUserStore();
......
<template>
<div class="st-plan-excute-form">
<a-form ref="formRef" :model="formData" label-width="120px">
<!-- 执行状态 -->
<a-form-item label="执行状态" prop="executeStatus">
<a-select v-model:value="formData.executeStatus" placeholder="请选择执行状态">
<a-select-option value="0">未开始</a-select-option>
<a-select-option value="1">进行中</a-select-option>
<a-select-option value="2">已完成</a-select-option>
<a-select-option value="3">已暂停</a-select-option>
</a-select>
</a-form-item>
<!-- 实际开始时间 -->
<a-form-item label="实际开始时间" prop="actualStartTime">
<a-date-picker v-model="formData.actualStartTime" type="datetime" placeholder="选择时间"></a-date-picker>
</a-form-item>
<!-- 实际结束时间 -->
<a-form-item label="实际结束时间" prop="actualEndTime">
<a-date-picker v-model="formData.actualEndTime" type="datetime" placeholder="选择时间"></a-date-picker>
</a-form-item>
<!-- 执行记录 -->
<a-form-item label="执行记录" prop="executeRecord">
<a-textarea v-model="formData.executeRecord" :rows="4" placeholder="请输入执行记录"></a-textarea>
</a-form-item>
<!-- 附件 -->
<a-form-item label="附件" prop="attachments">
<JUpload v-model:value="formModel.fileUploadPath" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." :disabled="isDetail" />
</a-form-item>
<!-- 操作按钮 -->
<a-form-item>
<a-button type="primary" @click="submitForm">保存</a-button>
<a-button @click="resetForm">重置</a-button>
</a-form-item>
</a-form>
</div>
</template>
<script setup>
import { ref } from 'vue';
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
const formRef = ref();
const formData = ref({
executeStatus: '',
actualStartTime: '',
actualEndTime: '',
executeRecord: '',
attachments: [],
});
const submitForm = () => {
formRef.value.validate((valid) => {
if (valid) {
console.log('Form submitted:', formData.value);
// 提交逻辑
}
});
};
const resetForm = () => {
formRef.value.resetFields();
};
</script>
<style scoped>
.st-plan-excute-form {
padding: 20px;
}
</style>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
v-for="item in safeJsonParse(model[field])" v-for="item in safeJsonParse(model[field])"
@click="viewBasisDetail(item)" @click="viewBasisDetail(item)"
:key="item.id" :key="item.id"
style="margin-bottom: 8px; cursor: pointer;" style="margin-bottom: 8px; cursor: pointer"
> >
{{ item.name }} {{ item.name }}
</a-tag> </a-tag>
...@@ -33,69 +33,68 @@ ...@@ -33,69 +33,68 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { BasicForm, useForm } from '/@/components/Form/index'; import { BasicForm, useForm } from '/@/components/Form/index';
import { computed, ref, onMounted,watchEffect,toRaw } from 'vue'; import { computed, ref, onMounted, watchEffect, toRaw } from 'vue';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { getBpmFormSchema } from '../StPlanMan.data'; import { getBpmFormSchema } from '../StPlanMan.data';
import { saveOrUpdate } from '../StPlanMan.api'; import { saveOrUpdate } from '../StPlanMan.api';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import AuditInnerDetailDrawer from '/@/views/newlib/components/modal/AuditInnerDetailDrawer.vue'; import AuditInnerDetailDrawer from '/@/views/newlib/components/modal/AuditInnerDetailDrawer.vue';
import { getAuthCache, setAuthCache, removeAuthCache } from '/@/utils/auth'; import { getAuthCache, setAuthCache, removeAuthCache } from '/@/utils/auth';
import { TOKEN_KEY} from '/@/enums/cacheEnum'; import { TOKEN_KEY } from '/@/enums/cacheEnum';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
const route = useRoute(); const route = useRoute();
interface Props {
interface Props {
formData: { formData: {
disabled?: boolean; disabled?: boolean;
[key: string]: any; [key: string]: any;
}; };
} }
const showDetailDrawer = ref(false); const showDetailDrawer = ref(false);
const props = defineProps<Props>(); const props = defineProps<Props>();
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const loading = ref(false); const loading = ref(false);
const submitting = ref(false); const submitting = ref(false);
const formData = ref<Record<string, any>>({}); const formData = ref<Record<string, any>>({});
const idsystoken = ref(''); const idsystoken = ref('');
const [registerForm, { setFieldsValue, setProps, getFieldsValue, resetFields, validate }] = useForm({ const [registerForm, { setFieldsValue, setProps, getFieldsValue, resetFields, validate }] = useForm({
labelWidth: 150, labelWidth: 150,
schemas: getBpmFormSchema(props.formData), schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false, showActionButtonGroup: false,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
}); });
const formDisabled = computed(() => { const formDisabled = computed(() => {
return props.formData?.disabled !== false; return props.formData?.disabled !== false;
}); });
// 安全解析JSON // 安全解析JSON
const safeJsonParse = (str: string) => { const safeJsonParse = (str: string) => {
try { try {
return JSON.parse(str); return JSON.parse(str);
} catch (e) { } catch (e) {
console.error('JSON解析错误:', e); console.error('JSON解析错误:', e);
return []; return [];
} }
}; };
// 验证是否为有效JSON // 验证是否为有效JSON
const isValidJson = (str: string) => { const isValidJson = (str: string) => {
try { try {
JSON.parse(str); JSON.parse(str);
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
} }
}; };
// 依据详情抽屉 // 依据详情抽屉
const auditInnerDetailDrawerRef = ref(); const auditInnerDetailDrawerRef = ref();
const selectedBasis = ref<any>(null); const selectedBasis = ref<any>(null);
const viewBasisDetail = (item: any) => { const viewBasisDetail = (item: any) => {
selectedBasis.value = item; selectedBasis.value = item;
const data = { const data = {
name: item.name, name: item.name,
...@@ -103,16 +102,15 @@ const viewBasisDetail = (item: any) => { ...@@ -103,16 +102,15 @@ const viewBasisDetail = (item: any) => {
}; };
showDetailDrawer.value = true; showDetailDrawer.value = true;
auditInnerDetailDrawerRef.value.open(data); auditInnerDetailDrawerRef.value.open(data);
}; };
const handleDrawerClose = () => { const handleDrawerClose = () => {
showDetailDrawer.value = false; showDetailDrawer.value = false;
selectedBasis.value = null; selectedBasis.value = null;
}; };
// 从URL获取参数 // 从URL获取参数
const getUrlParams = () => { const getUrlParams = () => {
const winurl = window.location.href; const winurl = window.location.href;
const params = new URLSearchParams(winurl.split('?')[1]); const params = new URLSearchParams(winurl.split('?')[1]);
...@@ -121,10 +119,10 @@ const getUrlParams = () => { ...@@ -121,10 +119,10 @@ const getUrlParams = () => {
cctoken: params.get('Token') || '', cctoken: params.get('Token') || '',
WorkID: params.get('WorkID') || '', WorkID: params.get('WorkID') || '',
}; };
}; };
// 初始化表单数据 // 初始化表单数据
const initFormData = async () => { const initFormData = async () => {
try { try {
loading.value = true; loading.value = true;
//const { cctoken, WorkID } = getUrlParams(); //const { cctoken, WorkID } = getUrlParams();
...@@ -153,7 +151,7 @@ const initFormData = async () => { ...@@ -153,7 +151,7 @@ const initFormData = async () => {
const queryByIdUrl = '/plan.main/stPlanMan/queryById'; const queryByIdUrl = '/plan.main/stPlanMan/queryById';
const data = await defHttp.get({ const data = await defHttp.get({
url: queryByIdUrl, url: queryByIdUrl,
params: { id: tid, "_t": timestamp }, params: { id: tid, _t: timestamp },
}); });
formData.value = { ...data }; formData.value = { ...data };
...@@ -170,17 +168,15 @@ const initFormData = async () => { ...@@ -170,17 +168,15 @@ const initFormData = async () => {
} finally { } finally {
loading.value = false; loading.value = false;
} }
}; };
onMounted(() => { onMounted(() => {
initFormData(); initFormData();
}); });
</script> </script>
<style scoped> <style scoped>
.ant-tag { .ant-tag {
margin-right: 8px; margin-right: 8px;
cursor: pointer; cursor: pointer;
} }
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论