发表于: 2019-12-06 21:00:29
0 1245
今天完成的事情:
明天计划的事情:
遇到的问题:
收获:
<div class="tableContent">
<div class="tableHeader">
<div>
<span>公司列表</span>
</div>
<el-button type="primary" size="mini" @click="addFirm">新增+</el-button>
</div>
<el-table
:data="tableData"
stripe
style="width: 100%"
v-loading="loading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
>
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="name" label="公司名称"></el-table-column>
<el-table-column prop="industryList[0]" label="公司行业">
<template slot-scope="scope">
{{
scope.row.industryList[0] | namePipe
}}
</template>
</el-table-column>
<el-table-column label="地区">
<template slot-scope="scope">
{{ scope.row.city | regionCity }}-{{
scope.row.county | regionCount
}}
</template>
</el-table-column>
<el-table-column label="融资规模">
<template slot-scope="scope">{{ scope.row.financing | financing }}</template>
</el-table-column>
<el-table-column label="认证状态">
<template slot-scope="scope">{{ scope.row.approved | approved }}</template>
</el-table-column>
<el-table-column label="冻结状态">
<template slot-scope="scope">{{ scope.row.freezed | freezed }}</template>
</el-table-column>
<el-table-column label="操作" width="350px">
<template slot-scope="scope">
<el-button size="mini" type="success" @click="jobPage">职位</el-button>
<el-button
slot="reference"
size="mini"
type="primary"
@click="changeApproved(scope.row)"
>{{ scope.row.approved == 1 ? "解除" : "认证" }}</el-button>
<el-button size="mini" type="success" @click="editPage">编辑</el-button>
<el-button
slot="reference"
size="mini"
type="primary"
@click="changeFreezed(scope.row)"
>{{ scope.row.freezed == 1 ? "解冻" : "冻结" }}</el-button>
<el-button size="mini" @click="deleteIt" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
这里需要在发起请求的时候弹出提示框,通过async await进行弹出提示框,因为发现element中的气泡选择框没有给点击确认的回调,所以只能用message来做了。代码量会增大一点点。
async changeFreezed(data) {
// console.log(data.freezed);
let params = {
id: data.id,
status: data.freezed == 0 ? 1 : 0,
type: 0 // type为0更改冻结状态,操
};
// 这里使用async await确认操作之后在发出请求
const confirmResult = await this.$confirm(
"更改冻结状态,是否继续?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).catch(err => err);
if (confirmResult !== "confirm") {
return this.$message.info("已取消本次操作");
}
this.$api.Freezed(params).then(res => {
if (res.code === 0) {
this.getData();
setTimeout(() => {
this.$message.success("更改成功");
}, 3000); // 这里延时时间以后根据情况在调
}
});
},
// =======================================================================
// 更改认证状态===========================================================
// =======================================================================
async changeApproved(data) {
let params = {
id: data.id,
status: data.approved === 1 ? 0 : 1,
type: 1 //type为1更改认证状态,操
};
const confirmResult = await this.$confirm(
"更改认证状态,是否继续?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).catch(err => err);
if (confirmResult !== "confirm") {
return this.$message.info("已取消本次操作");
}
this.$api.Approved(params).then(res => {
if (res.code === 0) {
this.getData();
setTimeout(() => {
this.$message.success("更改成功");
}, 3000); // 这里延时时间以后根据情况在调
}
});
},
评论