|
|
@@ -3,9 +3,7 @@ |
|
|
|
<el-card shadow="never"> |
|
|
|
<search :search-params="searchParams" /> |
|
|
|
<div class="operating"> |
|
|
|
<el-button size="small" type="warning" @click="showAdd == true" |
|
|
|
>新增</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> |
|
|
|
</div> |
|
|
@@ -13,7 +11,7 @@ |
|
|
|
highlight-current-row |
|
|
|
:data="dataList" |
|
|
|
border |
|
|
|
height="calc(100vh - 360px)" |
|
|
|
:height="tableHeight" |
|
|
|
> |
|
|
|
<el-table-column |
|
|
|
type="selection" |
|
|
@@ -30,31 +28,37 @@ |
|
|
|
label="考核年度" |
|
|
|
min-width="80" |
|
|
|
align="center" |
|
|
|
prop="year" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="表编号" |
|
|
|
min-width="80" |
|
|
|
align="center" |
|
|
|
prop="code" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="表格名称" |
|
|
|
min-width="100" |
|
|
|
align="center" |
|
|
|
prop="name" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="备注" |
|
|
|
min-width="100" |
|
|
|
align="center" |
|
|
|
prop="note" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="创建时间" |
|
|
|
min-width="100" |
|
|
|
align="center" |
|
|
|
prop="createTime" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="创建人" |
|
|
|
min-width="80" |
|
|
|
align="center" |
|
|
|
prop="createUser" |
|
|
|
></el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="操作" |
|
|
@@ -72,46 +76,46 @@ |
|
|
|
class="ele-pagination-circle" |
|
|
|
/> |
|
|
|
</el-card> |
|
|
|
<el-dialog title="添加表" :visible.sync="showAdd" width="600px"> |
|
|
|
<el-dialog |
|
|
|
title="添加表" |
|
|
|
:visible.sync="showAdd" |
|
|
|
width="400px" |
|
|
|
custom-class="ele-dialog-form" |
|
|
|
> |
|
|
|
<el-form |
|
|
|
:model="form" |
|
|
|
label-width="82px" |
|
|
|
custom-class="editForm" |
|
|
|
@keyup.enter.native="save" |
|
|
|
@submit.native.prevent |
|
|
|
ref="editForm" |
|
|
|
:rules="rules" |
|
|
|
> |
|
|
|
<el-row :gutter="15"> |
|
|
|
<el-col :sm="12"> |
|
|
|
<el-form-item label="考核年度:"> |
|
|
|
<el-input></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form label="表格名称:"> |
|
|
|
<el-input placeholder="请输入如表格编号"></el-input> |
|
|
|
</el-form> |
|
|
|
<el-form label="创建时间:"> |
|
|
|
<el-input placeholder="请输入如表格编号"></el-input> |
|
|
|
</el-form> |
|
|
|
</el-col> |
|
|
|
<el-col :sm="12"> |
|
|
|
<el-form-item label="表编号:"> |
|
|
|
<el-input></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form label="备注:"> |
|
|
|
<el-input placeholder="请输入如表格编号"></el-input> |
|
|
|
</el-form> |
|
|
|
<el-form label="创建人:"> |
|
|
|
<el-input placeholder="请输入如表格编号"></el-input> |
|
|
|
</el-form> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-form-item label="考核年度:" prop="year"> |
|
|
|
<el-date-picker type="year" placeholder="选择考核年度" style="width:100%" clearable v-model="form.year"> |
|
|
|
</el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="表格名称:" prop="name"> |
|
|
|
<el-input placeholder="请输入如表格名称" clearable v-model="form.name"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="表编号:" prop='code'> |
|
|
|
<el-input placeholder="请输入表编号" clearable v-model="form.code"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="备注:"> |
|
|
|
<el-input type="textarea" :rows="4" v-model="form.note"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div slot="footer"> |
|
|
|
<el-button @click="showAdd = false">取消</el-button> |
|
|
|
<el-button type="primary" @click="save">保存</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import search from "./search"; |
|
|
|
import api from "@/api/basicTable/category"; |
|
|
|
import api from "@/api/basicTable/category.js"; |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
search, |
|
|
@@ -119,21 +123,72 @@ export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
searchParams: {}, |
|
|
|
dataList: [], |
|
|
|
dataList: [ |
|
|
|
{ code: "fadfadf", name: "fadfadf", note: "fdafa", year: "fdfadf" }, |
|
|
|
], |
|
|
|
count: 0, |
|
|
|
page: { |
|
|
|
page: 1, |
|
|
|
limit: 10, |
|
|
|
limit: Math.floor((document.documentElement.clientHeight - 360-45) / 45), |
|
|
|
}, |
|
|
|
showAdd: false, |
|
|
|
form: {}, |
|
|
|
tableHeight: document.documentElement.clientHeight - 360, |
|
|
|
rules: { |
|
|
|
code: [{ required: true, message: "表编号", trigger: "blur" }], |
|
|
|
name: [{ required: true, message: "请输入表格名称", trigger: "blur" }], |
|
|
|
year: [{ required: true, message: "请输入考核年度" }], |
|
|
|
}, |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
|
api.getList(); |
|
|
|
this.getDataList(this.page); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
add() {}, |
|
|
|
getDataList(params) { |
|
|
|
const loading = this.$loading({ lock: true }); |
|
|
|
api |
|
|
|
.getList(params) |
|
|
|
.then((res) => { |
|
|
|
loading.close(); |
|
|
|
this.dataList = res.data.data.records; |
|
|
|
this.count=res.data.data.total |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
loading.close(); |
|
|
|
this.dataList = []; |
|
|
|
this.count=0 |
|
|
|
}); |
|
|
|
}, |
|
|
|
add(row) { |
|
|
|
console.log(row) |
|
|
|
this.form = { code: "", name: "", note: "", year: "" }; |
|
|
|
this.showAdd = true; |
|
|
|
}, |
|
|
|
edit(row) { |
|
|
|
console.log(row) |
|
|
|
this.form = Object.assign({}, row); |
|
|
|
this.showAdd = true; |
|
|
|
}, |
|
|
|
save() { |
|
|
|
this.$refs["editForm"].validate((valid) => { |
|
|
|
console.log(valid) |
|
|
|
if (valid) { |
|
|
|
const loading = this.$loading({ lock: true }); |
|
|
|
let action = this.form.id ? "edit" : "add"; |
|
|
|
api[action](this.form) |
|
|
|
.then((res) => { |
|
|
|
console.log(res); |
|
|
|
loading.close(); |
|
|
|
}) |
|
|
|
.catch((e) => { |
|
|
|
console.log(e) |
|
|
|
loading.close(); |
|
|
|
this.$message.error(this.form.id ? "修改失败" : "添加失败"); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |