Commit 90488a30 authored by 仇晓婷's avatar 仇晓婷

部门字段修改

parent e793effb
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('organizationType')" prop="organizationType"> <!-- <FormItem :label="l('organizationType')" prop="organizationType">
<Input v-model="entity.organization_Type" readonly placeholder="请选择..."> <Input v-model="entity.organization_Type" readonly placeholder="请选择...">
<Button slot="append" @click="selectDepart">选择</Button> <Button slot="append" @click="selectDepart">选择</Button>
</Input> </Input>
</FormItem> </FormItem>-->
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('upMent')"> <FormItem :label="l('upMent')">
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<CheckboxGroup v-model="entity.property"> <CheckboxGroup v-model="entity.property">
<Checkbox label="1">生产班组</Checkbox> <Checkbox label="1">生产班组</Checkbox>
<Checkbox label="2">排产资源</Checkbox> <Checkbox label="2">排产资源</Checkbox>
<Checkbox label="3">车间</Checkbox>
</CheckboxGroup> </CheckboxGroup>
</FormItem> </FormItem>
</Col> </Col>
...@@ -47,28 +48,29 @@ ...@@ -47,28 +48,29 @@
<Button @click="handleClose" class="ml20">取消</Button> <Button @click="handleClose" class="ml20">取消</Button>
</FormItem> </FormItem>
<!-- 组织类型 --> <!-- 组织类型 -->
<OrganizType <!-- <OrganizType
:show.sync="showTree" :show.sync="showTree"
:value.sync="entity.organization_Id" :value.sync="entity.organization_Id"
:text.sync="entity.organization_Type" :text.sync="entity.organization_Type"
/> />-->
</Form> </Form>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import OrganizType from "@/components/modalTree/organizType.vue"; // import OrganizType from "@/components/modalTree/organizType.vue";
import citys from "@/libs/citys"; import citys from "@/libs/citys";
export default { export default {
name: "Add", name: "Add",
components: { OrganizType }, // components: { OrganizType },
data() { data() {
return { return {
showTree: false, //组织类型 showTree: false, //组织类型
disabled: false, disabled: false,
citys: citys(), citys: citys(),
entity: { entity: {
organization_Id: 0, name: "",
organization_Type: "", // organization_Id: 0,
// organization_Type: "",
property: [] property: []
}, },
rules: { rules: {
...@@ -89,32 +91,37 @@ export default { ...@@ -89,32 +91,37 @@ export default {
val: Object val: Object
}, },
created() { created() {
this.entity = {}; // this.entity = {};
}, },
methods: { methods: {
handleSubmit() { handleSubmit() {
this.$refs["form"].validate(value => { this.$refs["form"].validate(value => {
if (value) { if (value) {
let property = ""; // let property = "";
if (this.entity.property) { if (this.entity.property) {
if (this.entity.property[0] == 1 || this.entity.property[1] == 1) { if (
this.entity.property[0] == 1 ||
this.entity.property[1] == 1 ||
this.entity.property[2] == 1
) {
this.entity.isProduction = 1; this.entity.isProduction = 1;
} else { } else {
this.entity.isProduction = 0; this.entity.isProduction = 0;
} }
property = this.entity.property.join; alert(this.entity.property);
// property = this.entity.property.join;
} else { } else {
this.entity.isProduction =''; this.entity.isProduction = "";
property = ""; // property = "";
} }
let paramsdata = { let paramsdata = {
name: this.entity.title02, //部门名称 name: this.entity.title02, //部门名称
parent_Id: this.entity.id, //上级部门 [id] parent_Id: this.entity.id, //上级部门 [id]
code: this.entity.departcode, //部门编号 code: this.entity.departcode, //部门编号
organization_Id: this.entity.organization_Id, //组织类型 [id] // organization_Id: this.entity.organization_Id, //组织类型 [id]
location: this.entity.location, //省市县 location: this.entity.location, //省市县
isProduction: this.entity.isProduction, //是否生产班组:1是,0否 isProduction: this.entity.isProduction, //是否生产班组:1是,0否
property: property, //属性 property: this.entity.property, //属性
parentTitle: this.entity.name //上级名称 parentTitle: this.entity.name //上级名称
}; };
Api.create(paramsdata) Api.create(paramsdata)
...@@ -134,9 +141,9 @@ export default { ...@@ -134,9 +141,9 @@ export default {
} }
}); });
}, },
selectDepart() { // selectDepart() {
this.showTree = true; // this.showTree = true;
}, // },
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
}, },
...@@ -147,7 +154,9 @@ export default { ...@@ -147,7 +154,9 @@ export default {
}, },
watch: { watch: {
val(v) { val(v) {
this.entity = this.val; this.entity = {};
this.entity.name = v.name;
this.entity.id = v.parent_Id;
} }
} }
}; };
......
...@@ -12,22 +12,23 @@ ...@@ -12,22 +12,23 @@
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('organizationType')" prop="organizationType"> <FormItem :label="l('organizationType')" prop="organizationType">
<Input v-model="entity.organizationType" readonly placeholder="请选择..."> <Input v-model="entity.organizationType" readonly placeholder="请选择...">
<Button slot="append" @click="selectDepart">选择</Button> <Button slot="append" @click="selectDepart">选择</Button>
</Input> </Input>
</FormItem> </FormItem>
</Col> </Col>-->
<Col :span="12"> <Col :span="12">
<FormItem :label="l('status')"> <FormItem :label="l('status')">
<!-- <RadioGroup v-model="entity.status"> <!-- <RadioGroup v-model="entity.status">
<Radio label="1"></Radio> <Radio label="1"></Radio>
<Radio label="0"></Radio> <Radio label="0"></Radio>
</RadioGroup>--> </RadioGroup>-->
<CheckboxGroup v-model="entity.isProduction"> <CheckboxGroup v-model="entity.property">
<Checkbox label="1">生产班组</Checkbox> <Checkbox label="1">生产班组</Checkbox>
<Checkbox label="2">排产资源</Checkbox> <Checkbox label="2">排产资源</Checkbox>
<Checkbox label="3">车间</Checkbox>
</CheckboxGroup> </CheckboxGroup>
</FormItem> </FormItem>
</Col> </Col>
...@@ -42,41 +43,41 @@ ...@@ -42,41 +43,41 @@
<Button @click="handleClose" class="ml20">取消</Button> <Button @click="handleClose" class="ml20">取消</Button>
</FormItem> </FormItem>
<!-- 组织类型 --> <!-- 组织类型 -->
<OrganizType <!-- <OrganizType
:show.sync="showTree" :show.sync="showTree"
:value.sync="entity.organization_Id" :value.sync="entity.organization_Id"
:text.sync="entity.organizationType" :text.sync="entity.organizationType"
/> />-->
</Form> </Form>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import OrganizType from "@/components/modalTree/organizType.vue"; // import OrganizType from "@/components/modalTree/organizType.vue";
import citys from "@/libs/citys"; import citys from "@/libs/citys";
export default { export default {
name: "Add", name: "Add",
components: { OrganizType }, // components: { OrganizType },
data() { data() {
return { return {
showTree: false, //组织类型 showTree: false, //组织类型
disabled: false, disabled: false,
citys: citys(), citys: citys(),
entity: { entity: {
organization_Id: 0, // organization_Id: 0,
organizationType: "" // organizationType: ""
}, },
rules: { rules: {
title02: [ title02: [
{ required: true, message: "库位名不能为空", trigger: "blur" } { required: true, message: "库位名不能为空", trigger: "blur" }
],
organizationType: [
{
// type: 'array',
required: true,
message: "组织类型不能为空",
trigger: "blur"
}
] ]
// organizationType: [
// {
// // type: 'array',
// required: true,
// message: "组织类型不能为空",
// trigger: "blur"
// }
// ]
} }
}; };
}, },
...@@ -84,18 +85,21 @@ export default { ...@@ -84,18 +85,21 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs["form"].validate(value => { this.$refs["form"].validate(value => {
if (value) { if (value) {
let property = ""; // var property = "";
if (this.entity.property) { if (this.entity.property) {
if (this.entity.property[0] == 1 || this.entity.property[1] == 1) { if (
this.entity.property[0] == 1 ||
this.entity.property[1] == 1 ||
this.entity.property[2] == 1
) {
this.entity.isProduction = 1; this.entity.isProduction = 1;
} else { } else {
this.entity.isProduction = 0; this.entity.isProduction = 0;
} }
property = this.entity.property.join;
} else { } else {
this.entity.isProduction = ""; this.entity.isProduction = "";
property = "";
} }
alert(this.entity.property);
let location; let location;
if (this.entity.location) { if (this.entity.location) {
location = this.entity.location.join(","); location = this.entity.location.join(",");
...@@ -106,10 +110,10 @@ export default { ...@@ -106,10 +110,10 @@ export default {
name: this.entity.title02, //部门名称 name: this.entity.title02, //部门名称
parent_Id: 0, //上级部门 [id] parent_Id: 0, //上级部门 [id]
code: this.entity.departcode, //部门编号 code: this.entity.departcode, //部门编号
organization_Id: this.entity.organization_Id, //组织类型 [id] // organization_Id: this.entity.organization_Id, //组织类型 [id]
location: location, //省市县 location: location, //省市县
isProduction: this.entity.isProduction, //是否生产班组:1是,0否 isProduction: this.entity.isProduction, //是否生产班组:1是,0否
property: property, //属性 property: this.entity.property, //属性
parentTitle: "" parentTitle: ""
}; };
Api.create(paramsdata) Api.create(paramsdata)
...@@ -129,9 +133,9 @@ export default { ...@@ -129,9 +133,9 @@ export default {
} }
}); });
}, },
selectDepart() { // selectDepart() {
this.showTree = true; // this.showTree = true;
}, // },
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
}, },
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
<Input v-model="entity.code" placeholder="请输入..."></Input> <Input v-model="entity.code" placeholder="请输入..."></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('organizationType')" prop="organizationType"> <FormItem :label="l('organizationType')" prop="organizationType">
<Input v-model="entity.organizationType" readonly placeholder="请选择..."> <Input v-model="entity.organizationType" readonly placeholder="请选择...">
<Button slot="append" @click="selectDepart">选择</Button> <Button slot="append" @click="selectDepart">选择</Button>
</Input> </Input>
</FormItem> </FormItem>
</Col> </Col>-->
<Col :span="12"> <Col :span="12">
<FormItem :label="l('status')"> <FormItem :label="l('status')">
<!-- <RadioGroup v-model="entity.isProduction"> <!-- <RadioGroup v-model="entity.isProduction">
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<CheckboxGroup v-model="entity.property"> <CheckboxGroup v-model="entity.property">
<Checkbox label="1">生产班组</Checkbox> <Checkbox label="1">生产班组</Checkbox>
<Checkbox label="2">排产资源</Checkbox> <Checkbox label="2">排产资源</Checkbox>
<Checkbox label="3">车间</Checkbox>
</CheckboxGroup> </CheckboxGroup>
</FormItem> </FormItem>
</Col> </Col>
...@@ -41,29 +42,30 @@ ...@@ -41,29 +42,30 @@
<Button @click="handleClose" class="ml20">取消</Button> <Button @click="handleClose" class="ml20">取消</Button>
</FormItem> </FormItem>
<!-- 组织类型 --> <!-- 组织类型 -->
<OrganizType <!-- <OrganizType
:show.sync="showTree" :show.sync="showTree"
:value.sync="entity.organization_Id" :value.sync="entity.organization_Id"
:text.sync="entity.organizationType" :text.sync="entity.organizationType"
/> />-->
</Form> </Form>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import OrganizType from "@/components/modalTree/organizType.vue"; // import OrganizType from "@/components/modalTree/organizType.vue";
import citys from "@/libs/citys"; import citys from "@/libs/citys";
export default { export default {
name: "Add", name: "Add",
components: { OrganizType }, // components: { OrganizType },
data() { data() {
return { return {
city_level: [], city_level: [],
showTree: false, //组织类型 // showTree: false, //组织类型
disabled: false, disabled: false,
citys: citys(), citys: citys(),
entity: { entity: {
organization_Id: 0, property: []
organizationType: "" // organization_Id: 0,
// organizationType: ""
}, },
rules: { rules: {
name: [{ required: true, message: "库位名不能为空", trigger: "blur" }], name: [{ required: true, message: "库位名不能为空", trigger: "blur" }],
...@@ -87,7 +89,11 @@ export default { ...@@ -87,7 +89,11 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs["form"].validate(value => { this.$refs["form"].validate(value => {
if (value) { if (value) {
if (this.entity.property[0] == 1 || this.entity.property[1] == 1) { if (
this.entity.property[0] == 1 ||
this.entity.property[1] == 1 ||
this.entity.property[2] == 1
) {
this.entity.isProduction = 1; this.entity.isProduction = 1;
} else { } else {
this.entity.isProduction = 0; this.entity.isProduction = 0;
...@@ -98,7 +104,7 @@ export default { ...@@ -98,7 +104,7 @@ export default {
parent_Id: this.entity.parent_Id, //上级部门 [id] parent_Id: this.entity.parent_Id, //上级部门 [id]
code: this.entity.code, //部门编号 code: this.entity.code, //部门编号
organizationType: this.entity.organizationType, //组织类型 [name] organizationType: this.entity.organizationType, //组织类型 [name]
organization_Id: this.entity.organization_Id, //组织类型 [id] // organization_Id: this.entity.organization_Id, //组织类型 [id]
location: this.city_level.join(","), //省市县 location: this.city_level.join(","), //省市县
isProduction: this.entity.isProduction, //是否生产班组:1是,0否 isProduction: this.entity.isProduction, //是否生产班组:1是,0否
property: this.entity.property.join() //属性 property: this.entity.property.join() //属性
...@@ -120,9 +126,9 @@ export default { ...@@ -120,9 +126,9 @@ export default {
} }
}); });
}, },
selectDepart() { // selectDepart() {
this.showTree = true; // this.showTree = true;
}, // },
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
}, },
...@@ -133,17 +139,8 @@ export default { ...@@ -133,17 +139,8 @@ export default {
}, },
watch: { watch: {
row(v) { row(v) {
console.log(v) console.log(v);
this.entity = this.row; this.entity = this.row;
if (v.property == "1,2") {
this.entity.property = ["1", "2"];
} else if (v.property == "1") {
this.entity.property = ["1"];
} else if (v.property == "2") {
this.entity.property = ["2"];
} else {
this.entity.property = [];
}
this.city_level = this.row.location.split(","); this.city_level = this.row.location.split(",");
} }
} }
......
...@@ -5,26 +5,25 @@ ...@@ -5,26 +5,25 @@
<Button type="primary" @click="add()" class="mb10">新增部门</Button> <Button type="primary" @click="add()" class="mb10">新增部门</Button>
</div> </div>
</div> </div>
<TreeGrid :columns="columns" :items="treeData"> <TreeGrid :columns="columns" :items="treeData"></TreeGrid>
</TreeGrid> <Modal v-model="addModal" title="新增部门" width="800" footer-hide>
<Modal v-model="addModal" title="新增部门" width='800' footer-hide> <Add @on-close="cancel" @on-ok="addOk" />
<Add @on-close="cancel" @on-ok="addOk" />
</Modal> </Modal>
<Modal v-model="addrowModal" title="新增部门" width='800' footer-hide> <Modal v-model="addrowModal" title="新增部门" width="800" footer-hide>
<AddRow :val="rowdata" @on-close="cancel" @on-ok="addOk" /> <AddRow :val="rowdata" @on-close="cancel" @on-ok="addOk" />
</Modal> </Modal>
<Modal v-model="editModal" title="编辑" width='800' footer-hide> <Modal v-model="editModal" title="编辑" width="800" footer-hide>
<Edit :row="rowData" @on-close="cancel" @on-ok="addOk" /> <Edit :row="rowData" @on-close="cancel" @on-ok="addOk" />
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
import Add from './add' import Add from "./add";
import AddRow from './Addrow' import AddRow from "./Addrow";
import Edit from './edit' import Edit from "./edit";
export default { export default {
name: 'list', name: "list",
components: { components: {
Add, Add,
Edit, Edit,
...@@ -32,9 +31,9 @@ export default { ...@@ -32,9 +31,9 @@ export default {
}, },
data() { data() {
return { return {
searchValue: '', //搜索库位名称 searchValue: "", //搜索库位名称
modal: { modal: {
title: '', title: "",
width: 1000, width: 1000,
show: false, show: false,
items: { items: {
...@@ -55,133 +54,137 @@ export default { ...@@ -55,133 +54,137 @@ export default {
rowData: null, rowData: null,
columns: [ columns: [
{ {
key: 'name', key: "name",
title: this.l('name'), title: this.l("name"),
align: 'left', align: "left",
high: true,
},
{
key: 'organizationType',
title: this.l('organizationType'),
align: 'left',
easy: true,
high: true high: true
}, },
// {
// key: 'organizationType',
// title: this.l('organizationType'),
// align: 'left',
// easy: true,
// high: true
// },
{ {
key: 'creationTime', key: "creationTime",
title: this.l('creationTime'), title: this.l("creationTime"),
align: 'left', align: "left",
easy: true, easy: true,
high: true high: true
}, },
{ {
key: 'isProduction', key: "property",
title: this.l('status'), title: this.l("status"),
align: 'left', align: "left",
code:'department.isProduction', code: "department.property",
easy: true, easy: true,
high: true high: true
}, },
{ {
title: '操作', title: "操作",
key: 'id', key: "id",
align: 'left', align: "left",
render: (h, params) => { render: (h, params) => {
let actions = [ let actions = [
h( h(
'op', "op",
{ {
attrs: { oprate: 'add' }, attrs: { oprate: "add" },
on: { click: () => this.addrow(params.row) } on: { click: () => this.addrow(params.row) }
}, },
'新增' "新增"
), ),
h( h(
'op', "op",
{ {
attrs: { oprate: 'edit' }, attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row) } on: { click: () => this.edit(params.row) }
}, },
'编辑' "编辑"
), ),
h( h(
'op', "op",
{ {
attrs: { oprate: 'delete' }, attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) } on: { click: () => this.remove(params.row.id) }
}, },
'删除' "删除"
) )
] ];
return h('div', { class: 'action' }, actions) return h("div", { class: "action" }, actions);
} }
} }
] ]
} };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
mounted() { mounted() {
this.init() this.init();
}, },
methods: { methods: {
init() { init() {
Api.getpaged().then((r) => { Api.getpaged().then(r => {
this.treeData = this.$u.toTree(r.result.items,0,undefined,"parent_Id"); this.treeData = this.$u.toTree(
}) r.result.items,
0,
undefined,
"parent_Id"
);
});
}, },
addOk() { addOk() {
this.init() this.init();
this.addModal = false this.addModal = false;
this.editModal = false this.editModal = false;
this.addrowModal = false this.addrowModal = false;
}, },
add() { add() {
this.addModal = true this.addModal = true;
this.aId = -1 this.aId = -1;
}, },
addrow(row){ addrow(row) {
this.addrowModal = true this.addrowModal = true;
this.rowdata = row this.rowdata = row;
}, },
edit(row) { edit(row) {
this.editModal = true; this.editModal = true;
this.rowData = row; this.rowData = row;
}, },
remove(id) { remove(id) {
this.editModal = false; this.editModal = false;
this.deletelModal = true this.deletelModal = true;
Api.delete({ id:id }).then((res) => { Api.delete({ id: id }).then(res => {
if (res.result == 1) { if (res.result == 1) {
this.init()//刷新列表: this.init(); //刷新列表:
this.$Message.info('删除成功!') this.$Message.info("删除成功!");
} else if (res.result == 2) { } else if (res.result == 2) {
this.$Message.info('删除失败,找不到数据!') this.$Message.info("删除失败,找不到数据!");
} else if (res.result == 3) { } else if (res.result == 3) {
this.$Message.info('删除失败,该组织下有子节点!') this.$Message.info("删除失败,该组织下有子节点!");
} else { } else {
this.$Message.info('删除失败!') this.$Message.info("删除失败!");
} }
});
})
}, },
removeCancel() { removeCancel() {
this.deletelModal = false this.deletelModal = false;
}, },
cancel() { cancel() {
this.addModal = false this.addModal = false;
this.addrowModal = false this.addrowModal = false;
this.editModal = false this.editModal = false;
this.deletedlModal = false this.deletedlModal = false;
}, },
l(key) { l(key) {
let vkey = 'DipartLocation' + '.' + key let vkey = "DipartLocation" + "." + key;
return this.$t(vkey) || key return this.$t(vkey) || key;
} }
} }
} };
</script> </script>
<style lang="less"> <style lang="less">
</style> </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