Просмотр исходного кода

Merge branch 'dev' of http://www.baoxianzhanggui.com:8090/sxzgd/vue-insagent-pc into dev

lihongxiao 2 лет назад
Родитель
Сommit
6b1de735c3
1 измененных файлов с 462 добавлено и 314 удалено
  1. 462 314
      src/views/Sys/Inscommanytemplate.vue

+ 462 - 314
src/views/Sys/Inscommanytemplate.vue

@@ -1,342 +1,490 @@
 <template>
-    <div class="page">
-        <el-row>
-            <el-col :span="6" style="padding: 20px;">
-                <el-button type="danger" size="small" @click="add()">新增</el-button>
-            </el-col>
-        </el-row>
-        <el-table size="small" :data="pageResult" height="690" border style="width: 100%" v-loading="loading"
-            highlight-current-row stripe
-            :header-cell-style="{ background: '#F2F7FC', fontWeight: '700', color: '#606266' }">
-            <el-table-column prop="id" label="ID" width="200" align="center"></el-table-column>
-            <el-table-column prop="insCompanyId" label="保险公司ID" width="100" align="center"></el-table-column>
-            <el-table-column prop="insCompanyName" label="保险公司简称" width="100" align="center"></el-table-column>
-            <el-table-column prop="fields" label="配置参数" align="center" :formatter="configureformatter"></el-table-column>
-            <el-table-column label="操作" align="center" width="200" fixed="right">
-                <template slot-scope="scope">
-                    <el-button size="mini" type="text" @click="CloseEdit(scope.$index, scope.row)">编辑</el-button>
-                    <el-button size="mini" type="text" style="color: #f78989;"
-                        @click="empowerBtn(scope.$index, scope.row)">删除</el-button>
-                </template>
-            </el-table-column>
-        </el-table>
+  <div class="page">
+    <el-form
+      :inline="true"
+      :model="formInline"
+      class="demo-form-inline"
+      size="small"
+      label-width="130px"
+      style="text-align: center"
+    >
+      <el-row style="padding: 20px">
+        <el-col :span="6">
+          <el-form-item label="请求类型:">
+            <el-select class="widths1" clearable v-model="formInline.apiType">
+              <el-option label="API" :value="1"></el-option>
+              <el-option label="python" :value="2"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="保险公司:">
+            <el-select
+              class="widths1"
+              filterable
+              v-model="formInline.insCompanyId"
+              @change="companyChange"
+              clearable
+            >
+              <el-option
+                v-for="(item, index) in companyselect"
+                :key="index.id"
+                :label="item.namesimple"
+                :value="item.id"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-button type="primary" size="small" @click="querySearch"
+            >查询</el-button
+          >
+          <el-button type="danger" size="small" @click="add()">新增</el-button>
+        </el-col>
+      </el-row>
+    </el-form>
 
