|
|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
<!-- 查询配置 -->
|
|
|
|
|
<div>
|
|
|
|
|
<div ref="lxHeader">
|
|
|
|
|
<LxHeader icon="md-apps" :text="customForm.tableName" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
|
|
|
|
<LxHeader icon="md-apps" :text="title || customForm.tableName" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
|
|
|
|
<div slot="content"></div>
|
|
|
|
|
<slot>
|
|
|
|
|
<header-content :auths="auths_auth_mixin">
|
|
|
|
|
@ -93,10 +93,17 @@
|
|
|
|
|
>新增</Button
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
<template #import>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="$refs['imports'].show()"
|
|
|
|
|
>导入</Button
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
<template #export>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="download('/api/admin/base-form/index','get',Object.assign(select,{ page: 1,page_size: 9999,is_export: 1 }),`${new Date().getTime()}.xlsx`)"
|
|
|
|
|
@click="exportExcel(new Date().getTime().toString())"
|
|
|
|
|
>导出</Button
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
@ -129,6 +136,7 @@
|
|
|
|
|
|
|
|
|
|
<dialoger :table-name="customForm.tableName" :form-info="form" ref="dialog" @refresh="$refs['xyTable'].getTableData()"></dialoger>
|
|
|
|
|
<drawer :table-name="customForm.tableName" :form-info="form" ref="drawer"></drawer>
|
|
|
|
|
<imports :table-name="customForm.tableName" :form-info="form" ref="imports" @refresh="$refs['xyTable'].getTableData()"></imports>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -139,21 +147,27 @@ import { index,destroy } from "@/api/system/baseForm";
|
|
|
|
|
import { op } from "@/const/op";
|
|
|
|
|
import { download } from "@/utils/downloadRequest";
|
|
|
|
|
import { getparameter } from "@/api/system/dictionary";
|
|
|
|
|
import { show } from "@/api/system/customForm";
|
|
|
|
|
import * as XLSX from "xlsx";
|
|
|
|
|
import { saveAs } from "file-saver";
|
|
|
|
|
|
|
|
|
|
import dialoger from './dialog.vue';
|
|
|
|
|
import LxHeader from "@/components/LxHeader/index.vue";
|
|
|
|
|
import headerContent from "@/components/LxHeader/XyContent.vue";
|
|
|
|
|
import drawer from "@/views/component/drawer.vue";
|
|
|
|
|
import imports from "./imports.vue"
|
|
|
|
|
export default {
|
|
|
|
|
components:{
|
|
|
|
|
LxHeader,
|
|
|
|
|
dialoger,
|
|
|
|
|
headerContent,
|
|
|
|
|
drawer,
|
|
|
|
|
imports
|
|
|
|
|
},
|
|
|
|
|
mixins: [authMixin],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
title: "",
|
|
|
|
|
op,
|
|
|
|
|
select: {
|
|
|
|
|
table_name: "",
|
|
|
|
|
@ -185,6 +199,27 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async exportExcel(sheetName) {
|
|
|
|
|
const res = await index(Object.assign(this.select,{ page: 1,page_size: 9999}))
|
|
|
|
|
if(res.data){
|
|
|
|
|
let headers = this.form.map(i => {
|
|
|
|
|
return {
|
|
|
|
|
key: i.field,
|
|
|
|
|
title: i.name
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const data = res.data.map(row => headers.map(header => row[header.key]));
|
|
|
|
|
data.unshift(headers.map(header => header.title));
|
|
|
|
|
const wb = XLSX.utils.book_new();
|
|
|
|
|
const ws = XLSX.utils.aoa_to_sheet(data);
|
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
|
|
|
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
|
|
|
|
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), `${sheetName}.xlsx`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// download('/api/admin/base-form/index','get',Object.assign(select,{ page: 1,page_size: 9999,is_export: 1 }),`${new Date().getTime()}.xlsx`)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//target要为内存地址引用类型
|
|
|
|
|
inputStartHandler(e,target) {
|
|
|
|
|
let temp = target?.value.split(',')[1]
|
|
|
|
|
@ -195,6 +230,11 @@ export default {
|
|
|
|
|
target.value = `${temp ? temp : ""},${e}`
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async getFormDetail() {
|
|
|
|
|
const res = await show({ id: this.customForm.customFormId },false)
|
|
|
|
|
this.title = res.name
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async getField() {
|
|
|
|
|
if(this.$route.meta.params?.custom_form) {
|
|
|
|
|
let decode = decodeURIComponent(this.$route.meta.params?.custom_form)
|
|
|
|
|
@ -218,9 +258,6 @@ export default {
|
|
|
|
|
if(res.data && res.data instanceof Array) {
|
|
|
|
|
res.data.forEach(i => {
|
|
|
|
|
if (i.field) {
|
|
|
|
|
if (i.edit_input === "file" || i.edit_input === "files") {
|
|
|
|
|
i._fileList = [];
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
(i.edit_input === "checkbox" || i.edit_input === "radio") &&
|
|
|
|
|
i.parameter_id
|
|
|
|
|
@ -294,7 +331,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getField()
|
|
|
|
|
|
|
|
|
|
this.getFormDetail()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|