<template>
|
<div class="help_doc_list_main">
|
<SearchCondition ref="condRef"
|
:info="info"
|
:conForm="conForm"
|
:isShowDetail="isShowDetail"
|
:screenWidth="screenWidth"
|
:buttonsList="[1, 2]"
|
@handleOnSeach="handleOnSeach"
|
@handleOnRest="handleOnRest"
|
@handleClick="isShowDetail = !isShowDetail" />
|
<div />
|
<el-row class="add-button">
|
<el-col :span="24">
|
<el-button type="primary"
|
size="small"
|
icon="el-icon-circle-plus-outline"
|
@click="handleAddPage"
|
class="add-btn">新增</el-button>
|
</el-col>
|
</el-row>
|
<ProTable :isAutoIndex="true"
|
:header="tableHeader"
|
:list="records"
|
:loading="loading"
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange" />
|
<el-dialog :title="dialogTitle"
|
:visible.sync="dialogVisible"
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
:destroy-on-close="true"
|
:show-close="false"
|
width="1000"
|
center
|
custom-class="help_doc_dialog">
|
<CreateForms ref="doclist"
|
v-if="dialogVisible"
|
:isReset="true"
|
:isView="isView"
|
:isShowBorder="isShowBorder"
|
:screenWidth="1000"
|
:formItems="formItems"
|
:defValues="defValues"
|
:formRules="formRules" />
|
<span slot="footer"
|
class="dialog-footer">
|
<el-button @click="handleDialogCancel">{{
|
isView ? "关 闭" : "取 消"
|
}}</el-button>
|
<el-button type="primary"
|
v-if="!isView"
|
@click="saveBoardInfo">确 定</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog title="删除确认"
|
:visible.sync="delDialogVisible"
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
:destroy-on-close="true"
|
:show-close="false"
|
width="450"
|
center
|
custom-class="help_doc_tip_dialog del_dialog">
|
<div style="text-align: center">
|
请确认是否删除白名单?
|
</div>
|
<span slot="footer"
|
class="dialog-footer">
|
<el-button @click="delDialogVisible = false">取 消</el-button>
|
<el-button type="primary"
|
@click="deleteRiskWhite">确 定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
// 风控-白名单添加
|
import { Message } from "element-ui";
|
import { RISKWHITE, RISKWHITEDEF } from "./configs/condtion.config";
|
import { RISKWHITECOLUMN } from "./configs/column.config";
|
import { RISKWHITEFORMS } from "./configs/formItem.config";
|
import { RISKWHITERULES } from "./configs/rules.config";
|
import { RISKWHITEDEFVALUES } from "./configs/defValues.config";
|
import ProTable from "../components/ProTable";
|
import CreateForms from "../components/CreateForms";
|
import SearchCondition from "../components/SearchCondition";
|
import {
|
qryRiskWhiteList,
|
saveRiskWhite,
|
getAttachMentList,
|
deleteRiskWhite,
|
qryDropDownOptionBatch,
|
} from "../../http/api";
|
export default {
|
data() {
|
return {
|
info: [...RISKWHITE],
|
formItems: [...RISKWHITEFORMS],
|
formRules: { ...RISKWHITERULES },
|
defValues: { ...RISKWHITEDEFVALUES },
|
tableHeader: [...RISKWHITECOLUMN],
|
conForm: { ...RISKWHITEDEF },
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0,
|
},
|
records: [],
|
contenttypeOptions: [],
|
ispublishOptions: [],
|
publishscopeOptions: [],
|
newTypeno: "",
|
screenWidth: document.body.offsetWidth,
|
condtionValue: {}, // 表单value集合
|
downOptionBatch: {},
|
isShowBorder: true,
|
serialno: "",
|
dialogTitle: "新增",
|
dialogVisible: false,
|
isShowDetail: false, // 是否显示所有表单项
|
isView: false,
|
loading: false,
|
delDialogVisible: false,
|
YesNoOption: [
|
{ value: "1", label: "有效" },
|
{ value: "0", label: "无效" },
|
]
|
};
|
},
|
components: {
|
SearchCondition,
|
ProTable,
|
CreateForms,
|
},
|
created() {
|
},
|
mounted() {
|
window.addEventListener("resize", this.getScreenWidth);
|
this.getconfigInfo();
|
this.getBoardList();
|
const date = this.dateFormat('YYYY/mm/dd', new Date())
|
this.defValues.starttime = RISKWHITEDEFVALUES.starttime = date
|
},
|
destroyed() {
|
window.removeEventListener("resize", this.getScreenWidth);
|
},
|
methods: {
|
async getconfigInfo() {
|
const options = {
|
productidarray: "productList",
|
productid: "productList",
|
status: "YesNoOption",
|
};
|
const params = Object.values(options);
|
|
const re = await qryDropDownOptionBatch(params);
|
if (re.code && re.code === "00") {
|
const downOption = { ...re.result, YesNoOption: this.YesNoOption };
|
this.downOptionBatch = downOption;
|
this.info = [...RISKWHITE].map((form) => {
|
const newForm = { ...form };
|
// newForm.readonly = true;
|
// newForm.placeholder = "";
|
if (newForm.type === "select" || newForm.type === "multipleSelect") {
|
newForm.options = downOption[options[newForm.name]];
|
}
|
return newForm;
|
});
|
this.formItems = [...RISKWHITEFORMS].map((form) => {
|
const newForm = { ...form };
|
if (newForm.type === "select" || newForm.type === "multipleSelect") {
|
newForm.options = downOption[options[newForm.name]];
|
}
|
return newForm;
|
});
|
}
|
},
|
async saveBoardInfo() {
|
const passValidate = await this.vailateForm()
|
if (!passValidate) {
|
return false;
|
}
|
|
const formRef = this.$refs.doclist;
|
let params = formRef.$refs["createForm"].model;
|
this.getProductName(params)
|
saveRiskWhite(params).then((res) => {
|
if (res.code === "00") {
|
this.$message.success("保存成功!");
|
// this.formItems = [...RISKWHITEFORMS];
|
this.defValues = { ...RISKWHITEDEFVALUES };
|
this.formRules = { ...RISKWHITERULES };
|
this.serialno = "";
|
this.dialogVisible = false;
|
this.getBoardList();
|
}
|
});
|
},
|
// 获取产品名称
|
getProductName(params) {
|
const product = this.downOptionBatch.productList.find(item => {
|
return item.value === params.productid
|
})
|
params.productname = product.label || ''
|
},
|
// 校验规则
|
async vailateForm() {
|
return new Promise((resolve, reject) => {
|
const formRef = this.$refs.doclist;
|
formRef.$refs["createForm"].validate(async valid => {
|
if (valid) {
|
resolve(true)
|
} else {
|
this.$message.error("请完善必填项!");
|
resolve(false)
|
}
|
});
|
|
})
|
},
|
// 获取列表
|
async getBoardList() {
|
const loading = this.$loading({
|
lock: true,
|
text: "",
|
background: "hsla(0,0%,100%,.9)",
|
});
|
const { currentPage, pageSize } = this.pageInfo;
|
const params = {
|
...this.condtionValue,
|
pageSize,
|
currentPage,
|
};
|
const listRes = await qryRiskWhiteList({ ...params });
|
loading.close();
|
if (listRes.code && listRes.code === "00") {
|
const newList =
|
listRes.result &&
|
listRes.result.records.map((item) => {
|
const newItem = { ...item };
|
newItem.statusDesc = item.status == "1" ? "有效" : "无效";
|
newItem.operationOption = [
|
// { label: "详情", type: "DETAIL", value: true },
|
{ label: "修改", type: "EDIT", value: true },
|
{ label: "删除", type: "DELETE", value: true },
|
];
|
return newItem;
|
});
|
this.$set(this, "records", newList);
|
this.$set(
|
this.pageInfo,
|
"total",
|
listRes.result && listRes.result.total
|
);
|
}
|
},
|
async getAttachMentList(params) {
|
const listRes = await getAttachMentList(params);
|
if (!listRes || listRes.code !== "00") {
|
return false;
|
}
|
return listRes.result;
|
},
|
// 搜索列表
|
handleOnSeach() {
|
const conRef = this.$refs.condRef;
|
this.$set(this, "condtionValue", conRef.$refs["conform"].model);
|
this.$set(this, "pageInfo", { currentPage: 1, pageSize: 10, total: 0 });
|
this.getBoardList();
|
},
|
|
// 重置
|
handleOnRest() {
|
this.$set(this, "condtionValue", {});
|
// this.$set(this, 'pageInfo', { currentPage: 1, pageSize: 10, total: 0 })
|
// this.getProductList()
|
},
|
// 表单事件回调
|
async doAction(name, item, { type }) {
|
if (type === "EDIT") {
|
this.formItems.map(item =>{
|
if(item.name === 'customername' || item.name === 'certid' ) {
|
item.readonly = true
|
}
|
})
|
this.isView = false;
|
this.subTitle = "确定";
|
this.dialogTitle = "修改";
|
this.addorupdate = "UPDATE";
|
this.defValues = { ...this.defValues, ...item };
|
this.dialogVisible = true;
|
}
|
if (type === "DELETE") {
|
this.serialno = item.serialno;
|
this.delDialogVisible = true;
|
}
|
},
|
handleDialogCancel() {
|
// this.formItems = [...RISKWHITEFORMS];
|
this.defValues = { ...RISKWHITEDEFVALUES };
|
this.formRules = { ...RISKWHITERULES };
|
this.serialno = "";
|
this.dialogVisible = false;
|
},
|
// 新增
|
handleAddPage() {
|
this.formItems.map(item =>{
|
if(item.name === 'customername' || item.name === 'certid' ) {
|
item.readonly = false
|
}
|
})
|
this.isView = false;
|
this.isShowBorder = true;
|
this.serialno = "";
|
this.dialogTitle = "新增";
|
this.dialogVisible = true;
|
},
|
// 删除
|
async deleteRiskWhite(type) {
|
const { serialno } = this;
|
const deleReS = await deleteRiskWhite({ serialno });
|
if (deleReS && deleReS.code === "00") {
|
!type && this.$message.success("删除成功");
|
this.delDialogVisible = false;
|
this.getBoardList();
|
}
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.getBoardList();
|
},
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.getBoardList();
|
},
|
getScreenWidth() {
|
this.$set(this, "screenWidth", document.body.offsetWidth);
|
},
|
dateFormat(fmt, date) {
|
let ret;
|
const opt = {
|
"Y+": date.getFullYear().toString(), // 年
|
"m+": (date.getMonth() + 1).toString(), // 月
|
"d+": date.getDate().toString(), // 日
|
"H+": date.getHours().toString(), // 时
|
"M+": date.getMinutes().toString(), // 分
|
"S+": date.getSeconds().toString() // 秒
|
};
|
for (let k in opt) {
|
ret = new RegExp("(" + k + ")").exec(fmt);
|
if (ret) {
|
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
};
|
};
|
return fmt;
|
}
|
},
|
};
|
</script>
|
|
<style lang="less">
|
.help_doc_list_main {
|
padding: 16px 0px 0 20px;
|
& .help_doc_dialog {
|
width: 1000px;
|
// & .is-always-shadow {
|
// // box-shadow: none;
|
// }
|
& .images {
|
text-align: left;
|
& .imagesList {
|
display: flex;
|
height: 61px;
|
& .upload_parent {
|
margin-top: -5px !important;
|
margin-left: 10px !important;
|
}
|
& .img-item {
|
position: relative;
|
}
|
& .el-icon-error {
|
position: absolute;
|
left: 32px;
|
top: -2px;
|
cursor: pointer;
|
}
|
& .el-upload--picture-card {
|
height: 61px;
|
width: 52px;
|
position: relative;
|
& .el-icon-plus {
|
position: absolute;
|
left: 12px;
|
top: 15px;
|
}
|
}
|
}
|
& img {
|
width: 50px;
|
margin-right: 15px;
|
}
|
& .oper_img_list_ico {
|
width: 24px;
|
height: 24px;
|
margin-right: 0px;
|
position: absolute;
|
bottom: 1 !important;
|
}
|
}
|
& .el-dialog__footer {
|
& .dialog-footer {
|
& .el-button--default {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
border-radius: 4px;
|
border: 1px solid rgba(204, 204, 204, 1);
|
}
|
& .el-button--primary {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
background: #0081f0;
|
border-color: #0081f0;
|
border-radius: 4px;
|
margin-left: 40px;
|
}
|
}
|
}
|
}
|
& .help_doc_tip_dialog {
|
width: 1000px;
|
& .el-dialog__footer {
|
& .dialog-footer {
|
& .el-button--default {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
border-radius: 4px;
|
border: 1px solid rgba(204, 204, 204, 1);
|
}
|
& .el-button--primary {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
background: #0081f0;
|
border-color: #0081f0;
|
border-radius: 4px;
|
margin-left: 40px;
|
}
|
}
|
}
|
}
|
& .copy_dialog {
|
width: 950px;
|
}
|
& .del_dialog {
|
width: 450px;
|
& .el-dialog__body {
|
text-align: justify;
|
}
|
}
|
& .add-button {
|
padding: 2px 0 30px 0;
|
}
|
}
|
</style>
|