-        <!-- 分页功能 -->
-        <div class="block">
-            <el-pagination @size-change="applyhandleSizeChange" @current-change="applyhandleCurrentChange"
-                :current-page="pageNum" :page-size="pageSize" :page-sizes="[10, 20, 50, 100]"
-                layout="total, sizes, prev, pager, next, jumper" :total="totalSize"></el-pagination>
-        </div>
-        <el-dialog :title="dilogtitle" :visible.sync="dialogVisible" width="1000px">
-            <el-form class="demo-ruleForm wrap-scrollbar scroll-style" :model="attributionform" ref="attributionform"
-                label-width="130px" size="small">
-                <el-row>
-                    <el-col :span="12">
-                        <el-form-item label="请求类型:">
-                            <el-select class="widths1" v-model="attributionform.apiType" @change="apiChange">
-                                <el-option label="API" :value="1"></el-option>
-                                <el-option label="python" :value="2"></el-option>
-                            </el-select>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="12">
-                        <el-form-item label="保险公司:">
-                            <el-select class="widths1" filterable  v-model="attributionform.insCompanyId" @change="companyChange">
-                                <el-option v-for="(item, index) in companyselect" :key="index.id" :label="item.namesimple"
-                                    :value="item.id"></el-option>
-                            </el-select>
-                        </el-form-item>
-                    </el-col>
-                    <div v-if="attributionform.apiType==2">
-                        <el-col :span="24">
-                            <div>
-                                <h4>URL配置</h4>
-                            </div>
-                        </el-col>
-                        <el-col :span="12" v-for="(apiitem, apiindex) in attributionform.api" :key="apiindex">
-                            <el-form-item :label="apiitem.apiName + ':'">
-                                <el-input v-model="apiitem.url"  placeholder="请输入指定链接"  ></el-input>
-                            </el-form-item>
-                        </el-col>
-                    </div>
-                    <el-col :span="24">
-                        <div>
-                            <h4>配置参数</h4>
-                        </div>
-                    </el-col>
-                    <el-col v-for="(configureitem, configureindex) in attributionform.fields" :key="configureindex">
-                        <el-col :span="10">
-                            <el-form-item label="字段名:">
-                                <el-input v-model="configureitem.field" class="widths1" placeholder="请输入字段名"></el-input>
-                            </el-form-item>
-                            <el-form-item label="标签:">
-                                <el-input v-model="configureitem.label" class="widths1" placeholder="标签名"></el-input>
-                            </el-form-item>
-                        </el-col>
-                        <el-col :span="10">
-                            <el-form-item label="表单类型:">
-                                <el-radio-group v-model="configureitem.type">
-                                    <el-radio label="text"></el-radio>
-                                    <el-radio label="select"></el-radio>
-                                </el-radio-group>
-
-                            </el-form-item>
-                            <el-form-item label="是否可修改:">
-                                <el-switch v-model="configureitem.isEdit"
-                                    @change="(event) => isEditchange(event, configureindex)" class="widths1"></el-switch>
-                            </el-form-item>
-                        </el-col>
-                        <el-col :span="4" >
-                            <el-button @click.prevent="removeDomain(configureitem)" size="small">删除</el-button>
-                        </el-col>
-                    </el-col>
-                </el-row>
-            </el-form>
-            <span slot="footer" class="dialog-footer">
-                <el-button size="small" @click="configuration" >新增配置</el-button>
-                <el-button size="small" @click="dialogVisible = false">取 消</el-button>
-                <el-button size="small" type="primary" @click="submitForm('attributionform')">提 交</el-button>
-            </span>
-        </el-dialog>
+    <el-table
+      size="small"
+      :data="pageResult"
+      height="690"
+      border
+      style="width: 100%"
+      v-loading="loading"
+      highlight-current-row
+      stripe
+      :header-cell-style="{
+        background: '#F2F7FC',
+        fontWeight: '700',
+        color: '#606266',
+      }"
+    >
+      <el-table-column
+        prop="id"
+        label="ID"
+        width="200"
+        align="center"
+      ></el-table-column>
+      <el-table-column
+        prop="insCompanyId"
+        label="保险公司ID"
+        width="100"
+        align="center"
+      ></el-table-column>
+      <el-table-column
+        prop="insCompanyName"
+        label="保险公司简称"
+        width="100"
+        align="center"
+      ></el-table-column>
+      <el-table-column
+        prop="fields"
+        label="配置参数"
+        align="center"
+        :formatter="configureformatter"
+      ></el-table-column>
+      <el-table-column label="操作" align="center" width="200" fixed="right">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="CloseEdit(scope.$index, scope.row)"
+            >编辑</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            style="color: #f78989"
+            @click="empowerBtn(scope.$index, scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
 
+    <!-- 分页功能 -->
+    <div class="block">
+      <el-pagination
+        @size-change="applyhandleSizeChange"
+        @current-change="applyhandleCurrentChange"
+        :current-page="pageNum"
+        :page-size="pageSize"
+        :page-sizes="[10, 20, 50, 100]"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="totalSize"
+      ></el-pagination>
     </div>
