master
xy 3 years ago
parent 4f93158656
commit 1e7b8951ac

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

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

@ -60,7 +60,7 @@ export default {
}, },
}, },
this.$scopedSlots[i.field] 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( h(
domMap.get(i.edit_input), domMap.get(i.edit_input),
@ -119,6 +119,9 @@ export default {
"uploaded-a": "uploaded-a":
file.status === "success", file.status === "success",
}, },
style: {
'padding': '0 4px'
},
}, },
file.name file.name
), ),
@ -216,7 +219,7 @@ export default {
? info._params.map((i) => ? info._params.map((i) =>
h("el-option", { h("el-option", {
props: { 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, value: info._relations ? i[info._relations.foreign_key] : i.value,
}, },
}) })
@ -337,14 +340,21 @@ export default {
this.form = Object.assign({}, this.form); this.form = Object.assign({}, this.form);
this.formInfo.forEach((i) => { this.formInfo.forEach((i) => {
if (i && i.edit_input === "file") { if (i && (i.edit_input === "file" || i.edit_input === 'files')) {
this.file[i.field] = [ 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 => {
name: res[i.link_with_name]?.original_name, return {
url: res[i.link_with_name]?.url, name: i?.original_name,
response: res[i.link_with_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")) { if (this.form.hasOwnProperty("id")) {
delete this.form.id; delete this.form.id;
} }
//TODO:
if (/^\/manage/.test(this.$route.path)) {
this.form['zhuangtai'] = 0
}
} }
if (this.type === "editor") { if (this.type === "editor") {
Object.defineProperty(this.form, "id", { Object.defineProperty(this.form, "id", {
@ -366,16 +381,32 @@ export default {
this.$refs["elForm"].validate((validate) => { this.$refs["elForm"].validate((validate) => {
if (validate) { if (validate) {
this.formInfo.forEach((info) => { this.formInfo.forEach((info) => {
if (info.edit_input === "files") { if (info._relations?.link_with_name) {
this.form[info.field] = info._fileList.map( if (info.edit_input === "files" || info.edit_input === "file") {
(i) => i?.response?.id this.form[info._relations.link_with_name] = this.file[info.field].map(i => {
); return {
} [info._relations.foreign_key]: i?.response?.id
if (info.edit_input === "file") { }
this.form[info.field] = this.file[info.field][0]?.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( save(Object.assign(this.form, { table_name: this.tableName })).then(
(res) => { (res) => {
this.$Message.success({ this.$Message.success({
@ -417,6 +448,13 @@ export default {
if (i.edit_input === "checkbox") { if (i.edit_input === "checkbox") {
this.form[i.field] = []; 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"> <div ref="lxHeader">
<LxHeader <LxHeader
icon="md-apps" icon="md-apps"
:text="title || customForm.tableName" :text="$route.meta.title"
style="margin-bottom: 10px; border: 0px; margin-top: 15px" style="margin-bottom: 10px; border: 0px; margin-top: 15px"
> >
<div slot="content"></div> <div slot="content"></div>
@ -14,7 +14,7 @@
<template #search> <template #search>
<div style="display: flex"> <div style="display: flex">
<Select <Select
v-model="select.filter[0].key" v-model="select.filter[1].key"
style="width: 100px" style="width: 100px"
placeholder="搜索条目" placeholder="搜索条目"
> >
@ -26,7 +26,7 @@
> >
</Select> </Select>
<Select <Select
v-model="select.filter[0].op" v-model="select.filter[1].op"
style="width: 100px; margin-left: 10px" style="width: 100px; margin-left: 10px"
placeholder="搜索条件" placeholder="搜索条件"
> >
@ -39,43 +39,43 @@
</Select> </Select>
<template <template
v-if=" v-if="
select.filter[0].op !== 'range' && select.filter[1].op !== 'range' &&
!columnArrTest(select.filter[0].key) !columnArrTest(select.filter[1].key)
" "
> >
<Input <Input
v-model="select.filter[0].value" v-model="select.filter[1].value"
style="width: 150px; margin-left: 10px" style="width: 150px; margin-left: 10px"
placeholder="请填写关键词" placeholder="请填写关键词"
/> />
</template> </template>
<template <template
v-else-if=" v-else-if="
select.filter[0].op !== 'range' && select.filter[1].op !== 'range' &&
columnArrTest(select.filter[0].key) columnArrTest(select.filter[1].key)
" "
> >
<Select <Select
v-model="select.filter[0].value" v-model="select.filter[1].value"
style="width: 150px; margin-left: 10px" style="width: 150px; margin-left: 10px"
placeholder="请选择关键词" placeholder="请选择关键词"
> >
<Option <Option
v-for="item in getColumnParams(select.filter[0].key)" v-for="item in getColumnParams(select.filter[1].key)"
:key="item.id" :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 }}</Option
> >
</Select> </Select>
</template> </template>
<template v-else> <template v-else>
<Input <Input
:value="select.filter[0].value.split(',')[0]" :value="select.filter[1].value.split(',')[1]"
style="width: 150px; margin-left: 10px" style="width: 150px; margin-left: 10px"
placeholder="范围开始关键词" placeholder="范围开始关键词"
@input="(e) => inputStartHandler(e, select.filter[0])" @input="(e) => inputStartHandler(e, select.filter[1])"
/> />
<span <span
style=" style="
@ -86,10 +86,10 @@
></span ></span
> >
<Input <Input
:value="select.filter[0].value.split(',')[1]" :value="select.filter[1].value.split(',')[1]"
style="width: 150px; margin-left: 10px" style="width: 150px; margin-left: 10px"
placeholder="范围结束关键词" placeholder="范围结束关键词"
@input="(e) => inputEndHandler(e, select.filter[0])" @input="(e) => inputEndHandler(e, select.filter[1])"
/> />
</template> </template>
<Button <Button
@ -110,8 +110,9 @@
class="select__item" class="select__item"
v-for="(item, index) in select.filter" v-for="(item, index) in select.filter"
:key="`${item.value}-${index}`" :key="`${item.value}-${index}`"
v-if="index !== 0"
> >
<p>条件{{ index + 1 }}</p> <p>条件{{ index }}</p>
<Select <Select
v-model="item.key" v-model="item.key"
style="width: 100px" style="width: 100px"
@ -162,7 +163,7 @@
:key="item.id" :key="item.id"
:value="getColumnField(item.key)._relations ? item[getColumnField(item.key)._relations.foreign_key] : item.value" :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 }}</Option
> >
</Select> </Select>
@ -244,7 +245,7 @@
:border="true" :border="true"
:action="index" :action="index"
:req-opt="select" :req-opt="select"
:destroy-req-opt="select" :destroy-req-opt="{ 'table_name': customForm.tableName }"
:table-item="table" :table-item="table"
@detail=" @detail="
(row) => { (row) => {
@ -268,6 +269,9 @@
ref="dialog" ref="dialog"
@refresh="$refs['xyTable'].getTableData()" @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> </dialoger>
<drawer <drawer
:table-name="customForm.tableName" :table-name="customForm.tableName"
@ -293,12 +297,15 @@ import { getparameter } from "@/api/system/dictionary";
import { show } from "@/api/system/customForm"; import { show } from "@/api/system/customForm";
import * as XLSX from "xlsx"; import * as XLSX from "xlsx";
import { saveAs } from "file-saver"; import { saveAs } from "file-saver";
import { listdept } from "@/api/system/department";
import { deepCopy } from "@/utils";
import dialoger from "./dialog.vue"; import dialoger from "./dialog.vue";
import LxHeader from "@/components/LxHeader/index.vue"; import LxHeader from "@/components/LxHeader/index.vue";
import headerContent from "@/components/LxHeader/XyContent.vue"; import headerContent from "@/components/LxHeader/XyContent.vue";
import drawer from "@/views/component/drawer.vue"; import drawer from "@/views/component/drawer.vue";
import imports from "./imports.vue"; import imports from "./imports.vue";
import flow from "@/views/flow/flow.vue"
export default { export default {
components: { components: {
LxHeader, LxHeader,
@ -306,6 +313,8 @@ export default {
headerContent, headerContent,
drawer, drawer,
imports, imports,
flow
}, },
mixins: [authMixin], mixins: [authMixin],
provide: { provide: {
@ -313,11 +322,15 @@ export default {
}, },
data() { data() {
return { return {
title: "",
op, op,
select: { select: {
table_name: "", table_name: "",
filter: [ filter: [
{
key: "leixing",
op: "eq",
value: this.$route.meta.params?.type,
},
{ {
key: "", key: "",
op: "", op: "",
@ -338,8 +351,13 @@ export default {
destroy, destroy,
download, download,
reset() { reset() {
this.select.filter.splice(1); this.select.filter.splice(2);
this.select.filter[0] = { this.select.filter[0] = {
key: "leixing",
op: "eq",
value: this.$route.meta.params?.type,
};
this.select.filter[1] = {
key: "", key: "",
op: "", op: "",
value: "", value: "",
@ -400,9 +418,16 @@ export default {
} }
const res = await show({ id: this.customForm.customFormId }, false); 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; let { fields, relation } = res;
if ( if (
!fields || !fields ||
@ -423,49 +448,28 @@ export default {
} }
}) })
} }
if (i.edit_input === 'file' || i.edit_input === 'files') {
return
}
if (i._relations) { if (i._relations) {
i._params = i._relations.parameter_id if (baseTable.get(i._relations.link_table_name)) {
? getparameter({ id: i._relations.parameter_id },false).then((res) => { baseTable.get(i._relations.link_table_name)().then(res => i._params = res)
i._params = res.detail; } else {
}) i._params = i._relations.parameter_id
: this.index({ ? getparameter({ id: i._relations.parameter_id },false).then((res) => {
table_name: i._relations.link_table_name, i._params = res.detail;
page: 1, })
page_size: 9999, : this.index({
}).then((res) => { table_name: i._relations.link_table_name,
i._params = res.data; page: 1,
}); page_size: 9999,
}).then((res) => {
i._params = res.data;
});
}
} }
}); });
this.form = fields; 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 this.table = this.form
?.filter((i) => i.list_show) ?.filter((i) => i.list_show)
.map((i) => { .map((i) => {
@ -562,7 +566,10 @@ export default {
? this.form.find((i) => i.field === field)._params ? this.form.find((i) => i.field === field)._params
: []; : [];
}; };
} },
//TODO:
}, },
created() { created() {
this.getFormDetail(); 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; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
transition: all .4s;
&:hover {
transform: scale(1.1, 1.1);
}
} }
&__left--single { &__left--single {
flex: 2.2; flex: 2.2;

Loading…
Cancel
Save