xy 2 years ago
parent 9b8c7d262c
commit cb3b7b5126

@ -1,10 +1,25 @@
import request from '@/utils/request'
function customParamsSerializer(params) {
let result = '';
for (let key in params) {
if (params.hasOwnProperty(key)) {
if (Array.isArray(params[key])) {
params[key].forEach((item,index) => {
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
});
} else {
result += `${key}=${params[key]}&`;
}
}
}
return result.slice(0, -1);
}
export function index(params) {
return request({
method: 'get',
url: '/api/oa/config/index',
params
params,
paramsSerializer: customParamsSerializer
})
}

@ -1 +1 @@
<svg t="1727226512125" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4440" width="200" height="200"><path d="M896 85.333333h-170.666667V42.666667a42.666667 42.666667 0 0 0-85.333333 0v42.666666H384V42.666667a42.666667 42.666667 0 0 0-85.333333 0v42.666666H128a128 128 0 0 0-128 128v682.666667a128 128 0 0 0 128 128h768a128 128 0 0 0 128-128V213.333333a128 128 0 0 0-128-128zM128 170.666667h170.666667v42.666666a42.666667 42.666667 0 0 0 85.333333 0V170.666667h256v42.666666a42.666667 42.666667 0 0 0 85.333333 0V170.666667h170.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v128H85.333333V213.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z m768 768H128a42.666667 42.666667 0 0 1-42.666667-42.666667V426.666667h853.333334v469.333333a42.666667 42.666667 0 0 1-42.666667 42.666667z" fill="#333333" p-id="4441"></path><path d="M663.04 559.786667l-213.333333 213.333333-90.026667-92.586667a42.666667 42.666667 0 0 0-60.16 0 42.666667 42.666667 0 0 0 0 60.586667l120.746667 120.746667a42.666667 42.666667 0 0 0 30.293333 12.8 42.666667 42.666667 0 0 0 30.293333-12.8l241.493334-241.493334a42.666667 42.666667 0 0 0 0-60.586666 42.666667 42.666667 0 0 0-59.306667 0z" fill="currentColor" p-id="4442"></path></svg>
<svg t="1727226512125" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4440" width="200" height="200"><path d="M896 85.333333h-170.666667V42.666667a42.666667 42.666667 0 0 0-85.333333 0v42.666666H384V42.666667a42.666667 42.666667 0 0 0-85.333333 0v42.666666H128a128 128 0 0 0-128 128v682.666667a128 128 0 0 0 128 128h768a128 128 0 0 0 128-128V213.333333a128 128 0 0 0-128-128zM128 170.666667h170.666667v42.666666a42.666667 42.666667 0 0 0 85.333333 0V170.666667h256v42.666666a42.666667 42.666667 0 0 0 85.333333 0V170.666667h170.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v128H85.333333V213.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z m768 768H128a42.666667 42.666667 0 0 1-42.666667-42.666667V426.666667h853.333334v469.333333a42.666667 42.666667 0 0 1-42.666667 42.666667z" fill="currentColor" p-id="4441"></path><path d="M663.04 559.786667l-213.333333 213.333333-90.026667-92.586667a42.666667 42.666667 0 0 0-60.16 0 42.666667 42.666667 0 0 0 0 60.586667l120.746667 120.746667a42.666667 42.666667 0 0 0 30.293333 12.8 42.666667 42.666667 0 0 0 30.293333-12.8l241.493334-241.493334a42.666667 42.666667 0 0 0 0-60.586666 42.666667 42.666667 0 0 0-59.306667 0z" fill="currentColor" p-id="4442"></path></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,8 +1,8 @@
<template>
<div :class="classObj" class="app-wrapper">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<sidebar class="sidebar-container" />
<div class="main-container">
<sidebar class="sidebar-container" :style="{ 'display': hideSidebar ? 'none' : '' }" />
<div class="main-container" :style="{ 'margin-left': hideSidebar ? '0' : '' }">
<app-main />
</div>
</div>
@ -23,6 +23,9 @@ export default {
},
mixins: [ResizeMixin],
computed: {
hideSidebar() {
return this.$route.query.isSinglePage
},
sidebar() {
return this.$store.state.app.sidebar
},

@ -53,14 +53,21 @@ Vue.config.productionTip = false
import Vant from 'vant'
import 'vant/lib/index.css';
Vue.use(Vant)
import domZIndex from 'dom-zindex'
domZIndex.setCurrent(2000)
import CardContainer from '@/layout/CardContainer.vue'
Vue.component('CardContainer', CardContainer)
//moment
import moment from 'moment'
moment.locale('zh-cn')
Vue.prototype.$moment = moment;
import { setToken,getToken } from "@/utils/auth"
if(window.top !== window.self) {
// 当前页面在iframe中
window._IN_IFRAME = true;
}
if (window.__POWERED_BY_WUJIE__) {
let instance;
window.__WUJIE_MOUNT = () => {
@ -77,31 +84,12 @@ if (window.__POWERED_BY_WUJIE__) {
window.__WUJIE_UNMOUNT = () => {
instance.$destroy();
};
}
else if(window.top !== window.self) {
// 当前页面在iframe中
window._IN_IFRAME = true;
setToken(window.decodeURIComponent(getQueryParam('auth_token')))
} else {
window.MODULE_NAME = getQueryParam('module_name')
new Vue({
router,
store,
render: h => h(App)
}).$mount("#app")
router.push(getQueryParam('to') || '/')
// window.addEventListener("message",function (e) {
// const { module_name, auth_token } = e.data;
// window.MODULE_NAME = module_name;
// console.log('token',auth_token)
//
// })
}
else {
new Vue({
router,
store,
render: h => h(App)
}).$mount("#app")
}

@ -16,6 +16,9 @@ router.beforeEach(async(to, from, next) => {
// set page title
document.title = getPageTitle(to.meta.title)
if(to.query.auth_token) {
setToken(window.decodeURIComponent(to.query.auth_token))
}
// determine whether the user has logged in
const hasToken = getToken()
if (hasToken) {

@ -1,6 +1,6 @@
module.exports = {
title: 'Vue Admin Template',
title: '内控管理平台',
/**
* @type {boolean} true | false

@ -18,7 +18,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
if (info?.selection_model) {
options = info.selection_model_items;
} else if (info?.stub) {
options = info?.stub?.split(/\n/) || [];
options = info?.stub?.split(/\r\n/) || [];
}
let options;
if (device === "desktop") {
@ -617,6 +617,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
field: subField.name,
title: subField.label,
align: "center",
'min-width': '180',
"edit-render": {},
},
scopedSlots: {
@ -647,7 +648,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
color: "#333",
},
},
moment(this.form[info.name]).format("YYYY年MM月DD日")
this.form[info.name] ? moment(this.form[info.name]).format("YYYY年MM月DD日") : ''
);
break;
case "datetime":
@ -658,7 +659,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
color: "#333",
},
},
moment(this.form[info.name]).format("YYYY年MM月DD日 HH时mm分ss秒")
this.form[info.name] ? moment(this.form[info.name]).format("YYYY年MM月DD日 HH时mm分ss秒") : ''
);
break;
case "select":

@ -1,30 +1,845 @@
<template>
<div class="dashboard-container">
<div class="dashboard-text">name: {{ name }}</div>
<div class="body">
<div class="dashboard-container">
<div class="row row1">
<div class="weather">
<div class="left">
<h3>工作台</h3>
<div class="d-flex">
<div>欢迎回来{{ name }}</div>
</div>
</div>
<div class="center">
<el-button
style="padding: 6px 15px"
type="primary"
size="small"
round
@click="$router.push('/attendance')"
>去打卡</el-button
>
</div>
<div class="right">
<div class="weather__icon">
<i :class="weatherIcon.get(weather.weather)"></i>
</div>
<div class="weather__weather">
<div>{{ $moment().format("dddd") }}</div>
<div>{{ weather.weather }}</div>
</div>
<div class="weather__temperature">
<div class="celsius">
<span>
{{ weather.temperature }}
</span>
<span>°C</span>
</div>
<div class="wind">
<span>{{ weather.winddirection }}</span>
<span> {{ weather.windpower }}</span>
</div>
</div>
</div>
</div>
<div class="mycard calendar">
<div class="mycard__title calendar__title d-flex">
<div>工作日历</div>
<el-date-picker
v-model="calendar"
type="month"
size="small"
style="
width: 160px;
border-radius: 10px;
background-color: #ffffff;
border: 1px solid #d1d1d1;
"
></el-date-picker>
</div>
<div class="mycard__body calendar__body">
<el-calendar v-model="calendar">
<template #dateCell="{ date, data }">
<div
:class="
!!getTodayAttendance(data.day) ? 'has-attendance' : ''
"
>
{{ data.day.split("-")[2] }}
<template v-if="getTodayAttendance(data.day)">
<div
class="sign-in"
v-if="
getTodayAttendance(data.day) &&
getTodayAttendance(data.day).sign_in_at
"
>
{{
$moment(getTodayAttendance(data.day).sign_in_at).format(
"HH:mm"
)
}}
</div>
<div
class="sign-out"
v-if="
getTodayAttendance(data.day) &&
getTodayAttendance(data.day).sign_out_at
"
>
{{
$moment(
getTodayAttendance(data.day).sign_out_at
).format("HH:mm")
}}
</div>
</template>
</div>
</template>
</el-calendar>
</div>
</div>
</div>
<div class="row row2">
<div class="mycard quick-menu">
<div class="mycard__title">
<span>快捷导航</span>
</div>
<div class="mycard__body quick-menu__body">
<router-link
:to="item.url"
tag="div"
v-for="item in quickMenus"
:key="item.key"
>
<div>
{{ item.name }}
</div>
</router-link>
</div>
</div>
<div class="mycard flow">
<div class="mycard__title">
<span>常用流程</span>
</div>
<div class="mycard__body flow__body">
<router-link
:to="'/flow/create?module_id=' + item.id"
tag="div"
v-for="item in usualFlows"
:key="item.key"
>
<div>
<div class="flow-cover">
<template v-if="item.icon">
<Icon class="flow__body--icon" :icon="item.icon"></Icon>
</template>
<template v-else>
<i class="el-icon-edit flow__body--icon"></i>
</template>
</div>
<span class="flow__body--name">{{ item.name }}</span>
</div>
</router-link>
</div>
</div>
</div>
</div>
<div class="todo mycard">
<div class="mycard__title">
<span>待办事项</span>
</div>
<div class="mycard__body">
<el-table
v-loading="noticeLoading"
style="width: 100%"
size="mini"
:header-cell-style="{
'font-weight': '600',
background: '#eaf2ff',
color: '#515a6e',
}"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.8)"
:data="notice"
>
<el-table-column
type="index"
width="46"
label="序号"
align="center"
/>
<el-table-column
v-for="(item, index) in noticeTable"
:key="index"
:width="item.width"
:label="item.title"
:prop="item.key"
:show-overflow-tooltip="item['show-overflow-tooltip']"
header-align="center"
:align="item.align"
:formatter="item.formatter"
/>
<el-table-column
label="操作"
header-align="center"
min-width="122"
fixed="right"
>
<template #default="{ row }">
<el-button
size="mini"
style="padding: 5px 10px"
@click="read(row)"
>设为已读</el-button
>
<el-button
size="mini"
type="primary"
style="padding: 5px 10px"
@click="handle(row)"
>办理</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 办理-->
<vxe-modal
v-model="isShowModal"
:z-index="zIndex"
transfer
show-zoom
:fullscreen="$store.getters.device === 'mobile'"
title="办理"
width="86vw"
height="80vh"
esc-closable
>
<iframe
:src="modalUrl"
style="width: 100%; height: 100%"
frameborder="0"
/>
</vxe-modal>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import Icon from '@/layout/components/Sidebar/Icon.vue'
import { PopupManager } from "element-ui/lib/utils/popup";
import { mapGetters } from "vuex";
import axios from "axios";
import { getToken } from "@/utils/auth";
import { flow } from "@/api/flow";
import { index as configIndex } from "@/api/config";
import { index } from "@/api/attendance";
export default {
name: 'Dashboard',
name: "Dashboard",
components: {
Icon
},
data() {
return {
modalUrl: "",
zIndex: PopupManager.nextZIndex(),
isShowModal: false,
weatherIcon: new Map([
["晴", "el-icon-sunny"],
["阴", "el-icon-cloudy"],
["多云", "el-icon-cloudy-and-sunny"],
["大雨", "el-icon-heavy-rain"],
["雷阵雨", "el-icon-lightning"],
["小雨", "el-icon-light-rain"],
["中雨", "el-icon-light-rain"],
]),
weather: {},
calendar: this.$moment().format("YYYY-MM"),
attendanceData: {
attendances: [],
},
quickMenus: [
{
name: "我收藏的",
url: "/flow/list/fav",
},
{
name: "我办理过的",
url: "/flow/list/handled",
},
{
name: "我发起的",
url: "/flow/list/my",
},
{
name: "所有待办",
url: "/flow/list/todo",
},
{
name: "抄送给我的",
url: "/flow/list/cc",
},
],
flows: [],
usualFlows: [],
noticeLoading: false,
notice: [],
noticeTable: [
{
title: "下发时间",
key: "created_at",
width: 156,
align: "center",
formatter: (row, column, cellValue) => {
return this.$moment(cellValue).format("YYYY-MM-DD HH:mm:ss");
},
},
{
title: "内容",
key: "data.title",
align: "left",
"show-overflow-tooltip": true,
minWidth: 240,
},
],
};
},
computed: {
...mapGetters([
'name'
])
}
}
...mapGetters(["name"]),
},
methods: {
getTodayAttendance(date) {
return this.attendanceData.attendances.find((i) => i.date === date)
?.attendance;
},
async getAttendance() {
try {
const res = await index({
month: this.calendar,
});
this.attendanceData = res;
} catch (err) {
console.error(err);
}
},
async getUsualFlows() {
try {
await this.getFlows();
const res = await configIndex({
filter: [
{
key: "key",
op: "eq",
value: "dashboard_menus",
},
],
});
this.usualFlows = this.flows.filter(
(i) => res.data[0]?.value?.indexOf(i.id.toString()) !== -1
);
console.log(this.usualFlows);
} catch (err) {
console.error(err);
}
},
async getFlows() {
try {
const res = await flow();
this.flows = res.cates?.map((i) => i.customer_models).flat();
} catch (err) {
console.error(err);
}
},
async getTotal() {},
async getWeather() {
try {
const res = await axios.get(
`https://restapi.amap.com/v3/weather/weatherInfo?city=320400&key=15ecd1e7de61e684959f43d8965a89f0`
);
if (res.status === 200) {
this.weather = res.data.lives[0];
}
} catch (err) {
console.error(err);
}
},
async getNotices() {
try {
this.noticeLoading = true;
const res = await axios.get(
`${process.env.VUE_APP_BASE_API}/api/notification/todo`,
{
headers: {
Authorization: `Bearer ${getToken()}`,
},
params: {
page: 1,
page_size: 30,
from: window.MODULE_NAME || process.env.VUE_APP_MODULE_NAME,
},
}
);
if (res.status === 200) {
this.notice = res.data.data?.data;
}
this.noticeLoading = false;
} catch (err) {
console.error(err);
this.noticeLoading = false;
}
},
async read(row) {
try {
this.loading = true;
const res = await axios.get(
`${process.env.VUE_APP_BASE_API}/api/notification/read`,
{
headers: {
Authorization: `Bearer ${getToken()}`,
},
params: {
id: row.id,
},
}
);
if (res.status === 200) {
await this.getNotices();
}
this.loading = false;
} catch (err) {
console.error(err);
this.loading = false;
}
},
handle(row) {
try {
const data = row.data;
if (data.from === "ht") {
this.modalUrl = `/${
data.from
}/#/contract/contractList?auth_token=${window.encodeURIComponent(
getToken()
)}&module_name=${data.from}&keyword=${
/\[(.*?)]/.exec(data.title) ? /\[(.*?)]/.exec(data.title)[1] : ""
}&isSinglePage=1`;
} else if (data.from === "oa") {
this.modalUrl = `/${
data.from
}/#/flow/create?auth_token=${window.encodeURIComponent(
getToken()
)}&module_name=${data.from}&flow_id=${
data.other?.flow_id
}&isSinglePage=1`;
}
console.log(this.modalUrl);
this.isShowModal = true;
} catch (err) {
this.$message.warning("未找到流程");
console.error(err);
}
},
},
created() {
this.getWeather();
this.getNotices();
this.getTotal();
this.getUsualFlows();
this.getAttendance();
},
};
</script>
<style lang="scss" scoped>
$btn-colors: linear-gradient(90deg, #d4bbfd 0%, #af7bff 100%),
linear-gradient(90deg, #8dddf7 0%, #3fbde2 100%),
linear-gradient(90deg, #aec1fd 0%, #81a0ea 100%),
linear-gradient(90deg, #f5c0b8 0%, #ee9b98 100%),
linear-gradient(90deg, #ffd2a6 0%, #ffb46d 100%);
::v-deep .el-calendar__header {
display: none;
}
::v-deep .el-input__inner {
border-color: transparent;
border-radius: 10px;
}
::v-deep .el-calendar__body table thead th:nth-last-child(1),
::v-deep .el-calendar__body table thead th:nth-last-child(2) {
color: #dd383d;
}
::v-deep .el-calendar-table td,
::v-deep .el-calendar-table tr:first-child td,
::v-deep .el-calendar-table tr td:first-child {
border: none;
}
::v-deep .el-calendar-table .el-calendar-day {
min-height: 68px;
height: auto;
border-radius: 6px;
transition: all 0.2s;
margin: 2px;
}
::v-deep .el-calendar-table td.is-selected {
background: var(--theme-color) !important;
color: #fff !important;
border-radius: 6px;
}
::v-deep .el-calendar-table .el-calendar-day:hover {
color: var(--theme-color);
}
::v-deep .el-calendar {
border-radius: 0 0 10px 10px;
}
::v-deep .el-calendar-table .is-today {
position: relative;
&::after {
content: "今";
color: #fff;
background: var(--theme-color);
filter: sepia(0.5);
transform: translate(50%, -50%);
border-radius: 4px;
padding: 2px;
font-size: 10px;
position: absolute;
right: 0;
top: 0;
}
}
.d-flex {
display: flex;
}
.body {
padding: 10px;
}
.mycard {
border-radius: 10px;
filter: drop-shadow(0 0 5px rgba(51, 51, 51, 0.1));
background-color: #ffffff;
padding: 22px;
&__title {
font-size: 20px;
color: #333333;
font-weight: bold;
padding-left: 20px;
position: relative;
&::before {
content: "";
height: 100%;
border-radius: 5px;
background: var(--theme-color);
width: 5px;
position: absolute;
top: 0;
left: 0;
}
}
&__body {
padding-top: 20px;
}
}
.dashboard {
&-container {
margin: 30px;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
& > * {
width: calc(50% - 10px);
}
.row {
& > * {
margin-bottom: 20px;
}
}
.weather {
display: flex;
align-items: flex-end;
.center {
margin-left: 20px;
}
.right {
display: flex;
align-items: center;
margin-left: auto;
}
&__icon {
color: var(--theme-color);
font-size: 40px;
}
&__weather {
font-size: 14px;
line-height: 1.5;
text-transform: uppercase;
color: #595959;
text-align: center;
margin-left: 8px;
}
&__temperature {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 8px;
.celsius {
& > span:nth-child(1) {
font-size: 44px;
color: #595959;
}
& > span:nth-child(2) {
font-size: 30px;
color: #595959;
}
}
.wind {
background: var(--theme-color);
border-radius: 8px;
font-size: 12px;
padding: 2px 12px;
color: #fff;
text-align: center;
}
}
}
.calendar {
padding: 0;
&__title {
justify-content: space-between;
align-items: center;
color: #fff;
font-size: 20px;
font-weight: bold;
border-radius: 10px 10px 0 0;
background: var(--theme-color);
padding: 22px;
}
&__body {
background: #fff;
}
}
.flow {
&__body {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 20px;
& > * {
& > div {
cursor: pointer;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
@for $index from 1 through length($btn-colors) {
&:nth-child(#{$index}n) .flow-cover {
background: nth($btn-colors, $index);
}
}
}
.flow-cover {
padding: 10px;
border-radius: 6px;
}
&--icon {
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
width: 30px !important;
height: 30px !important;
color: #fff;
margin-right: 0 !important;
}
&--name {
color: #5a576f;
font-weight: bold;
font-size: 14px;
padding-top: 20px;
text-align: center;
}
}
}
.quick-menu {
&__body {
display: flex;
flex-wrap: wrap;
& > div {
font-weight: bold;
font-size: 16px;
color: #fff;
padding: 14px 20px;
cursor: pointer;
border-radius: 10px;
margin: 10px 10px 0 0;
overflow: hidden;
position: relative;
&::before {
content: "";
width: 86%;
height: 114%;
background: radial-gradient(
100% 100% at 50% 50%,
#0000 0,
#0000 13%,
#fff2 44%,
#0000 44%
)
no-repeat;
position: absolute;
left: -33%;
bottom: -64%;
}
&::after {
content: "";
width: 116%;
height: 152%;
background: radial-gradient(
100% 100% at 50% 50%,
#0000 0,
#0000 13%,
#fff2 44%,
#0000 44%
)
no-repeat;
position: absolute;
right: -56%;
bottom: -79%;
}
}
@for $index from 1 through length($btn-colors) {
& > div:nth-child(#{$index}) {
background: nth($btn-colors, $index);
}
}
}
}
}
}
.todo {
margin-top: 20px;
}
@media (max-width: 992px) {
.body {
padding: 10px;
}
.dashboard {
&-container {
flex-direction: column;
padding: 0;
& > * {
width: 100%;
}
.weather {
display: flex;
&__icon {
font-size: 32px;
}
&__temperature {
.celsius {
& > span:nth-child(1) {
font-size: 32px;
}
& > span:nth-child(2) {
font-size: 20px;
}
}
.wind {
font-size: 11px;
}
}
.center {
margin-left: 0;
}
}
}
}
.todo {
margin-top: 10px;
}
}
</style>
<style lang="scss">
.el-calendar-day:has(.has-attendance) {
position: relative;
&::before {
content: "";
border-radius: 10px;
background: var(--theme-color);
opacity: 0.4;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.sign-in {
margin-top: 4px;
float: right;
color: #fff;
font-size: 10px;
border-radius: 3px;
background: var(--theme-color);
padding: 2px 4px;
margin-left: auto;
}
.sign-out {
margin-top: 4px;
float: right;
color: #fff;
font-size: 10px;
border-radius: 3px;
background-color: #251f83;
padding: 2px 4px;
margin-left: auto;
}
}
@media (max-width: 992px) {
.sign-in,
.sign-out {
float: none !important;
}
&-text {
font-size: 30px;
line-height: 46px;
.el-calendar-table .el-calendar-day {
padding: 2px;
}
}
</style>

@ -96,7 +96,7 @@ export default {
props: {
model: this.form,
'label-position': 'right',
'label-width': '80px',
'label-width': '100px',
rules: this.rules,
'inline-message': true
}

@ -289,6 +289,39 @@ export default {
};
},
methods: {
// urldefault_json
handleDefaultJSON() {
try {
const res = JSON.parse(this.$route.query?.default_json)
console.log('default_json', res)
for (let key in this.$route.query) {
if(/^out_(.*)_id/.test(key)) {
this.form[key] = this.$route.query[key]
}
}
for (let key in res) {
try {
let jsonObj = JSON.parse(res[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] = res[key];
}
}
}
} catch (err) {
console.error(err)
}
},
async print(isLog=false) {
if(isLog) {
const res = await this.$refs['table'].exportData({
@ -342,7 +375,7 @@ export default {
this.subConfig.get(field.sub_custom_model_id)?.customModel?.fields
);
} else {
object[field.name] = "";
object[field.name] = field.default_value ? field.default_value : "";
}
});
},
@ -363,7 +396,7 @@ export default {
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.8)",
});
//detail
// detail
if (/\/detail/.test(this.$route.path) && this.$route.query.flow_id) {
try {
const res = await view(this.$route.query.flow_id);
@ -435,6 +468,7 @@ export default {
});
this.config = res;
this.generateForm(this.form, fields);
this.handleDefaultJSON();
this.form = Object.assign({}, this.form);
loading.close();
} catch (err) {
@ -463,7 +497,7 @@ export default {
});
this.config = res;
this.generateForm(this.form, fields);
this.form = Object.assign({}, this.form);
this.handleDefaultJSON();
const { data } = res?.flow;
for (let key in data) {
try {
@ -485,6 +519,7 @@ export default {
}
}
this.fileList = Object.assign({}, this.fileList);
this.form = Object.assign({}, this.form);
loading.close();
} catch (err) {
console.error(err);

Loading…
Cancel
Save