+    <el-dialog :title="dilogtitle" :visible.sync="dialogVisible" width="1000px">
+      <el-form
+        class="demo-ruleForm wrap-scrollbar scroll-style"
+        :model="attributionform"
+        ref="attributionform"
+        label-width="130px"
+        size="small"
+      >
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="请求类型:">
+              <el-select
+                class="widths1"
+                v-model="attributionform.apiType"
+                @change="apiChange"
+              >
+                <el-option label="API" :value="1"></el-option>
+                <el-option label="python" :value="2"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="保险公司:">
+              <el-select
+                class="widths1"
+                filterable
+                v-model="attributionform.insCompanyId"
+                @change="companyChange"
+              >
+                <el-option
+                  v-for="(item, index) in companyselect"
+                  :key="index.id"
+                  :label="item.namesimple"
+                  :value="item.id"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <div v-if="attributionform.apiType == 2">
+            <el-col :span="24">
+              <div>
+                <h4>URL配置</h4>
+              </div>
+            </el-col>
+            <el-col
+              :span="12"
+              v-for="(apiitem, apiindex) in attributionform.api"
+              :key="apiindex"
+            >
+              <el-form-item :label="apiitem.apiName + ':'">
+                <el-input
+                  v-model="apiitem.url"
+                  placeholder="请输入指定链接"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </div>
+          <el-col :span="24">
+            <div>
+              <h4>配置参数</h4>
+            </div>
+          </el-col>
+          <el-col
+            v-for="(configureitem, configureindex) in attributionform.fields"
+            :key="configureindex"
+          >
+            <el-col :span="10">
+              <el-form-item label="字段名:">
+                <el-input
+                  v-model="configureitem.field"
+                  class="widths1"
+                  placeholder="请输入字段名"
+                ></el-input>
+              </el-form-item>
+              <el-form-item label="标签:">
+                <el-input
+                  v-model="configureitem.label"
+                  class="widths1"
+                  placeholder="标签名"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="10">
+              <el-form-item label="表单类型:">
+                <el-radio-group v-model="configureitem.type">
+                  <el-radio label="text"></el-radio>
+                  <el-radio label="select"></el-radio>
+                </el-radio-group>
+              </el-form-item>
+              <el-form-item label="是否可修改:">
+                <el-switch
+                  v-model="configureitem.isEdit"
+                  @change="(event) => isEditchange(event, configureindex)"
+                  class="widths1"
+                ></el-switch>
+              </el-form-item>
+            </el-col>
+            <el-col :span="4">
+              <el-button
+                @click.prevent="removeDomain(configureitem)"
+                size="small"
+                >删除</el-button
+              >
+            </el-col>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="small" @click="configuration">新增配置</el-button>
+        <el-button size="small" @click="dialogVisible = false">取 消</el-button>
+        <el-button
+          size="small"
+          type="primary"
+          @click="submitForm('attributionform')"
+          >提 交</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
 </template>
 <script>
 export default {
-    data() {
-        return {
-            dilogtitle:"新增",
-            filterText: "",
-            treedata: [], //树形数据
-            loading: false, //加载效果
-            dialogVisible: false, //新增弹框
-            pageNum: 1, //页数
-            pageSize: 20, //条数
-            totalSize: null, //总数
-            pageResult: [], //表格数据
+  data() {
+    return {
+      dilogtitle: "新增",
+      filterText: "",
+      treedata: [], //树形数据
+      loading: false, //加载效果
+      dialogVisible: false, //新增弹框
+      pageNum: 1, //页数
+      pageSize: 20, //条数
+      totalSize: null, //总数
+      pageResult: [], //表格数据
+      formInline: {
+        insCompanyId: "", //保险公司
+        apiType: "", //请求类型
+      }, //查询条件
 
-            attributionform: {
-                fields: [
-                    {
-                        field: "",
-                        isEdit: false,
-                        label: "",
-                        type: "",
-                        value: "",
-                    },
-                ],
-                apiType: "", //接口类型
-                insCompanyId: "", //保险公司id
-            },
-            attributionform1:{},
-            pythonApi: [
-                {
-                    apiName: "归属配置",
-                    apiType: 1,
-                    url: "",
-                },
-                {
-                    apiName: "报价",
-                    apiType: 2,
-                    url: "",
-                }, {
-                    apiName: "影像上传",
-                    apiType: 3,
-                    url: "",
-                }, {
-                    apiName: "核保",
-                    apiType: 4,
-                    url: "",
-                }, {
-                    apiName: "缴费查询",
-                    apiType: 5,
-                    url: "",
-                }, {
-                    apiName: "保单下载",
-                    apiType: 6,
-                    url: "",
-                }, {
-                    apiName: "非车险查询",
-                    apiType: 7,
-                    url: "",
-                }, {
-                    apiName: "人工核保状态刷新",
-                    apiType: 8,
-                    url: "",
-                }
-            ],
-            pageRequest: {
-                pageNum: 1,
-                pageSize: 20,
-                columnFilters: {
-                    parentId: {
-                        name: "parentId",
-                        value: "0",
-                    },
-                },
-            },
-            companyselect: [],
-            configurelist: [],
-            id: "",
-        };
-    },
-    created() {
-        this.$api.insCompany.gainTopList("1").then((res) => {
-            this.companyselect = res.data;
-        });
-        this.findpage();
-    },
-    watch: {
-        filterText(val) {
-            this.$refs.tree.filter(val);
+      attributionform: {
+        fields: [
+          {
+            field: "",
+            isEdit: false,
+            label: "",
+            type: "",
+            value: "",
+          },
+        ],
+        apiType: "", //接口类型
+        insCompanyId: "", //保险公司id
+      },
+      attributionform1: {},
+      pythonApi: [
+        {
+          apiName: "归属配置",
+          apiType: 1,
+          url: "",
         },
-    },
-
-    methods: {
-        add() {
-            let params = {
-                fields: [
-                    {
-                        field: "",
-                        isEdit: false,
-                        label: "",
-                        type: "",
-                        value: "",
-                    },
-                ],
-                insCompanyId: "", //保险公司id
-            };
-            this.id = "";
-            this.attributionform = params;
-            this.show = true;
-            this.dialogVisible = true;
+        {
+          apiName: "报价",
+          apiType: 2,
+          url: "",
         },
-        //表格参数自定义内容
-        configureformatter(row) {
-            let data = JSON.stringify(row.fields);
-            return data;
+        {
+          apiName: "影像上传",
+          apiType: 3,
+          url: "",
         },
-        findpage() {
-            let params={
-                pageNum:this.pageNum,
-                pageSize:this.pageSize,
-                insCompanyId:"",
-            }
-            this.$api.insCompany
-                .pagebelong(params)
-                .then((res) => {
-                    if (res.code == "200") {
-                        this.pageResult = res.data.content
-                        this.totalSize = res.data.totalSize
-                    }
-                });
+        {
+          apiName: "核保",
+          apiType: 4,
+          url: "",
         },
-        //删除事件
-        removeDomain(item) {
-            var index = this.attributionform.fields.indexOf(item);
-            if (index !== -1) {
-                this.attributionform.fields.splice(index, 1);
-            }
+        {
+          apiName: "缴费查询",
+          apiType: 5,
+          url: "",
         },
-        //新增配置按钮
-        configuration() {
-            this.attributionform.fields.push({
-                field: "",
-                isEdit: false,
-                label: "",
-                type: "",
-                value: "",
-            });
+        {
+          apiName: "保单下载",
+          apiType: 6,
+          url: "",
         },
-        //修改开关事件
-        isEditchange(val, id) {
-            this.attributionform.fields[id].isEdit = val;
+        {
+          apiName: "非车险查询",
+          apiType: 7,
+          url: "",
         },
-        //选择保险公司获取归属模板
-        companyChange(e) { },
-        apiChange(e){
-            e==2? this.attributionform['api']=this.pythonApi:"";
+        {
+          apiName: "人工核保状态刷新",
+          apiType: 8,
+          url: "",
         },
-        //提交表单
-        submitForm(formName) {
-            this.$refs[formName].validate((valid) => {
-                if (valid) {
-                    if (this.id) {
-                        this.$api.insCompany
-                            .updatebelong(this.id, this.attributionform)
-                            .then((res) => {
-                                if (res.code == "200") {
-                                    this.$message({ message: "修改成功", type: "success" });
-                                    this.findpage();
-                                    this.dialogVisible = false;
-                                } else {
-                                    this.$message({ message: res.msg, type: "warning" });
-                                }
-                            });
-                    } else {
-                        this.$api.insCompany
-                            .addbelong(this.attributionform)
-                            .then((res) => {
-                                if (res.code == "200") {
-                                    this.$message({ message: "新增成功", type: "success" });
-                                    this.findpage();
-                                    this.dialogVisible = false;
-                                } else {
-                                    this.$message({ message: res.msg, type: "success" });
-                                }
-                            });
-                    }
-                }
-            });
+      ],
+      pageRequest: {
+        pageNum: 1,
+        pageSize: 20,
+        columnFilters: {
+          parentId: {
+            name: "parentId",
+            value: "0",
+          },
         },
-        //删除操作
-        empowerBtn(index, row) {
-            this.$api.insCompany.deletebelong(row.id).then((res) => {
+      },
+      companyselect: [],
+      configurelist: [],
+      id: "",
+    };
+  },
+  created() {
+    this.$api.insCompany.gainTopList("1").then((res) => {
+      this.companyselect = res.data;
+    });
+    this.findpage();
+  },
+  watch: {
+    filterText(val) {
+      this.$refs.tree.filter(val);
+    },
+  },
+
+  methods: {
+    //查询
+    querySearch() {
+      this.pageNum = 1;
+      this.pageSize = 20;
+      this.findpage();
+    },
+    add() {
+      let params = {
+        fields: [
+          {
+            field: "",
+            isEdit: false,
+            label: "",
+            type: "",
+            value: "",
+          },
+        ],
+        insCompanyId: "", //保险公司id
+      };
+      this.id = "";
+      this.attributionform = params;
+      this.show = true;
+      this.dialogVisible = true;
+    },
+    //表格参数自定义内容
+    configureformatter(row) {
+      let data = JSON.stringify(row.fields);
+      return data;
+    },
+    findpage() {
+      let params = {
+        pageNum: this.pageNum,
+        pageSize: this.pageSize,
+        insCompanyId: this.formInline.insCompanyId,
+        apiType: this.formInline.apiType,
+      };
+      this.$api.insCompany.pagebelong(params).then((res) => {
+        if (res.code == "200") {
+          this.pageResult = res.data.content;
+          this.totalSize = res.data.totalSize;
+        }
+      });
+    },
+    //删除事件
+    removeDomain(item) {
+      var index = this.attributionform.fields.indexOf(item);
+      if (index !== -1) {
+        this.attributionform.fields.splice(index, 1);
+      }
+    },
+    //新增配置按钮
+    configuration() {
+      this.attributionform.fields.push({
+        field: "",
+        isEdit: false,
+        label: "",
+        type: "",
+        value: "",
+      });
+    },
+    //修改开关事件
+    isEditchange(val, id) {
+      this.attributionform.fields[id].isEdit = val;
+    },
+    //选择保险公司获取归属模板
+    companyChange(e) {},
+    apiChange(e) {
+      e == 2 ? (this.attributionform["api"] = this.pythonApi) : "";
+    },
+    //提交表单
+    submitForm(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          if (this.id) {
+            this.$api.insCompany
+              .updatebelong(this.id, this.attributionform)
+              .then((res) => {
                 if (res.code == "200") {
-                    this.findpage();
-                    this.$message({ message: res.msg, type: "success" });
+                  this.$message({ message: "修改成功", type: "success" });
+                  this.findpage();
+                  this.dialogVisible = false;
+                } else {
+                  this.$message({ message: res.msg, type: "warning" });
                 }
+              });
+          } else {
+            this.$api.insCompany.addbelong(this.attributionform).then((res) => {
+              if (res.code == "200") {
+                this.$message({ message: "新增成功", type: "success" });
+                this.findpage();
+                this.dialogVisible = false;
+              } else {
+                this.$message({ message: res.msg, type: "success" });
+              }
             });
-        },
-        //编辑操作
-        CloseEdit(index, row) {
-            this.dilogtitle="编辑"
-            this.id=row.id;
-           this.$api.insCompany.querybelong(row.id).then(res=>{
-            this.attributionform=res.data;
-            if(res.data.api!=null){
-                let api = JSON.parse(JSON.stringify(this.pythonApi));
-                api.forEach(item=>{
-                    let obj = res.data.api.find(it=>(item.apiName==it.apiName&&item.apiType==it.apiType))
-                    if(obj){
-                        item.url = obj.url
-                    }
-                })
-                this.attributionform['api']= api;
+          }
+        }
+      });
+    },
+    //删除操作
+    empowerBtn(index, row) {
+      this.$api.insCompany.deletebelong(row.id).then((res) => {
+        if (res.code == "200") {
+          this.findpage();
+          this.$message({ message: res.msg, type: "success" });
+        }
+      });
+    },
+    //编辑操作
+    CloseEdit(index, row) {
+      this.dilogtitle = "编辑";
+      this.id = row.id;
+      this.$api.insCompany.querybelong(row.id).then((res) => {
+        this.attributionform = res.data;
+        if (res.data.api != null) {
+          let api = JSON.parse(JSON.stringify(this.pythonApi));
+          api.forEach((item) => {
+            let obj = res.data.api.find(
+              (it) => item.apiName == it.apiName && item.apiType == it.apiType
+            );
+            if (obj) {
+              item.url = obj.url;
             }
-            this.dialogVisible=true;
-           })
-        },
-        // 设置每页条数
-        applyhandleSizeChange(val) {
-            this.pageSize = val;
-            this.pageNum = 1;
-            this.pageRequest.pageNum = 1;
-            this.pageRequest.pageSize = val;
-            this.findpage();
-        },
-        // 当前页
-        // 当前页 当前页
-        applyhandleCurrentChange(val) {
-            this.pageNum = val;
-            this.pageRequest.pageNum = val;
-            this.findpage();
-        },
+          });
+          this.attributionform["api"] = api;
+        }
+        this.dialogVisible = true;
+      });
+    },
+    // 设置每页条数
+    applyhandleSizeChange(val) {
+      this.pageSize = val;
+      this.pageNum = 1;
+      this.pageRequest.pageNum = 1;
+      this.pageRequest.pageSize = val;
+      this.findpage();
+    },
+    // 当前页
+    // 当前页 当前页
+    applyhandleCurrentChange(val) {
+      this.pageNum = val;
+      this.pageRequest.pageNum = val;
+      this.findpage();
     },
+  },
 };
 </script>
 <style scoped >
 .widths1 {
-    width: 250px;
+  width: 250px;
 }
 </style>