保安服务单位许可和备案申请系统
lin
2024-05-07 e047fc31f6d9c571b11a8c49072a34edb30176db
src/components/cardPopup/cardPopup.vue
@@ -1,41 +1,15 @@
<template>
  <div class="once">
    <div v-if="OnceChouse && useWhere != 'close'" class="OnceChouse">
      <slot name="close"></slot>
      <div class="heards"></div>
      <basic-container>
        <div v-for="(item, index) in cardData" :key="index">
          <!-- <div class="chouseHide"> -->
          <el-radio v-model="choseType" :label="item.type">{{
            item.menuName
          }}</el-radio>
          <div class="choseTitle">{{ item.datas.msg }}</div>
          <!-- </div> -->
        </div>
        <div class="hand-next">
          <el-button type="primary" @click="tipchose">确认</el-button>
          <!-- <el-button type="primary" @click="qx">取消</el-button> -->
        </div>
      </basic-container>
    </div>
    <div
      v-if="see && useWhere != 'close' && !OnceChouse"
      class="securityPermit"
    >
    <div v-if="see && useWhere != 'close' && !OnceChouse" class="securityPermit">
      <slot name="close"></slot>
      <div class="heards">{{ name }}</div>
      <basic-container>
        <div v-show="forms == 1" class="first-box-outer">
        <!-- <div v-show="forms == 1" class="first-box-outer">
          <div class="f-b-o-in">
            <div class="handling-guideline">
              <h2 class="hand-title">{{ name }}办理指南</h2>
              <div
                class="hand-content"
                ref="handcontent"
                id="handcontent"
                v-html="htmls"
              >
                <!-- ### -->
              <div class="hand-content" ref="handcontent" id="handcontent" v-html="htmls">
                {{ htmls }}
              </div>
            </div>
@@ -44,35 +18,24 @@
            <el-button type="primary" @click="tip0">下一步</el-button>
            <el-button type="primary" @click="qx">取消</el-button>
          </div>
        </div>
        <div v-show="forms == 2" class="first-box-outer">
          <div class="f-b-o-in" v-if="active">
        </div> -->
        <div class="first-box-outer">
          <div class="f-b-o-in">
            <el-collapse v-model="activeNames" @change="handleChange">
              <el-collapse-item title="公司基本信息" name="1">
                <avue-form
                  ref="form1"
                  v-model="obj0"
                  :option="option"
                  @submit="submit"
                  class="cardButs"
                ></avue-form>
                <avue-form ref="form1" v-model="obj0" :option="option" @submit="submit" class="cardButs"></avue-form>
              </el-collapse-item>
              <el-collapse-item title="附件上传/查询" name="2">
                <attach
                  :type="imgType"
                  :ptype="type"
                  :opens="opens"
                  :enclosure="enclosure"
                ></attach>
              <el-collapse-item title="附件上传" name="2">
                <!-- <attach :type="imgType" :ptype="type" :opens="opens" :enclosure="enclosure"></attach> -->
                <avue-form :option="optionFile" v-model="form"></avue-form>
              </el-collapse-item>
            </el-collapse>
          </div>
          <div class="hand-next">
            <el-button type="primary" @click="tip1up1">上一页</el-button>
            <el-button type="primary" @click="tip1" :disabled="!opens"
              >暂存</el-button
            >
            <!-- <el-button type="primary" @click="tip1up1">上一页</el-button> -->
            <el-button type="primary" @click="tip1" :disabled="!opens">暂存</el-button>
            <el-button type="primary" @click="up()" :disabled="!opens">{{
              //canDoIt ? "提交审批" : "已成功提交"
              opens ? "提交审批" : "提交审批"
@@ -86,341 +49,498 @@
</template>
<script>
import { mapGetters } from "vuex";
import { add, adds, selectIn } from "@/api/recordOur/outCardPopup";
import attach from "@/components/attach/attach";
import {
  // getDetail,
  getList,
  getListre,
  getListrek,
  getListrev,
  getListrel
} from "@/api/permit/permit";
export default {
  components: {
    attach: attach
  },
  props: ["data", "together"],
  data() {
    return {
      htmls: "",
      see: false,
      name: "",
      type: "",
      imgType: "",
      apiName: [],
      forms: 1,
      data0: {},
      obj0: {},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      option: {
        emptyBtn: false,
        submitBtn: true,
        gutter: 50,
        column: []
      },
      activeNames: ["1", "2"],
      opens: true,
      active: false,
  import {
    mapGetters
  } from "vuex";
  import {
    add,
    adds,
    selectIn
  } from "@/api/recordOur/outCardPopup";
  import attach from "@/components/attach/attach";
  import {
    // getDetail,
    getList,
    getListre,
    getListrek,
    getListrev,
    getListrel
  } from "@/api/permit/permit";
  export default {
    components: {
      attach: attach
    },
    props: ["data", "together"],
    data() {
      return {
        htmls: "",
        see: false,
        name: "",
        type: "",
        imgType: "",
        apiName: [],
        forms: 2,
        data0: {},
        obj0: {},
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        option: {
          emptyBtn: false,
          submitBtn: true,
          gutter: 50,
          column: [{
              labelWidth: 100,
              label: "场所名称",
              prop: "placeName",
              // span: 24,
              rules: [{
                required: true,
                message: "请输入场所名称",
                trigger: "blur"
              }]
            }, {
              labelWidth: 100,
              label: "负责人名称",
              prop: "principal",
              // span: 24,
              rules: [{
                required: true,
                message: "请输入场所负责人姓名",
                trigger: "blur"
              }]
            },
            {
              labelWidth: 100,
              label: "负责人电话",
              prop: "principalPhone",
              // span: 24,
              rules: [{
                required: true,
                message: "请输入场所负责人联系方式",
                trigger: "blur"
              }]
            },
            // {
            //   label: "位置",
            //   prop: "location",
            //   span: 24,
            //   rules: [{
            //     required: true,
            //     message: "请选择位置",
            //     trigger: "blur"
            //   }]
            // },
            {
              labelWidth: 100,
              // width: 160,
              overHidden: true,
              slot: true,
              label: "位置",
              prop: "location",
              type: "map",
              dataType: "string",
              // labelWidth: 120,
              // span: 24,
              value: [117.96646, 28.431002, ""],
              // cascader: ['houseCodeBinds'],
              mapChange: (params) => {
                console.log('高德回调参数', params)
              },
              //高德初始化参数
              params: {
                zoom: 10,
                zoomEnable: false,
                dragEnable: false,
              },
              rules: [{
                required: true,
                message: "请选择地址",
                trigger: "blur",
              }, ],
            },
            {
              labelWidth: 100,
              label: "派出所名称",
              prop: "pcsName",
              // span: 24,
              rules: [{
                required: true,
                message: "请输入派出所名称",
                trigger: "blur"
              }]
            },
            {
              labelWidth: 100,
              label: "社区名称",
              prop: "communityName",
              // span: 24,
              rules: [{
                required: true,
                message: "请输入社区名称",
                trigger: "blur"
              }]
            },
            {
              labelWidth: 100,
              label: "社区名称",
              prop: "communityName",
              // span: 24,
              rules: [{
                required: true,
                message: "请输入社区名称",
                trigger: "blur"
              }]
            },
          ]
        },
      OnceChouse: false, //选择武装押运或者保安服务许可
      cardData: [],
      choseType: "",
      overtime: {
        overtimef: "",
        overtimec: ""
      },
      enclosure: [] //附件上传 基础数据
    };
  },
  computed: {
    ...mapGetters(["userInfo", "useWhere"])
  },
  watch: {
    useWhere() {
      var d = [];
      // console.log(this.together, "fromWhere");
      for (var i in this.together) {
        if (this.useWhere == this.together[i].fromWhere) {
          this.OnceChouse = true;
        optionFile: {
          emptyBtn: false,
          submitBtn: true,
          gutter: 50,
          column: [
            //   {
            //   label: "附件",
            //   prop: "parentCode",
            //   type: 'upload',
            //   span: 24,
            //   dragFile: true,
            //   // action: action,
            //   rules: [{
            //     required: true,
            //     message: "请上传附件",
            //     trigger: "blur"
            //   }]
            // },
            {
              label: '附件',
              prop: 'constructionSchemeUrls',
              type: 'upload',
              span: 24,
              hide: true,
              labelWidth: 140,
              multiple: true,
              listType: "text",
              // showFileList: true,
              propsHttp: {
                res: 'data',
                name: "originalName",
                url: "link"
              },
              data: {
                suffix: 'pdf,ppt,doc,docx'
              },
              action: '/api/blade-resource/oss/endpoint/put-file-attach-suffix',
              rules: [{
                required: true,
                message: "请上传附件",
                trigger: "blur",
              }, ],
            },
          ]
        },
          d.push(this.together[i]);
          // console.log("选择");
        }
      }
      if (this.OnceChouse) {
        this.choseType = this.useWhere;
        for (var k in this.data) {
          if (this.data[k].type == this.useWhere) {
            d.unshift(this.data[k]);
        activeNames: ["1", "2"],
        opens: true,
        active: false,
        OnceChouse: false, //选择武装押运或者保安服务许可
        cardData: [],
        choseType: "",
        overtime: {
          overtimef: "",
          overtimec: ""
        },
        enclosure: [] //附件上传 基础数据
      };
    },
    computed: {
      ...mapGetters(["userInfo", "useWhere"])
    },
    watch: {
      useWhere() {
        var d = [];
        // console.log(this.together, "fromWhere");
        for (var i in this.together) {
          if (this.useWhere == this.together[i].fromWhere) {
            this.OnceChouse = true;
            d.push(this.together[i]);
            // console.log("选择");
          }
        }
        this.cardData = d;
        console.log(this.cardData);
      } else {
        this.openS();
      }
      if (this.useWhere == "close") {
        this.tipover();
      }
    }
  },
  methods: {
    tipchose() {
      this.OnceChouse = false;
      this.openS(this.choseType, this.cardData);
    },
    openS(chose, datas) {
      var n = chose || this.useWhere;
      this.data = datas || this.data;
      for (var k in this.data) {
        if (n == this.data[k].type) {
        if (this.OnceChouse) {
          this.choseType = this.useWhere;
          for (var k in this.data) {
            if (this.data[k].type == this.useWhere) {
              d.unshift(this.data[k]);
            }
          }
          this.cardData = d;
          console.log(this.cardData);
        } else {
          this.see = true;
          this.type = this.data[k].type;
          this.enclosure = this.data[k].enclosure;
          this.overtime = this.data[k].overtime;
          this.imgType = this.data[k].imgType;
          this.htmls = this.data[k].datas.htmls;
          this.apiName = this.data[k].datas.apiName;
          this.name = this.data[k].menuName;
          var d = this.data[k].datas.column;
          this.onLoad(this.page, {}, n, d);
          console.log("已选择type:" + n + "--" + this.name);
          this.convert();
          // this.openS();
        }
        if (this.useWhere == "close") {
          this.tipover();
        }
      }
    },
    onLoad(page, params = {}, val, d) {
      params["cardid"] = this.userInfo.Id;
      getList(page.currentPage, page.pageSize, params).then(res => {
        const data = res.data.data;
        this.data = data.records;
        getListre(page.currentPage, page.pageSize, params).then(ress => {
          this.data = this.data.concat(ress.data.data.records);
          getListrek(page.currentPage, page.pageSize, params).then(resk => {
            this.data = this.data.concat(resk.data.data.records);
            getListrev(page.currentPage, page.pageSize, params).then(resv => {
              this.data = this.data.concat(resv.data.data.records);
              getListrel(page.currentPage, page.pageSize, params).then(resl => {
                this.data = this.data.concat(resl.data.data.records);
                // console.log("已有申请数量:", this.data.length);
                // console.log(val, "当前type");
                if (this.data.kservicetime) {
                  this.data.kservicetime.split(",");
                }
                this.changeBut(true, d);
                if (this.data.length == 0) {
                  // console.log("一条数据都没有");
                } else {
                  this.data.forEach(item => {
                    // console.log(item.ptype);
                    if (item.ptype == val) {
                      if (item.type == 0 || item.type == 2) {
                        this.changeBut(false, d);
                        // console.log(item, "有数据未审核或者审核通过");
                      } else {
                        this.changeBut(true, d);
                        // console.log(item, "审核不通过");
                      }
                    }
                  });
                }
              });
            });
    methods: {
      tipchose() {
        this.OnceChouse = false;
        this.openS(this.choseType, this.cardData);
      },
      openS(chose, datas) {
        var n = chose || this.useWhere;
        this.data = datas || this.data;
        for (var k in this.data) {
          if (n == this.data[k].type) {
            this.see = true;
            this.type = this.data[k].type;
            this.enclosure = this.data[k].enclosure;
            this.overtime = this.data[k].overtime;
            this.imgType = this.data[k].imgType;
            this.htmls = this.data[k].datas.htmls;
            this.apiName = this.data[k].datas.apiName;
            this.name = this.data[k].menuName;
            var d = this.data[k].datas.column;
            this.onLoad(this.page, {}, n, d);
            console.log("已选择type:" + n + "--" + this.name);
            this.convert();
          }
        }
      },
      onLoad(page, params = {}, val, d) {
        params["cardid"] = this.userInfo.Id;
        // getList(page.currentPage, page.pageSize, params).then(res => {
        //   const data = res.data.data;
        //   this.data = data.records;
        //   getListre(page.currentPage, page.pageSize, params).then(ress => {
        //     this.data = this.data.concat(ress.data.data.records);
        //     getListrek(page.currentPage, page.pageSize, params).then(resk => {
        //       this.data = this.data.concat(resk.data.data.records);
        //       getListrev(page.currentPage, page.pageSize, params).then(resv => {
        //         this.data = this.data.concat(resv.data.data.records);
        //         getListrel(page.currentPage, page.pageSize, params).then(resl => {
        //           this.data = this.data.concat(resl.data.data.records);
        //           // console.log("已有申请数量:", this.data.length);
        //           // console.log(val, "当前type");
        //           if (this.data.kservicetime) {
        //             this.data.kservicetime.split(",");
        //           }
        //           this.changeBut(true, d);
        //           if (this.data.length == 0) {
        //             // console.log("一条数据都没有");
        //           } else {
        //             this.data.forEach(item => {
        //               // console.log(item.ptype);
        //               if (item.ptype == val) {
        //                 if (item.type == 0 || item.type == 2) {
        //                   this.changeBut(false, d);
        //                   // console.log(item, "有数据未审核或者审核通过");
        //                 } else {
        //                   this.changeBut(true, d);
        //                   // console.log(item, "审核不通过");
        //                 }
        //               }
        //             });
        //           }
        //         });
        //       });
        //     });
        //   });
        // });
      },
      changeBut(val, d) {
        this.opens = val;
        for (var k in d) {
          d[k]["disabled"] = !this.opens;
        }
        this.option.column = d;
        this.active = true;
      },
      convert: function() {
        var caridid = this.$store.getters.userInfo.Id;
        selectIn(this.apiName[2], caridid, this.type).then(res => {
          var d = res.data.data;
          // console.log(d, "d");
          for (var k in d) {
            this.obj0[k.toLowerCase()] = d[k];
          }
          // console.log(this.obj0, "obj0");
        });
      },
      tip0() {
        this.forms = 2;
      },
      qx() {
        this.tipover();
        this.$store.commit("changeuseWhere", "close");
      },
      tip1up1() {
        this.forms = 2;
      },
      tip1() {
        //暂存申请
        var d = {};
        for (var k in this.obj0) {
          for (var i in this.option.column) {
            if (k == this.option.column[i].prop && k != "title0") {
              d[k] = this.obj0[k];
            }
          }
        }
        console.log(d);
        this.data0 = d;
        this.data0.cardid = this.$store.getters.userInfo.Id;
        this.data0.ptype = this.type;
        adds(this.apiName[1], this.data0).then(() => {
          this.qx();
          this.$message({
            message: "暂存申请成功",
            type: "success"
          });
        });
      });
    },
    changeBut(val, d) {
      this.opens = val;
      for (var k in d) {
        d[k]["disabled"] = !this.opens;
      }
      this.option.column = d;
      this.active = true;
    },
    convert: function() {
      var caridid = this.$store.getters.userInfo.Id;
      selectIn(this.apiName[2], caridid, this.type).then(res => {
        var d = res.data.data;
        // console.log(d, "d");
        for (var k in d) {
          this.obj0[k.toLowerCase()] = d[k];
        }
        // console.log(this.obj0, "obj0");
      });
    },
    tip0() {
      this.forms = 2;
    },
    qx() {
      this.tipover();
      this.$store.commit("changeuseWhere", "close");
    },
    tip1up1() {
      this.forms = 1;
    },
    tip1() {
      //暂存申请
      var d = {};
      for (var k in this.obj0) {
        for (var i in this.option.column) {
          if (k == this.option.column[i].prop && k != "title0") {
            d[k] = this.obj0[k];
          }
        }
      }
      console.log(d);
      this.data0 = d;
      this.data0.cardid = this.$store.getters.userInfo.Id;
      this.data0.ptype = this.type;
      adds(this.apiName[1], this.data0).then(() => {
        this.qx();
        this.$message({
          message: "暂存申请成功",
          type: "success"
        });
      });
    },
    aa(b) {
      console.log(b);
    },
    submit() {
      this.up(0);
    },
    up(val = 1) {
      //提交申请
      // this.submit();
      if (val == 1) {
        this.$refs.form1.submit(); //解决点击提交不能显示那个字段输入错误的问题
        return;
      }
      var d = {};
      for (var k in this.obj0) {
        for (var i in this.option.column) {
          if (k == this.option.column[i].prop && k != "title0") {
            d[k] = this.obj0[k];
          }
        }
      }
      this.data0 = d;
      this.data0.ptype = this.type;
      this.data0.cardid = this.$store.getters.userInfo.Id;
      //验证数据
      var commin = true;
      var a = this.data0;
      for (var k in a) {
        if (k == "representativecell" || k == "contactscell") {
          //电话验证
          if (!yanzhengphons.test(a[k])) {
            // console.log(a[k], k);
            commin = false;
            console.log(1);
            break;
          }
          // } else if (k == "creditcode" || k == "registeredcapital") {
        } else if (k == "registeredcapital") {
          //数字验证
          if (!yanzhengnumbers.test(a[k])) {
            // console.log(a[k], k);
            commin = false;
            console.log(2);
            break;
          }
        } else if (k == "address" || k == "business") {
          //跳过验证
          continue;
        } else {
          //空值验证
          // if (a[k] == "" && k != "ptype" && k != "creditcode") {
          //   console.log(a[k], k);
          //   commin = false;
          //   console.log(3);
          //   break;
          // }
        }
      }
      if (!commin) {
        this.$message({
          message: "请检查输入数据是否正确!",
          type: "warning"
        });
        return;
      }
      a["overtime"] = this.getNowTime(this.overtime.overtimec);
      // console.log(a);
      // return;
      // console.log(typeof this.data0.kservicetime);
      if (
        this.data0.kservicetime &&
        typeof this.data0.kservicetime != "string"
      ) {
        this.data0.kservicetime = this.data0.kservicetime.join(",");
      }
      // console.log(this.apiName[0], this.data0);
      // return;
      add(this.apiName[0], this.data0).then(() => {
        this.qx();
        this.$message({
          message: "提交申请成功",
          type: "success"
        });
        this.$store.commit("changecanDoIt", false);
      });
    },
    getNowTime(form) {
      var DaysToAdd = form;
      var now = new Date();
      var newdate = new Date();
      var newtimems = newdate.getTime() + DaysToAdd * 24 * 60 * 60 * 1000;
      newdate.setTime(newtimems);
      //只得到年月日的
      var time =
        newdate.getFullYear() +
        "-" +
        (newdate.getMonth() + 1) +
        "-" +
        newdate.getDate();
      //得到具体时间
      return time;
    },
    tipover(a, b) {
      if (a == 1) {
      },
      aa(b) {
        console.log(b);
        var number = false,
          reg = /^[0-9]+.?[0-9]*$/;
        for (var k in b) {
          if (k == "creditcode") {
            if (reg.test(b[k])) {
              number = true;
            } else {
              number = false;
      },
      submit() {
        this.up(0);
      },
      up(val = 1) {
        //提交申请
        // this.submit();
        if (val == 1) {
          this.$refs.form1.submit(); //解决点击提交不能显示那个字段输入错误的问题
          return;
        }
        var d = {};
        for (var k in this.obj0) {
          for (var i in this.option.column) {
            if (k == this.option.column[i].prop && k != "title0") {
              d[k] = this.obj0[k];
            }
          } else {
            continue;
          }
        }
        return number;
        this.data0 = d;
        this.data0.ptype = this.type;
        this.data0.cardid = this.$store.getters.userInfo.Id;
        //验证数据
        var commin = true;
        var a = this.data0;
        for (var k in a) {
          if (k == "representativecell" || k == "contactscell") {
            //电话验证
            if (!yanzhengphons.test(a[k])) {
              // console.log(a[k], k);
              commin = false;
              console.log(1);
              break;
            }
            // } else if (k == "creditcode" || k == "registeredcapital") {
          } else if (k == "registeredcapital") {
            //数字验证
            if (!yanzhengnumbers.test(a[k])) {
              // console.log(a[k], k);
              commin = false;
              console.log(2);
              break;
            }
          } else if (k == "address" || k == "business") {
            //跳过验证
            continue;
          } else {
            //空值验证
            // if (a[k] == "" && k != "ptype" && k != "creditcode") {
            //   console.log(a[k], k);
            //   commin = false;
            //   console.log(3);
            //   break;
            // }
          }
        }
        if (!commin) {
          this.$message({
            message: "请检查输入数据是否正确!",
            type: "warning"
          });
          return;
        }
        a["overtime"] = this.getNowTime(this.overtime.overtimec);
        // console.log(a);
        // return;
        // console.log(typeof this.data0.kservicetime);
        if (
          this.data0.kservicetime &&
          typeof this.data0.kservicetime != "string"
        ) {
          this.data0.kservicetime = this.data0.kservicetime.join(",");
        }
        // console.log(this.apiName[0], this.data0);
        // return;
        add(this.apiName[0], this.data0).then(() => {
          this.qx();
          this.$message({
            message: "提交申请成功",
            type: "success"
          });
          this.$store.commit("changecanDoIt", false);
        });
      },
      getNowTime(form) {
        var DaysToAdd = form;
        var now = new Date();
        var newdate = new Date();
        var newtimems = newdate.getTime() + DaysToAdd * 24 * 60 * 60 * 1000;
        newdate.setTime(newtimems);
        //只得到年月日的
        var time =
          newdate.getFullYear() +
          "-" +
          (newdate.getMonth() + 1) +
          "-" +
          newdate.getDate();
        //得到具体时间
        return time;
      },
      tipover(a, b) {
        if (a == 1) {
          console.log(b);
          var number = false,
            reg = /^[0-9]+.?[0-9]*$/;
          for (var k in b) {
            if (k == "creditcode") {
              if (reg.test(b[k])) {
                number = true;
              } else {
                number = false;
              }
            } else {
              continue;
            }
          }
          return number;
        }
        this.forms = 2;
        this.obj0 = {
          // title0: "保安单位基本信息",
        };
        var d = {};
        this.data0 = d;
        this.active = false;
        this.OnceChouse = false;
      }
      this.forms = 1;
      this.obj0 = {
        // title0: "保安单位基本信息",
      };
      var d = {};
      this.data0 = d;
      this.active = false;
      this.OnceChouse = false;
    }
  }
};
  };
</script>
<style lang="scss"></style>