|
@@ -69,10 +69,28 @@
|
|
|
</el-row>
|
|
</el-row>
|
|
|
<el-row v-if="operType !== 'ADDC'">
|
|
<el-row v-if="operType !== 'ADDC'">
|
|
|
<el-col :span="24">
|
|
<el-col :span="24">
|
|
|
- <v-distpicker class="select-span" @rules="rulesquest" @province="selectProvince" @city="selectCity"
|
|
|
|
|
- @area="selectArea" :province="selectAddress.province" :city="selectAddress.city" :area="selectAddress.area"
|
|
|
|
|
- :provinceDisabled="disabledAddress.province" :cityDisabled="disabledAddress.city"
|
|
|
|
|
- :areaDisabled="disabledAddress.area"></v-distpicker>
|
|
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="省公司" prop="province">
|
|
|
|
|
+ <el-select @change="selectProvince" value-key="areaCname" style="width: 100%;" v-model="selectAddress.province" placeholder="请选择省" size="small">
|
|
|
|
|
+ <el-option v-for="item in provinces" :value="item" :key="item.areaCode" :label="item.areaCname"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="支公司" prop="city">
|
|
|
|
|
+ <el-select @change="selectCity" value-key="areaCname" style="width: 100%;" v-model="selectAddress.city" placeholder="请选择市" size="small">
|
|
|
|
|
+ <el-option v-for="(item, index) in cities" :key="index" :value="item" :label="item.areaCname"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="营销服务部" prop="area">
|
|
|
|
|
+ <el-select @change="selectArea" value-key="areaCname" style="width: 100%;" v-model="selectAddress.area" placeholder="请选择区" size="small">
|
|
|
|
|
+ <el-option v-for="(item, index) in areas " :key="index" :value="item" :label="item.areaCname"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <!-- selectArea area -->
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<!-- <el-col :span="8" v-show="dataForm.comlevel==5">
|
|
<!-- <el-col :span="8" v-show="dataForm.comlevel==5">
|
|
|
<el-form-item label="门店" prop="house">
|
|
<el-form-item label="门店" prop="house">
|
|
@@ -200,7 +218,6 @@ import Cookies from "js-cookie";
|
|
|
import KtButton from "@/views/Core/KtButton"; //按钮权限组件
|
|
import KtButton from "@/views/Core/KtButton"; //按钮权限组件
|
|
|
import tree from "@/components/ztree.vue"; //机构树组件
|
|
import tree from "@/components/ztree.vue"; //机构树组件
|
|
|
import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
|
|
import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
|
|
|
-import VDistpicker from "@/components/VDistpicker"; //区域下拉
|
|
|
|
|
import CommonUtil from "@/utils/comutil.js";
|
|
import CommonUtil from "@/utils/comutil.js";
|
|
|
export default {
|
|
export default {
|
|
|
name: "Deptall",
|
|
name: "Deptall",
|
|
@@ -208,7 +225,6 @@ export default {
|
|
|
KtButton,
|
|
KtButton,
|
|
|
tree,
|
|
tree,
|
|
|
KtCommonTable,
|
|
KtCommonTable,
|
|
|
- VDistpicker,
|
|
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
this.peopleid = Cookies.get("user");
|
|
this.peopleid = Cookies.get("user");
|
|
@@ -223,6 +239,7 @@ export default {
|
|
|
this.getDictItems("comlevel");
|
|
this.getDictItems("comlevel");
|
|
|
this.getDictItems("comattribute");
|
|
this.getDictItems("comattribute");
|
|
|
this.getDictItems("comtype");
|
|
this.getDictItems("comtype");
|
|
|
|
|
+ this.getQueryTree() //获取省市区数据
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
this.changeTreeWidth(); // 初始化树的宽度
|
|
this.changeTreeWidth(); // 初始化树的宽度
|
|
@@ -317,7 +334,6 @@ export default {
|
|
|
operType: "ADD", //'ADD','EDIT'
|
|
operType: "ADD", //'ADD','EDIT'
|
|
|
dialogTitle: "窗口",
|
|
dialogTitle: "窗口",
|
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
|
- propsrules:false,
|
|
|
|
|
dataForm: {
|
|
dataForm: {
|
|
|
id: "",
|
|
id: "",
|
|
|
name: "",
|
|
name: "",
|
|
@@ -378,6 +394,15 @@ export default {
|
|
|
trigger: "blur",
|
|
trigger: "blur",
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
|
|
+ province: [
|
|
|
|
|
+ { required: true, message: '请选择省', trigger: 'change' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ city: [
|
|
|
|
|
+ { required: true, message: '请选择市', trigger: 'change' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ area: [
|
|
|
|
|
+ { required: true, message: '请选择区', trigger: 'change' }
|
|
|
|
|
+ ]
|
|
|
},
|
|
},
|
|
|
//-- address begin ---
|
|
//-- address begin ---
|
|
|
selectAddress: {
|
|
selectAddress: {
|
|
@@ -411,6 +436,9 @@ export default {
|
|
|
isshow: false,
|
|
isshow: false,
|
|
|
expanded: false, // 在这里定义了展开与否的标志
|
|
expanded: false, // 在这里定义了展开与否的标志
|
|
|
// 部门DialogEnd
|
|
// 部门DialogEnd
|
|
|
|
|
+ provinces:[],//省数据
|
|
|
|
|
+ cities:[],//市数据
|
|
|
|
|
+ areas:[],//区数据
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
@@ -452,6 +480,13 @@ export default {
|
|
|
this[typeName + "options"] = [];
|
|
this[typeName + "options"] = [];
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ //获取省市区树数据
|
|
|
|
|
+ getQueryTree(){
|
|
|
|
|
+ this.$api.dept.queryTree().then((res) => {
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ this.provinces = res.data; //
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
// 添加子公司
|
|
// 添加子公司
|
|
|
handleAddCompany() {
|
|
handleAddCompany() {
|
|
|
if (!this.currentTreeNode) {
|
|
if (!this.currentTreeNode) {
|
|
@@ -663,9 +698,27 @@ export default {
|
|
|
this.$api.dept.getDeptById(data.id).then((res) => {
|
|
this.$api.dept.getDeptById(data.id).then((res) => {
|
|
|
that.dataForm = res.data;
|
|
that.dataForm = res.data;
|
|
|
Object.assign(that.dataForm, res.data);
|
|
Object.assign(that.dataForm, res.data);
|
|
|
- that.selectAddress.province = that.dataForm.province;
|
|
|
|
|
- that.selectAddress.city = that.dataForm.city;
|
|
|
|
|
- that.selectAddress.area = that.dataForm.area;
|
|
|
|
|
|
|
+ that.selectAddress.province = {areaCname:that.dataForm.province};
|
|
|
|
|
+ that.selectAddress.city = {areaCname:that.dataForm.city};
|
|
|
|
|
+ that.selectAddress.area = {areaCname:that.dataForm.area};
|
|
|
|
|
+ /****
|
|
|
|
|
+ * 获取市、区下拉框对应数据 ...start
|
|
|
|
|
+ */
|
|
|
|
|
+ let cityArr = that.provinces.filter(item=>{
|
|
|
|
|
+ return that.dataForm.province == item.areaCname
|
|
|
|
|
+ })
|
|
|
|
|
+ if(cityArr.length>0){
|
|
|
|
|
+ that.cities=cityArr[0].child
|
|
|
|
|
+ let areaArr = that.cities.filter(item=>{
|
|
|
|
|
+ return that.dataForm.city == item.areaCname
|
|
|
|
|
+ })
|
|
|
|
|
+ if(areaArr.length>0){
|
|
|
|
|
+ that.areas=areaArr[0].child
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /****
|
|
|
|
|
+ * 获取市、区下拉框对应数据 ...end
|
|
|
|
|
+ */
|
|
|
this.$api.dept.getDeptById(res.data.parentId).then((res) => {
|
|
this.$api.dept.getDeptById(res.data.parentId).then((res) => {
|
|
|
this.currentTreeNode = res.data;
|
|
this.currentTreeNode = res.data;
|
|
|
});
|
|
});
|
|
@@ -717,10 +770,6 @@ export default {
|
|
|
data: comtype,
|
|
data: comtype,
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- //父组件校验
|
|
|
|
|
- rulesquest(val){
|
|
|
|
|
- this.propsrules=val;
|
|
|
|
|
- },
|
|
|
|
|
// 提交表单
|
|
// 提交表单
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
// if (!this.dataForm.id || this.dataForm.id == this.dataForm.parentId) {
|
|
// if (!this.dataForm.id || this.dataForm.id == this.dataForm.parentId) {
|
|
@@ -848,35 +897,46 @@ export default {
|
|
|
|
|
|
|
|
//公司区域选择
|
|
//公司区域选择
|
|
|
//-- address begin --
|
|
//-- address begin --
|
|
|
|
|
+ // 选择省
|
|
|
selectProvince(value) {
|
|
selectProvince(value) {
|
|
|
- this.selectAddress.province = value.value;
|
|
|
|
|
- this.dataForm.province = value.value;
|
|
|
|
|
|
|
+ this.selectAddress.province = {areaCname:value.areaCname};
|
|
|
|
|
+ this.dataForm.province = value.areaCname;
|
|
|
|
|
+ this.cities = value.child;
|
|
|
if (this.dataForm.comlevel == 5) {
|
|
if (this.dataForm.comlevel == 5) {
|
|
|
- } else if (value.code) {
|
|
|
|
|
- this.dataForm.id = this.dataForm.parentId + value.code.substr(0, 2);
|
|
|
|
|
|
|
+ } else if (value.areaCode) {
|
|
|
|
|
+ this.dataForm.id = this.dataForm.parentId + value.areaCode.substr(0, 2);
|
|
|
// this.dataForm.id = ("99" + value.code).substr(0, 4);
|
|
// this.dataForm.id = ("99" + value.code).substr(0, 4);
|
|
|
} else {
|
|
} else {
|
|
|
this.dataForm.id = "";
|
|
this.dataForm.id = "";
|
|
|
}
|
|
}
|
|
|
|
|
+ this.selectAddress.city = '';
|
|
|
|
|
+ this.dataForm.city = '';
|
|
|
|
|
+ this.selectAddress.area = '';
|
|
|
|
|
+ this.dataForm.area = '';
|
|
|
},
|
|
},
|
|
|
|
|
+ // 选择市
|
|
|
selectCity(value) {
|
|
selectCity(value) {
|
|
|
- this.selectAddress.city = value.value;
|
|
|
|
|
- this.dataForm.city = value.value;
|
|
|
|
|
|
|
+ this.selectAddress.city = {areaCname:value.areaCname};
|
|
|
|
|
+ this.dataForm.city = value.areaCname;
|
|
|
|
|
+ this.areas = value.child;
|
|
|
if (this.dataForm.comlevel == 5) {
|
|
if (this.dataForm.comlevel == 5) {
|
|
|
- } else if (value.code) {
|
|
|
|
|
- this.dataForm.id = this.dataForm.parentId + value.code.substr(2, 2);
|
|
|
|
|
- // this.dataForm.id = ("99" + value.code).substr(0, 6);
|
|
|
|
|
|
|
+ } else if (value.areaCode) {
|
|
|
|
|
+ this.dataForm.id = this.dataForm.parentId + value.areaCode.substr(2, 2);
|
|
|
|
|
+ // this.dataForm.id = ("99" + value.areaCode).substr(0, 6);
|
|
|
} else {
|
|
} else {
|
|
|
this.dataForm.id = "";
|
|
this.dataForm.id = "";
|
|
|
}
|
|
}
|
|
|
|
|
+ this.selectAddress.area = '';
|
|
|
|
|
+ this.dataForm.area = '';
|
|
|
},
|
|
},
|
|
|
|
|
+ // 选择区
|
|
|
selectArea(value) {
|
|
selectArea(value) {
|
|
|
- this.selectAddress.area = value.value;
|
|
|
|
|
- this.dataForm.area = value.value;
|
|
|
|
|
|
|
+ this.selectAddress.area = {areaCname:value.areaCname};
|
|
|
|
|
+ this.dataForm.area = value.areaCname;
|
|
|
if (this.dataForm.comlevel == 5) {
|
|
if (this.dataForm.comlevel == 5) {
|
|
|
- } else if (value.code) {
|
|
|
|
|
- this.dataForm.id = this.dataForm.parentId + value.code.substr(4, 2);
|
|
|
|
|
- // this.dataForm.id = ("99" + value.code).substr(0, 8);
|
|
|
|
|
|
|
+ } else if (value.areaCode) {
|
|
|
|
|
+ this.dataForm.id = this.dataForm.parentId + value.areaCode.substr(4, 2);
|
|
|
|
|
+ // this.dataForm.id = ("99" + value.areaCode).substr(0, 8);
|
|
|
} else {
|
|
} else {
|
|
|
this.dataForm.id = "";
|
|
this.dataForm.id = "";
|
|
|
}
|
|
}
|