|
@@ -0,0 +1,283 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-main ref="elMain" style="padding: 0px;">
|
|
|
|
|
+ <!-- 工具区域Start -->
|
|
|
|
|
+ <el-row style="margin: 0px 20px;">
|
|
|
|
|
+ <kt-button style="background-color: #52C578;border:#52C578;margin-left: 15px;margin-bottom: 20px;"
|
|
|
|
|
+ icon="fa fa-plus" label="添加" type="primary" perms="sys:dept:add" @click="handleAddjudgeRule" />
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <kt-common-table permsEdit="judgeRule:judgeRule:edit" permsDelete="judgeRule:judgeRule:delete" :data="pageResult"
|
|
|
|
|
+ :columns="columns" editButtonName="编辑" deleteButtonName="删除" :showBatchDelete="true" @findPage="findPage"
|
|
|
|
|
+ @handleEdit="handleTableEdit" @handleDeleteFlag="handleTableDeleteFlag">
|
|
|
|
|
+ </kt-common-table>
|
|
|
|
|
+ </el-main>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 新增对话框 -->
|
|
|
|
|
+ <el-dialog :title="dialogTitle" v-dialogDrag :visible.sync="judgeRuleDialogVisible" width="800px" @open="closeDialog">
|
|
|
|
|
+ <el-form :model="dataForm" :rules="dataFormRules" ref="dataForm" @keyup.enter.native="submitForm"
|
|
|
|
|
+ label-width="100px" size="small">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="20">
|
|
|
|
|
+ <el-form-item label="归属保司" prop="companyId">
|
|
|
|
|
+ <el-select v-model="dataForm.companyId" placeholder="请选择归属保司" filterable >
|
|
|
|
|
+ <el-option v-for="item in prodInsurance" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="10">
|
|
|
|
|
+ <el-form-item label="单位" prop="unitTypeCode">
|
|
|
|
|
+ <el-select v-model="dataForm.unitTypeCode" placeholder="请选择单位" style="width:100%;">
|
|
|
|
|
+ <el-option label="月" value="月"></el-option>
|
|
|
|
|
+ <el-option label="天" value="天"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="10" :offset="2">
|
|
|
|
|
+ <el-form-item label="单位值" prop="unitTypeValue">
|
|
|
|
|
+ <el-input type="number" @change="judgValue" v-model="dataForm.unitTypeValue" placeholder="请输入单位值"></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button size="small" @click="judgeRuleDialogVisible = false">取 消</el-button>
|
|
|
|
|
+ <el-button size="small" type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <script>
|
|
|
|
|
+ import KtButton from "@/views/Core/KtButton";//按钮权限组件
|
|
|
|
|
+ import KtCommonTable from "@/views/Core/KtCommonTable.vue";//表格组件
|
|
|
|
|
+ export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ KtButton,
|
|
|
|
|
+ KtCommonTable
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ // 右侧列表查询数据Start
|
|
|
|
|
+ pageResult: {},
|
|
|
|
|
+ pageRequest: { //查询的默认条件
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 20,
|
|
|
|
|
+ },
|
|
|
|
|
+ columns: [ // 数据列
|
|
|
|
|
+ { prop: "companyName", label: "保险公司名称", minWidth: 80, sortable: false },
|
|
|
|
|
+ { prop: "unitTypeCode", label: "新车判断单位", minWidth: 80, sortable: false },
|
|
|
|
|
+ { prop: "unitTypeValue", label: "新车判断单位值", minWidth: 80, sortable: false },
|
|
|
|
|
+ ],
|
|
|
|
|
+ // 产品字段
|
|
|
|
|
+ dataForm: {
|
|
|
|
|
+ companyId: "",//保险公司名称
|
|
|
|
|
+ unitTypeCode: "",//新车判断单位
|
|
|
|
|
+ unitTypeValue: "",//新车判断单位值
|
|
|
|
|
+ },
|
|
|
|
|
+ dataFormRules: {
|
|
|
|
|
+ companyId: [{ required: true, message: "请选择保险公司", trigger: "blur" }],
|
|
|
|
|
+ unitTypeCode: [{ required: true, message: "新车判断单位不能为空", trigger: "blur" }],
|
|
|
|
|
+ unitTypeValue: [{ required: true, message: "新车判断单位值不能为空", trigger: "blur" }]
|
|
|
|
|
+ },
|
|
|
|
|
+ judgeRuleDialogVisible: false, //控制产品对话框
|
|
|
|
|
+ operType: "ADD", //'ADD','EDIT'
|
|
|
|
|
+ dialogTitle: "新增",
|
|
|
|
|
+ prodInsurance: [], //归属保司字典
|
|
|
|
|
+ id: "",
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ created() {
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 判断修改单位值
|
|
|
|
|
+ */
|
|
|
|
|
+ judgValue(e){
|
|
|
|
|
+ if(e<1&&e!=''){
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '单位值不能小于等于0',
|
|
|
|
|
+ type: 'error'
|
|
|
|
|
+ })
|
|
|
|
|
+ this.dataForm.unitTypeValue=''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 字典归属保司数据
|
|
|
|
|
+ */
|
|
|
|
|
+ insCompanyquery() {
|
|
|
|
|
+ return new Promise ((resolve,reject)=>{
|
|
|
|
|
+ if(this.prodInsurance.length>0){
|
|
|
|
|
+ resolve()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$api.insCompany.gainTopList("1").then(res => {
|
|
|
|
|
+ this.prodInsurance = res.data;
|
|
|
|
|
+ resolve()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 列表编辑按钮
|
|
|
|
|
+ */
|
|
|
|
|
+ handleTableEdit({ row, index }) {
|
|
|
|
|
+ this.operType = "EDIT";//'ADD','EDIT'
|
|
|
|
|
+ this.dialogTitle = "编辑";
|
|
|
|
|
+ this.dataForm = {
|
|
|
|
|
+ companyId: row.companyId,
|
|
|
|
|
+ unitTypeCode: row.unitTypeCode,
|
|
|
|
|
+ unitTypeValue: row.unitTypeValue,
|
|
|
|
|
+ };
|
|
|
|
|
+ this.id = row.id;
|
|
|
|
|
+ this.judgeRuleDialogVisible = true;
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 列表删除按钮
|
|
|
|
|
+ **/
|
|
|
|
|
+ handleTableDeleteFlag(data) {
|
|
|
|
|
+ this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ this.$api.judgerule.deleteJudgeRule(data.row.id).then((res)=>{
|
|
|
|
|
+ if(res.code==200){
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ message: '删除成功!'
|
|
|
|
|
+ });
|
|
|
|
|
+ this.findPage();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ message: res.msg
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ type: 'info',
|
|
|
|
|
+ message: '已取消删除'
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新增按钮
|
|
|
|
|
+ */
|
|
|
|
|
+ handleAddjudgeRule() {
|
|
|
|
|
+ this.operType = "ADD";//'ADD','EDIT'
|
|
|
|
|
+ this.dialogTitle = "新增";
|
|
|
|
|
+ this.judgeRuleDialogVisible = true;
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取列表数据
|
|
|
|
|
+ */
|
|
|
|
|
+ findPage(data) {
|
|
|
|
|
+ this.insCompanyquery().then(()=>{
|
|
|
|
|
+ if (data && data.pageRequest) {
|
|
|
|
|
+ this.pageRequest.pageNum = data.pageRequest.pageNum;
|
|
|
|
|
+ this.pageRequest.pageSize = data.pageRequest.pageSize;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$api.judgerule.findJudgeRulePage(this.pageRequest).then((res) => {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 当页数大于1时,点击删除按钮删除当前页最后一条时让当前页数见一在重新请求数据strat
|
|
|
|
|
+ */
|
|
|
|
|
+ if(res.data.content.length == 0&&this.pageRequest.pageNum>1) {
|
|
|
|
|
+ this.pageRequest.pageNum = this.pageRequest.pageNum-1
|
|
|
|
|
+ this.findPage()
|
|
|
|
|
+ }
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 当页数大于1时,点击删除按钮删除当前页最后一条时让当前页数见一在重新请求数据end
|
|
|
|
|
+ */
|
|
|
|
|
+ res.data.content.forEach(item=>{ //保险公司id跟名称转换
|
|
|
|
|
+ let filterData = this.prodInsurance.filter(filItem=>{
|
|
|
|
|
+ return item.companyId == filItem.id
|
|
|
|
|
+ })
|
|
|
|
|
+ if(filterData.length){
|
|
|
|
|
+ item.companyName = filterData[0].name
|
|
|
|
|
+ }else{
|
|
|
|
|
+ item.companyName = item.companyId
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ this.pageResult = res.data;
|
|
|
|
|
+
|
|
|
|
|
+ }).then(data != null ? data.callback : '')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 弹框显示
|
|
|
|
|
+ */
|
|
|
|
|
+ closeDialog() {
|
|
|
|
|
+ if (this.operType == "ADD") {
|
|
|
|
|
+ for (let key in this.dataForm) {
|
|
|
|
|
+ this.dataForm[key] = "";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 提交数据
|
|
|
|
|
+ */
|
|
|
|
|
+ submitForm() {
|
|
|
|
|
+ this.$refs.dataForm.validate((valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ if (this.operType == 'ADD') { //新增
|
|
|
|
|
+ this.$api.judgerule.addJudgeRule(this.dataForm).then((res) => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '操作成功',
|
|
|
|
|
+ type: 'success'
|
|
|
|
|
+ })
|
|
|
|
|
+ this.findPage();
|
|
|
|
|
+ this.judgeRuleDialogVisible = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '操作失败',
|
|
|
|
|
+ type: 'error'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else { //编辑
|
|
|
|
|
+ this.$api.judgerule.editJudgeRule(this.id, this.dataForm).then((res) => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '修改成功',
|
|
|
|
|
+ type: 'success'
|
|
|
|
|
+ })
|
|
|
|
|
+ this.findPage();
|
|
|
|
|
+ this.judgeRuleDialogVisible = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '操作失败',
|
|
|
|
|
+ type: 'error'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ </script>
|
|
|
|
|
+
|
|
|
|
|
+ <style scoped>
|
|
|
|
|
+ /* 顶部查询条件样式Start */
|
|
|
|
|
+ .queryFrom .el-row {
|
|
|
|
|
+ margin: 10px 0px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .queryFrom .el-form-item {
|
|
|
|
|
+ margin-bottom: 0px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .queryFrom .queryButton .el-form-item__content {
|
|
|
|
|
+ margin-left: 40px !important;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* 顶部查询条件样式End */
|
|
|
|
|
+ </style>
|
|
|
|
|
+
|