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

部门字段修改

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