This commit is contained in:
“hhk” 2024-08-08 20:11:30 +08:00
commit 2bc71eb413
9 changed files with 417 additions and 24 deletions

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 创建合同模板
export function createContTemp(data) {
return request({
url: '/base/cont-temp/create',
method: 'post',
data: data
})
}
// 更新合同模板
export function updateContTemp(data) {
return request({
url: '/base/cont-temp/update',
method: 'put',
data: data
})
}
// 删除合同模板
export function deleteContTemp(id) {
return request({
url: '/base/cont-temp/delete?id=' + id,
method: 'delete'
})
}
// 获得合同模板
export function getContTemp(id) {
return request({
url: '/base/cont-temp/get?id=' + id,
method: 'get'
})
}
// 获得合同模板分页
export function getContTempPage(params) {
return request({
url: '/base/cont-temp/page',
method: 'get',
params
})
}
// 导出合同模板 Excel
export function exportContTempExcel(params) {
return request({
url: '/base/cont-temp/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -1,9 +1,9 @@
<template>
<el-alert v-if="enable()" type="success" show-icon>
<template slot="title">
<div @click="goToUrl">{{ '' + title + '文档地址' + url }}</div>
</template>
</el-alert>
<!-- <el-alert v-if="enable()" type="success" show-icon>-->
<!-- <template slot="title">-->
<!-- <div @click="goToUrl">{{ '' + title + '文档地址' + url }}</div>-->
<!-- </template>-->
<!-- </el-alert>-->
</template>
<script>

View File

@ -108,6 +108,12 @@ export const DICT_TYPE = {
DICT_BASE_LABEL_TYPE : 'base_label_type',
//业务分类
DICT_BASE_LABEL_BUSI_TYPE : 'label_busi_type',
//合同模板类型
DICT_BASE_CONT_TEMP_TYPE : 'cont_temp_type',
//合同使用场景
DICT_BASE_CONT_TEMP_USE : 'cont_temp_use',
//合同是否有效
DICT_BASE_CONT_IS_VALID : 'cont_is_valid',
}
/**

View File

@ -0,0 +1,147 @@
<template>
<div class="app-container">
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
<el-row :gutter="1">
<el-col :span="5">
<el-form-item label="模板名称" prop="tempName">
<el-input v-model="formData.tempName" placeholder="请输入模板名称"/>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="模板编码" prop="tempCode">
<el-input v-model="formData.tempCode" placeholder="请输入模板编码"/>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="模板类型" prop="tempType">
<el-select v-model="formData.tempType" placeholder="请选择模板类型" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_BASE_CONT_TEMP_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="模板用途" prop="tempUse">
<el-select v-model="formData.tempUse" placeholder="请选择模板类型" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_BASE_CONT_TEMP_USE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="模板内容">
<Editor :height="500" v-model="formData.tempContent" :min-height="192"/>
</el-form-item>
</el-form>
<div slot="footer" style="text-align: right;" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="close()"> </el-button>
</div>
</div>
</template>
<script>
import * as ContTempApi from '@/api/base/cont';
import Editor from '@/components/Editor';
export default {
name: "ContTempForm",
components: {
Editor,
},
data() {
return {
// 12
formLoading: false,
//
formData: {
id: undefined,
tempCode: undefined,
tempType: undefined,
tempUse: undefined,
tempName: undefined,
isValid: undefined,
status: undefined,
tempContent: undefined,
},
//
formRules: {
tempName: [
{ required: true, message: '请输入模板名称', trigger: 'blur' },
],
tempCode: [
{ required: true, message: '请输入模板编码', trigger: 'blur' },
],
tempType: [
{ required: true, message: '请选择模板类型', trigger: 'blur' },
],
tempUse: [
{ required: true, message: '请选择模板用途', trigger: 'blur' },
],
},
};
},
created() {
const id = this.$route.params.id
this.open(id)
},
methods: {
close(){
this.$router.go(-1);
},
/** 打开弹窗 */
async open(id) {
this.reset();
//
if (id) {
this.formLoading = true;
try {
const res = await ContTempApi.getContTemp(id);
this.formData = res.data;
} finally {
this.formLoading = false;
}
}
},
/** 提交按钮 */
async submitForm() {
debugger
//
await this.$refs["formRef"].validate();
this.formLoading = true;
try {
const data = this.formData;
//
if (data.id) {
await ContTempApi.updateContTemp(data);
this.$modal.msgSuccess("修改成功");
this.$router.go(-1);
return;
}
//
await ContTempApi.createContTemp(data);
this.$modal.msgSuccess("新增成功");
this.$router.go(-1);
} finally {
this.formLoading = false;
}
},
/** 表单重置 */
reset() {
this.formData = {
id: undefined,
tempCode: undefined,
tempType: undefined,
tempUse: undefined,
tempName: undefined,
isValid: undefined,
status: undefined,
tempContent: undefined,
};
debugger
this.resetForm("formRef");
}
}
};
</script>

View File

@ -0,0 +1,202 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="模板名称" prop="tempName">
<el-input v-model="queryParams.tempName" placeholder="请输入模板名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="模板类型" prop="tempType">
<el-select v-model="queryParams.tempType" placeholder="请选择模板类型" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_BASE_CONT_TEMP_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="模板用途" prop="tempUse">
<el-select v-model="queryParams.tempUse" placeholder="请选择模板类型" @keyup.enter.native="handleQuery">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_BASE_CONT_TEMP_USE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
v-hasPermi="['base:cont-temp:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['base:cont-temp:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="模板名称" align="center" prop="tempName"/>
<el-table-column label="模板编码" align="center" prop="tempCode"/>
<el-table-column label="模板类型" align="center" prop="tempType">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.DICT_BASE_CONT_TEMP_TYPE" :value="scope.row.tempType" />
</template>
</el-table-column>
<el-table-column label="模板用途" align="center" prop="tempUse">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.DICT_BASE_CONT_TEMP_USE" :value="scope.row.tempUse" />
</template>
</el-table-column>
<el-table-column label="是否有效" align="center" prop="isValid">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.DICT_BASE_CONT_IS_VALID" :value="scope.row.isValid" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button v-if="scope.row.isValid == '0'" size="mini" type="text" icon="el-icon-open" @click="valid(scope.row.id,'1')"
v-hasPermi="['base:cont-temp:update']">启用
</el-button>
<el-button v-if="scope.row.isValid == '1'" size="mini" type="text" icon="el-icon-open" @click="valid(scope.row.id,'0')"
v-hasPermi="['base:cont-temp:update']">停用
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
v-hasPermi="['base:cont-temp:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:cont-temp:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<!-- <ContTempForm ref="formRef" @success="getList"/>-->
</div>
</template>
<script>
import * as ContTempApi from '@/api/base/cont';
export default {
name: "ContTemp",
components: {
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
isExpandAll: true,
//
refreshTable: true,
//
currentRow: {},
//
queryParams: {
pageNo: 1,
pageSize: 10,
tempCode: null,
tempType: null,
tempUse: null,
tempName: null,
isValid: null,
status: null,
tempContent: null,
createTime: [],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
async getList() {
try {
this.loading = true;
const res = await ContTempApi.getContTempPage(this.queryParams);
this.list = res.data.records;
this.total = res.data.total;
} finally {
this.loading = false;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 添加/修改操作 */
openForm(id) {
this.$router.push({
name: "ContTempForm",
params:{
id: id
}
});
// this.$refs["formRef"].open(id);
},
/**
* 启用/停用
*/
async valid(id,isValid){
let formData = {
id:id,
isValid:isValid
}
await ContTempApi.updateContTemp(formData);
this.$modal.msgSuccess("操作成功");
this.getList()
},
/** 删除按钮操作 */
async handleDelete(row) {
const id = row.id;
await this.$modal.confirm('是否确认删除合同模板名称为"' + row.tempName + '"的数据项?')
try {
await ContTempApi.deleteContTemp(id);
await this.getList();
this.$modal.msgSuccess("删除成功");
} catch {
}
},
/** 导出按钮操作 */
async handleExport() {
await this.$modal.confirm('是否确认导出所有合同模板数据项?');
try {
this.exportLoading = true;
const data = await ContTempApi.exportContTempExcel(this.queryParams);
this.$download.excel(data, '合同模板.xls');
} catch {
} finally {
this.exportLoading = false;
}
},
}
};
</script>

View File

@ -12,11 +12,6 @@
<el-form-item label="身份证号" prop="idCard">
<el-input v-model="queryParams.idCard" placeholder="请输入身份证号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="客户状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择客户状态" clearable size="small">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
@ -45,7 +40,7 @@
size="mini"
style="width: 100%">
<el-table-column align="center" prop="cusName" label="经办人姓名" width="100"/>
<el-table-column width="50" label="性别" align="center" prop="sex">
<el-table-column width="60" label="性别" align="center" prop="sex">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="scope.row.sex"/>
</template>

View File

@ -12,11 +12,6 @@
<el-form-item label="身份证号" prop="idCard">
<el-input v-model="queryParams.idCard" placeholder="请输入身份证号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="客户状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择客户状态" clearable size="small">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
@ -40,7 +35,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column width="50" label="性别" align="center" prop="sex">
<el-table-column width="60" label="性别" align="center" prop="sex">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="scope.row.sex" />
</template>

View File

@ -12,11 +12,6 @@
<el-form-item label="身份证号" prop="idCard">
<el-input v-model="queryParams.idCard" placeholder="请输入身份证号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="客户状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择客户状态" clearable size="small">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
@ -35,7 +30,7 @@
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column width="100" label="客户名称" align="center" prop="cusName"/>
<el-table-column width="50" label="性别" align="center" prop="sex">
<el-table-column width="60" label="性别" align="center" prop="sex">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="scope.row.sex" />
</template>

View File

@ -11,7 +11,7 @@ export default {
components: { iFrame },
data() {
return {
url: 'http://127.0.0.1:3000',
url: 'http://192.168.1.17:3000',
};
},
};