|
@@ -5,23 +5,23 @@
|
|
:title="titleText"
|
|
:title="titleText"
|
|
v-model="isshow"
|
|
v-model="isshow"
|
|
@cancle="cancel"
|
|
@cancle="cancel"
|
|
- width="40%"
|
|
|
|
:centered="true">
|
|
:centered="true">
|
|
- <a-form-model ref="ruleForm" :model="formData" :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
|
|
|
|
- <a-form-model-item label="司机姓名" prop="name">
|
|
|
|
|
|
+ <a-form-model ref="ruleForm" :model="formData" :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 15 }">
|
|
|
|
+ <a-form-model-item label="司机姓名" prop="name" ref="name">
|
|
<a-input v-model.trim="formData.name" :maxLength="30" placeholder="请输入司机姓名(最多30个字符)" id="addDiverModal-name"/>
|
|
<a-input v-model.trim="formData.name" :maxLength="30" placeholder="请输入司机姓名(最多30个字符)" id="addDiverModal-name"/>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
- <a-form-model-item label="手机号码" prop="phone">
|
|
|
|
- <a-input v-model.trim="formData.phone" @input="mobileInput" :maxLength="11" placeholder="请输入手机号" id="addDiverModal-phone"/>
|
|
|
|
|
|
+ <a-form-model-item label="手机号码" prop="phone" ref="phone">
|
|
|
|
+ <a-input v-model.trim="formData.phone" :maxLength="11" placeholder="请输入手机号" id="addDiverModal-phone"/>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
- <a-form-model-item label="状态" prop="loginFlag"><a-radio-group
|
|
|
|
|
|
+ <a-form-model-item label="状态" prop="loginFlag"ref="loginFlag"><a-radio-group
|
|
name="radioGroup"
|
|
name="radioGroup"
|
|
- v-model="formData.loginFlag" id="addDiverModal-loginFlag"
|
|
|
|
|
|
+ v-model="formData.loginFlag"
|
|
|
|
+ id="addDiverModal-loginFlag"
|
|
>
|
|
>
|
|
<a-radio :value="1">是</a-radio>
|
|
<a-radio :value="1">是</a-radio>
|
|
<a-radio :value="0">否</a-radio>
|
|
<a-radio :value="0">否</a-radio>
|
|
</a-radio-group> </a-form-model-item>
|
|
</a-radio-group> </a-form-model-item>
|
|
- <a-form-model-item label="" class="btn-cont" :wrapper-col="{ span: 24, offset: 9 }">
|
|
|
|
|
|
+ <a-form-model-item label="" class="btn-cont" :wrapper-col="{ span: 24, offset: 8 }">
|
|
<a-button type="primary" @click="onSubmit" :style="{ marginRight: '15px' }" id="addDiverModal-onSubmit">保存</a-button>
|
|
<a-button type="primary" @click="onSubmit" :style="{ marginRight: '15px' }" id="addDiverModal-onSubmit">保存</a-button>
|
|
<a-button @click="cancel" :style="{ marginLeft: '15px' }" id="addDiverModal-cancel">取消</a-button>
|
|
<a-button @click="cancel" :style="{ marginLeft: '15px' }" id="addDiverModal-cancel">取消</a-button>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
@@ -59,9 +59,6 @@ export default {
|
|
titleText: '新增',
|
|
titleText: '新增',
|
|
isshow: this.visible,
|
|
isshow: this.visible,
|
|
formLayout: 'horizontal',
|
|
formLayout: 'horizontal',
|
|
- // form: this.$form.createForm(this, {
|
|
|
|
- // name: 'ruleForm'
|
|
|
|
- // }),
|
|
|
|
optionData: [],
|
|
optionData: [],
|
|
formData: {
|
|
formData: {
|
|
name: '',
|
|
name: '',
|
|
@@ -69,23 +66,9 @@ export default {
|
|
phone: ''
|
|
phone: ''
|
|
},
|
|
},
|
|
rules: {
|
|
rules: {
|
|
- phone: [{
|
|
|
|
- required: true,
|
|
|
|
- pattern: /^\d{11}$/,
|
|
|
|
- message: '请输入手机号',
|
|
|
|
- trigger: 'blur'
|
|
|
|
- }],
|
|
|
|
- name: [{
|
|
|
|
- required: true,
|
|
|
|
- message: '请输入司机姓名',
|
|
|
|
- trigger: 'blur'
|
|
|
|
- }],
|
|
|
|
- loginFlag: [{
|
|
|
|
- required: true,
|
|
|
|
- message: '请选择状态',
|
|
|
|
- trigger: 'blur'
|
|
|
|
- }]
|
|
|
|
- }
|
|
|
|
|
|
+ phone: [{ required: true, pattern: /^\d{11}$/, message: '请输入手机号', trigger: 'blur' }],
|
|
|
|
+ name: [{ required: true, message: '请输入司机姓名', trigger: 'blur' }],
|
|
|
|
+ loginFlag: [{ required: true, message: '请选择状态', trigger: 'blur' }] }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -107,20 +90,23 @@ export default {
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
)
|
|
)
|
|
},
|
|
},
|
|
|
|
+ // 编辑查详情
|
|
getPageInfo () {
|
|
getPageInfo () {
|
|
slelerDetails({
|
|
slelerDetails({
|
|
id: this.itemId
|
|
id: this.itemId
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
console.log(res, '-------------返回数据')
|
|
console.log(res, '-------------返回数据')
|
|
- this.form.setFieldsValue({
|
|
|
|
- 'formData': res.data
|
|
|
|
- })
|
|
|
|
|
|
+ this.formData = Object.assign({}, this.formData, res.data)
|
|
|
|
+ this.formData.loginFlag = Number(this.formData.loginFlag)
|
|
|
|
+ // this.formData.loginFlag
|
|
|
|
+ // console.log(this.formData, '-----------数据')
|
|
// this.form.setFieldsValue({
|
|
// this.form.setFieldsValue({
|
|
- // 'formData.loginFlag': Number(res.data.loginFlag)
|
|
|
|
|
|
+ // 'formData': res.data
|
|
// })
|
|
// })
|
|
- // this.form.setFieldsValue({ 'formData.name': res.data.name })
|
|
|
|
- // this.form.setFieldsValue({ 'formData.phone': res.data.phone })
|
|
|
|
|
|
+ // this.formData.setFieldsValue({ 'formData.loginFlag': Number(res.data.loginFlag) })
|
|
|
|
+ // this.formData.setFieldsValue({ 'formData.name': res.data.name })
|
|
|
|
+ // this.formData.setFieldsValue({ 'formData.phone': res.data.phone })
|
|
// this.form.setFieldsValue({ 'formData.sex': res.data.sex })
|
|
// this.form.setFieldsValue({ 'formData.sex': res.data.sex })
|
|
// this.form.setFieldsValue({ 'formData.org.name': res.data.org.name })
|
|
// this.form.setFieldsValue({ 'formData.org.name': res.data.org.name })
|
|
// this.form.setFieldsValue({ 'formData.remarks': res.data.remarks })
|
|
// this.form.setFieldsValue({ 'formData.remarks': res.data.remarks })
|
|
@@ -130,7 +116,9 @@ export default {
|
|
// 保存提交
|
|
// 保存提交
|
|
onSubmit () {
|
|
onSubmit () {
|
|
this.$refs.ruleForm.validate(valid => {
|
|
this.$refs.ruleForm.validate(valid => {
|
|
|
|
+ console.log(valid, '--------------提交')
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ console.log(valid, '--------------提交', this.formData)
|
|
const params = JSON.parse(JSON.stringify(this.formData))
|
|
const params = JSON.parse(JSON.stringify(this.formData))
|
|
console.log(params)
|
|
console.log(params)
|
|
// saveUserPower(formData).then(res => {
|
|
// saveUserPower(formData).then(res => {
|
|
@@ -151,26 +139,25 @@ export default {
|
|
this.cancel()
|
|
this.cancel()
|
|
},
|
|
},
|
|
clear () {
|
|
clear () {
|
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
delete this.formData.id
|
|
delete this.formData.id
|
|
this.formData.name = ''
|
|
this.formData.name = ''
|
|
this.formData.loginFlag = ''
|
|
this.formData.loginFlag = ''
|
|
this.formData.phone = ''
|
|
this.formData.phone = ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- beforeCreate () {
|
|
|
|
- this.form = this.$form.createForm(this, {
|
|
|
|
- name: 'miniForm'
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
watch: {
|
|
watch: {
|
|
visible (newValue, oldValue) {
|
|
visible (newValue, oldValue) {
|
|
this.isshow = newValue
|
|
this.isshow = newValue
|
|
},
|
|
},
|
|
isshow (val) {
|
|
isshow (val) {
|
|
|
|
+ console.log(val, '------------弹窗')
|
|
if (!val) {
|
|
if (!val) {
|
|
this.$emit('close')
|
|
this.$emit('close')
|
|
} else {
|
|
} else {
|
|
- // this.form.resetFields()
|
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
itemId (newValue, oldValue) {
|
|
itemId (newValue, oldValue) {
|