Commit b26f549d by linjinhong

服务管理页面完成提交

parent 3a2a3472
......@@ -192,6 +192,7 @@ export default {
flex-wrap: wrap;
.el-form-item {
margin-right: 0;
display: flex;
}
}
.textClass {
......
......@@ -74,10 +74,16 @@ export default {
ishowForm: false,
select: '',
sourceData: [],
serviceNameList: [],
formData: {},
queryFormData: {},
queryformConfig: [
{ prop: 'name', type: 'input', name: '名称' },
{
prop: 'name',
type: 'select',
name: '名称',
options: []
},
{
prop: 'enable',
type: 'select',
......@@ -91,13 +97,14 @@ export default {
editformConfig: [
{
prop: 'name',
type: 'input',
type: 'select',
name: '名称',
options: [],
renderRules: (item) => [
{
required: true,
message: '请输入名称',
trigger: 'blur'
message: '请选择名称',
trigger: 'change'
}
]
},
......@@ -141,7 +148,25 @@ export default {
renderRules: (item) => [
{
required: item.tollCollectionManner !== '免费',
message: '请输入收费标准',
validator: (rule, value, callback) => {
if (item.tollCollectionManner !== '免费') {
if (value === '' || value === null || value === undefined) {
return callback(new Error('请输入收费标准'))
}
}
const numValue = Number(value)
if (isNaN(numValue)) {
return callback(new Error('请输入有效数字'))
}
if (numValue < 0) {
return callback(new Error('数值必须大于等于0'))
}
// 校验通过
callback()
},
trigger: 'blur'
}
]
......@@ -185,6 +210,8 @@ export default {
}
},
created() {
this.getServiceNameList()
this.getList()
},
computed: {
......@@ -194,7 +221,8 @@ export default {
{
label: '服务名称',
key: 'name',
width: ''
width: '',
render: (item) => <span>{this.serviceNameList.get(item.name)}</span>
},
{
label: '服务类型',
......@@ -396,9 +424,7 @@ export default {
const finalData = isAdd ? { ...postData, id: undefined } : postData
const res = await axios.post(url, finalData)
if (res.code !== 200) {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
return
}
this.dialogVisible = false
......@@ -457,10 +483,6 @@ export default {
message: '删除成功!'
})
this.getList()
} else {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
})
})
......@@ -471,6 +493,28 @@ export default {
this.formData = { enable: true, discount: true }
await this.$refs.formRefs?.resetFields()
},
async getServiceNameList() {
try {
const { data } = await axios.get('serviceManagement/serviceNameList')
const newData = data.map((el) => {
return {
label: el.value,
value: el.key
}
})
this.serviceNameList = new Map(
newData.map((item) => [item.value, item.label])
)
console.log(509, this.serviceNameList)
this.queryformConfig[0].options = [...newData]
this.editformConfig[0].options = [...newData]
} catch (error) {
this.queryformConfig[0].options = []
this.editformConfig[0].options = []
console.log(error)
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment