Merge branch 'material-ui' of http://192.168.30.2:3000/bonus/bonus-ui into material-ui
This commit is contained in:
		
						commit
						9f43098dbf
					
				| 
						 | 
				
			
			@ -44,6 +44,22 @@ export function getListUnite(data) {
 | 
			
		|||
    data: data,
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
export function getUnitListLeaseApi(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/material/select/getUnitListLease',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 班组领料人-下拉
 | 
			
		||||
export function getListLeasePersonApi(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/material/select/getUnitListLeasePerson',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 领料申请租赁工程下拉框
 | 
			
		||||
export function getListProject(data) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -281,3 +281,9 @@ export function toChineseAmount(n) {
 | 
			
		|||
      .replace(/^整$/, '零元整')
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 身份证-正则校验
 | 
			
		||||
export function validateIdCard(idCard) {
 | 
			
		||||
  const idCardRegex = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/
 | 
			
		||||
  return idCardRegex.test(idCard)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -143,6 +143,7 @@
 | 
			
		|||
                noOptionsText="没有数据"
 | 
			
		||||
                noResultsText="没有搜索结果"
 | 
			
		||||
                placeholder="请选择领用单位"
 | 
			
		||||
                @select="uniteChange"
 | 
			
		||||
              />
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
| 
						 | 
				
			
			@ -176,11 +177,28 @@
 | 
			
		|||
          <el-col :span="20">
 | 
			
		||||
            <el-form-item label="领料人" prop="leasePerson">
 | 
			
		||||
              <el-input
 | 
			
		||||
                v-if="leasePersonList.length === 0"
 | 
			
		||||
                v-model="maForm.leasePerson"
 | 
			
		||||
                placeholder="请输入领料人"
 | 
			
		||||
                maxlength="10"
 | 
			
		||||
                style="width: 240px"
 | 
			
		||||
              >
 | 
			
		||||
              </el-input>
 | 
			
		||||
              <el-select
 | 
			
		||||
                v-else
 | 
			
		||||
                v-model="maForm.leasePerson"
 | 
			
		||||
                placeholder="请选择领料人"
 | 
			
		||||
                style="width: 240px"
 | 
			
		||||
                filterable
 | 
			
		||||
              >
 | 
			
		||||
                <el-option
 | 
			
		||||
                  v-for="(item, index) in leasePersonList"
 | 
			
		||||
                  :key="index"
 | 
			
		||||
                  :label="item.leasePerson"
 | 
			
		||||
                  :value="item.leasePerson"
 | 
			
		||||
                >
 | 
			
		||||
                </el-option>
 | 
			
		||||
              </el-select>
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-row>
 | 
			
		||||
| 
						 | 
				
			
			@ -191,6 +209,7 @@
 | 
			
		|||
                v-model="maForm.phone"
 | 
			
		||||
                placeholder="请输入联系电话"
 | 
			
		||||
                maxlength="11"
 | 
			
		||||
                style="width: 240px"
 | 
			
		||||
              >
 | 
			
		||||
              </el-input>
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
| 
						 | 
				
			
			@ -209,7 +228,7 @@
 | 
			
		|||
import {
 | 
			
		||||
  getApplyInfo,getTypeOptions,applySubmit
 | 
			
		||||
} from "@/api/leasePublish/index";
 | 
			
		||||
import { getListUnite  } from '@/api/lease/apply'
 | 
			
		||||
import { getUnitListLeaseApi, getListLeasePersonApi } from '@/api/lease/apply'
 | 
			
		||||
import { getToken } from "@/utils/auth";
 | 
			
		||||
import Treeselect from '@riophae/vue-treeselect'
 | 
			
		||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 | 
			
		||||
| 
						 | 
				
			
			@ -277,6 +296,7 @@ export default {
 | 
			
		|||
        leasePerson: "",
 | 
			
		||||
        phone: "",
 | 
			
		||||
      },
 | 
			
		||||
      leasePersonList: [],
 | 
			
		||||
      //上层信息
 | 
			
		||||
      leaseApplyData: {},
 | 
			
		||||
      openView: false,
 | 
			
		||||
| 
						 | 
				
			
			@ -300,11 +320,11 @@ export default {
 | 
			
		|||
          {
 | 
			
		||||
            required: true,
 | 
			
		||||
            message: '请输入领料人',
 | 
			
		||||
            trigger: 'blur'
 | 
			
		||||
            trigger: 'change'
 | 
			
		||||
          }
 | 
			
		||||
        ],
 | 
			
		||||
        phone: [
 | 
			
		||||
          { required: true, message: '联系电话不能为空', trigger: 'blur' },
 | 
			
		||||
          // { required: true, message: '联系电话不能为空', trigger: 'blur' },
 | 
			
		||||
          {
 | 
			
		||||
            pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
 | 
			
		||||
            message: '请输入正确的手机号码',
 | 
			
		||||
| 
						 | 
				
			
			@ -327,6 +347,19 @@ export default {
 | 
			
		|||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    uniteChange(e) {
 | 
			
		||||
      this.getLeasePersonList(e.id)
 | 
			
		||||
    },
 | 
			
		||||
    // 获取领料人列表
 | 
			
		||||
    async getLeasePersonList(teamId) {
 | 
			
		||||
      try {
 | 
			
		||||
        const res = await getListLeasePersonApi({ leaseId: this.id, teamId})
 | 
			
		||||
        this.leasePersonList = res.data || []
 | 
			
		||||
        if (this.leasePersonList.length == 0) this.maForm.leasePerson = ''
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        console.log('🚀 ~ 获取领料人列表失败 ~ error:', error)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    /** 转换菜单数据结构 */
 | 
			
		||||
    normalizer(node) {
 | 
			
		||||
      if (node.children && !node.children.length) {
 | 
			
		||||
| 
						 | 
				
			
			@ -341,7 +374,7 @@ export default {
 | 
			
		|||
 | 
			
		||||
    /** 选择单位 */
 | 
			
		||||
    async getUnit(){
 | 
			
		||||
        getListUnite({ projectId: this.leaseApplyData.leaseProjectId }).then(response => {
 | 
			
		||||
        getUnitListLeaseApi({ projectId: this.leaseApplyData.leaseProjectId, leaseId: this.id }).then(response => {
 | 
			
		||||
          this.uniteList = response.data
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			@ -409,6 +442,7 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
 | 
			
		||||
    handleSign(){
 | 
			
		||||
        this.closeView()
 | 
			
		||||
        this.$router.push({ path: '/lease/protocol' })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,13 +106,14 @@
 | 
			
		|||
                @pagination="getList"
 | 
			
		||||
    />
 | 
			
		||||
 | 
			
		||||
    <el-dialog :title="dialogTitle" :visible.sync="authDialogVisible" width="800px" append-to-body>
 | 
			
		||||
      <el-form :model="authForm" ref="authFormRef" label-width="110px" class="auth-dialog-form">
 | 
			
		||||
        <el-form-item label="选择班组:" prop="teamId" required>
 | 
			
		||||
    <el-dialog :title="dialogTitle" :visible.sync="authDialogVisible" width="850px" append-to-body>
 | 
			
		||||
      <el-form :model="authForm" ref="authFormRef" label-width="110px" class="auth-dialog-form" :rules="authFormRules">
 | 
			
		||||
        <el-form-item label="选择班组:" prop="teamId">
 | 
			
		||||
          <el-select
 | 
			
		||||
            v-model="authForm.teamId"
 | 
			
		||||
            placeholder="请选择班组"
 | 
			
		||||
            clearable
 | 
			
		||||
            filterable
 | 
			
		||||
            style="width: 40%"
 | 
			
		||||
            :disabled="isEditMode"
 | 
			
		||||
          >
 | 
			
		||||
| 
						 | 
				
			
			@ -153,12 +154,12 @@
 | 
			
		|||
                      <el-table-column label="序号" type="index" width="60" align="center"></el-table-column>
 | 
			
		||||
                      <el-table-column label="姓名" prop="name" align="center">
 | 
			
		||||
                        <template slot-scope="scope">
 | 
			
		||||
                          <el-input v-model="scope.row.name" placeholder="请上传身份证识别" :disabled="true"></el-input>
 | 
			
		||||
                          <el-input v-model="scope.row.name" placeholder="请上传身份证识别" maxlength="30"></el-input>
 | 
			
		||||
                        </template>
 | 
			
		||||
                      </el-table-column>
 | 
			
		||||
                      <el-table-column label="身份证号码" prop="idNumber" align="center">
 | 
			
		||||
                        <template slot-scope="scope">
 | 
			
		||||
                          <el-input v-model="scope.row.idNumber" placeholder="请上传身份证识别" :disabled="true"></el-input>
 | 
			
		||||
                          <el-input v-model="scope.row.idNumber" placeholder="请上传身份证识别" maxlength="18" @blur="handleIdCard(scope.row)"></el-input>
 | 
			
		||||
                        </template>
 | 
			
		||||
                      </el-table-column>
 | 
			
		||||
                      <el-table-column label="身份证照片" prop="idPhotos" align="center" width="200">
 | 
			
		||||
| 
						 | 
				
			
			@ -316,6 +317,7 @@ import {
 | 
			
		|||
  uploadIdCard
 | 
			
		||||
} from "@/api/materialsStation/auth";
 | 
			
		||||
import {getToken} from "@/utils/auth";
 | 
			
		||||
import { validateIdCard } from "@/utils/bonus"
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'IdCardUploadComponent',
 | 
			
		||||
  data() {
 | 
			
		||||
| 
						 | 
				
			
			@ -369,6 +371,9 @@ export default {
 | 
			
		|||
      titles:'',
 | 
			
		||||
      authDialogVisible: false,
 | 
			
		||||
      teamList: [], // 班组列表
 | 
			
		||||
      authFormRules: {
 | 
			
		||||
        teamId: [{ required: true, message: '请选择班组', trigger: 'change' }],
 | 
			
		||||
      },
 | 
			
		||||
      authForm: {
 | 
			
		||||
        teamId: '',
 | 
			
		||||
        teamName: '',
 | 
			
		||||
| 
						 | 
				
			
			@ -410,6 +415,7 @@ export default {
 | 
			
		|||
      if (!newVal) {
 | 
			
		||||
        // 弹框关闭时重置上传相关状态
 | 
			
		||||
        this.resetUploadState();
 | 
			
		||||
        this.$refs.authFormRef.resetFields(); // 重置表单
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			@ -418,6 +424,14 @@ export default {
 | 
			
		|||
    selectable(row) {
 | 
			
		||||
      return row.authId === null;
 | 
			
		||||
    },
 | 
			
		||||
    // 身份证号码校验
 | 
			
		||||
    handleIdCard(row) {
 | 
			
		||||
      const idCard = row.idNumber;
 | 
			
		||||
      const isValid = validateIdCard(idCard)
 | 
			
		||||
      if (!isValid) {
 | 
			
		||||
        this.$message.error('身份证号码格式不正确')
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 上传前验证
 | 
			
		||||
    beforeIdPhotoUpload(file) {
 | 
			
		||||
      const isImage = file.type.startsWith('image/');
 | 
			
		||||
| 
						 | 
				
			
			@ -709,6 +723,12 @@ export default {
 | 
			
		|||
          this.$message.error(`第 ${i + 1} 个领料人请上传身份证正反面照片`);
 | 
			
		||||
          return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 身份证号码格式验证
 | 
			
		||||
        if (!validateIdCard(receiver.idNumber)) {
 | 
			
		||||
          this.$message.error(`第 ${i + 1} 个领料人身份证号码格式不正确`);
 | 
			
		||||
          return false
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // 批量模式下额外验证
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue