|
|
|
|
|
|
|
|
<search :search-params="searchParams" /> |
|
|
<search :search-params="searchParams" /> |
|
|
<div class="operating"> |
|
|
<div class="operating"> |
|
|
<el-button size="small" type="warning" @click="add">新增</el-button> |
|
|
<el-button size="small" type="warning" @click="add">新增</el-button> |
|
|
<el-button size="small" type="default">批量删除</el-button> |
|
|
|
|
|
<el-button size="small" type="default">批量导入</el-button> |
|
|
|
|
|
|
|
|
<el-button size="small" type="default" @click="remove()" |
|
|
|
|
|
>批量删除</el-button |
|
|
|
|
|
> |
|
|
|
|
|
<!-- <el-button size="small" type="default">批量导入</el-button> --> |
|
|
</div> |
|
|
</div> |
|
|
<el-table |
|
|
<el-table |
|
|
highlight-current-row |
|
|
highlight-current-row |
|
|
:data="dataList" |
|
|
:data="dataList" |
|
|
border |
|
|
border |
|
|
:height="tableHeight" |
|
|
:height="tableHeight" |
|
|
|
|
|
@selection-change="selectionChange" |
|
|
> |
|
|
> |
|
|
<el-table-column |
|
|
<el-table-column |
|
|
type="selection" |
|
|
type="selection" |
|
|
|
|
|
|
|
|
align="center" |
|
|
align="center" |
|
|
prop="createUser" |
|
|
prop="createUser" |
|
|
></el-table-column> |
|
|
></el-table-column> |
|
|
<el-table-column |
|
|
|
|
|
label="操作" |
|
|
|
|
|
min-width="150" |
|
|
|
|
|
align="center" |
|
|
|
|
|
></el-table-column> |
|
|
|
|
|
|
|
|
<el-table-column label="操作" min-width="120" align="center"> |
|
|
|
|
|
<template slot-scope="{ row }"> |
|
|
|
|
|
<el-link |
|
|
|
|
|
@click="edit(row)" |
|
|
|
|
|
icon="el-icon-edit" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
:underline="false" |
|
|
|
|
|
>修改</el-link |
|
|
|
|
|
> |
|
|
|
|
|
<el-popconfirm |
|
|
|
|
|
title="确定要删除此表格?" |
|
|
|
|
|
@confirm="remove(row)" |
|
|
|
|
|
class="ele-action" |
|
|
|
|
|
> |
|
|
|
|
|
<el-link |
|
|
|
|
|
slot="reference" |
|
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
|
type="danger" |
|
|
|
|
|
:underline="false" |
|
|
|
|
|
>删除</el-link |
|
|
|
|
|
> |
|
|
|
|
|
</el-popconfirm> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
<el-pagination |
|
|
<el-pagination |
|
|
:current-page="page.page" |
|
|
|
|
|
|
|
|
:current-page.sync="page.page" |
|
|
:page-size="page.limit" |
|
|
:page-size="page.limit" |
|
|
:total="count" |
|
|
:total="count" |
|
|
:background="true" |
|
|
:background="true" |
|
|
layout="total, prev, pager, next, jumper" |
|
|
layout="total, prev, pager, next, jumper" |
|
|
:pager-count="5" |
|
|
:pager-count="5" |
|
|
class="ele-pagination-circle" |
|
|
class="ele-pagination-circle" |
|
|
|
|
|
@current-change="getDataList()" |
|
|
/> |
|
|
/> |
|
|
</el-card> |
|
|
</el-card> |
|
|
<el-dialog |
|
|
<el-dialog |
|
|
|
|
|
|
|
|
:visible.sync="showAdd" |
|
|
:visible.sync="showAdd" |
|
|
width="400px" |
|
|
width="400px" |
|
|
custom-class="ele-dialog-form" |
|
|
custom-class="ele-dialog-form" |
|
|
|
|
|
:lock-scroll="false" |
|
|
|
|
|
:destroy-on-close="true" |
|
|
|
|
|
@closed="form = {}" |
|
|
> |
|
|
> |
|
|
<el-form |
|
|
<el-form |
|
|
:model="form" |
|
|
:model="form" |
|
|
|
|
|
|
|
|
:rules="rules" |
|
|
:rules="rules" |
|
|
> |
|
|
> |
|
|
<el-form-item label="考核年度:" prop="year"> |
|
|
<el-form-item label="考核年度:" prop="year"> |
|
|
<el-date-picker type="year" placeholder="选择考核年度" style="width:100%" clearable v-model="form.year"> |
|
|
|
|
|
|
|
|
<el-date-picker |
|
|
|
|
|
type="year" |
|
|
|
|
|
placeholder="选择考核年度" |
|
|
|
|
|
style="width: 100%" |
|
|
|
|
|
v-model="form.year" |
|
|
|
|
|
format="yyyy" |
|
|
|
|
|
value-format="yyyy" |
|
|
|
|
|
> |
|
|
</el-date-picker> |
|
|
</el-date-picker> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="表格名称:" prop="name"> |
|
|
<el-form-item label="表格名称:" prop="name"> |
|
|
<el-input placeholder="请输入如表格名称" clearable v-model="form.name"></el-input> |
|
|
|
|
|
|
|
|
<el-input |
|
|
|
|
|
placeholder="请输入如表格名称" |
|
|
|
|
|
clearable |
|
|
|
|
|
v-model="form.name" |
|
|
|
|
|
></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="表编号:" prop='code'> |
|
|
|
|
|
<el-input placeholder="请输入表编号" clearable v-model="form.code"></el-input> |
|
|
|
|
|
|
|
|
<el-form-item label="表编号:" prop="code"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
placeholder="请输入表编号" |
|
|
|
|
|
clearable |
|
|
|
|
|
v-model="form.code" |
|
|
|
|
|
></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="备注:"> |
|
|
<el-form-item label="备注:"> |
|
|
<el-input type="textarea" :rows="4" v-model="form.note"></el-input> |
|
|
<el-input type="textarea" :rows="4" v-model="form.note"></el-input> |
|
|
|
|
|
|
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
searchParams: {}, |
|
|
searchParams: {}, |
|
|
dataList: [ |
|
|
|
|
|
{ code: "fadfadf", name: "fadfadf", note: "fdafa", year: "fdfadf" }, |
|
|
|
|
|
], |
|
|
|
|
|
|
|
|
dataList: [], |
|
|
count: 0, |
|
|
count: 0, |
|
|
page: { |
|
|
page: { |
|
|
page: 1, |
|
|
page: 1, |
|
|
limit: Math.floor((document.documentElement.clientHeight - 360-45) / 45), |
|
|
|
|
|
|
|
|
limit: Math.floor( |
|
|
|
|
|
(document.documentElement.clientHeight - 360 - 45) / 45 |
|
|
|
|
|
), |
|
|
}, |
|
|
}, |
|
|
showAdd: false, |
|
|
showAdd: false, |
|
|
form: {}, |
|
|
form: {}, |
|
|
|
|
|
multipleSelection: [], |
|
|
tableHeight: document.documentElement.clientHeight - 360, |
|
|
tableHeight: document.documentElement.clientHeight - 360, |
|
|
rules: { |
|
|
rules: { |
|
|
code: [{ required: true, message: "表编号", trigger: "blur" }], |
|
|
code: [{ required: true, message: "表编号", trigger: "blur" }], |
|
|
name: [{ required: true, message: "请输入表格名称", trigger: "blur" }], |
|
|
name: [{ required: true, message: "请输入表格名称", trigger: "blur" }], |
|
|
year: [{ required: true, message: "请输入考核年度" }], |
|
|
|
|
|
|
|
|
year: [{ required: true, message: "请输入考核年度", trigger: "blur" }], |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
created() { |
|
|
this.getDataList(this.page); |
|
|
|
|
|
|
|
|
this.getDataList(); |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
selectionChange(rows) { |
|
|
|
|
|
this.multipleSelection = rows; |
|
|
|
|
|
}, |
|
|
getDataList(params) { |
|
|
getDataList(params) { |
|
|
const loading = this.$loading({ lock: true }); |
|
|
const loading = this.$loading({ lock: true }); |
|
|
|
|
|
console.log(this.page); |
|
|
api |
|
|
api |
|
|
.getList(params) |
|
|
|
|
|
|
|
|
.getList(params ? Object.assign(this.page, params) : this.page) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
loading.close(); |
|
|
loading.close(); |
|
|
this.dataList = res.data.data.records; |
|
|
|
|
|
this.count=res.data.data.total |
|
|
|
|
|
|
|
|
let data = res.data.data.records; |
|
|
|
|
|
data = data.map((item) => { |
|
|
|
|
|
item.year = item.year + ""; |
|
|
|
|
|
return item; |
|
|
|
|
|
}); |
|
|
|
|
|
this.dataList = data; |
|
|
|
|
|
this.count = res.data.data.total; |
|
|
}) |
|
|
}) |
|
|
.catch(() => { |
|
|
.catch(() => { |
|
|
loading.close(); |
|
|
loading.close(); |
|
|
this.dataList = []; |
|
|
this.dataList = []; |
|
|
this.count=0 |
|
|
|
|
|
|
|
|
this.count = 0; |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
add(row) { |
|
|
|
|
|
console.log(row) |
|
|
|
|
|
|
|
|
add() { |
|
|
this.form = { code: "", name: "", note: "", year: "" }; |
|
|
this.form = { code: "", name: "", note: "", year: "" }; |
|
|
this.showAdd = true; |
|
|
this.showAdd = true; |
|
|
}, |
|
|
}, |
|
|
edit(row) { |
|
|
edit(row) { |
|
|
console.log(row) |
|
|
|
|
|
this.form = Object.assign({}, row); |
|
|
this.form = Object.assign({}, row); |
|
|
this.showAdd = true; |
|
|
this.showAdd = true; |
|
|
}, |
|
|
}, |
|
|
|
|
|
remove(row) { |
|
|
|
|
|
if (!row) { |
|
|
|
|
|
// 批量删除 |
|
|
|
|
|
if (this.multipleSelection.length === 0) |
|
|
|
|
|
return this.$message.error("请至少选择一条数据"); |
|
|
|
|
|
let ids = this.multipleSelection.map((d) => d.id); |
|
|
|
|
|
ids.join(","); |
|
|
|
|
|
this.$confirm("确定要删除选中表格?", "提示", { type: "warning" }) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
const loading = this.$loading({ lock: true }); |
|
|
|
|
|
api |
|
|
|
|
|
.delete(ids) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
loading.close(); |
|
|
|
|
|
this.$message({ type: "success", message: "删除成功" }); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
loading.close(); |
|
|
|
|
|
this.$message.error("删失败"); |
|
|
|
|
|
}); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => 0); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 单个删除 |
|
|
|
|
|
const loading = this.$loading({ lock: true }); |
|
|
|
|
|
api |
|
|
|
|
|
.delete(row.id) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
loading.close(); |
|
|
|
|
|
this.$message({ type: "success", message: "删除成功" }); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
loading.close(); |
|
|
|
|
|
this.$message.error("删除失败"); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
save() { |
|
|
save() { |
|
|
this.$refs["editForm"].validate((valid) => { |
|
|
this.$refs["editForm"].validate((valid) => { |
|
|
console.log(valid) |
|
|
|
|
|
if (valid) { |
|
|
if (valid) { |
|
|
const loading = this.$loading({ lock: true }); |
|
|
const loading = this.$loading({ lock: true }); |
|
|
let action = this.form.id ? "edit" : "add"; |
|
|
let action = this.form.id ? "edit" : "add"; |
|
|
api[action](this.form) |
|
|
api[action](this.form) |
|
|
.then((res) => { |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
|
|
|
.then(() => { |
|
|
loading.close(); |
|
|
loading.close(); |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
type: "success", |
|
|
|
|
|
message: this.form.id ? "修改成功" : "添加成功", |
|
|
|
|
|
}); |
|
|
|
|
|
this.getDataList(this.page); |
|
|
}) |
|
|
}) |
|
|
.catch((e) => { |
|
|
|
|
|
console.log(e) |
|
|
|
|
|
|
|
|
.catch(() => { |
|
|
loading.close(); |
|
|
loading.close(); |
|
|
this.$message.error(this.form.id ? "修改失败" : "添加失败"); |
|
|
this.$message.error(this.form.id ? "修改失败" : "添加失败"); |
|
|
|
|
|
}) |
|
|
|
|
|
.finally(() => { |
|
|
|
|
|
this.showAdd = false; |
|
|
}); |
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
return false; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |