parent
bc69b41660
commit
e5e3296569
@ -0,0 +1,292 @@
|
||||
<template>
|
||||
<div class="L-public-main" id="L-size-main" v-if="false">
|
||||
<div class="L-main">
|
||||
<header id="L-header">
|
||||
<el-form :inline="true" :model="formInline" size="small" class="demo-form-inline" ref="queryFrom">
|
||||
<el-col :span="22">
|
||||
<el-form-item label="规则名称:" prop="enterpriseName">
|
||||
<el-input v-model.trim="formInline.enterpriseName" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="mini" @click="resetQuery('queryFrom')">重置</el-button>
|
||||
<el-button size="mini" type="primary" @click="handleQuery('queryFrom')">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<!-- <el-button type="primary" class="import-btn" icon="icon iconfont icon-jc-shangchuan" size="mini" @click="importBtn">新增发文</el-button> -->
|
||||
<el-button type="primary" class="import-btn" icon="el-icon-plus" size="mini" @click="importBtn">新增智能提醒规则</el-button>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</header>
|
||||
<section>
|
||||
<el-table v-loading="loading" :data="tableData" :row-class-name="tableRowClassName" :height="tabHeader" :max-height="tabHeader">
|
||||
<el-table-column label="规则名称" prop="enterpriseName" />
|
||||
<el-table-column label="提醒对象" prop="enterpriseCode" />
|
||||
<el-table-column label="提醒方式" prop="contactName" />
|
||||
<el-table-column label="提醒时间" prop="contactOffice" />
|
||||
<el-table-column label="修改时间" prop="contactPhone" />
|
||||
<!-- <el-table-column label="常用联系人邮箱" prop="contactEmail" /> -->
|
||||
<el-table-column label="操作" prop="userId" class-name="table-operation" width="180px">
|
||||
<template slot-scope="scope">
|
||||
<span class="look-info" @click="goInfo(scope.row)">查看详情</span>
|
||||
<span class="edit-info" @click="editInfo(scope.row)" v-hasRole="['ent']">修改</span>
|
||||
<span class="del-info" @click="delInfo(scope.row)" v-hasRole="['ent']">删除</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<my-pagination
|
||||
id="L-pagination"
|
||||
:total="total"
|
||||
:page="pagination.current"
|
||||
:limit="pagination.size"
|
||||
@pagination="getPagination"
|
||||
:current-page.sync="pagination.current"
|
||||
></my-pagination>
|
||||
</section>
|
||||
</div>
|
||||
<my-dialog :title="title" @close="importClose" @confirm="confirm" ref="importProject" closeText="关闭" :myclass="true">
|
||||
<el-form :model="addFrom" size="small" ref="importFrom" label-width="180px" :rules="rules" class="newArticle" :disabled="title == '查看常用联系人' ? true : false">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="提醒规则标题" class="importFormItem">
|
||||
<el-input v-model.trim="addFrom.enterpriseCode" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="企业名称:" class="importFormItem">
|
||||
<el-input v-model.trim="addFrom.enterpriseName" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="常用联系人名称:" class="importFormItem" prop="contactName">
|
||||
<el-input v-model.trim="addFrom.contactName" placeholder="请输入常用联系人名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="常用联系人公司职务:" class="importFormItem" prop="contactOffice">
|
||||
<el-input v-model.trim="addFrom.contactOffice" placeholder="请输入常用联系人公司职务"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="常用联系人手机号码:" class="importFormItem" prop="contactPhone">
|
||||
<el-input v-model.trim="addFrom.contactPhone" placeholder="请输入常用联系人手机号码"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="常用联系人邮箱:" class="importFormItem" prop="contactEmail">
|
||||
<el-input v-model.trim="addFrom.contactEmail" placeholder="请输入常用联系人邮箱"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</my-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import myPagination from "@/views/components/Pagination/index.vue"
|
||||
import myDialog from "@/views/components/myDialog/index.vue"
|
||||
import { getJEnterpriseContact, jEnterpriseContactNew, jEnterpriseContactChange, jEnterpriseContactId, jEnterpriseContactDel } from "@/api/jin_ji_hu/infoMaintain"
|
||||
export default {
|
||||
components:{myPagination, myDialog},
|
||||
data() {
|
||||
return {
|
||||
total:0,
|
||||
pagination: {
|
||||
current:1,
|
||||
size:10,
|
||||
},
|
||||
loading:false,
|
||||
formInline: {
|
||||
enterpriseName: '',
|
||||
enterpriseCode:"",
|
||||
},
|
||||
tableData:[],
|
||||
tabHeader: undefined,
|
||||
addFrom: {
|
||||
contactName:"",
|
||||
contactOffice:"",
|
||||
contactPhone:"",
|
||||
contactEmail:"",
|
||||
enterpriseCode:"",
|
||||
enterpriseName:"",
|
||||
},
|
||||
rules:{
|
||||
contactName:[
|
||||
{ required: true, message: '请填写常用联系人姓名', trigger: 'blur' }
|
||||
],
|
||||
contactOffice:[
|
||||
{ required: true, message: '请填写常用联系人公司职务', trigger: 'blur' }
|
||||
],
|
||||
contactPhone:[
|
||||
{ required: true, message: '请填写常用联系人手机号码', trigger: 'blur' },
|
||||
],
|
||||
contactEmail:[
|
||||
{ required: true, message: '请填写常用联系人邮箱', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
title:"新增智能提醒规则",
|
||||
infoVisible:false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.cancalDebounce();
|
||||
window.addEventListener('resize', this.cancalDebounce);
|
||||
},
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.cancalDebounce);
|
||||
},
|
||||
methods:{
|
||||
// 列表获取
|
||||
getList(){
|
||||
this.loading = true;
|
||||
getJEnterpriseContact(this.pagination).then(res=>{
|
||||
this.loading = false;
|
||||
this.total = res.data.total;
|
||||
this.tableData = res.data.records;
|
||||
})
|
||||
},
|
||||
// 获取页码
|
||||
getPagination(pages) {
|
||||
this.pagination.current = pages.page;
|
||||
this.pagination.size = pages.limit;
|
||||
this.getList();
|
||||
},
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.pagination.current = 1;
|
||||
this.pagination.size = 10;
|
||||
this.pagination = { ...this.pagination,...this.formInline };
|
||||
// console.log(this.pagination);
|
||||
// console.log(this.formInline);
|
||||
this.getList();
|
||||
},
|
||||
// 重置
|
||||
resetQuery(formName){
|
||||
this.$nextTick(() => {
|
||||
this.$refs[formName].resetFields();
|
||||
this.pagination = {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
// 修改table背景色
|
||||
tableRowClassName({row, rowIndex}){
|
||||
if (rowIndex % 2 !== 0) {
|
||||
return 'evenNumber-row';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
// 新增联系人
|
||||
importBtn(){
|
||||
this.title = "新增智能提醒规则";
|
||||
this.addFrom.enterpriseCode = this.name;
|
||||
this.addFrom.enterpriseName = this.nickName;
|
||||
this.$refs.importProject.open();
|
||||
},
|
||||
// 关闭事件触发
|
||||
importClose(){
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.importFrom.resetFields();
|
||||
this.$refs.importProject.close();
|
||||
this.addFrom = {
|
||||
contactName:"",
|
||||
contactOffice:"",
|
||||
contactPhone:"",
|
||||
contactEmail:"",
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查看详情
|
||||
goInfo(row){
|
||||
this.title = "查看智能提醒规则"
|
||||
jEnterpriseContactId(row.id).then((res=>{
|
||||
if(res.code == 200) {
|
||||
this.addFrom = res.data;
|
||||
this.$refs.importProject.open();
|
||||
}
|
||||
}))
|
||||
},
|
||||
// 编辑
|
||||
editInfo(row){
|
||||
this.title = "修改智能提醒规则"
|
||||
// this.addFrom.enterpriseCode = this.name;
|
||||
// this.addFrom.enterpriseName = this.nickName;
|
||||
jEnterpriseContactId(row.id).then((res)=>{
|
||||
if(res.code == 200) {
|
||||
this.addFrom = res.data;
|
||||
this.$refs.importProject.open();
|
||||
}
|
||||
})
|
||||
},
|
||||
// 提交按钮
|
||||
confirm(){
|
||||
this.$refs.importFrom.validate((valid) => {
|
||||
if (valid) {
|
||||
// console.log(this.addFrom);
|
||||
let id = this.addFrom.id ? this.addFrom.id : null;
|
||||
if(id) {
|
||||
jEnterpriseContactChange(this.addFrom).then((res)=>{
|
||||
if(res.code == 200) {
|
||||
this.getList();
|
||||
this.importClose();
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "修改成功!",
|
||||
});
|
||||
}
|
||||
})
|
||||
} else {
|
||||
jEnterpriseContactNew(this.addFrom).then((res)=>{
|
||||
if(res.code == 200) {
|
||||
this.getList();
|
||||
this.importClose();
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "新增成功!",
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除
|
||||
delInfo(row){
|
||||
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
jEnterpriseContactDel({ id: row.id }).then((res) => {
|
||||
this.getList();
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "删除成功!",
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: "info",
|
||||
message: "已取消删除",
|
||||
});
|
||||
});
|
||||
},
|
||||
// 屏幕尺寸变化
|
||||
cancalDebounce(){
|
||||
const element = document.getElementById('L-size-main'); // 通过元素的 ID 获取元素
|
||||
const header = document.getElementById('L-header'); // 通过元素的 ID 获取元素
|
||||
const pagination = document.getElementById('L-pagination'); // 通过元素的 ID 获取元素
|
||||
const elementHeight = element.offsetHeight;
|
||||
const headerHeight = header.offsetHeight;
|
||||
const paginationtHeight = pagination.offsetHeight;
|
||||
this.tabHeader = elementHeight - headerHeight - paginationtHeight - 140;
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
Loading…
Reference in new issue