|
|
@@ -0,0 +1,358 @@
|
|
|
+<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="false"
|
|
|
+ @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="10">
|
|
|
+ <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" :offset="2">
|
|
|
+ <el-form-item label="验车码" prop="vehicleInspectionCode">
|
|
|
+ <el-input
|
|
|
+ type="text"
|
|
|
+ @change="judgValue"
|
|
|
+ v-model="dataForm.vehicleInspectionCode"
|
|
|
+ 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: "vehicleInspectionCode",
|
|
|
+ label: "验车码",
|
|
|
+ minWidth: 80,
|
|
|
+ sortable: false,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ // 产品字段
|
|
|
+ dataForm: {
|
|
|
+ companyId: "", //保险公司名称
|
|
|
+ vehicleInspectionCode: "", //新车判断单位值
|
|
|
+ },
|
|
|
+ dataFormRules: {
|
|
|
+
|
|
|
+ },
|
|
|
+ judgeRuleDialogVisible: false, //控制产品对话框
|
|
|
+ operType: "ADD", //'ADD','EDIT'
|
|
|
+ dialogTitle: "新增",
|
|
|
+ prodInsurance: [], //归属保司字典
|
|
|
+ id: "",
|
|
|
+ unitTypeData: [], //新车判断单位字典数据
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.dictList();
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+ methods: {
|
|
|
+ /**
|
|
|
+ * 获取系统字典
|
|
|
+ */
|
|
|
+ dictList(data) {
|
|
|
+ this.$api.dict
|
|
|
+ .dictList()
|
|
|
+ .then((res) => {
|
|
|
+ //获取新车判断单位字典数据
|
|
|
+ let dataArr = res.filter((item) => {
|
|
|
+ return item.dictType == "newCarJudgingUnit";
|
|
|
+ });
|
|
|
+ dataArr.length > 0 ? (this.unitTypeData = dataArr[0].ddList) : "";
|
|
|
+ })
|
|
|
+ .then(data != null ? data.callback : "");
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 判断修改单位值
|
|
|
+ */
|
|
|
+ judgValue(e) {
|
|
|
+ if (e < 1 && e != "") {
|
|
|
+ this.$message({
|
|
|
+ message: "单位值不能小于等于0",
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ this.dataForm.vehicleInspectionCode = "";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 字典归属保司数据
|
|
|
+ */
|
|
|
+ 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,
|
|
|
+ vehicleInspectionCode: row.vehicleInspectionCode,
|
|
|
+ };
|
|
|
+ this.id = row.id;
|
|
|
+ this.judgeRuleDialogVisible = true;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 列表删除按钮
|
|
|
+ **/
|
|
|
+ handleTableDeleteFlag(data) {
|
|
|
+ this.$confirm("此操作将删除该数据, 是否继续?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$api.esminsvehicleinspectioncode.modification(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.esminsvehicleinspectioncode.display(this.pageRequest).then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.code == 200) {
|
|
|
+ /**
|
|
|
+ * 当页数大于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.esminsvehicleinspectioncode.submit(this.dataForm).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.findPage();
|
|
|
+ this.judgeRuleDialogVisible = false;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ //编辑
|
|
|
+ this.$api.judgerule
|
|
|
+ .remove(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>
|
|
|
+
|