Commit 966046cc authored by 周远喜's avatar 周远喜

物料主数据修改

parent 8044bf00
......@@ -429,7 +429,7 @@ export default {
let v = conditions[u].value;
let op = conditions[u].op;
if (!this.$u.isNull(v)) {
if (op == "Range") {
if (op == "Range"&&Array.isArray(v)) {
let times = [];
v.map(u => {
if (!this.$u.isNull(u)) {
......@@ -437,7 +437,7 @@ export default {
}
});
v = times.join(",");
} else if (op.indexOf("In") > -1) {
} else if (op.indexOf("In") > -1&&Array.isArray(v)) {
v = v.join(",");
}
if (!this.$u.isNull(v)) {
......@@ -544,6 +544,14 @@ export default {
},
height() {
this.tableHeight = this.height;
},
"columns.length"(){
this.columns.forEach(u => {
if (!u.hide) {
u.hide = false;
}
});
this.columnsCur = this.$u.clone(this.columns);
}
}
};
......
......@@ -42,7 +42,7 @@
</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 />
<Input v-model="row.note" placeholder="请输入字典编码" @on-blur="setRow(row,index)" v-else />
</template>
<template slot-scope="{ row, index }" slot="dataType">
<state
......@@ -114,21 +114,21 @@ export default {
{
title: "属性名称",
key: "title",
align: "center",
slot: "title"
},
{
title: "属性类型",
key: "dataType",
align: "center",
slot: "dataType",
width:150
},
{
title: "备注",
key: "note",
align: "center",
slot: "note"
},
{
title: "属性类型",
key: "dataType",
align: "center",
slot: "dataType"
},
// {
// title: "是否显示",
// key: "result",
......@@ -136,21 +136,23 @@ export default {
// slot: "result"
// },
{
title: "是否必填",
title: "必填",
key: "required",
align: "center",
slot: "required"
slot: "required",
width:80
},
{
title: "是否唯一属性",
title: "唯一",
key: "isUnique",
align: "center",
slot: "isUnique"
slot: "isUnique",
width:80
},
{
title: "操作",
slot: "action",
width: 100,
width: 80,
align: "center"
}
],
......@@ -185,6 +187,7 @@ export default {
if (r.result) {
var arr = r.result;
this.checkList = arr.filter(function(item) {
item.mid=item.id;
delete item["id"]; //删除属性id
return item;
});
......@@ -206,7 +209,15 @@ export default {
this.$set(this.checkList, index, row);
},
addNew() {
let maxId=0;
this.checkList.map(u=>{
if(u.mid>maxId){
maxId=u.mid;
}
})
let obj = {
mid:maxId+1,
field:"c"+maxId,
title: "",
note: "",
dataType: "",
......
<template>
<div>
<div class="p10">
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<!-- <Col :span="12">
......@@ -29,59 +29,58 @@
</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
@on-change="setRow(row,index)"
v-model="row.dataType"
code="materail.category.dataType"
type="select"
:value="row.dataType"
:key="row.dataType"
></Dictionary>
</template>
<!-- <template slot-scope="{ row, index }" slot="result">
<h4>扩展属性</h4>
<Table border :columns="columns" :data="checkList" 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">
<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
@on-change="setRow(row,index)"
v-model="row.dataType"
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||!row.notEditDelete"
>
<!-- notEditDelete=true,删除不显示 -->
<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>
</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>
<Button type="dashed" long @click="addNew" class="mt10">新增属性</Button>
</Col>
<Col :span="24" style="text-align: right;">
<Col :span="24" class="tr mt10">
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
......@@ -114,21 +113,21 @@ export default {
{
title: "属性名称",
key: "title",
align: "center",
slot: "title"
},
{
title: "属性类型",
key: "dataType",
align: "center",
slot: "dataType",
width:150
},
{
title: "备注",
key: "note",
align: "center",
slot: "note"
},
{
title: "属性类型",
key: "dataType",
align: "center",
slot: "dataType"
},
// {
// title: "是否显示",
// key: "result",
......@@ -136,21 +135,23 @@ export default {
// slot: "result"
// },
{
title: "是否必填",
title: "必填",
key: "required",
align: "center",
slot: "required"
slot: "required",
width:80
},
{
title: "是否唯一属性",
key: "isunique",
title: "唯一",
key: "isUnique",
align: "center",
slot: "isunique"
slot: "isUnique",
width:80
},
{
title: "操作",
slot: "action",
width: 100,
width: 80,
align: "center"
}
],
......@@ -184,9 +185,12 @@ export default {
fieldValue: this.nodeInfo.id
}
];
Api.listTable({ conditions: conditions }).then(r => {
Api.listTable({ conditions: conditions ,sortBy:'id',isDesc:false}).then(r => {
if (r.result) {
console.log(r);
r.result.map(u=>{
u.mid=u.id;
})
this.checkList = r.result;
}
});
......@@ -204,9 +208,16 @@ export default {
setRow(row, index) {
this.$set(this.checkList, index, row);
},
addNew() {
let arr = this.$u.clone(this.checkList);
addNew() {
let maxId=0;
this.checkList.map(u=>{
if(u.mid>maxId){
maxId=u.mid;
}
})
let obj = {
mid:maxId+1,
field:"c"+maxId,
title: "",
note: "",
dataType: "",
......@@ -215,10 +226,9 @@ export default {
fieldType: 3,
categoryId: 0,
action: 1,
add: 0
add: 0 //新增标识
};
arr.push(obj);
this.checkList = arr;
this.checkList.push(obj);
},
handleSubmit() {
this.$refs.form.validate(v => {
......
......@@ -68,7 +68,7 @@
<MasterData ref="dataTable" @on-edit="editRow" :root="root" @on-ok="ok" />
</Content>
</Layout>
<Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false">
<Modal v-model="modal" :title="title" width="1200" footer-hide :mask-closable="false">
<component
:is="detail"
:eid="curId"
......@@ -132,10 +132,14 @@ export default {
},
listSlecet() {
let data = {
conditions: []
conditions: [],sortBy:'id',isDesc:false
};
Api.pagedSlecet(data).then(r => {
this.cityList = r.result.items;
this.downName=this.cityList[0].name;
this.model8=this.cityList[0].id;
this.nodeInfo.codeRuleId = this.cityList[0].id;
this.loadTree(this.nodeInfo.codeRuleId);
});
},
......
......@@ -33,12 +33,34 @@
<Input v-model="entity.description" type="textarea" placeholder="请输入..."></Input>
</FormItem>
</Col>
</Row>
<div>
<h4>扩展属性</h4>
</div>
<Row>
<Col v-for="li in fileds" :key="li.field" :span="li.span">
<FormItem :label="li.title" :prop="li.name">
<Input v-if="li.dataType==0" v-model="entity[li.field]" ></Input>
<InputNumber v-if="li.dataType==1||li.dataType==2" v-model="entity[li.field]" class="w100"></InputNumber>
<Dictionary v-if="li.dataType==3" v-model="entity[li.field]" :code="li.note"></Dictionary>
<Input v-if="li.dataType==4" v-model="entity[li.filed]" ></Input>
<DatePicker v-if="li.dataType==5" v-model="entity[li.field]" type="date" :placeholder="'选择'+li.title" ></DatePicker>
<InputFile v-if="li.dataType==6" v-model="entity[li.field]" ></InputFile>
<!-- <files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> -->
<InputFile v-if="li.dataType==7" v-model="entity[li.field]" ></InputFile>
<Input v-if="li.dataType==8" type="textarea" v-model="entity[li.field]" ></Input>
</FormItem>
</Col>
<Col :span="24">
<div v-html="entity"></div>
</Col>
<Col :span="24" style="text-align: right;">
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Col>
</Col>
</Row>
</Form>
</div>
......@@ -53,6 +75,7 @@ export default {
entity: {
code: 0,
status: 0,
codeRuleId:this.nodeInfo.codeRuleId,
categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId //左侧树点击的数据的最顶层id
......@@ -61,40 +84,47 @@ export default {
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
},
fileds:[]//扩展属性
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
mounted() {
// this.tableData();
created() {
this.initFiled();
},
methods: {
// tableData() {
// let conditions = [
// {
// conditionalType: "In",
// fieldName: "fieldType",
// fieldValue: "1,2"
// },
// {
// conditionalType: "Equal",
// fieldName: "categoryId",
// fieldValue: "0"
// }
// ];
initFiled() {
let conditions = [
{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId
}
];
// 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 ,sortBy:'id',isDesc:false}).then(r => {
if (r.result) {
this.fileds = r.result.filter(function(item) {
item.span=12;
if(item.dataType>4){
item.span=24
}
delete item["id"];
return item.fieldType!=1;
});
this.fileds.map(u=>{
let v='';
if(u.dataType==1||u.dataType==2){
v=0;
}
// this.$set(this.entity.customProperties,u.filed,v)
this.$set(this.entity,u.filed,v)
})
}
});
},
remove(index, row) {
if (row.add == 0) {
//新增的删除,直接删
......
......@@ -11,14 +11,17 @@ export default {
list(params){
return Api.post(`${systemUrl}/category/list`,params);
},
listTable(params){
return Api.post(`${systemUrl}/custompropertydefinition/list`,params);
},
get(params){
return Api.get(`${systemUrl}/material/get`,params);
},
create(params){
return Api.post(`${systemUrl}/material/create`,params);
return Api.post(`${systemUrl}/material/createnew`,params);
},
update(params){
return Api.post(`${systemUrl}/material/update`,params);
return Api.post(`${systemUrl}/material/updatenew`,params);
},
delete(id) {
return Api.delete(`${systemUrl}/material/delete`,{params:{id:id}});
......
......@@ -53,6 +53,7 @@ export default {
entity: {
id: this.eid,
code: 0,
codeRuleId:this.nodeInfo.codeRuleId,
categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId //左侧树点击的数据的最顶层id
......
......@@ -105,12 +105,16 @@ export default {
}
});
},
listSlecet() {
listSlecet() {
let data = {
conditions: []
conditions: [],sortBy:'id',isDesc:false
};
Api.pagedSlecet(data).then(r => {
this.cityList = r.result.items;
this.downName=this.cityList[0].name;
this.model8=this.cityList[0].id;
this.nodeInfo.codeRuleId = this.cityList[0].id;
this.loadTree(this.nodeInfo.codeRuleId);
});
},
// chnangeClick(val){
......
<template>
<div class="master-data">
<DataGrid
:columns="columns"
:columns="cols"
ref="grid"
:conditions="easySearch"
:action="action"
......@@ -123,12 +123,25 @@ export default {
key: "description",
title: "描述",
align: "left"
},
{
key: "creationTime",
title: "创建时间",
hide:false,
align: "left"
},
{
key: "creatorUserId",
title: "创建人",
hide:false,
align: "left",
type:"user"
},
{
title: "操作",
key: "action",
width: 260,
align: "left",
width: 150,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
......@@ -158,7 +171,8 @@ export default {
]);
}
}
]
], //基础咧
cols: [] //
};
},
async fetch({ store, params }) {
......@@ -166,6 +180,11 @@ export default {
},
created() {
this.tableHeight = window.innerHeight - 220;
if (this.nodeInfo.rootCategoryId == 0) {
this.cols = this.columns;
} else {
this.initCols();
}
},
mounted() {
window.onresize = () => {
......@@ -180,6 +199,43 @@ export default {
search() {
this.$refs.grid.reload(this.easySearch);
},
initCols() {
let conditions = [
{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId
}
];
Api.listTable({
conditions: conditions,
sortBy: "id",
isDesc: false
}).then(r => {
if (r.result) {
var items = r.result.filter(u => {
return !this.columns.some(p => {
return p.key == u.field;
})&&u.dataType!=5;
});
this.cols=this.$u.clone(this.columns);
let extra= items.map(u=>{
var col={
key:u.field,
title:u.title
};
if(u.dataType==3){
col.code=u.note;
}
return col
})
this.cols= this.cols.concat(extra);
var action=this.cols.splice(this.columns.length-1,1);
this.cols.push(this.columns[this.columns.length-1]);
}
});
},
add() {
this.curId = 0;
this.title = "新增";
......@@ -241,6 +297,10 @@ export default {
watch: {
nodeInfo: {
handler(newName, oldName) {
console.log("ovo",newName,oldName)
if(newName.rootCategoryId){
this.initCols();
}
if (newName.categoryId) {
this.easySearch.categoryId.value = newName.ids;
this.$refs.grid.reload(this.easySearch);
......
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