added ESlint 语法检测

This commit is contained in:
何秀钢
2021-06-02 14:11:45 +08:00
parent 3932a8fbf3
commit 2f0465a1a1
94 changed files with 5031 additions and 4790 deletions
@@ -3,62 +3,62 @@
<div class="search-term">
<el-form :inline="true" :model="searchInfo" class="demo-form-inline">
<el-form-item label="字典名(中)">
<el-input placeholder="搜索条件" v-model="searchInfo.name"></el-input>
<el-input v-model="searchInfo.name" placeholder="搜索条件" />
</el-form-item>
<el-form-item label="字典名(英)">
<el-input placeholder="搜索条件" v-model="searchInfo.type"></el-input>
<el-input v-model="searchInfo.type" placeholder="搜索条件" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="searchInfo.status" clear placeholder="请选择">
<el-option key="true" label="是" value="true"></el-option>
<el-option key="false" label="否" value="false"></el-option>
<el-option key="true" label="是" value="true" />
<el-option key="false" label="否" value="false" />
</el-select>
</el-form-item>
<el-form-item label="描述">
<el-input placeholder="搜索条件" v-model="searchInfo.desc"></el-input>
<el-input v-model="searchInfo.desc" placeholder="搜索条件" />
</el-form-item>
<el-form-item>
<el-button @click="onSubmit" type="primary">查询</el-button>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
<el-form-item>
<el-button @click="openDialog" type="primary">新增字典</el-button>
<el-button type="primary" @click="openDialog">新增字典</el-button>
</el-form-item>
</el-form>
</div>
<el-table
ref="multipleTable"
:data="tableData"
border
ref="multipleTable"
stripe
style="width: 100%"
tooltip-effect="dark"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="selection" width="55" />
<el-table-column label="日期" width="180">
<template slot-scope="scope">{{scope.row.CreatedAt|formatDate}}</template>
<template slot-scope="scope">{{ scope.row.CreatedAt|formatDate }}</template>
</el-table-column>
<el-table-column label="字典名(中)" prop="name" width="120"></el-table-column>
<el-table-column label="字典名(中)" prop="name" width="120" />
<el-table-column label="字典名(英)" prop="type" width="120"></el-table-column>
<el-table-column label="字典名(英)" prop="type" width="120" />
<el-table-column label="状态" prop="status" width="120">
<template slot-scope="scope">{{scope.row.status|formatBoolean}}</template>
<template slot-scope="scope">{{ scope.row.status|formatBoolean }}</template>
</el-table-column>
<el-table-column label="描述" prop="desc" width="280"></el-table-column>
<el-table-column label="描述" prop="desc" width="280" />
<el-table-column label="按钮组">
<template slot-scope="scope">
<el-button @click="toDetile(scope.row)" size="small" type="success">详情</el-button>
<el-button @click="updateSysDictionary(scope.row)" size="small" type="primary">变更</el-button>
<el-popover placement="top" width="160" v-model="scope.row.visible">
<el-button size="small" type="success" @click="toDetile(scope.row)">详情</el-button>
<el-button size="small" type="primary" @click="updateSysDictionary(scope.row)">变更</el-button>
<el-popover v-model="scope.row.visible" placement="top" width="160">
<p>确定要删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteSysDictionary(scope.row)">确定</el-button>
</div>
<el-button type="danger" icon="el-icon-delete" size="mini" slot="reference" style="margin-left:10px">删除</el-button>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" style="margin-left:10px">删除</el-button>
</el-popover>
</template>
</el-table-column>
@@ -70,10 +70,10 @@
:page-sizes="[10, 30, 50, 100]"
:style="{float:'right',padding:'20px'}"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
/>
<el-dialog :before-close="closeDialog" :visible.sync="dialogFormVisible" title="弹窗操作">
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="110px">
@@ -83,7 +83,7 @@
placeholder="请输入字典名(中)"
clearable
:style="{width: '100%'}"
></el-input>
/>
</el-form-item>
<el-form-item label="字典名(英)" prop="type">
<el-input
@@ -91,19 +91,19 @@
placeholder="请输入字典名(英)"
clearable
:style="{width: '100%'}"
></el-input>
/>
</el-form-item>
<el-form-item label="状态" prop="status" required>
<el-switch v-model="formData.status" active-text="开启" inactive-text="停用"></el-switch>
<el-switch v-model="formData.status" active-text="开启" inactive-text="停用" />
</el-form-item>
<el-form-item label="描述" prop="desc">
<el-input v-model="formData.desc" placeholder="请输入描述" clearable :style="{width: '100%'}"></el-input>
<el-input v-model="formData.desc" placeholder="请输入描述" clearable :style="{width: '100%'}" />
</el-form-item>
</el-form>
<div class="dialog-footer" slot="footer">
<div slot="footer" class="dialog-footer">
<el-button @click="closeDialog">取 消</el-button>
<el-button @click="enterDialog" type="primary">确 定</el-button>
<el-button type="primary" @click="enterDialog">确 定</el-button>
</div>
</el-dialog>
@@ -118,17 +118,34 @@ import {
updateSysDictionary,
findSysDictionary,
getSysDictionaryList
} from "@/api/sysDictionary"; // 此处请自行替换地址
import { formatTimeToStr } from "@/utils/date";
import infoList from "@/mixins/infoList";
} from '@/api/sysDictionary' // 此处请自行替换地址
import { formatTimeToStr } from '@/utils/date'
import infoList from '@/mixins/infoList'
export default {
name: "SysDictionary",
name: 'SysDictionary',
filters: {
formatDate: function(time) {
if (time !== null && time !== '') {
var date = new Date(time)
return formatTimeToStr(date, 'yyyy-MM-dd hh:mm:ss')
} else {
return ''
}
},
formatBoolean: function(bool) {
if (bool !== null) {
return bool ? '是' : '否'
} else {
return ''
}
}
},
mixins: [infoList],
data() {
return {
listApi: getSysDictionaryList,
dialogFormVisible: false,
type: "",
type: '',
formData: {
name: null,
type: null,
@@ -139,124 +156,107 @@ export default {
name: [
{
required: true,
message: "请输入字典名(中)",
trigger: "blur"
message: '请输入字典名(中)',
trigger: 'blur'
}
],
type: [
{
required: true,
message: "请输入字典名(英)",
trigger: "blur"
message: '请输入字典名(英)',
trigger: 'blur'
}
],
desc: [
{
required: true,
message: "请输入描述",
trigger: "blur"
message: '请输入描述',
trigger: 'blur'
}
]
}
};
},
filters: {
formatDate: function(time) {
if (time != null && time != "") {
var date = new Date(time);
return formatTimeToStr(date, "yyyy-MM-dd hh:mm:ss");
} else {
return "";
}
},
formatBoolean: function(bool) {
if (bool != null) {
return bool ? "是" : "否";
} else {
return "";
}
}
},
async created() {
this.getTableData()
},
methods: {
toDetile(row) {
this.$router.push({
name: "dictionaryDetail",
name: 'dictionaryDetail',
params: {
id: row.ID
}
});
})
},
//条件搜索前端看此方法
// 条件搜索前端看此方法
onSubmit() {
this.page = 1;
this.pageSize = 10;
if (this.searchInfo.status == "") {
this.searchInfo.status = null;
this.page = 1
this.pageSize = 10
if (this.searchInfo.status === '') {
this.searchInfo.status = null
}
this.getTableData();
this.getTableData()
},
async updateSysDictionary(row) {
const res = await findSysDictionary({ ID: row.ID });
this.type = "update";
if (res.code == 0) {
this.formData = res.data.resysDictionary;
this.dialogFormVisible = true;
const res = await findSysDictionary({ ID: row.ID })
this.type = 'update'
if (res.code === 0) {
this.formData = res.data.resysDictionary
this.dialogFormVisible = true
}
},
closeDialog() {
this.dialogFormVisible = false;
this.dialogFormVisible = false
this.formData = {
name: null,
type: null,
status: true,
desc: null
};
}
},
async deleteSysDictionary(row) {
row.visible = false;
const res = await deleteSysDictionary({ ID: row.ID });
if (res.code == 0) {
row.visible = false
const res = await deleteSysDictionary({ ID: row.ID })
if (res.code === 0) {
this.$message({
type: "success",
message: "删除成功"
});
if (this.tableData.length == 1 && this.page > 1 ) {
this.page--;
type: 'success',
message: '删除成功'
})
if (this.tableData.length === 1 && this.page > 1) {
this.page--
}
this.getTableData();
this.getTableData()
}
},
async enterDialog() {
this.$refs["elForm"].validate(async valid => {
if (!valid) return;
let res;
this.$refs['elForm'].validate(async valid => {
if (!valid) return
let res
switch (this.type) {
case "create":
res = await createSysDictionary(this.formData);
break;
case "update":
res = await updateSysDictionary(this.formData);
break;
case 'create':
res = await createSysDictionary(this.formData)
break
case 'update':
res = await updateSysDictionary(this.formData)
break
default:
res = await createSysDictionary(this.formData);
break;
res = await createSysDictionary(this.formData)
break
}
if (res.code == 0) {
this.closeDialog();
this.getTableData();
if (res.code === 0) {
this.closeDialog()
this.getTableData()
}
});
})
},
openDialog() {
this.type = "create";
this.dialogFormVisible = true;
this.type = 'create'
this.dialogFormVisible = true
}
},
async created() {
this.getTableData();
}
};
}
</script>
<style>
</style>
</style>
@@ -3,58 +3,58 @@
<div class="search-term">
<el-form :inline="true" :model="searchInfo" class="demo-form-inline">
<el-form-item label="展示值">
<el-input placeholder="搜索条件" v-model="searchInfo.label"></el-input>
<el-input v-model="searchInfo.label" placeholder="搜索条件" />
</el-form-item>
<el-form-item label="字典值">
<el-input placeholder="搜索条件" v-model="searchInfo.value"></el-input>
<el-input v-model="searchInfo.value" placeholder="搜索条件" />
</el-form-item>
<el-form-item label="启用状态" prop="status">
<el-select v-model="searchInfo.status" placeholder="请选择">
<el-option key="true" label="是" value="true"></el-option>
<el-option key="false" label="否" value="false"></el-option>
<el-option key="true" label="是" value="true" />
<el-option key="false" label="否" value="false" />
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="onSubmit" type="primary">查询</el-button>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
<el-form-item>
<el-button @click="openDialog" type="primary">新增字典项</el-button>
<el-button type="primary" @click="openDialog">新增字典项</el-button>
</el-form-item>
</el-form>
</div>
<el-table
ref="multipleTable"
:data="tableData"
border
ref="multipleTable"
stripe
style="width: 100%"
tooltip-effect="dark"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="selection" width="55" />
<el-table-column label="日期" width="180">
<template slot-scope="scope">{{scope.row.CreatedAt|formatDate}}</template>
<template slot-scope="scope">{{ scope.row.CreatedAt|formatDate }}</template>
</el-table-column>
<el-table-column label="展示值" prop="label" width="120"></el-table-column>
<el-table-column label="展示值" prop="label" width="120" />
<el-table-column label="字典值" prop="value" width="120"></el-table-column>
<el-table-column label="字典值" prop="value" width="120" />
<el-table-column label="启用状态" prop="status" width="120">
<template slot-scope="scope">{{scope.row.status|formatBoolean}}</template>
<template slot-scope="scope">{{ scope.row.status|formatBoolean }}</template>
</el-table-column>
<el-table-column label="排序标记" prop="sort" width="120"></el-table-column>
<el-table-column label="排序标记" prop="sort" width="120" />
<el-table-column label="按钮组">
<template slot-scope="scope">
<el-button @click="updateSysDictionaryDetail(scope.row)" size="small" type="primary">变更</el-button>
<el-popover placement="top" width="160" v-model="scope.row.visible">
<el-button size="small" type="primary" @click="updateSysDictionaryDetail(scope.row)">变更</el-button>
<el-popover v-model="scope.row.visible" placement="top" width="160">
<p>确定要删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteSysDictionaryDetail(scope.row)">确定</el-button>
</div>
<el-button type="danger" icon="el-icon-delete" size="mini" slot="reference">删除</el-button>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini">删除</el-button>
</el-popover>
</template>
</el-table-column>
@@ -66,10 +66,10 @@
:page-sizes="[10, 30, 50, 100]"
:style="{float:'right',padding:'20px'}"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
/>
<el-dialog :before-close="closeDialog" :visible.sync="dialogFormVisible" title="弹窗操作">
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="110px">
@@ -79,7 +79,7 @@
placeholder="请输入展示值"
clearable
:style="{width: '100%'}"
></el-input>
/>
</el-form-item>
<el-form-item label="字典值" prop="value">
<el-input-number
@@ -89,18 +89,18 @@
placeholder="请输入字典值"
clearable
:style="{width: '100%'}"
></el-input-number>
/>
</el-form-item>
<el-form-item label="启用状态" prop="status" required>
<el-switch v-model="formData.status" active-text="开启" inactive-text="停用"></el-switch>
<el-switch v-model="formData.status" active-text="开启" inactive-text="停用" />
</el-form-item>
<el-form-item label="排序标记" prop="sort">
<el-input-number v-model.number="formData.sort" placeholder="排序标记"></el-input-number>
<el-input-number v-model.number="formData.sort" placeholder="排序标记" />
</el-form-item>
</el-form>
<div class="dialog-footer" slot="footer">
<div slot="footer" class="dialog-footer">
<el-button @click="closeDialog">取 消</el-button>
<el-button @click="enterDialog" type="primary">确 定</el-button>
<el-button type="primary" @click="enterDialog">确 定</el-button>
</div>
</el-dialog>
</div>
@@ -113,18 +113,35 @@ import {
updateSysDictionaryDetail,
findSysDictionaryDetail,
getSysDictionaryDetailList
} from "@/api/sysDictionaryDetail"; // 此处请自行替换地址
import { formatTimeToStr } from "@/utils/date";
import infoList from "@/mixins/infoList";
} from '@/api/sysDictionaryDetail' // 此处请自行替换地址
import { formatTimeToStr } from '@/utils/date'
import infoList from '@/mixins/infoList'
export default {
name: "SysDictionaryDetail",
name: 'SysDictionaryDetail',
filters: {
formatDate: function(time) {
if (time !== null && time !== '') {
var date = new Date(time)
return formatTimeToStr(date, 'yyyy-MM-dd hh:mm:ss')
} else {
return ''
}
},
formatBoolean: function(bool) {
if (bool !== null) {
return bool ? '是' : '否'
} else {
return ''
}
}
},
mixins: [infoList],
data() {
return {
listApi: getSysDictionaryDetailList,
dialogFormVisible: false,
type: "",
type: '',
formData: {
label: null,
value: null,
@@ -135,123 +152,106 @@ export default {
label: [
{
required: true,
message: "请输入展示值",
trigger: "blur"
message: '请输入展示值',
trigger: 'blur'
}
],
value: [
{
required: true,
message: "请输入字典值",
trigger: "blur"
message: '请输入字典值',
trigger: 'blur'
}
],
sort: [
{
required: true,
message: "排序标记",
trigger: "blur"
message: '排序标记',
trigger: 'blur'
}
]
}
};
},
filters: {
formatDate: function(time) {
if (time != null && time != "") {
var date = new Date(time);
return formatTimeToStr(date, "yyyy-MM-dd hh:mm:ss");
} else {
return "";
}
},
formatBoolean: function(bool) {
if (bool != null) {
return bool ? "是" : "否";
} else {
return "";
}
}
},
created() {
this.searchInfo.sysDictionaryID = Number(this.$route.params.id)
this.getTableData()
},
methods: {
//条件搜索前端看此方法
// 条件搜索前端看此方法
onSubmit() {
this.page = 1;
this.pageSize = 10;
if (this.searchInfo.status == "") {
this.searchInfo.status = null;
this.page = 1
this.pageSize = 10
if (this.searchInfo.status === '') {
this.searchInfo.status = null
}
this.getTableData();
this.getTableData()
},
async updateSysDictionaryDetail(row) {
const res = await findSysDictionaryDetail({ ID: row.ID });
this.type = "update";
if (res.code == 0) {
this.formData = res.data.resysDictionaryDetail;
this.dialogFormVisible = true;
const res = await findSysDictionaryDetail({ ID: row.ID })
this.type = 'update'
if (res.code === 0) {
this.formData = res.data.resysDictionaryDetail
this.dialogFormVisible = true
}
},
closeDialog() {
this.dialogFormVisible = false;
this.dialogFormVisible = false
this.formData = {
label: null,
value: null,
status: true,
sort: null,
sysDictionaryID: ""
};
sysDictionaryID: ''
}
},
async deleteSysDictionaryDetail(row) {
row.visible = false;
const res = await deleteSysDictionaryDetail({ ID: row.ID });
if (res.code == 0) {
row.visible = false
const res = await deleteSysDictionaryDetail({ ID: row.ID })
if (res.code === 0) {
this.$message({
type: "success",
message: "删除成功"
});
if (this.tableData.length == 1 && this.page > 1 ) {
this.page--;
type: 'success',
message: '删除成功'
})
if (this.tableData.length === 1 && this.page > 1) {
this.page--
}
this.getTableData();
this.getTableData()
}
},
async enterDialog() {
this.formData.sysDictionaryID = Number(this.$route.params.id);
this.$refs["elForm"].validate(async valid => {
if (!valid) return;
let res;
this.formData.sysDictionaryID = Number(this.$route.params.id)
this.$refs['elForm'].validate(async valid => {
if (!valid) return
let res
switch (this.type) {
case "create":
res = await createSysDictionaryDetail(this.formData);
break;
case "update":
res = await updateSysDictionaryDetail(this.formData);
break;
case 'create':
res = await createSysDictionaryDetail(this.formData)
break
case 'update':
res = await updateSysDictionaryDetail(this.formData)
break
default:
res = await createSysDictionaryDetail(this.formData);
break;
res = await createSysDictionaryDetail(this.formData)
break
}
if (res.code == 0) {
if (res.code === 0) {
this.$message({
type: "success",
message: "创建/更改成功"
});
this.closeDialog();
this.getTableData();
type: 'success',
message: '创建/更改成功'
})
this.closeDialog()
this.getTableData()
}
});
})
},
openDialog() {
this.type = "create";
this.dialogFormVisible = true;
this.type = 'create'
this.dialogFormVisible = true
}
},
created() {
this.searchInfo.sysDictionaryID = Number(this.$route.params.id);
this.getTableData();
}
};
}
</script>
<style>
</style>
</style>