Commit 0ea63655 authored by 骆瑛's avatar 骆瑛

修改项目管理对象

parent f142a1c0
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
</Modal> --> </Modal> -->
</Tabs> </Tabs>
</Row> </Row>
<component :is="detail" :list="checkList" /> <component :is="detail" :list="checkList" :dtosList="dtos" @dtos="getDtos" @onchange="oncheckList"/>
<!-- <Row> --> <!-- <Row> -->
<!-- <Row style="margin-bottom: 10px" :gutter="10"> <!-- <Row style="margin-bottom: 10px" :gutter="10">
<Col :span="6"> <Col :span="6">
...@@ -443,6 +443,13 @@ export default { ...@@ -443,6 +443,13 @@ export default {
this.detail=()=>import('./dtos') this.detail=()=>import('./dtos')
}, },
methods: { methods: {
oncheckList(v) {
this.checkList = v;
},
getDtos(v) {
console.log("getDtos",v)
this.dtos = v;
},
// 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));
// }, // },
...@@ -554,7 +561,7 @@ export default { ...@@ -554,7 +561,7 @@ export default {
// return; // return;
// } // }
// }, // },
handleSubmit() { handleSubmit() {debugger
let keys = false; let keys = false;
let name = ""; let name = "";
this.checkList.forEach((s, index) => { this.checkList.forEach((s, index) => {
...@@ -590,7 +597,17 @@ export default { ...@@ -590,7 +597,17 @@ export default {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
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) {
this.entity.dtos = JSON.stringify(this.dtos);
} else {
this.dtos = [];
}
console.log("this.entity",this.entity)
Api.create(this.entity) Api.create(this.entity)
.then((r) => { .then((r) => {
this.disabled = false; this.disabled = false;
......
...@@ -68,9 +68,10 @@ ...@@ -68,9 +68,10 @@
<Input <Input
@on-change="setRow(row, index)" @on-change="setRow(row, index)"
v-model="row.code" v-model="row.code"
:disabled="row.dataType != 3 && row.dataType != 10" v-if="row.dataType == 3 || row.dataType == 10"
placeholder="请输入" placeholder="请输入"
/> />
<div v-else>{{ row.code }}</div>
</template> </template>
<template slot-scope="{ row, index }" slot="isNullable"> <template slot-scope="{ row, index }" slot="isNullable">
<Checkbox <Checkbox
...@@ -80,7 +81,7 @@ ...@@ -80,7 +81,7 @@
</template> </template>
<template slot-scope="{ row, index }" slot="unit"> <template slot-scope="{ row, index }" slot="unit">
<Dictionary <Dictionary
:disabled="row.dataType != 0 && row.dataType != 8" v-if="row.dataType == 1 || row.dataType == 2"
@on-change="setRow(row, index)" @on-change="setRow(row, index)"
v-model="row.unit" v-model="row.unit"
code="materail.category.dataType" code="materail.category.dataType"
...@@ -88,6 +89,8 @@ ...@@ -88,6 +89,8 @@
:value="row.dataType" :value="row.dataType"
:key="row.dataType" :key="row.dataType"
></Dictionary> ></Dictionary>
<div v-else>{{ row.unit }}</div>
</template> </template>
<template slot-scope="{ row, index }" slot="length"> <template slot-scope="{ row, index }" slot="length">
<Input <Input
...@@ -135,7 +138,6 @@ ...@@ -135,7 +138,6 @@
<script> <script>
import Api from "../api"; import Api from "../api";
export default { export default {
// name: '',
data() { data() {
return { return {
checkList: this.list, checkList: this.list,
...@@ -175,7 +177,7 @@ export default { ...@@ -175,7 +177,7 @@ export default {
key: "dbColumnName", key: "dbColumnName",
align: "center", align: "center",
slot: "dbColumnName", slot: "dbColumnName",
width: 150, width: 200,
high: true, high: true,
renderHeader: (h, params) => { renderHeader: (h, params) => {
return h("div", [ return h("div", [
...@@ -190,6 +192,7 @@ export default { ...@@ -190,6 +192,7 @@ export default {
align: "center", align: "center",
key: "propertyName", key: "propertyName",
slot: "propertyName", slot: "propertyName",
width: 200,
high: false, high: false,
renderHeader: (h, params) => { renderHeader: (h, params) => {
return h("div", [ return h("div", [
...@@ -218,6 +221,7 @@ export default { ...@@ -218,6 +221,7 @@ export default {
key: "length", key: "length",
align: "center", align: "center",
slot: "length", slot: "length",
width: 100,
}, },
{ {
title: "业务类型", title: "业务类型",
...@@ -274,7 +278,7 @@ export default { ...@@ -274,7 +278,7 @@ export default {
align: "center", align: "center",
}, },
], ],
dtos: [], dtos: this.dtosList,
}; };
}, },
props: { props: {
...@@ -326,7 +330,7 @@ export default { ...@@ -326,7 +330,7 @@ export default {
this.checkList.splice(b, 0, ...this.checkList.splice(a, 1)); this.checkList.splice(b, 0, ...this.checkList.splice(a, 1));
}, },
remove(index, row) { remove(index, row) {
if (row.add == 0) { if (row.ident == 0) {
//新增的删除,直接删 //新增的删除,直接删
this.checkList.splice(index, 1); this.checkList.splice(index, 1);
let objArr = { let objArr = {
...@@ -343,56 +347,90 @@ export default { ...@@ -343,56 +347,90 @@ export default {
} }
}, },
setRow(row, index) { setRow(row, index) {
if (row.list == true) { debugger;
console.log("dtosrow", this.dtos);
if (row.list == true || row.add == true) {
if (this.dtos.length == 0) {
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: [],
},
];
this.dtos = [...arr];
}
this.dtos.forEach((e, index) => { this.dtos.forEach((e, index) => {
console.log(e) if (e.code == "list" && row.list == true) {
if (e.code == "list") {
this.dtos[index].list.push(row); this.dtos[index].list.push(row);
} } else if (e.code == "add" && row.add == true) {
});
} else if (row.add == true) {
this.dtos.forEach((e, index) => {
if (e.code == "add") {
this.dtos[index].list.push(row); this.dtos[index].list.push(row);
} }
}); });
} else if (row.list == false) { } else if (row.list == false || row.add == false) {
this.dtos.forEach((e, index) => { if (this.dtos.length > 0) {
if (e.code == "list" && this.dtos[index].list.length > 0) { this.dtos.forEach((e, index) => {
this.dtos[index].list.map((q, i) => { if (
if (q.propertyName == row.propertyName) { e.code == "list" &&
this.dtos[index].list.splice(i, 1); this.dtos[index].list.length > 0 &&
} row.list == false
}); ) {
} this.dtos[index].list.map((q, i) => {
}); if (q.propertyName == row.propertyName) {
} else if (row.add == false) { this.dtos[index].list.splice(i, 1);
this.dtos.forEach((e, index) => { }
if (e.code == "add" && this.dtos[index].list.length > 0) { });
this.dtos[index].list.map((q, i) => { } else if (
if (q.propertyName == row.propertyName) { e.code == "add" &&
this.dtos[index].list.splice(i, 1); this.dtos[index].list.length > 0 &&
} row.add == false
}); ) {
} this.dtos[index].list.map((q, i) => {
}); if (q.propertyName == row.propertyName) {
this.dtos[index].list.splice(i, 1);
}
});
}
});
}
} }
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 {
row.length = 0; row.length = 0;
} }
if (row.dbColumnName == "") { if (row.propertyName == "") {
row.propertyName = row.dbColumnName; row.propertyName = row.dbColumnName;
} }
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
this.$emit("dtos", this.dtos);
if (this.dtos.length > 0) {
this.checkList[index].dtos = JSON.stringify(this.dtos);
}
this.$emit("oncheckList", this.checkList);
}, },
addNew(index, e) { addNew(index, e) {
console.log("addNew", e);
let name = "", let name = "",
flag = false; flag = false;
if (index == 0 && e == "{}") { if (index == 0 && e == "{}") {
...@@ -415,7 +453,7 @@ export default { ...@@ -415,7 +453,7 @@ export default {
columnDescription: name, columnDescription: name,
defaultValue: "", defaultValue: "",
isNullable: false, isNullable: false,
unit: 0, unit: null,
link: 0, link: 0,
dataType: 0, dataType: 0,
isKey: false, // 是否主键 isKey: false, // 是否主键
...@@ -424,17 +462,28 @@ export default { ...@@ -424,17 +462,28 @@ export default {
propertyType: "", // 程序中的字段类型 propertyType: "", // 程序中的字段类型
fieldType: 3, fieldType: 3,
action: 1, action: 1,
add: 0, //新增标识 add: false,
uniqueness: false,
list: false,
ident: 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) => { if (e.content != "") {
this.checkList.push(item); this.checkList = [...JSON.parse(e.content)];
}); }
if (e.dtos != "") {
this.dtos = [...JSON.parse(e.dtos)];
}
} else { } else {
this.$Message.warning("请选择导入字段!"); this.$Message.warning("请选择导入字段!");
return; return;
} }
// this.$emit("dtos", this.dtos);
// if (this.dtos.length > 0) {
// this.checkList[index].dtos = JSON.stringify(this.dtos);
// }
// this.$emit("oncheckList", this.checkList);
}, },
}, },
watch: { watch: {
...@@ -443,10 +492,8 @@ export default { ...@@ -443,10 +492,8 @@ export default {
}, },
dtosList(v) { dtosList(v) {
this.dtos = v; this.dtos = v;
console.log("dtosList", v);
}, },
}, },
}; };
</script> </script>
\ No newline at end of file
<style scoped>
</style>
\ No newline at end of file
<template> <template>
<div> <div>
<h1>输入页面</h1>
<Row> <Row>
<Table :columns="inputColumns" :data="data"> <Table :columns="inputColumns" :data="data">
<template slot-scope="{ row, index }" slot="columnDescription"> <template slot-scope="{ row, index }" slot="columnDescription">
...@@ -81,7 +80,7 @@ export default { ...@@ -81,7 +80,7 @@ export default {
title: "属性", title: "属性",
key: "propertyName", key: "propertyName",
align: "center", align: "center",
slot: "propertyName", slot: "propertyName",
high: true, high: true,
}, },
{ {
...@@ -124,14 +123,16 @@ export default { ...@@ -124,14 +123,16 @@ export default {
this.data.push(obj); this.data.push(obj);
}); });
} else { } else {
let obj = { arr[0].list.map((e) => {
columnDescription: e.columnDescription, let obj = {
type: "", columnDescription: e.columnDescription,
propertyName: e.propertyName, type: "",
children: "", propertyName: e.propertyName,
action: 1, //不可删除项 children: "",
}; action: 1, //不可删除项
this.data.push(obj); };
this.data.push(obj);
});
} }
}, },
methods: { methods: {
......
...@@ -318,16 +318,19 @@ export default { ...@@ -318,16 +318,19 @@ export default {
this.iconType = "ios-arrow-up"; this.iconType = "ios-arrow-up";
} }
}, },
load(v) {debugger load(v) {
Api.get({ id: v }).then((r) => { Api.get({ id: v }).then((r) => {
debugger;
this.entity = r.result; this.entity = r.result;
if (r.result.content) { if (r.result.content) {
this.checkList = JSON.parse(r.result.content); this.checkList = JSON.parse(r.result.content);
} }
if (r.result.dtos) { if (r.result.dtos) {
this.dtos = JSON.parse(r.result.dtos); this.dtos = JSON.parse(r.result.dtos);
console.log(this.dtos)
} }
console.log(" this.entity", this.entity);
console.log(" this.checkList", this.checkList);
console.log(" this.dtos", this.dtos);
this.checkList.map((v) => { this.checkList.map((v) => {
if (v.fieldType > 1) { if (v.fieldType > 1) {
v.fieldType = 1; v.fieldType = 1;
...@@ -341,9 +344,40 @@ export default { ...@@ -341,9 +344,40 @@ export default {
}); });
}, },
handleSubmit() { handleSubmit() {
let keys = false;
let name = "";
this.checkList.forEach((s, index) => {
if (s.columnDescription == "") {
this.$Message.warning("请填写表格名称!");
return (keys = true);
}
if (s.propertyName == "") {
this.$Message.warning("请填写表格属性!");
return (keys = true);
}
});
if (this.checkList.length >= 2) {
for (var i = 1; i < this.checkList.length; i++) {
if (
this.checkList[0].columnDescription ==
this.checkList[i].columnDescription
) {
this.$Message.error("表格名称重复!");
return (keys = true);
}
if (
this.checkList[0].propertyName == this.checkList[i].propertyName
) {
this.$Message.error("表格属性重复!");
return (keys = true);
}
}
}
if (keys == true) {
return;
}
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
debugger
this.disabled = true; this.disabled = true;
if (this.checkList) { if (this.checkList) {
this.entity.content = JSON.stringify(this.checkList); this.entity.content = JSON.stringify(this.checkList);
...@@ -351,7 +385,6 @@ export default { ...@@ -351,7 +385,6 @@ export default {
this.checkList = []; this.checkList = [];
} }
if (this.dtos) { if (this.dtos) {
console.log(this.dtos)
this.entity.dtos = JSON.stringify(this.dtos); this.entity.dtos = JSON.stringify(this.dtos);
} else { } else {
this.dtos = []; this.dtos = [];
......
<template> <template>
<Form ref="form" :model="condition" :label-width="90"> <Form ref="form" :model="condition" :label-width="90">
<Row> <Row>
<Col :span="12" :v-if="condition.id.show" <!-- <Col :span="12" :v-if="condition.id.show"
><FormItem :label="$t('id')" prop="id"> >
<Input v-model="condition.id.value" number> </Input> </FormItem <FormItem :label="$t('id')" prop="id">
></Col> <Input v-model="condition.id.value" number> </Input>
</FormItem
>
</Col>
<Col :span="12" :v-if="condition.creationTime.show" <Col :span="12" :v-if="condition.creationTime.show"
><FormItem :label="l('creationTime')" prop="creationTime"> ><FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker <DatePicker
...@@ -94,7 +97,7 @@ ...@@ -94,7 +97,7 @@
<Col :span="12" :v-if="condition.projectId.show" <Col :span="12" :v-if="condition.projectId.show"
><FormItem :label="l('projectId')" prop="projectId"> ><FormItem :label="l('projectId')" prop="projectId">
<Input v-model="condition.projectId.value"> </Input> </FormItem <Input v-model="condition.projectId.value"> </Input> </FormItem
></Col> ></Col> -->
</Row> </Row>
</Form> </Form>
</template> </template>
......
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