perf: 外置表单模版

master
ssc 3 years ago
parent d42de6f1c5
commit 51d66cce1e
  1. 8
      src/api/plugin/workflow/demo/leave.js
  2. 2
      src/views/plugin/workflow/demo/leave/index.vue
  3. 27
      src/views/plugin/workflow/process/external/Leave/detail.vue
  4. 57
      src/views/plugin/workflow/process/external/Leave/start.vue
  5. 12
      src/views/plugin/workflow/process/external/template/detail.vue
  6. 4
      src/views/plugin/workflow/util/status.js

@ -22,4 +22,12 @@ export const remove = (ids) => {
ids, ids,
} }
}) })
}
export const submit = (data) => {
return request({
url: `${prefix}/submit`,
method: 'post',
data
})
} }

@ -215,7 +215,7 @@ export default {
}, },
methods: { methods: {
handleDetail(row) { handleDetail(row) {
this.dynamicRoute({ processInstanceId: row.processInsId }, 'detail', true).then(() => { this.dynamicRoute({ ...row, processInstanceId: row.processInsId }, 'detail', true).then(() => {
this.form = { ...row } this.form = { ...row }
this.detailVisible = true this.detailVisible = true
}) })

@ -28,6 +28,13 @@
:option="option" :option="option"
:upload-preview="handleUploadPreview"> :upload-preview="handleUploadPreview">
</avue-form> </avue-form>
<el-card shadow="never"
style="margin-top: 10px;"
header="流转信息"
:body-style="{padding: '20px 0'}"
v-if="isPrintShow">
<wf-flow :flow="flow"></wf-flow>
</el-card>
</div> </div>
</el-card> </el-card>
<el-card shadow="never" <el-card shadow="never"
@ -97,7 +104,7 @@ export default {
if (val) { if (val) {
const param = JSON.parse(Buffer.from(val, 'base64').toString()) const param = JSON.parse(Buffer.from(val, 'base64').toString())
const { taskId, processInsId } = param const { taskId, processInsId } = param
if (taskId && processInsId) this.getDetail(taskId, processInsId) if ((taskId && processInsId) || processInsId) this.getDetail(taskId, processInsId)
} }
}, },
immediate: true immediate: true
@ -124,7 +131,7 @@ export default {
label: '创建部门', label: '创建部门',
span: 12, span: 12,
display: true, display: true,
prop: 'createDept', prop: 'creatorDept',
value: '${this.$store.getters.userInfo.dept_name}', value: '${this.$store.getters.userInfo.dept_name}',
readonly: true readonly: true
}, },
@ -136,6 +143,7 @@ export default {
format: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
prop: 'datetime', prop: 'datetime',
dataType: 'string',
required: true, required: true,
rules: [ rules: [
{ {
@ -147,8 +155,8 @@ export default {
if (!value || value.length == 0) { if (!value || value.length == 0) {
this.$set(this.form, 'days', undefined) this.$set(this.form, 'days', undefined)
} else { } else {
const d1 = Date.parse(value[0]) const d1 = Date.parse(value.split(',')[0])
const d2 = Date.parse(value[1]) const d2 = Date.parse(value.split(',')[1])
const day = (d2 - d1) / (1 * 24 * 60 * 60 * 1000) const day = (d2 - d1) / (1 * 24 * 60 * 60 * 1000)
this.$set(this.form, 'days', Number(day.toFixed(2))) this.$set(this.form, 'days', Number(day.toFixed(2)))
} }
@ -170,7 +178,8 @@ export default {
controls: true, controls: true,
controlsPosition: 'right', controlsPosition: 'right',
change: ({ value }) => { change: ({ value }) => {
this.$set(this.form, 'reason', '请假' + value + '天') if (value) this.$set(this.form, 'reason', '请假' + value + '天')
else this.$set(this.form, 'reason', '')
} }
}, },
{ {
@ -201,7 +210,8 @@ export default {
showFileList: true, showFileList: true,
multiple: true, multiple: true,
limit: 10, limit: 10,
prop: 'attachment' prop: 'attachment',
dataType: 'string'
}, },
] ]
}, },
@ -286,7 +296,10 @@ export default {
if (valid) { if (valid) {
const variables = {} const variables = {}
this.vars.forEach(v => { this.vars.forEach(v => {
if (v != 'comment' && this.form[v]) variables[v] = this.form[v] if (!this.validatenull(this.form[v])) {
variables[v] = this.form[v]
if (this.form[`$${v}`]) variables[`$${v}`] = this.form[`$${v}`]
}
}) })
this.handleCompleteTask(pass, variables).then(() => { this.handleCompleteTask(pass, variables).then(() => {

@ -53,6 +53,9 @@
</template> </template>
<script> <script>
//
// import { submit } from '@/api/plugin/workflow/demo/leave.js'
import WfExamineForm from '@/views/plugin/workflow/process/components/examForm.vue' import WfExamineForm from '@/views/plugin/workflow/process/components/examForm.vue'
import WfUserSelect from '@/views/plugin/workflow/process/components/user-select' import WfUserSelect from '@/views/plugin/workflow/process/components/user-select'
@ -69,8 +72,8 @@ export default {
handler(val) { handler(val) {
if (val) { if (val) {
const param = JSON.parse(Buffer.from(val, 'base64').toString()) const param = JSON.parse(Buffer.from(val, 'base64').toString())
const { processId } = param const { processId, processDefKey } = param
if (processId) this.getForm(processId) if (processId || processDefKey) this.getForm(processId, processDefKey)
} }
}, },
immediate: true immediate: true
@ -103,7 +106,7 @@ export default {
label: '创建部门', label: '创建部门',
span: 12, span: 12,
display: true, display: true,
prop: 'createDept', prop: 'creatorDept',
value: '${this.$store.getters.userInfo.dept_name}', value: '${this.$store.getters.userInfo.dept_name}',
readonly: true readonly: true
}, },
@ -115,6 +118,7 @@ export default {
format: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
prop: 'datetime', prop: 'datetime',
dataType: 'string',
required: true, required: true,
rules: [ rules: [
{ {
@ -126,8 +130,8 @@ export default {
if (!value || value.length == 0) { if (!value || value.length == 0) {
this.$set(this.form, 'days', undefined) this.$set(this.form, 'days', undefined)
} else { } else {
const d1 = Date.parse(value[0]) const d1 = Date.parse(value.split(',')[0])
const d2 = Date.parse(value[1]) const d2 = Date.parse(value.split(',')[1])
const day = (d2 - d1) / (1 * 24 * 60 * 60 * 1000) const day = (d2 - d1) / (1 * 24 * 60 * 60 * 1000)
this.$set(this.form, 'days', Number(day.toFixed(2))) this.$set(this.form, 'days', Number(day.toFixed(2)))
} }
@ -149,7 +153,8 @@ export default {
controls: true, controls: true,
controlsPosition: 'right', controlsPosition: 'right',
change: ({ value }) => { change: ({ value }) => {
this.$set(this.form, 'reason', '请假' + value + '天') if (value) this.$set(this.form, 'reason', '请假' + value + '天')
else this.$set(this.form, 'reason', '')
} }
}, },
{ {
@ -180,7 +185,8 @@ export default {
showFileList: true, showFileList: true,
multiple: true, multiple: true,
limit: 10, limit: 10,
prop: 'attachment' prop: 'attachment',
dataType: 'string'
}, },
] ]
}, },
@ -189,8 +195,17 @@ export default {
} }
}, },
methods: { methods: {
getForm(processId) { getForm(processId, processDefKey) {
this.getStartForm(processId).then(res => { let param
let method
if (processId) {
param = processId
method = 'getStartForm'
} else if (processDefKey) {
param = processDefKey
method = 'getStartFormByProcessDefKey'
}
this[method](param).then(res => {
let { process, startForm } = res let { process, startForm } = res
this.form.processId = process.id this.form.processId = process.id
const option = this.option const option = this.option
@ -230,6 +245,30 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
}) })
//
// let form = this.deepClone(this.form)
// form = {
// ...form,
// processDefId: form.processId,
// exFormKey: this.process.formKey,
// exFormUrl: this.process.formUrl,
// }
// submit(form).then(res => {
// const data = res.data.data
// this.form.processDefKey = this.process.key
// this.form.businessKey = data.id
// this.handleStartProcessByKey(true).then((res, done) => {
// const processInsId = res.data.data
// submit({ id: data.id, processInsId }).then(() => {
// this.$message.success("")
// this.handleCloseTag('/plugin/workflow/process/send')
// done()
// })
// }).catch(() => {
// this.loading = false
// })
// })
}, },
} }
} }

@ -24,6 +24,13 @@
<!-- 自定义表单区域 --> <!-- 自定义表单区域 -->
<!-- 自定义表单区域 --> <!-- 自定义表单区域 -->
<el-card shadow="never"
style="margin-top: 10px;"
header="流转信息"
:body-style="{padding: '20px 0'}"
v-if="isPrintShow">
<wf-flow :flow="flow"></wf-flow>
</el-card>
</div> </div>
</el-card> </el-card>
<!-- 审批意见表单 --> <!-- 审批意见表单 -->
@ -137,7 +144,10 @@ export default {
if (valid) { if (valid) {
const variables = {} const variables = {}
this.vars.forEach(v => { this.vars.forEach(v => {
if (v != 'comment' && this.form[v]) variables[v] = this.form[v] if (!this.validatenull(this.form[v])) {
variables[v] = this.form[v]
if (this.form[`$${v}`]) variables[`$${v}`] = this.form[`$${v}`]
}
}) })
this.handleCompleteTask(pass, variables).then(() => { this.handleCompleteTask(pass, variables).then(() => {

@ -23,6 +23,10 @@ export default [
label: '审核中', // 到候选人/候选组 label: '审核中', // 到候选人/候选组
value: 8 value: 8
}, },
{
label: '审核中', // 到候选人/候选组
value: 10
},
{ {
label: '审核中', // 节点被调度 label: '审核中', // 节点被调度
value: 14 value: 14

Loading…
Cancel
Save