Commit f142a1c0 authored by 骆瑛's avatar 骆瑛

修改对象管理页面

parent 736da3b1
...@@ -106,8 +106,9 @@ ...@@ -106,8 +106,9 @@
</Modal> --> </Modal> -->
</Tabs> </Tabs>
</Row> </Row>
<Row> <component :is="detail" :list="checkList" />
<Row style="margin-bottom: 10px" :gutter="10"> <!-- <Row> -->
<!-- <Row style="margin-bottom: 10px" :gutter="10">
<Col :span="6"> <Col :span="6">
<AutoComplete <AutoComplete
v-model="completeValue" v-model="completeValue"
...@@ -134,8 +135,8 @@ ...@@ -134,8 +135,8 @@
<Col :span="2"> <Col :span="2">
<Button type="primary" @click="importColumns">导入</Button> <Button type="primary" @click="importColumns">导入</Button>
</Col> </Col>
</Row> </Row> -->
<Table <!-- <Table
:columns="columns1" :columns="columns1"
:data="checkList" :data="checkList"
border border
...@@ -206,15 +207,6 @@ ...@@ -206,15 +207,6 @@
placeholder="请输入" placeholder="请输入"
/> />
</template> </template>
<!-- <template slot-scope="{ row, index }" slot="link">
<Input
v-model="row.link"
@on-change="setRow(row, index)"
placeholder="请输入"
number
/>
</template> -->
<template slot-scope="{ row, index }" slot="systemName"> <template slot-scope="{ row, index }" slot="systemName">
<state code="project.main.systemName" :value="row.systemName" /> <state code="project.main.systemName" :value="row.systemName" />
</template> </template>
...@@ -246,8 +238,8 @@ ...@@ -246,8 +238,8 @@
</Table> </Table>
<Button type="dashed" long @click="addNew(0, '{}')" class="mt10" <Button type="dashed" long @click="addNew(0, '{}')" class="mt10"
>新增属性</Button >新增属性</Button
> > -->
</Row> <!-- </Row> -->
</Col> </Col>
<Col :span="24" class="tr mt10"> <Col :span="24" class="tr mt10">
<FormItem> <FormItem>
...@@ -268,6 +260,7 @@ export default { ...@@ -268,6 +260,7 @@ export default {
name: "Add", name: "Add",
data() { data() {
return { return {
detail:null,
iconType: "ios-arrow-up", iconType: "ios-arrow-up",
textUp: "收起", textUp: "收起",
upDrop: true, upDrop: true,
...@@ -415,20 +408,22 @@ export default { ...@@ -415,20 +408,22 @@ export default {
upId: null, upId: null,
level: null, level: null,
tenantId: null, tenantId: null,
type: null, type: 0,
englishFullName: "", englishFullName: "",
englishName: "", englishName: "",
status: null, status: null,
description: "", description: "",
inheritCategoryId: null, inheritCategoryId: null,
code: "", code: "",
dtos:"",
module: "", module: "",
version: null, version: null,
projectId: null, projectId: null,
}, },
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{ required: true, message: "请填写名称", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }], code: [{ required: true, message: "请填写编码", trigger: "blur" }],
// type:[{ required: true, message: '请选择类别', trigger: 'change' }]
}, },
// content:{ // content:{
// base:[] // base:[]
...@@ -436,37 +431,35 @@ export default { ...@@ -436,37 +431,35 @@ export default {
dtos:[] dtos:[]
}; };
}, },
components:{
Dtos
},
props: { props: {
v: Object, v: Object,
eid: Number, eid: Number,
}, },
mounted() { mounted() {
this.seachChange(); // this.seachChange();
if (this.eid > 0) { if (this.eid > 0) {
this.load(this.eid); this.load(this.eid);
} }
this.detail=()=>import('./dtos')
}, },
methods: { methods: {
onDragDrop(a, b) { // onDragDrop(a, b) {
this.checkList.splice(b, 0, ...this.checkList.splice(a, 1)); // this.checkList.splice(b, 0, ...this.checkList.splice(a, 1));
}, // },
importColumns() { // importColumns() {
//导入 // //导入
let changeId = {}; // let changeId = {};
if (this.completeList.length > 0) { // if (this.completeList.length > 0) {
this.completeList.map((e, index) => { // this.completeList.map((e, index) => {
if (e.name == this.completeValue) { // if (e.name == this.completeValue) {
changeId = e; // changeId = e;
this.completeList.splice(index, 1); // this.completeList.splice(index, 1);
this.completeValue = ""; // this.completeValue = "";
} // }
}); // });
this.addNew(1, changeId); // this.addNew(1, changeId);
} // }
}, // },
upClick(value) { upClick(value) {
this.upDrop = !value; this.upDrop = !value;
if (value) { if (value) {
...@@ -477,90 +470,90 @@ export default { ...@@ -477,90 +470,90 @@ export default {
this.iconType = "ios-arrow-up"; this.iconType = "ios-arrow-up";
} }
}, },
seachChange() { // seachChange() {
let data = { // let data = {
conditions: [], // conditions: [],
pageSize: 20, // pageSize: 20,
}; // };
Api.list(data).then((r) => { // Api.list(data).then((r) => {
if (r.success) { // if (r.success) {
this.completeList = r.result; // this.completeList = r.result;
} else { // } else {
} // }
}); // });
}, // },
remove(index, row) { // remove(index, row) {
if (row.add == 0) { // if (row.add == 0) {
//新增的删除,直接删 // //新增的删除,直接删
this.checkList.splice(index, 1); // this.checkList.splice(index, 1);
// let objArr = { // // let objArr = {
// name: row.columnDescription, // // name: row.columnDescription,
// code: row.code, // // code: row.code,
// id: row.id, // // id: row.id,
// }; // // };
// this.completeList.push(objArr); // // this.completeList.push(objArr);
} else { // } else {
row.action = 2; //返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台 // row.action = 2; //返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台
this.$set(this.checkList, index, row); // this.$set(this.checkList, index, row);
this.arr.push(row); // this.arr.push(row);
this.checkList.splice(index, 1); // this.checkList.splice(index, 1);
} // }
}, // },
setRow(row, index) { // setRow(row, index) {
if (row.dataType == 0 || row.dataType == 8) { // if (row.dataType == 0 || row.dataType == 8) {
row.length = 50; // row.length = 50;
}else{ // }else{
row.length = 0; // row.length = 0;
} // }
if (row.dbColumnName=="") { // if (row.dbColumnName=="") {
row.propertyName = row.dbColumnName; // row.propertyName = row.dbColumnName;
} // }
this.$set(this.checkList, index, row); // this.$set(this.checkList, index, row);
}, // },
addNew(index, e) { // addNew(index, e) {
let name = "", // let name = "",
flag = false; // flag = false;
if (index == 0 && e == "{}") { // if (index == 0 && e == "{}") {
this.checkList.forEach((s, index) => { // this.checkList.forEach((s, index) => {
if (s.columnDescription == "") { // if (s.columnDescription == "") {
this.$Message.warning("请填写表格名称!"); // this.$Message.warning("请填写表格名称!");
return (flag = true); // return (flag = true);
} // }
if (s.propertyName == "") { // if (s.propertyName == "") {
this.$Message.warning("请填写表格属性!"); // this.$Message.warning("请填写表格属性!");
return (flag = true); // return (flag = true);
} // }
}); // });
if (flag == true) { // if (flag == true) {
return; // return;
} // }
let obj = { // let obj = {
dbColumnName: "", // dbColumnName: "",
systemName: this.systemValue, // systemName: this.systemValue,
columnDescription: name, // columnDescription: name,
defaultValue: "", // defaultValue: "",
isNullable: false, // isNullable: false,
unit: 0, // unit: 0,
link: 0, // link: 0,
dataType: 0, // dataType: 0,
isKey: false, // 是否主键 // isKey: false, // 是否主键
length: 50, // length: 50,
propertyName: "", //程序中的字段名称 // propertyName: "", //程序中的字段名称
propertyType: "", // 程序中的字段类型 // propertyType: "", // 程序中的字段类型
fieldType: 3, // fieldType: 3,
action: 1, // action: 1,
add: 0, //新增标识 // add: 0, //新增标识
}; // };
this.checkList.push(obj); // this.checkList.push(obj);
} else if (index == 1 && JSON.stringify(e) != "{}") { // } else if (index == 1 && JSON.stringify(e) != "{}") {
JSON.parse(e.content).map((item) => { // JSON.parse(e.content).map((item) => {
this.checkList.push(item); // this.checkList.push(item);
}); // });
} else { // } else {
this.$Message.warning("请选择导入字段!"); // this.$Message.warning("请选择导入字段!");
return; // return;
} // }
}, // },
handleSubmit() { handleSubmit() {
let keys = false; let keys = false;
let name = ""; let name = "";
......
...@@ -97,15 +97,7 @@ ...@@ -97,15 +97,7 @@
placeholder="请输入" placeholder="请输入"
/> />
</template> </template>
<!--
<template slot-scope="{ row, index }" slot="link">
<Input
v-model="row.link"
@on-change="setRow(row, index)"
placeholder="请输入"
number
/>
</template> -->
<template slot-scope="{ row, index }" slot="systemName"> <template slot-scope="{ row, index }" slot="systemName">
<state code="project.main.systemName" :value="row.systemName" /> <state code="project.main.systemName" :value="row.systemName" />
</template> </template>
...@@ -141,6 +133,7 @@ ...@@ -141,6 +133,7 @@
</template> </template>
<script> <script>
import Api from "../api";
export default { export default {
// name: '', // name: '',
data() { data() {
...@@ -281,18 +274,40 @@ export default { ...@@ -281,18 +274,40 @@ export default {
align: "center", align: "center",
}, },
], ],
dtos: [],
}; };
}, },
props: { props: {
dtosList: Array,
default: () => {
return [];
},
list: Array, list: Array,
default:()=>{ default: () => {
return [] return [];
} },
},
mounted() {
this.seachChange();
}, },
created() { async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
seachChange() {
let data = {
conditions: [],
pageSize: 20,
};
Api.list(data)
.then((r) => {
if (r.success) {
this.completeList = r.result;
} else {
}
})
.catch((err) => {});
},
importColumns() { importColumns() {
//导入 //导入
let changeId = {}; let changeId = {};
...@@ -328,17 +343,45 @@ export default { ...@@ -328,17 +343,45 @@ export default {
} }
}, },
setRow(row, index) { setRow(row, index) {
console.log(row.list);
if (row.list == true) { if (row.list == true) {
this.dtos[0].list.push(row); this.dtos.forEach((e, index) => {
} else { console.log(e)
this.dtos[0].list.map((q, i) => { if (e.code == "list") {
if (q.propertyName == row.propertyName) { this.dtos[index].list.push(row);
this.dtos[0].list.splice(i, 1); }
});
} else if (row.add == true) {
this.dtos.forEach((e, index) => {
if (e.code == "add") {
this.dtos[index].list.push(row);
}
});
} else if (row.list == false) {
this.dtos.forEach((e, index) => {
if (e.code == "list" && this.dtos[index].list.length > 0) {
this.dtos[index].list.map((q, i) => {
if (q.propertyName == row.propertyName) {
this.dtos[index].list.splice(i, 1);
}
});
}
});
} else if (row.add == false) {
this.dtos.forEach((e, index) => {
if (e.code == "add" && this.dtos[index].list.length > 0) {
this.dtos[index].list.map((q, i) => {
if (q.propertyName == row.propertyName) {
this.dtos[index].list.splice(i, 1);
}
});
} }
}); });
} }
console.log(this.dtos[0].list); console.log("11111");
console.log(this.dtos);
this.$emit("dtos", this.dtos);
this.checkList[index].dtos = JSON.stringify(this.dtos);
this.$emit("oncheckList", this.checkList);
if (row.dataType == 0 || row.dataType == 8) { if (row.dataType == 0 || row.dataType == 8) {
row.length = 50; row.length = 50;
} else { } else {
...@@ -394,11 +437,14 @@ export default { ...@@ -394,11 +437,14 @@ export default {
} }
}, },
}, },
watch:{ watch: {
list(v){ list(v) {
this.checkList=v; this.checkList = v;
} },
} dtosList(v) {
this.dtos = v;
},
},
}; };
</script> </script>
......
<template>
<div>
<h1>输入页面</h1>
<Row>
<Table :columns="inputColumns" :data="data">
<template slot-scope="{ row, index }" slot="columnDescription">
<div v-if="row.columnDescription != ''">
{{ row.columnDescription }}
</div>
<Input
v-else
@on-change="setRow(row, index)"
v-model="row.columnDescription"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="propertyName">
<div v-if="row.propertyName != ''">
{{ row.propertyName }}
</div>
<Input
v-else
@on-change="setRow(row, index)"
v-model="row.propertyName"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="type">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.type"
code="base.project_atom.inputDtos"
:value="row.type"
:key="row.type"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="children">
<Checkbox
v-model="row.children"
@on-change="setRow(row, index)"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="action">
<a
@click="remove(index, row)"
style="color: #ff7a8b"
v-if="row.action == 0"
>删除</a
>
</template>
</Table>
<Button type="dashed" long @click="addNew(0, '{}')" class="mt10"
>新增属性</Button
>
</Row>
</div>
</template>
<script>
export default {
// name: '',
data() {
return {
data: [],
inputColumns: [
{
title: "名称",
align: "center",
key: "columnDescription",
slot: "columnDescription",
},
{
title: "列类型",
key: "type",
align: "center",
slot: "type",
high: true,
},
{
title: "属性",
key: "propertyName",
align: "center",
slot: "propertyName",
high: true,
},
{
title: "表头分组",
align: "center",
key: "children",
slot: "children",
high: false,
},
{
width: 80,
title: "操作",
slot: "action",
align: "center",
},
],
};
},
props: {
changeTabs: String,
dtosList: Array,
default: () => {
return [];
},
},
mounted() {
this.data = [];
console.log("进入页面", this.dtosList);
let arr = this.dtosList.filter((v) => v.code == this.changeTabs);
console.log(arr);
if (arr[0].list.length > 0) {
arr[0].list.map((e) => {
let obj = {
columnDescription: e.columnDescription,
type: e.type,
propertyName: e.propertyName,
children: e.children,
action: 1, //不可删除项
};
this.data.push(obj);
});
} else {
let obj = {
columnDescription: e.columnDescription,
type: "",
propertyName: e.propertyName,
children: "",
action: 1, //不可删除项
};
this.data.push(obj);
}
},
methods: {
setRow(row, index) {
this.$set(this.data, index, row);
this.dtosList.forEach((v) => {
if (v.code == this.changeTabs) {
v.list = this.data;
}
});
console.log("提交", this.dtosList);
this.$emit("dtos", this.dtosList);
},
remove(index, row) {
if (row.action == 0) {
//新增的删除,直接删
this.data.splice(index, 1);
}
},
addNew(index, e) {
let name = "",
flag = false;
if (index == 0 && e == "{}") {
this.checkList.forEach((s, index) => {
if (s.columnDescription == "") {
this.$Message.warning("请填写表格名称!");
return (flag = true);
}
if (s.propertyName == "") {
this.$Message.warning("请填写表格属性!");
return (flag = true);
}
});
if (flag == true) {
return;
}
let obj = {
columnDescription: "",
type: "",
propertyName: "",
children: "",
action: 1, //不可删除项
};
this.checkList.push(obj);
}
// else if (index == 1 && JSON.stringify(e) != "{}") {
// JSON.parse(e.content).map((item) => {
// this.checkList.push(item);
// });
// } else {
// this.$Message.warning("请选择导入字段!");
// return;
// }
},
},
watch: {
dtosList(v) {
this.data = v;
},
},
};
</script>
\ No newline at end of file
<template>
<div>
<h1>输出页面</h1>
<Row>
<Table :columns="columns" :data="data1">
<template slot-scope="{ row, index }" slot="columnDescription">
<div v-if="row.action != 0">
{{ row.columnDescription }}
</div>
<Input
v-else
v-model="row.columnDescription"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="propertyName">
<div v-if="row.action != 0">
{{ row.propertyName }}
</div>
<Input
v-else
v-model="row.propertyName"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="type">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.type"
code="base.project_atom.inputDtos"
:value="row.type"
:key="row.type"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="width">
<Input
v-model="row.width"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="align">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.align"
code="base.project_atom.align"
:value="row.align"
:key="row.align"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="fixed">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.fixed"
code="base.project_atom.fixed"
:value="row.fixed"
:key="row.fixed"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="ellipsis">
<Checkbox
@on-change="setRow(row, index)"
v-model="row.ellipsis"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="tooltip">
<Checkbox
@on-change="setRow(row, index)"
v-model="row.tooltip"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="render">
<Checkbox
@on-change="setRow(row, index)"
v-model="row.render"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="sortable">
<Checkbox
@on-change="setRow(row, index)"
v-model="row.sortable"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="resizable">
<Input
@on-change="setRow(row, index)"
v-model="row.resizable"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="action">
<a
@click="remove(index, row)"
style="color: #ff7a8b"
v-if="row.action == 0"
>删除</a
>
</template>
</Table>
<Button type="dashed" long @click="addNew(0, '{}')" class="mt10"
>新增属性</Button
>
</Row>
</div>
</template>
<script>
import { values } from "lodash";
export default {
data() {
return {
data1: [],
columns: [
{
title: "名称",
align: "center",
key: "columnDescription",
slot: "columnDescription",
},
{
title: "列类型",
key: "type",
align: "center",
slot: "type",
high: true,
},
{
title: "属性",
key: "propertyName",
align: "center",
slot: "propertyName",
high: true,
},
{
title: "列宽",
align: "center",
key: "width",
slot: "width",
high: false,
},
{
title: "对齐方式",
align: "center",
key: "align",
slot: "align",
high: false,
},
{
title: "列固定方位",
align: "center",
key: "fixed",
slot: "fixed",
high: false,
},
{
title: "是否为省略号",
align: "center",
key: "ellipsis",
slot: "ellipsis",
high: false,
},
{
title: "Tooltip 组件使用",
align: "center",
key: "tooltip",
slot: "tooltip",
high: false,
},
{
title: "渲染render",
align: "center",
key: "render",
slot: "render",
high: false,
},
{
title: "排序",
align: "center",
key: "sortable",
slot: "sortable",
high: false,
},
{
title: "列宽度调整",
align: "center",
key: "resizable",
slot: "resizable",
high: false,
},
{
width: 80,
title: "操作",
slot: "action",
align: "center",
},
],
};
},
props: {
changeTabs: String,
dtosList: Array,
default: () => {
return [];
},
},
mounted() {
this.data1 = [];
console.log("进入页面",this.dtosList)
let arr = this.dtosList.filter((v) => v.code == this.changeTabs);
if (arr[0].list.length > 0) {
arr[0].list.map((e) => {
let obj = {
columnDescription: e.columnDescription,
type: e.type,
propertyName: e.propertyName,
width: e.width,
align: e.align,
fixed: e.fixed,
ellipsis: e.ellipsis,
tooltip: e.tooltip,
render: e.render,
sortable: e.sortable,
resizable: e.resizable,
action: 1, //不可删除项
};
this.data1.push(obj);
});
}else{
arr[0].list.map((e) => {
let obj = {
columnDescription: e.columnDescription,
type: "",
propertyName: e.propertyName,
width: "",
align:"",
fixed:"",
ellipsis: "",
tooltip:"",
render: "",
sortable: "",
resizable: "",
action: 1, //不可删除项
};
this.data1.push(obj);
});
}
},
methods: {
setRow(row, index) {
this.$set(this.data1, index, row);
this.dtosList.forEach((v) => {
if(v.code == this.changeTabs){
v.list=this.data1;
}
});
console.log("提交",this.dtosList)
this.$emit("dtos",this.dtosList );
},
addNew(index, e) {
let name = "",
flag = false;
if (index == 0 && e == "{}") {
this.data1.forEach((s, index) => {
if (s.columnDescription == "") {
this.$Message.warning("请填写表格名称!");
return (flag = true);
}
if (s.propertyName == "") {
this.$Message.warning("请填写表格属性!");
return (flag = true);
}
});
if (flag == true) {
return;
}
let obj = {
columnDescription: "",
type: "",
propertyName: "",
width: null,
align: null,
fixed: null,
ellipsis: null,
tooltip: null,
render: null,
sortable: null,
resizable: null,
action: 0, //可删除项
};
this.data1.push(obj);
}
},
remove(index, row) {
if (row.action == 0) {
//新增的删除,直接删
this.data1.splice(index, 1);
}
// else {
// // row.action = 2; //返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台
// this.$set(this.data1, index, row);
// // this.arr.push(row);
// this.data1.splice(index, 1);
// }
},
},
watch: {
dtosList(v) {
this.data1 = v;
},
},
};
</script>
\ No newline at end of file
...@@ -61,29 +61,35 @@ ...@@ -61,29 +61,35 @@
<Divider orientation="left">扩展属性</Divider> <Divider orientation="left">扩展属性</Divider>
</Row> </Row>
<Row style="margin-top: 10px"> <Row style="margin-top: 10px">
<Tabs type="card" v-model="currTab" @on-click="handleContextMenu" > <Tabs type="card" v-model="currTab" @on-click="handleContextMenu">
<TabPane label="实体定义" name="base" > </TabPane> <TabPane label="实体定义" name="base"> </TabPane>
<TabPane v-for="tab in dtos" :key="tab.code" :label="tab.name" :name="tab.code" ></TabPane> <TabPane
<Button @click="modal1 = true" size="small" slot="extra" style="margin-right: 10px;" v-for="tab in dtos"
>增加</Button> :key="tab.code"
<Button size="small" slot="extra" :label="tab.name"
>默认增加</Button> :name="tab.code"
<Modal ></TabPane>
v-model="modal1" <Button
title="增加" @click="modal1 = true"
@on-ok="okModal('formline')" size="small"
@on-cancel="cancelModal('formline')" slot="extra"
style="margin-right: 10px"
>增加</Button
> >
<Button size="small" @click="pushDtos" slot="extra"
>默认增加</Button
>
<Modal v-model="modal1" title="增加" :footer-hide="true">
<Form <Form
:model="formline" :model="modelaForm"
ref="formline" ref="modelaForm"
:rules="ruleInline" :rules="ruleInline"
:label-width="80" :label-width="80"
> >
<p> <p>
<FormItem label="名称:" prop="name"> <FormItem label="名称:" prop="name">
<Input <Input
v-model="formline.name" v-model="modelaForm.name"
placeholder="请输入名称" placeholder="请输入名称"
></Input> ></Input>
</FormItem> </FormItem>
...@@ -91,159 +97,45 @@ ...@@ -91,159 +97,45 @@
<p> <p>
<FormItem label="编码:" prop="code"> <FormItem label="编码:" prop="code">
<Input <Input
v-model="formline.code" v-model="modelaForm.code"
placeholder="请输入编码" placeholder="请输入编码"
></Input> ></Input>
</FormItem> </FormItem>
<FormItem label="类型:" prop="type">
<RadioGroup v-model="modelaForm.type">
<Radio label="0">输入</Radio>
<Radio label="1">输出</Radio>
</RadioGroup>
</FormItem>
</p>
<p>
<FormItem class="tr mt10">
<Button type="primary" @click="okModal('modelaForm')"
>确定</Button
>
<Button @click="cancelModal('modelaForm')" class="ml20"
>取消</Button
>
</FormItem>
</p> </p>
</Form> </Form>
</Modal> </Modal>
</Tabs> </Tabs>
</Row> </Row>
<component
<!-- <Row style="margin-bottom: 10px" :gutter="10"> :is="detail"
<Col :span="6"> :list="checkList"
<AutoComplete :dtosList="dtos"
v-model="completeValue" @dtos="getDtos"
icon="ios-search" :changeTabs="contextData"
placeholder="请搜索" @onchange="oncheckList"
style="width: 100%" />
>
<Option
v-for="option in completeList"
:value="option.name"
:key="option.code"
>
<span class="demo-auto-complete-title">
{{ option.name }}
</span>
<span class="demo-auto-complete-count" style="float: right">{{
option.code
}}</span>
</Option>
</AutoComplete>
</Col>
<Col :span="2">
<Button type="primary" @click="importColumns">导入</Button>
</Col>
</Row>
<Table
:columns="columns1"
:data="checkList"
border
:draggable="true"
@on-drag-drop="onDragDrop"
>
<template slot-scope="{ row, index }" slot="columnDescription">
<Input
v-model="row.columnDescription"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="dataType">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.dataType"
code="materail.category.dataType"
type="select"
:value="row.dataType"
:key="row.dataType"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="propertyName">
<Input
v-model="row.propertyName"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="dbColumnName">
<Input
v-model="row.dbColumnName"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="code">
<Input
@on-change="setRow(row, index)"
v-model="row.code"
:disabled="row.dataType != 3 && row.dataType != 10"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="isNullable">
<Checkbox
v-model="row.isNullable"
@on-change="setRow(row, index)"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="unit">
<Dictionary
:disabled="row.dataType != 0 && row.dataType != 8"
@on-change="setRow(row, index)"
v-model="row.unit"
code="materail.category.dataType"
type="select"
:value="row.dataType"
:key="row.dataType"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="length">
<Input
:disabled="row.dataType != 0 && row.dataType != 8"
v-model="row.length"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="link">
<Input
v-model="row.link"
@on-change="setRow(row, index)"
placeholder="请输入"
number
/>
</template>
<template slot-scope="{ row, index }" slot="systemName">
<state code="project.main.systemName" :value="row.systemName" />
</template>
<template slot-scope="{ row, index }" slot="list">
<Checkbox v-model="row.list" @on-change="setRow(row, index)">
</Checkbox>
</template>
<template slot-scope="{ row, index }" slot="add">
<Checkbox v-model="row.add" @on-change="setRow(row, index)">
</Checkbox>
</template>
<template slot-scope="{ row, index }" slot="uniqueness">
<Checkbox
v-model="row.uniqueness"
@on-change="setRow(row, index)"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="defaultValue">
<Input v-model="row.defaultValue" placeholder="请输入" />
</template>
<template slot-scope="{ row, index }" slot="action">
<a
@click="remove(index, row)"
style="color: #ff7a8b"
v-if="row.fieldType > 1"
>删除</a
>
</template>
</Table>
<Button type="dashed" long @click="addNew(0, '{}')" class="mt10" >新增属性</Button> -->
<!-- <Dtos :list="checkList"></Dtos> -->
<component :is="detail" :list="checkList" />
</Col> </Col>
<Col :span="24" class="tr mt10"> <Col :span="24" class="tr mt10">
<FormItem> <FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled" <Button type="primary" @click="handleSubmit" :disabled="disabled"
>保存</Button> >保存</Button
>
<Button @click="handleClose" class="ml20">取消</Button> <Button @click="handleClose" class="ml20">取消</Button>
</FormItem> </FormItem>
</Col> </Col>
...@@ -256,47 +148,24 @@ export default { ...@@ -256,47 +148,24 @@ export default {
name: "Edit", name: "Edit",
data() { data() {
return { return {
currTab:'base', currTab: "base",
detail:null, detail: null,
contextData: null, contextData: null,
formline: { modelaForm: {
name: "", name: "",
code: "", code: "",
type: "",
}, },
ruleInline: { ruleInline: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }], name: [{ required: true, message: "请输入名称", trigger: "blur" }],
code: [{ required: true, message: "请输入编码", trigger: "blur" }], code: [{ required: true, message: "请输入编码", trigger: "blur" }],
type: [{ required: true, message: "请选择类别", trigger: "change" }],
}, },
modal1: false, modal1: false,
content: { content: {
base: [], base: [],
}, },
dtos: [ dtos: [],
{
name: "列表",
code: "list",
type: 0,
list: [],
},
{
name: "新增",
code: "Add",
type: 1,
list: [],
},
{
name: "编辑",
code: "Edit",
type: 1,
list: [],
},
{
name: "查询",
code: "Search",
type: 1,
list: [],
},
],
systemValue: 0, systemValue: 0,
iconType: "ios-arrow-up", iconType: "ios-arrow-up",
textUp: "收起", textUp: "收起",
...@@ -305,175 +174,132 @@ export default { ...@@ -305,175 +174,132 @@ export default {
completeList: [], completeList: [],
codeList: [], codeList: [],
checkList: [], checkList: [],
columns1: [
{
title: "序号",
type: "index",
width: 70,
align: "center",
},
{
title: "名称(*)",
align: "center",
key: "columnDescription",
slot: "columnDescription",
width: 150,
renderHeader: (h, params) => {
return h("div", [
h("span", "名称("),
h("span", { style: { color: "red" } }, "*"),
h("span", ")"),
]);
},
},
{
title: "类型",
key: "dataType",
align: "center",
slot: "dataType",
width: 150,
high: true,
},
{
title: "字段名称",
key: "dbColumnName",
align: "center",
slot: "dbColumnName",
width: 150,
high: true,
renderHeader: (h, params) => {
return h("div", [
h("span", "字段名称("),
h("span", { style: { color: "red" } }, "*"),
h("span", ")"),
]);
},
},
{
title: "属性(*)",
align: "center",
key: "propertyName",
slot: "propertyName",
high: false,
renderHeader: (h, params) => {
return h("div", [
h("span", "属性("),
h("span", { style: { color: "red" } }, "*"),
h("span", ")"),
]);
},
},
{
title: "关联",
key: "code",
align: "center",
slot: "code",
},
{
title: "单位",
key: "unit",
align: "center",
slot: "unit",
},
{
title: "长度",
key: "length",
align: "center",
slot: "length",
},
{
title: "业务类型",
key: "systemName",
align: "center",
slot: "systemName",
width: 190,
},
{
title: "是否可空",
key: "isNullable",
align: "center",
slot: "isNullable",
width: 100,
},
{
title: "业务设置",
align: "center",
children: [
{
title: "列表",
key: "list",
align: "center",
slot: "list",
width: 70,
},
{
title: "新增",
key: "add",
align: "center",
slot: "add",
width: 70,
},
{
title: "唯一",
key: "uniqueness",
align: "center",
slot: "uniqueness",
width: 70,
},
{
title: "默认值",
key: "defaultValue",
align: "center",
slot: "defaultValue",
},
],
},
{
width: 80,
title: "操作",
slot: "action",
align: "center",
},
],
disabled: false, disabled: false,
entity: {}, entity: {},
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{ required: true, message: "请填写名称", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }], code: [{ required: true, message: "请填写编码", trigger: "blur" }],
}, },
}; };
}, },
props: { props: {
eid: Number, eid: Number,
}, },
mounted() { mounted() {
if (this.eid > 0) { if (this.eid > 0) {
this.load(this.eid); this.load(this.eid);
this.seachChange();
} }
this.detail=()=>import('./dtos') this.detail = () => import("./dtos");
}, },
methods: { methods: {
handleContextMenu(data) {console.log("+=========================") pushDtos() {
console.log(data) let arr = [
{
name: "列表",
code: "list",
type: 0,
list: [],
},
{
name: "新增",
code: "add",
type: 1,
list: [],
},
{
name: "编辑",
code: "edit",
type: 1,
list: [],
},
{
name: "查询",
code: "search",
type: 1,
list: [],
},
];
let flag = false;
if (this.dtos.length > 0) {
// arr.forEach((item,index) => {
// this.dtos.forEach((e) => {
// if (e.code == obj.code) {
// arr.splice(index,1);
// flag = true;
// return;
// }else{
// }
// });
// });
// if(flag==false){
// console.log(arr)
// this.dtos.concat(arr)
// }
// arr.forEach((item) => {
// this.dtos.forEach((e) => {
// if (e.code != item.code) {
// this.dtos.push(item);
// } else {
// this.$Message.warning("请不要重复添加编码!");
// return;
// }
// });
// });
} else {
arr.forEach((item) => {
this.dtos.push(item);
});
}
},
oncheckList(v) {
this.checkList = v;
},
getDtos(v) {
this.dtos = v;
},
handleContextMenu(data) {
console.log("tabs", data);
this.contextData = data; this.contextData = data;
if (data == "list") {
this.detail = () => import("./dtos/outDto");
} else if (data == "add") {
this.detail = () => import("./dtos/inputDto");
} else if (data == "edit") {
this.detail = () => import("./dtos/inputDto");
} else if (data == "search") {
this.detail = () => import("./dtos/inputDto");
} else {
this.detail = () => import("./dtos");
}
}, },
okModal(name) { okModal(name) {
this.$refs[name].validate((valid) => { this.$refs[name].validate((valid) => {
if (valid) { if (valid) {
let obj = { let obj = {
name: this.formline.name, name: this.modelaForm.name,
code: this.formline.code, code: this.modelaForm.code,
type: Number(this.modelaForm.type),
list: [], list: [],
}; };
this.dtos.push(obj); let flag = false;
console.log(this.dtos); if (this.dtos.length > 0) {
this.dtos.forEach((e) => {
if (e.code == obj.code) {
flag = true;
this.$Message.warning("请不要重复添加编码!");
return;
}
});
if (flag == false) {
this.dtos.push(obj);
this.modal1 = false;
}
} else {
this.modal1 = false;
this.dtos.push(obj);
}
this.$refs[name].resetFields(); this.$refs[name].resetFields();
this.modal1 = false;
} }
}); });
}, },
...@@ -481,20 +307,7 @@ export default { ...@@ -481,20 +307,7 @@ export default {
this.$refs[name].resetFields(); this.$refs[name].resetFields();
this.modal1 = false; this.modal1 = false;
}, },
// importColumns() {
// //导入
// let changeId = {};
// if (this.completeList.length > 0) {
// this.completeList.map((e, index) => {
// if (e.name == this.completeValue) {
// changeId = e;
// this.completeList.splice(index, 1);
// this.completeValue = "";
// }
// });
// this.addNew(1, changeId);
// }
// },
upClick(value) { upClick(value) {
this.upDrop = !value; this.upDrop = !value;
if (value) { if (value) {
...@@ -505,112 +318,16 @@ export default { ...@@ -505,112 +318,16 @@ export default {
this.iconType = "ios-arrow-up"; this.iconType = "ios-arrow-up";
} }
}, },
seachChange() { load(v) {debugger
let data = {
conditions: [],
pageSize: 20,
};
Api.list(data)
.then((r) => {
if (r.success) {
this.completeList = r.result;
} else {
}
})
.catch((err) => {});
},
// onDragDrop(a, b) {
// this.checkList.splice(b, 0, ...this.checkList.splice(a, 1));
// },
// remove(index, row) {
// if (row.add == 0) {
// //新增的删除,直接删
// this.checkList.splice(index, 1);
// let objArr = {
// name: row.title,
// code: row.code,
// id: row.id,
// };
// this.completeList.push(objArr);
// } else {
// row.action = 2; //返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台
// this.$set(this.checkList, index, row);
// this.arr.push(row);
// this.checkList.splice(index, 1);
// }
// },
// setRow(row, index) {
// console.log(row.list)
// if(row.list==true){
// this.dtos[0].list.push(row)
// }else{
// this.dtos[0].list.map((q,i)=>{
// if(q.propertyName==row.propertyName){
// this.dtos[0].list.splice(i,1)
// }
// })
// }
// console.log(this.dtos[0].list)
// if (row.dataType == 0 || row.dataType == 8) {
// row.length = 50;
// } else {
// row.length = 0;
// }
// if (row.dbColumnName == "") {
// row.propertyName = row.dbColumnName;
// }
// this.$set(this.checkList, index, row);
// },
// addNew(index, e) {
// let name = "",
// flag = false;
// if (index == 0 && e == "{}") {
// this.checkList.forEach((s, index) => {
// if (s.columnDescription == "") {
// this.$Message.warning("请填写表格名称!");
// return (flag = true);
// }
// if (s.propertyName == "") {
// this.$Message.warning("请填写表格属性!");
// return (flag = true);
// }
// });
// if (flag == true) {
// return;
// }
// let obj = {
// dbColumnName: "",
// systemName: this.systemValue,
// columnDescription: name,
// defaultValue: "",
// isNullable: false,
// unit: 0,
// link: 0,
// dataType: 0,
// isKey: false, // 是否主键
// length: 50,
// propertyName: "", //程序中的字段名称
// propertyType: "", // 程序中的字段类型
// fieldType: 3,
// action: 1,
// add: 0, //新增标识
// };
// this.checkList.push(obj);
// } else if (index == 1 && JSON.stringify(e) != "{}") {
// JSON.parse(e.content).map((item) => {
// this.checkList.push(item);
// });
// } else {
// this.$Message.warning("请选择导入字段!");
// return;
// }
// },
load(v) {
Api.get({ id: v }).then((r) => { Api.get({ id: v }).then((r) => {
this.entity = r.result; this.entity = r.result;
this.checkList = JSON.parse(r.result.content); if (r.result.content) {
this.checkList = JSON.parse(r.result.content);
console.log(this.checkList) }
if (r.result.dtos) {
this.dtos = JSON.parse(r.result.dtos);
console.log(this.dtos)
}
this.checkList.map((v) => { this.checkList.map((v) => {
if (v.fieldType > 1) { if (v.fieldType > 1) {
v.fieldType = 1; v.fieldType = 1;
...@@ -621,14 +338,24 @@ export default { ...@@ -621,14 +338,24 @@ export default {
} }
}); });
}); });
}); });
}, },
handleSubmit() { handleSubmit() {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
debugger
this.disabled = true; this.disabled = true;
this.entity.content = JSON.stringify(this.checkList); if (this.checkList) {
this.entity.content = JSON.stringify(this.checkList);
} else {
this.checkList = [];
}
if (this.dtos) {
console.log(this.dtos)
this.entity.dtos = JSON.stringify(this.dtos);
} else {
this.dtos = [];
}
Api.update(this.entity) Api.update(this.entity)
.then((r) => { .then((r) => {
this.disabled = false; this.disabled = false;
...@@ -662,11 +389,6 @@ export default { ...@@ -662,11 +389,6 @@ export default {
this.systemValue = 1; this.systemValue = 1;
} }
}, },
// eid(v) {
// if (v != 0) {
// this.load(v);
// }
// },
}, },
}; };
</script> </script>
......
...@@ -159,12 +159,12 @@ export default { ...@@ -159,12 +159,12 @@ export default {
this.detail = () => import("./add"); this.detail = () => import("./add");
this.modal = true; this.modal = true;
}, },
copy(id) { // copy(id) {
this.curId = id; // this.curId = id;
this.title = "克隆"; // this.title = "克隆";
this.detail = () => import("./add"); // this.detail = () => import("./add");
this.modal = true; // this.modal = true;
}, // },
view(id) { view(id) {
this.curId = id; this.curId = id;
this.title = "详情"; this.title = "详情";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment