xy 1 year ago
parent d2c7da0f0d
commit 9e882a93a5

@ -277,8 +277,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
row[info.name].push({ row[info.name].push({
response: response.data.data, response: response.data.data,
name: response.data.data.original_name, name: response.data.data.original_name,
url: response.data.data.url, url: response.data.data.url
TYPE_FILE: 1
}) })
} else { } else {
this.$message.error("上传失败") this.$message.error("上传失败")
@ -316,22 +315,13 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
file.response = file.response.data; file.response = file.response.data;
} }
}); });
this.form[info.name] = fileList.map(i => ({ this.form[info.name] = fileList
...i,
TYPE_FILE: 1
}));
}, },
onRemove: (file, fileList) => { onRemove: (file, fileList) => {
this.form[info.name] = fileList.map(i => ({ this.form[info.name] = fileList
...i,
TYPE_FILE: 1
}));
}, },
onError: (err, file, fileList) => { onError: (err, file, fileList) => {
this.form[info.name] = fileList.map(i => ({ this.form[info.name] = fileList
...i,
TYPE_FILE: 1
}));
this.$message({ this.$message({
type: "warning", type: "warning",
message: err, message: err,
@ -905,21 +895,21 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
}, },
[formItem,(() => { [formItem,(() => {
if (info.is_sign) { if (info.is_sign) {
let log = this.logs.find(log => log.node?.fields?.findIndex(field => field?.field?.name === info.name) !== -1) let log = this.logs.find(log => log.node?.fields?.findIndex(field => field?.field?.name === info.name) !== -1) && (row ? row[info.name] : this.form[info.name])
if (log) { if (log && log.user) {
return h('div',[ return h('div',[
h('el-image',{ h('el-image',{
style: { style: {
'max-height': '80px' 'max-height': '80px'
}, },
props: { props: {
src: log.user.sign_file?.url, src: log.user?.sign_file?.url,
fit: 'contain', fit: 'contain',
alt: log.user.sign_id alt: log.user?.sign_id
}, },
attrs: { attrs: {
src: log.user.sign_file?.url, src: log.user?.sign_file?.url,
alt: log.user.sign_id alt: log.user?.sign_id
} }
}) })
]) ])
@ -930,11 +920,6 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
} }
} }
if (device === "mobile") { if (device === "mobile") {
let findValue = options?.find((i) =>
typeof i === "object"
? i.id === (row ? row[info.name] : this.form[info.name])
: i === (row ? row[info.name] : this.form[info.name])
);
if (info._writeable || pWrite) { if (info._writeable || pWrite) {
switch (info.type) { switch (info.type) {
case "text": case "text":
@ -1024,13 +1009,18 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
}); });
break; break;
case "select": case "select":
let findSelect = options?.find((i) =>
typeof i === "object"
? i.id === (row ? row[info.name] : this.form[info.name])
: i === (row ? row[info.name] : this.form[info.name])
);
formItem = h("van-field", { formItem = h("van-field", {
props: { props: {
readonly: true, readonly: true,
clickable: true, clickable: true,
name: info.name, name: info.name,
label: info.label, label: info.label,
value: typeof findValue === "object" ? findValue.name : findValue, value: typeof findSelect === "object" ? findSelect.name : findSelect,
clearable: true, clearable: true,
placeholder: info.help_text, placeholder: info.help_text,
}, },
@ -1045,13 +1035,22 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
}); });
break; break;
case "choice": case "choice":
let findChoice = info.multiple ? options?.filter((i) =>
typeof i === "object"
? (row ? row[info.name].indexOf(i.id) !== -1 : this.form[info.name].indexOf(i.id) !== -1)
: i === (row ? row[info.name] : this.form[info.name])
) : options?.find((i) =>
typeof i === "object"
? i.id === (row ? row[info.name] : this.form[info.name])
: i === (row ? row[info.name] : this.form[info.name])
);
formItem = h("van-field", { formItem = h("van-field", {
props: { props: {
readonly: true, readonly: true,
clickable: true, clickable: true,
name: info.name, name: info.name,
label: info.label, label: info.label,
value: typeof findValue === "object" ? findValue.name : findValue, value: (findChoice instanceof Array) ? (findChoice.map(i => typeof i === "object" ? i.name : i).toString()) : (typeof findChoice === "object" ? findChoice.name : findChoice),
clearable: true, clearable: true,
placeholder: info.help_text, placeholder: info.help_text,
}, },
@ -1190,13 +1189,18 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
]) ])
break; break;
case 'relation-flow': case 'relation-flow':
let findFlow = options?.find((i) =>
typeof i === "object"
? i.id === (row ? row[info.name] : this.form[info.name])
: i === (row ? row[info.name] : this.form[info.name])
);
formItem = h("van-field", { formItem = h("van-field", {
props: { props: {
readonly: true, readonly: true,
clickable: true, clickable: true,
name: info.name, name: info.name,
label: info.label, label: info.label,
value: typeof findValue === "object" ? (findValue.name || findValue.title) : findValue, value: typeof findFlow === "object" ? (findFlow.name || findFlow.title) : findFlow,
clearable: true, clearable: true,
placeholder: info.help_text, placeholder: info.help_text,
}, },
@ -1327,7 +1331,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
); );
break; break;
case "select": case "select":
let findValue = options.find((i) => let findSelect = options.find((i) =>
typeof i === "object" typeof i === "object"
? i.id === this.form[info.name] ? i.id === this.form[info.name]
: i === this.form[info.name] : i === this.form[info.name]
@ -1340,12 +1344,32 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
}, },
props: { props: {
title: info.label, title: info.label,
value: typeof findValue === "object" ? findValue.name : findValue value: typeof findSelect === "object" ? findSelect.name : findSelect
}
},
);
break;
case 'choice':
let findChoice = options.find((i) =>
typeof i === "object"
? i.id === this.form[info.name]
: i === this.form[info.name]
);
formItem = h(
"van-cell",
{
attrs: {
for: info.name
},
props: {
title: info.label,
value: typeof findChoice === "object" ? findChoice.name : findChoice
} }
}, },
); );
break; break;
case 'file': case 'file':
let files = (row ? row[info.name] : this.form[info.name])
formItem = h( formItem = h(
"van-cell", "van-cell",
{ {
@ -1356,12 +1380,11 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
title: info.label, title: info.label,
} }
}, },
(row ? row[info.name] : this.form[info.name]).map(file => h("div", {}, [ ((files && files !== 'null' && files !== 'undefined') ? files : [])?.map(file => h("div", {}, [
h( h(
"a", "a",
{ {
attrs: { attrs: {
href: file.url,
download: file.name, download: file.name,
}, },
class: { class: {
@ -1370,6 +1393,11 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
style: { style: {
padding: "0 4px", padding: "0 4px",
}, },
on: {
click:_ => {
this.$bus.$emit('online-file', file.url)
}
}
}, },
file.name file.name
), ),
@ -1386,7 +1414,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab
}), }),
h( h(
"div", "div",
this.form[info.name].map((sForm, sIndex) => this.form[info.name]?.map((sForm, sIndex) =>
h( h(
"van-cell-group", "van-cell-group",
{ {

@ -21,10 +21,31 @@
:data="tableData" :data="tableData"
> >
<vxe-column type="seq" width="58" align="center" /> <vxe-column type="seq" width="58" align="center" />
<vxe-column field="vehicle.name" align="center" width="120" title="车牌号码" />
<vxe-column field="name" width="170" title="证书名称" :edit-render="{ name: 'input', attrs: { type: 'text' } }" /> <vxe-column field="name" width="170" title="证书名称" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
<vxe-column field="key" width="150" title="标识" :edit-render="{ name: 'input', attrs: { type: 'text' } }" /> <vxe-column field="serial" width="170" title="证照编号" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
<vxe-column field="value" width="150" title="值" :edit-render="{ name: 'input', attrs: { type: 'text' } }" /> <vxe-column field="grant_by" width="170" align="center" title="发放单位" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
<vxe-column field="mysort" width="80" title="排序" align="center" :edit-render="{ name: 'input', attrs: { type: 'number' } }" /> <vxe-column field="grant_at" width="170" align="center" title="发放日期" :edit-render="{}">
<template #edit="{ row }">
<el-date-picker v-model="row.grant_at" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
</template>
</vxe-column>
<vxe-column field="expire_at" width="170" align="center" title="到期日期" :edit-render="{}">
<template #edit="{ row }">
<el-date-picker v-model="row.expire_at" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
</template>
</vxe-column>
<vxe-column field="renewed_at" width="170" align="center" title="续期日期" :edit-render="{}">
<template #edit="{ row }">
<el-date-picker v-model="row.renewed_at" value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
</template>
</vxe-column>
<vxe-column field="renewed.original_name" title="续签证书" min-width="180" header-align="center" align="left" :edit-render="{}">
<template #edit="{ row }">
<vxe-upload v-model="row.renewed" progress-text="{percent}%" :more-config="{ maxCount: 1, layout: 'horizontal' }" :limit-size="20" :show-button-text="false" :upload-method="({file}) => uploadMethod(file, row)"></vxe-upload>
</template>
</vxe-column>
<vxe-column field="operate" title="操作" min-width="220"> <vxe-column field="operate" title="操作" min-width="220">
<template #default="{ row }"> <template #default="{ row }">
<template v-if="isActiveStatus(row)"> <template v-if="isActiveStatus(row)">
@ -66,6 +87,8 @@ import { index as vehicleIndex } from '@/api/vehicle'
import { deepCopy } from '@/utils' import { deepCopy } from '@/utils'
import { index, save, destroy } from '@/api/vehicleCertificate' import { index, save, destroy } from '@/api/vehicleCertificate'
import AddVehicleCertificate from './components/AddVehicleCertificate.vue' import AddVehicleCertificate from './components/AddVehicleCertificate.vue'
import axios from "axios";
import {getToken} from "@/utils/auth";
export default { export default {
components: { components: {
AddVehicleCertificate AddVehicleCertificate
@ -112,6 +135,22 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
uploadMethod(file, row) {
const formData = new FormData()
formData.append('file', file)
return axios.post(process.env.VUE_APP_UPLOAD_API, formData, {
headers: {
Authorization: `Bearer ${getToken()}`,
}
}).then((response) => {
if (response.status === 200 && !response.data.code) {
row.renewed_id = response.data.data.id
row.renewed = response.data.data
} else {
this.$message.error("上传失败")
}
})
},
editRowEvent(row) { editRowEvent(row) {
if (this.$refs['table']) { if (this.$refs['table']) {
this.$refs['table'].setEditRow(row) this.$refs['table'].setEditRow(row)

@ -171,24 +171,20 @@
</div> </div>
<div class="mycard__body flow__body"> <div class="mycard__body flow__body">
<router-link <div
:to="'/flow/create?module_id=' + item.id"
tag="div"
v-for="item in usualFlows" v-for="item in usualFlows"
:key="item.key" :key="item.key"
> @click="toCreate(item)">
<div> <div class="flow-cover">
<div class="flow-cover"> <template v-if="item.icon">
<template v-if="item.icon"> <Icon class="flow__body--icon" :icon="item.icon"></Icon>
<Icon class="flow__body--icon" :icon="item.icon"></Icon> </template>
</template> <template v-else>
<template v-else> <i class="el-icon-edit flow__body--icon"></i>
<i class="el-icon-edit flow__body--icon"></i> </template>
</template>
</div>
<span class="flow__body--name">{{ item.name }}</span>
</div> </div>
</router-link> <span class="flow__body--name">{{ item.name }}</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -287,6 +283,7 @@ import { getToken } from "@/utils/auth";
import { flow } from "@/api/flow"; import { flow } from "@/api/flow";
import { index as configIndex } from "@/api/config"; import { index as configIndex } from "@/api/config";
import { index } from "@/api/attendance"; import { index } from "@/api/attendance";
import {isExternal} from "@/utils/validate";
export default { export default {
name: "Dashboard", name: "Dashboard",
components: { components: {
@ -385,6 +382,23 @@ export default {
} }
}, },
methods: { methods: {
toCreate(flow, cate) {
if(isExternal(flow.url)) {
const url = new URL(flow.url)
window.open(flow.url,'_blank')
} else if (flow.url) {
if (/\?.+/g.test(flow.url)) {
window.open(window.location.origin + flow.url,'_blank')
}
} else {
this.$router.push({
path: '/flow/create',
query: {
module_id: flow.id
}
})
}
},
getTodayAttendance(date,key = 'attendance') { getTodayAttendance(date,key = 'attendance') {
let temp = this.attendanceData.attendances.find((i) => i.date === date) ?? {} let temp = this.attendanceData.attendances.find((i) => i.date === date) ?? {}
return temp[key] return temp[key]
@ -737,15 +751,15 @@ $btn-colors: linear-gradient(90deg, #d4bbfd 0%, #af7bff 100%),
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
grid-gap: 20px; grid-gap: 20px;
& > div {
cursor: pointer;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
& > * { & > * {
& > div {
cursor: pointer;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
@for $index from 1 through length($btn-colors) { @for $index from 1 through length($btn-colors) {
&:nth-child(#{$index}n) .flow-cover { &:nth-child(#{$index}n) .flow-cover {

@ -47,13 +47,19 @@ export default {
default: () => [], default: () => [],
required: true required: true
}, },
fileList: { scriptContent: String,
rules: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
required: true
}, },
scriptContent: String subRules: {
type: Object,
default: () => ({}),
},
logs: {
type: Array,
default: () => []
}
}, },
data() { data() {
return { return {
@ -109,9 +115,6 @@ export default {
originalForm(newVal) { originalForm(newVal) {
this.form = deepCopy(newVal) this.form = deepCopy(newVal)
}, },
fileList(newVal) {
this.file = deepCopy(newVal)
},
scriptContent(newVal) { scriptContent(newVal) {
if(newVal) { if(newVal) {
try { try {
@ -133,6 +136,7 @@ export default {
_readable: this.readable.indexOf(field.id) !== -1, _readable: this.readable.indexOf(field.id) !== -1,
_writeable: this.writeable.indexOf(field.id) !== -1 _writeable: this.writeable.indexOf(field.id) !== -1
})) }))
const subFields = Array.from(this.subForm).map(i => i[1]?.customModel?.fields).filter(i => i).flat()
return h('div',[ return h('div',[
h('van-form',{ h('van-form',{
props: { props: {
@ -140,10 +144,11 @@ export default {
} }
},authFields.map(field => formBuilder.bind(this)(this.device, field, h))), },authFields.map(field => formBuilder.bind(this)(this.device, field, h))),
//calendar //calendar
authFields.findIndex(i => i.type === 'date') !== -1 ? (authFields.findIndex(i => i.type === 'date') !== -1 || subFields.findIndex(i => i.type === 'date')) ?
h('van-calendar',{ h('van-calendar',{
ref: `vanCalendar`, ref: `vanCalendar`,
props: { props: {
position: 'bottom',
value: this.vanCalendarOption.isShow, value: this.vanCalendarOption.isShow,
'min-date': this.$moment().subtract('years',10).toDate(), 'min-date': this.$moment().subtract('years',10).toDate(),
'max-date': this.$moment().add('years',10).toDate(), 'max-date': this.$moment().add('years',10).toDate(),
@ -164,7 +169,7 @@ export default {
} }
}) : '', }) : '',
//datetimepicker //datetimepicker
authFields.findIndex(i => i.type === 'datetime') !== -1 ? (authFields.findIndex(i => i.type === 'datetime') !== -1 || subFields.findIndex(i => i.type === 'datetime') !== -1) ?
h('van-popup',{ h('van-popup',{
props: { props: {
value: this.vanTimePickerOption.isShow, value: this.vanTimePickerOption.isShow,
@ -184,7 +189,6 @@ export default {
on: { on: {
confirm: time => { confirm: time => {
if(typeof this.vanTimePickerOption.originalObj === 'object') { if(typeof this.vanTimePickerOption.originalObj === 'object') {
console.log(this.vanTimePickerOption.originalObj)
this.$set(this.vanTimePickerOption.originalObj,this.vanTimePickerOption.forFormName,moment(time).format('YYYY-MM-DD HH:mm:ss')) this.$set(this.vanTimePickerOption.originalObj,this.vanTimePickerOption.forFormName,moment(time).format('YYYY-MM-DD HH:mm:ss'))
} else { } else {
this.$set(this.form,this.vanTimePickerOption.forFormName,moment(time).format('YYYY-MM-DD HH:mm:ss')) this.$set(this.form,this.vanTimePickerOption.forFormName,moment(time).format('YYYY-MM-DD HH:mm:ss'))
@ -198,7 +202,7 @@ export default {
}) })
]) : '', ]) : '',
//popup //popup
authFields.findIndex(i => i.type === 'select') !== -1 ? (authFields.findIndex(i => i.type === 'select') !== -1 || subFields.findIndex(i => i.type === 'select') !== -1) ?
h('van-popup',{ h('van-popup',{
props: { props: {
value: this.vanPopupOption.isShow, value: this.vanPopupOption.isShow,
@ -232,7 +236,7 @@ export default {
}) })
]) : '', ]) : '',
// //
authFields.findIndex(i => ['relation-flow','choice','choices'].indexOf(i.type) !== -1) !== -1 ? (authFields.findIndex(i => ['relation-flow','choice','choices'].indexOf(i.type) !== -1) !== -1 || subFields.findIndex(i => ['relation-flow','choice','choices'].indexOf(i.type) !== -1) !== -1) ?
h('van-popup',{ h('van-popup',{
props: { props: {
value: this.multipleSelectOption.isShow, value: this.multipleSelectOption.isShow,

@ -66,9 +66,11 @@
:fields="fields" :fields="fields"
:original-form="form" :original-form="form"
:readable="readableFields" :readable="readableFields"
:file-list="fileList"
:script-content="scriptContent" :script-content="scriptContent"
:writeable="writeableFields" :writeable="writeableFields"
:rules="rules"
:sub-rules="subRules"
:logs="config.logs"
></MobileForm> ></MobileForm>
</template> </template>
</div> </div>
@ -699,7 +701,7 @@ export default {
keys.forEach(key => { keys.forEach(key => {
if (form[key] instanceof Array) { if (form[key] instanceof Array) {
if (form[key].length > 0) { if (form[key].length > 0) {
if (form[key][0].hasOwnProperty('TYPE_FILE') && form[key][0]['TYPE_FILE']) { if (form[key][0].hasOwnProperty('response')) {
form[key] = form[key].map(i => i.response) form[key] = form[key].map(i => i.response)
} else { } else {
form[key].forEach(i => { form[key].forEach(i => {

@ -91,10 +91,10 @@ export default {
toCreate(flow,cate) { toCreate(flow,cate) {
if(isExternal(flow.url)) { if(isExternal(flow.url)) {
const url = new URL(flow.url) const url = new URL(flow.url)
if (/\?.+/g.test(url.hash)) { window.open(flow.url,'_blank')
window.open(flow.url + `&auth_token=${getToken()}`,'_blank') } else if (flow.url) {
} else { if (/\?.+/g.test(flow.url)) {
window.open(flow.url + `?auth_token=${getToken()}`,'_blank') window.open(window.location.origin + flow.url,'_blank')
} }
} else { } else {
this.$router.push({ this.$router.push({

@ -191,9 +191,59 @@
> >
</template> </template>
</vxe-column> </vxe-column>
<vxe-column v-if="device === 'mobile'" field="m-operate" type="expand" width="60" fixed="left"> <template v-if="$store.getters.device === 'mobile'">
<template #content="{ row }"> <vxe-column field="m-operate" type="expand" width="60" fixed="left">
<div> <template #content="{ row }">
<div>
<template v-if="$route.params.type !== 'all'">
<el-button
v-if="row.my_log"
type="primary"
size="mini"
@click="handle(row)"
>办理</el-button
>
<el-button
plain
type="primary"
size="mini"
@click="copyTo(row)"
>抄送</el-button
>
<el-button
v-if="row.can_recall"
plain
type="danger"
size="mini"
@click="recall(row)"
>撤回</el-button
>
<el-button
v-if="row.can_delete"
plain
type="danger"
size="mini"
@click="destroy(row)"
>删除</el-button
>
</template>
<el-button plain type="success" size="mini" @click="detail(row)"
>查看</el-button
>
</div>
</template>
</vxe-column>
</template>
<template v-else>
<vxe-column
min-width="280"
header-align="center"
field="operate"
title="操作"
fixed="right"
>
<template #default="{ row }">
<template v-if="$route.params.type !== 'all'"> <template v-if="$route.params.type !== 'all'">
<el-button <el-button
v-if="row.my_log" v-if="row.my_log"
@ -230,56 +280,9 @@
<el-button plain type="success" size="mini" @click="detail(row)" <el-button plain type="success" size="mini" @click="detail(row)"
>查看</el-button >查看</el-button
> >
</div>
</template>
</vxe-column>
<vxe-column
v-if="device === 'desktop'"
min-width="280"
header-align="center"
field="operate"
title="操作"
fixed="right"
>
<template #default="{ row }">
<template v-if="$route.params.type !== 'all'">
<el-button
v-if="row.my_log"
type="primary"
size="mini"
@click="handle(row)"
>办理</el-button
>
<el-button
plain
type="primary"
size="mini"
@click="copyTo(row)"
>抄送</el-button
>
<el-button
v-if="row.can_recall"
plain
type="danger"
size="mini"
@click="recall(row)"
>撤回</el-button
>
<el-button
v-if="row.can_delete"
plain
type="danger"
size="mini"
@click="destroy(row)"
>删除</el-button
>
</template> </template>
</vxe-column>
<el-button plain type="success" size="mini" @click="detail(row)" </template>
>查看</el-button
>
</template>
</vxe-column>
</vxe-table> </vxe-table>
<el-pagination <el-pagination
@ -498,9 +501,6 @@ export default {
}, },
}, },
computed: { computed: {
device() {
return this.$store.getters.device
}
}, },
created() { created() {
this.getList(); this.getList();

Loading…
Cancel
Save