riku
2022-08-10 51600113c20d84ee54660de23324400604704dc2
pages/promiseinfo/promiseinfo.js
@@ -20,48 +20,64 @@
    sceneType: '--',
    msg: [{
      name: "单位名称",
      id: "department",
      input: true,
      value: "",
      noValue: false
    },
    {
      name: "信用代码",
      id: "socialCode",
      input: true,
      value: "",
      noValue: false
    },
    {
      name: "报建号",
      id: "number",
      input: true,
      value: "",
      noValue: false
    },
    {
      name: "法人姓名",
      id: "juridicalPerson",
      input: true,
      value: '',
      noValue: false
    },
    {
      name: "身份证号",
      id: "idNo",
      input: true,
      value: "",
      noValue: false,
      maxLength: 18
    },
  ],
        name: "单位名称",
        id: "department",
        input: true,
        value: "",
        noValue: false
      },
      {
        name: "信用代码",
        id: "socialCode",
        input: true,
        value: "",
        noValue: false
      },
      {
        name: "报建号",
        id: "number",
        input: true,
        value: "",
        noValue: false,
        required: false
      },
      {
        name: "法人姓名",
        id: "juridicalPerson",
        input: true,
        value: '',
        noValue: false
      },
      {
        name: "身份证号",
        id: "idNo",
        input: true,
        value: "",
        noValue: false,
        maxLength: 18
      },
    ],
    commitTypes: [
      {value: 'type1', name: '环保主体责任承诺', checked: true},
      {value: 'type2', name: '环境行政许可事项', checked: false},
      {value: 'type3', name: '环保专项资金或其他资金补助', checked: false},
      {value: 'type4', name: '其他环保申报事项', checked: false}
    commitTypes: [{
        value: 'type1',
        name: '环保主体责任承诺',
        checked: true
      },
      {
        value: 'type2',
        name: '环境行政许可事项',
        checked: false
      },
      {
        value: 'type3',
        name: '环保专项资金或其他资金补助',
        checked: false
      },
      {
        value: 'type4',
        name: '其他环保申报事项',
        checked: false
      }
    ],
    commitTypeIndex: 0,
  },
@@ -71,6 +87,29 @@
   */
  onLoad: function (options) {
    let st = this.data.sceneTypeMap[app.globalData.userInfo.extension2]
    switch (st) {
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
        this.setData({
          'msg[2].name': '报建号'
        })
        break;
      case '1':
      case '7':
        this.setData({
          'msg[2].name': '环评审批文号'
        })
        break;
      default:
        this.setData({
          'msg[2].name': '环评审批文号'
        })
        break;
    }
    this.setData({
      sceneType: st
    })
@@ -176,12 +215,12 @@
  /**
   * 信息完整度检查
   */
  submitCheck () {
  submitCheck() {
    let msg = this.data.msg
    let msgLength = msg.length
    //确认信息完整度
    for (let i = 0; i < msgLength; i++) {
      if (msg[i].value === "") {
      if (msg[i].required != false && msg[i].value === "") {
        let error = msg[i].name + "不可为空"
        let path = "msg[" + i + "].noValue"
        this.setData({
@@ -196,6 +235,34 @@
        })
        return false
      }
      //身份证位数判断
      if (i == 4) {
        if (msg[i].value.length < msg[i].maxLength) {
          let error = msg[i].name + "位数错误"
          let path = "msg[" + i + "].noValue"
          this.setData({
            errorMsg: error,
            [path]: true
          })
          return false
        }
      }
    }
    var cList = []
    for (let i = 0; i < this.data.commitTypes.length; i++) {
      const t = this.data.commitTypes[i];
      if (t.checked) {
        cList.push(t)
      }
    }
    if (cList.length == 0) {
      this.setData({
        errorMsg: '至少选择一项承诺类型',
      })
      return false
    }
    return true