zhouwx
2024-08-30 1f6893d24ba87313d4114c68813073ead53b2e12
src/views/Admin/contactBook/contactors.vue
@@ -24,16 +24,18 @@
          </div>
        </div>
        <div style="margin: 20px 0;display: flex;justify-content: space-between">
          <div>
          <div style="display: flex;align-items: center">
            <a-button  type="primary" style="margin-right: 10px" @click="editData('add',{})">新增</a-button>
            <a-button  type="primary" @click="massImport()">批量导入</a-button>
          </div>
          <a-button type="primary" @click="openExport">批量导出</a-button>
<!--          <download-excel :data="json_data" :fields="json_fields" name="责任人导出.xlsx" >-->
<!--            <a-button type="primary">批量导出</a-button>-->
<!--          </download-excel>-->
        </div>
        <div style="display: flex;align-items: center;margin-bottom: 15px">
          <a-input v-model="search.searchParams.name" placeholder="请输入姓名" style="width: 250px;margin-right: 10px"></a-input>
          <a-input v-model="search.searchParams.phone" placeholder="请输入电话" style="width: 250px;margin-right: 10px"></a-input>
          <a-input v-model="search.searchParams.company" placeholder="请输入单位" style="width: 250px;margin-right: 10px"></a-input>
          <a-button  type="primary" style="margin-right: 10px" @click="getUserList()">查询</a-button>
          <a-button   @click="resetSearch()">重置</a-button>
        </div>
        <div class="table-cont">
@@ -96,6 +98,11 @@
      </a-form-model>
    </a-modal>
    <a-modal v-model="importDialog" title="导入失败列表" :footer="null" centered :afterClose="closeImportDialog">
      <span style="margin-bottom: 20px;font-size: 16px">{{errorMsg}}</span>
      <a-table :columns="errColumns" :data-source="errorData"  :rowKey="record=>record.id" bordered :pagination="false" :scroll="{y:'200px'}">
      </a-table>
    </a-modal>
  </div>
</template>
@@ -133,12 +140,14 @@
      unittype: null,
      districtId: null,
      currentKey: [],
      importDialog:false,
      search:{
        pageIndex: 1,
        pageSize: 10,
        searchParams: {
          name: '',
          phone: '',
          company: '',
          orgStructureId: null
        }
      },
@@ -208,6 +217,14 @@
        onChange: ( page, pageSize ) => this.onPageChange(page,pageSize),
        showTotal: total => `共 ${total} 条`
      },
      paginationErr: {
        current: 1,
        defaultCurrent: 1,
        defaultPageSize: 10,
        total: 0,
        onChange: ( page, pageSize ) => this.onPageChangeErr(page,pageSize),
        showTotal: total => `共 ${total} 条`
      },
      fieldNames:{
        label: 'name',
        value: 'id',
@@ -225,7 +242,12 @@
        value: 'code'
      },
      json_fields: {
        'ID': 'id',
        'ID': {
          field: 'id',
          callback: value => {
            return '&nbsp;'+value
          }
        },
        '姓名': 'name',
        '所属当前级别行政区划': 'districtName',
        '区划编号': 'districtCode',
@@ -240,7 +262,21 @@
          }
        },
      },
      json_data: []
      json_data: [],
      errorData: [],
      errorMsg: '',
      errColumns:[
        {
          title: '姓名',
          dataIndex: 'name',
          key: 'name'
        },
        {
          title: '失败原因',
          dataIndex: 'errorMsg',
          key: 'errorMsg'
        },
      ],
    }
  },
  created() {
@@ -304,6 +340,11 @@
          this.uploadLoading = false
          this.visible = false
          await this.getUserList()
          if(res.data.data && res.data.data.length>0){
            this.errorMsg = res.data.msg
            this.errorData = res.data.data
            this.importDialog = true;
          }
        }else{
          this.$message.warning(res.data.msg);
          this.uploadLoading = false
@@ -318,11 +359,18 @@
      this.json_data = [];
      this.exportDialog = false;
    },
    closeImportDialog(){
      this.errorMsg = '';
      this.errorData = [];
      this.importDialog = false;
    },
    async getStructure(){
      const t = this
      const res = await getStructure()
      if(res.data.code == 100){
        console.log('res',res)
        t.treeData = t.filterBranches(res.data.data,['自治区直辖县级行政区划'])
        console.log('treeData',t.treeData)
        // const firstItem = this.firstIdWithOrgStructures(res.data.data[0])
        // if(firstItem){
        //   t.openKeys =  [firstItem.id +'-'+  firstItem.name]
@@ -387,6 +435,7 @@
        searchParams: {
          name: '',
          phone: '',
          company: '',
          orgStructureId: null
        }
      }
@@ -418,6 +467,12 @@
      t.search = {
        pageIndex: 1,
        pageSize: 10,
        searchParams: {
          name: '',
          phone: '',
          company: '',
          orgStructureId: t.search.searchParams.orgStructureId
        }
      }
      t.getUserList()
    },
@@ -467,11 +522,12 @@
      getExportData(this.exportAreaId).then(res => {
        if(res.data.code == 100){
          this.json_data = res.data.data
          console.log('this.json_data',this.json_data)
        }else{
          this.$message.warning(res.data.msg);
        }
      })
      console.log('this.json_data',this.json_data)
    },
    async deliverTask(){