xy 1 year ago
parent ad0cf1347b
commit 9b8c7d262c

@ -12,11 +12,9 @@
:collapse-transition="false"
mode="vertical"
>
<sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />
<sidebar-item v-for="route in permission_routes" :key="route.key" :item="route" :base-path="route.path" />
</el-menu>
</el-scrollbar>
<!-- <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />-->
</div>
</template>

@ -155,8 +155,8 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
formItem = h(formBuilderMap(device).get(info.type), {
props: {
type: "datetime",
"value-format": "yyyy-MM-dd",
format: "yyyy年MM月dd日",
"value-format": "yyyy-MM-dd HH:mm:ss",
format: "yyyy-MM-dd HH:mm",
value: row ? row[info.name] : this.form[info.name],
clearable: true,
placeholder: info.help_text,
@ -1090,6 +1090,9 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
formItem = h(
"van-cell",
{
attrs: {
for: info.name
},
props: {
title: info.label,
value: this.form[info.name] ? moment(this.form[info.name]).format("YYYY年MM月DD日") : ''
@ -1101,6 +1104,9 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
formItem = h(
"van-cell",
{
attrs: {
for: info.name
},
props: {
title: info.label,
value: this.form[info.name] ? moment(this.form[info.name]).format("YYYY年MM月DD日 HH时mm分ss秒") : ''
@ -1117,6 +1123,9 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
formItem = h(
"van-cell",
{
attrs: {
for: info.name
},
props: {
title: info.label,
value: typeof findValue === "object" ? findValue.name : findValue
@ -1128,6 +1137,9 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
formItem = h(
"van-cell",
{
attrs: {
for: info.name
},
props: {
title: info.label,
}
@ -1208,6 +1220,9 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
break;
default:
formItem = h('van-cell',{
attrs: {
for: info.name
},
props: {
title: info.label,
value: row ? row[info.name] : this.form[info.name]

@ -0,0 +1,41 @@
import store from '@/store'
/**
* @param{string} printJs 打印模版
* @param{boolean} isLog 是否带审批
* @param{string} logContent 审批表格html
* @return{void}
**/
export function print(printJs, isLog, logContent) {
let printStr = printJs
const regexField = /<field[^>]*>(.*?)<\/field>/g;
let fieldMaths = []
let match;
while ((match = regexField.exec(printJs)) !== null) {
fieldMaths.push(match[0]); // 提取 <field> 之间的内容
}
fieldMaths.forEach(fieldMath => {
const matchName = fieldMath.match(/name="([^"]+)"/);
if (matchName) {
const nameValue = matchName[1];
const value = store.getters.device === 'desktop' ? document.querySelector(`[for=${nameValue}]+div`).innerHTML : document.querySelector(`[for=${nameValue}] > div:nth-child(2)`).innerHTML
printStr = printStr.replace(fieldMath,`<span>${value}</span>`)
} else {
console.log('未找到name属性');
}
})
if(isLog) {
const logStyle = logContent.match(/<style>(.*?)<\/style>/g)
let totalLogStyle= ''
logStyle.forEach(item => {
totalLogStyle += item
})
printStr = printStr.replace('</style>',`</style>${totalLogStyle}`)
const logBody = logContent.match(/<table(.*?)<\/table>/g)[0]
printStr = printStr.replace('</table>',`</talbe>${logBody}`)
}
let printWindow = window.open('', '_blank');
printWindow.document.write(printStr);
printWindow.focus();
}

@ -1,12 +1,14 @@
<template>
<div class="container">
<el-card :shadow="device === 'desktop' ? 'always' : 'never'"
<el-card
:shadow="device === 'desktop' ? 'always' : 'never'"
class="card"
:style="{
border: device === 'desktop' ? '' : 'none',
background: device === 'desktop' ? '' : '#f7f8fa',
'min-height': device === 'desktop' ? '' : '100vh',
}">
}"
>
<template #header>
<p>{{ config.customModel ? config.customModel.name : "办理" }}</p>
</template>
@ -29,10 +31,9 @@
</el-steps>
<el-divider></el-divider>
</div>
<div class="form-container">
<div class="form-container" id="print-content">
<template v-if="device === 'desktop'">
<DesktopForm
:device="device"
@ -63,10 +64,11 @@
</div>
</template>
<!-- 审批日志-->
<!-- 审批日志-->
<div v-if="/\/detail/.test($route.path)" style="margin-top: 10px">
<div>流转记录</div>
<vxe-table
style="margin-top: 10px;"
show-footer
ref="table"
stripe
@ -80,9 +82,27 @@
:footer-data="footerData"
:data="config.logs || []"
>
<vxe-column type="seq" width="62" align="center" field="seq" title="编号"/>
<vxe-column width="140" title="节点名称" align="center" field="node.name" :formatter="({ cellValue }) => (cellValue || '节点已调整')"></vxe-column>
<vxe-column width="80" align="center" title="办理状态" field="status" :formatter="({ cellValue }) => (myStatus.get(cellValue))">
<vxe-column
type="seq"
width="62"
align="center"
field="seq"
title="编号"
/>
<vxe-column
width="140"
title="节点名称"
align="center"
field="node.name"
:formatter="({ cellValue }) => cellValue || '节点已调整'"
></vxe-column>
<vxe-column
width="80"
align="center"
title="办理状态"
field="status"
:formatter="({ cellValue }) => myStatus.get(cellValue)"
>
<template #default="{ row }">
<el-tag
size="mini"
@ -92,12 +112,50 @@
>
</template>
</vxe-column>
<vxe-column align="center" width="80" title="承办人员" field="user.name"></vxe-column>
<vxe-column align="center" width="200" title="流转时间" field="created_at" :formatter="({ cellValue }) => $moment(cellValue).format('YYYY年MM月DD日 HH:mm:ss')"></vxe-column>
<vxe-column min-width="200" header-align="center" title="退回原因" field="reason"></vxe-column>
<vxe-column align="center" width="200" title="办理时间" field="updated_at">
<vxe-column
align="center"
width="80"
title="承办人员"
field="user.name"
></vxe-column>
<vxe-column
align="center"
width="200"
title="流转时间"
field="created_at"
:formatter="
({ cellValue }) =>
$moment(cellValue).format('YYYY年MM月DD日 HH:mm:ss')
"
></vxe-column>
<vxe-column
min-width="200"
header-align="center"
title="退回原因"
field="reason"
></vxe-column>
<vxe-column
align="center"
width="200"
title="办理时间"
field="updated_at"
>
<template #default="{ row }">
<span :style="{ 'color': (row.deadline && row.updated_at && $moment(row.updated_at).isAfter($moment(row.deadline).endOf('day')) ? 'red' : '') }">{{ $moment(row.updated_at).format('YYYY年MM月DD日 HH:mm:ss') }}</span>
<span
:style="{
color:
row.deadline &&
row.updated_at &&
$moment(row.updated_at).isAfter(
$moment(row.deadline).endOf('day')
)
? 'red'
: '',
}"
>{{
$moment(row.updated_at).format("YYYY年MM月DD日 HH:mm:ss")
}}</span
>
</template>
</vxe-column>
<vxe-column align="center" title="耗时" field="use_time" width="120">
@ -147,27 +205,10 @@
>
</template>
<template v-else>
<el-button
plain
size="small"
@click="$router.go(-1)"
>返回</el-button
>
<el-button
plain
size="small"
>打印</el-button
>
<el-button
plain
size="small"
>打印(带审批记录)</el-button
>
<el-button
plain
size="small"
>下载附件</el-button
>
<el-button plain size="small" @click="$router.go(-1)"></el-button>
<el-button plain size="small" @click="print(false)"></el-button>
<el-button plain size="small" @click="print(true)">()</el-button>
<el-button plain size="small">下载附件</el-button>
</template>
</div>
</el-card>
@ -182,11 +223,14 @@
<forward
ref="forward"
:is-show.sync="isShowForward"
:flow="config.flow"></forward>
:flow="config.flow"
></forward>
<rollback ref="rollback"
<rollback
ref="rollback"
:is-show.sync="isShowRollback"
:flow="config.flow"></rollback>
:flow="config.flow"
></rollback>
<el-backtop></el-backtop>
</div>
@ -198,10 +242,17 @@ import MobileForm from "./MobileForm.vue";
import assign from "./components/assign.vue";
import forward from "./components/forward.vue";
import rollback from "./components/rollback.vue";
import { create, deal, fieldConfig, preConfig, preDeal, view } from "@/api/flow";
import {
create,
deal,
fieldConfig,
preConfig,
preDeal,
view,
} from "@/api/flow";
import { deepCopy } from "@/utils";
import { validation, validationName } from "@/utils/validate";
import { print } from "@/utils/print";
export default {
components: {
DesktopForm,
@ -219,8 +270,8 @@ export default {
config: {},
subConfig: new Map(),
myStatus: new Map([
[-2,'会签退回'],
[-1,'退回'],
[-2, "会签退回"],
[-1, "退回"],
[0, "办理中"],
[1, "已完成"],
]),
@ -234,31 +285,51 @@ export default {
form: {},
result: {},
fileList: {},
rules: {}
rules: {},
};
},
methods: {
async print(isLog=false) {
if(isLog) {
const res = await this.$refs['table'].exportData({
type: 'html',
download: false
})
print(this.config.customModel.print_format, isLog, res.content)
} else {
print(this.config.customModel.print_format, isLog)
}
},
generateForm(object, fields) {
this.rules = {}
this.rules = {};
fields.forEach((field) => {
if(field.rules && field.rules.length > 0) {
this.rules[field.name] = field.rules.map(rule => {
if (field.rules && field.rules.length > 0) {
this.rules[field.name] = field.rules.map((rule) => {
switch (rule) {
case 'required':
return { required: true, message: `请填写${field.label}`, trigger: 'blur' }
case "required":
return {
required: true,
message: `请填写${field.label}`,
trigger: "blur",
};
default:
return {
validator: (myRule, value, callback) => {
if(validation.get(rule).test(value)) {
callback()
if (validation.get(rule).test(value)) {
callback();
} else {
callback(new Error(`${field.label}必须为${validationName.get(rule)}`))
callback(
new Error(
`${field.label}必须为${validationName.get(rule)}`
)
);
}
},
trigger: 'blur'
}
trigger: "blur",
};
}
})
});
}
if (field.type === "file") {
this.fileList[field.name] = [];
@ -280,7 +351,9 @@ export default {
const hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60));
const seconds = (time % (1000 * 60)) / 1000;
return `${days > 0 ? (days) + '天' : ''}${hours > 0 ? (hours) + '时' : ''}${minutes}${seconds}`;
return `${days > 0 ? days + "天" : ""}${
hours > 0 ? hours + "时" : ""
}${minutes}分${seconds}`;
},
async getConfig() {
@ -291,10 +364,10 @@ export default {
background: "rgba(0, 0, 0, 0.8)",
});
//detail
if(/\/detail/.test(this.$route.path) && this.$route.query.flow_id) {
if (/\/detail/.test(this.$route.path) && this.$route.query.flow_id) {
try {
const res = await view(this.$route.query.flow_id);
console.log('view',res)
console.log("view", res);
const { fields } = res?.customModel;
let subFormRequest = [];
const getSubForm = (id) => {
@ -422,7 +495,7 @@ export default {
},
async submit(type) {
let copyForm,copyFile;
let copyForm, copyFile;
if (this.device === "desktop") {
copyForm = deepCopy(this.$refs["desktopForm"].form);
copyFile = deepCopy(this.$refs["desktopForm"].file);
@ -430,7 +503,7 @@ export default {
copyForm = deepCopy(this.$refs["mobileForm"].form);
copyFile = deepCopy(this.$refs["mobileForm"].file);
}
console.log(copyForm,copyFile)
console.log(copyForm, copyFile);
for (let [key, value] of Object.entries(copyFile)) {
if (copyForm.hasOwnProperty(key)) {
copyForm[key] = value.map((i) => i.response?.id)?.toString();
@ -455,7 +528,7 @@ export default {
break;
}
if (this.device === "desktop") {
if(!await this.$refs['desktopForm'].validate()) return
if (!(await this.$refs["desktopForm"].validate())) return;
}
if (this.$route.query.flow_id) {
copyForm.id = this.$route.query.flow_id;
@ -464,10 +537,14 @@ export default {
copyForm
);
this.result = flow;
if(!is_last_handled_log) {
await this.$alert('办理成功,其他会签办理完成后,由最后办理的成员流转到下一节点。','提示',{
if (!is_last_handled_log) {
await this.$alert(
"办理成功,其他会签办理完成后,由最后办理的成员流转到下一节点。",
"提示",
{
showClose: false,
})
}
);
callback = () => this.$router.push("/flow/list/todo");
}
} else {
@ -487,7 +564,9 @@ export default {
return this.config?.customModel?.fields || [];
},
readableFields() {
return /\/detail/.test(this.$route.path) ? this.fields?.map(i => i.id) : (this.config?.currentNode?.readable || []);
return /\/detail/.test(this.$route.path)
? this.fields?.map((i) => i.id)
: this.config?.currentNode?.readable || [];
},
writeableFields() {
return this.config?.currentNode?.writeable || [];
@ -503,19 +582,21 @@ export default {
}
},
diffTime() {
return function (end,start) {
const diff = this.$moment(end).diff(this.$moment(start))
return this.formatTime(diff)
}
return function (end, start) {
const diff = this.$moment(end).diff(this.$moment(start));
return this.formatTime(diff);
};
},
footerData() {
const diff = this.$moment(this.config?.logs?.at(-1)?.updated_at).diff(this.$moment(this.config?.logs?.at(0)?.created_at));
const diff = this.$moment(this.config?.logs?.at(-1)?.updated_at).diff(
this.$moment(this.config?.logs?.at(0)?.created_at)
);
return [
{
seq: "总耗时",
'use_time': this.formatTime(diff),
}
]
use_time: this.formatTime(diff),
},
];
},
},
created() {

Loading…
Cancel
Save