Commit b533f436 authored by 仇晓婷's avatar 仇晓婷

部门

parent 9c6ecebc
......@@ -19,12 +19,8 @@
</FormItem>
</Col>-->
<Col :span="12">
<FormItem :label="l('status')">
<!-- <RadioGroup v-model="entity.isProduction">
<Radio label="1"></Radio>
<Radio label="0"></Radio>
</RadioGroup>-->
<CheckboxGroup v-model="entity.property">
<FormItem :label="l('status')" prop="propertyList">
<CheckboxGroup v-model="propertyList">
<Checkbox label="1">生产班组</Checkbox>
<Checkbox label="2">排产资源</Checkbox>
<Checkbox label="3">车间</Checkbox>
......@@ -38,6 +34,7 @@
</Col>
</Row>
<FormItem>
{{entity}}
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
......@@ -51,84 +48,94 @@
</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, //组织类型
propertyList: [],
showTree: false, //组织类型
disabled: false,
citys: citys(),
entity: {
property: []
// organization_Id: 0,
// organizationType: ""
organization_Id: 0, //组织类型
organizationType: "",
name: "",
parent_Id: 0,
level_Desc: "",
location: "",
isProduction: 1,
code: "",
property: "",
id: -1
},
rules: {
name: [{ required: true, message: "库位名不能为空", trigger: "blur" }],
// organizationType: [
// {
// required: true,
// message: "组织类型不能为空",
// trigger: "blur"
// }
// ]
property: [
{
required: true,
message: "属性不能为空",
trigger: "change"
}
]
}
};
},
props: {
row: Object
},
created() {
// this.entity = {}
},
created() {},
methods: {
handleSubmit() {
this.$refs["form"].validate(value => {
if (value) {
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;
}
let paramsdata = {
id: this.entity.id,
name: this.entity.name, //部门名称
parent_Id: this.entity.parent_Id, //上级部门 [id]
code: this.entity.code, //部门编号
// organizationType: this.entity.organizationType, //组织类型 [name]
// organization_Id: this.entity.organization_Id, //组织类型 [id]
location: this.city_level.join(","), //省市县
isProduction: this.entity.isProduction, //是否生产班组:1是,0否
property: this.entity.property.join() //属性
};
Api.update(paramsdata)
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success("编辑成功");
this.$emit("on-ok");
} else {
if (this.entity.id > 0) {
let isProduction = 0;
if (
this.entity.property[0] == 1 ||
this.entity.property[1] == 1 ||
this.entity.property[2] == 1
) {
location;
isProduction = 1;
} else {
isProduction = 0;
}
let location = this.city_level;
let property = this.entity.property;
let paramsdata = {
id: this.entity.id,
name: this.entity.name, //部门名称
parent_Id: this.entity.parent_Id, //上级部门 [id]
code: this.entity.code, //部门编号
organization_Id: this.entity.organization_Id, //组织类型 [id]
location: location.join(","), //省市县
isProduction: isProduction, //是否生产班组:1是,0否
property: property //属性
};
Api.update(paramsdata)
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success("编辑成功");
this.$emit("on-ok");
} else {
this.$Message.error("编辑失败,请联系管理员");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("编辑失败,请联系管理员");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("编辑失败,请联系管理员");
});
});
}
}
});
},
// selectDepart() {
// this.showTree = true;
// },
handleClose() {
this.$emit("on-close");
},
......@@ -138,10 +145,30 @@ export default {
}
},
watch: {
row(v) {
console.log(v);
this.entity = this.row;
this.city_level = this.row.location.split(",");
"row.id"(v) {
let model = {
name: this.row.name,
parent_Id: this.row.parent_Id,
location: this.row.location,
isProduction: 0,
code: this.row.code,
property: this.row.property,
id: this.row.id,
organization_Id: this.row.organization_Id,
organizationType: this.row.organizationType
};
if (!model.property) {
model.property = "";
this.propertyList = [];
} else {
this.propertyList = (model.property + "").split(",");
}
if (!model.location) {
this.city_level = [];
} else {
this.city_level = model.location.split(",");
}
this.entity = model;
}
}
};
......
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