Appearance
字段属性命名规范
- 前端、后端、数据库字段命名、前后端接口交互,系统统一要素字段名不允许乱起名,要按照规范的要素名称命名,比如部门代码就应该为
departmentCode
,不允许简化成deptCode
。
错误示例:
<template>
</template>
<script>
import fetch from '@/config/fetch';
export default {
data() {
// TODO:字段属性在命名时,不能随意命名,要按照规范的要素名称命名,比如部门编码命名为deptCode,应该命名为departmentCode。
return {
deptCode: '', // 部门编码
deptName: '', // 部门名称
};
},
methods: {
/**
* 获取数据
*/
getData() {
fetch
.post('xxxxxxx', {
// TODO:前后端接口交互时,对于接口参数命名,也要按照规范的要素名称来命名,比如部门编码命名为deptCode,应该命名为departmentCode
deptCode: this.deptCode,
deptName: this.deptName,
})
.then(({ data }) => {
console.log(data);
})
.catch((err) => {
console.error(err);
this.$message({
type: 'error',
message: err.msg,
});
});
},
},
};
</script>
常用字段命名
字段属性 | 字段含义 |
---|---|
fiscalYear | 年度 |
fiscalPeriod | 区间 |
transDate | 业务日期 |
mofDivCode | 区划编码 |
taskId | 任务ID |
agencyCode | 单位代码 |
agencyName | 单位名称 |
departmentCode | 部门代码 |
departmentName | 部门名称 |
userCode | 用户代码 |
userName | 用户名称 |
roleCode | 角色代码 |
roleName | 角色名称 |