|
@ -6,15 +6,39 @@ |
|
|
<div class="filter-container"> |
|
|
<div class="filter-container"> |
|
|
<el-form> |
|
|
<el-form> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-input v-model="listQuery.code" placeholder="请输入类别代码" clearable style="width: 200px" @keyup.enter.native="handleFilter" /> |
|
|
<el-input |
|
|
<el-input v-model="listQuery.name" placeholder="请输入类别名称" clearable style="width: 200px" @keyup.enter.native="handleFilter" /> |
|
|
v-model="listQuery.code" |
|
|
<el-button type="primary" icon="el-icon-search" @click="handleFilter"> |
|
|
placeholder="请输入类别代码" |
|
|
|
|
|
clearable |
|
|
|
|
|
style="width: 200px" |
|
|
|
|
|
@keyup.enter.native="handleFilter" |
|
|
|
|
|
/> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model="listQuery.name" |
|
|
|
|
|
placeholder="请输入类别名称" |
|
|
|
|
|
clearable |
|
|
|
|
|
style="width: 200px" |
|
|
|
|
|
@keyup.enter.native="handleFilter" |
|
|
|
|
|
/> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="el-icon-search" |
|
|
|
|
|
@click="handleFilter" |
|
|
|
|
|
> |
|
|
查询 |
|
|
查询 |
|
|
</el-button> |
|
|
</el-button> |
|
|
<el-button type="primary" icon="el-icon-edit" @click="showCreate"> |
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="el-icon-edit" |
|
|
|
|
|
@click="showCreate" |
|
|
|
|
|
> |
|
|
添加 |
|
|
添加 |
|
|
</el-button> |
|
|
</el-button> |
|
|
<el-button type="danger" icon="el-icon-delete" @click="deleteCategory"> |
|
|
<el-button |
|
|
|
|
|
type="danger" |
|
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
|
@click="deleteCategory" |
|
|
|
|
|
> |
|
|
删除 |
|
|
删除 |
|
|
</el-button> |
|
|
</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -31,23 +55,57 @@ |
|
|
@selection-change="handleSelectionChange" |
|
|
@selection-change="handleSelectionChange" |
|
|
> |
|
|
> |
|
|
<el-table-column type="selection" width="40" /> |
|
|
<el-table-column type="selection" width="40" /> |
|
|
<el-table-column type="index" align="center" label="序号" width="50" /> |
|
|
<el-table-column |
|
|
<el-table-column align="center" label="检验类别名称" prop="name" width="100" /> |
|
|
type="index" |
|
|
<el-table-column align="center" label="检验类别代码" prop="code" width="80" /> |
|
|
align="center" |
|
|
<el-table-column :formatter="formatSpecies" align="center" label="设备种类" prop="species" /> |
|
|
label="序号" |
|
|
|
|
|
width="50" |
|
|
|
|
|
/> |
|
|
|
|
|
<el-table-column |
|
|
|
|
|
align="center" |
|
|
|
|
|
label="检验类别名称" |
|
|
|
|
|
prop="name" |
|
|
|
|
|
width="100" |
|
|
|
|
|
/> |
|
|
|
|
|
<el-table-column |
|
|
|
|
|
align="center" |
|
|
|
|
|
label="检验类别代码" |
|
|
|
|
|
prop="code" |
|
|
|
|
|
width="80" |
|
|
|
|
|
/> |
|
|
|
|
|
<el-table-column |
|
|
|
|
|
:formatter="formatSpecies" |
|
|
|
|
|
align="center" |
|
|
|
|
|
label="设备种类" |
|
|
|
|
|
prop="species" |
|
|
|
|
|
/> |
|
|
<el-table-column align="center" label="操作" prop="" min-width="20"> |
|
|
<el-table-column align="center" label="操作" prop="" min-width="20"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-button type="primary" size="medium" title="修改" @click="showUpdate(scope.$index)"> |
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
size="medium" |
|
|
|
|
|
title="修改" |
|
|
|
|
|
@click="showUpdate(scope.$index)" |
|
|
|
|
|
> |
|
|
修改 |
|
|
修改 |
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
<pagination v-show="totalCount>0" :total="totalCount" :page-num.sync="listQuery.pageNum" :page-row.sync="listQuery.pageSize" @pagination="getList" /> |
|
|
<pagination |
|
|
|
|
|
v-show="totalCount > 0" |
|
|
|
|
|
:total="totalCount" |
|
|
|
|
|
:page-num.sync="listQuery.pageNum" |
|
|
|
|
|
:page-row.sync="listQuery.pageSize" |
|
|
|
|
|
@pagination="getList" |
|
|
|
|
|
/> |
|
|
</el-card> |
|
|
</el-card> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
|
<el-card class="box-card"> |
|
|
<el-card class="box-card"> |
|
|
|
|
|
<div slot="header" class="clearfix"> |
|
|
|
|
|
<span>字典详情</span> |
|
|
|
|
|
</div> |
|
|
<el-table |
|
|
<el-table |
|
|
ref="list" |
|
|
ref="list" |
|
|
:data="list" |
|
|
:data="list" |
|
@ -57,26 +115,64 @@ |
|
|
highlight-current-row |
|
|
highlight-current-row |
|
|
@row-click="onRowClick" |
|
|
@row-click="onRowClick" |
|
|
@selection-change="handleSelectionChange" |
|
|
@selection-change="handleSelectionChange" |
|
|
|
|
|
v-if="list.length > 0" |
|
|
> |
|
|
> |
|
|
<el-table-column type="selection" width="40" /> |
|
|
<el-table-column type="selection" width="40" /> |
|
|
<el-table-column type="index" align="center" label="序号" width="80" /> |
|
|
<el-table-column |
|
|
<el-table-column align="center" label="检验类别名称" prop="name" min-width="40" /> |
|
|
type="index" |
|
|
<el-table-column align="center" label="检验类别代码" prop="code" min-width="40" /> |
|
|
align="center" |
|
|
<el-table-column :formatter="formatSpecies" align="center" label="设备种类" prop="species" /> |
|
|
label="序号" |
|
|
|
|
|
width="80" |
|
|
|
|
|
/> |
|
|
|
|
|
<el-table-column |
|
|
|
|
|
align="center" |
|
|
|
|
|
label="检验类别名称" |
|
|
|
|
|
prop="name" |
|
|
|
|
|
min-width="40" |
|
|
|
|
|
/> |
|
|
|
|
|
<el-table-column |
|
|
|
|
|
align="center" |
|
|
|
|
|
label="检验类别代码" |
|
|
|
|
|
prop="code" |
|
|
|
|
|
min-width="40" |
|
|
|
|
|
/> |
|
|
|
|
|
<el-table-column |
|
|
|
|
|
:formatter="formatSpecies" |
|
|
|
|
|
align="center" |
|
|
|
|
|
label="设备种类" |
|
|
|
|
|
prop="species" |
|
|
|
|
|
/> |
|
|
<el-table-column align="center" label="操作" prop="" min-width="20"> |
|
|
<el-table-column align="center" label="操作" prop="" min-width="20"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-button type="primary" size="medium" title="修改" @click="showUpdate(scope.$index)"> |
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
size="medium" |
|
|
|
|
|
title="修改" |
|
|
|
|
|
@click="showUpdate(scope.$index)" |
|
|
|
|
|
> |
|
|
修改 |
|
|
修改 |
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
|
|
|
<div v-else>点击左侧字典查看详情</div> |
|
|
</el-card> |
|
|
</el-card> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" @close="closeDialog"> |
|
|
<el-dialog |
|
|
<el-form ref="tempCategory" :model="tempCategory" class="small-space" label-position="left" label-width="120px" style="width: 300px; margin-left:50px;"> |
|
|
:title="textMap[dialogStatus]" |
|
|
|
|
|
:visible.sync="dialogFormVisible" |
|
|
|
|
|
@close="closeDialog" |
|
|
|
|
|
> |
|
|
|
|
|
<el-form |
|
|
|
|
|
ref="tempCategory" |
|
|
|
|
|
:model="tempCategory" |
|
|
|
|
|
class="small-space" |
|
|
|
|
|
label-position="left" |
|
|
|
|
|
label-width="120px" |
|
|
|
|
|
style="width: 300px; margin-left: 50px" |
|
|
|
|
|
> |
|
|
<el-form-item label="检验类别名称" prop="name" required> |
|
|
<el-form-item label="检验类别名称" prop="name" required> |
|
|
<el-input v-model="tempCategory.name" type="text" /> |
|
|
<el-input v-model="tempCategory.name" type="text" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -108,10 +204,12 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
<div slot="footer" class="dialog-footer"> |
|
|
<div slot="footer" class="dialog-footer"> |
|
|
<el-button @click="dialogFormVisible = false"> |
|
|
<el-button @click="dialogFormVisible = false"> 取 消 </el-button> |
|
|
取 消 |
|
|
<el-button |
|
|
</el-button> |
|
|
v-if="dialogStatus === 'create'" |
|
|
<el-button v-if="dialogStatus==='create'" type="success" @click="createCategory"> |
|
|
type="success" |
|
|
|
|
|
@click="createCategory" |
|
|
|
|
|
> |
|
|
创 建 |
|
|
创 建 |
|
|
</el-button> |
|
|
</el-button> |
|
|
<el-button v-else type="primary" @click="updateCategory"> |
|
|
<el-button v-else type="primary" @click="updateCategory"> |
|
@ -123,9 +221,9 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import Pagination from '@/components/Pagination' |
|
|
import Pagination from "@/components/Pagination"; |
|
|
export default { |
|
|
export default { |
|
|
name: 'Category', |
|
|
name: "Category", |
|
|
components: { Pagination }, |
|
|
components: { Pagination }, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
@ -135,195 +233,195 @@ export default { |
|
|
listQuery: { |
|
|
listQuery: { |
|
|
pageNum: 1, // 页码 |
|
|
pageNum: 1, // 页码 |
|
|
pageSize: 20, |
|
|
pageSize: 20, |
|
|
orderBy: 'sort asc', |
|
|
orderBy: "sort asc", |
|
|
parentId: '' |
|
|
parentId: "", |
|
|
}, |
|
|
}, |
|
|
dialogStatus: 'create', |
|
|
dialogStatus: "create", |
|
|
dialogFormVisible: false, |
|
|
dialogFormVisible: false, |
|
|
textMap: { |
|
|
textMap: { |
|
|
update: '编辑', |
|
|
update: "编辑", |
|
|
create: '新建检验类别' |
|
|
create: "新建检验类别", |
|
|
}, |
|
|
}, |
|
|
tempCategory: {}, |
|
|
tempCategory: {}, |
|
|
multipleSelection: [], |
|
|
multipleSelection: [], |
|
|
sbzlList: [], |
|
|
sbzlList: [], |
|
|
species: [], |
|
|
species: [], |
|
|
parentList: [], |
|
|
parentList: [], |
|
|
leftList: [] |
|
|
leftList: [], |
|
|
} |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
created() { |
|
|
// this.getList() |
|
|
// this.getList() |
|
|
this.getSbzlList() |
|
|
this.getSbzlList(); |
|
|
this.getParentList() |
|
|
this.getParentList(); |
|
|
this.getLeftList() |
|
|
this.getLeftList(); |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
getList() { |
|
|
getList() { |
|
|
this.api({ |
|
|
this.api({ |
|
|
url: '/category/list', |
|
|
url: "/category/list", |
|
|
method: 'get', |
|
|
method: "get", |
|
|
params: this.listQuery |
|
|
params: this.listQuery, |
|
|
}).then(data => { |
|
|
}).then((data) => { |
|
|
this.list = data.list |
|
|
this.list = data.list; |
|
|
this.totalCount = data.total |
|
|
this.totalCount = data.total; |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
handleFilter() { |
|
|
handleFilter() { |
|
|
// 查询事件 |
|
|
// 查询事件 |
|
|
this.listQuery.pageNum = 1 |
|
|
this.listQuery.pageNum = 1; |
|
|
this.getList() |
|
|
this.getList(); |
|
|
}, |
|
|
}, |
|
|
onRowClick(row) { |
|
|
onRowClick(row) { |
|
|
this.$refs.list.toggleRowSelection(row) |
|
|
this.$refs.list.toggleRowSelection(row); |
|
|
this.listQuery.parentId = row.id |
|
|
this.listQuery.parentId = row.id; |
|
|
this.getList() |
|
|
this.getList(); |
|
|
}, |
|
|
}, |
|
|
handleSelectionChange: function (val) { |
|
|
handleSelectionChange: function (val) { |
|
|
this.multipleSelection = val |
|
|
this.multipleSelection = val; |
|
|
}, |
|
|
}, |
|
|
showCreate() { |
|
|
showCreate() { |
|
|
this.tempCategory = {} |
|
|
this.tempCategory = {}; |
|
|
this.dialogStatus = 'create' |
|
|
this.dialogStatus = "create"; |
|
|
this.dialogFormVisible = true |
|
|
this.dialogFormVisible = true; |
|
|
}, |
|
|
}, |
|
|
createCategory() { |
|
|
createCategory() { |
|
|
this.$refs['tempCategory'].validate(valid => { |
|
|
this.$refs["tempCategory"].validate((valid) => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
this.tempCategory.species = JSON.stringify(this.species) |
|
|
this.tempCategory.species = JSON.stringify(this.species); |
|
|
this.api({ |
|
|
this.api({ |
|
|
url: '/category/addCategory', |
|
|
url: "/category/addCategory", |
|
|
method: 'post', |
|
|
method: "post", |
|
|
data: this.tempCategory |
|
|
data: this.tempCategory, |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
this.$message({ message: '添加成功。', type: 'success' }) |
|
|
this.$message({ message: "添加成功。", type: "success" }); |
|
|
this.getList() |
|
|
this.getList(); |
|
|
this.dialogFormVisible = false |
|
|
this.dialogFormVisible = false; |
|
|
}) |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
return false |
|
|
return false; |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
showUpdate($index) { |
|
|
showUpdate($index) { |
|
|
this.tempCategory = this.list[$index] |
|
|
this.tempCategory = this.list[$index]; |
|
|
this.species = JSON.parse(this.tempCategory.species) |
|
|
this.species = JSON.parse(this.tempCategory.species); |
|
|
this.dialogStatus = 'update' |
|
|
this.dialogStatus = "update"; |
|
|
this.dialogFormVisible = true |
|
|
this.dialogFormVisible = true; |
|
|
}, |
|
|
}, |
|
|
updateCategory() { |
|
|
updateCategory() { |
|
|
this.$refs['tempCategory'].validate(valid => { |
|
|
this.$refs["tempCategory"].validate((valid) => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
this.tempCategory.species = JSON.stringify(this.species) |
|
|
this.tempCategory.species = JSON.stringify(this.species); |
|
|
this.api({ |
|
|
this.api({ |
|
|
url: '/category/updateCategory', |
|
|
url: "/category/updateCategory", |
|
|
method: 'post', |
|
|
method: "post", |
|
|
data: this.tempCategory |
|
|
data: this.tempCategory, |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
this.$message({ message: '数据更新成功。', type: 'success' }) |
|
|
this.$message({ message: "数据更新成功。", type: "success" }); |
|
|
this.getList() |
|
|
this.getList(); |
|
|
this.dialogFormVisible = false |
|
|
this.dialogFormVisible = false; |
|
|
}) |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
return false |
|
|
return false; |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
deleteCategory() { |
|
|
deleteCategory() { |
|
|
if (this.multipleSelection.length === 0) { |
|
|
if (this.multipleSelection.length === 0) { |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
type: 'error', |
|
|
type: "error", |
|
|
message: '请选中需要删除的数据!' |
|
|
message: "请选中需要删除的数据!", |
|
|
}) |
|
|
}); |
|
|
return false |
|
|
return false; |
|
|
} else { |
|
|
} else { |
|
|
this.$confirm('确定删除当前选中记录?', '提示', { |
|
|
this.$confirm("确定删除当前选中记录?", "提示", { |
|
|
confirmButtonText: '确定', |
|
|
confirmButtonText: "确定", |
|
|
showCancelButton: true, |
|
|
showCancelButton: true, |
|
|
type: 'warning' |
|
|
type: "warning", |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
const pks = [] |
|
|
const pks = []; |
|
|
const qs = require('qs') |
|
|
const qs = require("qs"); |
|
|
this.multipleSelection.forEach(category => { |
|
|
this.multipleSelection.forEach((category) => { |
|
|
pks.push(category.id) |
|
|
pks.push(category.id); |
|
|
}) |
|
|
}); |
|
|
this.api({ |
|
|
this.api({ |
|
|
url: '/category/delCategory', |
|
|
url: "/category/delCategory", |
|
|
method: 'delete', |
|
|
method: "delete", |
|
|
params: { |
|
|
params: { |
|
|
pks: pks |
|
|
pks: pks, |
|
|
}, |
|
|
}, |
|
|
paramsSerializer: function (params) { |
|
|
paramsSerializer: function (params) { |
|
|
return qs.stringify(params, { indices: false }) |
|
|
return qs.stringify(params, { indices: false }); |
|
|
} |
|
|
}, |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
this.$message({ message: '删除成功。', type: 'success' }) |
|
|
this.$message({ message: "删除成功。", type: "success" }); |
|
|
this.getList() |
|
|
this.getList(); |
|
|
}) |
|
|
}); |
|
|
}) |
|
|
}); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getSbzlList() { |
|
|
getSbzlList() { |
|
|
this.api({ |
|
|
this.api({ |
|
|
url: '/sedirectory/getList', |
|
|
url: "/sedirectory/getList", |
|
|
method: 'get', |
|
|
method: "get", |
|
|
params: { |
|
|
params: { |
|
|
sbzl: undefined, |
|
|
sbzl: undefined, |
|
|
level: '1' |
|
|
level: "1", |
|
|
} |
|
|
}, |
|
|
}).then(data => { |
|
|
}).then((data) => { |
|
|
this.sbzlList = data |
|
|
this.sbzlList = data; |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
getParentList() { |
|
|
getParentList() { |
|
|
this.api({ |
|
|
this.api({ |
|
|
url: '/category/all', |
|
|
url: "/category/all", |
|
|
method: 'get', |
|
|
method: "get", |
|
|
params: { |
|
|
params: { |
|
|
parentCode: null, |
|
|
parentCode: null, |
|
|
species: null |
|
|
species: null, |
|
|
} |
|
|
}, |
|
|
}).then(data => { |
|
|
}).then((data) => { |
|
|
this.parentList = data |
|
|
this.parentList = data; |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
getLeftList() { |
|
|
getLeftList() { |
|
|
this.api({ |
|
|
this.api({ |
|
|
url: '/category/getTopLevel', |
|
|
url: "/category/getTopLevel", |
|
|
method: 'get', |
|
|
method: "get", |
|
|
params: { |
|
|
params: { |
|
|
pageNum: 10, |
|
|
pageNum: 10, |
|
|
pageSize: 10 |
|
|
pageSize: 10, |
|
|
} |
|
|
}, |
|
|
}).then(data => { |
|
|
}).then((data) => { |
|
|
this.leftList = data.list |
|
|
this.leftList = data.list; |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
closeDialog() { |
|
|
closeDialog() { |
|
|
this.species = [] |
|
|
this.species = []; |
|
|
}, |
|
|
}, |
|
|
formatSpecies(row, column, cellValue) { |
|
|
formatSpecies(row, column, cellValue) { |
|
|
const value = JSON.parse(cellValue) |
|
|
const value = JSON.parse(cellValue); |
|
|
let lable = '' |
|
|
let lable = ""; |
|
|
for (let i = 0; i < value.length; i++) { |
|
|
for (let i = 0; i < value.length; i++) { |
|
|
for (let j = 0; j < this.sbzlList.length; j++) { |
|
|
for (let j = 0; j < this.sbzlList.length; j++) { |
|
|
if (value[i] === this.sbzlList[j].value) { |
|
|
if (value[i] === this.sbzlList[j].value) { |
|
|
lable = this.sbzlList[j].label + ',' + lable |
|
|
lable = this.sbzlList[j].label + "," + lable; |
|
|
break |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return lable.substring(0, lable.length - 1) |
|
|
return lable.substring(0, lable.length - 1); |
|
|
}, |
|
|
}, |
|
|
tableRowClassName({ row }) { |
|
|
tableRowClassName({ row }) { |
|
|
if (row.parentId === null) { |
|
|
if (row.parentId === null) { |
|
|
return 'main-row' |
|
|
return "main-row"; |
|
|
} else { |
|
|
} else { |
|
|
return '' |
|
|
return ""; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|
<style> |
|
|
<style> |
|
|
.el-table .main-row { |
|
|
.el-table .main-row { |
|
|