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>
<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-input
v-model="queryParams.userName"
@ -11,8 +17,16 @@
/>
</el-form-item>
<el-form-item>
<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-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>
@ -25,39 +39,55 @@
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
>删除</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</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 label="合同内容" align="center" prop="content">
<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>
</el-table-column>
<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">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@ -68,7 +98,7 @@
<el-dialog :title="title" :visible.sync="open" width="750px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="合同内容">
<editor v-model="form.content" :min-height="192"/>
<editor v-model="form.content" :min-height="192" />
</el-form-item>
<el-form-item label="学员姓名" prop="userName">
<el-input v-model="form.userName" placeholder="请输入学员姓名" />
@ -79,23 +109,41 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<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>
<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="text-align: right;" v-if="userUrl">
<el-image
:src="baseImageUrl + userUrl"
fit="cover"
:preview-src-list="[baseImageUrl + userUrl]"
lazy
alt="身份证照片"
/>
</div>
</el-dialog>
</div>
</template>
<script>
import { listContract, getContract, delContract, addContract, updateContract } from "./api/contract";
import editor from '@/components/Editor/index.vue'
import {
listContract,
getContract,
delContract,
addContract,
updateContract,
} from "./api/contract";
import editor from "@/components/Editor/index.vue";
export default {
name: "Contract",
components: {editor},
components: { editor },
data() {
return {
viewFlag:false,
content:"",
viewFlag: false,
content: "",
//
loading: true,
//
@ -121,27 +169,30 @@ export default {
deptId: null,
userId: null,
content: null,
userName: null
userName: null,
},
baseImageUrl: "http://122.51.230.86:9000/",
userUrl: "",
//
form: {},
//
rules: {
}
rules: {},
};
},
created() {
this.getList();
},
methods: {
viewContentFun(data){
this.content = data;
this.viewFlag = true
viewContentFun(data) {
console.log(data, "111");
this.content = data.content;
this.userUrl = data.userUrl;
this.viewFlag = true;
},
/** 查询驾校合同列表 */
getList() {
this.loading = true;
listContract(this.queryParams).then(response => {
listContract(this.queryParams).then((response) => {
this.contractList = response.data.records;
this.total = response.data.total;
this.loading = false;
@ -163,7 +214,7 @@ export default {
createBy: null,
updateTime: null,
updateBy: null,
userName: null
userName: null,
};
this.resetForm("form");
},
@ -179,9 +230,9 @@ export default {
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
@ -192,8 +243,8 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getContract(id).then(response => {
const id = row.id || this.ids;
getContract(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改驾校合同";
@ -201,16 +252,16 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateContract(this.form).then(response => {
updateContract(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addContract(this.form).then(response => {
addContract(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -222,19 +273,27 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除驾校合同编号为"' + ids + '"的数据项?').then(function() {
return delContract(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm('是否确认删除驾校合同编号为"' + ids + '"的数据项?')
.then(function () {
return delContract(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/driveSchool/contract/export', {
...this.queryParams
}, `contract_${new Date().getTime()}.xlsx`)
}
}
this.download(
"system/driveSchool/contract/export",
{
...this.queryParams,
},
`contract_${new Date().getTime()}.xlsx`
);
},
},
};
</script>