fix:海信字典添加
This commit is contained in:
parent
fdfe6d2bc8
commit
46360914af
53
src/api/xj/hisense/dictionary.js
Normal file
53
src/api/xj/hisense/dictionary.js
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* @Author: SunTao 328867980@qq.com
|
||||
* @Date: 2025-02-13 09:11:50
|
||||
* @LastEditors: SunTao 328867980@qq.com
|
||||
* @LastEditTime: 2025-02-18 13:45:45
|
||||
* @FilePath: \znxjxt-ui\src\api\xj\hisense\inter-change.js
|
||||
* @Description: 海信-桥梁
|
||||
*/
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 获取列表数据
|
||||
export function getList(query) {
|
||||
return request({
|
||||
url: "/hxDic/page",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 新增数据
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: "/hxDic",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 更新数据
|
||||
export function updata(data) {
|
||||
return request({
|
||||
url: "/hxDic",
|
||||
method: "put",
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除数据
|
||||
export function delData(id) {
|
||||
return request({
|
||||
url: `/hxDic/${id}`,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
||||
// 获取互通立交下拉数据
|
||||
export function getDropDown(params) {
|
||||
return request({
|
||||
url: "/hxDic/dicType/dropdown",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
* @Author: SunTao 328867980@qq.com
|
||||
* @Date: 2025-02-12 14:35:34
|
||||
* @LastEditors: SunTao 328867980@qq.com
|
||||
* @LastEditTime: 2025-02-17 16:01:33
|
||||
* @LastEditTime: 2025-02-18 15:28:21
|
||||
* @FilePath: \znxjxt-ui\src\views\xj\hisense\bridge\index.vue
|
||||
* @Description: 海信-桥梁
|
||||
-->
|
||||
@ -165,6 +165,7 @@ export default {
|
||||
defectType: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
160
src/views/xj/hisense/dictionary/components/add-dictionary.vue
Normal file
160
src/views/xj/hisense/dictionary/components/add-dictionary.vue
Normal file
@ -0,0 +1,160 @@
|
||||
<!--
|
||||
* @Author: SunTao 328867980@qq.com
|
||||
* @Date: 2025-02-12 16:44:44
|
||||
* @LastEditors: SunTao 328867980@qq.com
|
||||
* @LastEditTime: 2025-02-18 14:47:10
|
||||
* @FilePath: \znxjxt-ui\src\views\xj\hisense\inter-change\components\add-inter.vue
|
||||
* @Description: 海信-收费站-新增/编辑
|
||||
-->
|
||||
<template>
|
||||
<div class="dialog-content">
|
||||
<el-form class="addForm" ref="addInterForm" :model="addInterForm" :rules="rules" label-width="8rem">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="字典名称:" prop="dicLabel">
|
||||
<el-input v-model="addInterForm.dicLabel" placeholder="请填写名称" style="width: 100%" clearable>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="字典类型:" prop="dicType">
|
||||
<el-select v-model="addInterForm.dicType" placeholder="请选择字典类型" clearable style="width: 100%">
|
||||
<el-option v-for="item in tableDefect" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="字典code:" prop="dicCode">
|
||||
<el-input v-model="addInterForm.dicCode" placeholder="请填写字典code" style="width: 100%" clearable>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="字典等级:" prop="dicLevel">
|
||||
<el-input v-model="addInterForm.dicLevel" placeholder="请填写字典等级" style="width: 100%" clearable>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { add, updata } from '@/api/xj/hisense/dictionary'
|
||||
|
||||
export default {
|
||||
name: "AddDictionary",
|
||||
props: {
|
||||
// 接收父组件传过来的数据
|
||||
dialogItem: {
|
||||
type: Object,
|
||||
default: () => { },
|
||||
},
|
||||
// 字典类型传过来的数据
|
||||
tableDefect: {
|
||||
type: Array,
|
||||
default: () => { },
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 新增表单
|
||||
addInterForm: {
|
||||
dicLabel: "",
|
||||
dicType: "",
|
||||
dicCode: "",
|
||||
dicLevel: "",
|
||||
},
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
dicLabel: [{ required: true, message: "请填写名称", trigger: "blur" }],
|
||||
dicType: [{ required: true, message: "请填写字典类型", trigger: "blur" },
|
||||
// {
|
||||
// pattern: /^[1-9]\d*$/,
|
||||
// message: "请输入正整数",
|
||||
// }
|
||||
],
|
||||
dicCode: [{ required: true, message: "请填写code", trigger: "blur" }],
|
||||
dicLevel: [{ required: true, message: "请填写桩号", trigger: "blur" }, {
|
||||
pattern: /^[1-9]\d*$/,
|
||||
message: "请输入非负数",
|
||||
},],
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogItem: {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.addInterForm = JSON.parse(JSON.stringify(val))
|
||||
}
|
||||
}, immediate: true, deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* @description: 点击确定事件
|
||||
* @return {*}
|
||||
*/
|
||||
submitForm() {
|
||||
this.$refs.addInterForm.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
...this.addInterForm,
|
||||
};
|
||||
if (this.addInterForm.id) {
|
||||
updata(data).then(({ code }) => {
|
||||
if (code === 200) {
|
||||
this.$modal.msgSuccess("更新成功");
|
||||
this.$emit("cancel");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
add(data).then(({ code }) => {
|
||||
if (code === 200) {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.$emit("cancel");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 点击取消事件
|
||||
* @return {*}
|
||||
*/
|
||||
cancel() {
|
||||
this.$emit("cancel");
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dialog-content {
|
||||
width: 100%;
|
||||
// height: 20rem;
|
||||
}
|
||||
|
||||
/* 页脚 */
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
282
src/views/xj/hisense/dictionary/index.vue
Normal file
282
src/views/xj/hisense/dictionary/index.vue
Normal file
@ -0,0 +1,282 @@
|
||||
<!--
|
||||
* @Author: SunTao 328867980@qq.com
|
||||
* @Date: 2025-02-18 10:59:34
|
||||
* @LastEditors: SunTao 328867980@qq.com
|
||||
* @LastEditTime: 2025-02-18 16:11:09
|
||||
* @FilePath: \znxjxt-ui\src\views\xj\hisense\dictionary\index.vue
|
||||
* @Description: 海信-字典表
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="content">
|
||||
<el-form :model="interForm" ref="interForm" size="small" :inline="true" label-width="7rem">
|
||||
<el-form-item label="字典名称" prop="name">
|
||||
<el-input v-model="interForm.name" placeholder="请输入字典名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="字典类型" prop="type">
|
||||
<el-select v-model="interForm.type" placeholder="请选择字典类型" clearable>
|
||||
<el-option v-for="item in tableDefect" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
|
||||
@click="handleDelete(null)">删除
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
<!-- 表格 -->
|
||||
<el-table ref="setupTable" :data="interList" v-loading="loading" @selection-change="handleSelectionChange"
|
||||
style="width: 100%">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column type="index" label="序号"> </el-table-column>
|
||||
<el-table-column label="字典名称" align="center" prop="dicLabel" />
|
||||
<el-table-column label="字典类型" align="center" prop="dicType">
|
||||
</el-table-column>
|
||||
<el-table-column label="字典code" align="center" prop="dicCode" />
|
||||
<el-table-column label="字典等级" align="center" prop="dicLevel" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<div class="pagination-part">
|
||||
<el-pagination background :current-page.sync="pagination.pageNum" @current-change="handleCurrentChange"
|
||||
:page-sizes="[10, 20, 30, 40]" :page-size.sync="pagination.pageSize" @size-change="handleSizeChange"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="tableTotal">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<!-- 新增弹窗 -->
|
||||
<el-dialog :title="title" :visible.sync="addVisible" width="50rem" append-to-body :close-on-click-modal="false"
|
||||
destroy-on-close>
|
||||
<add-dictionary v-if="addVisible" :tableDefect="tableDefect" :dialogItem="dialogItem"
|
||||
@cancel="addCancel"></add-dictionary>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, delData, getDropDown } from "@/api/xj/hisense/dictionary"
|
||||
import AddDictionary from "./components/add-dictionary.vue"
|
||||
|
||||
export default {
|
||||
name: "Dictionary",
|
||||
components: {
|
||||
AddDictionary,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 搜索绑定菜单
|
||||
interForm: {
|
||||
name: "",
|
||||
type: "",
|
||||
},
|
||||
searchForm: {},
|
||||
// 路段下拉数据
|
||||
segmentList: [],
|
||||
// 字典类型下拉
|
||||
tableDefect: [],
|
||||
|
||||
// 列表数据
|
||||
interList: [],
|
||||
// 列表加载状态
|
||||
loading: false,
|
||||
// 列表勾选框数据
|
||||
checkIds: [],
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 分页-列表总数
|
||||
tableTotal: 0,
|
||||
// 分页-页数页码
|
||||
pagination: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
|
||||
// 弹窗标题
|
||||
title: "新增",
|
||||
// 新增弹窗显隐控制
|
||||
addVisible: false,
|
||||
// 传弹窗数据
|
||||
dialogItem: {},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTableData()
|
||||
this.getTypeList()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* @description: 获取类型下拉列表
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
getTypeList() {
|
||||
getDropDown().then(({ code, data }) => {
|
||||
if (code === 200) {
|
||||
this.tableDefect = data
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 点击搜索
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
handleQuery() {
|
||||
this.searchForm = JSON.parse(JSON.stringify(this.interForm));
|
||||
this.pagination.pageNum = 1;
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 点击重置
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
resetQuery() {
|
||||
this.interForm = {
|
||||
name: "",
|
||||
type: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 点击新增事件
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
handleAdd() {
|
||||
this.addVisible = true;
|
||||
this.dialogItem = {};
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 获取列表数据
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
getTableData() {
|
||||
const dataItem = {
|
||||
...this.searchForm,
|
||||
...this.pagination,
|
||||
}
|
||||
getList(dataItem).then(({ rows, code, total }) => {
|
||||
if (code === 200) {
|
||||
this.interList = rows;
|
||||
this.tableTotal = total;
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @description: 列表选择改变事件
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
handleSelectionChange(selection) {
|
||||
this.checkIds = selection.map((item) => item.hxDicId);
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 点击编辑事件
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
handleUpdate(value) {
|
||||
this.addVisible = true;
|
||||
this.dialogItem = value;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 点击删除事件
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
handleDelete(row) {
|
||||
// const checkIds = row ? row.hxDicId : this.checkIds;
|
||||
// if (!checkIds.length) {
|
||||
// this.$modal.msgWarning("请选择要删除的记录");
|
||||
// return;
|
||||
// }
|
||||
this.$modal
|
||||
.confirm(`是否确认删除选中的1条记录?`)
|
||||
.then(() => {
|
||||
return delData(row.hxDicId);
|
||||
})
|
||||
.then(() => {
|
||||
this.getTableData();
|
||||
// this.$refs.defectTable.clearSelection();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 切换分页
|
||||
* @param {*} arg
|
||||
* @return {*}
|
||||
*/
|
||||
handleCurrentChange(arg) {
|
||||
this.pagination.pageNum = arg;
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 切换每条/页
|
||||
* @param {*} arg
|
||||
* @return {*}
|
||||
*/
|
||||
handleSizeChange(arg) {
|
||||
this.pagination.pageSize = arg;
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
* @description: 关闭弹窗事件
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
addCancel() {
|
||||
this.addVisible = false;
|
||||
this.dialogItem = {};
|
||||
this.getTableData();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
width: 100%;
|
||||
height: calc(100vh - 5.4rem);
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* 分页样式 */
|
||||
.pagination-part {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
padding-top: 1rem;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
@ -165,6 +165,7 @@ export default {
|
||||
defectType: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -166,6 +166,7 @@ export default {
|
||||
defectType: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* @Author: SunTao 328867980@qq.com
|
||||
* @Date: 2025-02-12 14:40:41
|
||||
* @LastEditors: SunTao 328867980@qq.com
|
||||
* @LastEditTime: 2025-02-17 16:50:12
|
||||
* @LastEditTime: 2025-02-18 15:28:52
|
||||
* @FilePath: \znxjxt-ui\src\views\xj\hisense\route-information\index.vue
|
||||
* @Description: 海信-道路信息
|
||||
-->
|
||||
@ -163,6 +163,7 @@ export default {
|
||||
defectType: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -163,6 +163,7 @@ export default {
|
||||
defectType: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -164,6 +164,7 @@ export default {
|
||||
defectType: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -163,6 +163,7 @@ export default {
|
||||
defectType: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* @Author: SunTao 328867980@qq.com
|
||||
* @Date: 2025-02-12 14:09:49
|
||||
* @LastEditors: SunTao 328867980@qq.com
|
||||
* @LastEditTime: 2025-02-17 13:14:02
|
||||
* @LastEditTime: 2025-02-18 15:29:30
|
||||
* @FilePath: \znxjxt-ui\src\views\xj\hisense\work-station\index.vue
|
||||
* @Description: 海信-工作站
|
||||
-->
|
||||
@ -162,6 +162,7 @@ export default {
|
||||
defectType: "",
|
||||
}
|
||||
this.searchForm = {}
|
||||
this.getTableData();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user