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

物料分类顶级新增加固有属性

parent daabb5f2
...@@ -25,7 +25,11 @@ ...@@ -25,7 +25,11 @@
</Col> </Col>
<Col :span="24"> <Col :span="24">
<FormItem label="描述" prop="description"> <FormItem label="描述" prop="description">
<Input v-model="entity.description" type="textarea" placeholder="请输入..."></Input> <Input
v-model="entity.description"
type="textarea"
placeholder="请输入..."
></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="24"> <Col :span="24">
...@@ -33,30 +37,37 @@ ...@@ -33,30 +37,37 @@
<!-- <h4>扩展属性</h4> --> <!-- <h4>扩展属性</h4> -->
<Table :columns="columns" :data="checkList" border> <Table :columns="columns" :data="checkList" border>
<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>
<Input <Input
v-if="row.fieldType==3" v-if="row.fieldType == 3"
v-model="row.title" v-model="row.title"
placeholder="请输入名称" placeholder="请输入名称"
@on-blur="setRow(row,index)" @on-blur="setRow(row, index)"
/> />
</template> </template>
<template slot-scope="{ row, index }" slot="note"> <template slot-scope="{ row, index }" slot="note">
<!-- <Input v-if="row.dataType==3" v-model="row.note" placeholder="请输入字典编码" @on-blur="setRow(row,index)" /> --> <!-- <Input v-if="row.dataType==3" v-model="row.note" placeholder="请输入字典编码" @on-blur="setRow(row,index)" /> -->
<Select <Select
v-if="row.dataType==3" v-if="row.dataType == 3"
v-model="row.note" v-model="row.note"
clearable clearable
transfer transfer
@on-change="setRow(row,index)" @on-change="setRow(row, index)"
>
<Option
v-for="item in codeList"
:value="item.code"
:key="item.code"
>{{ item.name }}</Option
> >
<Option v-for="item in codeList" :value="item.code" :key="item.code">{{ item.name }}</Option>
</Select> </Select>
<span v-else>{{row.note}}</span> <span v-else>{{ row.note }}</span>
</template> </template>
<template slot-scope="{ row, index }" slot="dataType"> <template slot-scope="{ row, index }" slot="dataType">
<Dictionary <Dictionary
@on-change="setRow(row,index)" @on-change="setRow(row, index)"
v-model="row.dataType" v-model="row.dataType"
code="materail.category.dataType" code="materail.category.dataType"
type="select" type="select"
...@@ -66,8 +77,8 @@ ...@@ -66,8 +77,8 @@
</template> </template>
<template slot-scope="{ row, index }" slot="unitName"> <template slot-scope="{ row, index }" slot="unitName">
<Dictionary <Dictionary
v-if="row.dataType==1||row.dataType==2" v-if="row.dataType == 1 || row.dataType == 2"
@on-change="setRow(row,index)" @on-change="setRow(row, index)"
v-model="row.unitName" v-model="row.unitName"
code="material.main.unitName" code="material.main.unitName"
type="select" type="select"
...@@ -77,17 +88,30 @@ ...@@ -77,17 +88,30 @@
></Dictionary> ></Dictionary>
</template> </template>
<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>
<template slot-scope="{ row, index }" slot="action"> <template slot-scope="{ row, index }" slot="action">
<a @click="remove(index,row)" style="color:#FF7A8B" v-if="row.fieldType>1">删除</a> <a
@click="remove(index, row)"
style="color: #ff7a8b"
v-if="row.fieldType > 1"
>删除</a
>
</template> </template>
</Table> </Table>
<Button type="dashed" long @click="addNew" class="mt10">新增属性</Button> <Button type="dashed" long @click="addNew" class="mt10"
>新增属性</Button
>
</Col> </Col>
<Col :span="24" class="tr mt10"> <Col :span="24" class="tr mt10">
<FormItem> <FormItem>
...@@ -168,7 +192,61 @@ export default { ...@@ -168,7 +192,61 @@ export default {
align: "center", align: "center",
}, },
], ],
checkList: [], checkList: [
{
field: "drawing",
title: "图号",
note: "",
dataType: 0,
unitName: "",
required: false,
isunique: false,
fieldType: 1,
categoryId: 0,
action: 1,
add: 0, //新增标识
},
{
field: "version",
title: "版本",
note: "",
dataType: 0,
unitName: "",
required: true,
isunique: false,
fieldType: 1,
categoryId: 0,
action: 1,
add: 0, //新增标识
},
{
field: "name",
title: "名称",
note: "",
dataType: 0,
unitName: "",
required: true,
isunique: false,
fieldType: 1, //共有属性(不能删除)
categoryId: 0,
action: 1,
add: 0, //新增标识
},
{
field: "description",
title: "描述",
note: "",
dataType: 8,
unitName: "",
required: false,
isunique: true,
fieldType: 1, //共有属性(不能删除)
categoryId: 0,
action: 1,
add: 0, //新增标识
},
],
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{ required: true, message: "必填", trigger: "blur" }],
}, },
...@@ -206,12 +284,14 @@ export default { ...@@ -206,12 +284,14 @@ export default {
}).then((r) => { }).then((r) => {
if (r.result) { if (r.result) {
var arr = r.result; var arr = r.result;
this.checkList = arr.filter(function (item) { let dataList = [];
dataList = arr.filter(function (item) {
item.mid = item.id; item.mid = item.id;
delete item["id"]; //删除属性id delete item["id"]; //删除属性id
// return item.fieldType > 1; // return item.fieldType > 1;
return true; return true;
}); });
this.checkList = this.checkList.concat(dataList);
} }
}); });
Api.getChildren({ id: 582 }).then((r) => { Api.getChildren({ id: 582 }).then((r) => {
......
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