|
@@ -177,7 +177,11 @@
|
|
|
placeholder="联系电话"
|
|
|
maxlength="100"
|
|
|
:disabled="isDetail == '007'"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <el-select slot="prepend" v-model="currentMobileMode" style="width:120px">
|
|
|
+ <el-option v-for="opt in options" :key="opt.value" :label="opt.label" :value="opt.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
@@ -205,23 +209,25 @@
|
|
|
<script>
|
|
|
import asyncRequest from '@/apis/service/serviceParam/workCompany'
|
|
|
import resToken from '@/mixins/resToken'
|
|
|
-import { isMobile, isPhone, invTime } from '@/utils/validate'
|
|
|
+import { isMobile, isPhone, invTime, isqzf, isqz, iszf, isz } from '@/utils/validate'
|
|
|
export default {
|
|
|
name: 'WorkCompany',
|
|
|
mixins: [resToken],
|
|
|
props: ['showModel', 'id', 'isDetail'],
|
|
|
data() {
|
|
|
- const validatemobile = (rule, value, callback) => {
|
|
|
- if (value !== '') {
|
|
|
- if (isPhone(value) || isMobile(value)) {
|
|
|
- callback()
|
|
|
- } else {
|
|
|
- callback(new Error('联系电话格式不正确!'))
|
|
|
- }
|
|
|
- } else {
|
|
|
- callback(new Error('联系电话不能为空!'))
|
|
|
- }
|
|
|
- }
|
|
|
+ // const validatemobile = (rule, value, callback) => {
|
|
|
+ // if (value !== '') {
|
|
|
+ // if (isPhone(value) || isMobile(value)) {
|
|
|
+ // callback()
|
|
|
+ // } else {
|
|
|
+ // callback(new Error('联系电话格式不正确!'))
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // callback(new Error('联系电话不能为空!'))
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ const basicRule = { required: true, trigger: 'blur' }
|
|
|
|
|
|
return {
|
|
|
pickerOptions: {
|
|
@@ -229,6 +235,7 @@ export default {
|
|
|
return time.getTime() >= Date.now()
|
|
|
}
|
|
|
},
|
|
|
+ currentMobileMode: '0',
|
|
|
supplier_name: '',
|
|
|
accountNames: '',
|
|
|
loading: false,
|
|
@@ -252,6 +259,102 @@ export default {
|
|
|
invoice_title: ''
|
|
|
},
|
|
|
rulesThis: this.rules,
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: '0',
|
|
|
+ label: '区-固-分',
|
|
|
+ rule: {
|
|
|
+ ...basicRule,
|
|
|
+ validator(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ return callback(new Error('联系电话不能为空!'))
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isqzf(value)) {
|
|
|
+ callback(new Error('联系电话格式不正确!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '1',
|
|
|
+ label: '区-固',
|
|
|
+ rule: {
|
|
|
+ ...basicRule,
|
|
|
+ validator(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ return callback(new Error('联系电话不能为空!'))
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isqz(value)) {
|
|
|
+ callback(new Error('联系电话格式不正确!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '2',
|
|
|
+ label: '固-分',
|
|
|
+ rule: {
|
|
|
+ ...basicRule,
|
|
|
+ validator(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ return callback(new Error('联系电话不能为空!'))
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!iszf(value)) {
|
|
|
+ callback(new Error('联系电话格式不正确!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '3',
|
|
|
+ label: '固',
|
|
|
+ rule: {
|
|
|
+ ...basicRule,
|
|
|
+ validator(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ return callback(new Error('联系电话不能为空!'))
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isz(value)) {
|
|
|
+ callback(new Error('联系电话格式不正确!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '4',
|
|
|
+ label: '手机号',
|
|
|
+ rule: {
|
|
|
+ ...basicRule,
|
|
|
+ validator(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error('联系电话不能为空!'))
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isMobile(value)) {
|
|
|
+ callback(new Error('联系电话格式不正确!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
rules: {
|
|
|
inv_bank: [
|
|
|
{
|
|
@@ -270,9 +373,19 @@ export default {
|
|
|
|
|
|
mobile: [
|
|
|
{
|
|
|
- required: true,
|
|
|
- validator: validatemobile,
|
|
|
- trigger: 'blur'
|
|
|
+ ...basicRule,
|
|
|
+ validator(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ return callback(new Error('联系电话不能为空!'))
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isqzf(value)) {
|
|
|
+ callback(new Error('联系电话格式不正确!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
],
|
|
|
invoice_title: [{ required: true, message: '公司抬头不能为空!', trigger: 'blur' }],
|
|
@@ -291,6 +404,9 @@ export default {
|
|
|
if (!val) {
|
|
|
this.$emit('cancel')
|
|
|
}
|
|
|
+ },
|
|
|
+ currentMobileMode() {
|
|
|
+ this.$set(this.rulesThis.mobile, '0', this.options[this.currentMobileMode].rule)
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -342,6 +458,9 @@ export default {
|
|
|
invoice_title
|
|
|
} = res.data
|
|
|
|
|
|
+ const index = this.options.findIndex(({ rule }) => rule.validator('', mobile, () => {}))
|
|
|
+ this.currentMobileMode = String(index)
|
|
|
+
|
|
|
this.ruleForm = {
|
|
|
id: id || '',
|
|
|
company: company || '', // 公司名称
|