src/views/supplierManage/outsourceSupplier/index.vue
@@ -18,8 +18,15 @@
      <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
                >
@@ -38,6 +45,12 @@
    <!-- <div class="overSpread" v-show="isopen || isCreateShop"></div> -->
    <!-- 添加/编辑备件 -->
    <AddEnterprise ref="add" :showList="showList" :titleName="titleName" :editRow="editRow" @shutdown="shutdown" />
    <!-- 创建账号 -->
    <CreateAccount
      ref="create"
      :editRow="createRow"
      @shutdown="shutCreateDown"
    />
  </div>
</template>
@@ -49,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()
@@ -106,7 +121,8 @@
        "添加时间",
        "状态"
      ],
      showList: []
      showList: [],
      createRow: {},
    }
  },
  mounted() {
@@ -184,6 +200,7 @@
        {
          label: "组织机构代码",
          prop: "organizationCode",
          min:140,
          isShowColumn: showcol.includes("组织机构代码"),
          default: false
        },
@@ -258,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
    },
    // 启用/停用
@@ -274,15 +291,18 @@
        updateEnterprise(params)
          .then((reply) => {
            if (reply && reply.code == 200) {
              if(row.tel){
              this.editOutsideUser(row)
              // this.getData();
              // this.$message.success(row.status == 1 ? "停用成功" : "启用成功");
              }else{
                this.getData()
                this.$message.success(row.status == 1 ? "停用成功" : "启用成功")
              }
            } else {
              this.$message.error(row.status == 1 ? "停用失败" : "启用失败")
            }
          })
          .catch(() => {})
      })
      }).catch(() => {})
    },
    // 启用停用外部用户
    editOutsideUser(row) {
@@ -304,7 +324,17 @@
    // 获取状态
    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>