master
xy 2 years ago
parent 256236fe26
commit a4594e8387

@ -32,18 +32,20 @@ if (process.env.NODE_ENV === 'production') {
//Vue.use(ElementUI, { locale }) //Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui按如下方式声明 // 如果想要中文版 element-ui按如下方式声明
Vue.use(ElementUI) Vue.use(ElementUI)
import { VxeButton, VxeIcon, VxeTable, VxeColumn, VxeColgroup, VxeModal, VxeToolbar, VxeTableEditModule, VxeTableValidatorModule, VxeTableExportModule } from "vxe-table"; import VxeTable from 'vxe-table'
//import { VxeButton, VxeIcon, VxeTable, VxeColumn, VxeColgroup, VxeModal, VxeToolbar, VxeTableEditModule, VxeTableValidatorModule, VxeTableExportModule } from "vxe-table";
import "vxe-table/styles/index.scss" import "vxe-table/styles/index.scss"
Vue.use(VxeTableEditModule); Vue.use(VxeTable)
Vue.use(VxeTableValidatorModule); // Vue.use(VxeTableEditModule);
Vue.use(VxeTableExportModule); // Vue.use(VxeTableValidatorModule);
Vue.use(VxeIcon); // Vue.use(VxeTableExportModule);
Vue.use(VxeTable); // Vue.use(VxeIcon);
Vue.use(VxeColumn); // Vue.use(VxeTable);
Vue.use(VxeColgroup); // Vue.use(VxeColumn);
Vue.use(VxeModal); // Vue.use(VxeColgroup);
Vue.use(VxeToolbar); // Vue.use(VxeModal);
Vue.use(VxeButton); // Vue.use(VxeToolbar);
// Vue.use(VxeButton);
Vue.config.productionTip = false Vue.config.productionTip = false

@ -0,0 +1,130 @@
<template>
<div>
<el-dialog
:title="title"
:visible.sync="visible"
fullscreen
append-to-body
:show-close="false"
>
<div>
<div class="steps">
<el-steps :space="120" finish-status="success" align-center>
<el-step
:title="node.name"
status="finish"
icon="el-icon-edit"
></el-step>
<el-step
title="流转到下一节点"
icon="el-icon-right"
status="wait"
></el-step>
</el-steps>
</div>
<el-divider></el-divider>
<div class="next-nodes">
<div class="next-nodes__label">下一节点</div>
<div>
<el-radio-group v-model="form.next_node_id">
<el-radio v-for="node in node.nextNodes" :label="node.id">{{ node.name }}</el-radio>
</el-radio-group>
</div>
</div>
<el-divider></el-divider>
<div class="users">
<div class="users__label">承办人员</div>
<div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="$emit('update:visible',false)"
> </el-button
>
</span>
</el-dialog>
</div>
</template>
<script>
import { getNextNodeUsers } from "@/api/flow";
export default {
props: {
visible: {
type: Boolean,
default: false,
required: true
},
config: Object,
result: {
type: Object,
required: true
}
},
data() {
return {
form: {
cc_users: [],
user_id: "",
next_node_id: "",
},
node2Users: new Map()
};
},
methods: {
async getNextNodesUsers() {
try {
const res = await Promise.all(this.node?.nextNodes?.map(node => getNextNodeUsers({
id: this.result.id,
next_node_id: node.id,
},false)));
console.log(res)
} catch (err) {
console.error(err)
}
}
},
computed: {
title() {
return this.config?.customModel?.name + '流转'
},
node() {
return this.config?.currentNode || {};
},
},
watch: {
node: {
handler:function (newVal) {
if(newVal && newVal.nextNodes && newVal.nextNodes?.length > 0) {
this.getNextNodesUsers()
}
}
},
immediate: true
},
created() {}
};
</script>
<style scoped lang="scss">
.next-nodes,.users {
display: flex;
&__label {
flex-basis: 100px;
font-weight: 600;
color: #666;
}
}
</style>

@ -2,18 +2,24 @@
<div class="container"> <div class="container">
<el-card shadow="always" class="card"> <el-card shadow="always" class="card">
<template #header> <template #header>
<p>{{ config.customModel ? config.customModel.name : '办理' }}</p> <p>{{ config.customModel ? config.customModel.name : "办理" }}</p>
</template> </template>
<template> <template>
<div class="steps"> <div class="steps">
<el-steps :space="120" finish-status="success" align-center> <el-steps :space="120" finish-status="success" align-center>
<el-step :title="node.name" status="finish" icon="el-icon-edit"></el-step> <el-step
<el-step v-for="nextNode in node.nextNodes" :title="node.name"
:key="nextNode.id" status="finish"
:title="nextNode.name" icon="el-icon-edit"
icon="el-icon-right" ></el-step>
status="wait"></el-step> <el-step
v-for="nextNode in node.nextNodes"
:key="nextNode.id"
:title="nextNode.name"
icon="el-icon-right"
status="wait"
></el-step>
</el-steps> </el-steps>
</div> </div>
@ -21,36 +27,43 @@
<div class="form-container"> <div class="form-container">
<template v-if="device === 'desktop'"> <template v-if="device === 'desktop'">
<DesktopForm :device="device" <DesktopForm
ref="desktopForm" :device="device"
:sub-form="subConfig" ref="desktopForm"
:fields="fields" :sub-form="subConfig"
:original-form="form" :fields="fields"
:readable="readableFields" :original-form="form"
:file-list="fileList" :readable="readableFields"
:script-content="scriptContent" :file-list="fileList"
:writeable="writeableFields"></DesktopForm> :script-content="scriptContent"
:writeable="writeableFields"
></DesktopForm>
</template> </template>
<template v-else> <template v-else>
<MobileForm :device="device" <MobileForm
ref="mobileForm" :device="device"
:sub-form="subConfig" ref="mobileForm"
:fields="fields" :sub-form="subConfig"
:original-form="form" :fields="fields"
:readable="readableFields" :original-form="form"
:file-list="fileList" :readable="readableFields"
:script-content="scriptContent" :file-list="fileList"
:writeable="writeableFields"></MobileForm> :script-content="scriptContent"
:writeable="writeableFields"
></MobileForm>
</template> </template>
</div> </div>
</template> </template>
<div class="btns" ref="btns"> <div class="btns" ref="btns">
<el-button type="primary" size="small" @click="submit"> <i class="el-icon-right"></i></el-button> <el-button type="primary" size="small" @click="submit('assign')"
>保存并流转 <i class="el-icon-right"></i
></el-button>
</div> </div>
</el-card> </el-card>
<assign ref="assign" :visible.sync="isShowAssign" :config="config"></assign>
<el-backtop></el-backtop> <el-backtop></el-backtop>
</div> </div>
</template> </template>
@ -58,82 +71,90 @@
<script> <script>
import DesktopForm from "./DesktopForm.vue"; import DesktopForm from "./DesktopForm.vue";
import MobileForm from "./MobileForm.vue"; import MobileForm from "./MobileForm.vue";
import { preConfig, preDeal, create, fieldConfig, getNextNodeUsers, checkIsThroughNode } from "@/api/flow" import assign from "./components/assign.vue";
import { deepCopy } from "@/utils"; import {create, fieldConfig, preConfig,} from "@/api/flow";
import {deepCopy} from "@/utils";
export default { export default {
components: { components: {
DesktopForm, DesktopForm,
MobileForm MobileForm,
assign,
}, },
data() { data() {
return { return {
isShowAssign: false,
info: [], info: [],
config: {}, config: {},
subConfig: new Map(), subConfig: new Map(),
form: {}, form: {},
fileList: {} result: {},
} fileList: {},
};
}, },
methods: { methods: {
generateForm(object,fields) { generateForm(object, fields) {
fields.forEach(field => { fields.forEach((field) => {
if(field.type === 'file') { if (field.type === "file") {
this.fileList[field.name] = [] this.fileList[field.name] = [];
} }
if(field.type === 'relation') { if (field.type === "relation") {
object[field.name] = [{}] object[field.name] = [{}];
this.generateForm(object[field.name][0], this.subConfig.get(field.sub_custom_model_id)?.customModel?.fields) this.generateForm(
object[field.name][0],
this.subConfig.get(field.sub_custom_model_id)?.customModel?.fields
);
} else { } else {
object[field.name] = "" object[field.name] = "";
} }
}) });
}, },
async getConfig() { async getConfig() {
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: '拼命加载中', text: "拼命加载中",
spinner: 'el-icon-loading', spinner: "el-icon-loading",
background: 'rgba(0, 0, 0, 0.8)' background: "rgba(0, 0, 0, 0.8)",
}); });
try { try {
const res = await preConfig(this.$route.query.module_id) const res = await preConfig(this.$route.query.module_id);
const { fields } = res?.customModel; const { fields } = res?.customModel;
let subFormRequest = [] let subFormRequest = [];
const getSubForm = (id) => { const getSubForm = (id) => {
subFormRequest.push(fieldConfig(id)) subFormRequest.push(fieldConfig(id));
} };
fields.forEach(field => { fields.forEach((field) => {
if(field.sub_custom_model_id) { if (field.sub_custom_model_id) {
getSubForm(field.sub_custom_model_id) getSubForm(field.sub_custom_model_id);
} }
}) });
const subConfigs = await Promise.all(subFormRequest) const subConfigs = await Promise.all(subFormRequest);
subConfigs.forEach(sub => { subConfigs.forEach((sub) => {
if(sub.customModel?.id) { if (sub.customModel?.id) {
this.subConfig.set(sub.customModel?.id, sub) this.subConfig.set(sub.customModel?.id, sub);
} }
}) });
this.config = res; this.config = res;
this.generateForm(this.form, fields) this.generateForm(this.form, fields);
this.form = Object.assign({},this.form) this.form = Object.assign({}, this.form);
loading.close() loading.close();
} catch (err) { } catch (err) {
console.error(err) console.error(err);
this.$message.error("配置失败") this.$message.error("配置失败");
loading.close() loading.close();
} }
}, },
async submit() { async submit(type) {
if(this.device === 'desktop') { if (this.device === "desktop") {
console.log(this.$refs['desktopForm'].form) console.log(this.$refs["desktopForm"].form);
let copyForm = deepCopy(this.$refs['desktopForm'].form) let copyForm = deepCopy(this.$refs["desktopForm"].form);
let copyFile = deepCopy(this.$refs['desktopForm'].file) let copyFile = deepCopy(this.$refs["desktopForm"].file);
for (let [key, value] of Object.entries(copyFile)) { for (let [key, value] of Object.entries(copyFile)) {
if (copyForm.hasOwnProperty(key)) { if (copyForm.hasOwnProperty(key)) {
copyForm[key] = value.map(i => i.response?.id)?.toString() copyForm[key] = value.map((i) => i.response?.id)?.toString();
} }
} }
// for (let key in copyForm) { // for (let key in copyForm) {
@ -155,50 +176,56 @@ export default {
// } // }
try { try {
const res = await create(copyForm,this.$route.query.module_id) this.result = await create(copyForm, this.$route.query.module_id);
await getNextNodeUsers({ switch (type) {
id: res.id, case "only-submit":
next_node_id: this.config?.currentNode?.nextNodes[0]?.id this.$router.push("/flow/list");
}) break;
} catch(err) { case "assign":
console.error(err) this.isShowAssign = true;
// await getNextNodeUsers({
// id: res.id,
// next_node_id: this.config?.currentNode?.nextNodes[0]?.id,
// });
break;
}
} catch (err) {
console.error(err);
} }
} }
} },
}, },
computed: { computed: {
device() { device() {
return this.$store.state.app.device return this.$store.state.app.device;
}, },
fields() { fields() {
return this.config?.customModel?.fields || [] return this.config?.customModel?.fields || [];
}, },
readableFields() { readableFields() {
return this.config?.currentNode?.readable || [] return this.config?.currentNode?.readable || [];
}, },
writeableFields() { writeableFields() {
return this.config?.currentNode?.writeable || [] return this.config?.currentNode?.writeable || [];
}, },
node() { node() {
return this.config?.currentNode || {} return this.config?.currentNode || {};
}, },
scriptContent() { scriptContent() {
if(this.config?.customModel?.js) { if (this.config?.customModel?.js) {
return this.config?.customModel?.js return this.config?.customModel?.js;
} }
} },
}, },
created() { created() {
this.getConfig() this.getConfig();
}, },
mounted() { mounted() {},
} };
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .el-card__header { ::v-deep .el-card__header {
} }
.container { .container {
padding: 20px; padding: 20px;
@ -207,7 +234,6 @@ export default {
position: relative; position: relative;
} }
.btns { .btns {
margin-top: 10px; margin-top: 10px;
position: sticky; position: sticky;
bottom: 20px; bottom: 20px;

Loading…
Cancel
Save