Commit 08c22d25 authored by 仇晓婷's avatar 仇晓婷

物料主数据分类管理

parent 0fc2457c
...@@ -46,16 +46,20 @@ ...@@ -46,16 +46,20 @@
<div v-if="row.fieldType==1">{{row.note}}</div> <div v-if="row.fieldType==1">{{row.note}}</div>
<Input v-model="row.note" placeholder="请输入" @on-blur="setRow(row,index)" v-else /> <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">
<div v-if="row.fieldType==1">{{row.datatype}}</div> <state
<Select v-model="row.datatype" v-else> v-if="row.fieldType==1"
<Option code="materail.category.dataType"
@on-change="setRow(row,index)" :value="row.dataType"
v-for="(item,index) in cityList" type="text"
:value="item.value" ></state>
:key="item.value" <Dictionary
>{{ item.label }}</Option> v-else
</Select> code="materail.category.dataType"
type="select"
:value="row.dataType"
:key="row.dataType"
></Dictionary>
</template> </template>
<!-- <template slot-scope="{ row, index }" slot="result"> <!-- <template slot-scope="{ row, index }" slot="result">
<Input v-model="row.result" placeholder="请输入" @on-blur="setRow(row,index)" /> <Input v-model="row.result" placeholder="请输入" @on-blur="setRow(row,index)" />
...@@ -71,7 +75,7 @@ ...@@ -71,7 +75,7 @@
slot="action" slot="action"
v-if="row.fieldType==2||row.fieldType==3" v-if="row.fieldType==2||row.fieldType==3"
> >
<a @click="remove(index)" style="color:#FF7A8B">删除</a> <a @click="remove(index,row)" style="color:#FF7A8B">删除</a>
</template> </template>
</Table> </Table>
</Col> </Col>
...@@ -93,33 +97,11 @@ import Api from "./api"; ...@@ -93,33 +97,11 @@ import Api from "./api";
export default { export default {
data() { data() {
return { return {
arr: [],
entity: { entity: {
upId: 0, upId: 0,
code: 0 code: 0
}, },
cityList: [
{
value: "0",
label: "Number"
},
{
value: "1",
label: "string"
},
{
value: "2",
label: "Null"
},
{
value: "3",
label: "Boolean"
},
{
value: "4",
label: "Undefined"
}
],
disabled: false, disabled: false,
columns: [ columns: [
{ {
...@@ -142,9 +124,9 @@ export default { ...@@ -142,9 +124,9 @@ export default {
}, },
{ {
title: "属性类型", title: "属性类型",
key: "datatype", key: "dataType",
align: "center", align: "center",
slot: "datatype" slot: "dataType"
}, },
// { // {
// title: "是否显示", // title: "是否显示",
...@@ -208,8 +190,16 @@ export default { ...@@ -208,8 +190,16 @@ export default {
} }
}); });
}, },
remove(index) { remove(index, row) {
this.checkList.splice(index, 1); if (row.add == 0) {
//新增的删除,直接删
this.checkList.splice(index, 1);
} else {
row.action = 2; //返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台
this.$set(this.checkList, index, row);
this.arr.push(row);
this.checkList.splice(index, 1);
}
}, },
setRow() { setRow() {
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
...@@ -218,12 +208,13 @@ export default { ...@@ -218,12 +208,13 @@ export default {
let obj = { let obj = {
title: "", title: "",
note: "", note: "",
datatype: "", dataType: "",
required: false, required: false,
isunique: false, isunique: false,
fieldType: 3, fieldType: 3,
categoryId: 0, categoryId: 0,
action: 1 action: 1,
add: 0 //新增标识
}; };
this.checkList.push(obj); this.checkList.push(obj);
}, },
...@@ -231,7 +222,7 @@ export default { ...@@ -231,7 +222,7 @@ export default {
this.$refs.form.validate(v => { this.$refs.form.validate(v => {
if (v) { if (v) {
let categoryDto = this.entity; let categoryDto = this.entity;
let pro = this.checkList; let pro = this.checkList.concat(this.arr);
Api.create({ categoryDto: categoryDto, pro: pro }) Api.create({ categoryDto: categoryDto, pro: pro })
.then(r => { .then(r => {
if (r.success) { if (r.success) {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<h4>属性配置</h4> <h4>属性配置</h4>
</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">
<!--fieldType 1.固有,2.默认,3自定义; -->
<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"> <template slot-scope="{ row, index }" slot="title">
<div v-if="row.fieldType==1||row.fieldType==2">{{row.title}}</div> <div v-if="row.fieldType==1||row.fieldType==2">{{row.title}}</div>
...@@ -41,16 +42,20 @@ ...@@ -41,16 +42,20 @@
<div v-if="row.fieldType==1">{{row.note}}</div> <div v-if="row.fieldType==1">{{row.note}}</div>
<Input v-model="row.note" placeholder="请输入" @on-blur="setRow(row,index)" v-else /> <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">
<div v-if="row.fieldType==1">{{row.datatype}}</div> <state
<Select v-model="row.datatype" v-else> v-if="row.fieldType==1"
<Option code="materail.category.dataType"
@on-change="setRow(row,index)" :value="row.dataType"
v-for="(item,index) in cityList" type="text"
:value="item.value" ></state>
:key="item.value" <Dictionary
>{{ item.label }}</Option> v-else
</Select> code="materail.category.dataType"
type="select"
:value="row.dataType"
:key="row.dataType"
></Dictionary>
</template> </template>
<!-- <template slot-scope="{ row, index }" slot="result"> <!-- <template slot-scope="{ row, index }" slot="result">
<Input v-model="row.result" placeholder="请输入" @on-blur="setRow(row,index)" /> <Input v-model="row.result" placeholder="请输入" @on-blur="setRow(row,index)" />
...@@ -66,7 +71,7 @@ ...@@ -66,7 +71,7 @@
slot="action" slot="action"
v-if="row.fieldType==2||row.fieldType==3" v-if="row.fieldType==2||row.fieldType==3"
> >
<a @click="remove(index)" style="color:#FF7A8B">删除</a> <a @click="remove(index,row)" style="color:#FF7A8B">删除</a>
</template> </template>
</Table> </Table>
</Col> </Col>
...@@ -93,28 +98,7 @@ export default { ...@@ -93,28 +98,7 @@ export default {
upId: 0, upId: 0,
code: 0 code: 0
}, },
cityList: [ arr: [],
{
value: "0",
label: "Number"
},
{
value: "1",
label: "string"
},
{
value: "2",
label: "Null"
},
{
value: "3",
label: "Boolean"
},
{
value: "4",
label: "Undefined"
}
],
disabled: false, disabled: false,
columns: [ columns: [
{ {
...@@ -137,9 +121,9 @@ export default { ...@@ -137,9 +121,9 @@ export default {
}, },
{ {
title: "属性类型", title: "属性类型",
key: "datatype", key: "dataType",
align: "center", align: "center",
slot: "datatype" slot: "dataType"
}, },
// { // {
// title: "是否显示", // title: "是否显示",
...@@ -203,8 +187,15 @@ export default { ...@@ -203,8 +187,15 @@ export default {
} }
}); });
}, },
remove(index) { remove(index, row) {
this.checkList.splice(index, 1); if (row.add == 0) {
this.checkList.splice(index, 1);
} else {
row.action = 2;
this.$set(this.checkList, index, row);
this.arr.push(row);
this.checkList.splice(index, 1);
}
}, },
setRow() { setRow() {
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
...@@ -214,12 +205,13 @@ export default { ...@@ -214,12 +205,13 @@ export default {
let obj = { let obj = {
title: "", title: "",
note: "", note: "",
datatype: "", dataType: "",
required: false, required: false,
isunique: false, isunique: false,
fieldType: 3, fieldType: 3,
categoryId: 0, categoryId: 0,
action: 1 action: 1,
add: 0
}; };
arr.push(obj); arr.push(obj);
this.checkList = arr; this.checkList = arr;
...@@ -228,7 +220,7 @@ export default { ...@@ -228,7 +220,7 @@ export default {
this.$refs.form.validate(v => { this.$refs.form.validate(v => {
if (v) { if (v) {
let categoryDto = this.entity; let categoryDto = this.entity;
let pro = this.checkList; let pro = this.checkList.concat(this.arr);
Api.update({ categoryDto: categoryDto, pro: pro }) Api.update({ categoryDto: categoryDto, pro: pro })
.then(r => { .then(r => {
if (r.success) { if (r.success) {
......
...@@ -56,8 +56,15 @@ ...@@ -56,8 +56,15 @@
<!-- <Product :parent="parent" /> --> <!-- <Product :parent="parent" /> -->
</Content> </Content>
</Layout> </Layout>
<Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false"> <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"
ref="chlidren"
/>
</Modal> </Modal>
</div> </div>
</template> </template>
...@@ -109,6 +116,7 @@ export default { ...@@ -109,6 +116,7 @@ export default {
this.title = "新增"; this.title = "新增";
this.detail = () => import("./add"); this.detail = () => import("./add");
this.modal = true; this.modal = true;
this.$refs.chlidren.arr = [];
}, },
add() { add() {
this.curId = 0; this.curId = 0;
...@@ -119,6 +127,7 @@ export default { ...@@ -119,6 +127,7 @@ export default {
edit() { edit() {
if (this.nodeInfo.upId == 0) { if (this.nodeInfo.upId == 0) {
this.detail = () => import("./edit"); this.detail = () => import("./edit");
this.$refs.chlidren.arr = [];
} else { } else {
this.detail = () => import("./sonEdit"); this.detail = () => import("./sonEdit");
} }
......
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