17 changed files with 1032 additions and 41 deletions
@ -0,0 +1,58 @@ |
|||||
|
import request from '@/utils/request'; |
||||
|
import { AxiosPromise } from 'axios'; |
||||
|
import { |
||||
|
TaskLogQuery, |
||||
|
taskLogPageResult, |
||||
|
gainTaskListQuery, |
||||
|
gainTaskListPageResult, |
||||
|
customerFormLogo, |
||||
|
customerFormVersionCont |
||||
|
} from '@/api/taskapi/types' |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 非流程表单提交数据记录 |
||||
|
* |
||||
|
* @param TaskLogQuery |
||||
|
*/ |
||||
|
export function currencyFormApiSubmit(url:any,data:any){ |
||||
|
return request({ |
||||
|
url: url, |
||||
|
method: 'post', |
||||
|
data:data |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 非流程表单提交数据记录 |
||||
|
* |
||||
|
* @param TaskLogQuery |
||||
|
*/ |
||||
|
export function appFormdataLog(data: TaskLogQuery): AxiosPromise<taskLogPageResult> { |
||||
|
return request({ |
||||
|
url: '/systemapi/task_management/app_formdata_log', |
||||
|
method: 'post', |
||||
|
data:data |
||||
|
}); |
||||
|
} |
||||
|
/** |
||||
|
* 获取可执行得任务列表 |
||||
|
* |
||||
|
* @param gainTaskListQuery |
||||
|
*/ |
||||
|
export function gainTaskList(data: gainTaskListQuery): AxiosPromise<gainTaskListPageResult> { |
||||
|
return request({ |
||||
|
url: '/systemapi/task_management/gain_task_list', |
||||
|
method: 'post', |
||||
|
data:data |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
//获取自定义表单版本列表
|
||||
|
export function haveCustomerFormVersion(data: customerFormLogo):AxiosPromise<customerFormVersionCont> { |
||||
|
return request({ |
||||
|
url: '/systemapi/task_management/gain_task_versioncont', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}); |
||||
|
} |
||||
@ -0,0 +1,57 @@ |
|||||
|
//任务记录
|
||||
|
export interface TaskLogQuery extends PageQuery { |
||||
|
keywords?: string; |
||||
|
} |
||||
|
//任务记录列表
|
||||
|
export interface taskLonCont{ |
||||
|
id:number; |
||||
|
title:string; |
||||
|
creater:number; |
||||
|
creater_time:number; |
||||
|
edit_time:number; |
||||
|
types:number; |
||||
|
version_id:number; |
||||
|
status:number; |
||||
|
masters_key:string; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 任务记录列表分页 |
||||
|
*/ |
||||
|
export type taskLogPageResult = PageResult<taskLonCont[]>; |
||||
|
|
||||
|
//获取可执行得任务列表
|
||||
|
export interface gainTaskListQuery extends PageQuery { |
||||
|
status?: number; |
||||
|
} |
||||
|
//执行得任务记录列表
|
||||
|
export interface taskListCont{ |
||||
|
id:string; |
||||
|
name:string; |
||||
|
createrName:string; |
||||
|
createrNumber:string; |
||||
|
createrTame:string; |
||||
|
} |
||||
|
/** |
||||
|
* 获取可执行得任务列表分页 |
||||
|
*/ |
||||
|
export type gainTaskListPageResult = PageResult<taskListCont[]>; |
||||
|
|
||||
|
//自定义表单标识符
|
||||
|
export interface customerFormLogo{ |
||||
|
id:string |
||||
|
} |
||||
|
//自定义表单版本内容
|
||||
|
export interface customerFormVersionCont{ |
||||
|
id:number; |
||||
|
tablekey:string; |
||||
|
version:number; |
||||
|
status:number; |
||||
|
mastesform:string; |
||||
|
mastesformjson:string; |
||||
|
creater:number; |
||||
|
time:number; |
||||
|
editTime:number; |
||||
|
table_structure:string; |
||||
|
dict:string; |
||||
|
} |
||||
@ -0,0 +1,238 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2023-09-26 09:12:55 |
||||
|
@ 备注: 编辑自定义表单数据 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { ref, reactive, onMounted, computed, nextTick } from 'vue' |
||||
|
import { useRouter } from 'vue-router' |
||||
|
import { |
||||
|
string2json, |
||||
|
stringToObj |
||||
|
} from '@/utils/DesignForm/form' |
||||
|
|
||||
|
import { haveCustomerFormVersion } from '@/api/taskapi/management' |
||||
|
import { judgeSubmitCancel } from '@/api/DesignForm/requestapi' |
||||
|
|
||||
|
import '@/assets/scss/element-var.scss' |
||||
|
import '@/assets/scss/index.scss' |
||||
|
import '@/assets/iconfont/iconfont.css' |
||||
|
import 'element-plus/dist/index.css' |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
iseditopen:{ |
||||
|
type:Boolean, |
||||
|
default:true |
||||
|
}, |
||||
|
versionid:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
}, |
||||
|
versiontitle:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
}, |
||||
|
masterskey:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
}, |
||||
|
infoid:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
} |
||||
|
}) |
||||
|
const submitButton = { |
||||
|
type: "div", |
||||
|
control:{}, |
||||
|
config:{ |
||||
|
textAlign: "center", |
||||
|
span: "" |
||||
|
}, |
||||
|
list: [ |
||||
|
{ |
||||
|
type: "button", |
||||
|
control:{ |
||||
|
label: "保存", |
||||
|
type: "primary", |
||||
|
key: "submit" |
||||
|
}, |
||||
|
config:{ |
||||
|
textAlign: "center" |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
const cancelButton = { |
||||
|
type: "div", |
||||
|
control:{}, |
||||
|
config:{ |
||||
|
textAlign: "center", |
||||
|
span: "" |
||||
|
}, |
||||
|
list: [ |
||||
|
{ |
||||
|
type: "button", |
||||
|
control:{ |
||||
|
label: "返回", |
||||
|
type: "danger", |
||||
|
key: "cancel" |
||||
|
}, |
||||
|
config:{ |
||||
|
textAlign: "center" |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
const submitAndCancelButton = { |
||||
|
type: "div", |
||||
|
control:{}, |
||||
|
config:{ |
||||
|
span: 24, |
||||
|
textAlign: "center" |
||||
|
}, |
||||
|
list: [ |
||||
|
{ |
||||
|
type: "button", |
||||
|
control:{ |
||||
|
label: "保存", |
||||
|
type: "primary", |
||||
|
key: "submit" |
||||
|
}, |
||||
|
config:{ |
||||
|
span: 0 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
type: "button", |
||||
|
control:{ |
||||
|
label: "返回", |
||||
|
type: "danger", |
||||
|
key: "cancel" |
||||
|
}, |
||||
|
config:{ |
||||
|
span: 0 |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}; |
||||
|
const loadingData = ref(false) |
||||
|
const formEl = ref() |
||||
|
const state = reactive<any>({ |
||||
|
type: 1, // 1新增;2修改;3查看(表单模式) ;4查看; 5设计 |
||||
|
formData: { |
||||
|
list: [], |
||||
|
form: {}, |
||||
|
config: {} |
||||
|
}, |
||||
|
dict: {}, |
||||
|
formId: props.versionid, |
||||
|
id: props.masterskey, |
||||
|
loading: true |
||||
|
}) |
||||
|
const formType = computed(() => { |
||||
|
// 带有参数id为编辑状态 |
||||
|
if (props.infoid) { |
||||
|
return 2 |
||||
|
} else { |
||||
|
return 1 |
||||
|
} |
||||
|
}) |
||||
|
const emits = defineEmits(["update:iseditopen"]); |
||||
|
const isShow = computed({ |
||||
|
get: () => props.iseditopen, |
||||
|
set: (val) => { |
||||
|
emits("update:iseditopen", val); |
||||
|
}, |
||||
|
}); |
||||
|
//获取表单数据 |
||||
|
const getTaskFormData = () =>{ |
||||
|
loadingData.value = true; |
||||
|
haveCustomerFormVersion({id:props.versionid}) |
||||
|
.then(({ data }) =>{ |
||||
|
console.log("表单数据",data) |
||||
|
state.id=props.versionid |
||||
|
state.formData = stringToObj(data.mastesform) |
||||
|
state.dict = string2json(data.dict) |
||||
|
|
||||
|
judgeSubmitCancel({"name":data.mastesformjson}) |
||||
|
.then((data:any) =>{ |
||||
|
if(data.code == 0){ |
||||
|
if (data.data == 3 || data.data == 4){ |
||||
|
state.formData.list.push(submitButton) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
.finally(()=>{ |
||||
|
formEl.value.getData({ formId: props.versionid, id: props.masterskey}) |
||||
|
loadingData.value = false; |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
const drawerWith = ref<number>(0); |
||||
|
onMounted(()=>{ |
||||
|
drawerWith.value = window.innerWidth - 220 |
||||
|
|
||||
|
}); |
||||
|
window.addEventListener("resize", function(){ |
||||
|
drawerWith.value = window.innerWidth -220 |
||||
|
}) |
||||
|
const beforeSubmit = (params: any) => { |
||||
|
params.formId = props.masterskey |
||||
|
params.id = props.versionid |
||||
|
// emits("update:isopen", false); |
||||
|
console.log(params,"===========================>") |
||||
|
return params |
||||
|
} |
||||
|
const afterSubmit = (type: string) => { |
||||
|
if (type === 'success') { |
||||
|
// router.go(-1) |
||||
|
console.log("表单提交成功") |
||||
|
closeAppSubmit(); |
||||
|
} |
||||
|
} |
||||
|
const closeAppSubmit = () => { |
||||
|
emits("update:iseditopen", false); |
||||
|
initData(); |
||||
|
} |
||||
|
const initData = () => { |
||||
|
state.formData = { |
||||
|
list: [], |
||||
|
form: {}, |
||||
|
config: {} |
||||
|
}; |
||||
|
state.dict = {}; |
||||
|
state.formId = 0; |
||||
|
state.id = 0; |
||||
|
state.loading = true; |
||||
|
} |
||||
|
watch(()=>props.iseditopen,()=>{ |
||||
|
if(props.iseditopen){ |
||||
|
getTaskFormData(); |
||||
|
}else{ |
||||
|
initData() |
||||
|
} |
||||
|
}) |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-drawer v-model="isShow" v-loading="loadingData" :title="versiontitle" :close-on-click-modal="false" :close-on-press-escape="false" :destroy-on-close="true" :size="drawerWith" class="drawerClass" > |
||||
|
<div class="drawerBody"> |
||||
|
<ak-form |
||||
|
ref="formEl" |
||||
|
:form-data="state.formData" |
||||
|
:type="formType" |
||||
|
:dict="state.dict" |
||||
|
request-url="getFormContent" |
||||
|
add-url="saveFormContent" |
||||
|
edit-url="editFormContent" |
||||
|
:before-submit="beforeSubmit" |
||||
|
:after-submit="afterSubmit" |
||||
|
:close-app-submit="closeAppSubmit" |
||||
|
/> |
||||
|
</div> |
||||
|
|
||||
|
</el-drawer> |
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,207 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2023-09-22 15:26:36 |
||||
|
@ 备注: 回显表单 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { ref, reactive, onMounted, computed, nextTick } from 'vue' |
||||
|
import { useRouter } from 'vue-router' |
||||
|
import { |
||||
|
string2json, |
||||
|
stringToObj |
||||
|
} from '@/utils/DesignForm/form' |
||||
|
|
||||
|
import { haveCustomerFormVersion } from '@/api/taskapi/management' |
||||
|
import { judgeSubmitCancel } from '@/api/DesignForm/requestapi' |
||||
|
|
||||
|
import '@/assets/scss/element-var.scss' |
||||
|
import '@/assets/scss/index.scss' |
||||
|
import '@/assets/iconfont/iconfont.css' |
||||
|
import 'element-plus/dist/index.css' |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
isopen:{ |
||||
|
type:Boolean, |
||||
|
default:true |
||||
|
}, |
||||
|
versionid:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
}, |
||||
|
versiontitle:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
}, |
||||
|
infoid:{ |
||||
|
type:String, |
||||
|
default:"" |
||||
|
} |
||||
|
}) |
||||
|
const submitButton = { |
||||
|
type: "div", |
||||
|
control: |
||||
|
{}, |
||||
|
config: |
||||
|
{ |
||||
|
textAlign: "center", |
||||
|
span: "" |
||||
|
}, |
||||
|
list: [ |
||||
|
{ |
||||
|
type: "button", |
||||
|
control: |
||||
|
{ |
||||
|
label: "保存", |
||||
|
type: "primary", |
||||
|
key: "submit" |
||||
|
}, |
||||
|
config: |
||||
|
{ |
||||
|
textAlign: "center" |
||||
|
} |
||||
|
}] |
||||
|
} |
||||
|
const loadingData = ref(false) |
||||
|
const formEl = ref() |
||||
|
const router = useRouter() |
||||
|
const state = reactive<any>({ |
||||
|
type: 1, // 1新增;2修改;3查看(表单模式) ;4查看; 5设计 |
||||
|
formData: { |
||||
|
list: [], |
||||
|
form: {}, |
||||
|
config: {} |
||||
|
}, |
||||
|
dict: {}, |
||||
|
formId: props.versionid, |
||||
|
id: 0, |
||||
|
loading: true |
||||
|
}) |
||||
|
const formType = computed(() => { |
||||
|
// 带有参数id为编辑状态 |
||||
|
if (props.infoid) { |
||||
|
return 2 |
||||
|
} else { |
||||
|
return 1 |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
const emits = defineEmits(["update:isopen","searchquery"]); |
||||
|
const drawerOpenOrClose = computed({ |
||||
|
get: () => props.isopen, |
||||
|
set: (val) => { |
||||
|
emits("update:isopen", val); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
//获取表单数据 |
||||
|
const getTaskFormData = () =>{ |
||||
|
loadingData.value = true; |
||||
|
haveCustomerFormVersion({id:props.versionid}) |
||||
|
.then(({ data }) =>{ |
||||
|
console.log("表单数据",data) |
||||
|
state.id=props.versionid |
||||
|
state.formData = stringToObj(data.mastesform) |
||||
|
state.dict = string2json(data.dict) |
||||
|
judgeSubmitCancel({"name":data.mastesformjson}) |
||||
|
.then((data:any) =>{ |
||||
|
if(data.code == 0){ |
||||
|
if (data.data == 3 || data.data == 4){ |
||||
|
state.formData.list.push(submitButton) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
.finally(()=>{ |
||||
|
loadingData.value = false; |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
const drawerWith = ref<number>(0); |
||||
|
onMounted(()=>{ |
||||
|
drawerWith.value = window.innerWidth - 220 |
||||
|
|
||||
|
}); |
||||
|
window.addEventListener("resize", function(){ |
||||
|
drawerWith.value = window.innerWidth -220 |
||||
|
}) |
||||
|
const beforeSubmit = (params: any) => { |
||||
|
params.formId = props.versionid |
||||
|
params.id = "" |
||||
|
// emits("update:isopen", false); |
||||
|
return params |
||||
|
} |
||||
|
const afterSubmit = (type: string) => { |
||||
|
if (type === 'success') { |
||||
|
// router.go(-1) |
||||
|
console.log("表单提交成功") |
||||
|
emits("searchquery"); |
||||
|
closeAppSubmit(); |
||||
|
} |
||||
|
} |
||||
|
const closeAppSubmit = () => { |
||||
|
emits("update:isopen", false); |
||||
|
initData(); |
||||
|
} |
||||
|
const initData = () => { |
||||
|
state.formData = { |
||||
|
list: [], |
||||
|
form: {}, |
||||
|
config: {} |
||||
|
}; |
||||
|
state.dict = {}; |
||||
|
state.formId = 0; |
||||
|
state.id = 0; |
||||
|
state.loading = true; |
||||
|
} |
||||
|
watch(()=>props.isopen,()=>{ |
||||
|
if(props.isopen){ |
||||
|
getTaskFormData(); |
||||
|
}else{ |
||||
|
initData() |
||||
|
} |
||||
|
}) |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-drawer v-model="drawerOpenOrClose" v-loading="loadingData" :title="versiontitle" :close-on-click-modal="false" :close-on-press-escape="false" :destroy-on-close="true" :size="drawerWith" class="drawerClass" > |
||||
|
<div class="drawerBody"> |
||||
|
<ak-form |
||||
|
ref="formEl" |
||||
|
:form-data="state.formData" |
||||
|
:type="formType" |
||||
|
:dict="state.dict" |
||||
|
request-url="getFormContent" |
||||
|
add-url="saveFormContent" |
||||
|
edit-url="editFormContent" |
||||
|
:before-submit="beforeSubmit" |
||||
|
:after-submit="afterSubmit" |
||||
|
:close-app-submit="closeAppSubmit" |
||||
|
/> |
||||
|
</div> |
||||
|
|
||||
|
</el-drawer> |
||||
|
|
||||
|
</template> |
||||
|
<style lang='scss'> |
||||
|
.drawerClass ::v-deep.el-drawer__header { |
||||
|
font-size: 22px; |
||||
|
text-align: center; |
||||
|
margin-bottom: 0px; |
||||
|
padding: 0; |
||||
|
.el-drawer__close-btn{ |
||||
|
background-color: rgb(255, 77, 79); |
||||
|
color: white; |
||||
|
} |
||||
|
} |
||||
|
::v-deep .el-drawer__body { |
||||
|
padding: 0px; |
||||
|
} |
||||
|
.details { |
||||
|
width: 80%; |
||||
|
margin-right: 0px; |
||||
|
margin-left: 20%; |
||||
|
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%); |
||||
|
} |
||||
|
.drawerBody{ |
||||
|
padding: 20px; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,112 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2023-09-22 08:59:47 |
||||
|
@ 备注: 任务列表 |
||||
|
--> |
||||
|
<script lang='ts' setup> |
||||
|
import { gainTaskListQuery,taskListCont } from '@/api/taskapi/types' |
||||
|
import { gainTaskList } from '@/api/taskapi/management' |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
isshow:{ |
||||
|
type:Boolean, |
||||
|
default:true |
||||
|
} |
||||
|
}) |
||||
|
const taskLoding = ref(false); |
||||
|
const gainTaskListInfo = reactive<gainTaskListQuery>({ |
||||
|
page:1, |
||||
|
pagesize:9, |
||||
|
status:1 |
||||
|
}); |
||||
|
const taskTotal = ref<number>(0) |
||||
|
const taskList = ref<taskListCont[]>(); |
||||
|
|
||||
|
const emits = defineEmits(["update:isshow","opencustomerform"]); |
||||
|
const isShow = computed({ |
||||
|
get: () => props.isshow, |
||||
|
set: (val) => { |
||||
|
emits("update:isshow", val); |
||||
|
}, |
||||
|
}); |
||||
|
//获取记录 |
||||
|
const gainTaskContAry = () => { |
||||
|
taskLoding.value = true |
||||
|
gainTaskList(gainTaskListInfo) |
||||
|
.then(({data})=>{ |
||||
|
console.log(data) |
||||
|
if(data != null){ |
||||
|
taskList.value = data.list; |
||||
|
taskTotal.value = data.total; |
||||
|
} |
||||
|
}) |
||||
|
.finally(()=>{ |
||||
|
taskLoding.value = false |
||||
|
}) |
||||
|
} |
||||
|
//初始化数据 |
||||
|
const initData = () => { |
||||
|
gainTaskListInfo.page = 1; |
||||
|
gainTaskListInfo.pagesize = 9; |
||||
|
gainTaskListInfo.status = 1; |
||||
|
} |
||||
|
//关闭弹窗 |
||||
|
const taskEntryClose = () => { |
||||
|
emits("update:isshow", false); |
||||
|
initData(); |
||||
|
} |
||||
|
//监听 |
||||
|
watch(() => props.isshow,(val:boolean)=>{ |
||||
|
if(val) { |
||||
|
gainTaskContAry(); |
||||
|
} |
||||
|
}) |
||||
|
//使用版本 |
||||
|
const startUsing = (id:string,title:string) => { |
||||
|
taskEntryClose(); |
||||
|
emits("opencustomerform",id,title) |
||||
|
} |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-dialog |
||||
|
v-model="isShow" |
||||
|
title="选择任务" |
||||
|
width="845" |
||||
|
:before-close="taskEntryClose" |
||||
|
> |
||||
|
<el-space v-loading="taskLoding" wrap > |
||||
|
<el-card v-for="item in taskList" :key="item.id" style="width: 260px"> |
||||
|
<el-space direction="vertical" style="width: 100%;"> |
||||
|
<div> |
||||
|
<el-space wrap> |
||||
|
<el-text class="mx-1">{{ item.name }}</el-text> |
||||
|
<el-text class="mx-1">设计者:{{ item.createrName }}({{ item.createrNumber }})</el-text> |
||||
|
<el-text class="mx-1">发布时间:{{ item.createrTame }}</el-text> |
||||
|
</el-space> |
||||
|
</div> |
||||
|
<div class="taskButton"><el-button type="primary" @click.stop="startUsing(item.id,item.name)">使用</el-button></div> |
||||
|
</el-space> |
||||
|
</el-card> |
||||
|
</el-space> |
||||
|
<template #footer> |
||||
|
<pagination |
||||
|
v-if="taskTotal > 0" |
||||
|
v-model:total="taskTotal" |
||||
|
v-model:page="gainTaskListInfo.page" |
||||
|
v-model:limit="gainTaskListInfo.pagesize" |
||||
|
align="center" |
||||
|
@pagination="gainTaskContAry" |
||||
|
/> |
||||
|
|
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
<style lang='scss' scoped> |
||||
|
.taskButton{ |
||||
|
width: 100%; |
||||
|
text-align: center; |
||||
|
|
||||
|
} |
||||
|
</style> |
||||
Loading…
Reference in new issue