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.
		
		
		
		
		
			
		
			
				
					
					
						
							935 lines
						
					
					
						
							27 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							935 lines
						
					
					
						
							27 KiB
						
					
					
				
								<template>
							 | 
						|
								  <div v-if="pageLoading" class="resi-container">
							 | 
						|
								    <resi-search
							 | 
						|
								      v-if="searchList.length > 0"
							 | 
						|
								      ref="resiSearch"
							 | 
						|
								      :form-list="searchList"
							 | 
						|
								      @search="handleSearch"
							 | 
						|
								    />
							 | 
						|
								    <el-card class="resi-card-table">
							 | 
						|
								      <div class="resi-row-btn">
							 | 
						|
								        <el-button type="success" size="small" @click="handleAdd">新增</el-button>
							 | 
						|
								        <el-button type="warning" size="small" @click="handleExport">导出</el-button>
							 | 
						|
								        <!-- <el-button type="primary" size="small">下载人口模板</el-button> -->
							 | 
						|
								        <el-upload
							 | 
						|
								          ref="upload"
							 | 
						|
								          class="upload-demo"
							 | 
						|
								          action="uploadUlr"
							 | 
						|
								          :limit="1"
							 | 
						|
								          :with-credentials="true"
							 | 
						|
								          :show-file-list="false"
							 | 
						|
								          :auto-upload="true"
							 | 
						|
								          :on-progress="handleProgress"
							 | 
						|
								          :on-success="handleExcelSuccess"
							 | 
						|
								          :before-upload="beforeExcelUpload"
							 | 
						|
								          :http-request="uploadHttpRequest"
							 | 
						|
								          >
							 | 
						|
								          <el-button type="danger" size="small" :loading="importLoading">{{importBtnTitle}}</el-button>
							 | 
						|
								        </el-upload>
							 | 
						|
								        
							 | 
						|
								      </div>
							 | 
						|
								      <el-table
							 | 
						|
								        :data="tableData"
							 | 
						|
								        v-loading="tableLoading"
							 | 
						|
								        border
							 | 
						|
								        style="width: 100%"
							 | 
						|
								        class="resi-table"
							 | 
						|
								      >
							 | 
						|
								        <el-table-column label="序号" type="index" align="center" width="50">
							 | 
						|
								        </el-table-column>
							 | 
						|
								        <el-table-column
							 | 
						|
								          v-for="item in tableHeader"
							 | 
						|
								          :key="item.columnName"
							 | 
						|
								          :prop="item.columnName"
							 | 
						|
								          :label="item.label"
							 | 
						|
								          align="center"
							 | 
						|
								          :show-overflow-tooltip="true"
							 | 
						|
								          :width="item.itemType === 'radio' ? computedWidth(item.label) : 180"
							 | 
						|
								        >
							 | 
						|
								          <template slot-scope="scope">
							 | 
						|
								            <span>{{ handleFilterSpan(scope.row, item) }}</span>
							 | 
						|
								          </template>
							 | 
						|
								        </el-table-column>
							 | 
						|
								        <el-table-column fixed="right" label="操作" align="center" width="120">
							 | 
						|
								          <template slot-scope="scope">
							 | 
						|
								            <el-button
							 | 
						|
								              @click="handleLook(scope.row)"
							 | 
						|
								              type="text"
							 | 
						|
								              size="small"
							 | 
						|
								              class="btn-color-look"
							 | 
						|
								              >查看</el-button
							 | 
						|
								            >
							 | 
						|
								            <template v-if="filterEdit(scope.row.ORG_ID)">
							 | 
						|
								              <el-button
							 | 
						|
								                @click="handleEdit(scope.row)"
							 | 
						|
								                type="text"
							 | 
						|
								                size="small"
							 | 
						|
								                class="btn-color-edit"
							 | 
						|
								                >编辑</el-button
							 | 
						|
								              >
							 | 
						|
								              <el-popconfirm
							 | 
						|
								                title="删除之后无法回复,确认删除?"
							 | 
						|
								                @onConfirm="handleDel(scope.row)"
							 | 
						|
								              >
							 | 
						|
								                <el-button
							 | 
						|
								                  slot="reference"
							 | 
						|
								                  type="text"
							 | 
						|
								                  size="small"
							 | 
						|
								                  class="btn-color-del"
							 | 
						|
								                  >删除</el-button
							 | 
						|
								                >
							 | 
						|
								              </el-popconfirm>
							 | 
						|
								            </template>
							 | 
						|
								          </template>
							 | 
						|
								        </el-table-column>
							 | 
						|
								      </el-table>
							 | 
						|
								      <div>
							 | 
						|
								        <el-pagination
							 | 
						|
								          @size-change="handleSizeChange"
							 | 
						|
								          @current-change="handleCurrentChange"
							 | 
						|
								          :current-page.sync="currentPage"
							 | 
						|
								          :page-sizes="[20, 50, 100, 200]"
							 | 
						|
								          :page-size="pageSize"
							 | 
						|
								          layout="sizes, prev, pager, next"
							 | 
						|
								          :total="total"
							 | 
						|
								        >
							 | 
						|
								        </el-pagination>
							 | 
						|
								      </div>
							 | 
						|
								    </el-card>
							 | 
						|
								
							 | 
						|
								    <el-dialog
							 | 
						|
								      :title="formName"
							 | 
						|
								      :visible.sync="dialogVisible"
							 | 
						|
								      width="80%"
							 | 
						|
								      append-to-body
							 | 
						|
								      :close-on-click-modal="false"
							 | 
						|
								      :before-close="handlerCancle"
							 | 
						|
								    >
							 | 
						|
								      <resi-form
							 | 
						|
								        v-if="dialogVisible"
							 | 
						|
								        ref="baseForm"
							 | 
						|
								        :fixed="true"
							 | 
						|
								        :form-list="formList"
							 | 
						|
								        @changegroup="handleChangeGroup"
							 | 
						|
								      />
							 | 
						|
								      <div v-if="dialogVisible" class="resi-other">
							 | 
						|
								        <div class="resi-other-title">其他</div>
							 | 
						|
								        <div class="tabs-other-info">
							 | 
						|
								          <el-tabs v-model="activeName" @tab-click="handleClick">
							 | 
						|
								            <el-tab-pane
							 | 
						|
								              v-for="item in tabsList"
							 | 
						|
								              :key="item.columnName"
							 | 
						|
								              :label="item.label"
							 | 
						|
								              :name="'group' + item.groupId"
							 | 
						|
								            >
							 | 
						|
								              <resi-form
							 | 
						|
								                :ref="'group' + item.groupId"
							 | 
						|
								                :columns="3"
							 | 
						|
								                :support-add="item.supportAdd"
							 | 
						|
								                :form-id="item.columnName"
							 | 
						|
								                :form-list="item.itemList"
							 | 
						|
								              />
							 | 
						|
								            </el-tab-pane>
							 | 
						|
								          </el-tabs>
							 | 
						|
								        </div>
							 | 
						|
								      </div>
							 | 
						|
								      <div class="resi-btns">
							 | 
						|
								        <el-button size="small" @click="handlerCancle">取消</el-button>
							 | 
						|
								        <el-button
							 | 
						|
								          type="primary"
							 | 
						|
								          size="small"
							 | 
						|
								          :loading="btnLoading"
							 | 
						|
								          @click="handleSUbmit"
							 | 
						|
								          >提交</el-button
							 | 
						|
								        >
							 | 
						|
								      </div>
							 | 
						|
								    </el-dialog>
							 | 
						|
								
							 | 
						|
								    <el-dialog
							 | 
						|
								      :title="formName"
							 | 
						|
								      :visible.sync="dialogEditVisible"
							 | 
						|
								      width="80%"
							 | 
						|
								      append-to-body
							 | 
						|
								      :close-on-click-modal="false"
							 | 
						|
								      :before-close="handlerEditCancle"
							 | 
						|
								    >
							 | 
						|
								      <edit-resi
							 | 
						|
								        v-if="dialogEditVisible"
							 | 
						|
								        ref="baseForm"
							 | 
						|
								        :disabled="disabled"
							 | 
						|
								        :form-info="editForm"
							 | 
						|
								        :fixed="true"
							 | 
						|
								        :form-list="formList"
							 | 
						|
								        :agency-id="editAgencyId"
							 | 
						|
								        @changegroup="handleChangeGroup"
							 | 
						|
								      />
							 | 
						|
								      <div v-if="dialogEditVisible" class="resi-other">
							 | 
						|
								        <div class="resi-other-title">其他</div>
							 | 
						|
								        <div class="tabs-other-info">
							 | 
						|
								          <el-tabs v-model="activeName" @tab-click="handleClick">
							 | 
						|
								            <el-tab-pane
							 | 
						|
								              v-for="item in tabsList"
							 | 
						|
								              :key="item.columnName"
							 | 
						|
								              :label="item.label"
							 | 
						|
								              :name="'group' + item.groupId"
							 | 
						|
								            >
							 | 
						|
								              <edit-resi
							 | 
						|
								                :ref="'group' + item.groupId"
							 | 
						|
								                :columns="3"
							 | 
						|
								                :support-add="item.supportAdd"
							 | 
						|
								                :form-id="item.columnName"
							 | 
						|
								                :muti-list="item.mutiList"
							 | 
						|
								                :form-list="item.itemList"
							 | 
						|
								                :disabled="disabled"
							 | 
						|
								                :label-width="'140px'"
							 | 
						|
								                :agency-id="editAgencyId"
							 | 
						|
								              />
							 | 
						|
								            </el-tab-pane>
							 | 
						|
								          </el-tabs>
							 | 
						|
								        </div>
							 | 
						|
								      </div>
							 | 
						|
								      <div class="resi-btns">
							 | 
						|
								        <el-button size="small" @click="handlerEditCancle">取消</el-button>
							 | 
						|
								        <el-button
							 | 
						|
								          v-if="!disabled"
							 | 
						|
								          type="primary"
							 | 
						|
								          size="small"
							 | 
						|
								          :loading="btnLoading"
							 | 
						|
								          @click="handleEditSUbmit"
							 | 
						|
								          >提交</el-button
							 | 
						|
								        >
							 | 
						|
								      </div>
							 | 
						|
								    </el-dialog>
							 | 
						|
								  </div>
							 | 
						|
								</template>
							 | 
						|
								
							 | 
						|
								<script>
							 | 
						|
								import resiSearch from '../../components/resiSearch.vue'
							 | 
						|
								import resiForm from '../../components/resiForm.vue'
							 | 
						|
								import editResi from '../../components/editResi.vue'
							 | 
						|
								import axios from 'axios'
							 | 
						|
								export default {
							 | 
						|
								  components: {
							 | 
						|
								    resiSearch,
							 | 
						|
								    resiForm,
							 | 
						|
								    editResi
							 | 
						|
								  },
							 | 
						|
								  data() {
							 | 
						|
								    return {
							 | 
						|
								      importBtnTitle: '导入人员数据',
							 | 
						|
								      importLoading: false,
							 | 
						|
								      rowVisible: false,
							 | 
						|
								      tableLoading: false,
							 | 
						|
								      btnLoading: false,
							 | 
						|
								      disabled: false,
							 | 
						|
								      pageLoading: false,
							 | 
						|
								      dialogEditVisible: false,
							 | 
						|
								      dialogVisible: false,
							 | 
						|
								      uploadUlr: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/importExcel',
							 | 
						|
								      currentPage: 1,
							 | 
						|
								      pageSize: 20,
							 | 
						|
								      total: null,
							 | 
						|
								      conditions: [],
							 | 
						|
								      activeName: '',
							 | 
						|
								      tableData: [],
							 | 
						|
								      searchList: [],
							 | 
						|
								      editAgencyId: '',
							 | 
						|
								      editForm: {
							 | 
						|
								        GRID_ID: '',
							 | 
						|
								        VILLAGE_ID: '',
							 | 
						|
								        BUILD_ID: '',
							 | 
						|
								        HOME_ID: ''
							 | 
						|
								      },
							 | 
						|
								      editTableName: {},
							 | 
						|
								      formName: '',
							 | 
						|
								      formList: [],
							 | 
						|
								      tableHeader: [],
							 | 
						|
								      tabsList: []
							 | 
						|
								    }
							 | 
						|
								  },
							 | 
						|
								  async created() {
							 | 
						|
								    await this.getSearchList()
							 | 
						|
								    // await this.getFormList()
							 | 
						|
								    await this.getTableHeader()
							 | 
						|
								    this.getTableData()
							 | 
						|
								    this.pageLoading = true
							 | 
						|
								    console.log('storeoooo----0000', this.$store)
							 | 
						|
								  },
							 | 
						|
								  methods: {
							 | 
						|
								    computedWidth(label) {
							 | 
						|
								      const wd = 20 * label.length
							 | 
						|
								      return wd > 80 ? wd : 80
							 | 
						|
								    },
							 | 
						|
								    filterEdit(id) {
							 | 
						|
								      const { user } = this.$store.state
							 | 
						|
								      return id === user.agencyId
							 | 
						|
								    },
							 | 
						|
								    handleSizeChange(val) {
							 | 
						|
								      console.log(`每页 ${val} 条`)
							 | 
						|
								      this.pageSize = val
							 | 
						|
								      this.getTableData()
							 | 
						|
								    },
							 | 
						|
								    handleCurrentChange(val) {
							 | 
						|
								      console.log(`当前页: ${val}`)
							 | 
						|
								      this.currentPage = val
							 | 
						|
								      this.getTableData()
							 | 
						|
								    },
							 | 
						|
								    handleFilterSpan(row, item) {
							 | 
						|
								      let _val = ''
							 | 
						|
								      if (item.itemType === 'radio' && item.options.length > 0) {
							 | 
						|
								        item.options.forEach((n) => {
							 | 
						|
								          if (n.value === row[item.columnName]) _val = n.label
							 | 
						|
								        })
							 | 
						|
								      }
							 | 
						|
								      return _val || row[item.columnName]
							 | 
						|
								    },
							 | 
						|
								    handleSearch(val) {
							 | 
						|
								      console.log('searchhh--', val)
							 | 
						|
								      this.currentPage = 1
							 | 
						|
								      this.conditions = val
							 | 
						|
								      this.getTableData()
							 | 
						|
								    },
							 | 
						|
								    // 下载文件
							 | 
						|
								    download(data, fileName) {
							 | 
						|
								      console.log('data', data)
							 | 
						|
								      if (!data) {
							 | 
						|
								        return
							 | 
						|
								      }
							 | 
						|
								
							 | 
						|
								      var csvData = new Blob([data])
							 | 
						|
								
							 | 
						|
								      if (window.navigator && window.navigator.msSaveOrOpenBlob) {
							 | 
						|
								        window.navigator.msSaveOrOpenBlob(csvData, fileName)
							 | 
						|
								      }
							 | 
						|
								      // for Non-IE (chrome, firefox etc.)
							 | 
						|
								      else {
							 | 
						|
								        var a = document.createElement('a')
							 | 
						|
								        document.body.appendChild(a)
							 | 
						|
								        a.style = 'display: none'
							 | 
						|
								        var url = window.URL.createObjectURL(csvData)
							 | 
						|
								        a.href = url
							 | 
						|
								        a.download = fileName
							 | 
						|
								        a.click()
							 | 
						|
								        a.remove()
							 | 
						|
								        window.URL.revokeObjectURL(url)
							 | 
						|
								      }
							 | 
						|
								    },
							 | 
						|
								    handleExport() {
							 | 
						|
								      let params = {
							 | 
						|
								        formCode: 'resi_base_info',
							 | 
						|
								        conditions: this.conditions
							 | 
						|
								      }
							 | 
						|
								
							 | 
						|
								      // .post('epmetuser/icresiuser/exportExcel', params)
							 | 
						|
								      axios({
							 | 
						|
								        url: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/exportExcel',
							 | 
						|
								        // url: 'epmetuser/icresiuser/exportExcel',
							 | 
						|
								        method: 'post',
							 | 
						|
								        data: params,
							 | 
						|
								        responseType: 'blob'
							 | 
						|
								      })
							 | 
						|
								        .then(res => {
							 | 
						|
								          console.log('resllll', res)
							 | 
						|
								          let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
							 | 
						|
								          console.log('filename', fileName)
							 | 
						|
								          let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
							 | 
						|
								          var url = window.URL.createObjectURL(blob)
							 | 
						|
								          var aLink = document.createElement('a')
							 | 
						|
								          aLink.style.display = 'none'
							 | 
						|
								          aLink.href = url
							 | 
						|
								          aLink.setAttribute('download', fileName)
							 | 
						|
								          document.body.appendChild(aLink)
							 | 
						|
								          aLink.click()
							 | 
						|
								          document.body.removeChild(aLink) //下载完成移除元素
							 | 
						|
								          window.URL.revokeObjectURL(url) //释放掉blob对象
							 | 
						|
								        })
							 | 
						|
								        .catch((err) => {
							 | 
						|
								          console.log('获取导出情失败', err)
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								    // 上传大图标成功
							 | 
						|
								    handleExcelSuccess (res, file) {
							 | 
						|
								      if (res.code === 0 && res.msg === 'success') {
							 | 
						|
								
							 | 
						|
								        console.log('resss---ppp', res)
							 | 
						|
								
							 | 
						|
								      } else {
							 | 
						|
								        this.$message.error(res.msg)
							 | 
						|
								      }
							 | 
						|
								    },
							 | 
						|
								    handleProgress(event, file, fileList) {
							 | 
						|
								      console.log('percentage', file.percentage)
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    beforeExcelUpload (file) {
							 | 
						|
								      console.log('file', file)
							 | 
						|
								      const isType = file.type === 'application/vnd.ms-excel'
							 | 
						|
								      const isTypeComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
							 | 
						|
								      const fileType = isType || isTypeComputer
							 | 
						|
								      const isLt1M = (file.size / 1024 / 1024) < 10
							 | 
						|
								      if(!fileType) {
							 | 
						|
								          this.$message.error('上传文件只能是xls/xlsx格式!')
							 | 
						|
								      }
							 | 
						|
								      
							 | 
						|
								      if (!isLt1M) {
							 | 
						|
								        this.$message.error('上传图片大小不能超过 10MB!')
							 | 
						|
								      }
							 | 
						|
								      return fileType && isLt1M
							 | 
						|
								    },
							 | 
						|
								    uploadHttpRequest(file) {
							 | 
						|
								      this.importLoading = true
							 | 
						|
								      this.importBtnTitle = '正在上传中...'
							 | 
						|
								      const formData = new FormData() //FormData对象,添加参数只能通过append('key', value)的形式添加
							 | 
						|
								      formData.append('file', file.file) //添加文件对象
							 | 
						|
								      axios({
							 | 
						|
								        url: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/importExcel',
							 | 
						|
								        method: 'post',
							 | 
						|
								        data: formData,
							 | 
						|
								        responseType: 'blob'
							 | 
						|
								      })
							 | 
						|
								      .then((res) => {
							 | 
						|
								        this.importLoading = false
							 | 
						|
								        this.importBtnTitle = '导入人员数据'
							 | 
						|
								        let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
							 | 
						|
								          console.log('filename', fileName)
							 | 
						|
								        let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
							 | 
						|
								        var url = window.URL.createObjectURL(blob)
							 | 
						|
								        var aLink = document.createElement('a')
							 | 
						|
								        aLink.style.display = 'none'
							 | 
						|
								        aLink.href = url
							 | 
						|
								        aLink.setAttribute('download', fileName)
							 | 
						|
								        document.body.appendChild(aLink)
							 | 
						|
								        aLink.click()
							 | 
						|
								        document.body.removeChild(aLink) //下载完成移除元素
							 | 
						|
								        window.URL.revokeObjectURL(url) //释放掉blob对象
							 | 
						|
								        this.getTableData()
							 | 
						|
								      })
							 | 
						|
								      .catch( err => {
							 | 
						|
								          console.log('失败', err)
							 | 
						|
								          param.onError() //上传失败的文件会从文件列表中删除
							 | 
						|
								      })
							 | 
						|
								    },
							 | 
						|
								    handleClick(tab, event) {
							 | 
						|
								      console.log(tab, event)
							 | 
						|
								    },
							 | 
						|
								    async handleLook(row) {
							 | 
						|
								      this.disabled = true
							 | 
						|
								      this.editAgencyId = row.ORG_ID
							 | 
						|
								      await this.getFormList('edit')
							 | 
						|
								      this.getrowInfo(row.icResiUserId)
							 | 
						|
								    },
							 | 
						|
								    async handleEdit(row) {
							 | 
						|
								      this.disabled = false
							 | 
						|
								      this.editAgencyId = row.ORG_ID
							 | 
						|
								      await this.getFormList('edit')
							 | 
						|
								      await this.getrowInfo(row.icResiUserId)
							 | 
						|
								    },
							 | 
						|
								    async handleAdd() {
							 | 
						|
								      await this.getFormList()
							 | 
						|
								      this.dialogVisible = true
							 | 
						|
								    },
							 | 
						|
								    async handleChangeGroup(val) {
							 | 
						|
								      console.log('changeguoprrrrr----', val)
							 | 
						|
								      let { childGroup, value } = val
							 | 
						|
								      let hasT = false
							 | 
						|
								      let i = 0
							 | 
						|
								      // const list = { ...this.tabsList }
							 | 
						|
								      this.tabsList.forEach((item, index) => {
							 | 
						|
								        if (item.tableName === childGroup.tableName) {
							 | 
						|
								          hasT = true
							 | 
						|
								          i = index
							 | 
						|
								        }
							 | 
						|
								      })
							 | 
						|
								      if (value === 1 || value === '1') {
							 | 
						|
								        // console.log('changegroup----999', value)
							 | 
						|
								        if (!hasT) {
							 | 
						|
								          childGroup.itemList.forEach(async (item) => {
							 | 
						|
								            if (item.optionSourceType === 'remote') {
							 | 
						|
								              await this.getOptionsList(item.optionSourceValue).then((res) => {
							 | 
						|
								                item.options = res
							 | 
						|
								              })
							 | 
						|
								              // console.log('')
							 | 
						|
								            }
							 | 
						|
								          })
							 | 
						|
								          this.tabsList.push(childGroup)
							 | 
						|
								        }
							 | 
						|
								      } else {
							 | 
						|
								        // console.log('changegroup----000', value)
							 | 
						|
								        if (hasT) this.tabsList.splice(i, 1)
							 | 
						|
								      }
							 | 
						|
								    },
							 | 
						|
								    formetForm() {
							 | 
						|
								      const _baseForm = this.$refs.baseForm.handleForm()
							 | 
						|
								      let arr = []
							 | 
						|
								      if (_baseForm.length === 0) return false
							 | 
						|
								      arr.push([..._baseForm])
							 | 
						|
								      this.tabsList.forEach((item) => {
							 | 
						|
								        arr.push([...this.$refs['group' + item.groupId][0].handleForm()])
							 | 
						|
								      })
							 | 
						|
								      let arr2 = arr.reduce(function (a, b) {
							 | 
						|
								        return a.concat(b)
							 | 
						|
								      })
							 | 
						|
								      let noChange = true
							 | 
						|
								      arr2.forEach((item) => {
							 | 
						|
								        if (item.list.length !== 0) noChange = false
							 | 
						|
								      })
							 | 
						|
								      console.log('arr2', arr2)
							 | 
						|
								      if (noChange) {
							 | 
						|
								        this.$message.warning('您还没有做任何修改')
							 | 
						|
								        return false
							 | 
						|
								      }
							 | 
						|
								      // 合并相同tableName的多个数组
							 | 
						|
								      let hash = {}
							 | 
						|
								      let i = 0
							 | 
						|
								      let res = []
							 | 
						|
								      let finalArr = []
							 | 
						|
								      arr2.forEach(function (item) {
							 | 
						|
								        let name = item.tableName
							 | 
						|
								        if (hash[name]) {
							 | 
						|
								          res[hash[name] - 1].list.push(...item.list)
							 | 
						|
								        } else {
							 | 
						|
								          hash[name] = ++i
							 | 
						|
								          res.push({
							 | 
						|
								            list: [...item.list],
							 | 
						|
								            supportAdd: item.supportAdd,
							 | 
						|
								            tableName: name
							 | 
						|
								          })
							 | 
						|
								        }
							 | 
						|
								      })
							 | 
						|
								      console.log('res', res)
							 | 
						|
								      // 多个list合并成一个list子集
							 | 
						|
								      res.forEach((item) => {
							 | 
						|
								        let _form = {}
							 | 
						|
								        item.list.length > 0 &&
							 | 
						|
								          item.list.forEach((n) => {
							 | 
						|
								            _form = { ..._form, ...n }
							 | 
						|
								          })
							 | 
						|
								        if (item.list.length > 0) {
							 | 
						|
								          finalArr.push({
							 | 
						|
								            tableName: item.tableName,
							 | 
						|
								            list: item.supportAdd ? [...item.list] : [{ ..._form }]
							 | 
						|
								          })
							 | 
						|
								        }
							 | 
						|
								      })
							 | 
						|
								      console.log('finalArr', finalArr)
							 | 
						|
								      return finalArr
							 | 
						|
								    },
							 | 
						|
								    async handleEditSUbmit() {
							 | 
						|
								      const arr = await this.formetForm()
							 | 
						|
								      if (arr) this.submitEdit(arr)
							 | 
						|
								    },
							 | 
						|
								    async handleSUbmit() {
							 | 
						|
								      const arr = await this.formetForm()
							 | 
						|
								      if (arr) this.submitAdd(arr)
							 | 
						|
								    },
							 | 
						|
								    handleDel(row) {
							 | 
						|
								      let params = {
							 | 
						|
								        formCode: 'resi_base_info',
							 | 
						|
								        icResiUserId: row.icResiUserId
							 | 
						|
								      }
							 | 
						|
								      console.log('row1', row)
							 | 
						|
								      this.$http
							 | 
						|
								        .post('/epmetuser/icresiuser/delete', params)
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          console.log('row2', row)
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            console.log('row3', row)
							 | 
						|
								            this.$message.success('删除成功')
							 | 
						|
								            this.getTableData()
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch((err) => {
							 | 
						|
								          console.log('row4', err)
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								    handleFormatUrl(url) {
							 | 
						|
								      return url.includes('?')
							 | 
						|
								    },
							 | 
						|
								    handlerEditCancle() {
							 | 
						|
								      this.$refs.baseForm.resetForm()
							 | 
						|
								      this.tabsList.forEach((item) => {
							 | 
						|
								        this.$refs['group' + item.groupId][0].resetForm()
							 | 
						|
								      })
							 | 
						|
								      this.dialogEditVisible = false
							 | 
						|
								    },
							 | 
						|
								    handlerCancle() {
							 | 
						|
								      this.$refs.baseForm.resetForm()
							 | 
						|
								      this.tabsList.forEach((item) => {
							 | 
						|
								        this.$refs['group' + item.groupId][0].resetForm()
							 | 
						|
								      })
							 | 
						|
								      this.dialogVisible = false
							 | 
						|
								    },
							 | 
						|
								    async submitAdd(arr) {
							 | 
						|
								      this.btnLoading = true
							 | 
						|
								      await this.$http
							 | 
						|
								        .post('/epmetuser/icresiuser/add', arr)
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            this.$message.success('提交成功')
							 | 
						|
								            // this.$refs[formName].resetFields();
							 | 
						|
								            this.$refs.baseForm.resetForm()
							 | 
						|
								            this.tabsList.forEach((item) => {
							 | 
						|
								              this.$refs['group' + item.groupId][0].resetForm()
							 | 
						|
								            })
							 | 
						|
								            this.getTableData()
							 | 
						|
								            this.dialogVisible = false
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch(() => {
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								      this.btnLoading = false
							 | 
						|
								    },
							 | 
						|
								    async submitEdit(arr) {
							 | 
						|
								      this.btnLoading = true
							 | 
						|
								      await this.$http
							 | 
						|
								        .post('/epmetuser/icresiuser/edit', arr)
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            this.$message.success('提交成功')
							 | 
						|
								            // this.$refs[formName].resetFields();
							 | 
						|
								            this.$refs.baseForm.resetForm()
							 | 
						|
								            this.tabsList.forEach((item) => {
							 | 
						|
								              this.$refs['group' + item.groupId][0].resetForm()
							 | 
						|
								            })
							 | 
						|
								            this.getTableData()
							 | 
						|
								            this.dialogEditVisible = false
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch(() => {
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								      this.btnLoading = false
							 | 
						|
								    },
							 | 
						|
								    getTableHeader() {
							 | 
						|
								      this.$http
							 | 
						|
								        .post('/oper/customize/icform/tableheaders', {
							 | 
						|
								          formCode: 'resi_base_info'
							 | 
						|
								        })
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            this.tableHeader = res.data
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch(() => {
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								    async getTableData() {
							 | 
						|
								      this.tableLoading = true
							 | 
						|
								      let params = {
							 | 
						|
								        formCode: 'resi_base_info',
							 | 
						|
								        pageNo: this.currentPage,
							 | 
						|
								        pageSize: this.pageSize,
							 | 
						|
								        conditions: this.conditions
							 | 
						|
								      }
							 | 
						|
								      await this.$http
							 | 
						|
								        .post('/epmetuser/icresiuser/listresi', params)
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            this.tableData = res.data.list
							 | 
						|
								            this.total = res.data.total
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch(() => {
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								      this.tableLoading = false
							 | 
						|
								    },
							 | 
						|
								    getrowInfo(id) {
							 | 
						|
								      let params = {
							 | 
						|
								        formCode: 'resi_base_info',
							 | 
						|
								        icResiUserId: id
							 | 
						|
								      }
							 | 
						|
								      this.$http
							 | 
						|
								        .post('/epmetuser/icresiuser/detail', params)
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            // console.log('getrowInfo----', res.data)
							 | 
						|
								            let info = res.data
							 | 
						|
								            this.editTableName = { ...info }
							 | 
						|
								            let list = info[this.formList[0].tableName][0]
							 | 
						|
								            for (let n in list) {
							 | 
						|
								              this.editForm[n] = list[n]
							 | 
						|
								            }
							 | 
						|
								            this.formList.forEach((item) => {
							 | 
						|
								              item.columnValue = list[item.columnName]
							 | 
						|
								              item.ID = list.ID
							 | 
						|
								
							 | 
						|
								              if (
							 | 
						|
								                item.columnValue == '1' &&
							 | 
						|
								                item.itemType === 'radio' &&
							 | 
						|
								                item.childGroup
							 | 
						|
								              ) {
							 | 
						|
								                this.tabsList.push(item.childGroup)
							 | 
						|
								              }
							 | 
						|
								
							 | 
						|
								              // if (item.childGroup && info[item.childGroup.tableName]) {
							 | 
						|
								
							 | 
						|
								              // }
							 | 
						|
								            })
							 | 
						|
								            this.tabsList.forEach((item) => {
							 | 
						|
								              let _info = info[item.tableName]
							 | 
						|
								              if (item.supportAdd) {
							 | 
						|
								                // console.log('tabsList---333', item.label)
							 | 
						|
								                const _list = [...item.itemList]
							 | 
						|
								                let mutiList = []
							 | 
						|
								                if (_info) {
							 | 
						|
								                  _info.forEach((fo, index) => {
							 | 
						|
								                    // console.log('mutiList----555' + index, mutiList, _list)
							 | 
						|
								                    mutiList.splice(index, 0, {
							 | 
						|
								                      row: index,
							 | 
						|
								                      itemList: _list.map((m) => {
							 | 
						|
								                        // console.log('itemList---item' + index, m)
							 | 
						|
								                        return {
							 | 
						|
								                          ...m,
							 | 
						|
								                          ID: fo.ID,
							 | 
						|
								                          columnValue: fo[m.columnName]
							 | 
						|
								                        }
							 | 
						|
								                      })
							 | 
						|
								                    })
							 | 
						|
								                    // console.log('mutiList----666' + index, mutiList)
							 | 
						|
								                  })
							 | 
						|
								                }
							 | 
						|
								                item.mutiList = mutiList
							 | 
						|
								              } else {
							 | 
						|
								                if (_info) {
							 | 
						|
								                  item.itemList.forEach((n) => {
							 | 
						|
								                    n.ID = _info[0].ID
							 | 
						|
								                    n.columnValue = _info[0][n.columnName]
							 | 
						|
								                  })
							 | 
						|
								                }
							 | 
						|
								              }
							 | 
						|
								            })
							 | 
						|
								            // console.log('getrowInfo---formname', this.tabsList)
							 | 
						|
								            this.dialogEditVisible = true
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch((err) => {
							 | 
						|
								          console.log('getrowInfo---formnameerr', err)
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								    async getOptionsList(url) {
							 | 
						|
								      let options = []
							 | 
						|
								      // console.log('getOptionsList----', url)
							 | 
						|
								      await this.$http
							 | 
						|
								        .post(url, { formCode: 'resi_base_info' })
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            options = res.data
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch(() => {
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								      return options
							 | 
						|
								    },
							 | 
						|
								    getSearchList() {
							 | 
						|
								      this.$http
							 | 
						|
								        .post('/oper/customize/icform/conditionlist', {
							 | 
						|
								          formCode: 'resi_base_info',
							 | 
						|
								          dynamic: true
							 | 
						|
								        })
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            // console.log('获取查询详情成功', res.data)
							 | 
						|
								            this.searchList = res.data
							 | 
						|
								            res.data.forEach((item) => {
							 | 
						|
								              if (item.optionSourceType === 'remote') {
							 | 
						|
								                this.getOptionsList(item.optionSourceValue).then((res) => {
							 | 
						|
								                  item.options = res
							 | 
						|
								                })
							 | 
						|
								                // console.log('')
							 | 
						|
								              }
							 | 
						|
								            })
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch(() => {
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								    getTreeData(data){
							 | 
						|
								      if (!Array.isArray(data)) return []
							 | 
						|
								      let arr = data.map(item => {
							 | 
						|
								        let _item = {}
							 | 
						|
								        if (item.children) {
							 | 
						|
								          if (item.children.length === 0) _item = { ...item, children: undefined }
							 | 
						|
								          else _item = { ...item, children: this.getTreeData(item.children)}
							 | 
						|
								        } else {
							 | 
						|
								          _item = { ...item }
							 | 
						|
								        }
							 | 
						|
								        return _item
							 | 
						|
								      })
							 | 
						|
								      return arr
							 | 
						|
								    },
							 | 
						|
								    async getFormList(type) {
							 | 
						|
								      await this.$http
							 | 
						|
								        .post('/oper/customize/icform/getcustomerform', {
							 | 
						|
								          formCode: 'resi_base_info',
							 | 
						|
								          dynamic: true
							 | 
						|
								        })
							 | 
						|
								        .then(({ data: res }) => {
							 | 
						|
								          if (res.code !== 0) {
							 | 
						|
								            return this.$message.error(res.msg)
							 | 
						|
								          } else {
							 | 
						|
								            console.log('获取详情成功getFormList')
							 | 
						|
								            let { itemList, groupList, formName } = res.data
							 | 
						|
								            this.formName = formName
							 | 
						|
								            this.activeName = 'group' + res.data.groupList[0].groupId
							 | 
						|
								            if (type !== 'edit') {
							 | 
						|
								              itemList.forEach(async (item) => {
							 | 
						|
								                if (item.optionSourceType === 'remote') {
							 | 
						|
								                  await this.getOptionsList(item.optionSourceValue).then(
							 | 
						|
								                    (res) => {
							 | 
						|
								                      item.options = this.getTreeData(res)
							 | 
						|
								                    }
							 | 
						|
								                  )
							 | 
						|
								                }
							 | 
						|
								              })
							 | 
						|
								            }
							 | 
						|
								            groupList.forEach((item) => {
							 | 
						|
								              item.itemList.forEach(async (n) => {
							 | 
						|
								                n.tableName = item.tableName
							 | 
						|
								                if (n.optionSourceType === 'remote' && type !== 'edit') {
							 | 
						|
								                  await this.getOptionsList(n.optionSourceValue).then((res) => {
							 | 
						|
								                    n.options = this.getTreeData(res)
							 | 
						|
								                  })
							 | 
						|
								                }
							 | 
						|
								              })
							 | 
						|
								            })
							 | 
						|
								            // }
							 | 
						|
								            this.formList = itemList
							 | 
						|
								            this.tabsList = groupList
							 | 
						|
								          }
							 | 
						|
								        })
							 | 
						|
								        .catch(() => {
							 | 
						|
								          return this.$message.error('网络错误')
							 | 
						|
								        })
							 | 
						|
								    }
							 | 
						|
								  }
							 | 
						|
								}
							 | 
						|
								</script>
							 | 
						|
								
							 | 
						|
								<style lang="scss" scoped>
							 | 
						|
								.tabs-other-info {
							 | 
						|
								  ::v-deep .el-tabs__item {
							 | 
						|
								    // width: 50px;
							 | 
						|
								    height: 20px;
							 | 
						|
								    box-sizing: border-box;
							 | 
						|
								    margin-right: 7px;
							 | 
						|
								    padding: 0 10px !important;
							 | 
						|
								    font-size: 8px;
							 | 
						|
								    font-weight: 500;
							 | 
						|
								    color: #666666;
							 | 
						|
								    line-height: 20px;
							 | 
						|
								    background: #ebecf1;
							 | 
						|
								    border-radius: 2px;
							 | 
						|
								  }
							 | 
						|
								  ::v-deep .el-tabs__nav-wrap::after,
							 | 
						|
								  ::v-deep .el-tabs__active-bar {
							 | 
						|
								    display: none;
							 | 
						|
								  }
							 | 
						|
								  ::v-deep .el-tabs__nav-next,
							 | 
						|
								  ::v-deep .el-tabs__nav-prev {
							 | 
						|
								    // width: 12px;
							 | 
						|
								    // height: 12px;
							 | 
						|
								    color: rgba(30, 122, 254, 1);
							 | 
						|
								    line-height: 20px;
							 | 
						|
								    background: rgba(30, 122, 254, .2);
							 | 
						|
								    // border-radius: 50%;
							 | 
						|
								  }
							 | 
						|
								  ::v-deep .el-tabs__item.is-active {
							 | 
						|
								    color: #fff;
							 | 
						|
								    background: linear-gradient(90deg, #1A5AFD, #26C4FF);
							 | 
						|
								  }
							 | 
						|
								}
							 | 
						|
								.resi-container .resi-card-table {
							 | 
						|
								  ::v-deep .el-table th {
							 | 
						|
								    color: #fff;
							 | 
						|
								    background-color: rgba(33, 149, 254, 1);
							 | 
						|
								    border-right: 1px solid rgba(33, 149, 254, 1);;
							 | 
						|
								  }
							 | 
						|
								}
							 | 
						|
								.resi-table {
							 | 
						|
								  ::v-deep .el-button--text {
							 | 
						|
								    text-decoration: underline;
							 | 
						|
								  }
							 | 
						|
								  ::v-deep .btn-color-del {
							 | 
						|
								    margin-left: 10px;
							 | 
						|
								    color: rgba(213, 16, 16, 1);
							 | 
						|
								  }
							 | 
						|
								  ::v-deep .btn-color-edit {
							 | 
						|
								    color: rgba(0, 167, 169, 1);
							 | 
						|
								  }
							 | 
						|
								}
							 | 
						|
								</style>
							 | 
						|
								
							 | 
						|
								<style lang="scss" scoped>
							 | 
						|
								.resi-card-table {
							 | 
						|
								  margin-top: 20px;
							 | 
						|
								}
							 | 
						|
								.resi-row-btn {
							 | 
						|
								  display: flex;
							 | 
						|
								  margin-bottom: 13px;
							 | 
						|
								  .el-button {
							 | 
						|
								    margin-left: 10px;
							 | 
						|
								    border: 0;
							 | 
						|
								  }
							 | 
						|
								  .el-button--success {
							 | 
						|
								    background: rgba(34, 193, 195, 1);
							 | 
						|
								  }
							 | 
						|
								  .el-button--warning {
							 | 
						|
								    background: rgba(254, 179, 73, 1);
							 | 
						|
								  }
							 | 
						|
								  .el-button--danger {
							 | 
						|
								    background: rgba(254, 98, 82, 1);
							 | 
						|
								  }
							 | 
						|
								}
							 | 
						|
								.resi-other {
							 | 
						|
								  width: 100%;
							 | 
						|
								  display: flex;
							 | 
						|
								  .resi-other-title {
							 | 
						|
								    flex-shrink: 0;
							 | 
						|
								    // display: inline-block;
							 | 
						|
								    width: 100px;
							 | 
						|
								    box-sizing: border-box;
							 | 
						|
								    margin-bottom: 10px;
							 | 
						|
								    // padding: 6px 12px 0 0;
							 | 
						|
								    font-size: 16px;
							 | 
						|
								    font-weight: 500;
							 | 
						|
								    color: #333;
							 | 
						|
								    text-align: center;
							 | 
						|
								  }
							 | 
						|
								  .tabs-other-info {
							 | 
						|
								    // display: inline-block;
							 | 
						|
								    // flex: 1;
							 | 
						|
								    // padding-left: 60px;
							 | 
						|
								    width: calc(100% - 100px);
							 | 
						|
								  }
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								.resi-btns {
							 | 
						|
								  margin-top: 20px;
							 | 
						|
								  text-align: center;
							 | 
						|
								}
							 | 
						|
								</style>
							 | 
						|
								
							 |