城阳pc工作端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

595 lines
17 KiB

<template>
<div>
<div class="dialog-h-content scroll-h">
<el-form
ref="ref_form"
:inline="false"
:model="dataForm"
:rules="dataRule"
label-width="150px"
class="g-edit-form"
>
<el-form-item label="当前组织" style="display: block">
<span>{{ gridName }}</span>
</el-form-item>
<el-form-item label="姓名" style="display: block">
<span>{{ dataForm.name }}</span>
</el-form-item>
<el-form-item label="迁出时间" prop="outOfTime">
<el-date-picker
v-model="dataForm.outOfTime"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd"
placeholder="选择日期"
class="u-edit-width-normal"
:clearable="false"
>
</el-date-picker>
</el-form-item>
<el-form-item label="迁出类型" prop="type" style="display: block">
<el-radio-group v-model="dataForm.type">
<el-radio :label="'in'">{{
"迁往" + rootAgency.organizationName + "内其他区域"
}}</el-radio>
<el-radio :label="'out'">其他</el-radio>
</el-radio-group>
</el-form-item>
<template v-if="dataForm.type === 'in'">
<el-form-item label="迁出至" prop="agencyId">
<el-cascader
ref="myCascader"
v-model="agencyIdArray"
class="u-edit-width-normal"
:key="iscascaderShow"
:options="casOptions"
:props="optionProps"
@change="handleChangeAgency"
clearable
></el-cascader>
</el-form-item>
<el-form-item label="所属家庭" prop="villageId">
<div>
<el-select
v-model.trim="dataForm.villageId"
placeholder="请选择小区"
clearable
class="u-edit-width-normal"
@change="handleChangeCommunity($event)"
>
<el-option
v-for="item in communityList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div style="margin-top: 5px">
<el-select
v-model.trim="dataForm.buildId"
placeholder="楼号"
clearable
class="u-edit-width-build"
@change="handleChangeBuilding($event)"
>
<el-option
v-for="item in buildingList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-select
v-model.trim="dataForm.unitId"
placeholder="单元"
clearable
style="margin-left: 10px"
class="u-edit-width-build"
@change="handleChangeUnit($event)"
>
<el-option
v-for="item in unitList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-select
v-model.trim="dataForm.homeId"
placeholder="房号"
clearable
style="margin-left: 10px"
class="u-edit-width-build"
@change="handleChangeHome($event)"
>
<el-option
v-for="item in roomList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
</el-form-item>
</template>
<div v-if="dataForm.type === 'out'">
<el-form-item label="外迁详细地址" prop="address">
<el-input
type="textarea"
:autosize="{ minRows: 2, maxRows: 7 }"
:rows="5"
resize="none"
class="u-edit-width-normal"
placeholder="请输入外迁详细地址"
v-model="dataForm.address"
>
</el-input>
</el-form-item>
</div>
<el-form-item label="迁出原因" prop="reason">
<el-input
type="textarea"
:autosize="{ minRows: 4, maxRows: 7 }"
:rows="5"
resize="none"
class="u-edit-width-normal"
placeholder="请输入迁出原因"
v-model="dataForm.reason"
>
</el-input>
</el-form-item>
<!-- <el-form-item label=""
prop="welfareFlag">
<el-checkbox v-model="dataForm.welfareFlag">享受福利</el-checkbox>
</el-form-item> -->
</el-form>
</div>
<div class="m-edit-btn">
<el-button size="small" @click="handleCancle"> </el-button>
<el-button
type="primary"
size="small"
class="diy-button--blue"
:disabled="btnDisable"
@click="handleComfirm"
> </el-button
>
</div>
</div>
</template>
<script>
import util from "@js/util.js";
import { Loading } from "element-ui"; // 引入Loading服务
import { requestPost, requestGet } from "@/js/dai/request";
let loading; // 加载动画
export default {
data() {
return {
btnDisable: false,
communityList: [],
buildingList: [],
unitList: [],
roomList: [],
dataForm: {
icUserId: "", // 被调动人ID
type: "in", //操作类型【客户外out,客户内in】
agencyId: "", //调动到的组织Id
gridId: "", //调动到的网格Id
gridName: "",
villageId: "", //调动到的小区ID
villageName: "",
buildId: "", //调动到的楼宇Id
buildName: "",
unitId: "", //调动到的单元Id
unitName: "",
homeId: "", //调动到的房屋Id
homeName: "",
transferTime: "", //调动时间【日期类型】
reason: "", //备注
customerId: "",
oldHome: "",
oldDept: "",
oldAddress: "",
ownerName: "",
name: "",
gender: "",
age: "",
address: "",
outOfTime: "",
welfareFlag: false,
},
customerId: "", //客户id
userId: "", //操作人员id
gridName: "",
rootAgency: {},
casOptions: [],
agencyIdArray: [],
customerList: [],
iscascaderShow: 0,
optionProps: {
multiple: false,
value: "agencyId",
label: "agencyName",
children: "subAgencyList",
// checkStrictly: true
},
selGrid: {},
};
},
components: {},
mounted() {},
computed: {
dataRule() {
return {
type: [
{ required: true, message: "操作类型不能为空", trigger: "blur" },
],
agencyId: [
{ required: true, message: "所选组织不能为空", trigger: "blur" },
],
villageId: [
{ required: true, message: "所属家庭不能为空", trigger: "blur" },
],
address: [
{ required: true, message: "外迁详细地址不能为空", trigger: "blur" },
],
outOfTime: [
{ required: true, message: "迁出时间不能为空", trigger: "blur" },
],
};
},
},
methods: {
async initForm(row) {
this.customerId = localStorage.getItem("customerId");
this.$refs.ref_form.resetFields();
// this.icUserId = row.icResiUserId
this.gridName = row.gridName;
this.dataForm.icUserId = row.resiId;
// 添加参数
if (
row.homeName !== null &&
row.homeName !== "" &&
row.homeName !== undefined
) {
this.dataForm.oldHome = row.homeName;
} else {
this.dataForm.oldHome = "";
}
this.dataForm.customerId = this.customerId;
this.dataForm.idCard = row.idNum;
this.dataForm.mobile = row.mobile;
await this.loadHouseInfo(row.homeId);
this.dataForm.name = row.name;
this.dataForm.gender = row.gender;
this.dataForm.age = "";
await this.loadRootAgency();
await this.getAgencylist();
},
async loadHouseInfo(homeIdValue) {
const url = "/gov/org/ichouse/" + homeIdValue;
const { data, code, msg } = await requestGet(url);
if (code === 0) {
this.dataForm.oldDept = "";
this.dataForm.oldAddress = data.houseName;
this.dataForm.ownerName = data.ownerName;
} else {
this.$message.error(msg);
}
},
//根据人员id获取根组织信息
async loadRootAgency() {
await this.$http
.post("/gov/org/agency/customerrootagency/" + this.customerId)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
if (res.data) {
this.rootAgency = res.data;
}
})
.catch(() => {});
},
async getAgencylist() {
const url = "/gov/org/customeragency/rootagencygridtree";
const params = {
agencyId: this.rootAgency.id,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
++this.iscascaderShow;
this.casOptions = [];
this.agencyIdArray.length = [];
if (data) {
let treeData = [data];
this.resolveAgencyTree(treeData);
this.casOptions.push(data);
}
} else {
this.$message.error(msg);
}
},
resolveAgencyTree(treeData) {
treeData.forEach((element) => {
if (!element.subAgencyList || element.subAgencyList.length === 0) {
//不存在下级,且level=grid的是true
if (element.level === "grid") {
element.disabled = false;
} else {
element.disabled = true;
}
} else {
this.resolveAgencyTree(element.subAgencyList);
}
});
},
handleChangeAgency() {
console.log(this.$refs["myCascader"].getCheckedNodes()[0].data);
this.selGrid = this.$refs["myCascader"].getCheckedNodes()[0].data;
this.dataForm.agencyId = this.selGrid.pid;
this.dataForm.gridId = this.selGrid.agencyId;
this.dataForm.gridName = this.selGrid.agencyName;
this.loadCommunityList();
this.dataForm.villageId = ""; //调动到的小区ID
this.dataForm.villageName = "";
this.dataForm.buildId = ""; //调动到的楼宇Id
this.dataForm.buildName = "";
this.dataForm.unitId = ""; //调动到的单元Id
this.dataForm.unitName = "";
this.dataForm.homeId = ""; //调动到的房屋Id
this.dataForm.homeName = "";
},
async loadCommunityList() {
const url = "/gov/org/icneighborhood/neighborhoodoption";
let params = {
gridId: this.dataForm.gridId,
agencyId: this.dataForm.agencyId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.communityList = [];
this.communityList = [...data];
} else {
this.$message.error(msg);
}
},
async handleChangeCommunity(id) {
// 小区
this.communityList.find((item) => {
if (item.value === id) {
this.dataForm.villageName = item.label;
}
});
const url = "/gov/org/icbuilding/buildingoption";
let params = {
neighborHoodId: this.dataForm.villageId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.buildingList = [];
this.buildingList = [...data];
this.dataForm.buildId = ""; //调动到的楼宇Id
this.dataForm.unitId = ""; //调动到的单元Id
this.dataForm.homeId = ""; //调动到的房屋Id
} else {
this.$message.error(msg);
}
},
async handleChangeBuilding(id) {
// 楼号
this.buildingList.find((item) => {
if (item.value === id) {
this.dataForm.buildName = item.label;
}
});
const url = "/gov/org/icbuildingunit/unitoption";
let params = {
buildingId: this.dataForm.buildId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.unitList = [];
this.unitList = [...data];
this.dataForm.unitId = ""; //调动到的单元Id
this.dataForm.homeId = ""; //调动到的房屋Id
} else {
this.$message.error(msg);
}
},
async handleChangeUnit(id) {
// 单元号
this.unitList.find((item) => {
if (item.value === id) {
this.dataForm.unitName = item.label;
}
});
const url = "/gov/org/ichouse/houseoption";
let params = {
unitId: this.dataForm.unitId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.roomList = [];
this.roomList = [...data];
this.dataForm.homeId = ""; //调动到的房屋Id
} else {
this.$message.error(msg);
}
},
async handleChangeHome(id) {
// 房屋号
this.roomList.find((item) => {
if (item.value === id) {
this.dataForm.homeName = item.label;
}
});
},
async handleComfirm() {
this.btnDisable = true;
setTimeout(() => {
this.btnDisable = false;
}, 2000);
this.$refs["ref_form"].validate((valid, messageObj) => {
if (!valid) {
// app.util.validateRule(messageObj)
console.log("error submit!");
} else {
if (this.dataForm.type === "in") {
if (!this.dataForm.buildId) {
this.$message.warning("楼栋");
return false;
}
if (!this.dataForm.unitId) {
this.$message.warning("请选择单元");
return false;
}
if (!this.dataForm.homeId) {
this.$message.warning("请选择房间");
return false;
}
}
this.saveForm();
}
});
},
async saveForm() {
// saveOutOfInfo
const url = "/epmetuser/changeRelocation/moveOutHome";
let noData = new Date();
noData = util.dateFormatter(noData, "time");
this.dataForm.transferTime = noData;
const { data, code, msg } = await requestPost(url, this.dataForm);
if (code === 0) {
this.$message.success("操作成功");
this.handleCancle();
} else {
this.$message.error(msg);
}
},
// async saveForm () {
// const url = '/epmetuser/icusertransferrecord/add'
// let noData = new Date()
// noData = util.dateFormatter(noData, 'time')
// this.dataForm.transferTime = noData
//
// console.log('-----------3--------------')
// console.log(this.dataForm)
// const { data, code, msg } = await requestPost(url, this.dataForm)
//
// if (code === 0) {
// this.$message.success('调动成功')
// this.handleCancle()
// } else {
// this.$message.error(msg)
// }
// },
handleCancle() {
this.resetData();
this.$emit("dialogCancle");
},
resetData() {
this.dataForm = {
icUserId: "", // 被调动人ID
type: "in", //操作类型【客户外out,客户内in】
agencyId: "", //调动到的组织Id
gridId: "", //调动到的网格Id
villageId: "", //调动到的小区ID
buildId: "", //调动到的楼宇Id
unitId: "", //调动到的单元Id
homeId: "", //调动到的房屋Id
transferTime: "", //调动时间【日期类型】
reason: "", //备注
outOfTime: "",
welfareFlag: false,
};
this.customerId = ""; //客户id
this.userId = ""; //操作人员id
this.gridName = "";
this.rootAgency = {};
this.selGrid = {};
},
// 开启加载动画
startLoading() {
loading = Loading.service({
lock: true, // 是否锁定
text: "正在加载……", // 加载中需要显示的文字
background: "rgba(0,0,0,.7)", // 背景颜色
});
},
// 结束加载动画
endLoading() {
// clearTimeout(timer);
if (loading) {
loading.close();
}
},
},
props: {},
};
</script>
<style lang="scss" scoped>
@import "@/assets/scss/modules/management/edit-main.scss";
</style>