【modify】使用ESLint格式化代码

This commit is contained in:
zer0Black
2023-03-01 09:33:58 +08:00
parent 694855ae8b
commit 63369b8b87
400 changed files with 42942 additions and 43132 deletions
@@ -31,108 +31,107 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import { httpAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'SysFillRuleModal',
components: {},
data() {
return {
title: '操作',
visible: false,
model: {},
labelCol: { xs: { span: 24 }, sm: { span: 5 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
export default {
name: 'SysFillRuleModal',
components: {},
data () {
return {
title: '操作',
visible: false,
model: {},
labelCol: { xs: { span: 24 }, sm: { span: 5 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
confirmLoading: false,
validatorRules: {
ruleName: [{ required: true, message: '规则名称不能为空' }],
ruleCode: [
{ required: true, message: '规则Code不能为空' },
{ validator: (rule, value, callback) => validateDuplicateValue('sys_fill_rule', 'rule_code', value, this.model.id, callback) }
],
ruleClass: [{ required: true, message: '规则实现类不能为空' }],
ruleParams: [{
validator: (rule, value, callback) => {
try {
let json = JSON.parse(value)
if (json instanceof Array) {
callback('只能传递JSON对象不能传递JSON数组')
} else if (json instanceof Object) {
callback()
} else {
callback('请输入JSON字符串')
}
} catch {
confirmLoading: false,
validatorRules: {
ruleName: [{ required: true, message: '规则名称不能为空' }],
ruleCode: [
{ required: true, message: '规则Code不能为空' },
{ validator: (rule, value, callback) => validateDuplicateValue('sys_fill_rule', 'rule_code', value, this.model.id, callback) }
],
ruleClass: [{ required: true, message: '规则实现类不能为空' }],
ruleParams: [{
validator: (rule, value, callback) => {
try {
const json = JSON.parse(value)
if (json instanceof Array) {
callback('只能传递JSON对象不能传递JSON数组')
} else if (json instanceof Object) {
callback()
} else {
callback('请输入JSON字符串')
}
} catch {
callback('请输入JSON字符串')
}
}],
},
url: {
add: '/sys/fillRule/add',
edit: '/sys/fillRule/edit',
},
}
},
computed: {
disabledCode() {
return !!this.model.id
}
},
created() {
},
methods: {
add() {
this.edit({})
},
edit(record) {
this.visible = true
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
})
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
const that = this
// 触发表单验证
this.$refs.form.validate((ok, err) => {
if (ok) {
that.confirmLoading = true
let httpUrl = this.url.add, method = 'post'
if (this.model.id) {
httpUrl = this.url.edit
method = 'put'
}
httpAction(httpUrl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
}]
},
handleCancel() {
this.close()
url: {
add: '/sys/fillRule/add',
edit: '/sys/fillRule/edit'
}
}
},
computed: {
disabledCode () {
return !!this.model.id
}
},
created () {
},
methods: {
add () {
this.edit({})
},
edit (record) {
this.visible = true
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
})
},
close () {
this.$emit('close')
this.visible = false
},
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate((ok, err) => {
if (ok) {
that.confirmLoading = true
let httpUrl = this.url.add; let method = 'post'
if (this.model.id) {
httpUrl = this.url.edit
method = 'put'
}
httpAction(httpUrl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
</style>
</style>