This commit is contained in:
xyc 2025-04-17 15:03:27 +08:00
parent 021640ed3a
commit e384bbcb30

View File

@ -1,7 +1,13 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="学员姓名" prop="userName"> <el-form-item label="学员姓名" prop="userName">
<el-input <el-input
v-model="queryParams.userName" v-model="queryParams.userName"
@ -11,8 +17,16 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -25,33 +39,49 @@
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
>删除</el-button> >删除</el-button
>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="contractList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="合同内容" align="center" prop="content"> <el-table-column label="合同内容" align="center" prop="content">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="viewContentFun(scope.row.content)" type="text" >查看</el-button> <el-button @click="viewContentFun(scope.row)" type="text"
>查看</el-button
>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="学员姓名" align="center" prop="userName" /> <el-table-column label="学员姓名" align="center" prop="userName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
>修改</el-button> >修改</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -80,14 +110,32 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="查看" :visible.sync="viewFlag" width="65%" append-to-body> <el-dialog title="查看" :visible.sync="viewFlag" width="65%" append-to-body>
<div style="box-sizing: border-box;padding: 15px;overflow: hidden" v-html="content"></div> <div
style="box-sizing: border-box; padding: 15px; overflow: hidden"
v-html="content"
></div>
<div style="text-align: right;" v-if="userUrl">
<el-image
:src="baseImageUrl + userUrl"
fit="cover"
:preview-src-list="[baseImageUrl + userUrl]"
lazy
alt="身份证照片"
/>
</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listContract, getContract, delContract, addContract, updateContract } from "./api/contract"; import {
import editor from '@/components/Editor/index.vue' listContract,
getContract,
delContract,
addContract,
updateContract,
} from "./api/contract";
import editor from "@/components/Editor/index.vue";
export default { export default {
name: "Contract", name: "Contract",
@ -121,13 +169,14 @@ export default {
deptId: null, deptId: null,
userId: null, userId: null,
content: null, content: null,
userName: null userName: null,
}, },
baseImageUrl: "http://122.51.230.86:9000/",
userUrl: "",
// //
form: {}, form: {},
// //
rules: { rules: {},
}
}; };
}, },
created() { created() {
@ -135,13 +184,15 @@ export default {
}, },
methods: { methods: {
viewContentFun(data) { viewContentFun(data) {
this.content = data; console.log(data, "111");
this.viewFlag = true this.content = data.content;
this.userUrl = data.userUrl;
this.viewFlag = true;
}, },
/** 查询驾校合同列表 */ /** 查询驾校合同列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listContract(this.queryParams).then(response => { listContract(this.queryParams).then((response) => {
this.contractList = response.data.records; this.contractList = response.data.records;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
@ -163,7 +214,7 @@ export default {
createBy: null, createBy: null,
updateTime: null, updateTime: null,
updateBy: null, updateBy: null,
userName: null userName: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -179,9 +230,9 @@ export default {
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length!==1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
@ -192,8 +243,8 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getContract(id).then(response => { getContract(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改驾校合同"; this.title = "修改驾校合同";
@ -201,16 +252,16 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateContract(this.form).then(response => { updateContract(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addContract(this.form).then(response => { addContract(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -222,19 +273,27 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除驾校合同编号为"' + ids + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除驾校合同编号为"' + ids + '"的数据项?')
.then(function () {
return delContract(ids); return delContract(ids);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/driveSchool/contract/export', { this.download(
...this.queryParams "system/driveSchool/contract/export",
}, `contract_${new Date().getTime()}.xlsx`) {
} ...this.queryParams,
} },
`contract_${new Date().getTime()}.xlsx`
);
},
},
}; };
</script> </script>