|
|
|
|
@ -3,7 +3,7 @@ import { save, show, index, destroy } from "@/api/system/baseForm";
|
|
|
|
|
import { getparameter } from "@/api/system/dictionary";
|
|
|
|
|
import { domMap } from "@/const/inputType";
|
|
|
|
|
import { addPropsMap } from "@/const/addProps";
|
|
|
|
|
import {deepCopy} from "@/utils";
|
|
|
|
|
import { deepCopy } from "@/utils";
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
formInfo: {
|
|
|
|
|
@ -17,7 +17,7 @@ export default {
|
|
|
|
|
"el-dialog",
|
|
|
|
|
{
|
|
|
|
|
props: {
|
|
|
|
|
top: '8vh',
|
|
|
|
|
top: "8vh",
|
|
|
|
|
title: "新增",
|
|
|
|
|
visible: this.dialogVisible,
|
|
|
|
|
width: "750px",
|
|
|
|
|
@ -29,136 +29,165 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
[
|
|
|
|
|
h('el-scrollbar', {
|
|
|
|
|
style: {
|
|
|
|
|
'height': '58vh'
|
|
|
|
|
}
|
|
|
|
|
}, [h(
|
|
|
|
|
"el-form",
|
|
|
|
|
h(
|
|
|
|
|
"el-scrollbar",
|
|
|
|
|
{
|
|
|
|
|
ref: "elForm",
|
|
|
|
|
style: {
|
|
|
|
|
'padding-right': '12px'
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
model: this.form,
|
|
|
|
|
labelWidth: "80px",
|
|
|
|
|
rules: this.rules,
|
|
|
|
|
labelPosition: "right",
|
|
|
|
|
size: "small"
|
|
|
|
|
height: "58vh",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
(() => {
|
|
|
|
|
let dom = [];
|
|
|
|
|
this.formInfo.filter(i => i.form_show).forEach((i, index) => {
|
|
|
|
|
dom.push(
|
|
|
|
|
h(
|
|
|
|
|
"el-form-item",
|
|
|
|
|
{
|
|
|
|
|
ref: `elFormItem${i.field}`,
|
|
|
|
|
style: {
|
|
|
|
|
width: "100%",
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
label: i.name,
|
|
|
|
|
prop: i.field,
|
|
|
|
|
required:
|
|
|
|
|
i.validation instanceof Array
|
|
|
|
|
? !!i.validation.find((i) => i === "required")
|
|
|
|
|
: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
this.$scopedSlots[i.field]
|
|
|
|
|
? this.$scopedSlots[i.field]({ fieldInfo: i, form: this.form, file: this.file })
|
|
|
|
|
: [
|
|
|
|
|
h(
|
|
|
|
|
domMap.get(i.edit_input),
|
|
|
|
|
{
|
|
|
|
|
ref: `elEdit_${i.field}`,
|
|
|
|
|
style: {
|
|
|
|
|
width: "100%",
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
...addPropsMap.get(i.edit_input),
|
|
|
|
|
...this.extraProps(i),
|
|
|
|
|
placeholder: i.help,
|
|
|
|
|
value: this.form[i.field],
|
|
|
|
|
},
|
|
|
|
|
attrs: {
|
|
|
|
|
placeholder: i.help || `请填写${i.name}`,
|
|
|
|
|
},
|
|
|
|
|
on: {
|
|
|
|
|
[this.getEventType(i.edit_input)]: (e) => {
|
|
|
|
|
if (i.field) {
|
|
|
|
|
this.form[i.field] = e;
|
|
|
|
|
this.form = Object.assign({}, this.form);
|
|
|
|
|
}
|
|
|
|
|
[
|
|
|
|
|
h(
|
|
|
|
|
"el-form",
|
|
|
|
|
{
|
|
|
|
|
ref: "elForm",
|
|
|
|
|
style: {
|
|
|
|
|
"padding-right": "12px",
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
model: this.form,
|
|
|
|
|
labelWidth: "80px",
|
|
|
|
|
rules: this.rules,
|
|
|
|
|
labelPosition: "right",
|
|
|
|
|
size: "small",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
(() => {
|
|
|
|
|
let dom = [];
|
|
|
|
|
this.formInfo
|
|
|
|
|
.filter((i) => i.form_show)
|
|
|
|
|
.forEach((i, index) => {
|
|
|
|
|
if (
|
|
|
|
|
!/\/manage\/rule/.test(this.$route.fullPath) &&
|
|
|
|
|
!!["nianfen", "bianhao", "wenjian"].find(
|
|
|
|
|
(j) => j === i.field
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
} else {
|
|
|
|
|
dom.push(
|
|
|
|
|
h(
|
|
|
|
|
"el-form-item",
|
|
|
|
|
{
|
|
|
|
|
ref: `elFormItem${i.field}`,
|
|
|
|
|
style: {
|
|
|
|
|
width: "100%",
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
label: i.name,
|
|
|
|
|
prop: i.field,
|
|
|
|
|
required:
|
|
|
|
|
i.validation instanceof Array
|
|
|
|
|
? !!i.validation.find((i) => i === "required")
|
|
|
|
|
: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
scopedSlots:
|
|
|
|
|
i.edit_input === "file" ||
|
|
|
|
|
i.edit_input === "files"
|
|
|
|
|
? {
|
|
|
|
|
file: (scope) => {
|
|
|
|
|
let { file } = scope;
|
|
|
|
|
return [
|
|
|
|
|
h("div", {}, [
|
|
|
|
|
h("i", {
|
|
|
|
|
class: {
|
|
|
|
|
"el-icon-circle-check":
|
|
|
|
|
file.status === "success",
|
|
|
|
|
"el-icon-loading":
|
|
|
|
|
file.status === "uploading",
|
|
|
|
|
},
|
|
|
|
|
style: {
|
|
|
|
|
color:
|
|
|
|
|
file.status === "success"
|
|
|
|
|
? "green"
|
|
|
|
|
: "",
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
h(
|
|
|
|
|
"a",
|
|
|
|
|
{
|
|
|
|
|
attrs: {
|
|
|
|
|
href: file.url,
|
|
|
|
|
download: file.name,
|
|
|
|
|
},
|
|
|
|
|
class: {
|
|
|
|
|
"uploaded-a":
|
|
|
|
|
file.status === "success",
|
|
|
|
|
},
|
|
|
|
|
style: {
|
|
|
|
|
'padding': '0 4px'
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
file.name
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
h("i", {
|
|
|
|
|
class: "el-icon-close",
|
|
|
|
|
on: {
|
|
|
|
|
["click"]: () =>
|
|
|
|
|
this.fileRemoveHandler(
|
|
|
|
|
file,
|
|
|
|
|
i.field
|
|
|
|
|
),
|
|
|
|
|
this.$scopedSlots[i.field]
|
|
|
|
|
? this.$scopedSlots[i.field]({
|
|
|
|
|
fieldInfo: i,
|
|
|
|
|
form: this.form,
|
|
|
|
|
file: this.file,
|
|
|
|
|
})
|
|
|
|
|
: [
|
|
|
|
|
h(
|
|
|
|
|
domMap.get(i.edit_input),
|
|
|
|
|
{
|
|
|
|
|
ref: `elEdit_${i.field}`,
|
|
|
|
|
style: {
|
|
|
|
|
width: "100%",
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
...addPropsMap.get(i.edit_input),
|
|
|
|
|
...this.extraProps(i),
|
|
|
|
|
placeholder: i.help,
|
|
|
|
|
value: this.form[i.field],
|
|
|
|
|
},
|
|
|
|
|
attrs: {
|
|
|
|
|
placeholder: i.help || `请填写${i.name}`,
|
|
|
|
|
},
|
|
|
|
|
on: {
|
|
|
|
|
[this.getEventType(i.edit_input)]: (
|
|
|
|
|
e
|
|
|
|
|
) => {
|
|
|
|
|
if (i.field) {
|
|
|
|
|
this.form[i.field] = e;
|
|
|
|
|
this.form = Object.assign(
|
|
|
|
|
{},
|
|
|
|
|
this.form
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
];
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
: "",
|
|
|
|
|
},
|
|
|
|
|
this.optionsRender(h, i)
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
return dom;
|
|
|
|
|
})()
|
|
|
|
|
)]),
|
|
|
|
|
},
|
|
|
|
|
scopedSlots:
|
|
|
|
|
i.edit_input === "file" ||
|
|
|
|
|
i.edit_input === "files"
|
|
|
|
|
? {
|
|
|
|
|
file: (scope) => {
|
|
|
|
|
let { file } = scope;
|
|
|
|
|
return [
|
|
|
|
|
h("div", {}, [
|
|
|
|
|
h("i", {
|
|
|
|
|
class: {
|
|
|
|
|
"el-icon-circle-check":
|
|
|
|
|
file.status ===
|
|
|
|
|
"success",
|
|
|
|
|
"el-icon-loading":
|
|
|
|
|
file.status ===
|
|
|
|
|
"uploading",
|
|
|
|
|
},
|
|
|
|
|
style: {
|
|
|
|
|
color:
|
|
|
|
|
file.status ===
|
|
|
|
|
"success"
|
|
|
|
|
? "green"
|
|
|
|
|
: "",
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
h(
|
|
|
|
|
"a",
|
|
|
|
|
{
|
|
|
|
|
attrs: {
|
|
|
|
|
href: file.url,
|
|
|
|
|
download: file.name,
|
|
|
|
|
},
|
|
|
|
|
class: {
|
|
|
|
|
"uploaded-a":
|
|
|
|
|
file.status ===
|
|
|
|
|
"success",
|
|
|
|
|
},
|
|
|
|
|
style: {
|
|
|
|
|
padding: "0 4px",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
file.name
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
h("i", {
|
|
|
|
|
class: "el-icon-close",
|
|
|
|
|
on: {
|
|
|
|
|
["click"]: () =>
|
|
|
|
|
this.fileRemoveHandler(
|
|
|
|
|
file,
|
|
|
|
|
i.field
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
];
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
: "",
|
|
|
|
|
},
|
|
|
|
|
this.optionsRender(h, i)
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return dom;
|
|
|
|
|
})()
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
h("template", { slot: "footer" }, [
|
|
|
|
|
h(
|
|
|
|
|
"el-button",
|
|
|
|
|
@ -229,7 +258,14 @@ export default {
|
|
|
|
|
? info._params.map((i) =>
|
|
|
|
|
h("el-option", {
|
|
|
|
|
props: {
|
|
|
|
|
label: i.name || i.mingcheng || i.label || i.key || i.value || i.id || i.no,
|
|
|
|
|
label:
|
|
|
|
|
i.name ||
|
|
|
|
|
i.mingcheng ||
|
|
|
|
|
i.label ||
|
|
|
|
|
i.key ||
|
|
|
|
|
i.value ||
|
|
|
|
|
i.id ||
|
|
|
|
|
i.no,
|
|
|
|
|
value: i.id || i.value,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
@ -320,6 +356,7 @@ export default {
|
|
|
|
|
this.form[key] = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.form["faburiqi"] = this.$moment(new Date()).format("YYYY-MM-DD");
|
|
|
|
|
this.$refs["elForm"].clearValidate();
|
|
|
|
|
},
|
|
|
|
|
show() {
|
|
|
|
|
@ -349,34 +386,37 @@ export default {
|
|
|
|
|
this.$integrateData(this.form, res);
|
|
|
|
|
|
|
|
|
|
this.formInfo.forEach((i) => {
|
|
|
|
|
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?.name,
|
|
|
|
|
url: i?.url,
|
|
|
|
|
response: i
|
|
|
|
|
}
|
|
|
|
|
}) : [{
|
|
|
|
|
name: res[i._relations.link_with_name]?.name,
|
|
|
|
|
url: res[i._relations.link_with_name]?.url,
|
|
|
|
|
response: res[i._relations.link_with_name]
|
|
|
|
|
}]
|
|
|
|
|
) : this.file[i.field] = []
|
|
|
|
|
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?.name,
|
|
|
|
|
url: i?.url,
|
|
|
|
|
response: i,
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
: [
|
|
|
|
|
{
|
|
|
|
|
name: res[i._relations.link_with_name]?.name,
|
|
|
|
|
url: res[i._relations.link_with_name]?.url,
|
|
|
|
|
response: res[i._relations.link_with_name],
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
: (this.file[i.field] = []);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i.field === 'shenhebumen') {
|
|
|
|
|
this.form['shenhebumen'] = res[i._relations.link_with_name]?.dept_id
|
|
|
|
|
if (i.field === "shenhebumen") {
|
|
|
|
|
this.form["shenhebumen"] = res[i._relations.link_with_name]?.dept_id;
|
|
|
|
|
}
|
|
|
|
|
this.form = Object.assign({}, this.form);
|
|
|
|
|
this.originalForm = deepCopy(res)
|
|
|
|
|
this.originalForm = deepCopy(res);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log('11',this.form)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
|
let promiseAll = []
|
|
|
|
|
let promiseAll = [];
|
|
|
|
|
if (this.type === "add") {
|
|
|
|
|
if (this.form.hasOwnProperty("id")) {
|
|
|
|
|
delete this.form.id;
|
|
|
|
|
@ -384,12 +424,11 @@ export default {
|
|
|
|
|
|
|
|
|
|
//TODO:业务特殊处理
|
|
|
|
|
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.tableName === "materials") {
|
|
|
|
|
this.form["leixing"] = Number(this.$route.meta.params.type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (this.type === "editor") {
|
|
|
|
|
Object.defineProperty(this.form, "id", {
|
|
|
|
|
@ -398,81 +437,110 @@ export default {
|
|
|
|
|
configurable: true,
|
|
|
|
|
writable: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.$refs["elForm"].validate((validate) => {
|
|
|
|
|
if (validate) {
|
|
|
|
|
let copyForm = deepCopy(this.form)
|
|
|
|
|
let copyForm = deepCopy(this.form);
|
|
|
|
|
this.formInfo.forEach((info) => {
|
|
|
|
|
if (info._relations?.link_relation === 'newHasMany' || info._relations?.link_relation === 'hasMany') {
|
|
|
|
|
if (
|
|
|
|
|
info._relations?.link_relation === "newHasMany" ||
|
|
|
|
|
info._relations?.link_relation === "hasMany"
|
|
|
|
|
) {
|
|
|
|
|
if (this.originalForm[info._relations.link_with_name]) {
|
|
|
|
|
this.originalForm[info._relations.link_with_name].map(i => {
|
|
|
|
|
promiseAll.push(destroy({
|
|
|
|
|
id: i.id,
|
|
|
|
|
table_name: info._relations.link_table_name
|
|
|
|
|
}))
|
|
|
|
|
})
|
|
|
|
|
this.originalForm[info._relations.link_with_name].map((i) => {
|
|
|
|
|
promiseAll.push(
|
|
|
|
|
destroy({
|
|
|
|
|
id: i.id,
|
|
|
|
|
table_name: info._relations.link_table_name,
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (info.field === 'biaoqian') {
|
|
|
|
|
copyForm[info._relations.link_with_name].forEach(i => delete i.id)
|
|
|
|
|
delete copyForm[info.field]
|
|
|
|
|
return
|
|
|
|
|
if (info.field === "biaoqian") {
|
|
|
|
|
copyForm[info._relations.link_with_name].forEach(
|
|
|
|
|
(i) => delete i.id
|
|
|
|
|
);
|
|
|
|
|
delete copyForm[info.field];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (copyForm[info._relations?.link_with_name]?.length > 0) {
|
|
|
|
|
delete copyForm[info.field]
|
|
|
|
|
delete copyForm[info.field];
|
|
|
|
|
}
|
|
|
|
|
if (info._relations?.link_relation === 'newHasMany' || info._relations?.link_relation === 'hasMany') {
|
|
|
|
|
if (info.edit_input === 'files') {
|
|
|
|
|
copyForm[info._relations.link_with_name] = this.file[info.field]?.map(i => {
|
|
|
|
|
let copyRelation = i?.response ? deepCopy(i?.response) : ''
|
|
|
|
|
delete copyRelation.id
|
|
|
|
|
if (
|
|
|
|
|
info._relations?.link_relation === "newHasMany" ||
|
|
|
|
|
info._relations?.link_relation === "hasMany"
|
|
|
|
|
) {
|
|
|
|
|
if (info.edit_input === "files") {
|
|
|
|
|
copyForm[info._relations.link_with_name] = this.file[
|
|
|
|
|
info.field
|
|
|
|
|
]?.map((i) => {
|
|
|
|
|
let copyRelation = i?.response ? deepCopy(i?.response) : "";
|
|
|
|
|
delete copyRelation.id;
|
|
|
|
|
return {
|
|
|
|
|
upload_id: i?.response?.id,
|
|
|
|
|
...copyRelation
|
|
|
|
|
}
|
|
|
|
|
...copyRelation,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
copyForm[info._relations.link_with_name] = copyForm[info.field]?.map( i => {
|
|
|
|
|
let copyRelation = info._params.find(param => param[info._relations?.foreign_key] === i) ? deepCopy(info._params.find(param => param[info._relations?.foreign_key] === i)) : ''
|
|
|
|
|
delete copyRelation.id
|
|
|
|
|
copyForm[info._relations.link_with_name] = copyForm[
|
|
|
|
|
info.field
|
|
|
|
|
]?.map((i) => {
|
|
|
|
|
let copyRelation = info._params.find(
|
|
|
|
|
(param) => param[info._relations?.foreign_key] === i
|
|
|
|
|
)
|
|
|
|
|
? deepCopy(
|
|
|
|
|
info._params.find(
|
|
|
|
|
(param) => param[info._relations?.foreign_key] === i
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
: "";
|
|
|
|
|
delete copyRelation.id;
|
|
|
|
|
return {
|
|
|
|
|
[info._relations.foreign_key]: i,
|
|
|
|
|
...copyRelation
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
...copyRelation,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete copyForm[info.field]
|
|
|
|
|
delete copyForm[info.field];
|
|
|
|
|
}
|
|
|
|
|
if (info._relations?.link_relation === 'newHasOne' || info._relations?.link_relation === 'hasOne') {
|
|
|
|
|
if (info.edit_input === 'file') {
|
|
|
|
|
if (
|
|
|
|
|
info._relations?.link_relation === "newHasOne" ||
|
|
|
|
|
info._relations?.link_relation === "hasOne"
|
|
|
|
|
) {
|
|
|
|
|
if (info.edit_input === "file") {
|
|
|
|
|
copyForm[info._relations.link_with_name] = [
|
|
|
|
|
{
|
|
|
|
|
upload_id: this.file[info.field]?.response?.id,
|
|
|
|
|
...this.file[info.field]
|
|
|
|
|
}
|
|
|
|
|
...this.file[info.field],
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
let copyRelation = deepCopy(info._params.find(param => param.id == this.form[info.field]))
|
|
|
|
|
let copyRelation = deepCopy(
|
|
|
|
|
info._params.find(
|
|
|
|
|
(param) => param.id == this.form[info.field]
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
if (copyRelation) {
|
|
|
|
|
delete copyRelation.id
|
|
|
|
|
delete copyRelation.id;
|
|
|
|
|
copyForm[info._relations.link_with_name] = [
|
|
|
|
|
{
|
|
|
|
|
id: this.form[info._relations?.link_with_name]?.id,
|
|
|
|
|
[info.field === 'shenhebumen' ? 'dept_id' : info._relations.foreign_key]: this.form[info.field],
|
|
|
|
|
[info.field === "shenhebumen"
|
|
|
|
|
? "dept_id"
|
|
|
|
|
: info._relations.foreign_key]: this.form[info.field],
|
|
|
|
|
...copyRelation,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete copyForm[info.field]
|
|
|
|
|
delete copyForm[info.field];
|
|
|
|
|
}
|
|
|
|
|
if (!copyForm[info._relations?.link_with_name]) {
|
|
|
|
|
delete copyForm[info._relations?.link_with_name]
|
|
|
|
|
delete copyForm[info._relations?.link_with_name];
|
|
|
|
|
}
|
|
|
|
|
// if (info._relations?.link_with_name) {
|
|
|
|
|
// if (info.edit_input === "files" || info.edit_input === "file") {
|
|
|
|
|
@ -486,16 +554,16 @@ export default {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
});
|
|
|
|
|
promiseAll.push(save(Object.assign(copyForm, { table_name: this.tableName })))
|
|
|
|
|
Promise.all(promiseAll).then(
|
|
|
|
|
(res) => {
|
|
|
|
|
this.$Message.success({
|
|
|
|
|
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
|
|
|
|
|
});
|
|
|
|
|
this.$emit("refresh");
|
|
|
|
|
this.hidden();
|
|
|
|
|
}
|
|
|
|
|
promiseAll.push(
|
|
|
|
|
save(Object.assign(copyForm, { table_name: this.tableName }))
|
|
|
|
|
);
|
|
|
|
|
Promise.all(promiseAll).then((res) => {
|
|
|
|
|
this.$Message.success({
|
|
|
|
|
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
|
|
|
|
|
});
|
|
|
|
|
this.$emit("refresh");
|
|
|
|
|
this.hidden();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
@ -529,7 +597,25 @@ export default {
|
|
|
|
|
this.form[i.field] = [];
|
|
|
|
|
}
|
|
|
|
|
if (i._relations) {
|
|
|
|
|
this.form[i._relations?.link_with_name] = []
|
|
|
|
|
this.form[i._relations?.link_with_name] = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
if (i.field === 'shenhebumen') {
|
|
|
|
|
this.form[i.field] = this.$store.state.user.department?.id
|
|
|
|
|
}
|
|
|
|
|
if (i.field === "faburiqi") {
|
|
|
|
|
this.form[i.field] = this.$moment(new Date()).format(
|
|
|
|
|
"YYYY-MM-DD"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
i.field === "fujian" &&
|
|
|
|
|
/^\/manage\/form/.test(this.$route.fullPath)
|
|
|
|
|
) {
|
|
|
|
|
this.rules[i.field] = [
|
|
|
|
|
{ required: true, message: `请选择${i.name}` },
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -564,5 +650,4 @@ export default {
|
|
|
|
|
color: red;
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|