haoxuan
2024-04-28 4e5f6381bfedbbd8060101f2b63be46cf1c81a0a
src/views/supplierManage/outsourceSupplier/index.vue
@@ -1,23 +1,32 @@
<template>
  <d2-container>
    <template slot="header">
      <div class="top">
        <SearchCommonView
  <div class="outsource-supplier-manage">
    <div class="filter">
      <div class="filter-card">
        <CommonSearch
          :add-title="'新增企业'"
          :total-object="totalObject"
          :other-options="otherOptions"
          :placeholder="'请输入名称'"
          @addCommonClick="addEnterpriseClick"
          @searchClick="getEnterpriseList"
          @clearClick="getEnterpriseList"
        />
      </div>
    </template>
    </div>
    <div class="content">
      <div class="content-top">
      <div class="body-card">
      <div class="list-view">
        <TableCommonView ref="tableListRef" :table-list="tableList" @selTableCol="selTableCol">
          <template slot="tableButton">
            <el-table-column label="操作" width="160" fixed="right">
            <el-table-column label="操作" width="150" fixed="right">
              <template slot-scope="scope">
                <el-button
                  v-if="scope.row.tel.length == 0"
                  type="text"
                  size="small"
                  @click="createAccountClick(scope.row)"
                  >创建账号</el-button
                >
                <el-button v-if="scope.row.status == 1" type="text" size="small" @click="statusModifyClick(scope.row)"
                  >停用</el-button
                >
@@ -32,10 +41,17 @@
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
      </div>
    </div>
    </div>
    <!-- <div class="overSpread" v-show="isopen || isCreateShop"></div> -->
    <!-- 添加/编辑备件 -->
    <AddEnterprise ref="add" :showList="showList" :titleName="titleName" :editRow="editRow" @shutdown="shutdown" />
  </d2-container>
    <!-- 创建账号 -->
    <CreateAccount
      ref="create"
      :editRow="createRow"
      @shutdown="shutCreateDown"
    />
  </div>
</template>
<script>
@@ -46,12 +62,14 @@
  editOutsideUser
} from "@/api/supplierManage/outsourceSupplier"
import AddEnterprise from "@/views/supplierManage/outsourceSupplier/components/addEnterprise"
import CreateAccount from "@/views/supplierManage/outsourceSupplier/components/CreateAccount";
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "outsourceManage",
  mixins: [pageMixin],
  components: {
    AddEnterprise
    AddEnterprise,
    CreateAccount
  },
  beforeMount() {
    this.getData()
@@ -103,7 +121,8 @@
        "添加时间",
        "状态"
      ],
      showList: []
      showList: [],
      createRow: {},
    }
  },
  mounted() {
@@ -181,6 +200,7 @@
        {
          label: "组织机构代码",
          prop: "organizationCode",
          min:140,
          isShowColumn: showcol.includes("组织机构代码"),
          default: false
        },
@@ -241,7 +261,7 @@
    },
    // 搜索触发
    async getEnterpriseList(val) {
      this.searchParam.keyword = val
      this.searchParam.keyword = val?val:''
      this.pagerOptions.currPage = 1
      this.getData()
    },
@@ -255,7 +275,7 @@
    editClick(val) {
      let params = JSON.parse(JSON.stringify(val))
      this.titleName = "编辑"
      this.editRow = { ...params, password: "000000" }
      this.editRow = { ...params, password: "000000",id:params.id?params.id:params.ID, }
      this.$refs.add.islook = true
    },
    // 启用/停用
@@ -271,15 +291,18 @@
        updateEnterprise(params)
          .then((reply) => {
            if (reply && reply.code == 200) {
              this.editOutsideUser(row)
              // this.getData();
              // this.$message.success(row.status == 1 ? "停用成功" : "启用成功");
              if(row.tel){
                this.editOutsideUser(row)
              }else{
                this.getData()
                this.$message.success(row.status == 1 ? "停用成功" : "启用成功")
              }
            } else {
              this.$message.error(row.status == 1 ? "停用失败" : "启用失败")
            }
          })
          .catch(() => {})
      })
      }).catch(() => {})
    },
    // 启用停用外部用户
    editOutsideUser(row) {
@@ -301,42 +324,68 @@
    // 获取状态
    getStatus(val) {
      return val == 0 ? "新建" : val == 1 ? "启用" : val == 2 ? "停用" : "--"
    }
    },
    shutCreateDown() {
      this.$refs.create.islook = false;
      this.getData();
    },
    // 创建账号
    createAccountClick(row) {
      let params = JSON.parse(JSON.stringify(row))
      this.createRow = { ...params,id:row.id?row.id:row.ID };
      this.$refs.create.islook = true;
    },
  }
}
</script>
<style lang="scss" scoped>
.top {
  width: 100%;
  height: 61px;
  display: flex;
  align-items: center;
  .fon_weight {
    font-size: 28px;
    height: 32px;
  }
  .top_right_bottom {
    font-size: 14px;
    line-height: 20px;
    color: #000;
    opacity: 0.6;
    margin-top: 9px;
    font-family: "PingFangSC-Medium," sans-serif;
.outsource-supplier-manage{
  height: 100%;
  overflow: hidden;
  .filter {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 12px 20px 0 20px;
    &-card {
      height: 80px;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      padding: 10px 20px;
      flex: 1;
      border-radius: 12px;
      background-color: #fff;
    }
  }
}
.el-button {
  font-family: "PingFangSC";
}
.content {
  width: 100%;
  height: calc(100% - 30px);
  background: #fff;
  // width: 100%;
  height: calc(100% - 92px);
  border-radius: 12px;
  box-sizing: border-box;
  .content-top {
    height: calc(100% - 60px);
  }
  padding: 10px 20px;
  .body-card {
      background-color: #fff;
      border-radius: 12px;
      height: 100%;
      overflow: hidden;
    }
  .list-view {
      height: calc(100% - 60px);
      overflow: hidden;
    }
    .btn-pager {
      display: flex;
      .page {
        margin-left: auto;
      }
    }
}
::v-deep {
  .el-table {