master
xy 3 years ago
parent 4f93158656
commit 1e7b8951ac

@ -895,7 +895,9 @@ export default {
</af-table-column>
);
})}
{ this.auths.length > 0 ? this.isCreateAuthBtns() : '' }
{
$scopedSlots.btns ? $scopedSlots.btns() : (this.auths.length > 0 ? this.isCreateAuthBtns() : '')
}
</el-table>
) : (
<el-table ref="table" v-loading={this.loading} height={this.height ?? this.tableHeight} />

@ -62,23 +62,28 @@ export const constantRoutes = [
children: [
{
path: 'home',
component: () => import('@/views/reception/home')
component: () => import('@/views/reception/home'),
meta: { title: '内部质量保证体系资料汇编'}
},
{
path: 'department',
component: () => import('@/views/reception/department')
component: () => import('@/views/reception/department'),
meta: { title: '部门'}
},
{
path: 'label',
component: () => import('@/views/reception/label')
component: () => import('@/views/reception/label'),
meta: { title: '标签'}
},
{
path: 'list1',
component: () => import('@/views/reception/list1')
component: () => import('@/views/reception/list1'),
meta: { title: '内部质量保证体系资料汇编'}
},
{
path: 'list2',
component: () => import('@/views/reception/list2')
component: () => import('@/views/reception/list2'),
meta: { title: '内部质量保证体系资料汇编'}
}
],
hidden: true

@ -60,7 +60,7 @@ export default {
},
},
this.$scopedSlots[i.field]
? this.$scopedSlots[i.field]({ fieldInfo: i, form: this.form })
? this.$scopedSlots[i.field]({ fieldInfo: i, form: this.form, file: this.file })
: [
h(
domMap.get(i.edit_input),
@ -119,6 +119,9 @@ export default {
"uploaded-a":
file.status === "success",
},
style: {
'padding': '0 4px'
},
},
file.name
),
@ -216,7 +219,7 @@ export default {
? info._params.map((i) =>
h("el-option", {
props: {
label: i.key || i.name || i.no || i.value || i.id,
label: i.key || i.value || i.name || i.no || i.mingcheng || i.id,
value: info._relations ? i[info._relations.foreign_key] : i.value,
},
})
@ -337,14 +340,21 @@ export default {
this.form = Object.assign({}, this.form);
this.formInfo.forEach((i) => {
if (i && i.edit_input === "file") {
this.file[i.field] = [
{
name: res[i.link_with_name]?.original_name,
url: res[i.link_with_name]?.url,
response: res[i.link_with_name],
},
];
if (i && (i.edit_input === "file" || i.edit_input === 'files')) {
res[i._relations.link_with_name] ? (
this.file[i.field] = res[i._relations.link_with_name] instanceof Array ? res[i._relations.link_with_name].map(i => {
return {
name: i?.original_name,
url: i?.url,
response: i
}
}) : [{
name: res[i._relations.link_with_name]?.original_name,
url: res[i._relations.link_with_name]?.url,
response: res[i._relations.link_with_name]
}]
) : this.file[i.field] = []
}
});
},
@ -354,6 +364,11 @@ export default {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
//TODO:
if (/^\/manage/.test(this.$route.path)) {
this.form['zhuangtai'] = 0
}
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
@ -366,16 +381,32 @@ export default {
this.$refs["elForm"].validate((validate) => {
if (validate) {
this.formInfo.forEach((info) => {
if (info.edit_input === "files") {
this.form[info.field] = info._fileList.map(
(i) => i?.response?.id
);
}
if (info.edit_input === "file") {
this.form[info.field] = this.file[info.field][0]?.response?.id;
if (info._relations?.link_with_name) {
if (info.edit_input === "files" || info.edit_input === "file") {
this.form[info._relations.link_with_name] = this.file[info.field].map(i => {
return {
[info._relations.foreign_key]: i?.response?.id
}
});
delete this.form[info.field]
} else {
this.form[info._relations.link_with_name] = this.form[info.field] instanceof Array ? this.form[info.field].map(i => {
return {
[info._relations.foreign_key]: i
}
}) : [{ [info._relations.foreign_key]: this.form[info.field] }]
delete this.form[info.field]
}
}
// if (info.edit_input === "files") {
// this.form[info.field] = this.file[info.field].map(
// (i) => i?.response?.id
// );
// }
// if (info.edit_input === "file") {
// this.form[info.field] = this.file[info.field][0]?.response?.id;
// }
});
console.log(this.form);
save(Object.assign(this.form, { table_name: this.tableName })).then(
(res) => {
this.$Message.success({
@ -417,6 +448,13 @@ export default {
if (i.edit_input === "checkbox") {
this.form[i.field] = [];
}
//TODO:
if (this.tableName === 'materials') {
if (i.field === 'leixing') {
this.form[i.field] = Number(this.$route.meta.params.type);
}
}
}
});
},

@ -5,7 +5,7 @@
<div ref="lxHeader">
<LxHeader
icon="md-apps"
:text="title || customForm.tableName"
:text="$route.meta.title"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
>
<div slot="content"></div>
@ -14,7 +14,7 @@
<template #search>
<div style="display: flex">
<Select
v-model="select.filter[0].key"
v-model="select.filter[1].key"
style="width: 100px"
placeholder="搜索条目"
>
@ -26,7 +26,7 @@
>
</Select>
<Select
v-model="select.filter[0].op"
v-model="select.filter[1].op"
style="width: 100px; margin-left: 10px"
placeholder="搜索条件"
>
@ -39,43 +39,43 @@
</Select>
<template
v-if="
select.filter[0].op !== 'range' &&
!columnArrTest(select.filter[0].key)
select.filter[1].op !== 'range' &&
!columnArrTest(select.filter[1].key)
"
>
<Input
v-model="select.filter[0].value"
v-model="select.filter[1].value"
style="width: 150px; margin-left: 10px"
placeholder="请填写关键词"
/>
</template>
<template
v-else-if="
select.filter[0].op !== 'range' &&
columnArrTest(select.filter[0].key)
select.filter[1].op !== 'range' &&
columnArrTest(select.filter[1].key)
"
>
<Select
v-model="select.filter[0].value"
v-model="select.filter[1].value"
style="width: 150px; margin-left: 10px"
placeholder="请选择关键词"
>
<Option
v-for="item in getColumnParams(select.filter[0].key)"
v-for="item in getColumnParams(select.filter[1].key)"
:key="item.id"
:value="getColumnField(select.filter[0].key)._relations ? item[getColumnField(select.filter[0].key)._relations.foreign_key] : item.value"
:value="getColumnField(select.filter[1].key)._relations ? item[getColumnField(select.filter[1].key)._relations.foreign_key] : item.value"
>{{
item.key || item.value || item.name || item.no || item.id
item.key || item.value || item.name || item.no || item.mingcheng || item.id
}}</Option
>
</Select>
</template>
<template v-else>
<Input
:value="select.filter[0].value.split(',')[0]"
:value="select.filter[1].value.split(',')[1]"
style="width: 150px; margin-left: 10px"
placeholder="范围开始关键词"
@input="(e) => inputStartHandler(e, select.filter[0])"
@input="(e) => inputStartHandler(e, select.filter[1])"
/>
<span
style="
@ -86,10 +86,10 @@
></span
>
<Input
:value="select.filter[0].value.split(',')[1]"
:value="select.filter[1].value.split(',')[1]"
style="width: 150px; margin-left: 10px"
placeholder="范围结束关键词"
@input="(e) => inputEndHandler(e, select.filter[0])"
@input="(e) => inputEndHandler(e, select.filter[1])"
/>
</template>
<Button
@ -110,8 +110,9 @@
class="select__item"
v-for="(item, index) in select.filter"
:key="`${item.value}-${index}`"
v-if="index !== 0"
>
<p>条件{{ index + 1 }}</p>
<p>条件{{ index }}</p>
<Select
v-model="item.key"
style="width: 100px"
@ -162,7 +163,7 @@
:key="item.id"
:value="getColumnField(item.key)._relations ? item[getColumnField(item.key)._relations.foreign_key] : item.value"
>{{
item.key || item.value || item.name || item.no || item.id
item.key || item.value || item.name || item.no || item.mingcheng || item.id
}}</Option
>
</Select>
@ -244,7 +245,7 @@
:border="true"
:action="index"
:req-opt="select"
:destroy-req-opt="select"
:destroy-req-opt="{ 'table_name': customForm.tableName }"
:table-item="table"
@detail="
(row) => {
@ -268,6 +269,9 @@
ref="dialog"
@refresh="$refs['xyTable'].getTableData()"
>
<template #fujian="{ fieldInfo, form, file }" v-if="$route.meta.params && $route.meta.params.type == 1">
<flow :field-info="fieldInfo" :form="form" :file="file"></flow>
</template>
</dialoger>
<drawer
:table-name="customForm.tableName"
@ -293,12 +297,15 @@ import { getparameter } from "@/api/system/dictionary";
import { show } from "@/api/system/customForm";
import * as XLSX from "xlsx";
import { saveAs } from "file-saver";
import { listdept } from "@/api/system/department";
import { deepCopy } from "@/utils";
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";
import flow from "@/views/flow/flow.vue"
export default {
components: {
LxHeader,
@ -306,6 +313,8 @@ export default {
headerContent,
drawer,
imports,
flow
},
mixins: [authMixin],
provide: {
@ -313,11 +322,15 @@ export default {
},
data() {
return {
title: "",
op,
select: {
table_name: "",
filter: [
{
key: "leixing",
op: "eq",
value: this.$route.meta.params?.type,
},
{
key: "",
op: "",
@ -338,8 +351,13 @@ export default {
destroy,
download,
reset() {
this.select.filter.splice(1);
this.select.filter.splice(2);
this.select.filter[0] = {
key: "leixing",
op: "eq",
value: this.$route.meta.params?.type,
};
this.select.filter[1] = {
key: "",
op: "",
value: "",
@ -400,9 +418,16 @@ export default {
}
const res = await show({ id: this.customForm.customFormId }, false);
this.title = res.name;
//
//
let baseTable = new Map([
['departments', async () => {
const res = await listdept()
return res
}],
['admins',[]]
])
let { fields, relation } = res;
if (
!fields ||
@ -423,49 +448,28 @@ export default {
}
})
}
if (i.edit_input === 'file' || i.edit_input === 'files') {
return
}
if (i._relations) {
i._params = i._relations.parameter_id
? getparameter({ id: i._relations.parameter_id },false).then((res) => {
i._params = res.detail;
})
: this.index({
table_name: i._relations.link_table_name,
page: 1,
page_size: 9999,
}).then((res) => {
i._params = res.data;
});
if (baseTable.get(i._relations.link_table_name)) {
baseTable.get(i._relations.link_table_name)().then(res => i._params = res)
} else {
i._params = i._relations.parameter_id
? getparameter({ id: i._relations.parameter_id },false).then((res) => {
i._params = res.detail;
})
: this.index({
table_name: i._relations.link_table_name,
page: 1,
page_size: 9999,
}).then((res) => {
i._params = res.data;
});
}
}
});
this.form = fields;
console.log(111, this.form);
// if(res.fields && res.fields instanceof Array) {
// res.fields.forEach(i => {
// if (i.field) {
// if (
// (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") &&
// i.parameter_id
// ) {
// getparameter({ id: i.parameter_id }).then((res) => {
// i._paramters = res.detail ?? [];
// });
// }
// if (
// (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") &&
// i.link_table_name
// ) {
// index({
// page: 1,
// page_size: 999,
// table_name: i.link_table_name,
// }).then((res) => {
// i._paramters = res.data ?? [];
// });
// }
// }
// })
// }
// this.form = res.fields
this.table = this.form
?.filter((i) => i.list_show)
.map((i) => {
@ -562,7 +566,10 @@ export default {
? this.form.find((i) => i.field === field)._params
: [];
};
}
},
//TODO:
},
created() {
this.getFormDetail();

@ -0,0 +1,52 @@
<template>
<div>
<el-button size="small" type="primary" icon="el-icon-s-order" @click="$refs['formList'].show()"></el-button>
<el-button size="small" type="primary" icon="el-icon-plus">表单新增</el-button>
<el-upload
class="upload"
ref="upload"
:action="action"
:file-list="fileList"
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="">上传到服务器</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<formList ref="formList"></formList>
</div>
</template>
<script>
import formList from './formList.vue';
export default {
components: {
formList
},
props: {
form: Object,
fieldInfo: Object,
file: Object,
},
data() {
return {
action: process.env.VUE_APP_UPLOAD_API,
}
},
methods: {},
computed: {
fileList () {
return (this.file && this.fieldInfo?.field) ? this.file[this.fieldInfo.field] : []
}
},
}
</script>
<style scoped lang="scss">
.upload {
margin-top: 10px;
}
</style>

@ -0,0 +1,67 @@
<template>
<div>
<el-dialog
:append-to-body="true"
title="表单中心"
:visible.sync="dialogVisible"
width="30%">
<template>
<Table></Table>
</template>
<template #footer>
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</template>
</el-dialog>
</div>
</template>
<script>
import { index } from "@/api/system/baseForm"
export default {
data() {
return {
dialogVisible: false,
data: [],
table: [],
select: {
page: 1,
page_size: 10,
table_name: 'materials',
filter: [
{
key: 'leixing',
op: 'eq',
value: 2
}
]
}
}
},
methods: {
show() {
this.dialogVisible = true
},
hide() {
this.dialogVisible = false
},
async getData() {
const res = await index(this.select)
console.log(111,res)
}
},
computed: {},
watch: {
dialogVisible(newVal) {
if (newVal) {
this.getData()
}
}
}
}
</script>
<style scoped lang="scss">
</style>

@ -353,6 +353,11 @@ export default {
align-items: center;
justify-content: center;
cursor: pointer;
transition: all .4s;
&:hover {
transform: scale(1.1, 1.1);
}
}
&__left--single {
flex: 2.2;

Loading…
Cancel
Save