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,84 +48,94 @@ ...@@ -51,84 +48,94 @@
</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 ( if (this.entity.id > 0) {
this.entity.property[0] == 1 || let isProduction = 0;
this.entity.property[1] == 1 || if (
this.entity.property[2] == 1 this.entity.property[0] == 1 ||
) { this.entity.property[1] == 1 ||
this.entity.isProduction = 1; this.entity.property[2] == 1
} else { ) {
this.entity.isProduction = 0; location;
} isProduction = 1;
let paramsdata = { } else {
id: this.entity.id, isProduction = 0;
name: this.entity.name, //部门名称 }
parent_Id: this.entity.parent_Id, //上级部门 [id]
code: this.entity.code, //部门编号 let location = this.city_level;
// organizationType: this.entity.organizationType, //组织类型 [name] let property = this.entity.property;
// organization_Id: this.entity.organization_Id, //组织类型 [id]
location: this.city_level.join(","), //省市县 let paramsdata = {
isProduction: this.entity.isProduction, //是否生产班组:1是,0否 id: this.entity.id,
property: this.entity.property.join() //属性 name: this.entity.name, //部门名称
}; parent_Id: this.entity.parent_Id, //上级部门 [id]
Api.update(paramsdata) code: this.entity.code, //部门编号
.then(r => { organization_Id: this.entity.organization_Id, //组织类型 [id]
this.disabled = false; location: location.join(","), //省市县
if (r.success) { isProduction: isProduction, //是否生产班组:1是,0否
this.$Message.success("编辑成功"); property: property //属性
this.$emit("on-ok"); };
} else { 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("编辑失败,请联系管理员"); this.$Message.error("编辑失败,请联系管理员");
} });
}) }
.catch(err => {
this.disabled = false;
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