odc.xiaohui
2023-05-22 0782140a00e554ec7a1c724ecc1eb36726d994f8
src/views/manager/User.vue
@@ -3,8 +3,8 @@
    <el-card style="height: 100%">
      <template slot="header">
        <el-form :inline="true" :model="queryInfo" class="demo-form-inline">
          <el-form-item label="用户名:">
            <el-input placeholder="请输入" v-model="queryInfo.nickName"></el-input>
          <el-form-item label="手机号:">
            <el-input placeholder="请输入" v-model="queryInfo.userMobile"></el-input>
          </el-form-item>
          <el-form-item label="用户姓名:">
            <el-input placeholder="请输入" v-model="queryInfo.realName"></el-input>
@@ -14,6 +14,7 @@
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="addPublicityVisibel = true">添加</el-button>
            <el-button type="primary" @click="exportList">导出</el-button>
          </el-form-item>
        </el-form>
      </template>
@@ -21,11 +22,14 @@
        <el-table :data="publicityList" style="width: 100%">
          <el-table-column prop="nickName" label="用户名" width="180" align="center">
          </el-table-column>
          <el-table-column prop="realName" label="用户姓名" width="180" header-align="center" align="center">
          </el-table-column>
          <el-table-column prop="userMobile" label="手机号码" width="180" header-align="center" align="center">
          </el-table-column>
          <el-table-column prop="ctime" label="创建时间" width="180" header-align="center" align="center">
          </el-table-column>
          <el-table-column prop="userMemo" label="备注" width="180" align="center">
          </el-table-column>
          <el-table-column label="操作" align="conter">
            <template slot-scope="scope">
@@ -116,6 +120,13 @@
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="备注" prop="userMemo">
            <el-input v-model="detailsRow.userMemo" placeholder="请输入备注" clearable
                      :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <span slot="footer" class="dialog-footer">
@@ -183,7 +194,8 @@
      total: null,
      //查询条件
      queryInfo: {
        nickName: '',
        userMobile: '',
        realName: '',
        current: 1,
        size: 10
      },
@@ -215,6 +227,33 @@
  },
  methods:
      {
        exportList(){
          this.$http({
            url:'/api/user/exp',
            responseType: 'blob',
            method: 'post',
          }).then(res=>{
            console.log(res)
            this.$message.success('操作成功');
            let time = new Date()
            let deathdate =time.toLocaleDateString()
            const blob = new Blob([res.data], {
              type: "application/vnd.ms-excel;charset=utf-8",
            });
            if (window.navigator.msSaveBlob) {
              window.navigator.msSaveBlob(blob, deathdate + ".xlsx");
            } else {
              const url = window.URL.createObjectURL(blob);
              const link = document.createElement("a");
              link.style.display = "none";
              link.href = url;
              link.download = deathdate + ".xlsx";
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link);
            }
          })
        },
        handleToManager(data) {
          toManager(data.id).then(res => {
            this.$message({
@@ -277,12 +316,19 @@
        },
        update() {
          this.$http.put('/api/user', this.detailsRow).then(res => {
                this.$message({
                      message: '编辑成功',
                      type: 'success'
                    }
                )
                this.search();
            console.log(res)
            if (res.data.code == 200){
              this.$message({
                    message: '编辑成功',
                    type: 'success'
                  }
              )
              this.search();
            }else {
              this.$message.error(res.data.msg)
              this.search();
            }
              }
          );
          this.detailsVisible = false;
@@ -341,7 +387,7 @@
          let param = {}
          param.current = this.queryInfo.current
          param.realName = this.queryInfo.realName
          param.nickName = this.queryInfo.nickName
          param.userMobile = this.queryInfo.userMobile
          param.size = this.queryInfo.size
          getPublicityList(param).then(res => {
            this.publicityList = res.records;