9 changed files with 193 additions and 140 deletions
-
2src/assets/scss/_base.scss
-
18src/assets/scss/global.scss
-
158src/views/modules/sys/config-add-or-update.vue
-
33src/views/modules/sys/menu-add-or-update.vue
-
14src/views/modules/sys/menu.vue
-
12src/views/modules/sys/role-add-or-update.vue
-
15src/views/modules/sys/role.vue
-
49src/views/modules/sys/user-add-or-update.vue
-
32src/views/modules/sys/user.vue
@ -1,99 +1,109 @@ |
|||||
<template> |
<template> |
||||
<el-dialog |
<el-dialog |
||||
|
width="285px" |
||||
:title="!dataForm.id ? '新增' : '修改'" |
:title="!dataForm.id ? '新增' : '修改'" |
||||
:close-on-click-modal="false" |
:close-on-click-modal="false" |
||||
:visible.sync="visible"> |
:visible.sync="visible"> |
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> |
|
||||
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" |
||||
|
label-width="80px"> |
||||
<el-form-item label="参数名" prop="paramKey"> |
<el-form-item label="参数名" prop="paramKey"> |
||||
<el-input v-model="dataForm.paramKey" placeholder="参数名"></el-input> |
|
||||
|
<el-input v-model="dataForm.paramKey" style="width: 150px;" placeholder="参数名"></el-input> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="参数值" prop="paramValue"> |
<el-form-item label="参数值" prop="paramValue"> |
||||
<el-input v-model="dataForm.paramValue" placeholder="参数值"></el-input> |
|
||||
|
<el-input v-model="dataForm.paramValue" style="width: 150px;" placeholder="参数值"></el-input> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="备注" prop="remark"> |
<el-form-item label="备注" prop="remark"> |
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input> |
|
||||
|
<el-input v-model="dataForm.remark" style="width: 150px;" placeholder="备注"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="状态" size="mini" prop="status"> |
||||
|
<el-radio-group v-model="dataForm.status"> |
||||
|
<el-radio :label="0">禁用</el-radio> |
||||
|
<el-radio :label="1">正常</el-radio> |
||||
|
</el-radio-group> |
||||
</el-form-item> |
</el-form-item> |
||||
</el-form> |
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="visible = false">取消</el-button> |
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> |
|
||||
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> |
||||
|
<el-button @click="visible = false">取消</el-button> |
||||
</span> |
</span> |
||||
</el-dialog> |
</el-dialog> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
export default { |
|
||||
data () { |
|
||||
return { |
|
||||
visible: false, |
|
||||
dataForm: { |
|
||||
id: 0, |
|
||||
paramKey: '', |
|
||||
paramValue: '', |
|
||||
remark: '' |
|
||||
}, |
|
||||
dataRule: { |
|
||||
paramKey: [ |
|
||||
{ required: true, message: '参数名不能为空', trigger: 'blur' } |
|
||||
], |
|
||||
paramValue: [ |
|
||||
{ required: true, message: '参数值不能为空', trigger: 'blur' } |
|
||||
] |
|
||||
} |
|
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
visible: false, |
||||
|
dataForm: { |
||||
|
id: 0, |
||||
|
paramKey: '', |
||||
|
paramValue: '', |
||||
|
remark: '', |
||||
|
status: 1 |
||||
|
}, |
||||
|
dataRule: { |
||||
|
paramKey: [ |
||||
|
{required: true, message: '参数名不能为空', trigger: 'blur'} |
||||
|
], |
||||
|
paramValue: [ |
||||
|
{required: true, message: '参数值不能为空', trigger: 'blur'} |
||||
|
] |
||||
} |
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
init(id) { |
||||
|
this.dataForm.id = id || 0 |
||||
|
this.visible = true |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs['dataForm'].resetFields() |
||||
|
if (this.dataForm.id) { |
||||
|
this.$http({ |
||||
|
url: this.$http.adornUrl(`/sys/config/info/${this.dataForm.id}`), |
||||
|
method: 'get', |
||||
|
params: this.$http.adornParams() |
||||
|
}).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.dataForm.paramKey = data.config.paramKey |
||||
|
this.dataForm.paramValue = data.config.paramValue |
||||
|
this.dataForm.remark = data.config.remark |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
}, |
}, |
||||
methods: { |
|
||||
init (id) { |
|
||||
this.dataForm.id = id || 0 |
|
||||
this.visible = true |
|
||||
this.$nextTick(() => { |
|
||||
this.$refs['dataForm'].resetFields() |
|
||||
if (this.dataForm.id) { |
|
||||
this.$http({ |
|
||||
url: this.$http.adornUrl(`/sys/config/info/${this.dataForm.id}`), |
|
||||
method: 'get', |
|
||||
params: this.$http.adornParams() |
|
||||
}).then(({data}) => { |
|
||||
if (data && data.code === 0) { |
|
||||
this.dataForm.paramKey = data.config.paramKey |
|
||||
this.dataForm.paramValue = data.config.paramValue |
|
||||
this.dataForm.remark = data.config.remark |
|
||||
} |
|
||||
|
// 表单提交 |
||||
|
dataFormSubmit() { |
||||
|
this.$refs['dataForm'].validate((valid) => { |
||||
|
if (valid) { |
||||
|
this.$http({ |
||||
|
url: this.$http.adornUrl(`/sys/config/${!this.dataForm.id ? 'save' : 'update'}`), |
||||
|
method: 'post', |
||||
|
data: this.$http.adornData({ |
||||
|
'id': this.dataForm.id || undefined, |
||||
|
'paramKey': this.dataForm.paramKey, |
||||
|
'paramValue': this.dataForm.paramValue, |
||||
|
'remark': this.dataForm.remark, |
||||
|
'status': this.dataForm.status |
||||
}) |
}) |
||||
} |
|
||||
}) |
|
||||
}, |
|
||||
// 表单提交 |
|
||||
dataFormSubmit () { |
|
||||
this.$refs['dataForm'].validate((valid) => { |
|
||||
if (valid) { |
|
||||
this.$http({ |
|
||||
url: this.$http.adornUrl(`/sys/config/${!this.dataForm.id ? 'save' : 'update'}`), |
|
||||
method: 'post', |
|
||||
data: this.$http.adornData({ |
|
||||
'id': this.dataForm.id || undefined, |
|
||||
'paramKey': this.dataForm.paramKey, |
|
||||
'paramValue': this.dataForm.paramValue, |
|
||||
'remark': this.dataForm.remark |
|
||||
|
}).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.$message({ |
||||
|
message: '操作成功', |
||||
|
type: 'success', |
||||
|
duration: 1500, |
||||
|
onClose: () => { |
||||
|
this.visible = false |
||||
|
this.$emit('refreshDataList') |
||||
|
} |
||||
}) |
}) |
||||
}).then(({data}) => { |
|
||||
if (data && data.code === 0) { |
|
||||
this.$message({ |
|
||||
message: '操作成功', |
|
||||
type: 'success', |
|
||||
duration: 1500, |
|
||||
onClose: () => { |
|
||||
this.visible = false |
|
||||
this.$emit('refreshDataList') |
|
||||
} |
|
||||
}) |
|
||||
} else { |
|
||||
this.$message.error(data.msg) |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
|
} else { |
||||
|
this.$message.error(data.msg) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
} |
} |
||||
} |
} |
||||
|
} |
||||
</script> |
</script> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue