Commit 6bcd208b authored by 仇晓婷's avatar 仇晓婷

物料主数据

parent d4efdb51
......@@ -70,30 +70,30 @@ export default {
// this.tableData();
},
methods: {
tableData() {
let conditions = [
{
conditionalType: "In",
fieldName: "fieldType",
fieldValue: "1,2"
},
{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: "0"
}
];
// tableData() {
// let conditions = [
// {
// conditionalType: "In",
// fieldName: "fieldType",
// fieldValue: "1,2"
// },
// {
// conditionalType: "Equal",
// fieldName: "categoryId",
// fieldValue: "0"
// }
// ];
Api.listTable({ conditions: conditions }).then(r => {
if (r.result) {
var arr = r.result;
this.checkList = arr.filter(function(item) {
delete item["id"];
return item;
});
}
});
},
// Api.listTable({ conditions: conditions }).then(r => {
// if (r.result) {
// var arr = r.result;
// this.checkList = arr.filter(function(item) {
// delete item["id"];
// return item;
// });
// }
// });
// },
remove(index, row) {
if (row.add == 0) {
//新增的删除,直接删
......
<template>
<Layout class="data-details">
<Sider hide-trigger class="left-detail" width="300">
<h4 class="bt">标题</h4>
<div class="list-tree">
<div
v-for="(item,index) in listData"
:key="index"
:class="isactive == index ? 'addclass' : 'item-i'"
@click="everyItem(item,index)"
>{{item.lable}}</div>
</div>
</Sider>
<Content class="right-detail">
<div class="btn">
<Button type="primary">编辑</Button>
<div class="new-detail">
<Row>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课</Filed>
</Row>
<Divider />
<div class="title-h4">engineering</div>
<Row>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课</Filed>
</Row>
<Divider />
<div class="title-h4">engineering</div>
<Row>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课</Filed>
</Row>
<div class="maseter">
<div class="come-back" @click="back">
<Icon type="ios-undo-outline" />返回
</div>
<Layout class="data-details">
<Sider hide-trigger class="left-detail" width="300">
<h4 class="bt">标题</h4>
<div class="list-tree">
<div
v-for="(item,index) in listData"
:key="index"
:class="isactive == index ? 'addclass' : 'item-i'"
@click="everyItem(item,index)"
>{{item.lable}}</div>
</div>
</div>
</Content>
</Layout>
</Sider>
<Content class="right-detail">
<div class="btn">
<Button type="primary">编辑</Button>
<div class="new-detail">
<Row>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课</Filed>
</Row>
<Divider />
<div class="title-h4">engineering</div>
<Row>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课</Filed>
</Row>
<Divider />
<div class="title-h4">engineering</div>
<Row>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('routingHeaderName')+':'">HHJK就开始上课uioiweiwuuu你和环境</Filed>
<Filed :span="8" :name="l('routingDetailName')+':'">HHJK就开始上课</Filed>
<Filed :span="8" :name="l('standard')+':'">HHJK就开始上课</Filed>
</Row>
</div>
</div>
</Content>
</Layout>
</div>
</template>
<script>
export default {
......@@ -73,6 +78,11 @@ export default {
};
},
methods: {
back() {
this.$router.push({
path: "/materiel/masterData"
});
},
everyItem(li, i) {
this.isactive = i;
},
......@@ -83,7 +93,21 @@ export default {
}
};
</script>
<style lang="less">
<style lang="less" >
.maseter {
.come-back {
margin: 5px;
color: #2680eb;
.ivu-icon {
font-size: 20px;
}
}
.come-back:hover {
font-weight: bold;
cursor: pointer;
}
}
.ivu-layout {
background-color: #f5f7f9 !important;
}
......
......@@ -2,11 +2,11 @@
<div>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<!-- <Col :span="12">
<Col :span="12">
<FormItem label="编码" prop="code">
<Input v-model="entity.code" placeholder="请输入" disabled></Input>
</FormItem>
</Col>-->
</Col>
<Col :span="12">
<FormItem label="名称" prop="name">
<Input v-model="entity.name" placeholder="请输入"></Input>
......@@ -23,61 +23,16 @@
></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="版本" prop="version">
<Input v-model="entity.version" placeholder="请输入"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem label="描述" prop="description">
<Input v-model="entity.description" type="textarea" placeholder="请输入..."></Input>
</FormItem>
</Col>
<Col :span="24">
<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>
<Input v-else v-model="row.title" placeholder="请输入" @on-blur="setRow(row,index)" />
</template>
<template slot-scope="{ row, index }" slot="note">
<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">
<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)" />
</template>-->
<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>
<template
slot-scope="{ row, index }"
slot="action"
v-if="row.fieldType==2||row.fieldType==3"
>
<a @click="remove(index,row)" style="color:#FF7A8B">删除</a>
</template>
</Table>
</Col>
<Col :span="24" style="margin-bottom:20px;">
<Button type="primary" long @click="addNew" class="mt10">添加</Button>
</Col>
<Col :span="24" style="text-align: right;">
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
......@@ -94,69 +49,20 @@ export default {
props: ["nodeInfo"],
data() {
return {
arr: [],
entity: {
upId: 0,
code: 0
id: this.nodeInfo.id,
code: 0,
categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId //左侧树点击的数据的最顶层id
},
arr: [],
disabled: false,
columns: [
{
title: "序号",
type: "index",
width: 80,
align: "center"
},
{
title: "属性名称",
key: "title",
align: "center",
slot: "title"
},
{
title: "备注",
key: "note",
align: "center",
slot: "note"
},
{
title: "属性类型",
key: "dataType",
align: "center",
slot: "dataType"
},
// {
// title: "是否显示",
// key: "result",
// align: "center",
// slot: "result"
// },
{
title: "是否必填",
key: "required",
align: "center",
slot: "required"
},
{
title: "是否唯一属性",
key: "isunique",
align: "center",
slot: "isunique"
},
{
title: "操作",
slot: "action",
width: 100,
align: "center"
}
],
checkList: [],
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
......@@ -168,71 +74,42 @@ export default {
Api.get({ id: this.nodeInfo.id }).then(r => {
if (r.result) {
this.entity = r.result;
this.tableData();
}
});
},
tableData() {
let conditions = [
{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.id
}
];
Api.listTable({ conditions: conditions }).then(r => {
if (r.result) {
console.log(r);
this.checkList = r.result;
}
});
},
remove(index, row) {
if (row.add == 0) {
//新增的删除,直接删
this.checkList.splice(index, 1);
} else {
row.action = 2;
row.action = 2; //返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台
this.$set(this.checkList, index, row);
this.arr.push(row);
this.checkList.splice(index, 1);
}
},
setRow(row,index) {
setRow(row, index) {
this.$set(this.checkList, index, row);
},
addNew() {
let arr = this.$u.clone(this.checkList);
let obj = {
title: "",
note: "",
dataType: "",
required: false,
isunique: false,
fieldType: 3,
categoryId: 0,
action: 1,
add: 0
};
arr.push(obj);
this.checkList = arr;
},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
let categoryDto = this.entity;
let pro = this.checkList.concat(this.arr);
Api.update({ categoryDto: categoryDto, pro: pro })
// let categoryDto = this.entity;
// let pro = this.checkList.concat(this.arr);
Api.update(this.entity)
.then(r => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
this.$Message.error(r.error.message);
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
this.$Message.error(r.error.message);
});
}
});
......
<template>
<div class="master-data">
{{nodeInfo}}
<DataGrid :columns="columns" ref="grid" :action="action" :initsearch="sets" :high="false">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
......@@ -57,7 +56,7 @@ export default {
v.rootCategoryId = this.nodeInfo.rootCategoryId;
},
easySearch: {
keys: { op: "Code,Name", value: null },
keys: { op: "Code,Name", value: null }
// categoryId: {
// op: "In",
// value: this.nodeInfo.categoryId
......@@ -77,7 +76,19 @@ export default {
{
key: "Code",
title: "编码",
align: "left"
align: "left",
render: (h, params) => {
return h(
"a",
{
props: {},
on: {
click: () => this.details(params.row)
}
},
params.row.Code
);
}
},
{
key: "Name",
......@@ -151,7 +162,12 @@ export default {
this.detail = () => import("./add");
this.modal = true;
},
edit(row) {},
edit(row) {
this.nodeInfo.id = row.Id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
this.$Modal.confirm({
title: "删除",
......@@ -169,6 +185,11 @@ export default {
}
});
},
details() {
this.$router.push({
path: "/materiel/masterData/details"
});
},
ok() {
this.$refs.grid.reload(this.easySearch);
this.modal = false;
......
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