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

修改项目管理对象

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