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

物料主数据分类管理

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