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

部门加字段

parent 369364b5
......@@ -420,7 +420,8 @@ export default {
DipartLocation: {
name: "部门",
organizationType: "组织类型",
status: '是否生产班组',
// status: '是否生产班组',
status:'属性',
departcode: '部门编号',
department: '部门名称',
cityName: '省市县',
......
......@@ -21,9 +21,9 @@
<Col :span="12">
<FormItem :label="l('upMent')">
<b>{{entity.name}}</b>
</FormItem>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('cityName')">
<Cascader :data="citys" v-model="entity.description02"></Cascader>
......@@ -31,10 +31,14 @@
</Col>
<Col :span="12">
<FormItem :label="l('status')">
<RadioGroup v-model="entity.isProduction">
<!-- <RadioGroup v-model="entity.isProduction">
<Radio label="1"></Radio>
<Radio label="0"></Radio>
</RadioGroup>
</RadioGroup>-->
<CheckboxGroup v-model="entity.isProduction">
<Checkbox label="1">生产班组</Checkbox>
<Checkbox label="2">排产资源</Checkbox>
</CheckboxGroup>
</FormItem>
</Col>
</Row>
......@@ -51,11 +55,11 @@
</Form>
</template>
<script>
import Api from './api'
import OrganizType from '@/components/modalTree/organizType.vue'
import citys from '@/libs/citys'
import Api from "./api";
import OrganizType from "@/components/modalTree/organizType.vue";
import citys from "@/libs/citys";
export default {
name: 'Add',
name: "Add",
components: { OrganizType },
data() {
return {
......@@ -64,72 +68,72 @@ export default {
citys: citys(),
entity: {
organization_Id: 0,
organization_Type: ''
organization_Type: ""
},
rules: {
title02: [
{ required: true, message: '库位名不能为空', trigger: 'blur' }
{ required: true, message: "库位名不能为空", trigger: "blur" }
],
organizationType: [
{
required: true,
message: '组织类型不能为空',
trigger: 'blur'
message: "组织类型不能为空",
trigger: "blur"
}
]
}
}
};
},
props: {
val: Object
},
created() {
this.entity = {};
},
props: {
val: Object
},
created() {
this.entity = {}
},
methods: {
handleSubmit() {
this.$refs['form'].validate(value=>{
if(value){
this.$refs["form"].validate(value => {
if (value) {
let paramsdata = {
name: this.entity.title02,//部门名称
parent_Id: this.entity.id,//上级部门 [id]
code: this.entity.departcode,//部门编号
organization_Id: this.entity.organization_Id,//组织类型 [id]
location: this.entity.location,//省市县
isProduction: this.entity.isProduction,//是否生产班组:1是,0否
}
name: this.entity.title02, //部门名称
parent_Id: this.entity.id, //上级部门 [id]
code: this.entity.departcode, //部门编号
organization_Id: this.entity.organization_Id, //组织类型 [id]
location: this.entity.location, //省市县
isProduction: this.entity.isProduction //是否生产班组:1是,0否
};
Api.create(paramsdata)
.then((r) => {
this.disabled = false
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功!')
this.$emit('on-ok')
this.$Message.success("保存成功!");
this.$emit("on-ok");
} else {
this.$Message.error('保存失败,请联系管理员')
this.$Message.error("保存失败,请联系管理员");
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败,请联系管理员')
})
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败,请联系管理员");
});
}
});
},
selectDepart() {
this.showTree = true
this.showTree = true;
},
handleClose() {
this.$emit('on-close')
this.$emit("on-close");
},
l(key) {
key = 'DipartLocation' + '.' + key
return this.$t(key)
key = "DipartLocation" + "." + key;
return this.$t(key);
}
},
watch: {
val(v) {
this.entity = this.val
this.entity = this.val;
}
}
}
};
</script>
\ No newline at end of file
......@@ -13,7 +13,7 @@
</Col>
<Col :span="12">
<FormItem :label="l('organizationType')" prop="organizationType">
<FormItem :label="l('organizationType')" prop="organizationType">
<Input v-model="entity.organizationType" readonly placeholder="请选择...">
<Button slot="append" @click="selectDepart">选择</Button>
</Input>
......@@ -21,10 +21,14 @@
</Col>
<Col :span="12">
<FormItem :label="l('status')">
<RadioGroup v-model="entity.status">
<!-- <RadioGroup v-model="entity.status">
<Radio label="1"></Radio>
<Radio label="0"></Radio>
</RadioGroup>
</RadioGroup>-->
<CheckboxGroup v-model="entity.isProduction">
<Checkbox label="1">生产班组</Checkbox>
<Checkbox label="2">排产资源</Checkbox>
</CheckboxGroup>
</FormItem>
</Col>
<Col :span="24">
......@@ -46,11 +50,11 @@
</Form>
</template>
<script>
import Api from './api'
import OrganizType from '@/components/modalTree/organizType.vue'
import citys from '@/libs/citys'
import Api from "./api";
import OrganizType from "@/components/modalTree/organizType.vue";
import citys from "@/libs/citys";
export default {
name: 'Add',
name: "Add",
components: { OrganizType },
data() {
return {
......@@ -59,69 +63,68 @@ export default {
citys: citys(),
entity: {
organization_Id: 0,
organizationType: ''
organizationType: ""
},
rules: {
title02: [
{ required: true, message: '库位名不能为空', trigger: 'blur' }
{ required: true, message: "库位名不能为空", trigger: "blur" }
],
organizationType: [
{
// type: 'array',
required: true,
message: '组织类型不能为空',
trigger: 'blur'
message: "组织类型不能为空",
trigger: "blur"
}
]
}
}
};
},
methods: {
handleSubmit() {
this.$refs['form'].validate(value =>{
if(value){
let location ;
if(this.entity.location){
location = this.entity.location.join(',')
}else{
location = ''
this.$refs["form"].validate(value => {
if (value) {
let location;
if (this.entity.location) {
location = this.entity.location.join(",");
} else {
location = "";
}
let paramsdata = {
name: this.entity.title02,//部门名称
parent_Id: 0,//上级部门 [id]
code: this.entity.departcode,//部门编号
organization_Id: this.entity.organization_Id,//组织类型 [id]
location: location,//省市县
isProduction: this.entity.status,//是否生产班组:1是,0否
}
name: this.entity.title02, //部门名称
parent_Id: 0, //上级部门 [id]
code: this.entity.departcode, //部门编号
organization_Id: this.entity.organization_Id, //组织类型 [id]
location: location, //省市县
isProduction: this.entity.isProduction //是否生产班组:1是,0否
};
Api.create(paramsdata)
.then((r) => {
this.disabled = false
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功!')
this.$emit('on-ok')
this.$Message.success("保存成功!");
this.$emit("on-ok");
} else {
this.$Message.error('保存失败,请联系管理员')
this.$Message.error("保存失败,请联系管理员");
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败,请联系管理员')
})
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败,请联系管理员");
});
}
});
},
selectDepart() {
this.showTree = true
this.showTree = true;
},
handleClose() {
this.$emit('on-close')
this.$emit("on-close");
},
l(key) {
key = 'DipartLocation' + '.' + key
return this.$t(key)
key = "DipartLocation" + "." + key;
return this.$t(key);
}
}
}
};
</script>
\ No newline at end of file
......@@ -20,10 +20,14 @@
</Col>
<Col :span="12">
<FormItem :label="l('status')">
<RadioGroup v-model="entity.isProduction">
<!-- <RadioGroup v-model="entity.isProduction">
<Radio label="1"></Radio>
<Radio label="0"></Radio>
</RadioGroup>
</RadioGroup>-->
<CheckboxGroup v-model="entity.isProduction">
<Checkbox label="1">生产班组</Checkbox>
<Checkbox label="2">排产资源</Checkbox>
</CheckboxGroup>
</FormItem>
</Col>
<Col :span="24">
......@@ -31,7 +35,6 @@
<Cascader :data="citys" v-model="city_level"></Cascader>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
......@@ -46,90 +49,88 @@
</Form>
</template>
<script>
import Api from './api'
import OrganizType from '@/components/modalTree/organizType.vue'
import citys from '@/libs/citys'
import Api from "./api";
import OrganizType from "@/components/modalTree/organizType.vue";
import citys from "@/libs/citys";
export default {
name: 'Add',
name: "Add",
components: { OrganizType },
data() {
return {
city_level:[],
city_level: [],
showTree: false, //组织类型
disabled: false,
citys: citys(),
entity: {
organization_Id: 0,
organizationType: ''
organizationType: ""
},
rules: {
name: [
{ required: true, message: '库位名不能为空', trigger: 'blur' }
],
name: [{ required: true, message: "库位名不能为空", trigger: "blur" }],
organizationType: [
{
required: true,
message: '组织类型不能为空',
trigger: 'blur'
message: "组织类型不能为空",
trigger: "blur"
}
]
}
}
};
},
props: {
row: Object
},
created() {
// this.entity = {}
},
props: {
row: Object
},
created() {
// this.entity = {}
},
methods: {
handleSubmit() {
this.$refs['form'].validate(value=>{
if(value){
this.$refs["form"].validate(value => {
if (value) {
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否
}
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否
};
Api.update(paramsdata)
.then((r) => {
this.disabled = false
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success('编辑成功')
this.$emit('on-ok')
this.$Message.success("编辑成功");
this.$emit("on-ok");
} else {
this.$Message.error('编辑失败,请联系管理员')
this.$Message.error("编辑失败,请联系管理员");
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('编辑失败,请联系管理员')
})
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("编辑失败,请联系管理员");
});
}
});
},
selectDepart() {
this.showTree = true
this.showTree = true;
},
handleClose() {
this.$emit('on-close')
this.$emit("on-close");
},
l(key) {
key = 'DipartLocation' + '.' + key
return this.$t(key)
key = "DipartLocation" + "." + key;
return this.$t(key);
}
},
watch: {
row(v) {
this.entity = this.row
this.entity.isProduction = this.row.isProduction.toString()
this.city_level = this.row.location.split(',')
this.entity = this.row;
this.entity.isProduction = this.row.isProduction.toString();
this.city_level = this.row.location.split(",");
}
}
}
};
</script>
\ 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