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

零部件库

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