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

部门

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