123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665 |
- <template>
- <div class="main">
- <div></div>
- <div class="formContent">
- <div class="formContent-item">
- <div class="formContent-item_title">基础信息</div>
- <div class="formContent-formList">
- <zz-form :cols="formCols" :data="formData" :rules="formRules" :errors="formErrors" labelWidth="70" ref="form">
- <!-- 查看审核 -->
- <template v-if="islooks">
- <template slot="name">{{ formData.name }}</template>
- <template slot="phone">{{ formData.phone }}</template>
- <template slot="personnelNumber">{{ formData.personnelNumber }}</template>
- <template slot="sex" v-if="formData.sex === 0">未知</template>
- <template slot="sex" v-else>{{ formData.sex === 1 ? '男' : '女' }}</template>
- <template slot="remarks">{{ formData.remarks }}</template>
- </template>
- <!-- 添加编辑 -->
- <template v-else>
- <template slot="sex">
- <el-radio v-model="formData.sex" :label="0">未知</el-radio>
- <el-radio v-model="formData.sex" :label="1">男</el-radio>
- <el-radio v-model="formData.sex" :label="2">女</el-radio>
- </template>
- <template slot="remarks">
- <el-input type="textarea" v-model="formData.remark" maxlength="50" placeholder="请输入备注"> </el-input>
- </template>
- </template>
- </zz-form>
- <template>
- <div class="clickUpload">
- <div class="clickUpText">
- <img class="dataImg" v-if="!!formData.facePictureUrl" :src="formData.facePictureUrl" />
- <template v-else>
- <img class="bg-img" src="@/assets/img/ownerManagement/img_zhaopian2@2x.png" alt="" />
- <div>{{ !islooks ? '点击添加人脸照片' : '无人脸图片' }}</div>
- </template>
- </div>
- <el-upload
- v-if="!islooks"
- :headers="token"
- ref="uploaduserlogo"
- class="mini-upload"
- limit="1"
- action="/sc-community/upload/uploadFile"
- :on-success="uploadsuccess"
- :before-upload="beforeAvatarUpload"
- :auto-upload="true"
- name="file"
- >
- </el-upload>
- </div>
- </template>
- </div>
- </div>
- <div class="formContent-item">
- <div class="formContent-item_title">证件信息</div>
- <zz-form :cols="formCols2" :data="formData" :errors="formErrors" labelWidth="70">
- <!-- 查看审核 -->
- <template v-if="islooks">
- <template slot="idType">{{ formData.idType | matchingVal(idTypeArray) }}</template>
- <template slot="idNumber">{{ formData.idNumber }}</template>
- <template slot="permanentAddress">{{ formData.permanentAddress }}</template>
- <template slot="issuingAuthority">{{ formData.issuingAuthority }}</template>
- <template slot="effectiveDate">{{ formData.effectiveDateStart + ' —— ' + formData.effectiveDateStart }}</template>
- <template slot="nationality">{{ formData.nationality | matchingVal(nationalityArray) }}</template>
- <template slot="nativePlace">{{ formData.nativePlace | matchingVal(nativePlaceArray) }}</template>
- <template slot="nation">{{ formData.nation | matchingVal(nationArray) }}</template>
- <template slot="birthDate">{{ formData.birthDate }}</template>
- </template>
- <!-- 添加编辑 -->
- <template v-else>
- <template slot="idType">
- <el-select v-model="formData.idType" clearable class="width100">
- <el-option v-for="(item, index) in idTypeArray" :key="index" :label="item.label" :value="item.status">{{
- item.label
- }}</el-option>
- </el-select>
- </template>
- <template slot="nationality">
- <el-select v-model="formData.nationality" clearable class="width100">
- <el-option
- v-for="(item, index) in nationalityArray"
- :key="index"
- :label="item.label"
- :value="item.status"
- >{{ item.label }}</el-option
- >
- </el-select>
- </template>
- <template slot="nativePlace">
- <el-select v-model="formData.nativePlace" clearable class="width100">
- <el-option v-for="(item, index) in nativePlaceArray" :key="index" :label="item.name" :value="item.code">{{
- item.name
- }}</el-option>
- </el-select>
- </template>
- <template slot="nation">
- <el-select v-model="formData.nation" clearable class="width100">
- <el-option v-for="(item, index) in nationArray" :key="index" :label="item.name" :value="item.code">{{
- item.name
- }}</el-option>
- </el-select>
- </template>
- <template slot="birthDate">
- <el-date-picker
- class="width100"
- v-model="formData.birthDate"
- value-format="yyyy-MM-dd HH:mm:ss"
- type="date"
- :picker-options="pickerOptions"
- placeholder="选择日期"
- >
- </el-date-picker>
- </template>
- <template slot="effectiveDate">
- <el-date-picker
- class="width100"
- v-model="effectiveDate"
- value-format="yyyy-MM-dd HH:mm:ss"
- type="daterange"
- range-separator="至"
- start-placeholder="选择开始日期"
- end-placeholder="选择结束日期"
- @change="effectiveDateToggle"
- :editable="false"
- ></el-date-picker>
- </template>
- </template>
- </zz-form>
- </div>
- <div class="formContent-item">
- <div class="formContent-item_title"><span class="show-required-icon-star"></span> 绑定房产</div>
- <div class="formContent-formList" v-for="(item, index) in formData.houseList" :key="index">
- <div class="block-title">
- <div class="floor list-title">
- {{
- `${item.buildingName} ${item.unitName.indexOf('单元') !== -1 ? item.unitName : item.unitName + '单元'}${
- item.roomNumber
- }`
- }}
- </div>
- <span class="remove list-title" v-if="!islooks" @click="removeHouse(index, 'houseList')">移除</span>
- <img class="bg-img" src="@/assets/img/ownerManagement/bg_card@2x.png" alt="" />
- <img class="bg-imgIoc" src="@/assets/img/ownerManagement/icon_building@2x.png" alt="" />
- </div>
- <zz-form :cols="formCols3" :data="item" :rules="formRules" :errors="formErrors" labelWidth="70">
- <!-- 查看审核 -->
- <template v-if="islooks">
- <template slot="householdType">{{ item.householdType | matchingVal(householdTypeArray) }}</template>
- <template slot="checkInDate">{{ item.checkInDate }}</template>
- </template>
- <!-- 添加编辑 -->
- <template v-else>
- <template slot="householdType">
- <el-select v-model="item.householdType" clearable>
- <el-option
- v-for="(item, index) in householdTypeArray"
- :key="index"
- :label="item.label"
- :value="item.status"
- >{{ item.label }}</el-option
- >
- </el-select>
- </template>
- <template slot="checkInDate">
- <el-date-picker
- v-model="item.checkInDate"
- value-format="yyyy-MM-dd HH:mm:ss"
- type="date"
- placeholder="选择日期"
- >
- </el-date-picker> </template
- ></template>
- </zz-form>
- </div>
- <div class="addHouse add-block" v-if="!islooks" @click="addHouse(1, 'houseList')">
- <img src="@/assets/img/ownerManagement/btn_add@2x.png" />
- </div>
- <div class="formContent-item_title">绑定车位</div>
- <div class="addCat">
- <div class="block-title" v-for="(item, index) in formData.parkingList" :key="index">
- <div class="floor list-title">{{ item.parkingNumber }}</div>
- <span class="remove list-title" v-if="!islooks" @click="removeHouse(index, 'parkingList')">移除</span>
- <img class="bg-img" src="@/assets/img/ownerManagement/bg_card@2x.png" alt="" />
- <img class="bg-imgIoc" src="@/assets/img/ownerManagement/icon_car@2x.png" alt="" />
- </div>
- <div class="addHouse add-block" v-if="!islooks" @click="addHouse(2, 'parkingList')">
- <img src="@/assets/img/ownerManagement/btn_add@2x.png" />
- </div>
- </div>
- </div>
- </div>
- <div class="buttons" v-if="islooks">
- <el-button @click="closes">取消</el-button>
- <el-button type="primary" @click="passOK(2)">审核不通过</el-button>
- <el-button type="primary" @click="passOK(1)">审核通过</el-button>
- </div>
- <div class="buttons" v-else>
- <el-button @click="closes">取消</el-button>
- <el-button type="primary" @click="addEdit()">保存</el-button>
- </div>
- </div>
- </template>
- <script>
- import envConfig from '@/config';
- export default {
- props: {
- params: {
- type: Object
- },
- islook: {
- type: Boolean,
- default: false
- },
- isAdd: {
- type: Boolean,
- default: true
- }
- },
- computed: {
- islooks() {
- if (this.islook) {
- this.lookFormCols('formCols');
- this.lookFormCols('formCols2');
- this.lookFormCols('formCols3');
- }
- return this.islook;
- }
- },
- filters: {
- matchingVal(val, arr) {
- let v = '';
- if (!!val) {
- arr.forEach((item) => {
- if (!!item.status && item.status === val) {
- v = item.label;
- } else if (!!item.code && item.code === val) {
- v = item.name;
- }
- });
- }
- return v;
- }
- },
- data() {
- return {
- envConfig: envConfig,
- token: {
- [localStorage.getItem('SC_token') && 'Authorization']: 'Bearer ' + localStorage.getItem('SC_token')
- },
- pickerOptions: {
- disabledDate(val) {
- // return val.getTime() < Date.now() - 8.64e7;
- return +new Date(val) > +new Date();
- }
- },
- effectiveDate: [],
- formData: {
- name: '',
- phone: '',
- personnelNumber: '',
- sex: 0,
- remarks: '',
- facePictureUrl: '',
- id: 0,
- idType: '',
- idNumber: '',
- permanentAddress: '',
- issuingAuthority: '',
- effectiveDateStart: '',
- effectiveDateEnd: '',
- nationality: 1,
- nativePlace: '',
- nation: '',
- birthDate: '',
- houseList: [],
- parkingList: []
- },
- formCols: [
- [
- {
- label: '姓名',
- prop: 'name',
- slot: 'name',
- input: true
- },
- {
- label: '手机号',
- prop: 'phone',
- slot: 'phone',
- input: true
- },
- {
- label: '人员编号',
- prop: 'personnelNumber',
- slot: 'personnelNumber',
- input: true
- },
- {
- label: '性别',
- prop: 'sex',
- slot: 'sex'
- },
- {
- label: '备注',
- prop: 'remarks',
- slot: 'remarks'
- }
- ]
- ],
- formCols2: [
- [
- {
- label: '证件类型',
- prop: 'idType',
- slot: 'idType'
- },
- {
- label: '证件号码',
- prop: 'idNumber',
- slot: 'idNumber',
- input: true
- },
- {
- label: '户籍地址',
- prop: 'permanentAddress',
- slot: 'permanentAddress',
- input: true
- },
- {
- label: '签发机关',
- prop: 'issuingAuthority',
- slot: 'issuingAuthority',
- input: true
- },
- {
- label: '有效期',
- prop: 'effectiveDate',
- slot: 'effectiveDate'
- },
- {
- label: '国籍',
- prop: 'nationality',
- slot: 'nationality'
- },
- {
- label: '籍贯',
- prop: 'nativePlace',
- slot: 'nativePlace'
- },
- {
- label: '民族',
- prop: 'nation',
- slot: 'nation'
- },
- {
- label: '出生日期',
- prop: 'birthDate',
- slot: 'birthDate'
- }
- ]
- ],
- formCols3: [
- [
- {
- label: '类型',
- prop: 'householdType',
- slot: 'householdType',
- showRequired: true
- },
- {
- label: '入住时间',
- prop: 'checkInDate',
- slot: 'checkInDate'
- }
- ]
- ],
- nationalityArray: [
- {
- status: 1,
- label: '中国'
- },
- {
- status: 2,
- label: '其他'
- }
- ],
- idTypeArray: [
- {
- status: 1,
- label: '居民身份证'
- },
- {
- status: 2,
- label: '居民户口簿'
- },
- {
- status: 3,
- label: '暂住证'
- },
- {
- status: 4,
- label: '其他'
- }
- ],
- householdTypeArray: [
- {
- status: 1,
- label: '业主'
- },
- {
- status: 2,
- label: '亲属'
- },
- {
- status: 3,
- label: '租客'
- }
- ],
- formRules: {
- name: [this.$valid.selectRequired('填写姓名')],
- phone: [this.$valid.selectRequired('填写手机号')],
- householdType: [this.$valid.selectRequired('填写类型')]
- },
- communityArr: [],
- garageArr: []
- };
- },
- created() {
- this.$store.dispatch('collapse', true);
- if (!!this.params.id) {
- this.getDetails(this.params.id);
- }
- this.getTenantsTree();
- },
- beforeDestroy() {
- this.$store.dispatch('collapse', false);
- },
- computed: {
- nationArray() {
- return this.$store.getters['getNationArray'];
- },
- nativePlaceArray() {
- return this.$store.getters['getNativeArray'];
- }
- },
- methods: {
- getDetails(id) {
- let url = '/sc-community/scResident/find/' + id;
- if (this.islooks) {
- url = '/sc-community/scResident/audit/find/' + id;
- }
- this.$http
- .get(url)
- .then(({ data, status, msg }) => {
- if (0 === status) {
- let { effectiveDateStart, effectiveDateEnd } = data;
- if (effectiveDateStart == null || effectiveDateEnd == null) {
- effectiveDateStart = '';
- effectiveDateEnd = '';
- }
- this.effectiveDate = [effectiveDateStart, effectiveDateEnd];
- this.formData = data;
- } else {
- this.$message.error(msg);
- }
- })
- .catch(() => {});
- },
- lookFormCols(cols) {
- this[cols][0].forEach((item, index) => {
- if (!!item.input) {
- item.input = false;
- }
- });
- },
- uploadsuccess(response, file, fileList) {
- this.$refs.uploaduserlogo.clearFiles();
- if (0 === response.status) {
- this.formData.facePictureUrl = response.data;
- }
- },
- beforeAvatarUpload(file) {
- const isJPG = file.type === 'image/jpeg';
- const isLt2M = file.size / 1024 / 1024 < 2;
- if (!isJPG) {
- this.$message.error('上传头像图片只能是 JPG 格式!');
- }
- if (!isLt2M) {
- this.$message.error('上传头像图片大小不能超过 2MB!');
- }
- return isJPG && isLt2M;
- },
- effectiveDateToggle(va) {
- let arr = va;
- if (!arr) {
- arr = ['', ''];
- }
- this.formData.effectiveDateStart = arr[0];
- this.formData.effectiveDateEnd = arr[1];
- },
- addHouse(num, arr) {
- new Promise((resolve) => {
- let title = '',
- tenantsTree,
- list;
- if (num === 1) {
- title = '选择房产';
- tenantsTree = this.communityArr;
- list = this.formData.houseList;
- } else {
- title = '选择车位';
- tenantsTree = this.garageArr;
- list = this.formData.parkingList;
- }
- this.$store.dispatch('addPopup', {
- url: '/ownerManagement/stepPage/poptreeSelect.vue',
- width: '500px',
- height: '400px',
- props: {
- num,
- list,
- tenantsTree,
- callback: resolve
- },
- title: title,
- notip: true
- });
- }).then((res) => {
- debugger;
- if (res.length > 0) {
- res.forEach((item, index) => {
- let newObj = {};
- if (num === 1) {
- newObj = {
- checkInDate: '',
- householdType: 1,
- buildingName: item.buildingName,
- unitName: item.unitName,
- roomNumber: item.roomNumber,
- houseId: item.houseId
- };
- let isExit = this.formData[arr].some((is) => {
- return is.houseId == item.houseId;
- });
- if (!isExit) {
- this.formData[arr].push(newObj);
- }
- } else {
- newObj = {
- parkingId: item.parkingId,
- parkingNumber: item.parkingNumber
- };
- let isExit = this.formData[arr].some((is) => {
- return is.parkingId == item.parkingId;
- });
- if (!isExit) {
- this.formData[arr].push(newObj);
- }
- }
- });
- }
- });
- },
- removeHouse(index, arr) {
- this.formData[arr].splice(index, 1);
- },
- closes() {
- this.$emit('clerOwnerStatus');
- },
- close() {
- let activeRout = this.$route;
- let tagsList = this.$store.getters['getTagsList'];
- tagsList.forEach((item, index) => {
- if (item.title == activeRout.meta.title || item.path == activeRout.path) {
- tagsList.splice(index, 1);
- history.go(-1);
- return true;
- }
- });
- },
- addEdit() {
- let _this = this;
- if (this.formData.houseList.length === 0) {
- this.$message.error('房产必须绑定');
- return;
- }
- new Promise((resolve) => {
- this.$refs.form.validate(resolve);
- })
- .then(() => {
- let url = '/sc-community/scResident/add';
- let params = this.formData;
- if (!_this.isAdd) {
- url = '/sc-community/scResident/update';
- }
- this.$http
- .post(url, params)
- .then(({ status, msg }) => {
- if (status == 0) {
- this.$message.success(msg);
- this.closes();
- } else {
- this.$message.error(msg);
- }
- })
- .catch(() => {});
- })
- .catch(() => {});
- },
- passOK(status) {
- this.$http
- .get('/sc-community/scResident/audit', { id: this.params.id, auditStatus: status })
- .then(({ status, msg }) => {
- if (0 === status) {
- this.$message.success(msg);
- this.closes();
- } else {
- this.$message.error(msg);
- }
- })
- .catch(() => {});
- },
- getTenantsTree() {
- this.$http.get('/sc-community/assets/tree/community/find').then(({ status, data, msg }) => {
- if (status === 0 && data) {
- this.dimension(data);
- this.communityArr = data;
- }
- });
- this.$http.get('/sc-community/assets/tree/garage/find').then(({ status, data, msg }) => {
- if (status === 0 && data) {
- this.garageArr = data;
- }
- });
- },
- dimension(arr) {
- arr.map((item, index) => {
- if (!!item.children & (item.type !== 'unit')) {
- this.dimension(item.children);
- } else {
- if (item.name.indexOf('单元') === -1) {
- item.name = item.name + '单元';
- }
- }
- });
- }
- }
- };
- </script>
- <style lang='scss' scoped >
- @import '../style.scss';
- </style>
|