Commit be5ff771 authored by 仇晓婷's avatar 仇晓婷

零部件库

parent 20adf7bb
...@@ -33,14 +33,25 @@ ...@@ -33,14 +33,25 @@
</Col> </Col>
<Col :span="24" style="padding:20px 0 0px 10px;margin-bottom:10px;" class="table-solt"> <Col :span="24" style="padding:20px 0 0px 10px;margin-bottom:10px;" class="table-solt">
<Table border :columns="columns" :data="checkList" class="tableCommon" height="300"> <Table border :columns="columns" :data="checkList" class="tableCommon" height="300">
<template slot-scope="{ row, index }" slot="title">
<div v-if="row.fieldType==1||row.fieldType==2">{{row.title}}</div>
<Input
v-if="row.fieldType==3"
v-model="row.title"
placeholder="请输入"
@on-blur="setRow(row,index)"
/>
</template>
<template slot-scope="{ row, index }" slot="note"> <template slot-scope="{ row, index }" slot="note">
<Input v-model="row.note" placeholder="请输入" @on-blur="setRow(row,index)" /> <div v-if="row.fieldType==1">{{row.note}}</div>
<Input v-model="row.note" placeholder="请输入" @on-blur="setRow(row,index)" v-else />
</template> </template>
<template slot-scope="{ row, index }" slot="datatype"> <template slot-scope="{ row, index }" slot="datatype">
<!-- <Input v-model="row.datatype" placeholder="请输入" @on-blur="setRow(row,index)" /> --> <div v-if="row.fieldType==1">{{row.datatype}}</div>
<Select v-model="row.datatype" style="width:200px" @on-change="setRow(row,index)"> <Select v-model="row.datatype" v-else>
<Option <Option
v-for="item in cityList" @on-change="setRow(row,index)"
v-for="(item,index) in cityList"
:value="item.value" :value="item.value"
:key="item.value" :key="item.value"
>{{ item.label }}</Option> >{{ item.label }}</Option>
...@@ -52,8 +63,15 @@ ...@@ -52,8 +63,15 @@
<template slot-scope="{ row, index }" slot="required"> <template slot-scope="{ row, index }" slot="required">
<Checkbox v-model="row.required" @on-change="setRow(row,index)"></Checkbox> <Checkbox v-model="row.required" @on-change="setRow(row,index)"></Checkbox>
</template> </template>
<template slot-scope="{ row, index }" slot="isunique"> <template slot-scope="{ row, index }" slot="isUnique">
<Checkbox v-model="row.isunique" @on-change="setRow(row,index)"></Checkbox> <Checkbox v-model="row.isUnique" @on-change="setRow(row,index)"></Checkbox>
</template>
<template
slot-scope="{ row, index }"
slot="action"
v-if="row.fieldType==2||row.fieldType==3"
>
<a @click="remove(index)" style="color:#FF7A8B">删除</a>
</template> </template>
</Table> </Table>
</Col> </Col>
...@@ -79,6 +97,7 @@ export default { ...@@ -79,6 +97,7 @@ export default {
upId: 0, upId: 0,
code: 0 code: 0
}, },
cityList: [ cityList: [
{ {
value: "0", value: "0",
...@@ -112,7 +131,8 @@ export default { ...@@ -112,7 +131,8 @@ export default {
{ {
title: "属性名称", title: "属性名称",
key: "title", key: "title",
align: "center" align: "center",
slot: "title"
}, },
{ {
title: "备注", title: "备注",
...@@ -140,9 +160,15 @@ export default { ...@@ -140,9 +160,15 @@ export default {
}, },
{ {
title: "是否唯一属性", title: "是否唯一属性",
key: "isunique", key: "isUnique",
align: "center", align: "center",
slot: "isunique" slot: "isUnique"
},
{
title: "操作",
slot: "action",
width: 100,
align: "center"
} }
], ],
checkList: [], checkList: [],
...@@ -159,19 +185,47 @@ export default { ...@@ -159,19 +185,47 @@ export default {
}, },
methods: { methods: {
tableData() { tableData() {
let conditions = []; let conditions = [
{
conditionalType: "In",
fieldName: "fieldType",
fieldValue: "1,2"
},
{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: "0"
}
];
Api.listTable({ conditions: conditions }).then(r => { Api.listTable({ conditions: conditions }).then(r => {
if (r.result) { if (r.result) {
console.log(r); var arr = r.result;
this.checkList = r.result; this.checkList = arr.filter(function(item) {
delete item["id"];
return item
});
} }
}); });
}, },
remove(index) {
this.checkList.splice(index, 1);
},
setRow() { setRow() {
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
}, },
addNew() {}, addNew() {
let obj = {
title: "",
note: "",
datatype: "",
required: false,
isunique: false,
fieldType: 3,
categoryId: 0
};
this.checkList.push(obj);
},
handleSubmit() { handleSubmit() {
this.$refs.form.validate(v => { this.$refs.form.validate(v => {
if (v) { if (v) {
......
...@@ -33,14 +33,25 @@ ...@@ -33,14 +33,25 @@
</Col> </Col>
<Col :span="24" style="padding:20px 0 0px 10px;margin-bottom:10px;" class="table-solt"> <Col :span="24" style="padding:20px 0 0px 10px;margin-bottom:10px;" class="table-solt">
<Table border :columns="columns" :data="checkList" class="tableCommon" height="300"> <Table border :columns="columns" :data="checkList" class="tableCommon" height="300">
<template slot-scope="{ row, index }" slot="title">
<div v-if="row.fieldType==1||row.fieldType==2">{{row.title}}</div>
<Input
v-if="row.fieldType==3"
v-model="row.title"
placeholder="请输入"
@on-blur="setRow(row,index)"
/>
</template>
<template slot-scope="{ row, index }" slot="note"> <template slot-scope="{ row, index }" slot="note">
<Input v-model="row.note" placeholder="请输入" @on-blur="setRow(row,index)" /> <div v-if="row.fieldType==1">{{row.note}}</div>
<Input v-model="row.note" placeholder="请输入" @on-blur="setRow(row,index)" v-else />
</template> </template>
<template slot-scope="{ row, index }" slot="datatype"> <template slot-scope="{ row, index }" slot="datatype">
<!-- <Input v-model="row.datatype" placeholder="请输入" @on-blur="setRow(row,index)" /> --> <div v-if="row.fieldType==1">{{row.datatype}}</div>
<Select v-model="row.datatype" style="width:200px" @on-change="setRow(row,index)"> <Select v-model="row.datatype" v-else>
<Option <Option
v-for="item in cityList" @on-change="setRow(row,index)"
v-for="(item,index) in cityList"
:value="item.value" :value="item.value"
:key="item.value" :key="item.value"
>{{ item.label }}</Option> >{{ item.label }}</Option>
...@@ -52,8 +63,15 @@ ...@@ -52,8 +63,15 @@
<template slot-scope="{ row, index }" slot="required"> <template slot-scope="{ row, index }" slot="required">
<Checkbox v-model="row.required" @on-change="setRow(row,index)"></Checkbox> <Checkbox v-model="row.required" @on-change="setRow(row,index)"></Checkbox>
</template> </template>
<template slot-scope="{ row, index }" slot="isunique"> <template slot-scope="{ row, index }" slot="isUnique">
<Checkbox v-model="row.isunique" @on-change="setRow(row,index)"></Checkbox> <Checkbox v-model="row.isUnique" @on-change="setRow(row,index)"></Checkbox>
</template>
<template
slot-scope="{ row, index }"
slot="action"
v-if="row.fieldType==2||row.fieldType==3"
>
<a @click="remove(index)" style="color:#FF7A8B">删除</a>
</template> </template>
</Table> </Table>
</Col> </Col>
...@@ -73,6 +91,7 @@ ...@@ -73,6 +91,7 @@
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
props: ["nodeInfo"],
data() { data() {
return { return {
entity: { entity: {
...@@ -143,6 +162,12 @@ export default { ...@@ -143,6 +162,12 @@ export default {
key: "isunique", key: "isunique",
align: "center", align: "center",
slot: "isunique" slot: "isunique"
},
{
title: "操作",
slot: "action",
width: 100,
align: "center"
} }
], ],
checkList: [], checkList: [],
...@@ -151,13 +176,22 @@ export default { ...@@ -151,13 +176,22 @@ export default {
} }
}; };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
mounted() { mounted() {
this.tableData(); this.tableData();
this.get();
}, },
methods: { methods: {
get() {
Api.get({ id: this.nodeInfo.id }).then(r => {
if (r.result) {
this.entity = r.result;
}
});
},
tableData() { tableData() {
let conditions = []; let conditions = [];
Api.listTable({ conditions: conditions }).then(r => { Api.listTable({ conditions: conditions }).then(r => {
...@@ -167,11 +201,24 @@ export default { ...@@ -167,11 +201,24 @@ export default {
} }
}); });
}, },
remove(index) {
this.checkList.splice(index, 1);
},
setRow() { setRow() {
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
}, },
addNew() {}, addNew() {
let obj = {
title: "",
note: "",
datatype: "",
required: false,
isunique: false,
fieldType: 3,
categoryId: 0
};
this.checkList.push(obj);
},
handleSubmit() { handleSubmit() {
this.$refs.form.validate(v => { this.$refs.form.validate(v => {
if (v) { if (v) {
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<!-- <Product :parent="parent" /> --> <!-- <Product :parent="parent" /> -->
</Content> </Content>
</Layout> </Layout>
<Modal v-model="modal" :title="title" width="1000" footer-hide> <Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false">
<component :is="detail" :eid="curId" :nodeInfo="nodeInfo" @on-close="cancel" @on-ok="ok" /> <component :is="detail" :eid="curId" :nodeInfo="nodeInfo" @on-close="cancel" @on-ok="ok" />
</Modal> </Modal>
</div> </div>
......
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