Commit 35adbb58 authored by kangzhenfei's avatar kangzhenfei

Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product

parents 897f05a8 20adf7bb
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<div> <div>
<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">
<FormItem label="编码" prop="code"> <FormItem label="编码" prop="code">
<Input v-model="entity.code" placeholder="请输入" disabled></Input> <Input v-model="entity.code" placeholder="请输入" disabled></Input>
</FormItem> </FormItem>
</Col> </Col>-->
<Col :span="12"> <Col :span="12">
<FormItem label="名称" prop="name"> <FormItem label="名称" prop="name">
<Input v-model="entity.name" placeholder="请输入"></Input> <Input v-model="entity.name" placeholder="请输入"></Input>
...@@ -179,8 +179,9 @@ export default { ...@@ -179,8 +179,9 @@ export default {
let pro = this.checkList; let pro = this.checkList;
Api.create({ categoryDto: categoryDto, pro: pro }) Api.create({ categoryDto: categoryDto, pro: pro })
.then(r => { .then(r => {
if (r.result) { if (r.success) {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.$emit("on-ok");
} else { } else {
this.$Message.error("保存失败"); this.$Message.error("保存失败");
} }
......
<template> <template>
<div>55555555</div> <div>
</template> <Form ref="form" :model="entity" :rules="rules" :label-width="90">
\ No newline at end of file <Row>
<!-- <Col :span="12">
<FormItem label="编码" prop="code">
<Input v-model="entity.code" placeholder="请输入" disabled></Input>
</FormItem>
</Col>-->
<Col :span="12">
<FormItem label="名称" prop="name">
<Input v-model="entity.name" placeholder="请输入"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="状态" prop="status" placeholder="请选择">
<Dictionary
code="materail.category.status"
v-model="entity.status"
type="select"
:value="entity.status"
:key="entity.status"
></Dictionary>
</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">
<Table border :columns="columns" :data="checkList" class="tableCommon" height="300">
<template slot-scope="{ row, index }" slot="note">
<Input v-model="row.note" placeholder="请输入" @on-blur="setRow(row,index)" />
</template>
<template slot-scope="{ row, index }" slot="datatype">
<!-- <Input v-model="row.datatype" placeholder="请输入" @on-blur="setRow(row,index)" /> -->
<Select v-model="row.datatype" style="width:200px" @on-change="setRow(row,index)">
<Option
v-for="item in cityList"
:value="item.value"
:key="item.value"
>{{ item.label }}</Option>
</Select>
</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>
</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>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Col>
</Row>
</Form>
</div>
</template>
<script>
import Api from "./api";
export default {
data() {
return {
entity: {
upId: 0,
code: 0
},
cityList: [
{
value: "0",
label: "Number"
},
{
value: "1",
label: "string"
},
{
value: "2",
label: "Null"
},
{
value: "3",
label: "Boolean"
},
{
value: "4",
label: "Undefined"
}
],
disabled: false,
columns: [
{
title: "序号",
type: "index",
width: 80,
align: "center"
},
{
title: "属性名称",
key: "title",
align: "center"
},
{
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"
}
],
checkList: [],
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
mounted() {
this.tableData();
},
methods: {
tableData() {
let conditions = [];
Api.listTable({ conditions: conditions }).then(r => {
if (r.result) {
console.log(r);
this.checkList = r.result;
}
});
},
setRow() {
this.$set(this.checkList, index, row);
},
addNew() {},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
let categoryDto = this.entity;
let pro = this.checkList;
Api.create({ categoryDto: categoryDto, pro: pro })
.then(r => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
});
}
});
},
handleClose() {
this.$emit("on-close");
}
}
};
</script>
...@@ -85,8 +85,8 @@ export default { ...@@ -85,8 +85,8 @@ export default {
} }
}; };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {
this.loadTree(); this.loadTree();
...@@ -104,19 +104,26 @@ async fetch({ store, params }) { ...@@ -104,19 +104,26 @@ async fetch({ store, params }) {
addNew() { addNew() {
// this.nodeInfo.id = 0; // this.nodeInfo.id = 0;
// let conditions = []; // let conditions = [];
// debugger
this.add(); this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
}, },
add() { add() {
// this.curId = 0; this.curId = 0;
this.title = "新增"; this.title = "新增";
this.detail = () => import("./add"); this.detail = () => import("./sonAdd");
this.modal = true; this.modal = true;
}, },
edit() { edit() {
if (this.nodeInfo.upId == 0) {
this.detail = () => import("./edit");
} else {
this.detail = () => import("./sonEdit");
}
this.curId = this.nodeInfo.id; this.curId = this.nodeInfo.id;
this.title = "编辑"; this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true; this.modal = true;
}, },
remove() { remove() {
...@@ -172,17 +179,16 @@ async fetch({ store, params }) { ...@@ -172,17 +179,16 @@ async fetch({ store, params }) {
loadTree() { loadTree() {
let conditions = []; let conditions = [];
Api.list({ conditions: conditions }).then(r => { Api.list({ conditions: conditions }).then(r => {
setTree(r.result); var data = this.$u.toTree(
function setTree(data) { r.result,
data.map(u => { 0,
u.title = u.name; u => {
u.title = u.code + u.name;
u.value = u.id; u.value = u.id;
if (u.children) { u.expand = true;
setTree(u.children); },
} "upId"
}); );
}
var data = r.result;
this.list = this.$u.clone(data); this.list = this.$u.clone(data);
}); });
}, },
......
<template>
<div class="master-data">
<DataGrid :columns="columns" ref="grid" :action="action">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入编码/名称" v-width="200" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1120" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
</div>
</template>
<script>
export default {
data() {
return {
action: "",
detail: null,
modal: false,
curId: 0,
easySearch: {
keys: { op: "name,code", value: null }
},
title: "",
columns: [
{
key: "code",
title: "编码",
align: "left",
width: 200,
easy: true,
high: true
},
{
key: "name",
title: "名称",
align: "left",
easy: true,
high: true,
tooltip: true
},
{
title: "操作",
key: "action",
width: 260,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row) }
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) }
},
"删除"
)
]);
}
}
]
};
},
methods: {
edit() {
this.modal = true;
this.detail = () => import("./add");
},
remove() {},
add() {
this.modal = true;
this.detail = () => import("./add");
},
search() {
this.$refs.grid.reload(this.easySearch);
},
ok() {
// this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
cancel() {
this.curId = 0;
this.modal = false;
}
}
};
</script>
<style lang="less" scoped>
.spare-parts {
width: 100%;
height: 100%;
}
</style>
\ No newline at end of file
<template>
<div>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem label="上级名称" prop="upName">
<Input v-model="upName" placeholder="请输入" disabled></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="编码" prop="code">
<Input v-model="entity.code" placeholder="请输入" disabled></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="名称" prop="name">
<Input v-model="entity.name" placeholder="请输入"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="状态" prop="status" placeholder="请选择">
<Dictionary
code="materail.category.status"
v-model="entity.status"
type="select"
:value="entity.status"
:key="entity.status"
></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem label="描述" prop="description">
<Input v-model="entity.description" type="textarea" placeholder="请输入..."></Input>
</FormItem>
</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>
</Row>
</Form>
</div>
</template>
<script>
import Api from "./api";
export default {
data() {
return {
entity: {
upId: this.nodeInfo.id,
code: 0
},
upName: this.nodeInfo.title,
disabled: false,
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
props: ["nodeInfo"],
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
mounted() {},
methods: {
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
Api.create({ categoryDto: this.entity, pro: [] })
.then(r => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
});
}
});
},
handleClose() {
this.$emit("on-close");
}
}
};
</script>
<template>
<div>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem label="上级名称" prop="upName">
<Input v-model="upName" placeholder="请输入" disabled></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="编码" prop="code">
<Input v-model="entity.code" placeholder="请输入" disabled></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="名称" prop="name">
<Input v-model="entity.name" placeholder="请输入"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="状态" prop="status" placeholder="请选择">
<Dictionary
code="materail.category.status"
v-model="entity.status"
type="select"
:value="entity.status"
:key="entity.status"
></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem label="描述" prop="description">
<Input v-model="entity.description" type="textarea" placeholder="请输入..."></Input>
</FormItem>
</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>
</Row>
</Form>
</div>
</template>
<script>
import Api from "./api";
export default {
data() {
return {
entity: {
upId: 0,
code: 0
},
upName: this.nodeInfo.title,
disabled: false,
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
props: ["nodeInfo"],
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
mounted() {
this.get();
},
methods: {
get() {
Api.get({ id: this.nodeInfo.id }).then(r => {
if (r.result) {
this.entity = r.result;
}
});
},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
Api.update({ categoryDto: this.entity, pro: [] })
.then(r => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
});
}
});
},
handleClose() {
this.$emit("on-close");
}
}
};
</script>
<template>
<div class="spare-parts">
<Button type="dashed" @click="add">新增</Button>
<Modal v-model="addModal" title="新增" footer-hide width='1000'>
<Add @on-close="cancel" @on-ok="addOk" ref="add" />
</Modal>
</div>
</template>
<script>
import Add from "./add";
export default {
components: {
Add
},
data() {
return {
addModal: false
};
},
methods: {
add() {
this.addModal = true;
},
remove(){
},
addOk() {
this.addModal = false;
},
cancel() {
this.addModal = false;
}
}
};
</script>
<style lang="less" scoped>
.spare-parts {
width: 100%;
height: 100%;
}
</style>
\ No newline at end of file
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