master
xy 3 years ago
parent 1e7b8951ac
commit df6df947f2

@ -12,7 +12,7 @@
<template> <template>
<div class="dropdown-box"> <div class="dropdown-box">
<div class="left"> <div class="left">
<div class="left-item" v-for="i in ['制度文件','工作流程','岗位工作及标准','表单中心']" @click="selectValue = i"> <div class="left-item" v-for="i in ['制度文件','工作流程','岗位工作及标准','表单中心','部门工作职责']" @click="selectValue = i">
{{ i }} {{ i }}
</div> </div>
</div> </div>
@ -27,8 +27,8 @@
</el-button> </el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="select-drop"> <el-dropdown-menu class="select-drop">
<el-dropdown-item command="制度文件"> <el-dropdown-item command="规章制度">
<div style="text-align: center">制度文件</div> <div style="text-align: center">规章制度</div>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item command="工作流程"> <el-dropdown-item command="工作流程">
<div style="text-align: center">工作流程</div> <div style="text-align: center">工作流程</div>
@ -39,6 +39,9 @@
<el-dropdown-item command="表单中心"> <el-dropdown-item command="表单中心">
<div style="text-align: center">表单中心</div> <div style="text-align: center">表单中心</div>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item command="部门工作职责">
<div style="text-align: center">部门工作职责</div>
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
@ -121,6 +124,9 @@ export default {
flex: 1; flex: 1;
background: url("../../assets/reception/search-bottom-bkg.png") no-repeat center; background: url("../../assets/reception/search-bottom-bkg.png") no-repeat center;
background-size: cover; background-size: cover;
display: flex;
flex-direction: column;
justify-content: space-between;
& .search-bar { & .search-bar {
display: flex; display: flex;
@ -154,7 +160,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
margin: 43px 0 0 8.8%; margin: 0 0 43px 8.8%;
&__word { &__word {
font-size: 13px; font-size: 13px;
@ -166,7 +172,7 @@ export default {
} }
} }
.search { .search {
height: 295px; height: 342px;
width: 100%; width: 100%;
padding: 33px 18.75% 38px 18.75%; padding: 33px 18.75% 38px 18.75%;

@ -17,6 +17,10 @@ router.beforeEach(async(to, from, next) => {
// set page title // set page title
document.title = getPageTitle(to.meta.title) document.title = getPageTitle(to.meta.title)
if (/^\/index\/.*/.test(to.path)) {
next()
return
}
// determine whether the user has logged in // determine whether the user has logged in
const hasToken = getToken() const hasToken = getToken()

@ -0,0 +1,79 @@
<script>
export default {
props: {
info: Object,
detail: Object,
},
data() {
return {};
},
methods: {},
computed: {},
render(h) {
let { edit_input, select_item, _relations, field } = this.info;
if (edit_input === "richtext") {
return (
<el-scrollbar>
<div
style={{ "max-height": "50px" }}
domPropsInnerHTML={this.detail[field]}
></div>
</el-scrollbar>
);
}
if (
select_item &&
typeof select_item === "object" &&
!(select_item instanceof Array)
) {
let keys = Object.keys(select_item);
let paramMap = new Map();
keys.forEach((key) => {
paramMap.set(select_item[key], key);
});
return <span>{paramMap.get(this.detail[field]?.toString())}</span>;
}
if (_relations) {
let { link_relation, foreign_key, link_with_name } = _relations;
if (link_relation === "newHasOne" || link_relation === "hasOne") {
if (edit_input === "file") {
return (
<a
download={this.detail[link_with_name]?.original_name}
href={this.detail[link_with_name]?.url}
>
{this.detail[link_with_name]?.original_name}
</a>
);
} else {
return (
<span>
{this.detail[link_with_name]?.name ||
this.detail[link_with_name]?.no ||
this.detail[link_with_name]?.value}
</span>
);
}
}
if (link_relation === "hasMany" || link_relation === "newHasMany") {
return (
<div>
{this.detail[link_with_name]?.map((o) => (
<span>{o?.name || o?.no || o?.value}</span>
))}
</div>
);
}
}
return (
<span>{this.detail[field]}</span>
);
},
};
</script>
<style scoped lang="scss"></style>

@ -3,6 +3,7 @@ import { save, show, index } from "@/api/system/baseForm";
import { getparameter } from "@/api/system/dictionary"; import { getparameter } from "@/api/system/dictionary";
import { domMap } from "@/const/inputType"; import { domMap } from "@/const/inputType";
import { addPropsMap } from "@/const/addProps"; import { addPropsMap } from "@/const/addProps";
import {deepCopy} from "@/utils";
export default { export default {
props: { props: {
formInfo: { formInfo: {
@ -16,9 +17,10 @@ export default {
"el-dialog", "el-dialog",
{ {
props: { props: {
top: '8vh',
title: "新增", title: "新增",
visible: this.dialogVisible, visible: this.dialogVisible,
width: "600px", width: "700px",
}, },
on: { on: {
"update:visible": (val) => { "update:visible": (val) => {
@ -27,16 +29,23 @@ export default {
}, },
}, },
[ [
h( h('el-scrollbar', {
style: {
'height': '58vh'
}
}, [h(
"el-form", "el-form",
{ {
ref: "elForm", ref: "elForm",
style: {
'padding-right': '12px'
},
props: { props: {
model: this.form, model: this.form,
labelWidth: "80px", labelWidth: "80px",
rules: this.rules, rules: this.rules,
labelPosition: "right", labelPosition: "right",
size: "small", size: "small"
}, },
}, },
(() => { (() => {
@ -149,7 +158,7 @@ export default {
}); });
return dom; return dom;
})() })()
), )]),
h("template", { slot: "footer" }, [ h("template", { slot: "footer" }, [
h( h(
"el-button", "el-button",
@ -360,6 +369,8 @@ export default {
}, },
submit() { submit() {
console.log(this.form)
return
if (this.type === "add") { if (this.type === "add") {
if (this.form.hasOwnProperty("id")) { if (this.form.hasOwnProperty("id")) {
delete this.form.id; delete this.form.id;
@ -369,6 +380,10 @@ export default {
if (/^\/manage/.test(this.$route.path)) { if (/^\/manage/.test(this.$route.path)) {
this.form['zhuangtai'] = 0 this.form['zhuangtai'] = 0
} }
if (this.tableName === 'materials') {
this.form['leixing'] = Number(this.$route.meta.params.type);
}
} }
if (this.type === "editor") { if (this.type === "editor") {
Object.defineProperty(this.form, "id", { Object.defineProperty(this.form, "id", {
@ -380,34 +395,39 @@ export default {
} }
this.$refs["elForm"].validate((validate) => { this.$refs["elForm"].validate((validate) => {
if (validate) { if (validate) {
let copyForm = deepCopy(this.form)
this.formInfo.forEach((info) => { this.formInfo.forEach((info) => {
if (info._relations?.link_with_name) { if (info._relations?.link_relation === 'newHasMany' || info._relations?.link_relation === 'hasMany') {
if (info.edit_input === "files" || info.edit_input === "file") { if (info.edit_input === 'files') {
this.form[info._relations.link_with_name] = this.file[info.field].map(i => { copyForm[info._relations.link_with_name] = this.file[info.field].map(i => i?.response);
return {
[info._relations.foreign_key]: i?.response?.id
}
});
delete this.form[info.field]
} else { } else {
this.form[info._relations.link_with_name] = this.form[info.field] instanceof Array ? this.form[info.field].map(i => { copyForm[info._relations.link_with_name] = copyForm[info.field]
return {
[info._relations.foreign_key]: i
}
}) : [{ [info._relations.foreign_key]: this.form[info.field] }]
delete this.form[info.field]
} }
delete copyForm[info.field]
} }
// if (info.edit_input === "files") { if (info._relations?.link_relation === 'newHasOne' || info._relations?.link_relation === 'hasOne') {
// this.form[info.field] = this.file[info.field].map( if (info.edit_input === 'file') {
// (i) => i?.response?.id //this.form[info._relations.link_with_name] =
// ); } else {
// }
// if (info.edit_input === "file") { }
// this.form[info.field] = this.file[info.field][0]?.response?.id;
delete copyForm[info.field]
}
// 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 => i?.response);
// 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._params.find(param => i === param[info._relations.foreign_key])
// }) : [info._params.find(param => this.form[info.field] === param[info._relations.foreign_key])]
// delete this.form[info.field]
// }
// } // }
}); });
save(Object.assign(this.form, { table_name: this.tableName })).then( save(Object.assign(copyForm, { table_name: this.tableName })).then(
(res) => { (res) => {
this.$Message.success({ this.$Message.success({
content: `${this.type === "add" ? "新增" : "编辑"}成功`, content: `${this.type === "add" ? "新增" : "编辑"}成功`,
@ -448,13 +468,6 @@ 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);
}
}
} }
}); });
}, },
@ -466,7 +479,6 @@ export default {
this.$nextTick(() => this.getDetail()); this.$nextTick(() => this.getDetail());
} }
} else { } else {
this.file = {};
this.id = ""; this.id = "";
this.type = ""; this.type = "";
this.init(); this.init();
@ -489,4 +501,5 @@ export default {
color: red; color: red;
text-decoration: underline; text-decoration: underline;
} }
</style> </style>

@ -4,7 +4,7 @@
ref="elDrawer" ref="elDrawer"
:title="detail.name || '详情'" :title="detail.name || '详情'"
:visible.sync="isShow" :visible.sync="isShow"
size="45%" size="80%"
direction="rtl" direction="rtl"
> >
<template> <template>
@ -18,9 +18,9 @@
style="margin: 20px 10px" style="margin: 20px 10px"
> >
<template v-for="info in formInfo"> <template v-for="info in formInfo">
<el-descriptions-item :label="info.name">{{ <el-descriptions-item :label="info.name">
contentFormat(info) <descriptionItem :info="info" :detail="detail"></descriptionItem>
}}</el-descriptions-item> </el-descriptions-item>
</template> </template>
</el-descriptions> </el-descriptions>
</template> </template>
@ -30,7 +30,12 @@
<script> <script>
import { show } from "@/api/system/baseForm"; import { show } from "@/api/system/baseForm";
import descriptionItem from "@/views/component/descriptionItem.vue";
export default { export default {
components: {
descriptionItem
},
props: { props: {
formInfo: { formInfo: {
type: Array, type: Array,
@ -99,7 +104,6 @@ export default {
}, },
true true
).then((res) => { ).then((res) => {
console.log(111, res);
this.detail = res; this.detail = res;
}); });
} }

@ -238,6 +238,7 @@
</div> </div>
<xy-table <xy-table
:btn-width="200"
:auths="auths_auth_mixin" :auths="auths_auth_mixin"
:delay-req="true" :delay-req="true"
:destroy-action="destroy" :destroy-action="destroy"
@ -270,7 +271,7 @@
@refresh="$refs['xyTable'].getTableData()" @refresh="$refs['xyTable'].getTableData()"
> >
<template #fujian="{ fieldInfo, form, file }" v-if="$route.meta.params && $route.meta.params.type == 1"> <template #fujian="{ fieldInfo, form, file }" v-if="$route.meta.params && $route.meta.params.type == 1">
<flow :field-info="fieldInfo" :form="form" :file="file"></flow> <flow :field-info="fieldInfo" :form="form" :file="file" @update="val => form['fujian'] = val"></flow>
</template> </template>
</dialoger> </dialoger>
<drawer <drawer
@ -327,9 +328,9 @@ export default {
table_name: "", table_name: "",
filter: [ filter: [
{ {
key: "leixing", key: this.$route.meta.params?.type ? "leixing" : '',
op: "eq", op: this.$route.meta.params?.type ? "eq" : '',
value: this.$route.meta.params?.type, value: this.$route.meta.params?.type || '',
}, },
{ {
key: "", key: "",
@ -475,7 +476,17 @@ export default {
.map((i) => { .map((i) => {
let linkOb = {}; let linkOb = {};
if (i.select_item && typeof i.select_item === 'object') { if (i.edit_input === 'richtext') {
linkOb.customFn = row => {
return (
<el-scrollbar>
<div style={{ 'max-height': '50px' }} domPropsInnerHTML={row[i.field]}></div>
</el-scrollbar>
)
}
}
if (i.select_item && typeof i.select_item === 'object' && !(i.select_item instanceof Array)) {
let keys = Object.keys(i.select_item) let keys = Object.keys(i.select_item)
linkOb.customFn = row => { linkOb.customFn = row => {
let paramMap = new Map() let paramMap = new Map()
@ -485,7 +496,7 @@ export default {
return ( return (
<span> <span>
{ paramMap.get(row[i.field].toString()) } { paramMap.get(row[i.field]?.toString()) }
</span> </span>
) )
} }
@ -542,6 +553,8 @@ export default {
width: 60, width: 60,
label: "序号", label: "序号",
}); });
console.log(111,this.form)
}, },
}, },
@ -612,4 +625,5 @@ a:hover {
color: red; color: red;
text-decoration: underline; text-decoration: underline;
} }
</style> </style>

@ -15,7 +15,7 @@
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div> <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload> </el-upload>
<formList ref="formList"></formList> <formList ref="formList" :value="selections" @selected="selectedHandler"></formList>
</div> </div>
</template> </template>
@ -33,14 +33,29 @@ export default {
data() { data() {
return { return {
action: process.env.VUE_APP_UPLOAD_API, action: process.env.VUE_APP_UPLOAD_API,
selections: [],
}
},
methods: {
selectedHandler (ids) {
this.selections = Array.from(new Set(ids))
this.$emit('update', this.selections)
} }
}, },
methods: {},
computed: { computed: {
fileList () { fileList () {
return (this.file && this.fieldInfo?.field) ? this.file[this.fieldInfo.field] : [] return (this.file && this.fieldInfo?.field) ? this.file[this.fieldInfo.field] : []
} },
}, },
watch: {
form: {
handler(newVal) {
this.selections = newVal[this.fieldInfo.field]
},
immediate: true
}
}
} }
</script> </script>

@ -4,9 +4,21 @@
:append-to-body="true" :append-to-body="true"
title="表单中心" title="表单中心"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="30%"> width="60%">
<template> <template>
<Table></Table> <Table :row-key="true" :loading="isLoading" :columns="table" :data="data" size="small" @on-selection-change="selectionChange"></Table>
<div style="display: flex;justify-content: center;margin-top: 10px;">
<el-pagination
small
layout="prev, pager, next"
:total="total"
@current-change="e => {
select.page = e
getData()
}">
</el-pagination>
</div>
</template> </template>
<template #footer> <template #footer>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
@ -19,12 +31,61 @@
<script> <script>
import { index } from "@/api/system/baseForm" import { index } from "@/api/system/baseForm"
export default { export default {
props: {
value: Array
},
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
isLoading: false,
total: 0,
data: [], data: [],
table: [], table: [
{
width: 54,
type: 'selection'
},
{
key: 'nianfen',
title: '年份',
width: 100
},
{
key: 'wenjian',
title: '文件',
width: 120
},
{
key: 'bianhao',
title: '编号',
width: 120
},
{
key: 'biaoti',
title: '标题',
width: 140
},
{
key: 'beizhu',
title: '备注',
align: 'left',
minWidth: 200
},
{
key: 'admin',
title: '创建人',
width: 140,
render: (h, { row }) => {
return h('span', row.admin?.name)
}
},
{
key: 'created_at',
title: '创建日期',
width: 160
}
],
select: { select: {
page: 1, page: 1,
page_size: 10, page_size: 10,
@ -48,8 +109,22 @@ export default {
}, },
async getData() { async getData() {
this.isLoading = true
const res = await index(this.select) const res = await index(this.select)
console.log(111,res) console.log(222,this.value)
this.data = res.data.map(i => {
return {
_checked: this.value?.indexOf(i.id) !== -1,
...i
}
})
this.total = res.total
this.isLoading = false
},
selectionChange(selection) {
this.$emit('selected', selection.map(i => i.id))
} }
}, },
computed: {}, computed: {},

Loading…
Cancel
Save