Commit 7eed0ff4 authored by renjintao's avatar renjintao

store

parent dbe0e802
......@@ -13,12 +13,18 @@
</Col>
<Col :span="12">
<FormItem :label="l('description')" prop="description">
<Input v-model="entity.description" ></Input>
<Input v-model="entity.description"></Input>
</FormItem>
</Col>
<Col :span="12">
<Col :span="12" v-if="user">
<FormItem :label="l('userName')" prop="userName">
<Input v-model="entity.userName"></Input>
<UserSelect
ref="userSelected"
:roleTitle="roleTitle"
v-model="entity.userIds"
:multiple="true"
@on-change="userChange"
/>
</FormItem>
</Col>
</Row>
......@@ -35,6 +41,7 @@ export default {
data() {
return {
disabled: false,
roleTitle: "库管员",
entity: {
creationTime: null,
creatorUserId: null,
......@@ -61,20 +68,37 @@ export default {
props: {
v: Object,
eid: Number,
level:Number,
upId:Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
level: Number,
upId: Number,
user: {
type: Boolean,
default: true
}
},
mounted() {},
methods: {
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
Api.create(this.entity)
let userNam = "";
let userId = "";
if (this.user) {
userId = this.entity.userIds.join(",");
userNam = this.$refs.userSelected.getSelectNames().join(",");
}
let paramsdata = {
id: this.entity.id,
upId: this.entity.upId,
title: this.entity.title, //库位名称
code: this.entity.code, //库位编号
description: this.entity.description, //位置
level: this.entity.level,
userName: userNam, //库管员
userIds: userId //库管员id
};
Api.create(paramsdata)
.then(r => {
this.disabled = false;
if (r.success) {
......@@ -101,6 +125,7 @@ export default {
this.entity.id = 0;
});
},
userChange(val) {},
l(key) {
key = "store_room_location" + "." + key;
return this.$t(key);
......@@ -110,10 +135,8 @@ export default {
v() {
this.entity = this.$u.clone(this.v);
},
eid(v) {
if (v > 0) {
this.load(v);
}
user(v) {
this.user = v;
}
}
};
......
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<Filed :span="12" :name="l('creatorUserId')">{{entity.creatorUserId}}</Filed>
<Filed :span="12" :name="l('lastModificationTime')">{{entity.lastModificationTime}}</Filed>
<Filed :span="12" :name="l('lastModifierUserId')">{{entity.lastModifierUserId}}</Filed>
<Filed :span="12" :name="l('isDeleted')">{{entity.isDeleted}}</Filed>
<Filed :span="12" :name="l('deleterUserId')">{{entity.deleterUserId}}</Filed>
<Filed :span="12" :name="l('deletionTime')">{{entity.deletionTime}}</Filed>
<Filed :span="12" :name="l('upId')">{{entity.upId}}</Filed>
<Filed :span="12" :name="l('materialType')">{{entity.materialType}}</Filed>
<Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<Filed :span="12" :name="l('code')">{{entity.code}}</Filed>
<Filed :span="12" :name="l('status')">{{entity.status}}</Filed>
<Filed :span="24" :name="l('description')">{{entity.description}}</Filed>
<Filed :span="12" :name="l('level')">{{entity.level}}</Filed>
<Filed :span="12" :name="l('description')">{{entity.description}}</Filed>
<Filed :span="12" :name="l('level')"><state code="store.level" :value="entity.level+''" type="text"></state> </Filed>
<Filed :span="24" :name="l('userName')">{{entity.userName}}</Filed>
<Filed :span="24" :name="l('userIds')">{{entity.userIds}}</Filed>
<Filed :span="12" :name="l('creatorUserId')"><User :value="entity.creatorUserId" /></Filed>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<Filed :span="12" :name="l('lastModifierUserId')"> <User :value="entity.lastModifierUserId" /></Filed>
<Filed :span="12" :name="l('lastModificationTime')">{{entity.lastModificationTime}}</Filed>
</Row>
</div>
</template>
......
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker type="date" v-model="entity.creationTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('creatorUserId')" prop="creatorUserId">
<InputNumber v-model="entity.creatorUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('lastModificationTime')" prop="lastModificationTime">
<DatePicker type="date" v-model="entity.lastModificationTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<InputNumber v-model="entity.lastModifierUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('isDeleted')" prop="isDeleted">
<Input v-model="entity.isDeleted"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('deleterUserId')" prop="deleterUserId">
<InputNumber v-model="entity.deleterUserId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker type="date" v-model="entity.deletionTime"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('upId')" prop="upId">
<InputNumber v-model="entity.upId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('materialType')" prop="materialType">
<Input v-model="entity.materialType"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
......@@ -57,28 +12,18 @@
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('status')" prop="status">
<InputNumber v-model="entity.status"></InputNumber>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('description')" prop="description">
<Input v-model="entity.description" type="textarea" :rows="5"></Input>
<Input v-model="entity.description"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('level')" prop="level">
<InputNumber v-model="entity.level"></InputNumber>
</FormItem>
</Col>
<Col :span="24">
<Col :span="12" v-if="user">
<FormItem :label="l('userName')" prop="userName">
<Input v-model="entity.userName" type="textarea" :rows="5"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('userIds')" prop="userIds">
<Input v-model="entity.userIds" type="textarea" :rows="5"></Input>
<UserSelect
ref="userSelected"
:roleTitle="roleTitle"
v-model="entity.userIds"
:multiple="true"
/>
</FormItem>
</Col>
</Row>
......@@ -95,6 +40,7 @@ export default {
data() {
return {
disabled: false,
roleTitle: "库管",
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
......@@ -102,7 +48,14 @@ export default {
};
},
props: {
eid: Number
v: Object,
eid: Number,
level: Number,
upId: Number,
user: {
type: Boolean,
default: true
}
},
mounted() {
if (this.eid > 0) {
......@@ -112,6 +65,7 @@ export default {
methods: {
load(v) {
Api.get({ id: v }).then(r => {
r.result.userIds = this.$u.toIntArray(r.result.userIds);
this.entity = r.result;
});
},
......@@ -119,7 +73,27 @@ export default {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
Api.update(this.entity)
let userNam = "";
let userId = "";
if (this.user) {
userId = this.entity.userIds.join(",");
userNam = this.$refs.userSelected.getSelectNames().join(",");
}
let paramsdata = {
id: this.entity.id,
upId: this.entity.upId,
title: this.entity.title, //库位名称
code: this.entity.code, //库位编号
description: this.entity.description, //位置
level: this.entity.level,
userName: userNam, //库管员
userIds: userId, //库管员id
creationTime: this.entity.creationTime,
creatorUserId: this.entity.creatorUserId
};
Api.update(paramsdata)
.then(r => {
this.disabled = false;
if (r.success) {
......@@ -150,6 +124,9 @@ export default {
if (v != 0) {
this.load(v);
}
},
user(v) {
this.user = v;
}
}
};
......
......@@ -2,18 +2,19 @@
<div>
<div class="mb10 pt5">
<Input v-model="searchValue" placeholder="请输入库位名称" clearable style="width: 240px" />
<Button type="primary" class @click="searchData">查询</Button>
<Button type="primary" class @click="handleSearch">查询</Button>
<div class="fr">
<Button type="primary" @click="add()">新增库位</Button>
</div>
</div>
<TreeGrid :columns="columns" :items="treeData"></TreeGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<Modal v-model="modal" :title="title" width="1000" footer-hide>
<component
:is="detail"
:eid="curId"
:level="level"
:upId="upId"
:user="user"
@on-close="cancel"
@on-ok="ok"
/>
......@@ -46,41 +47,51 @@ export default {
curId: 0,
level: null,
upId: null,
user: true,
treeData: [],
treeDataOld: [],
columns: [
{
key: "title",
title: this.l("title"),
align: "left",
align: "left"
},
{
key: "code",
title: this.l("code"),
align: "left",
align: "left"
},
{
key: "description",
title: this.l("description"),
align: "left",
align: "left"
},
{
key: "level",
title: this.l("level"),
align: "left",
code:'store.level'
code: "store.level"
},
{
key: "userName",
title: this.l("userName"),
align: "left",
align: "left"
},
{
title: "操作",
key: "action",
width: 140,
width: 300,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "add" },
on: { click: () => this.addrow(params.row) }
},
"新增"
),
h(
"op",
{
......@@ -94,7 +105,7 @@ export default {
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) }
on: { click: () => this.edit(params.row) }
},
"编辑"
),
......@@ -108,63 +119,41 @@ export default {
)
]);
}
},
{
title: '操作',
key: 'id',
align: 'left',
render: (h, params) => {
let actions = [
h(
'op',
{
attrs: { oprate: 'add' },
on: { click: () => this.addrow(params.row) }
},
'新增'
),
h(
'op',
{
attrs: { oprate: 'edit' },
on: { click: () => this.edit(params.row.id,params.row.up_id) }
},
'编辑'
)
]
if (params.row.children.length == 0) {
actions.push(
h(
'op',
{
attrs: { oprate: 'delete' },
on: { click: () => this.remove(params.row.id) }
},
'删除'
)
)
}
return h('div', { class: 'action' }, actions)
}
}
]
};
},
mounted() {
this.laodaction(this.keys)
this.laodaction(this.keys);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
laodaction(name) {
let params = { title: name };
Api.getList(params).then(r => {
this.treeData = r.result;
this.treeData.forEach(data=>{
data.children=[]
})
alert(JSON.stringify(this.treeData))
let params = {
conditions: [
{
fieldName: "title",
fieldValue: name,
conditionalType: "Like"
}
]
};
Api.paged(params).then(r => {
let res = r.result.items;
var data = this.$u.toTree(
res,
0,
u => {
u.expand = true;
u.selected = false;
u.checked = false;
},
"upId"
);
this.treeData = this.$u.clone(data);
this.treeDataOld = this.$u.clone(data);
});
},
//查询
......@@ -172,28 +161,78 @@ export default {
var name = this.searchValue;
this.laodaction(name);
},
handleSearch() {
let tree = this.$u.clone(this.treeDataOld);
let value = this.searchValue;
if (value.trim() == "") {
this.treeData = this.$u.clone(this.treeDataOld);
} else {
//不满足搜索条件的待删除元素索引数组
let removeArr = [];
for (let i = 0; i < tree.length; i++) {
let node = tree[i];
this.searchTree(node, i, value, removeArr);
}
//遍历删除不满足条件的节点
for (let j = removeArr.length - 1; j >= 0; j--) {
tree.splice(removeArr[j], 1);
}
this.treeData = tree;
}
},
searchTree(node, index, value, removeArr) {
let children = node.children;
//针对非叶子节点,需要递归其children节点
if (children && children.length > 0) {
let innderArr = [];
for (let i = 0; i < children.length; i++) {
this.searchTree(children[i], i, value, innderArr);
}
if (node.title.indexOf(value) === -1) {
for (let j = innderArr.length - 1; j >= 0; j--) {
children.splice(innderArr[j], 1);
}
if (node.children.length === 0) {
removeArr.push(index);
}
}
} else {
//叶子节点,直接进行匹配
if (node.title.indexOf(value) === -1) {
removeArr.push(index);
} else {
//将满足条件内容做标记显示
// node.title = node.title.replace(regExp, replaceStr);
}
}
},
addOk() {
this.laodaction();
this.addModal = false;
this.editModal = false;
this.addrowModal = false;
var name = this.searchValue;
this.laodaction(name);
this.modal = false;
// this.curId = 0
},
ok() {
this.$refs.grid.load();
var name = this.searchValue;
this.laodaction(name);
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.level = 1;
this.user = true;
(this.upId = 0), (this.title = "新增");
this.detail = () => import("./add");
this.modal = true;
},
addrow(params) {
this.curId = 0;
this.user = false;
(this.upId = params.id), (this.title = "新增");
this.detail = () => import("./add");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
......@@ -206,17 +245,23 @@ export default {
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
edit(row) {
this.curId = row.id;
this.title = "编辑";
if (row.upId == 0) {
this.user = true;
} else {
this.user = false;
}
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
var name = this.searchValue;
this.laodaction(name);
}
});
},
......
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