|
|
|
|
@ -6,7 +6,7 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="steps">
|
|
|
|
|
<div class="steps" v-if="!/\/detail/.test($route.path)">
|
|
|
|
|
<el-steps :space="120" finish-status="success" align-center>
|
|
|
|
|
<el-step
|
|
|
|
|
:title="node.name"
|
|
|
|
|
@ -21,9 +21,10 @@
|
|
|
|
|
status="wait"
|
|
|
|
|
></el-step>
|
|
|
|
|
</el-steps>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<el-divider></el-divider>
|
|
|
|
|
<el-divider></el-divider>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-container">
|
|
|
|
|
<template v-if="device === 'desktop'">
|
|
|
|
|
@ -55,14 +56,101 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- 审批日志-->
|
|
|
|
|
<div v-if="/\/detail/.test($route.path)" style="margin-top: 10px">
|
|
|
|
|
<div>流转记录</div>
|
|
|
|
|
<vxe-table
|
|
|
|
|
ref="table"
|
|
|
|
|
stripe
|
|
|
|
|
keep-source
|
|
|
|
|
show-overflow
|
|
|
|
|
:column-config="{ resizable: true }"
|
|
|
|
|
:print-config="{}"
|
|
|
|
|
:export-config="{}"
|
|
|
|
|
:custom-config="{ mode: 'popup' }"
|
|
|
|
|
:data="config.logs || []"
|
|
|
|
|
>
|
|
|
|
|
<vxe-column type="seq" width="58" align="center" title="编号"/>
|
|
|
|
|
<vxe-column title="节点名称" align="center" field="node.name"></vxe-column>
|
|
|
|
|
<vxe-column title="办理状态" field="status_label"></vxe-column>
|
|
|
|
|
<vxe-column title="承办人员" field="user.name"></vxe-column>
|
|
|
|
|
<vxe-column title="流转时间" field="created_at"></vxe-column>
|
|
|
|
|
<vxe-column title="退回原因" field="reason"></vxe-column>
|
|
|
|
|
<vxe-column title="办理时间" field="updated_at"></vxe-column>
|
|
|
|
|
<vxe-column title="耗时"></vxe-column>
|
|
|
|
|
</vxe-table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="btns" ref="btns">
|
|
|
|
|
<el-button type="primary" size="small" @click="submit('assign')"
|
|
|
|
|
<template v-if="!/\/detail/.test($route.path)">
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="$route.query.flow_id"
|
|
|
|
|
icon="el-icon-arrow-left"
|
|
|
|
|
type="danger"
|
|
|
|
|
size="small"
|
|
|
|
|
@click=""
|
|
|
|
|
>退回</el-button
|
|
|
|
|
>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="$route.query.flow_id"
|
|
|
|
|
icon="el-icon-caret-right"
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
size="small"
|
|
|
|
|
@click=""
|
|
|
|
|
>部门内转办</el-button
|
|
|
|
|
>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="$route.query.flow_id"
|
|
|
|
|
icon="el-icon-document-add"
|
|
|
|
|
type="info"
|
|
|
|
|
size="small"
|
|
|
|
|
@click="submit('only-submit')"
|
|
|
|
|
>暂存不流转</el-button
|
|
|
|
|
>
|
|
|
|
|
<el-button type="primary" size="small" @click="submit('assign')"
|
|
|
|
|
>保存并流转 <i class="el-icon-right"></i
|
|
|
|
|
></el-button>
|
|
|
|
|
></el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="!$route.query.flow_id"
|
|
|
|
|
type="info"
|
|
|
|
|
size="small"
|
|
|
|
|
@click="$router.go(-1)"
|
|
|
|
|
>返回</el-button
|
|
|
|
|
>
|
|
|
|
|
</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
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
<assign ref="assign" :visible.sync="isShowAssign" :config="config" :result="result"></assign>
|
|
|
|
|
<assign
|
|
|
|
|
ref="assign"
|
|
|
|
|
:visible.sync="isShowAssign"
|
|
|
|
|
:config="config"
|
|
|
|
|
:result="result"
|
|
|
|
|
></assign>
|
|
|
|
|
|
|
|
|
|
<el-backtop></el-backtop>
|
|
|
|
|
</div>
|
|
|
|
|
@ -72,7 +160,7 @@
|
|
|
|
|
import DesktopForm from "./DesktopForm.vue";
|
|
|
|
|
import MobileForm from "./MobileForm.vue";
|
|
|
|
|
import assign from "./components/assign.vue";
|
|
|
|
|
import {create, fieldConfig, preConfig,} from "@/api/flow";
|
|
|
|
|
import { create, deal, fieldConfig, preConfig, preDeal, view } from "@/api/flow";
|
|
|
|
|
import { deepCopy } from "@/utils";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
@ -118,76 +206,183 @@ export default {
|
|
|
|
|
spinner: "el-icon-loading",
|
|
|
|
|
background: "rgba(0, 0, 0, 0.8)",
|
|
|
|
|
});
|
|
|
|
|
try {
|
|
|
|
|
const res = await preConfig(this.$route.query.module_id);
|
|
|
|
|
const { fields } = res?.customModel;
|
|
|
|
|
let subFormRequest = [];
|
|
|
|
|
const getSubForm = (id) => {
|
|
|
|
|
subFormRequest.push(fieldConfig(id));
|
|
|
|
|
};
|
|
|
|
|
fields.forEach((field) => {
|
|
|
|
|
if (field.sub_custom_model_id) {
|
|
|
|
|
getSubForm(field.sub_custom_model_id);
|
|
|
|
|
//路由为detail为详情
|
|
|
|
|
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)
|
|
|
|
|
const { fields } = res?.customModel;
|
|
|
|
|
let subFormRequest = [];
|
|
|
|
|
const getSubForm = (id) => {
|
|
|
|
|
subFormRequest.push(fieldConfig(id));
|
|
|
|
|
};
|
|
|
|
|
fields.forEach((field) => {
|
|
|
|
|
if (field.sub_custom_model_id) {
|
|
|
|
|
getSubForm(field.sub_custom_model_id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const subConfigs = await Promise.all(subFormRequest);
|
|
|
|
|
subConfigs.forEach((sub) => {
|
|
|
|
|
if (sub.customModel?.id) {
|
|
|
|
|
this.subConfig.set(sub.customModel?.id, sub);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.config = res;
|
|
|
|
|
this.generateForm(this.form, fields);
|
|
|
|
|
this.form = Object.assign({}, this.form);
|
|
|
|
|
const { data } = res?.flow;
|
|
|
|
|
for (let key in data) {
|
|
|
|
|
try {
|
|
|
|
|
let jsonObj = JSON.parse(data[key]);
|
|
|
|
|
if (this.form.hasOwnProperty(key)) {
|
|
|
|
|
this.form[key] = jsonObj;
|
|
|
|
|
}
|
|
|
|
|
if (this.fileList.hasOwnProperty(key)) {
|
|
|
|
|
this.fileList[key] = jsonObj.map((i) => ({
|
|
|
|
|
name: i.name,
|
|
|
|
|
url: i.url,
|
|
|
|
|
response: i,
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
if (this.form.hasOwnProperty(key)) {
|
|
|
|
|
this.form[key] = data[key];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const subConfigs = await Promise.all(subFormRequest);
|
|
|
|
|
subConfigs.forEach((sub) => {
|
|
|
|
|
if (sub.customModel?.id) {
|
|
|
|
|
this.subConfig.set(sub.customModel?.id, sub);
|
|
|
|
|
this.fileList = Object.assign({}, this.fileList);
|
|
|
|
|
loading.close();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err);
|
|
|
|
|
this.$message.error("配置失败");
|
|
|
|
|
loading.close();
|
|
|
|
|
}
|
|
|
|
|
} else if (!this.$route.query.flow_id) {
|
|
|
|
|
try {
|
|
|
|
|
const res = await preConfig(this.$route.query.module_id);
|
|
|
|
|
const { fields } = res?.customModel;
|
|
|
|
|
let subFormRequest = [];
|
|
|
|
|
const getSubForm = (id) => {
|
|
|
|
|
subFormRequest.push(fieldConfig(id));
|
|
|
|
|
};
|
|
|
|
|
fields.forEach((field) => {
|
|
|
|
|
if (field.sub_custom_model_id) {
|
|
|
|
|
getSubForm(field.sub_custom_model_id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const subConfigs = await Promise.all(subFormRequest);
|
|
|
|
|
subConfigs.forEach((sub) => {
|
|
|
|
|
if (sub.customModel?.id) {
|
|
|
|
|
this.subConfig.set(sub.customModel?.id, sub);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.config = res;
|
|
|
|
|
this.generateForm(this.form, fields);
|
|
|
|
|
this.form = Object.assign({}, this.form);
|
|
|
|
|
loading.close();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err);
|
|
|
|
|
this.$message.error("配置失败");
|
|
|
|
|
loading.close();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
const res = await preDeal(this.$route.query.flow_id);
|
|
|
|
|
const { fields } = res?.customModel;
|
|
|
|
|
let subFormRequest = [];
|
|
|
|
|
const getSubForm = (id) => {
|
|
|
|
|
subFormRequest.push(fieldConfig(id));
|
|
|
|
|
};
|
|
|
|
|
fields.forEach((field) => {
|
|
|
|
|
if (field.sub_custom_model_id) {
|
|
|
|
|
getSubForm(field.sub_custom_model_id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const subConfigs = await Promise.all(subFormRequest);
|
|
|
|
|
subConfigs.forEach((sub) => {
|
|
|
|
|
if (sub.customModel?.id) {
|
|
|
|
|
this.subConfig.set(sub.customModel?.id, sub);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.config = res;
|
|
|
|
|
this.generateForm(this.form, fields);
|
|
|
|
|
this.form = Object.assign({}, this.form);
|
|
|
|
|
const { data } = res?.flow;
|
|
|
|
|
for (let key in data) {
|
|
|
|
|
try {
|
|
|
|
|
let jsonObj = JSON.parse(data[key]);
|
|
|
|
|
if (this.form.hasOwnProperty(key)) {
|
|
|
|
|
this.form[key] = jsonObj;
|
|
|
|
|
}
|
|
|
|
|
if (this.fileList.hasOwnProperty(key)) {
|
|
|
|
|
this.fileList[key] = jsonObj.map((i) => ({
|
|
|
|
|
name: i.name,
|
|
|
|
|
url: i.url,
|
|
|
|
|
response: i,
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
if (this.form.hasOwnProperty(key)) {
|
|
|
|
|
this.form[key] = data[key];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.config = res;
|
|
|
|
|
this.generateForm(this.form, fields);
|
|
|
|
|
this.form = Object.assign({}, this.form);
|
|
|
|
|
loading.close();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err);
|
|
|
|
|
this.$message.error("配置失败");
|
|
|
|
|
loading.close();
|
|
|
|
|
this.fileList = Object.assign({}, this.fileList);
|
|
|
|
|
loading.close();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err);
|
|
|
|
|
this.$message.error("配置失败");
|
|
|
|
|
loading.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async submit(type) {
|
|
|
|
|
let copyForm,copyFile;
|
|
|
|
|
if (this.device === "desktop") {
|
|
|
|
|
console.log(this.$refs["desktopForm"].form);
|
|
|
|
|
let copyForm = deepCopy(this.$refs["desktopForm"].form);
|
|
|
|
|
let copyFile = deepCopy(this.$refs["desktopForm"].file);
|
|
|
|
|
for (let [key, value] of Object.entries(copyFile)) {
|
|
|
|
|
if (copyForm.hasOwnProperty(key)) {
|
|
|
|
|
copyForm[key] = value.map((i) => i.response?.id)?.toString();
|
|
|
|
|
}
|
|
|
|
|
copyForm = deepCopy(this.$refs["desktopForm"].form);
|
|
|
|
|
copyFile = deepCopy(this.$refs["desktopForm"].file);
|
|
|
|
|
} else {
|
|
|
|
|
copyForm = deepCopy(this.$refs["mobileForm"].form);
|
|
|
|
|
copyFile = deepCopy(this.$refs["mobileForm"].file);
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
// for (let key in copyForm) {
|
|
|
|
|
// if(copyForm[key] instanceof Array && copyForm[key][0]) {
|
|
|
|
|
// let formatObj = {}
|
|
|
|
|
// let subKeys = Object.keys(copyForm[key][0])
|
|
|
|
|
// subKeys.forEach(key => {
|
|
|
|
|
// formatObj[key] = []
|
|
|
|
|
// })
|
|
|
|
|
// copyForm[key].forEach(item => {
|
|
|
|
|
// subKeys.forEach(subKey => {
|
|
|
|
|
// formatObj[subKey].push(item[subKey])
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// delete formatObj['_X_ROW_KEY']
|
|
|
|
|
// copyForm[key] = formatObj
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
copyForm["current_node_id"] = this.config.currentNode.id;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
this.result = await create(copyForm, this.$route.query.module_id);
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "only-submit":
|
|
|
|
|
this.$router.push("/flow/list");
|
|
|
|
|
break;
|
|
|
|
|
case "assign":
|
|
|
|
|
this.isShowAssign = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err);
|
|
|
|
|
try {
|
|
|
|
|
let callback;
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "only-submit":
|
|
|
|
|
if (this.$route.query.flow_id) {
|
|
|
|
|
copyForm["temporary_save"] = 1;
|
|
|
|
|
}
|
|
|
|
|
callback = () => this.$router.push("/flow/list/todo");
|
|
|
|
|
break;
|
|
|
|
|
case "assign":
|
|
|
|
|
if (this.$route.query.flow_id) {
|
|
|
|
|
copyForm["temporary_save"] = 0;
|
|
|
|
|
}
|
|
|
|
|
callback = () => (this.isShowAssign = true);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (this.$route.query.flow_id) {
|
|
|
|
|
copyForm.id = this.$route.query.flow_id;
|
|
|
|
|
const { flow, is_last_handled_log } = await deal(
|
|
|
|
|
this.$route.query.flow_id,
|
|
|
|
|
copyForm
|
|
|
|
|
);
|
|
|
|
|
this.result = flow;
|
|
|
|
|
} else {
|
|
|
|
|
this.result = await create(this.$route.query.module_id, copyForm);
|
|
|
|
|
}
|
|
|
|
|
callback();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
@ -199,7 +394,7 @@ export default {
|
|
|
|
|
return this.config?.customModel?.fields || [];
|
|
|
|
|
},
|
|
|
|
|
readableFields() {
|
|
|
|
|
return 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 || [];
|
|
|
|
|
@ -208,7 +403,9 @@ export default {
|
|
|
|
|
return this.config?.currentNode || {};
|
|
|
|
|
},
|
|
|
|
|
scriptContent() {
|
|
|
|
|
if (this.config?.customModel?.js) {
|
|
|
|
|
if (this.config?.customModel?.view_js && this.$route.query.flow_id) {
|
|
|
|
|
return this.config?.customModel?.view_js;
|
|
|
|
|
} else if (this.config?.customModel?.js && !this.$route.query.flow_id) {
|
|
|
|
|
return this.config?.customModel?.js;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -230,9 +427,12 @@ export default {
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
.btns {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
position: sticky;
|
|
|
|
|
bottom: 20px;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.form-container {
|
|
|
|
|
|