master
xy 2 years ago
parent c1966c586e
commit 529aca4ca7

@ -140,14 +140,60 @@ export default {
];
Promise.all(promiseAll).then(res => {
let dataTable = this.allTables.find(t => t.table_name === res[1].relation[0].link_table_name);
formShow({ id: dataTable.id }).then(res1 => {
if (item.edit_input !== 'files') {
let dataTable = this.allTables.find(t => t.table_name === res[1].relation[0].link_table_name);
formShow({ id: dataTable.id }).then(res1 => {
this.linkTableList.push({
value: res[0].data?.map(o => o[res[1]?.relation[0]?.link_with_name]),
field: this.formatColumn(res1),
title: res[1]?.name
})
})
} else {
this.linkTableList.push({
value: res[0].data?.map(o => o[res[1]?.relation[0]?.link_with_name]),
field: this.formatColumn(res1),
field: [
{
type: 'index',
label: '序号',
width: 50
},
{
prop: 'original_name',
label: '文件名'
},
{
label: '操作',
width: 100,
customFn:row => {
return (
<div>
<el-button
type="primary"
icon="el-icon-download"
circle
size="mini"
on={{
['click']:_ => this.down(row)
}}
></el-button>
<el-button
type="primary"
icon="el-icon-search"
circle
size="mini"
on={{
['click']:_ => this.open(row.url)
}}
></el-button>
</div>
)
}
}
],
title: res[1]?.name
})
})
}
})
}
},

@ -505,9 +505,9 @@ export default {
}
}
if (copyForm[info._relations?.link_with_name]?.length > 0) {
delete copyForm[info.field];
}
// if (copyForm[info._relations?.link_with_name]?.length > 0) {
// delete copyForm[info.field];
// }
if (
info._relations?.link_relation === "newHasMany" ||
info._relations?.link_relation === "hasMany"
@ -516,33 +516,22 @@ export default {
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,
original_name: i?.response?.original_name
};
});
} else {
copyForm[info._relations.link_with_name] = copyForm[
info.field
] instanceof Array ? 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.custom_form_field]: i,
//...copyRelation,
};
});
}) : '';
}
delete copyForm[info.field];
@ -552,7 +541,7 @@ export default {
info._relations?.link_relation === "hasOne"
) {
if (info.edit_input === "file") {
copyForm[info.field] = this.file[info.field][0]?.response?.id;
copyForm[info.field] = this.file[info.field] ? this.file[info.field][0]?.response?.id : '';
} else {
// let copyRelation = deepCopy(
// info._params.find(
@ -648,6 +637,7 @@ export default {
this.$nextTick(() => this.getDetail());
}
} else {
this.originalForm = {};
this.file = {};
this.id = "";
this.type = "";

@ -2,6 +2,57 @@
<div>
<el-dialog :visible.sync="dialogVisible">
<template>
<div class="select">
<Select
v-model="select.filter[0].key"
style="width: 100px"
placeholder="搜索条目"
>
<Option v-for="item in fields" :key="item.id" :value="item.field">{{
item.name
}}</Option>
</Select>
<Select
v-model="select.filter[0].op"
style="width: 100px; margin-left: 10px"
placeholder="搜索条件"
>
<Option v-for="item in op" :key="item.value" :value="item.value">{{
item.label
}}</Option>
</Select>
<template v-if="select.filter[0].op !== 'range'">
<Input
clearable
v-model="select.filter[0].value"
style="width: 150px; margin-left: 10px"
placeholder="请填写关键词"
/>
</template>
<template v-else>
<Input
:value="select.filter[0].value.split(',')[0]"
style="width: 150px; margin-left: 10px"
placeholder="范围开始关键词"
@input="(e) => inputStartHandler(e, select.filter[0])"
/>
<span style="margin-left: 10px; display: flex; align-items: center"
></span
>
<Input
:value="select.filter[0].value.split(',')[1]"
style="width: 150px; margin-left: 10px"
placeholder="范围结束关键词"
@input="(e) => inputEndHandler(e, select.filter[0])"
/>
</template>
<Button
style="margin-left: 10px"
type="primary"
@click="$refs['table'].getTableData(true)"
>查询</Button
>
</div>
<xy-table
:is-first-req="false"
ref="table"
@ -31,6 +82,7 @@
</template>
<script>
import { op } from '@/const/op'
import { index } from "@/api/system/baseForm";
import { index as customFormIndex, show } from "@/api/system/customForm";
export default {
@ -45,12 +97,21 @@ export default {
},
data() {
return {
op,
tempRow: {},
dialogVisible: false,
select: {
table_name: "",
table_id: "",
filter: [
{
key: '',
op: '',
value: ''
}
]
},
fields: [],
columns: [],
originalRowIds: [],
};
@ -64,6 +125,16 @@ export default {
this.dialogVisible = false;
},
//target
inputStartHandler(e, target) {
let temp = target?.value.split(",")[1];
target.value = `${e},${temp ? temp : ""}`;
},
inputEndHandler(e, target) {
let temp = target?.value.split(",")[0];
target.value = `${temp ? temp : ""},${e}`;
},
async getDataTableName() {
if (this.linkType === "hasMany" || this.linkType === "newHasMany") {
const tables = (
@ -110,6 +181,7 @@ export default {
);
console.log(res);
this.fields = res.fields;
this.columns = res.fields
?.filter((i) => i.list_show)
.map((i) => {
@ -168,16 +240,21 @@ export default {
rowPick({ row }) {
this.tempRow = row;
},
selectBk (selections, row) {
if (!selections.find(i => i.id === row.id)) {
this.originalRowIds.splice(this.originalRowIds.indexOf(row.id),1)
selectBk(selections, row) {
if (!selections.find((i) => i.id === row.id)) {
this.originalRowIds.splice(this.originalRowIds.indexOf(row.id), 1);
}
},
confirm() {
this.linkType === "hasMany" || this.linkType === "newHasMany"
? this.$emit("confirm", {
field: this.field,
value: Array.from(new Set([...this.$refs["table"].getSelection()?.map(i => i.id),...this.originalRowIds])),
value: Array.from(
new Set([
...this.$refs["table"].getSelection()?.map((i) => i.id),
...this.originalRowIds,
])
),
})
: this.$emit("confirm", {
field: this.field,
@ -195,19 +272,22 @@ export default {
},
dialogVisible(newVal) {
if (newVal) {
} else {
this.tempRow = {};
this.$refs['table'].clearSelection();
this.$refs["table"].clearSelection();
}
},
originalRows (newVal) {
this.originalRowIds = newVal.map(i => i[this.field])
originalRows(newVal) {
this.originalRowIds = newVal.map((i) => i[this.field]);
this.selectRows();
}
},
},
};
</script>
<style scoped lang="scss"></style>
<style scoped lang="scss">
.select {
margin-bottom: 10px;
}
</style>

@ -54,7 +54,7 @@ export default {
value={ row.custom_form_field }
on={{
['change']:e => {
row.custom_form_field = e
this.$set(row,'custom_form_field',e);
}
}}>
{

Loading…
Cancel
Save