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

物料主数据修改

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