|
@@ -17,7 +17,7 @@
|
|
|
></el-cascader>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="所属公司" prop="companyOrgId">
|
|
|
- <el-cascader
|
|
|
+ <!-- <el-cascader
|
|
|
v-model="companyOrgId"
|
|
|
:options="companyArray"
|
|
|
:props="defaultProps"
|
|
@@ -25,18 +25,26 @@
|
|
|
@change="productChange2($event)"
|
|
|
placeholder="请选择公司"
|
|
|
>
|
|
|
- </el-cascader>
|
|
|
+ </el-cascader> -->
|
|
|
+
|
|
|
+ <select-tree
|
|
|
+ class="new-select-tree"
|
|
|
+ selectTreeTitle="请选择公司"
|
|
|
+ placeholder="请选择公司"
|
|
|
+ :options="companyArray"
|
|
|
+ :props="defaultProps"
|
|
|
+ v-model="ruleForm.companyOrgId"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="所属部门">
|
|
|
- <el-cascader
|
|
|
- v-model="deptOrgId"
|
|
|
+ <select-tree
|
|
|
+ class="new-select-tree"
|
|
|
+ placeholder="请选择部门"
|
|
|
:options="departmentArray"
|
|
|
+ selectTreeTitle="请选择部门"
|
|
|
:props="defaultProps"
|
|
|
- @change="productChange3($event)"
|
|
|
- clearable
|
|
|
- placeholder="请选择部门"
|
|
|
- >
|
|
|
- </el-cascader>
|
|
|
+ v-model="ruleForm.deptOrgId"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="详细地址" prop="address">
|
|
|
<div @click="addressQueryClick">
|
|
@@ -62,17 +70,6 @@
|
|
|
<el-input v-model="ruleForm.parkingArea"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="社区图片">
|
|
|
- <!-- <el-upload
|
|
|
- class="avatar-uploader"
|
|
|
- action="https://jsonplaceholder.typicode.com/posts/"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="handleAvatarSuccess"
|
|
|
- :before-upload="beforeAvatarUpload"
|
|
|
- >
|
|
|
- <img v-if="imageUrl" :src="imageUrl" class="avatar" />
|
|
|
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
- </el-upload> -->
|
|
|
-
|
|
|
<el-upload
|
|
|
:headers="token"
|
|
|
ref="uploaduserlogo"
|
|
@@ -105,7 +102,7 @@
|
|
|
</div>
|
|
|
</el-form>
|
|
|
<div style="text-align: right">
|
|
|
- <el-button type="primary" @click="submit">提交</el-button>
|
|
|
+ <el-button type="primary" @click="addEdit">提交</el-button>
|
|
|
<el-button @click="close">取消</el-button>
|
|
|
</div>
|
|
|
|
|
@@ -130,8 +127,6 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
regionId: '',
|
|
|
- companyOrgId: '',
|
|
|
- deptOrgId: '',
|
|
|
locationList: [], //地区列表
|
|
|
ruleForm: {
|
|
|
address: '', //详细地址
|
|
@@ -159,19 +154,22 @@ export default {
|
|
|
token: {
|
|
|
[localStorage.getItem('SC_token') && 'Authorization']: 'Bearer ' + localStorage.getItem('SC_token')
|
|
|
},
|
|
|
- companyArray: [],
|
|
|
- departmentArray: [],
|
|
|
defaultProps: {
|
|
|
value: 'id', // 唯一标识
|
|
|
label: 'orgName', // 标签显示
|
|
|
children: 'orgs' // 子级
|
|
|
},
|
|
|
rules: {
|
|
|
- communityName: [{ required: true, message: '请输入社区名称', trigger: 'change' }],
|
|
|
- address: [{ required: true, message: '请选择地址', trigger: 'change' }],
|
|
|
- regionId: [{ required: true, message: '请选择地区', trigger: 'blur' }],
|
|
|
- companyOrgId: [{ required: true, message: '请选择公司', trigger: 'blur' }],
|
|
|
- phone: [{ required: true, message: '请输入手机号码', trigger: 'change' }]
|
|
|
+ communityName: [this.$valid.selectRequired('请输入社区名称')],
|
|
|
+ address: [this.$valid.selectRequired('请选择地址')],
|
|
|
+ regionId: [this.$valid.selectRequired('请选择地区')],
|
|
|
+ companyOrgId: [this.$valid.selectRequired('请选择公司')],
|
|
|
+ phone: [
|
|
|
+ this.$valid.inputRequired('输入手机号'),
|
|
|
+ this.$valid.pattern(
|
|
|
+ /^((0\d{2,3}-\d{7,8})|((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|147)\d{8})$/
|
|
|
+ )
|
|
|
+ ]
|
|
|
},
|
|
|
mapPopUpStatus: false //地图弹出框
|
|
|
};
|
|
@@ -179,7 +177,14 @@ export default {
|
|
|
components: {
|
|
|
MapPopup
|
|
|
},
|
|
|
- computed: {},
|
|
|
+ computed: {
|
|
|
+ companyArray() {
|
|
|
+ return this.$store.getters['getCompanyArray'];
|
|
|
+ },
|
|
|
+ departmentArray() {
|
|
|
+ return this.$store.getters['getDepartmentArray'];
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
productChange(va) {
|
|
|
debugger;
|
|
@@ -200,27 +205,51 @@ export default {
|
|
|
this.mapPopUpStatus = !this.mapPopUpStatus;
|
|
|
},
|
|
|
//保存
|
|
|
- submit() {
|
|
|
- new Promise((resolve) => {
|
|
|
- this.$refs.ruleForm.validate(resolve);
|
|
|
- }).then(() => {
|
|
|
- let url = '/sc-community/assets/community/add';
|
|
|
- let params = this.ruleForm;
|
|
|
- if (!this.isAdd) {
|
|
|
- url = '/sc-community/assets/community/update';
|
|
|
+ addEdit() {
|
|
|
+ this.$refs.ruleForm.validate((valid) => {
|
|
|
+ console.log(this.ruleForm);
|
|
|
+ if (valid) {
|
|
|
+ let url = '/sc-community/assets/community/add';
|
|
|
+ let params = this.ruleForm;
|
|
|
+ if (!this.isAdd) {
|
|
|
+ url = '/sc-community/assets/community/update';
|
|
|
+ }
|
|
|
+ this.$http
|
|
|
+ .post(url, params)
|
|
|
+ .then(({ status, msg }) => {
|
|
|
+ if (status == 0) {
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.close();
|
|
|
+ } else {
|
|
|
+ this.$message.error(msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
}
|
|
|
- this.$http
|
|
|
- .post(url, params)
|
|
|
- .then(({ status, msg }) => {
|
|
|
- if (status == 0) {
|
|
|
- this.$message.success(msg);
|
|
|
- this.close();
|
|
|
- } else {
|
|
|
- this.$message.error(msg);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
});
|
|
|
+ // new Promise((resolve) => {
|
|
|
+ // this.$refs.ruleForm.validate(resolve);
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+
|
|
|
+ // let url = '/sc-community/assets/community/add';
|
|
|
+ // let params = this.ruleForm;
|
|
|
+ // if (!this.isAdd) {
|
|
|
+ // url = '/sc-community/assets/community/update';
|
|
|
+ // }
|
|
|
+ // this.$http
|
|
|
+ // .post(url, params)
|
|
|
+ // .then(({ status, msg }) => {
|
|
|
+ // if (status == 0) {
|
|
|
+ // this.$message.success(msg);
|
|
|
+ // this.close();
|
|
|
+ // } else {
|
|
|
+ // this.$message.error(msg);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .catch(() => {});
|
|
|
+ // })
|
|
|
+ // .catch(() => {});
|
|
|
},
|
|
|
|
|
|
//所属地区
|
|
@@ -232,21 +261,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- //所属公司
|
|
|
- companyQuery() {
|
|
|
- this.$http.postForm('/sc-user-center/org/getOrgTree', { orgType: 'company' }).then(({ data }) => {
|
|
|
- this.companyArray = data;
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- //所属部门
|
|
|
- departmentQuery() {
|
|
|
- let self = this;
|
|
|
- this.$http.postForm('/sc-user-center/org/getOrgTree', { orgType: 'department' }).then(({ data }) => {
|
|
|
- this.departmentArray = data;
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
uploadsuccess(response, file, fileList) {
|
|
|
this.$refs.uploaduserlogo.clearFiles();
|
|
|
if (0 === response.status) {
|
|
@@ -276,8 +290,8 @@ export default {
|
|
|
if (0 === status) {
|
|
|
this.ruleForm = data;
|
|
|
this.regionId = [data.provinceId, data.cityId, data.regionId];
|
|
|
- this.companyOrgId = [null, null, data.companyOrgId];
|
|
|
- this.deptOrgId = [null, null, data.deptOrgId];
|
|
|
+ // this.companyOrgId = [null, null, data.companyOrgId];
|
|
|
+ // this.deptOrgId = [null, null, data.deptOrgId];
|
|
|
} else {
|
|
|
this.$message.error(msg);
|
|
|
}
|
|
@@ -290,8 +304,6 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.regionalQuery();
|
|
|
- this.companyQuery();
|
|
|
- this.departmentQuery();
|
|
|
|
|
|
if (!!this.params.id) {
|
|
|
this.getDetails(this.params.id);
|