You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1151 lines
36 KiB

1 year ago
<template>
<div class="container">
1 year ago
<el-card
:shadow="device === 'desktop' ? 'always' : 'never'"
class="card"
:style="{
border: device === 'desktop' ? '' : 'none',
background: device === 'desktop' ? '' : '#f7f8fa',
'min-height': device === 'desktop' ? '' : '100vh',
}"
>
1 year ago
<template #header>
1 year ago
<p>{{ config.customModel ? config.customModel.name : "办理" }}</p>
1 year ago
</template>
<template>
9 months ago
<Steps :logs="config.logs" :current-node="node"></Steps>
<div v-if="/\/detail/.test($route.path) && config && config.flow">
4 months ago
<div v-if="config.flow.hasOwnProperty('out_contracts') && config.flow.out_contracts && config.flow.out_contracts.length > 0" style="margin-bottom: 10px;color:#F56C6C;">
<!-- 单条数据 -->
<div v-if="config.flow.out_contracts.length === 1">
<span @click="showContract(config.flow.out_contracts[0].id)" style="cursor: pointer;">
本流程已关联资金预算管理<span style="color:#409eff;">{{ config.flow.out_contracts[0].name }}</span>点击查看完整信息链
</span>
</div>
<!-- 多条数据 -->
<div v-else>
<span>本流程已关联{{ config.flow.out_contracts.length }}条资金预算管理分别是</span>
<span v-for="(contract, index) in config.flow.out_contracts" :key="contract.id">
<span v-if="index > 0"></span>
<span @click="showContract(contract.id)" style="cursor: pointer;color:#409eff;">{{ contract.name }}</span>
</span>
<span>可分别点击查看完整信息链</span>
</div>
4 months ago
</div>
1 year ago
4 months ago
<!-- out_pay 处理 -->
<div v-if="config.flow.hasOwnProperty('out_pay') && config.flow.out_pay && config.flow.out_pay.length > 0" style="margin-bottom: 10px;color:#F56C6C;">
<!-- 单条数据 -->
<div v-if="config.flow.out_pay.length === 1">
<span @click="showContract(config.flow.out_pay[0].contract_id)" style="cursor: pointer;">
3 weeks ago
本流程已关联资金预算管理<span style="color:#409eff;">{{ config.flow.out_pay[0].contract?config.flow.out_pay[0].contract.name:'未知支出'+config.flow.out_pay[0].contract_id }}</span>点击查看完整信息链
4 months ago
</span>
</div>
<!-- 多条数据 -->
<div v-else>
<span>本流程已关联{{ config.flow.out_pay.length }}条资金预算管理分别是</span>
<span v-for="(pay, index) in config.flow.out_pay" :key="pay.id">
<span v-if="index > 0"></span>
3 weeks ago
<span @click="showContract(pay.contract_id)" style="cursor: pointer;color:#409eff;">{{ pay.contract?pay.contract.name:'未知支出'+pay.contract_id }}</span>
4 months ago
</span>
<span>可分别点击查看完整信息链</span>
</div>
</div>
</div>
<div class="form-container" id="print-content">
11 months ago
<DesktopForm
:device="device"
ref="desktopForm"
:config="config"
:is-first-node="isFirstNode"
:sub-form="subConfig"
:fields="fields"
:original-form="form"
10 months ago
:readable.sync="readableFields"
11 months ago
:script-content="scriptContent"
10 months ago
:writeable.sync="writeableFields"
11 months ago
:rules="rules"
:sub-rules="subRules"
:logs="config.logs"
></DesktopForm>
1 year ago
</div>
1 year ago
</template>
1 year ago
1 year ago
<!-- 审批日志-->
<div v-if="/\/detail/.test($route.path)" style="margin-top: 10px">
<div>流转记录</div>
<vxe-table
1 year ago
style="margin-top: 10px;"
show-footer
ref="table"
stripe
class="log-table-scroll"
keep-source
show-overflow
:column-config="{ resizable: true }"
:print-config="{}"
:export-config="{}"
:custom-config="{ mode: 'popup' }"
:footer-data="footerData"
:data="config.logs || []"
1 year ago
@cell-dblclick="cellDblclickEvent"
>
1 year ago
<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"
:type="statusColor.get(row.status)"
effect="dark"
1 year ago
>{{ myStatus.get(row.status) }}</el-tag
>
</template>
</vxe-column>
1 year ago
<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 }">
1 year ago
<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">
<template #default="{ row }">
<span>{{ diffTime(row.updated_at, row.created_at) }}</span>
</template>
</vxe-column>
</vxe-table>
</div>
1 year ago
<div class="btns" ref="btns">
<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="isShowRollback = true"
1 year ago
>退回</el-button
>
1 month ago
<el-button
v-if="$route.query.flow_id"
icon="el-icon-caret-right"
type="primary"
plain
size="small"
@click="isShowForward = true"
1 year ago
>部门内转办</el-button
1 month ago
>
<el-button
v-if="$route.query.flow_id"
icon="el-icon-document-add"
type="info"
size="small"
@click="submit('only-submit')"
1 year ago
>暂存不流转</el-button
>
<el-button type="primary" size="small" @click="submit('assign')"
1 year ago
>保存并流转 <i class="el-icon-right"></i
></el-button>
<el-button
v-if="!$route.query.flow_id"
type="info"
size="small"
@click="$router.go(-1)"
1 year ago
>返回</el-button
>
</template>
<template v-else>
9 months ago
<el-button
v-if="$store.state.user.adminId === 1 && $route.query.flow_id"
icon="el-icon-arrow-left"
type="danger"
size="small"
@click="isShowRollback = true"
>退回</el-button
>
1 year ago
<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> -->
4 months ago
<!-- <el-button plain size="small">下载附件</el-button> -->
</template>
1 year ago
</div>
1 year ago
</el-card>
1 year ago
<assign
ref="assign"
:visible.sync="isShowAssign"
:config="config"
:result="result"
></assign>
1 year ago
<forward
ref="forward"
:is-show.sync="isShowForward"
1 year ago
:flow="config.flow"
></forward>
1 year ago
<rollback
ref="rollback"
:is-show.sync="isShowRollback"
:flow="config.flow"
></rollback>
1 year ago
<el-backtop></el-backtop>
3 weeks ago
<!-- 更改时间 -->
<el-dialog
title="请选择时间"
:visible.sync="isShowTime"
:close-on-click-modal="false"
width="30%"
>
<!-- 日期时间选择器 -->
<el-date-picker
v-model="selectedDateTime"
type="datetime"
placeholder="选择日期时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
:clearable="false"
style="width: 100%"
></el-date-picker>
<div slot="footer" class="dialog-footer">
<el-button @click="isShowTime = false,timeId='',selectedDateTime='',selectedDateType=''">取消</el-button>
<el-button type="primary" @click="updateTime"></el-button>
</div>
</el-dialog>
<!-- 更改承办人员 -->
<el-dialog
title="请选择承办人员"
:visible.sync="isShowUserDialog"
:close-on-click-modal="false"
width="30%"
>
<!-- 用户选择下拉框 -->
<el-select
v-model="selectedUserId"
placeholder="请选择承办人员"
filterable
style="width: 100%"
>
<el-option
v-for="user in userList"
:key="user.id"
:label="user.name"
:value="user.id"
></el-option>
</el-select>
<div slot="footer" class="dialog-footer">
<el-button @click="isShowUserDialog = false,currentRowId='',selectedUserId=''">取消</el-button>
<el-button type="primary" @click="updateUser"></el-button>
</div>
</el-dialog>
4 months ago
<!-- 打开支出 详情 -->
<vxe-modal
v-model="isShowModal"
:z-index="999999"
transfer
show-zoom
resize
:fullscreen="$store.getters.device === 'mobile'"
title="查看"
width="100%"
height="100%"
esc-closable
:padding="false"
>
<iframe
:src="contractUrl"
style="display: block;width: 100%;height: 100%;border: 0;"
frameborder="0"
/>
</vxe-modal>
1 year ago
</div>
</template>
<script>
9 months ago
import Steps from "./components/Steps.vue";
1 year ago
import DesktopForm from "./DesktopForm.vue";
import MobileForm from "./MobileForm.vue";
1 year ago
import assign from "./components/assign.vue";
import forward from "./components/forward.vue";
import rollback from "./components/rollback.vue";
1 year ago
import { generateRandomString } from '@/utils'
3 weeks ago
import { userListNoAuth} from "@/api/common";
1 year ago
import {
create,
deal,
1 year ago
fieldConfig, flowList,
1 year ago
preConfig,
preDeal,
1 year ago
updateNodeTime,
1 year ago
view,
} from "@/api/flow";
1 year ago
import { deepCopy } from "@/utils";
1 year ago
import { validation, validationName } from "@/utils/validate";
1 year ago
import { print } from "@/utils/print";
11 months ago
import JSONBigint from 'json-bigint'
4 months ago
import { getToken } from "@/utils/auth";
1 year ago
export default {
1 year ago
components: {
9 months ago
Steps,
1 year ago
DesktopForm,
1 year ago
MobileForm,
assign,
forward,
rollback,
1 year ago
},
1 year ago
data() {
1 year ago
return {
4 months ago
isShowModal:false,
contractUrl:'',
1 year ago
printKey: 0,
isShowRollback: false,
isShowForward: false,
1 year ago
isShowAssign: false,
3 weeks ago
timeId: '',
isShowTime: false,
selectedDateTime: '',
selectedDateType: '',
isShowUserDialog: false,
selectedUserId: '',
userList: [],
currentRowId: '',
1 year ago
info: [],
config: {},
10 months ago
writeableFields: [],
readableFields: [],
1 year ago
subConfig: new Map(),
myStatus: new Map([
1 year ago
[-2, "会签退回"],
[-1, "退回"],
[0, "办理中"],
[1, "已完成"],
]),
statusColor: new Map([
[-2, "warning"],
[-1, "warning"],
[0, ""],
[1, "success"],
]),
1 year ago
form: {},
1 year ago
result: {},
fileList: {},
1 year ago
subFileList: {},
1 year ago
rules: {},
1 year ago
subRules: {},
1 year ago
flows: [],
1 year ago
csrf_token: '',
1 year ago
};
1 year ago
},
4 months ago
watch:{
isShowModal(val){
if(!val){
this.contractUrl = ''
}
}
},
1 year ago
methods: {
4 months ago
// 打开 支出的链接
showContract(id){
this.contractUrl = `${process.env.VUE_APP_BASE_API}/ht/#/contract-flow?auth_token=${window.encodeURIComponent(
getToken()
)}&out_contract_id=`+id
this.isShowModal = true
},
1 year ago
// 处理url中default_json
handleDefaultJSON() {
7 months ago
console.log("123")
this.form['form_canal'] = 'oa'
1 year ago
try {
1 year ago
if(!this.$route.query?.default_json) return
1 year ago
const res = JSON.parse(this.$route.query?.default_json)
for (let key in this.$route.query) {
if(/^out_(.*)_id/.test(key)) {
this.form[key] = this.$route.query[key]
}
7 months ago
if(/^borrow_id/.test(key)) {
this.form[key] = this.$route.query[key]
}
if(/^form_canal/.test(key)){
this.form[key] = this.$route.query[key]
}
1 year ago
}
for (let key in res) {
try {
let jsonObj = JSON.parse(res[key]);
if (this.form.hasOwnProperty(key)) {
this.form[key] = jsonObj;
}
1 year ago
} catch (err) {
if (this.form.hasOwnProperty(key)) {
this.form[key] = res[key];
}
}
}
} catch (err) {
console.error(err)
}
},
1 year ago
async print(isLog=false) {
1 year ago
const _this = this
1 year ago
let customModelId = this.config.customModel.id || this.$route.query.module_id
const modelRes = await fieldConfig(customModelId,true)
let pickTemplate = 0
const printTemplates = [{
id: 0,
name: '基础模版',
print_format: modelRes.customModel.print_format
},...modelRes.customModel.print_formats]
const h = this.$createElement;
await this.$msgbox({
title: '打印模版选择',
message: h('div',{
class: 'print-template-radios',
key: this.printKey++
},[
h('div',{
},printTemplates.map(i => h('div',{
style: {
display: 'flex',
'align-items': 'center',
'margin-top': '4px',
}
},[
h('span',{
class: 'el-radio__input'
},[
h('span', {
class: 'el-radio__inner custom-cursor-on-hover'
}),
h('input', {
style: {
cursor: 'pointer',
opacity: 0,
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
margin: 0
},
attrs: {
// 添加属性
type: "radio",
id: `print-radio-${i.id}`,
name: "Radio",
value: i.id,
checked: pickTemplate === i.id,
},
on: {
change: () => {
pickTemplate = i.id
}
}
})
]),
h('label', {
style: {
flex: 1
},
attrs: {
for: `print-radio-${i.id}`
},
class: 'el-radio__label',
}, i.name)
])))
]),
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
})
const printText = printTemplates.find(i => i.id === pickTemplate)?.print_format
1 year ago
if(isLog) {
const res = await this.$refs['table'].exportData({
type: 'html',
download: false
})
1 year ago
await print.bind(this)(printText, isLog, _this.config.flow, res.content)
1 year ago
} else {
1 year ago
await print.bind(this)(printText, isLog, _this.config.flow)
1 year ago
}
},
1 year ago
generateForm(object, fields, relation = false, pname) {
1 year ago
fields.forEach((field) => {
1 year ago
if (field.rules && field.rules.length > 0 && this.writeableFields.find(i => i === field.id) && !relation) {
1 year ago
this.rules[field.name] = field.rules.map((rule) => {
1 year ago
switch (rule) {
1 year ago
case "required":
12 months ago
if (field.type === 'relation') {
return {
validator: (myRule, value, callback) => {
if (value instanceof Array && value.length > 0) {
callback()
} else {
callback(`请填写${field.label}`)
}
},
message: `请填写${field.label}`,
trigger: "blur",
};
} else {
return {
required: true,
message: `请填写${field.label}`,
trigger: "blur",
};
}
1 year ago
default:
return {
validator: (myRule, value, callback) => {
1 year ago
if (validation.get(rule).test(value) || value === '') {
1 year ago
callback();
1 year ago
} else {
1 year ago
callback(
new Error(
`${field.label}必须为${validationName.get(rule)}`
)
);
1 year ago
}
},
1 year ago
trigger: "blur",
1 year ago
message: `${field.label}必须为${validationName.get(rule)}`,
1 year ago
};
1 year ago
}
1 year ago
});
1 year ago
}
1 year ago
if (relation) {
this.subRules[`${pname}_rules`][field.name] = field.rules.map((rule) => {
switch (rule) {
case "required":
return {
required: true,
message: `请填写${field.label}`,
};
default:
return {
11 months ago
validator: this.device === 'desktop' ? ({ cellValue }) => {
1 year ago
return new Promise((resolve, reject) => {
if (validation.get(rule).test(cellValue) || cellValue === '') {
resolve()
} else {
reject(
new Error(
`${field.label}必须为${validationName.get(rule)}`
)
);
}
})
11 months ago
} : (myRule, value, callback) => {
if (validation.get(rule).test(value) || value === '') {
callback();
} else {
callback(
new Error(
`${field.label}必须为${validationName.get(rule)}`
)
);
}
1 year ago
},
trigger: "blur",
1 year ago
pattern: validation.get(rule),
message: `${field.label}必须为${validationName.get(rule)}`,
1 year ago
};
}
});
}
1 year ago
if (field.type === "relation") {
1 year ago
this.subRules[`${field.name}_rules`] = {}
11 months ago
let temp = {}
this.subConfig.get(field.sub_custom_model_id)?.customModel?.fields?.forEach(field => temp[field.name] = '')
object[field.name] = [temp];
1 year ago
1 year ago
this.generateForm(
object[field.name][0],
1 year ago
this.subConfig.get(field.sub_custom_model_id)?.customModel?.fields,
true,
1 year ago
field.name
1 year ago
);
1 year ago
} else {
1 year ago
if (/\/detail/.test(this.$route.path) && this.$route.query.flow_id) {
object[field.name] = "";
} else {
1 year ago
if (this.writeableFields.indexOf(field.id) !== -1 || this.readableFields.indexOf(field.id) !== -1) {
object[field.name] = (this.writeableFields.indexOf(field.id) !== -1 && field.default_value) ? field.default_value : (field.type === 'file' ? [] : "");
}
1 year ago
}
1 year ago
}
1 year ago
});
1 year ago
this.form['flow_title'] = this.config?.flow?.title ?? `${this.config.customModel.name}${this.$store.getters.name} ${this.$moment().format('YYYY-MM-DD HH:mm')}`
1 year ago
},
11 months ago
formatTime(time) {
const days = parseInt(time / (1000 * 60 * 60 * 24));
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;
1 year ago
return `${days > 0 ? days + "天" : ""}${
hours > 0 ? hours + "时" : ""
}${minutes}分${seconds}`;
},
1 year ago
async getConfig() {
const loading = this.$loading({
lock: true,
1 year ago
text: "拼命加载中",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.8)",
1 year ago
});
1 year ago
// 路由为detail为详情
1 year ago
if (/\/detail/.test(this.$route.path) && this.$route.query.flow_id) {
try {
const res = await view(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;
10 months ago
this.readableFields = /\/detail/.test(this.$route.path)
? this.fields?.map((i) => i.id)
: this.config?.currentNode?.readable || [];
this.writeableFields = this.config?.currentNode?.writeable || [];
11 months ago
// 生成空的form表单对象
this.generateForm(this.form, fields);
11 months ago
// form赋值
const { data } = res?.flow;
for (let key in data) {
try {
let jsonObj = JSON.parse(data[key]);
1 year ago
jsonObj.forEach(item => {
// 遍历对象中的每个键值对
for (const key in item) {
if (typeof item[key] === 'string') {
try {
// 尝试解析字符串为 JSON 对象
11 months ago
const parsedValue = JSONBigint({ storeAsString: true }).parse(item[key]);
1 year ago
// 如果解析成功,替换原始字符串
item[key] = parsedValue;
} catch (e) {
// 如果解析失败,继续保持原始字符串
}
}
}
})
if (this.form.hasOwnProperty(key)) {
this.form[key] = jsonObj;
}
} catch (err) {
if (this.form.hasOwnProperty(key)) {
1 year ago
if (data[key] instanceof Array) {
if (data[key].length > 0 && data[key][0].hasOwnProperty('url')) {
this.form[key] = data[key].map(i => ({
name: i.original_name,
url: i.url,
response: i,
}))
} else {
this.form[key] = ''
}
}
this.form[key] = data[key];
}
}
1 year ago
}
11 months ago
this.form = Object.assign({}, this.form);
loading.close();
} catch (err) {
console.error(err);
this.$message.error("配置失败");
loading.close();
}
} else if (!this.$route.query.flow_id) {
1 year ago
// 新建
try {
1 year ago
this.csrf_token = generateRandomString()
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;
10 months ago
this.readableFields = /\/detail/.test(this.$route.path)
? this.fields?.map((i) => i.id)
: this.config?.currentNode?.readable || [];
this.writeableFields = this.config?.currentNode?.writeable || [];
this.generateForm(this.form, fields);
1 year ago
this.handleDefaultJSON();
this.form = Object.assign({}, this.form);
loading.close();
} catch (err) {
console.error(err);
this.$message.error("配置失败");
loading.close();
}
} else {
1 year ago
// 待办
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;
10 months ago
this.readableFields = /\/detail/.test(this.$route.path)
? this.fields?.map((i) => i.id)
: this.config?.currentNode?.readable || [];
this.writeableFields = this.config?.currentNode?.writeable || [];
this.generateForm(this.form, fields);
1 year ago
this.handleDefaultJSON();
const { data } = res?.flow;
for (let key in data) {
try {
let jsonObj = JSON.parse(data[key]);
1 year ago
jsonObj.forEach(item => {
// 遍历对象中的每个键值对
for (const key in item) {
if (typeof item[key] === 'string') {
try {
// 尝试解析字符串为 JSON 对象
11 months ago
const parsedValue = JSONBigint({ storeAsString: true }).parse(item[key]);
1 year ago
// 如果解析成功,替换原始字符串
item[key] = parsedValue;
} catch (e) {
// 如果解析失败,继续保持原始字符串
}
}
}
})
if (this.form.hasOwnProperty(key)) {
this.form[key] = jsonObj;
}
} catch (err) {
if (this.form.hasOwnProperty(key)) {
1 year ago
if (data[key] instanceof Array) {
if (data[key].length > 0) {
this.form[key] = data[key];
} else {
this.form[key] = ''
}
}
1 year ago
if (data[key] && data[key] !== 'null' && data[key] !== 'undefined') {
this.form[key] = data[key];
}
}
}
1 year ago
}
1 year ago
this.form = Object.assign({}, this.form);
loading.close();
} catch (err) {
console.error(err);
this.$message.error("配置失败");
loading.close();
}
1 year ago
}
1 year ago
},
1 year ago
async submit(type) {
1 year ago
if (window.$_uploading) {
this.$message.warning("文件正在上传中")
return
}
1 year ago
let copyForm;
11 months ago
try {
await this.$refs['desktopForm'].validate()
} catch (err) {
console.warn(err)
this.$message.warning('数据校验失败')
return
}
copyForm = deepCopy(this.$refs["desktopForm"].form);
11 months ago
const uploadHandler = (form, fields) => {
1 year ago
let keys = Object.keys(form)
if(fields){
keys.forEach(key => {
1 year ago
if (form[key] instanceof Array) {
11 months ago
if (form[key].length > 0 && typeof form[key][0] === 'object') {
console.log("key",key,fields)
11 months ago
const myField = fields.find(field => field.name === key)
if (myField) {
if (myField.type === 'file') {
form[key] = form[key].map(i => i.hasOwnProperty('response') ? i.response : i)
} else {
form[key].forEach(i => {
uploadHandler(i, this.subConfig.get(myField.sub_custom_model_id)?.customModel?.fields)
})
}
1 year ago
}
10 months ago
} else if (form[key].length > 0) {
1 year ago
} else {
form[key] = ''
}
} else {
if (form[key] === 'null' || form[key] === 'undefined') {
form[key] = ''
}
}
})
}
1 month ago
}
7 months ago
console.log("copyForm",copyForm,this.fields)
console.log("this.writeableFields",this.writeableFields)
11 months ago
uploadHandler(copyForm, this.fields)
12 months ago
for (let key in copyForm) {
let myField = this.fields.find(i => i.name === key)
7 months ago
12 months ago
if (myField && this.writeableFields.indexOf(myField.id) === -1) {
delete copyForm[key]
}
}
7 months ago
copyForm["current_node_id"] = this.config.currentNode.id;
try {
11 months ago
let callback = () => {};
switch (type) {
case "only-submit":
if (this.$route.query.flow_id) {
copyForm["temporary_save"] = 1;
}
11 months ago
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;
}
7 months ago
console.log("copyForm",copyForm,this.$refs["desktopForm"].form)
// return
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;
1 year ago
if (!is_last_handled_log) {
await this.$alert(
"办理成功,其他会签办理完成后,由最后办理的成员流转到下一节点。",
"提示",
{
showClose: false,
}
);
1 year ago
callback = () => this.$router.push("/flow/list/todo");
}
} else {
1 year ago
copyForm['csrf_token'] = this.csrf_token
this.result = await create(this.$route.query.module_id, copyForm);
1 year ago
}
callback();
} catch (err) {
console.error(err);
1 year ago
}
1 year ago
},
1 year ago
async cellDblclickEvent({ row, column }) {
// if(this.$store.state.user.username !== 'admin') return
3 weeks ago
if(!this.$store.state.user.roles.includes("全局流程监管")) return
1 year ago
if(column.field === 'created_at' || column.field === 'updated_at') {
3 weeks ago
this.timeId = row.id
this.selectedDateType = column.field
this.selectedDateTime = row[column.field]
this.isShowTime = true
}
if(column.field === "user.name"){
this.currentRowId = row.id
this.selectedUserId = row.user ? row.user.id : ''
this.isShowUserDialog = true
this.getUserList()
}
},
updateTime() {
updateNodeTime({
id: this.timeId,
date: this.selectedDateTime,
date_type: this.selectedDateType
}).then(_ => {
this.$message.success('更新成功')
this.timeId = ''
this.selectedDateTime = ''
this.selectedDateType = ''
this.isShowTime = false
this.getConfig()
})
},
async getUserList() {
try {
const userRes = await userListNoAuth({
page: 1,
rows: 9999,
})
3 weeks ago
this.userList = userRes.data || []
} catch (err) {
console.error(err)
this.$message.error('获取用户列表失败')
1 year ago
}
},
3 weeks ago
updateUser() {
if (!this.selectedUserId) {
this.$message.warning('请选择承办人员')
return
}
updateNodeTime({
id: this.currentRowId,
user_id: this.selectedUserId
}).then(_ => {
this.$message.success('更新成功')
this.currentRowId = ''
this.selectedUserId = ''
this.isShowUserDialog = false
this.getConfig()
})
},
1 year ago
},
1 year ago
computed: {
device() {
1 year ago
return this.$store.state.app.device;
1 year ago
},
fields() {
1 year ago
return this.config?.customModel?.fields || [];
1 year ago
},
10 months ago
// 放到data中为了修改
// readableFields() {
// return /\/detail/.test(this.$route.path)
// ? this.fields?.map((i) => i.id)
// : this.config?.currentNode?.readable || [];
// },
// writeableFields() {
// return this.config?.currentNode?.writeable || [];
// },
1 year ago
node() {
1 year ago
return this.config?.currentNode || {};
1 year ago
},
scriptContent() {
1 year ago
if (this.config?.customModel?.view_js && this.$route.query.flow_id && /\/detail/.test(this.$route.path)) {
return this.config?.customModel?.view_js;
12 months ago
} else if (this.config?.customModel?.js && !/\/detail/.test(this.$route.path)) {
1 year ago
return this.config?.customModel?.js;
1 year ago
}
1 year ago
},
diffTime() {
1 year ago
return function (end, start) {
const diff = this.$moment(end).diff(this.$moment(start));
return this.formatTime(diff);
};
},
footerData() {
1 year ago
const diff = this.$moment(this.config?.logs?.at(-1)?.updated_at).diff(
this.$moment(this.config?.logs?.at(0)?.created_at)
);
return [
{
seq: "总耗时",
1 year ago
use_time: this.formatTime(diff),
},
];
},
1 year ago
isFirstNode() {
return this.config?.logs?.length === 0 || this.config?.currentNode?.category === 'start'
}
1 year ago
},
1 year ago
created() {
1 year ago
this.getConfig();
1 year ago
},
1 year ago
mounted() {},
};
1 year ago
</script>
<style scoped lang="scss">
1 year ago
::v-deep .el-step__title {
font-size: 14px;
line-height: 1.5;
}
::v-deep .el-step__icon.is-icon {
border-radius: 100%;
box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05);
1 year ago
width: 36px;
height: 36px;
border: solid 2px;
1 year ago
}
::v-deep .el-step.is-center .el-step__line {
top: 50%;
}
1 year ago
::v-deep .el-card__header {
}
.container {
padding: 20px;
1 year ago
.card {
position: relative;
}
.btns {
display: flex;
justify-content: center;
1 year ago
margin-top: 10px;
flex-wrap: wrap;
1 year ago
}
1 year ago
}
1 year ago
.form-container {
}
1 year ago
@media (max-width: 768px) {
.container {
padding: 0;
}
1 year ago
.btns {
1 year ago
justify-content: space-evenly;
& > * {
margin: 4px 6px;
}
}
1 year ago
::v-deep .el-steps--horizontal {
display: flex;
flex-wrap: wrap;
}
}
</style>
<style lang="scss">
.log-table-scroll {
::-webkit-scrollbar {
height: 0;
1 year ago
}
}
1 year ago
.print-template-radios .el-radio__input:has(input[type=radio]:checked) .el-radio__inner {
border-color: var(--theme-color);
background: var(--theme-color);
&::after {
transform: translate(-50%,-50%) scale(1);
}
}
5 months ago
/** 移动端展示 **/
@media screen and (max-width: 500px) {
.el-picker-panel__sidebar {
width: 100%;
}
.el-picker-panel {
width: 400px!important;
}
.el-picker-panel__content {
width: 100%;
}
.el-picker-panel__body{
margin-left: 0!important;
display: flex;
flex-direction: column;
min-width: auto!important;
}
.el-picker-panel__sidebar {
position: relative;
}
.el-picker-panel__body-wrapper {
display: flex;
flex-direction: column;
align-items: center;
}
}
1 year ago
</style>