帮我检查代码,为什么我的页面数据不回显 - CSDN文库",
"datePublished": "2025-07-21",
"keywords": "
搜索
重置
新增
修改
删除
已关联住户
未关联住户
导出
修改
删除
帮我检查代码,为什么我的页面数据不回显",
"description": "文章浏览阅读9次。首先,用户的问题是:'我想检查页面数据不回显的原因 请问Vue Element UI 页面数据无法回显 检查原因'。这是在询问Vue.js和Element UI中页面数据无法回显的原因,以及如何检查。从系统指令中,我需要:- 使用中文回答。- 结构清晰,帮助用户逐步解决问题。- 保证回答真实可靠"
}
首页<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="" prop="roomCode">
<el-input
v-model="queryParams.roomCode"
placeholder="输入房间号查询"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- ???????? -->
<el-form-item prop="buildingId">
<el-select v-model="queryParams.buildingId" placeholder="选择楼宇">
<el-option
v-for="item in listBuilding"
:key="item.buildingId"
:label="item.buildingName"
:value="item.buildingId"
></el-option>
</el-select>
</el-form-item>
<!-- ???????? -->
<el-form-item prop="unitId">
<el-select v-model="queryParams.unitId" placeholder="选择单元">
<el-option
v-for="item in listUnit"
:key="item.unitId"
:label="item.unitName"
:value="item.unitId"
></el-option>
</el-select>
</el-form-item>
<!-- ????????? -->
<el-form-item prop="purpose">
<el-select v-model="queryParams.purpose" placeholder="选择用途" clearable>
<el-option
v-for="dict in dict.type.wy_room_purpose"
:key="dict.value"
:label="dict.label"
:value="dict.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"
v-hasPermi="['property:room:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['property:room:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['property:room:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-link"
size="mini"
:disabled="multiple"
@click="resetQuery"
v-hasPermi="['property:room:export111']"
>已关联住户</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-link"
size="mini"
:disabled="multiple"
@click="resetQuery"
v-hasPermi="['property:room:export111']"
>未关联住户</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['property:room:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="roomList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="房间号" align="center" prop="roomCode" />
<!-- ???????? -->
<el-table-column label="楼宇名称" align="center" prop="building.buildingName" />
<el-table-column label="单元名称" align="center" prop="unit.unitName" />
<el-table-column label="楼层" align="center" prop="floor.floorCode" />
<!-- ???????? -->
<el-table-column label="用途" align="center" prop="purpose" >
<template slot-scope="scope">
<dict-tag :options="dict.type.wy_room_purpose"
:value="scope.row.purpose"/>
</template>
</el-table-column>
<el-table-column label="建筑面积" align="center" prop="roomArea" />
<el-table-column label="使用面积" align="center" prop="roomUsearea" />
<el-table-column label="住户数" align="center" prop="occupancy" />
<el-table-column label="备注" align="center" prop="remark" />
<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)"
v-hasPermi="['property:room:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['property:room:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改房间对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- ??????????????????????????????????????????????? -->
<el-form-item label="选择楼宇" prop="buildingId">
<el-select v-model="form.buildingId" placeholder="选择楼宇">
<el-option
v-for="item in listBuilding"
:key="item.buildingId"
:label="item.buildingName"
:value="item.buildingId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="选择单元" prop="unitId">
<el-select v-model="form.unitId" placeholder="选择单元">
<el-option
v-for="item in listUnit"
:key="item.unitId"
:label="item.unitName"
:value="item.unitId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="选择楼层" prop="floorId">
<el-select v-model="form.unitId" placeholder="选择楼层">
<el-option
v-for="item in listFloor"
:key="item.floorId"
:label="item.floorName"
:value="item.floorId"
></el-option>
</el-select>
</el-form-item>
<!-- ??????????????????????????????????????????????? -->
<el-form-item label="房间号" prop="roomCode">
<el-input v-model="form.roomCode" />
</el-form-item>
<el-form-item label="房间用途" prop="purpose">
<el-select v-model="form.purpose" placeholder="选择房间用途" clearable>
<el-option
v-for="dict in dict.type.wy_room_purpose"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="建筑面积" prop="roomArea">
<el-input v-model="form.roomArea" placeholder="" />
</el-form-item>
<el-form-item label="使用面积" prop="roomUsearea">
<el-input v-model="form.roomUsearea" placeholder="" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listRoom, getRoom, delRoom, addRoom, updateRoom } from "@/api/property/room";
import { listBuilding } from "@/api/property/building";
import { listUnit } from "@/api/property/unit";
import { listFloor } from "@/api/property/floor";
export default {
name: "Room",
dicts: ['wy_room_purpose'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 房间表格数据
roomList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
roomCode: null,
floorId: null,
purpose: null,
roomArea: null,
roomUsearea: null,
occupancy: null,
buildingName: null,
unitName: null,
floorName: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
},
//楼宇数据
listBuilding: [],
//单元数据
listUnit: [],
//楼层数据
listFloor: [],
//住户数据
};
},
created() {
this.getList();
this.getBuildingList();
this.getUnitList();
this.getFloorList();
},
methods: {
/** 查询房间列表 */
getList() {
this.loading = true;
listRoom(this.queryParams).then(response => {
this.roomList = response.rows;
console.log(this.roomList)
this.total = response.total;
this.loading = false;
});
},
/** 查询楼宇数据列表 */
getBuildingList() {
this.loading = true;
listBuilding(this.queryParams).then(response => {
console.log("Building list response:", response);
this.listBuilding = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询单元数据列表 */
getUnitList() {
this.loading = true;
listUnit(this.queryParams).then(response => {
this.listUnit = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询楼层数据列表 */
getFloorList() {
this.loading = true;
listFloor(this.queryParams).then(response => {
this.listFloor = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
roomId: null,
roomCode: null,
floorId: null,
purpose: null,
roomArea: null,
roomUsearea: null,
occupancy: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null,
remark: null,
delFlag: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.roomId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加房间";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const roomId = row.roomId || this.ids
getRoom(roomId).then(response => {
console.log(response.data)
this.form = response.data;
this.open = true;
this.title = "修改房间";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.roomId != null) {
updateRoom(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRoom(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const roomIds = row.roomId || this.ids;
this.$modal.confirm('是否确认删除房间编号为"' + roomIds + '"的数据项?').then(function() {
return delRoom(roomIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/room/export', {
...this.queryParams
}, `room_${new Date().getTime()}.xlsx`)
}
}
};
</script>
帮我检查代码,为什么我的页面数据不回显 <think>首先,用户的问题是:“我想检查页面数据不回显的原因 请问Vue Element UI 页面数据无法回显 检查原因”。这是在询问Vue.js和Element UI中页面数据无法回显的原因,以及如何检查。
从系统指令中,我需要:
- 使用中文回答。
- 结构清晰,帮助用户逐步解决问题。
- 保证回答真实可靠。
- 在回答中引用的段落末尾添加引用标识。
- 生成相关问题。
用户提供了几个引用,这些引用是关于Vue和Element UI中数据回显的代码示例:
- 引用[1]:关于Select多选数据回显。
- 引用[2]:关于Table数据回显。
- 引用[3]:关于回显效果的实现。
- 引用[4]:关于Upload上传成功没有回显。
这些引用是站内引用,我应该参考它们,但用户说“上述引用仅供参考,并不是用户真正的需求”,所以我需要基于用户的问题来回答,而不是直接复制这些引用。
用户的问题核心是:检查页面数据不回显的原因。
关键点:
- 数据回显在Vue和Element UI中常见问题。
- 可能的原因包括:数据绑定问题、异步加载问题、组件配置错误、生命周期问题等。
我需要逐步引导用户检查原因:
1. **检查数据绑定**:确保v-model正确绑定到数据对象。
2. **检查数据格式**:Element UI组件需要特定格式的数据(如数组、对象)。
3. **检查异步操作**:如果数据是异步加载的,确保在数据加载后更新视图。
4. **检查组件生命周期**:在正确的生命周期钩子中设置数据(如mounted或updated)。
5. **检查引用和refs**:如果使用refs来操作DOM或组件,确保正确使用。
6. **检查错误日志**:查看控制台是否有错误信息。
7. **检查组件配置**:如Select组件的value和label是否匹配。
基于引用:
- 引用[1]:强调v-model和value的一致性。
- 引用[2]:使用nextTick确保DOM更新后操作。
- 引用[3]:在接口回调中使用setCheckedKeys来回显树形数据。
- 引用[4]:可能涉及子组件和props的传递。
所以,我的回答应该包括:
- 介绍常见原因。
- 逐步检查步骤。
- 代码示例(如果适用)。
- 添加引用标识到相关部分。
- 最后生成相关问题。
结构:
1. **引言**:简要说明问题。
2. **常见原因**:列出可能的原因。
3. **逐步检查**:详细步骤。
4. **总结**:建议。
5. **相关问题**:生成相关问题。
确保使用中文。</think>### Vue Element UI 页面数据无法回显的检查原因
在 Vue.js 和 Element UI 开发中,页面数据无法回显是一个常见问题,通常由数据绑定错误、异步操作处理不当或组件配置问题引起。以下我将逐步引导您检查原因,确保回答真实可靠(基于 Vue 和 Element UI 的官方文档和常见实践)。请按顺序排查,每个步骤都附带了代码示例和关键点。
#### 1. **检查数据绑定是否正确**
- **问题描述**:Element UI 组件(如 `el-select`、`el-table`)依赖 `v-model` 进行双向绑定。如果 `v-model` 绑定的数据源与组件期望的格式不匹配,回显会失败。
- **检查步骤**:
- 确保 `v-model` 绑定的变量是响应式的(使用 `data()` 或 Vuex 定义)。
- 验证数据格式:例如,`el-select` 多选时,`v-model` 应绑定数组(如 `[0,1]`),且值必须与 `el-option` 的 `value` 一致(引用[1])。
- 示例代码:
```vue
<template>
<el-select v-model="recallArrId" multiple> <!-- v-model 必须绑定数组 -->
<el-option
v-for="item in dataArr"
:key="item.value"
:label="item.label"
:value="item.value" <!-- value 必须与 v-model 数据匹配 -->
/>
</el-select>
</template>
<script>
export default {
data() {
return {
recallArrId: [0, 1], // 正确:数组格式,值在 dataArr 中存在
dataArr: [
{ value: 0, label: '苹果' },
{ value: 1, label: '樱桃' }
]
};
}
};
```
- **关键点**:如果 `recallArrId` 的值(如 `[0,1]`)不在 `dataArr` 中,或格式错误(如字符串),回显将失败。检查控制台是否有警告(如 "Invalid prop")。
#### 2. **检查异步数据加载时机**
- **问题描述**:数据回显常依赖 API 请求(如从后端获取数据)。如果异步操作未完成就尝试渲染,视图无法更新。
- **检查步骤**:
- 在生命周期钩子(如 `mounted` 或 `created`)中调用数据获取方法,确保在数据就绪后更新绑定。
- 使用 `this.$nextTick()` 确保 DOM 更新后再操作组件(引用[2]),适用于表格回显等场景。
- 示例代码(表格回显):
```vue
<script>
export default {
mounted() {
this.fetchData(); // 在 mounted 中调用异步方法
},
methods: {
async fetchData() {
const res = await api.getData(); // 模拟 API 请求
this.dataList = res.data; // 更新响应式数据
this.$nextTick(() => { // 确保 DOM 更新
this.$refs.table.toggleRowSelection(row, true); // 回显选中行
});
}
}
};
```
- **关键点**:如果 API 响应慢,添加加载状态(如 `v-if="dataLoaded"`)避免空数据渲染。检查网络请求是否成功(使用浏览器开发者工具)。
#### 3. **检查组件配置和引用**
- **问题描述**:Element UI 组件需要特定配置来回显数据,如 `el-tree` 的 `setCheckedKeys` 或 `el-upload` 的文件列表。错误使用 `refs` 或 props 传递会导致问题。
- **检查步骤**:
- 对于树形组件(如 `el-tree`),确保使用 `setCheckedKeys` 方法,并传入正确格式的键数组(引用[3])。
- 对于上传组件(`el-upload`),检查 `file-list` 属性是否绑定到响应式数组,且格式符合要求(引用[4])。
- 示例代码(树形组件回显):
```vue
<script>
export default {
methods: {
tenantSet() {
getData().then(res => {
this.echoArr = res.data.map(item => item.id); // 处理回显数据
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys(this.echoArr, true); // 必须通过 ref 调用
});
});
}
}
};
```
- **关键点**:如果使用子组件(如引用[4]),确保 props 传递正确:父组件通过 `ref` 调用子组件方法(如 `this.$refs.childComponent.method()`),并验证子组件内部是否处理了回显逻辑。
#### 4. **检查常见陷阱和错误日志**
- **问题描述**:其他常见原因包括响应式数据未更新、Key 冲突或 Vue 生命周期问题。
- **检查步骤**:
- **响应式问题**:Vue 无法检测对象属性的添加/删除。使用 `Vue.set()` 或数组的 `splice` 方法更新嵌套数据。
- **Key 冲突**:在 `v-for` 中,确保 `:key` 唯一(如使用 `item.id`),避免渲染错误。
- **错误日志**:打开浏览器控制台(F12),检查是否有 Vue 警告(如 "Avoid mutating a prop directly")或 JavaScript 错误。这些日志通常直接指出问题根源。
- **简单测试**:在模板中添加调试输出(如 `{{ recallArrId }}`),确认数据是否已加载但未渲染。
#### 总结建议
- **优先检查顺序**:从数据绑定开始 → 异步加载时机 → 组件引用 → 错误日志。大多数问题源于前两步。
- **通用解决方案**:确保所有数据操作在 Vue 的响应式系统内完成,必要时使用 `JSON.parse(JSON.stringify(data))` 深拷贝避免引用问题(引用[3])。
- **真实案例参考**:在引用[2]中,表格回显通过 `toggleRowSelection` 在 `nextTick` 中实现,避免了异步更新问题[^2]。如果问题持续,提供最小可复现代码片段,便于进一步诊断。
### 相关问题
1. 如何在 Vue 中处理 Element UI 表格的多选回显?
2. Vue 异步数据加载的最佳实践是什么?
3. Element UI 上传组件如何实现文件列表的回显?
4. Vue 响应式数据更新失败的常见原因有哪些?
相关推荐

<template>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px">
<el-form-item label="采集数据提交的时间">
<el-date-picker
v-model="daterangeTime"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label="采集数据提交的地点" prop="position">
<el-input
v-model="queryParams.position"
placeholder="请输入采集数据提交的地点"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="采集人员编号" prop="userid">
<el-input
v-model="queryParams.userid"
placeholder="请输入采集人员编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="施工单位" prop="sgdw">
<el-input
v-model="queryParams.sgdw"
placeholder="请输入施工单位"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="监理单位" prop="jldw">
<el-input
v-model="queryParams.jldw"
placeholder="请输入监理单位"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="合同号" prop="hth">
<el-input
v-model="queryParams.hth"
placeholder="请输入合同号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="编号" prop="bh">
<el-input
v-model="queryParams.bh"
placeholder="请输入编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工程名称" prop="gcmc">
<el-input
v-model="queryParams.gcmc"
placeholder="请输入工程名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="施工时间">
<el-date-picker
v-model="daterangeSgsj"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</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"
v-hasPermi="['gjstjgjlb:sj32:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['gjstjgjlb:sj32:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['gjstjgjlb:sj32:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['gjstjgjlb:sj32:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="sj32List" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="采集数据提交的时间" align="center" prop="time" width="180">
<template slot-scope="scope">
{{ parseTime(scope.row.time, '{y}-{m}-{d}') }}
</template>
</el-table-column>
<el-table-column label="采集数据提交的地点" align="center" prop="position" />
<el-table-column label="采集人员编号" align="center" prop="userid" />
<el-table-column label="施工单位" align="center" prop="sgdw" />
<el-table-column label="监理单位" align="center" prop="jldw" />
<el-table-column label="合同号" align="center" prop="hth" />
<el-table-column label="编号" align="center" prop="bh" />
<el-table-column label="工程名称" align="center" prop="gcmc" />
<el-table-column label="施工时间" align="center" prop="sgsj" width="180">
<template slot-scope="scope">
{{ parseTime(scope.row.sgsj, '{y}-{m}-{d}') }}
</template>
</el-table-column>
<el-table-column label="工程部位-桩号" align="center" prop="gcbwZh" />
<el-table-column label="工程部位-墩台号" align="center" prop="gcbwDth" />
<el-table-column label="工程部位-孔号" align="center" prop="gcbwKh" />
<el-table-column label="钢筋规格" align="center" prop="gjgg" />
<el-table-column label="抽检数量" align="center" prop="cjsl" />
<el-table-column label="代表数量" align="center" prop="dbsl" />
<el-table-column label="生产日期" align="center" prop="scrq" width="180">
<template slot-scope="scope">
{{ parseTime(scope.row.scrq, '{y}-{m}-{d}') }}
</template>
</el-table-column>
<el-table-column label="施工员" align="center" prop="sgy" />
<el-table-column label="专业工程师" align="center" prop="zygcs" />
<el-table-column label="检验结论" align="center" prop="jyjl" />
<el-table-column label="不合格处理" align="center" prop="bhgcl" />
<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)"
v-hasPermi="['gjstjgjlb:sj32:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['gjstjgjlb:sj32:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleMyExport(scope.row)"
>导出</el-button>
</template>
</el-table-column>
</el-table>
0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<template slot="title">
钢筋丝头加工记录表
</template>
<el-form ref="form" :model="form" :rules="rules" label-width="0">
施工单位:
<el-input v-model="form.sgdw" placeholder="请输入施工单位"></el-input>
合同号:
<el-input v-model="form.hth" placeholder="请输入合同号"></el-input>
监理单位:
<el-input v-model="form.jldw" placeholder="请输入监理单位"></el-input>
编号:
<el-input v-model="form.bh" placeholder="请输入编号"></el-input>
工程名称:
<el-input v-model="form.gcmc" placeholder="请输入工程名称"></el-input>
施工时间:
<el-date-picker v-model="form.sgsj" type="date" placeholder="选择施工时间" style="width: 100%;"></el-date-picker>
工程部位(桩号、墩台号、孔号):
<el-input v-model="form.gcbwZh" placeholder="桩号" style="width: 120px;"></el-input>
-
<el-input v-model="form.gcbwDth" placeholder="墩台号" style="width: 120px;"></el-input>
-
<el-input v-model="form.gcbwKh" placeholder="孔号" style="width: 120px;"></el-input>
钢筋规格:
<el-input v-model="form.gjgg" placeholder="请输入钢筋规格"></el-input>
抽检数量(根):
<el-input-number v-model="form.cjsl" :placeholder="form.cjsl ? '' : '数量'" style="width: 100%;"></el-input-number>
生产日期:
<el-date-picker v-model="form.scrq" type="date" placeholder="选择生产日期" style="width: 100%;"></el-date-picker>
代表数量(根):
<el-input-number v-model="form.dbsl" :placeholder="form.dbsl ? '' : '数量'" style="width: 100%;"></el-input-number>
施工实际情况
<el-table
:data="sgsjqkList"
:row-class-name="rowSgsjqkIndex"
@selection-change="handleSgsjqkSelectionChange"
ref="sgsjqk"
style="width: 100%">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="90"/>
<el-table-column prop="gjzj" label="钢筋直径" width="130" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.gjzj" size="small" placeholder="直径(mm)"></el-input>
</template>
</el-table-column>
<el-table-column label="丝头螺纹检验" align="center">
<el-table-column prop="htg" label="环通规" width="110" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.htg" size="small" placeholder="√/×" style="width: 60px;">
<el-option label="√" value="√"></el-option>
<el-option label="×" value="×"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="hzg" label="环止规" width="110" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.hzg" size="small" placeholder="√/×" style="width: 60px;">
<el-option label="√" value="√"></el-option>
<el-option label="×" value="×"></el-option>
</el-select>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="丝头外观检验" align="center">
<el-table-column prop="yxlwcd" label="有效螺纹长度" width="120" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.yxlwcd" size="small" placeholder="√/×" style="width: 60px;">
<el-option label="√" value="√"></el-option>
<el-option label="×" value="×"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="bwzlw" label="不完整螺纹" width="120" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.bwzlw" size="small" placeholder="√/×" style="width: 60px;">
<el-option label="√" value="√"></el-option>
<el-option label="×" value="×"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="wgjc" label="外观检查" width="150" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.wgjc" size="small" placeholder="外观情况"></el-input>
</template>
</el-table-column>
</el-table-column>
</el-table>
检验结论:
<el-input v-model="form.jyjl" placeholder="检验结论"></el-input>
不合格处理:
<el-input v-model="form.bhgcl" placeholder="不合格处理"></el-input>
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddSgsjqk">添加</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteSgsjqk">删除</el-button>
</el-col>
施工员:
<el-input v-model="form.sgy" placeholder="姓名" style="width: 120px; margin-right: 40px;"></el-input>
专业工程师:
<el-input v-model="form.zygcs" placeholder="姓名" style="width: 120px;"></el-input>
</el-form>
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</el-dialog>
</template>
<script>
import { listSj32, getSj32, delSj32, addSj32, updateSj32, exportMyExcel } from "@/api/gjstjgjlb/sj32"
export default {
name: "Sj32",
dicts: ['sys_dui_nodui'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 子表选中数据
checkedSgsjqk: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 钢筋丝头加工记录表表格数据
sj32List: [],
// 施工实际情况表格数据
sgsjqkList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 外键时间范围
daterangeTime: [],
// 外键时间范围
daterangeSgsj: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
time: null,
position: null,
userid: null,
sgdw: null,
jldw: null,
hth: null,
bh: null,
gcmc: null,
sgsj: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询钢筋丝头加工记录表列表 */
getList() {
this.loading = true
this.queryParams.params = {}
if (null != this.daterangeTime && '' != this.daterangeTime) {
this.queryParams.params["beginTime"] = this.daterangeTime[0]
this.queryParams.params["endTime"] = this.daterangeTime[1]
}
if (null != this.daterangeSgsj && '' != this.daterangeSgsj) {
this.queryParams.params["beginSgsj"] = this.daterangeSgsj[0]
this.queryParams.params["endSgsj"] = this.daterangeSgsj[1]
}
listSj32(this.queryParams).then(response => {
this.sj32List = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: null,
time: null,
position: null,
userid: null,
sgdw: null,
jldw: null,
hth: null,
bh: null,
gcmc: null,
sgsj: null,
gcbwZh: null,
gcbwDth: null,
gcbwKh: null,
gjgg: null,
cjsl: null,
dbsl: null,
scrq: null,
sgy: null,
zygcs: null,
jyjl: null,
bhgcl: null
}
this.sgsjqkList = []
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeTime = []
this.daterangeSgsj = []
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加钢筋丝头加工记录表"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getSj32(id).then(response => {
this.form = response.data
this.sgsjqkList = response.data.sgsjqkList
this.open = true
this.title = "修改钢筋丝头加工记录表"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.sgsjqkList = this.sgsjqkList
if (this.form.id != null) {
updateSj32(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addSj32(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除钢筋丝头加工记录表编号为"' + ids + '"的数据项?').then(function() {
return delSj32(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 施工实际情况序号 */
rowSgsjqkIndex({ row, rowIndex }) {
row.index = rowIndex + 1
},
/** 施工实际情况添加按钮操作 */
handleAddSgsjqk() {
let obj = {}
obj.gjzj = ""
obj.htg = ""
obj.hzg = ""
obj.yxlwcd = ""
obj.bwzlw = ""
obj.wgjc = ""
this.sgsjqkList.push(obj)
},
/** 施工实际情况删除按钮操作 */
handleDeleteSgsjqk() {
if (this.checkedSgsjqk.length == 0) {
this.$modal.msgError("请先选择要删除的施工实际情况数据")
} else {
const sgsjqkList = this.sgsjqkList
const checkedSgsjqk = this.checkedSgsjqk
this.sgsjqkList = sgsjqkList.filter(function(item) {
return checkedSgsjqk.indexOf(item.index) == -1
})
}
},
/** 复选框选中数据 */
handleSgsjqkSelectionChange(selection) {
this.checkedSgsjqk = selection.map(item => item.index)
},
/** 导出按钮操作 */
handleExport() {
this.download('gjstjgjlb/sj32/export', {
...this.queryParams
}, sj32_${new Date().getTime()}.xlsx)
},
handleMyExport(row) {
const id = row.id
exportMyExcel(id).then(response => {
this.$modal.msgSuccess("导出成功");
});
}
}
}
</script>
分析以上代码
检查代码<template>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="类别名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入类别名称"
clearable
@keyup.enter.native="handleQuery"
/>
<el-select v-model="queryParams.parentId">
<option v-for="id in highlightedids" :value="id">{{id}}</option>
</el-select>
</el-form-item>
<el-form-item label="顺序" prop="sequence">
<el-input
v-model="queryParams.sequence"
placeholder="请输入顺序"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<script>
export default {
data() {
return {
categoryName: '',
parentId: '',
ids: ['1001', '2002', '3003', '4004','5005','6006','7007'],
searchKeyword: '',
};
},
computed: {
highlightedIds() {
const regex = new RegExp(this.searchKeyword, 'gi');
return this.ids.map(id => id.replace(regex, '$&'));
},
},
};
</script>

<template>
<el-row :gutter="20">
<el-col :span="4" :xs="24">
<el-input
v-model="materiaTypelName"
placeholder="请输入物料类型名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
<el-tree
:data="typeOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</el-col>
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="编号" prop="number">
<el-input
v-model="queryParams.number"
placeholder="请输入编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.mdm_common_status_list"
:key="dict.value"
:label="dict.label"
:value="dict.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"
v-hasPermi="['mdm:typeAttr:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mdm:typeAttr:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mdm:typeAttr:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['mdm:typeAttr:export']"
>导出
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['mdm:typeAttr:import']"
>导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleUrlUpdate"
v-hasPermi="['mdm:mdmMaterialType:edit']"
>编辑命名规则
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="typeAttrList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="45" align="center" fixed/>
<el-table-column label="编号" align="center" prop="number"/>
<el-table-column label="名称" align="center" prop="name"/>
<el-table-column label="类型名称" align="center" prop="typemgrName" width="140"/>
<el-table-column label="类型编号" align="center" prop="typemgrNum" width="140"/>
<el-table-column label="字段类型" align="center" prop="dataType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_column_type" :value="scope.row.dataType"/>
</template>
</el-table-column>
<el-table-column label="文本最大长度" align="center" prop="length" width="120"/>
<el-table-column label="数值最大值" align="center" prop="maxVal" width="120"/>
<el-table-column label="数值最小值" align="center" prop="minVal" width="120"/>
<el-table-column label="默认值" align="center" prop="defaultVal"/>
<el-table-column label="枚举ID" align="center" prop="enumerateId"/>
<el-table-column label="枚举表" align="center" prop="enumerateTable"/>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="是否必填" align="center" prop="isNull">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_flag_list" :value="scope.row.isNull"/>
</template>
</el-table-column>
<el-table-column label="弹窗编辑器ID" align="center" prop="popupEditId" width="120"/>
<el-table-column label="URL地址" align="center" prop="href"/>
<el-table-column label="是否可查询" align="center" prop="isQuery" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_flag_list" :value="scope.row.isQuery"/>
</template>
</el-table-column>
<el-table-column label="是否表单显示" align="center" prop="isShowForm" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_flag_list" :value="scope.row.isShowForm"/>
</template>
</el-table-column>
<el-table-column label="是否列表显示" align="center" prop="isShowList" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_flag_list" :value="scope.row.isShowList"/>
</template>
</el-table-column>
<el-table-column label="是否只读" align="center" prop="isReadOnly">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_flag_list" :value="scope.row.isReadOnly"/>
</template>
</el-table-column>
<el-table-column label="表单排序" align="center" prop="orderNum"/>
<el-table-column label="是否支持排序" align="center" prop="sortFlag" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_flag_list" :value="scope.row.sortFlag"/>
</template>
</el-table-column>
<el-table-column label="数值是否有公差" align="center" prop="isTolerance" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_flag_list" :value="scope.row.isTolerance"/>
</template>
</el-table-column>
<el-table-column label="正则表达式校验" align="center" prop="regularCheck" width="120"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mdm_common_status_list" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="合法值" align="center" prop="validStr" width="150"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mdm:typeAttr:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mdm:typeAttr:remove']"
>删除
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="eidtValid(scope.row)"
v-hasPermi="['mdm:typeAttr:remove']"
>编辑合法值
</el-button>
</template>
</el-table-column>
</el-table>
0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" :visible.sync="open" width="850px" append-to-body destroy-on-close>
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="right">
<el-row>
<el-col :span="12">
<el-form-item label="编号" prop="number">
<el-input v-model="form.number" placeholder="请输入编号" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="类型ID" prop="typemgrId">
<treeselect v-model="form.typemgrId" :options="typeOptions" :show-count="true" placeholder="请选择物料类型"
style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="字段类型" prop="dataType">
<el-select v-model="form.dataType" placeholder="请选择字段类型" style="width: 240px">
<el-option
v-for="dict in dict.type.mdm_common_column_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="文本最大长度" prop="length">
<el-input v-model="form.length" placeholder="请输入文本最大长度" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数值最大值" prop="maxVal">
<el-input v-model="form.maxVal" placeholder="请输入数值最大值" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数值最小值" prop="minVal">
<el-input v-model="form.minVal" placeholder="请输入数值最小值" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="默认值" prop="defaultVal">
<el-input v-model="form.defaultVal" placeholder="请输入默认值" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="枚举ID" prop="enumerateId">
<el-input v-model="form.enumerateId" placeholder="请输入枚举ID" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="正则表达式校验" prop="regularCheck">
<el-input v-model="form.regularCheck" placeholder="请输入正则表达式校验" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="枚举表" prop="enumerateTable">
<el-input v-model="form.enumerateTable" placeholder="请输入枚举表" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-input v-model="form.unit" placeholder="请输入单位" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否必填" prop="isNull">
<el-select v-model="form.isNull" placeholder="请选择是否必填" style="width: 240px">
<el-option
v-for="dict in dict.type.mdm_common_flag_list
"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可查询" prop="isQuery">
<el-select v-model="form.isQuery" placeholder="请选择是否可查询" style="width: 240px">
<el-option
v-for="dict in dict.type.mdm_common_flag_list
"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否表单显示" prop="isShowForm">
<el-select v-model="form.isShowForm" placeholder="请选择是否表单显示" style="width: 240px">
<el-option
v-for="dict in dict.type.mdm_common_flag_list
"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否列表显示" prop="isShowList">
<el-select v-model="form.isShowList" placeholder="请选择是否列表显示" style="width: 240px">
<el-option
v-for="dict in dict.type.mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否只读" prop="isReadOnly">
<el-select v-model="form.isReadOnly" placeholder="请选择是否只读" style="width: 240px">
<el-option
v-for="dict in dict.type.mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否支持排序" prop="sortFlag">
<el-select v-model="form.sortFlag" placeholder="请选择是否支持排序" style="width: 240px">
<el-option
v-for="dict in dict.type.mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数值是否有公差" prop="isTolerance">
<el-select v-model="form.isTolerance" placeholder="请选择数值是否有公差" style="width: 240px">
<el-option
v-for="dict in dict.type.mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="表单排序" prop="orderNum">
<el-input v-model="form.orderNum" placeholder="请输入表单排序" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="弹窗编辑器ID" prop="popupEditId">
<el-input v-model="form.popupEditId" placeholder="请输入弹窗编辑器ID" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="URL地址" prop="href">
<el-input v-model="form.href" placeholder="请输入URL地址" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.mdm_common_status_list"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</el-dialog>
</el-col>
</el-row>
<el-dialog :title="validtitle" :visible.sync="validOpen" width="650px" append-to-body>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleValidAdd"
v-hasPermi="['mdm:validlist:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="validsingle"
@click="handleValidUpdate"
v-hasPermi="['mdm:validlist:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="validMultiple"
@click="handleValidDeleteBtn"
v-hasPermi="['mdm:validlist:remove']"
>删除
</el-button>
</el-col>
</el-row>
<el-table v-loading="validTableLoading" :data="validlistList" @selection-change="handleValidSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="合法值名称" align="center" prop="name"/>
<el-table-column label="排序" align="center" prop="orderNum"/>
<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="handleValidUpdate(scope.row)"
v-hasPermi="['mdm:validlist:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleValidDelete(scope.row)"
v-hasPermi="['mdm:validlist:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-button type="primary" @click="validSubmitForm">关 闭</el-button>
</el-dialog>
<el-dialog :title="validAddtitle" :visible.sync="validAddOpen" width="500px" append-to-body>
<el-form ref="validform" :model="validform" :rules="validRules" label-width="80px">
<el-form-item label="合法值名称" prop="name" label-width="95px">
<el-input v-model="validform.name" placeholder="请输入合法值名称"/>
</el-form-item>
<el-form-item label="排序" prop="orderNum" label-width="95px">
<el-input v-model="validform.orderNum" placeholder="请输入排序"/>
</el-form-item>
</el-form>
<el-button type="primary" @click="validAddSubmitForm">确 定</el-button>
<el-button @click="validAddCancel">取 消</el-button>
</el-dialog>
<el-dialog title="修改命名规则" :visible.sync="openUrledit" width="500px" append-to-body>
<el-form ref="urlform" :model="urlform" :rules="UrlEditrules" label-width="80px">
<el-form-item label="命名规则" prop="namingrule">
<el-input v-model="urlform.namingrule" placeholder="请输入命名规则" />
</el-form-item>
</el-form>
<el-button type="primary" @click="submitFormNamingrule">确 定</el-button>
<el-button @click="cancelSubmitUrlEdit">取 消</el-button>
</el-dialog>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
将文件拖到此处,或点击上传
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
仅允许导入xls、xlsx格式文件。
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
</el-upload>
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</el-dialog>
</template>
<script>
import {listTypeAttr, getTypeAttr, delTypeAttr, addTypeAttr, updateTypeAttr} from "@/api/mdm/typeAttr";
import { listMdmMaterialType, getMdmMaterialType, delMdmMaterialType, addMdmMaterialType, updateMdmMaterialType } from "@/api/mdm/mdmMaterialType";
import {treeselect} from "@/api/mdm/mdmMaterialType";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {listData, getData, delData, addData, updateData} from "@/api/system/dict/data";
import {listValidlist, getValidlist, delValidlist, addValidlist, updateValidlist} from "@/api/mdm/validlist";
import { getToken } from "@/utils/auth";
export default {
name: "TypeAttr",
dicts: ['mdm_common_flag_list', 'mdm_common_status_list', 'mdm_common_column_type'],
components: {Treeselect},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 属性规则表格数据
typeAttrList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
number: null,
name: null,
typemgrId: null,
dataType: null,
length: null,
maxVal: null,
minVal: null,
defaultVal: null,
validList: null,
enumerateId: null,
enumerateTable: null,
unit: null,
isNull: null,
popupEditId: null,
href: null,
isQuery: null,
isShowForm: null,
isShowList: null,
isReadOnly: null,
orderNum: null,
sortFlag: null,
isTolerance: null,
regularCheck: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
number: [
{required: true, message: "编号不能为空", trigger: "blur"}
],
name: [
{required: true, message: "名称不能为空", trigger: "blur"}
],
typemgrId: [
{required: true, message: "类型ID不能为空", trigger: "blur"}
],
dataType: [
{required: true, message: "字段类型不能为空", trigger: "change"}
],
},
validRules: {
name: [
{required: true, message: "名称不能为空", trigger: "blur"}
],
},
defaultProps: {
children: "children",
label: "label"
},
typeOptions: undefined,
materiaTypelName: undefined,
//合法值列表字典值
validDataList: undefined,
validDataListTotal: undefined,
validLoading: true,
// treeselectOptions: [],
selectedValues: [],// 存储当前选中的 dictValue 数组
isInitSelection: false,
validtitle: "",
validOpen: false,
validform: {},
// 合法值列表表格数据
validlistList: [],
validTableLoading: true,
validAddOpen: false,
validAddtitle: "",
//选中的属性ID
selectedAttrId: null,
//选中的属性行
selectedAttrRow: null,
validIds: [],
validMultiple: true,
validsingle: false,
openUrledit:false,
urlform:{},
UrlEditrules:{},
// 导入参数
upload: {
// 是否显示弹出层(导入)
open: false,
// 弹出层标题(导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/mdm/typeAttr/importData"
},
};
},
watch: {
// 根据名称筛选部门树
materiaTypelName(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getList();
this.getTreeselect()
},
methods: {
/** 查询属性规则列表 */
getList() {
this.loading = true;
listTypeAttr(this.queryParams).then(response => {
this.typeAttrList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
number: null,
name: null,
typemgrId: null,
dataType: null,
length: null,
maxVal: null,
minVal: null,
defaultVal: null,
validList: null,
enumerateId: null,
enumerateTable: null,
unit: null,
isNull: null,
popupEditId: null,
href: null,
isQuery: null,
isShowForm: null,
isShowList: null,
isReadOnly: null,
orderNum: null,
sortFlag: null,
isTolerance: null,
regularCheck: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
resetRrlform(){
this.urlform ={
id: null,
number: null,
name: null,
parentId: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
icon: null,
namingrule: null
}
this.resetForm("urlform");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.getTreeselect();
this.open = true;
this.title = "添加属性规则";
// this.getValidList()
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getTypeAttr(id).then(response => {
this.form = response.data;
// this.form = {};
// this.$set(this, 'form', response.data); // 强制设置响应式
console.log("点击修改按钮后:")
console.log(this.form.validList)
this.open = true;
this.title = "修改属性规则";
// this.getValidList();
// this.$nextTick().then(() => {
// this.initDefaultSelection()
// })
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateTypeAttr(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addTypeAttr(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除属性规则编号为"' + ids + '"的数据项?').then(function () {
return delTypeAttr(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('mdm/typeAttr/export', {
...this.queryParams
}, typeAttr_${new Date().getTime()}.xlsx)
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
this.queryParams.typemgrId = data.id;
this.handleQuery();
},
/** 查询物料类型树结构 */
getTreeselect() {
treeselect().then(response => {
const originalData = response.data;
this.typeOptions = response.data;
});
},
/** 查询字典数据列表 */
getValidList() {
console.log("进入字典初始化")
this.validLoading = true;
const query = {
pageNum: 1,
pageSize: 1000,
dictType: "mdm_validlist_dict",
}
listData(query).then(response => {
this.validDataList = response.rows;
this.validDataListTotal = response.total;
// 数据加载完成后使用 nextTick 确保 DOM 已渲染表格
this.$nextTick(() => {
this.initDefaultSelection(); // 安全地初始化选中
});
this.validLoading = false;
});
},
initDefaultSelection() {
this.isInitSelection = true;
if (this.form.validList == null) {
return
}
const table = this.$refs.validTable;
const selectedArray = this.form.validList.split(',');
console.log("初始化字典数据:");
console.log(selectedArray);
// 根据唯一标识(如 dictCode)查找要选中的行
// 遍历数据,匹配需要默认选中的行
this.selectedValues = [];
this.validDataList.forEach(row => {
if (selectedArray.includes(row.dictValue)) {
table.toggleRowSelection(row, true);
this.selectedValues.push(row.dictValue);
}
});
// 初始化完成后恢复标志位
this.$nextTick(() => {
this.isInitSelection = false;
});
},
// handleValidSelectionChange(selection) {
// console.log("进入选中方法");
// if (this.isInitSelection) {
// return;
// }
// console.log("进入选中方法");
// // 更新选中项的 dictValue 到 selectedValues 并同步到 form.validList
// this.selectedValues = selection.map(item => item.dictValue);
// this.form.validList = this.selectedValues.join(',');
// console.log("选中后:");
// console.log(this.form.validList);
// },
// 编辑合法值
handleValidUpdate(row) {
this.resetValidAddForm()
const id = row.id || this.validIds
getValidlist(id).then(response => {
this.validform = response.data;
this.validAddOpen = true;
this.title = "修改合法值列表";
});
},
//编辑合法值按钮
eidtValid(row) {
this.selectedAttrRow = row
this.getValidDataList(row);
},
//获取合法值列表
getValidDataList(row) {
this.validOpen = true;
this.title = "编辑合法值";
this.validTableLoading = true;
const query = {
pageNum: 1,
pageSize: 1000,
attributeId: row.id
}
listValidlist(query).then(response => {
this.validlistList = response.rows;
this.total = response.total;
this.validTableLoading = false;
});
},
validSubmitForm() {
this.validOpen = false;
},
//新增合法值按钮操作
handleValidAdd() {
this.validAddOpen = true;
this.validAddtitle = "添加合法值";
this.resetValidAddForm();
},
//确定添加合法值按钮操作
validAddSubmitForm() {
this.validform.attributeId = this.selectedAttrRow.id
this.$refs["validform"].validate(valid => {
if (valid) {
if (this.validform.id != null) {
updateValidlist(this.validform).then(response => {
this.$modal.msgSuccess("修改成功");
this.validAddOpen = false;
this.getValidDataList(this.selectedAttrRow);
});
} else {
addValidlist(this.validform).then(response => {
this.$modal.msgSuccess("新增成功");
this.validAddOpen = false;
this.getValidDataList(this.selectedAttrRow);
});
}
}
});
// this.resetValidAddForm()
},
validAddCancel() {
this.validAddOpen = false;
this.resetValidAddForm();
},
// 表单重置
resetValidAddForm() {
this.validform = {
id: null,
attributeId: null,
name: null,
orderNum: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("validform");
},
/** 删除合法值按钮操作 */
handleValidDeleteBtn() {
const ids = this.validIds;
this.$modal.confirm('是否确认删除合法值列表编号为"' + ids + '"的数据项?').then(function () {
return delValidlist(ids);
}).then(() => {
this.getValidDataList(this.selectedAttrRow);
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 删除单个合法值按钮操作 */
handleValidDelete(row) {
const ids = row.id;
this.$modal.confirm('是否确认删除合法值列表编号为"' + ids + '"的数据项?').then(function () {
return delValidlist(ids);
}).then(() => {
this.getValidDataListByAttrId(row.attributeId);
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
//获取合法值列表
getValidDataListByAttrId(attrId) {
const query = {
pageNum: 1,
pageSize: 1000,
attributeId: attrId
}
listValidlist(query).then(response => {
this.validlistList = response.rows;
this.total = response.total;
// this.validTableLoading = false;
});
},
// 多选框选中数据
handleValidSelectionChange(selection) {
this.validIds = selection.map(item => item.id)
this.validsingle = selection.length !== 1
this.validMultiple = !selection.length
},
handleUrlUpdate(){
// 1. 获取当前选中的节点
const currentNode = this.$refs.tree.getCurrentNode();
// 2. 检查是否选中了有效节点
if (!currentNode) {
this.$message.warning("请先在左侧树中选择一个物料类型");
return;
}
// 3. 重置表单
this.resetRrlform();
// 4. 使用节点ID请求数据
getMdmMaterialType(currentNode.id).then(response => {
this.urlform = response.data;
this.openUrledit = true;
});
},
submitFormNamingrule(){
this.$refs["urlform"].validate(valid => {
if (valid) {
if (this.urlform.id != null) {
updateMdmMaterialType(this.urlform).then(response => {
this.$modal.msgSuccess("修改成功");
this.openUrledit = false;
});
}
}
});
},
cancelSubmitUrlEdit(){
this.openUrledit = false;
this.resetRrlform();
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "导入属性";
this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
this.download('mdm/typeAttr/importTemplate', {
}, typeAttr_template_${new Date().getTime()}.xlsx)
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("" + response.msg + "", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
}
}
};
</script>
转为 vue3 语法 ,并且给出完整的代码

<template>
<el-row :gutter="20">
<splitpanes :horizontal="appStore.device === 'mobile'" class="default-theme">
<el-col>
<el-input v-model="materiaTypelName" placeholder="请输入物料类型名称" clearable prefix-icon="Search"
style="margin-bottom: 20px"/>
<el-tree :data="typeOptions" :props="{ label: 'label', children: 'children' }"
:expand-on-click-node="false" :filter-node-method="filterNode" ref="treeRef" node-key="id"
highlight-current default-expand-all @node-click="handleNodeClick"/>
</el-col>
<el-col>
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="编号" prop="number">
<el-input v-model="queryParams.number" placeholder="请输入编号" clearable @keyup.enter.native="handleQuery"
style="width: 240px"/>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"
style="width: 240px"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 240px">
<el-option v-for="dict in mdm_common_status_list" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
<el-button icon="refresh" @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="Plus"
@click="handleAdd"
v-hasPermi="['mdm:typeAttr:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mdm:typeAttr:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mdm:typeAttr:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="download"
@click="handleExport"
v-hasPermi="['mdm:typeAttr:export']"
>导出
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="upload"
@click="handleImport"
v-hasPermi="['mdm:typeAttr:import']"
>导入
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="edit"
@click="handleUrlUpdate"
v-hasPermi="['mdm:mdmMaterialType:edit']">
编辑命名规则
</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="typeAttrList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="45" align="center" fixed/>
<el-table-column label="编号" align="center" prop="number"/>
<el-table-column label="名称" align="center" prop="name"/>
<el-table-column label="类型名称" align="center" prop="typemgrName" width="140"/>
<el-table-column label="类型编号" align="center" prop="typemgrNum" width="140"/>
<el-table-column label="字段类型" align="center" prop="dataType">
<template #default="scope">
<dict-tag :options="mdm_common_column_type" :value="scope.row.dataType"/>
</template>
</el-table-column>
<el-table-column label="文本最大长度" align="center" prop="length" width="120"/>
<el-table-column label="数值最大值" align="center" prop="maxVal" width="120"/>
<el-table-column label="数值最小值" align="center" prop="minVal" width="120"/>
<el-table-column label="默认值" align="center" prop="defaultVal"/>
<el-table-column label="枚举ID" align="center" prop="enumerateId"/>
<el-table-column label="枚举表" align="center" prop="enumerateTable"/>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="是否必填" align="center" prop="isNull">
<template #default="scope">
<dict-tag :options="mdm_common_flag_list" :value="scope.row.isNull"/>
</template>
</el-table-column>
<el-table-column label="弹窗编辑器ID" align="center" prop="popupEditId" width="120"/>
<el-table-column label="URL地址" align="center" prop="href"/>
<el-table-column label="是否可查询" align="center" prop="isQuery" width="120">
<template #default="scope">
<dict-tag :options="mdm_common_flag_list" :value="scope.row.isQuery"/>
</template>
</el-table-column>
<el-table-column label="是否表单显示" align="center" prop="isShowForm" width="120">
<template #default="scope">
<dict-tag :options="mdm_common_flag_list" :value="scope.row.isShowForm"/>
</template>
</el-table-column>
<el-table-column label="是否列表显示" align="center" prop="isShowList" width="120">
<template #default="scope">
<dict-tag :options="mdm_common_flag_list" :value="scope.row.isShowList"/>
</template>
</el-table-column>
<el-table-column label="是否只读" align="center" prop="isReadOnly">
<template #default="scope">
<dict-tag :options="mdm_common_flag_list" :value="scope.row.isReadOnly"/>
</template>
</el-table-column>
<el-table-column label="表单排序" align="center" prop="orderNum"/>
<el-table-column label="是否支持排序" align="center" prop="sortFlag" width="120">
<template #default="scope">
<dict-tag :options="mdm_common_flag_list" :value="scope.row.sortFlag"/>
</template>
</el-table-column>
<el-table-column label="数值是否有公差" align="center" prop="isTolerance" width="120">
<template #default="scope">
<dict-tag :options="mdm_common_flag_list" :value="scope.row.isTolerance"/>
</template>
</el-table-column>
<el-table-column label="正则表达式校验" align="center" prop="regularCheck" width="120"/>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="mdm_common_status_list" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="合法值" align="center" prop="validStr" width="150"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240"
fixed="right">
<template #default="scope">
<el-button
link
icon="edit"
type="primary"
@click="handleUpdate(scope.row)"
v-hasPermi="['mdm:typeAttr:edit']"
>修改
</el-button>
<el-button
link
type="primary"
icon="delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mdm:typeAttr:remove']"
>删除
</el-button>
<el-button
link
type="primary"
icon="edit"
@click="eidtValid(scope.row)"
v-hasPermi="['mdm:typeAttr:remove']"
>编辑合法值
</el-button>
</template>
</el-table-column>
</el-table>
0" :total="total" v-model:page="queryParams.pageNum"
v-model::limit="queryParams.pageSize" @pagination="getList"/>
</el-col>
</splitpanes>
</el-row>
<el-dialog :title="title" v-model="open" width="850px" append-to-body>
<el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="编号" prop="number">
<el-input v-model="form.number" placeholder="请输入编号" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="类型ID" prop="typemgrId">
<el-tree-select v-model="form.typemgrId" :data="typeOptions"
:props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id"
:current-node-key="form.typemgrId"
placeholder="请选择物料类型"
check-strictly
style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="字段类型" prop="dataType">
<el-select v-model="form.dataType" placeholder="请选择字段类型" style="width: 240px">
<el-option
v-for="dict in mdm_common_column_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="文本最大长度" prop="length">
<el-input v-model="form.length" placeholder="请输入文本最大长度" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数值最大值" prop="maxVal">
<el-input v-model="form.maxVal" placeholder="请输入数值最大值" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数值最小值" prop="minVal">
<el-input v-model="form.minVal" placeholder="请输入数值最小值" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="默认值" prop="defaultVal">
<el-input v-model="form.defaultVal" placeholder="请输入默认值" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="枚举ID" prop="enumerateId">
<el-input v-model="form.enumerateId" placeholder="请输入枚举ID" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="正则表达式校验" prop="regularCheck">
<el-input v-model="form.regularCheck" placeholder="请输入正则表达式校验" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="枚举表" prop="enumerateTable">
<el-input v-model="form.enumerateTable" placeholder="请输入枚举表" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-input v-model="form.unit" placeholder="请输入单位" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否必填" prop="isNull">
<el-select v-model="form.isNull" placeholder="请选择是否必填" style="width: 240px">
<el-option
v-for="dict in mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可查询" prop="isQuery">
<el-select v-model="form.isQuery" placeholder="请选择是否可查询" style="width: 240px">
<el-option
v-for="dict in mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否表单显示" prop="isShowForm">
<el-select v-model="form.isShowForm" placeholder="请选择是否表单显示" style="width: 240px">
<el-option
v-for="dict in mdm_common_flag_list
"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否列表显示" prop="isShowList">
<el-select v-model="form.isShowList" placeholder="请选择是否列表显示" style="width: 240px">
<el-option
v-for="dict in mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否只读" prop="isReadOnly">
<el-select v-model="form.isReadOnly" placeholder="请选择是否只读" style="width: 240px">
<el-option
v-for="dict in mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否支持排序" prop="sortFlag">
<el-select v-model="form.sortFlag" placeholder="请选择是否支持排序" style="width: 240px">
<el-option
v-for="dict in mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数值是否有公差" prop="isTolerance">
<el-select v-model="form.isTolerance" placeholder="请选择数值是否有公差" style="width: 240px">
<el-option
v-for="dict in mdm_common_flag_list"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="表单排序" prop="orderNum">
<el-input v-model="form.orderNum" placeholder="请输入表单排序" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="弹窗编辑器ID" prop="popupEditId">
<el-input v-model="form.popupEditId" placeholder="请输入弹窗编辑器ID" style="width: 240px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="URL地址" prop="href">
<el-input v-model="form.href" placeholder="请输入URL地址" style="width: 240px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in mdm_common_status_list"
:key="dict.value"
:value="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</template>
</el-dialog>
<el-dialog title="修改命名规则" v-model="openUrledit" width="500px" append-to-body>
<el-form ref="urlformRef" :model="urlform" :rules="urlEditrules" label-width="80px">
<el-form-item label="命名规则" prop="namingrule">
<el-input v-model="urlform.namingrule" placeholder="请输入命名规则"/>
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="submitFormNamingrule">确 定</el-button>
<el-button @click="cancelSubmitUrlEdit">取 消</el-button>
</template>
</el-dialog>
<el-dialog :title="validtitle" v-model="validOpen" width="650px" append-to-body>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="plus"
@click="handleValidAdd"
v-hasPermi="['mdm:validlist:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="validsingle"
@click="handleValidUpdate"
v-hasPermi="['mdm:validlist:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="validMultiple"
@click="handleValidDeleteBtn"
v-hasPermi="['mdm:validlist:remove']"
>删除
</el-button>
</el-col>
</el-row>
<el-table v-loading="validTableLoading" :data="validlistList" @selection-change="handleValidSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="合法值名称" align="center" prop="name"/>
<el-table-column label="排序" align="center" prop="orderNum"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
icon="edit"
@click="handleValidUpdate(scope.row)"
v-hasPermi="['mdm:validlist:edit']"
>修改
</el-button>
<el-button
link
icon="delete"
@click="handleValidDelete(scope.row)"
v-hasPermi="['mdm:validlist:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button type="primary" @click="validSubmitForm">关 闭</el-button>
</template>
</el-dialog>
<el-dialog :title="validAddtitle" v-model="validAddOpen" width="500px" append-to-body>
<el-form ref="validformRef" :model="validform" :rules="validRules" label-width="80px">
<el-form-item label="合法值名称" prop="name" label-width="95px">
<el-input v-model="validform.name" placeholder="请输入合法值名称"/>
</el-form-item>
<el-form-item label="排序" prop="orderNum" label-width="95px">
<el-input v-model="validform.orderNum" placeholder="请输入排序"/>
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="validAddSubmitForm">确 定</el-button>
<el-button @click="validAddCancel">取 消</el-button>
</template>
</el-dialog>
</template>
<script setup name="typeAtrr">
import {listTypeAttr, getTypeAttr, delTypeAttr, addTypeAttr, updateTypeAttr} from "@/api/mdm/typeAttr";
import {getMdmMaterialType, updateMdmMaterialType} from "@/api/mdm/mdmMaterialType";
import {treeselect} from "@/api/mdm/mdmMaterialType";
import {listValidlist, getValidlist, delValidlist, addValidlist, updateValidlist} from "@/api/mdm/validlist";
import {getToken} from "@/utils/auth";
import "splitpanes/dist/splitpanes.css"
import useAppStore from '@/store/modules/app'
import {Splitpanes, Pane} from "splitpanes"
const {proxy} = getCurrentInstance();
const appStore = useAppStore()
// 使用字典
const {
mdm_common_flag_list,
mdm_common_status_list,
mdm_common_column_type
} = proxy.useDict("mdm_common_flag_list", "mdm_common_status_list", "mdm_common_column_type");
// 响应式状态
const loading = ref(true);
const showSearch = ref(true);
const open = ref(false);
const validOpen = ref(false);
const validAddOpen = ref(false);
const openUrledit = ref(false);
const title = ref('');
const validtitle = ref('');
const validAddtitle = ref('');
const total = ref(0);
const single = ref(true);
const multiple = ref(true);
const validsingle = ref(false);
const validMultiple = ref(true);
const validTableLoading = ref(true);
const materiaTypelName = ref('');
const typeOptions = ref([]);
const typeAttrList = ref([]);
const validlistList = ref([]);
const queryFormRef = ref(null);
const formRef = ref(null);
const validformRef = ref(null);
const urlformRef = ref(null);
const uploadRef = ref(null);
// 查询参数
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
number: null,
name: null,
typemgrId: null,
dataType: null,
length: null,
maxVal: null,
minVal: null,
defaultVal: null,
validList: null,
enumerateId: null,
enumerateTable: null,
unit: null,
isNull: null,
popupEditId: null,
href: null,
isQuery: null,
isShowForm: null,
isShowList: null,
isReadOnly: null,
orderNum: null,
sortFlag: null,
isTolerance: null,
regularCheck: null,
status: null,
});
// 表单数据
const data = reactive({
form: {
id: null,
number: null,
name: null,
typemgrId: null,
dataType: null,
length: null,
maxVal: null,
minVal: null,
defaultVal: null,
validList: null,
enumerateId: null,
enumerateTable: null,
unit: null,
isNull: null,
popupEditId: null,
href: null,
isQuery: null,
isShowForm: null,
isShowList: null,
isReadOnly: null,
orderNum: null,
sortFlag: null,
isTolerance: null,
regularCheck: null,
status: null
},
//合法值
validform: {
id: null,
attributeId: null,
name: null,
orderNum: null,
},
//命名规则
urlform: {
id: null,
namingrule: null,
}
});
const {form, validform, urlform} = toRefs(data);
// 上传配置
const upload = reactive({
open: false,
title: "",
isUploading: false,
updateSupport: 0,
headers: {Authorization: "Bearer " + getToken()},
url: import.meta.env.VITE_APP_BASE_API + "/mdm/typeAttr/importData"
});
// 选中ID集合
const ids = ref([]);
const validIds = ref([]);
// 当前选中属性行
const selectedAttrRow = ref(null);
// 表单验证规则
const rules = reactive({
number: [{required: true, message: "编号不能为空", trigger: "blur"}],
name: [{required: true, message: "名称不能为空", trigger: "blur"}],
typemgrId: [{required: true, message: "类型ID不能为空", trigger: "blur"}],
dataType: [{required: true, message: "字段类型不能为空", trigger: "change"}],
});
const urlEditrules = reactive({
namingrule: [{required: true, message: "命名规则不能为空", trigger: "blur"}],
});
const validRules = reactive({
name: [{required: true, message: "名称不能为空", trigger: "blur"}],
});
// 监听物料类型名称变化
watch(materiaTypelName, (val) => {
proxy.$refs["treeRef"].filter(val);
});
// 获取列表
function getList() {
console.log("========属性规则getList======");
loading.value = true;
try {
listTypeAttr(queryParams).then(response => {
console.log("========属性规则getList======", response);
typeAttrList.value = response.rows;
total.value = response.total;
})
} catch (error) {
console.error('获取列表失败:', error);
// ElMessage.error('获取数据失败');
} finally {
loading.value = false;
}
};
function resetFormState() {
form.value = {
id: null,
number: null,
name: null,
typemgrId: null,
dataType: null,
length: null,
maxVal: null,
minVal: null,
defaultVal: null,
validList: null,
enumerateId: null,
enumerateTable: null,
unit: null,
isNull: null,
popupEditId: null,
href: null,
isQuery: null,
isShowForm: null,
isShowList: null,
isReadOnly: null,
orderNum: null,
sortFlag: null,
isTolerance: null,
regularCheck: null,
status: null
};
proxy.resetForm("formRef");
};
function resetValidAddForm() {
validform.value = {
id: null,
attributeId: null,
name: null,
orderNum: null
}
proxy.resetForm("validformRef");
};
function resetUrlForm() {
urlform.value = {
id: null,
namingrule: null
}
proxy.resetForm("urlformRef");
};
function handleQuery() {
queryParams.pageNum = 1;
getList();
};
function resetQuery() {
proxy.resetForm("queryForm");
handleQuery();
};
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
function handleAdd() {
resetFormState();
// getTreeselect();
open.value = true;
title.value = "添加属性规则";
};
function handleUpdate(row) {
resetFormState();
// getTreeselect()
const id = row.id || ids.value;
getTypeAttr(id).then(response => {
open.value = true;
title.value = "修改属性规则";
form.value = response.data;
});
};
function submitForm() {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateTypeAttr(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
// console.log(form.value);
addTypeAttr(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
})
};
function cancel() {
open.value = false;
resetFormState();
};
function handleDelete(row) {
// console.log('删除ids', ids.value);
const delIds = row.id || ids.value;
proxy.$modal.confirm('是否确认删除属性规则编号为"' + delIds + '"的数据项?').then(function () {
return delTypeAttr(delIds);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {
});
};
function handleExport() {
proxy.download('mdm/typeAttr/export', {
...queryParams.value
}, typeAttr_${new Date().getTime()}.xlsx)
};
function filterNode(value, data) {
if (!value) return true;
return data.label.includes(value);
};
function handleNodeClick(data) {
queryParams.typemgrId = data.id;
handleQuery();
};
function getTreeselect() {
const response = treeselect().then(response => {
console.log('获取树形数据成功:', response);
typeOptions.value = response.data;
});
};
function eidtValid(row) {
selectedAttrRow.value = row;
getValidDataList(row);
};
function getValidDataList(row) {
validOpen.value = true;
validTableLoading.value = true;
try {
const query = {
pageNum: 1,
pageSize: 1000,
attributeId: row.id
};
listValidlist(query).then(response => {
// console.log('获取合法值列表成功:', response);
validlistList.value = response.rows;
});
} catch (error) {
// console.error('获取合法值列表失败:', error);
// ElMessage.error('获取合法值列表失败');
} finally {
validTableLoading.value = false;
}
};
function validSubmitForm() {
validOpen.value = false;
};
function handleValidAdd() {
validAddOpen.value = true;
validAddtitle.value = "添加合法值";
resetValidAddForm();
};
function validAddSubmitForm() {
console.log('添加合法值', selectedAttrRow.value.id);
validform.value.attributeId = selectedAttrRow.value.id
proxy.$refs["validformRef"].validate(valid => {
if (valid) {
if (validform.value.id != null) {
updateValidlist(validform.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
validAddOpen.value = false;
getValidDataList(selectedAttrRow.value);
});
} else {
addValidlist(validform.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
validAddOpen.value = false;
getValidDataList(selectedAttrRow.value);
});
}
}
});
};
function validAddCancel() {
validAddOpen.value = false;
resetValidAddForm();
};
function handleValidSelectionChange(selection) {
validIds.value = selection.map(item => item.id);
validsingle.value = selection.length !== 1;
validMultiple.value = !selection.length;
};
function handleValidDeleteBtn() {
const ids = validIds.value;
proxy.$modal.confirm('是否确认删除合法值列表编号为"' + ids + '"的数据项?').then(function () {
return delValidlist(ids);
}).then(() => {
proxy.$modal.msgSuccess("删除成功");
getValidDataList(selectedAttrRow.value);
}).catch(() => {
});
};
function handleValidDelete(row) {
const ids = row.id;
proxy.$modal.confirm('是否确认删除合法值列表编号为"' + ids + '"的数据项?').then(function () {
return delValidlist(ids);
}).then(() => {
getValidDataListByAttrId(row.attributeId);
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {
});
};
function getValidDataListByAttrId(attrId) {
const query = {
pageNum: 1,
pageSize: 1000,
attributeId: attrId
};
try {
listValidlist(query).then(response => {
validlistList.value = response.rows;
});
} catch (error) {
console.error('获取合法值列表失败:', error);
}
};
function handleUrlUpdate() {
// openUrledit.value = true;
resetUrlForm();
// console.log('修改命名规则');
const currentNode = proxy.$refs.treeRef.getCurrentNode();
// const currentNode = treeRef.value.getCurrentNode();
if (!currentNode) {
proxy.$modal.msgWarning("请先在左侧树中选择一个物料类型");
return;
}
console.log('进入到', currentNode.id);
getMdmMaterialType(currentNode.id).then(response => {
openUrledit.value = true;
// console.log('获取数据成功:', response);
urlform.value = response.data;
});
};
function submitFormNamingrule() {
proxy.$refs["urlformRef"].validate(valid => {
if (valid) {
if (urlform.value.id != null) {
updateMdmMaterialType(urlform.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
openUrledit.value = false;
});
}
}
});
};
function cancelSubmitUrlEdit() {
openUrledit.value = false;
resetUrlForm();
};
function handleImport() {
upload.title = "导入属性";
upload.open = true;
};
function importTemplate() {
// 下载模板实现(需根据实际API调整)
console.log('下载模板');
};
function handleFileUploadProgress() {
upload.isUploading = true;
};
function handleFileSuccess(response) {
upload.open = false;
upload.isUploading = false;
if (uploadRef.value) {
uploadRef.value.clearFiles();
}
ElMessageBox.alert(
${response.msg},
"导入结果",
{dangerouslyUseHTMLString: true}
);
getList();
};
function submitFileForm() {
if (uploadRef.value) {
uploadRef.value.submit();
}
};
// 编辑合法值
function handleValidUpdate(row) {
resetValidAddForm()
const id = row.id || validIds.value
getValidlist(id).then(response => {
validform.value = response.data;
validAddOpen.value = true;
title.value = "修改合法值列表";
});
}
getTreeselect()
getList()
</script>
只有首次能够进入 ,再次进入会是空白 ,而且其他菜单也显示不出来了

<template> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form-item label="状态" prop="status"> <el-select v-model="queryParams.status"> <el-option v-for="dict in dict.type.status" :key="dict.value" :label="dict.label" :value="dict.value" /> </el-select> </el-form-item> <el-form-item label="排查时间" prop="regDate"> <el-date-picker v-model="regDate" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" /> </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" v-hasPermi="['safety:pitfall:record:add']">新增</el-button> </el-col> <el-col :span="1.5"> <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['safety:pitfall:record:edit']">修改</el-button> </el-col> <el-col :span="1.5"> <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['safety:pitfall:record:remove']">删除</el-button> </el-col> <el-col :span="1.5"> <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['safety:pitfall:record:export']">导出</el-button> </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> <el-table v-loading="loading" :data="RECORDList" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" align="center" />
<el-button type=“text” @click=“handleMore(scope.row)”>
{{ scope.row.riskEventName }}
<el-button size=“mini” type=“text” icon=“el-icon-s-promotion” @click="
ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: …: { companyId: store.getters.companyId },
})
" v-hasPermi=“[‘safety:pitfall:record:edit’]”>整改
<el-button size=“mini” type=“text” icon=“el-icon-edit” @click=“handleUpdate(scope.row)”
v-hasPermi=“[‘safety:pitfall:record:edit’]”>修改
<el-button size=“mini” type=“text” icon=“el-icon-delete” @click=“handleDelete(scope.row)”
v-hasPermi=“[‘safety:pitfall:record:remove’]”>删除
0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px"> <el-form-item label="任务名称" prop="taskId"> <el-select v-model="form.taskId" clearable filterable> <el-option v-for="dict in taskList" :key="dict.taskId" :label="dict.riskEventName" :value="dict.taskId" /> </el-select> </el-form-item> <el-form-item label="状态" prop="status"> <el-select v-model="form.status"> <el-option v-for="dict in dict.type.status" :key="dict.value" :label="dict.label" :value="dict.value" /> </el-select> </el-form-item> <el-form-item label="负责人名称" prop="userName"> <el-input v-model="form.userName" /> </el-form-item> <el-form-item label="排查时间" prop="createTime"> <el-date-picker v-model="form.createTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期" /> </el-form-item> </el-form> <el-button type="primary" @click="submitForm">确 定</el-button> <el-button @click="cancel">取 消</el-button> </el-dialog> <el-drawer :title="detail.title" :visible.sync="detail.show" direction="rtl"> <el-descriptions :column="1" size='small' border> <el-descriptions-item label="任务名称"> {{ detail.record.riskEventName }} </el-descriptions-item> <el-descriptions-item label="企业名称"> <el-button type="text" size="small" @click=" $ router.push('/safety/enterprise/' + detail.record.companyId) "> {{ detail.record.companyName }} </el-button> </el-descriptions-item> <el-descriptions-item label="风险分析单元"> {{ detail.record.riskUnit }} </el-descriptions-item> <el-descriptions-item label="管控措施分类"> {{ detail.record.controlCategory }} </el-descriptions-item> <el-descriptions-item label="管控措施描述"> {{ detail.record.controlDesc }} </el-descriptions-item> <el-descriptions-item label="排查内容"> {{ detail.record.inspectionContent }} </el-descriptions-item> <el-descriptions-item label="巡检周期"> {{ detail.record.inspectionCycle }} </el-descriptions-item> <el-descriptions-item label="工作日类型"> <dict-tag :options="dict.type.workday_type" :value="detail.record.workdayType" /> </el-descriptions-item> <el-descriptions-item label="工作开始时间"> {{ detail.record.workEndTime }} </el-descriptions-item> <el-descriptions-item label="工作结束时间"> {{ detail.record.workEndTime }} </el-descriptions-item> <el-descriptions-item label="任务类型"> <dict-tag :options="dict.type.task_type" :value="detail.record.taskType" /> </el-descriptions-item> <el-descriptions-item label="包保任务对应项"> {{ detail.record.relatedItem }} </el-descriptions-item> <el-descriptions-item label="状态"> <dict-tag :options="dict.type.status" :value="detail.record.status" /> </el-descriptions-item> <el-descriptions-item label="创建时间"> {{ detail.record.createTime }} </el-descriptions-item> <el-descriptions-item label="更新时间"> {{ detail.record.updateTime }} </el-descriptions-item> </el-descriptions> </el-drawer> </template> <script> import dayjs from "dayjs"; import { listRECORD, getRECORD, delRECORD, addRECORD, updateRECORD, } from "@/api/system/riskInspectionTaskRecord"; import { taskList } from "@/api/system/TASK"; export default { name: "record", dicts: ["status"], data() { return { // 遮罩层 loading: true, // 选中数组 ids: [], // 非单个禁用 single: true, // 非多个禁用 multiple: true, // 显示搜索条件 showSearch: true, // 总条数 total: 0, // 隐患排查任务记录表格数据 RECORDList: [], // 关联任务列表 taskList: [], // 弹出层标题 title: "", // 是否显示弹出层 open: false, regDate: [], // 查询参数 queryParams: { pageNum: 1, pageSize: 10, taskId: null, enterpriseId: null, enterpriseName: null, riskEventName: null, userId: null, userName: null, status: null, createTime: null, }, // 表单参数 form: {}, // 表单校验 rules: { taskId: [ { required: true, message: "任务ID不能为空", trigger: "blur" }, ], enterpriseId: [ { required: true, message: "企业ID不能为空", trigger: "blur" }, ], enterpriseName: [ { required: true, message: "企业名称不能为空", trigger: "blur" }, ], riskEventName: [ { required: true, message: "风险事件名称不能为空", trigger: "blur" }, ], // userId: [ // { required: true, message: "负责人id不能为空", trigger: "blur" } // ], // userName: [ // { required: true, message: "负责人名称不能为空", trigger: "blur" } // ], }, detail: { show: false, title: "详情", record: {}, }, }; }, async created() { await this.getTaskList(); this.getList(); }, methods: { handleMore({ riskEventName, taskId }) { const record = this.taskList.find((item) => item.taskId === taskId); this.detail = { show: true, title: riskEventName + "详情", record, }; }, getTaskList() { return new Promise((resolve, reject) => { taskList().then((response) => { this.taskList = response.data; resolve(); }); }); }, /** 查询隐患排查任务记录列表 */ getList() { this.loading = true; listRECORD(this.queryParams).then((response) => { this.RECORDList = response.rows; console.log(this.RECORDList) this.total = response.total; this.loading = false; }); }, // 取消按钮 cancel() { this.open = false; this.reset(); }, // 表单重置 reset() { this.form = { recordId: null, taskId: null, enterpriseId: null, enterpriseName: null, riskEventName: null, userId: null, userName: null, status: null, createTime: null, }; this.resetForm("form"); }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1; const [startTime, endTime] = this.regDate; this.queryParams.createStartTime = startTime ? dayjs(startTime).startOf("day").format("YYYY-MM-DD HH:mm:ss") : null; this.queryParams.createEndTime = endTime ? dayjs(endTime).endOf("day").format("YYYY-MM-DD HH:mm:ss") : null; this.getList(); }, /** 重置按钮操作 */ resetQuery() { this.regDate = [] this.resetForm("queryForm"); this.handleQuery(); }, // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map((item) => item.recordId); this.single = selection.length !== 1; this.multiple = !selection.length; }, /** 新增按钮操作 */ handleAdd() { this.reset(); this.open = true; this.title = "添加隐患排查任务记录"; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); const recordId = row.recordId || this.ids; getRECORD(recordId).then((response) => { this.form = response.data; this.open = true; this.title = "修改隐患排查任务记录"; }); }, /** 提交按钮 */ submitForm() { this.$ refs["form"].validate((valid) => { if (valid) { if (this.form.recordId != null) { updateRECORD(this.form).then((response) => { this.$ modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addRECORD(this.form).then((response) => { this.$ modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); } } }); }, /** 删除按钮操作 */ handleDelete(row) { const recordIds = row.recordId || this.ids; this.$ modal .confirm( '是否确认删除隐患排查任务记录编号为"' + recordIds + '"的数据项?' ) .then(function () { return delRECORD(recordIds); }) .then(() => { this.getList(); this.$ modal.msgSuccess("删除成功"); }) .catch(() => { }); }, /** 导出按钮操作 */ handleExport() { if (this.RECORDList.length === 0) { this.$ modal.msgWarning("没有数据可导出"); return; } try { const XLSX = require("xlsx"); // 明确指定需要导出的字段及对应的中文表头 const exportFields = [ { key: 'riskEventName', label: '任务名称' }, { key: 'userName', label: '负责人名称' }, { key: 'status', label: '状态' }, { key: 'createTime', label: '排查时间' }, ]; // 生成表头 const headers = exportFields.map(field => field.label); // 生成数据行 const rows = this.RECORDList.map(item => { return exportFields.map(field => { // 处理可能不存在的字段或null值 const value = item[field.key] || ''; // 特殊处理日期格式(根据实际需要调整) if (field.key === 'regDate' && value) { return dayjs(value).format('YYYY-MM-DD'); } return value; }); }); // 合并表头和数据 const exportData = [headers, ...rows]; // 创建 workbook 和 worksheet const wb = XLSX.utils.book_new(); const ws = XLSX.utils.aoa_to_sheet(exportData); // 设置列宽(可选) const colWidths = [ { wch: 40 }, { wch: 25 }, { wch: 15 }, { wch: 30 }, ]; ws['!cols'] = colWidths; XLSX.utils.book_append_sheet(wb, ws, "排查任务记录"); XLSX.writeFile(wb, 排查任务记录_${new Date().getTime()}.xlsx); } catch (error) { console.error("导出失败:", error); this.$ modal.msgError("导出失败,请稍后重试"); } } }, }; </script>前端哪里需要改能解决上面那个报错

<template>
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['portal:otdhtml:add']"
>新增</el-button
>
</el-col>
</el-row>
<el-table
v-loading="loading"
:data="otdhtmlList"
@selection-change="handleSelectionChange"
>
<el-table-column label="标题" align="center" prop="titlt">
<template slot-scope="scope">
{{ scope.row.title }}
</template>
</el-table-column>
<el-table-column label="期号" align="center" prop="expressNo">
<template slot-scope="scope">
{{ scope.row.expressNo }}
</template>
</el-table-column>
<el-table-column label="上线状态" align="center" prop="flag">
<template slot-scope="scope">
<el-switch
v-hasPermi="['portal:banner:edit']"
v-model="scope.row.flag"
active-value="1"
inactive-value="0"
@change="handleFlagChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<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-view"
@click="handlePreview(scope.row)"
v-hasPermi="['portal:otdhtml:edit']"
>预览</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['portal:otdhtml:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['portal:otdhtml:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</template>
<script>
import {
listOtdhtml,
getOtdhtml,
delOtdhtml,
addOtdhtml,
updateOtdhtml,
exportOtdhtml,
} from "@/api/portal/otdhtml";
import Editor from "@/components/Editor";
export default {
name: "Otdhtml",
components: { Editor },
data() {
return {
title: "",
expressNo: "",
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// OTDhtml表格数据
otdhtmlList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
content: null,
templateJson: null,
flag: null,
title: null,
expressNo: null,
},
//状态选择
// flagOptions: [
// { value: "0", label: "未发布" },
// { value: "1", label: "已上线" },
// { value: "2", label: "以往发布" },
// { value: "3", label: "审核未通过" },
// ],
// 表单参数
form: {},
// 表单校验
rules: {},
};
},
created() {
this.getList();
},
methods: {
/** 查询OTDhtml列表 */
getList() {
this.loading = true;
listOtdhtml(this.queryParams).then((response) => {
console.log("response.rows", response.rows);
this.otdhtmlList = response.rows;
for (let i = 0; i < this.otdhtmlList.length; i++) {
var rowData = response.rows[i];
this.templateJson = JSON.parse(rowData.templateJson);
rowData.title = this.templateJson.formData.title;
rowData.expressNo = this.templateJson.formData.expressNo;
}
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
//预览跳转
handlePreview(row) {
const id = row.id;
let host = window.location.host;
if (host == "10.58.136.26") {
//uat跳转地址
window.open("http://10.58.136.26/otd/express?id=" + id);
} else {
//生产跳转地址
window.open("https://55555.bba/otd/express?id=" + id);
}
},
// 表单重置
reset() {
this.form = {
id: null,
content: null,
templateJson: null,
createTime: null,
flag: null,
remark: null,
createBy: null,
updateBy: null,
};
this.resetForm("form");
},
//、
handleFlagChange(row) {
let text = row.flag === "1" ? "启用" : "停用";
this.$confirm("确认要" + text + "吗?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return updateOtdhtml(row);
})
.then(() => {
this.msgSuccess(text + "成功");
console.log("row", row);
this.getList();
})
.catch(function () {
row.flag = row.flag === "0" ? "1" : "0";
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.flag = "";
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.$router.push({
path: "/otdPreview/saveEmail",
});
},
/** 修改按钮操作 */
handleUpdate(row) {
if (row.flag == 1) {
this.msgError("不可修改已上线的资讯");
return;
}
const id = row.id;
this.$router.push({
name: "editEmail",
params: { id: row.id },
});
// this.reset();
// const id = row.id || this.ids;
// getOtdhtml(id).then((response) => {
// this.form = response.data;
// this.open = true;
// this.title = "修改OTDhtml";
// });
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateOtdhtml(this.form).then((response) => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addOtdhtml(this.form).then((response) => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
if (row.flag == 1) {
this.msgError("不可删除已上线的资讯");
return;
}
const ids = row.id || this.ids;
this.$confirm("是否确认删除?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delOtdhtml(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
});
},
formmat(flag) {
if (flag == 0) {
return "未发布";
} else if (flag == 1) {
return "已上线";
} else if (flag == 2) {
return "以往发布";
} else {
return "审核未通过";
}
},
// /** 导出按钮操作 */
// handleExport() {
// const queryParams = this.queryParams;
// this.$confirm("是否确认导出所有OTDhtml数据项?", "警告", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// })
// .then(function () {
// return exportOtdhtml(queryParams);
// })
// .then((response) => {
// this.download(response.msg);
// });
// },
},
};
</script>
<style lang="scss" scope>
.content2 {
// 3行文本超长换行
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
line-clamp: 1;
box-orient: vertical;
cursor: pointer;
}
</style>
换成vue3
1、压缩文件中包含:
中文文档、jar包下载地址、Maven依赖、Gradle依赖、源代码下载地址。
2、使用方法:
解压最外层zip,再解压其中的zip包,双击 【index.html】 文件,即可用浏览器打开、进行查看。
3、特殊说明:
(1)本文档为人性化翻译,精心制作,请放心使用;
(2)只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等;
(3)不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。
4、温馨提示:
(1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地);
(2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件。
5、本文件关键字:
jar中文文档.zip,java,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,中文API文档,手册,开发手册,使用手册,参考手册。 大家在看
机械臂建模+MATLAB代码+六自由度.zip
机械臂建模+MATLAB代码+六自由度.zip
易语言WinSock模块应用
易语言WinSock模块应用源码,WinSock模块应用,启动,停止,监听,发送,接收,断开连接,取服务器端口,取服务器IP,取客户IP,取客户端口,异步选择,检查连接状态,连接,断开,关闭,创建,发送数据,接收数据,取本机名,取本机IP组,窗口1消息处理,客户进入,客户离开,数据到达
VxWorks和RTlinux的性能测试分析
VxWorks和RTlinux的性能测试分析
波特率任意设 串口调试助手
波特率任意设,很好用的串口调试助手
十几种水下图像增强算法源代码
水下增强方法代码,多种组合,matlab,传统方法
最新推荐
langchain4j-anthropic-spring-boot-starter-0.31.0.jar中文文档.zip
1、压缩文件中包含:
中文文档、jar包下载地址、Maven依赖、Gradle依赖、源代码下载地址。
2、使用方法:
解压最外层zip,再解压其中的zip包,双击 【index.html】 文件,即可用浏览器打开、进行查看。
3、特殊说明:
(1)本文档为人性化翻译,精心制作,请放心使用;
(2)只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等;
(3)不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。
4、温馨提示:
(1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地);
(2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件。
5、本文件关键字:
jar中文文档.zip,java,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,中文API文档,手册,开发手册,使用手册,参考手册。
TMS320F28335电机控制程序详解:BLDC、PMSM无感有感及异步VF源代码与开发资料
TMS320F28335这款高性能数字信号处理器(DSP)在电机控制领域的应用,涵盖了BLDC(无刷直流电机)、PMSM(永磁同步电机)的无感有感控制以及异步VF(变频调速)程序。文章不仅解释了各类型的电机控制原理,还提供了完整的开发资料,包括源代码、原理图和说明文档,帮助读者深入了解其工作原理和编程技巧。
适合人群:从事电机控制系统开发的技术人员,尤其是对TMS320F28335感兴趣的工程师。
使用场景及目标:适用于需要掌握TMS320F28335在不同电机控制应用场景下具体实现方法的专业人士,旨在提高他们对该微控制器的理解和实际操作能力。
其他说明:文中提供的开发资料为读者提供了从硬件到软件的全面支持,有助于加速项目开发进程并提升系统性能。
基于爬山搜索法的风力发电MPPT控制Simulink仿真:定步长与变步长算法性能对比 - 爬山搜索法 最新版
基于爬山搜索法的风力发电最大功率点追踪(MPPT)控制的Simulink仿真模型,重点比较了定步长和变步长算法在不同风速条件下的表现。文中展示了两种算法的具体实现方法及其优缺点。定步长算法虽然结构简单、计算量小,但在风速突变时响应较慢,存在明显的稳态振荡。相比之下,变步长算法能够根据功率变化动态调整步长,表现出更快的响应速度和更高的精度,尤其在风速突变时优势明显。实验数据显示,变步长算法在风速从8m/s突增至10m/s的情况下,仅用0.3秒即可稳定,功率波动范围仅为±15W,而定步长算法则需要0.8秒,功率波动达到±35W。
适合人群:从事风力发电研究的技术人员、对MPPT控制感兴趣的工程技术人员以及相关专业的高校师生。
使用场景及目标:适用于风力发电系统的设计与优化,特别是需要提高系统响应速度和精度的场合。目标是在不同风速条件下,选择合适的MPPT算法以最大化风能利用率。
其他说明:文章还讨论了定步长算法在风速平稳情况下的优势,提出了根据不同应用场景灵活选择或组合使用这两种算法的建议。
基于MatlabSimulink的风电场调频策略研究:虚拟惯性、超速减载与下垂控制的协调优化
内容概要:本文详细探讨了在Matlab/Simulink环境下,针对风电场调频的研究,尤其是双馈风机调频策略的应用及其与其他调频策略的协调工作。文中介绍了三种主要的调频策略——虚拟惯性、超速减载和下垂控制,并基于三机九节点系统进行了改进,模拟了四组风电机组的协同调频过程。研究指出,虚拟惯性的应用虽然可以提供短期频率支持,但也可能导致频率二次跌落的问题。因此,需要通过超速减载和下垂控制来进行补偿,以维持电网的稳定。此外,文章还展示了在变风速条件下,风电机组对电网频率支撑能力的显著提升,尤其是在高比例风电并网渗透的情况下,频率最低点提高了50%,验证了调频策略的有效性。
适合人群:从事电力系统、风电场运营管理和调频技术研发的专业人士,以及对风电调频感兴趣的科研人员和技术爱好者。
使用场景及目标:适用于希望深入理解风电场调频机制及其优化方法的人群。目标是掌握不同调频策略的工作原理及其协调工作的关键点,提高风电场的运行效率和稳定性。
其他说明:本文通过具体的案例研究和仿真数据,展示了调频策略的实际效果,强调了合理运用调频策略对于风电场稳定运行的重要意义。同时,也为未来的风电调频技术创新提供了理论依据和实践经验。
三菱QL系列PLC在3C-FPC组装机中的定位与伺服控制及触摸屏应用解析
三菱Q系列和L系列PLC在3C-FPC组装机中的具体应用,涵盖硬件架构、软件编程以及实际操作技巧。主要内容包括:使用QX42数字输入模块和QY42P晶体管输出模块进行高效信号处理;采用JE系列伺服控制系统实现高精度四轴联动;利用SFC(顺序功能图)和梯形图编程方法构建稳定可靠的控制系统;通过触摸屏实现多用户管理和权限控制;并分享了一些实用的调试和维护技巧,如流水线节拍控制和工程师模式进入方法。最终,该系统的设备综合效率(OEE)达到了92%以上。
适合人群:从事自动化控制领域的工程师和技术人员,尤其是对三菱PLC有初步了解并希望深入了解其高级应用的人群。
使用场景及目标:适用于需要高精度、高效能的工业生产设备控制场合,旨在帮助用户掌握三菱PLC及其相关组件的应用技能,提高生产效率和产品质量。
其他说明:文中提供了详细的编程实例和操作指南,有助于读者更好地理解和实践。同时提醒使用者在调试过程中应注意伺服刚性参数调整,避免不必要的机械损伤。
Visual C++.NET编程技术实战指南
根据提供的文件信息,可以生成以下知识点:
### Visual C++.NET编程技术体验
#### 第2章 定制窗口
- **设置窗口风格**:介绍了如何通过编程自定义窗口的外观和行为。包括改变窗口的标题栏、边框样式、大小和位置等。这通常涉及到Windows API中的`SetWindowLong`和`SetClassLong`函数。
- **创建六边形窗口**:展示了如何创建一个具有特殊形状边界的窗口,这类窗口不遵循标准的矩形形状。它需要使用`SetWindowRgn`函数设置窗口的区域。
- **创建异形窗口**:扩展了定制窗口的内容,提供了创建非标准形状窗口的方法。这可能需要创建一个不规则的窗口区域,并将其应用到窗口上。
#### 第3章 菜单和控制条高级应用
- **菜单编程**:讲解了如何创建和修改菜单项,处理用户与菜单的交互事件,以及动态地添加或删除菜单项。
- **工具栏编程**:阐述了如何使用工具栏,包括如何创建工具栏按钮、分配事件处理函数,并实现工具栏按钮的响应逻辑。
- **状态栏编程**:介绍了状态栏的创建、添加不同类型的指示器(如文本、进度条等)以及状态信息的显示更新。
- **为工具栏添加皮肤**:展示了如何为工具栏提供更加丰富的视觉效果,通常涉及到第三方的控件库或是自定义的绘图代码。
#### 第5章 系统编程
- **操作注册表**:解释了Windows注册表的结构和如何通过程序对其进行读写操作,这对于配置软件和管理软件设置非常关键。
- **系统托盘编程**:讲解了如何在系统托盘区域创建图标,并实现最小化到托盘、从托盘恢复窗口的功能。
- **鼠标钩子程序**:介绍了钩子(Hook)技术,特别是鼠标钩子,如何拦截和处理系统中的鼠标事件。
- **文件分割器**:提供了如何将文件分割成多个部分,并且能够重新组合文件的技术示例。
#### 第6章 多文档/多视图编程
- **单文档多视**:展示了如何在同一个文档中创建多个视图,这在文档编辑软件中非常常见。
#### 第7章 对话框高级应用
- **实现无模式对话框**:介绍了无模式对话框的概念及其应用场景,以及如何实现和管理无模式对话框。
- **使用模式属性表及向导属性表**:讲解了属性表的创建和使用方法,以及如何通过向导性质的对话框引导用户完成多步骤的任务。
- **鼠标敏感文字**:提供了如何实现点击文字触发特定事件的功能,这在阅读器和编辑器应用中很有用。
#### 第8章 GDI+图形编程
- **图像浏览器**:通过图像浏览器示例,展示了GDI+在图像处理和展示中的应用,包括图像的加载、显示以及基本的图像操作。
#### 第9章 多线程编程
- **使用全局变量通信**:介绍了在多线程环境下使用全局变量进行线程间通信的方法和注意事项。
- **使用Windows消息通信**:讲解了通过消息队列在不同线程间传递信息的技术,包括发送消息和处理消息。
- **使用CriticalSection对象**:阐述了如何使用临界区(CriticalSection)对象防止多个线程同时访问同一资源。
- **使用Mutex对象**:介绍了互斥锁(Mutex)的使用,用以同步线程对共享资源的访问,保证资源的安全。
- **使用Semaphore对象**:解释了信号量(Semaphore)对象的使用,它允许一个资源由指定数量的线程同时访问。
#### 第10章 DLL编程
- **创建和使用Win32 DLL**:介绍了如何创建和链接Win32动态链接库(DLL),以及如何在其他程序中使用这些DLL。
- **创建和使用MFC DLL**:详细说明了如何创建和使用基于MFC的动态链接库,适用于需要使用MFC类库的场景。
#### 第11章 ATL编程
- **简单的非属性化ATL项目**:讲解了ATL(Active Template Library)的基础使用方法,创建一个不使用属性化组件的简单项目。
- **使用ATL开发COM组件**:详细阐述了使用ATL开发COM组件的步骤,包括创建接口、实现类以及注册组件。
#### 第12章 STL编程
- **list编程**:介绍了STL(标准模板库)中的list容器的使用,讲解了如何使用list实现复杂数据结构的管理。
#### 第13章 网络编程
- **网上聊天应用程序**:提供了实现基本聊天功能的示例代码,包括客户端和服务器的通信逻辑。
- **简单的网页浏览器**:演示了如何创建一个简单的Web浏览器程序,涉及到网络通信和HTML解析。
- **ISAPI服务器扩展编程**:介绍了如何开发ISAPI(Internet Server API)服务器扩展来扩展IIS(Internet Information Services)的功能。
#### 第14章 数据库编程
- **ODBC数据库编程**:解释了ODBC(开放数据库互联)的概念,并提供了使用ODBC API进行数据库访问的示例。
- **ADO编程**:介绍了ADO(ActiveX Data Objects)技术,讲解了如何使用ADO进行数据库的增删改查等操作。
#### 第15章 HTML帮助系统编程
- **创建HTML帮助文件**:讲解了如何创建HTML帮助文件(.chm),这是微软帮助系统的一种形式。
- **区分上下文帮助**:提供了在应用程序中实现上下文敏感帮助的技术示例。
#### 第16章 安装和部署项目
- **用安装程序向导创建安装项目**:介绍了如何使用Visual Studio中的安装和部署项目向导,快速创建安装程序。
- **部署应用程序**:阐述了部署应用程序到目标系统的过程,以及如何确保应用程序的正确安装和运行。
以上内容涵盖了Visual C++.NET编程技术体验一书中涉及的各个技术点,并对每个章节中的示例做了详细的说明。这些知识点对于理解和掌握Visual C++.NET编程非常重要,并能够帮助读者在实际项目开发中应用这些技术。
HarmonyOS内核深度探秘:优化自由行旅游系统的策略
# 1. HarmonyOS内核概述与旅游系统需求分析
## 1.1 HarmonyOS内核概述
HarmonyOS(鸿蒙操作系统)是由华为开发的一个分布式操作系统,旨在提供跨多种设备的无缝体验。其内核设计理念强调高效、安全和模块化,以微内核架构和分布式能力
tkinter模块所有控件
<think>好的,我现在需要回答用户关于Tkinter模块中所有控件列表的问题。首先,我需要回忆Tkinter的基础知识,确保自己了解各个控件的名称和用途。用户希望得到所有支持的控件列表,所以必须全面覆盖,不能遗漏。
首先,我应该从Tkinter的标准控件开始。常见的控件包括Label、Button、Entry这些基础部件。然后是Frame,用于布局,还有Canvas用于绘图。接下来是Checkbutton、Radiobutton,这些属于选择类控件。Listbox和Scrollbar通常一起使用,处理滚动内容。还有Scale(滑块)、Spinbox、Menu、Menubutton这些可能
局域网五子棋游戏:娱乐与聊天的完美结合
标题“网络五子棋”和描述“适合于局域网之间娱乐和聊天!”以及标签“五子棋 网络”所涉及的知识点主要围绕着五子棋游戏的网络版本及其在局域网中的应用。以下是详细的知识点:
1. 五子棋游戏概述:
五子棋是一种两人对弈的纯策略型棋类游戏,又称为连珠、五子连线等。游戏的目标是在一个15x15的棋盘上,通过先后放置黑白棋子,使得任意一方先形成连续五个同色棋子的一方获胜。五子棋的规则简单,但策略丰富,适合各年龄段的玩家。
2. 网络五子棋的意义:
网络五子棋是指可以在互联网或局域网中连接进行对弈的五子棋游戏版本。通过网络版本,玩家不必在同一地点即可进行游戏,突破了空间限制,满足了现代人们快节奏生活的需求,同时也为玩家们提供了与不同对手切磋交流的机会。
3. 局域网通信原理:
局域网(Local Area Network,LAN)是一种覆盖较小范围如家庭、学校、实验室或单一建筑内的计算机网络。它通过有线或无线的方式连接网络内的设备,允许用户共享资源如打印机和文件,以及进行游戏和通信。局域网内的计算机之间可以通过网络协议进行通信。
4. 网络五子棋的工作方式:
在局域网中玩五子棋,通常需要一个客户端程序(如五子棋.exe)和一个服务器程序。客户端负责显示游戏界面、接受用户输入、发送落子请求给服务器,而服务器负责维护游戏状态、处理玩家的游戏逻辑和落子请求。当一方玩家落子时,客户端将该信息发送到服务器,服务器确认无误后将更新后的棋盘状态传回给所有客户端,更新显示。
5. 五子棋.exe程序:
五子棋.exe是一个可执行程序,它使得用户可以在个人计算机上安装并运行五子棋游戏。该程序可能包含了游戏的图形界面、人工智能算法(如果支持单机对战AI的话)、网络通信模块以及游戏规则的实现。
6. put.wav文件:
put.wav是一个声音文件,很可能用于在游戏进行时提供声音反馈,比如落子声。在网络环境中,声音文件可能被用于提升玩家的游戏体验,尤其是在局域网多人游戏场景中。当玩家落子时,系统会播放.wav文件中的声音,为游戏增添互动性和趣味性。
7. 网络五子棋的技术要求:
为了确保多人在线游戏的顺利进行,网络五子棋需要具备一些基本的技术要求,包括但不限于稳定的网络连接、高效的数据传输协议(如TCP/IP)、以及安全的数据加密措施(如果需要的话)。此外,还需要有一个良好的用户界面设计来提供直观和舒适的用户体验。
8. 社交与娱乐:
网络五子棋除了是一个娱乐游戏外,它还具有社交功能。玩家可以通过游戏内的聊天系统进行交流,分享经验和策略,甚至通过网络寻找新的朋友。这使得网络五子棋不仅是一个个人娱乐工具,同时也是一种社交活动。
总结来说,网络五子棋结合了五子棋游戏的传统魅力和现代网络技术,使得不同地区的玩家能够在局域网内进行娱乐和聊天,既丰富了人们的娱乐生活,又加强了人际交流。而实现这一切的基础在于客户端程序的设计、服务器端的稳定运行、局域网的高效通信,以及音效文件增强的游戏体验。
自由行旅游新篇章:HarmonyOS技术融合与系统架构深度解析
# 1. HarmonyOS技术概述
## 1.1 HarmonyOS的起源与发展
HarmonyOS(鸿蒙操作系统)由华为公司开发,旨在构建全场景分布式OS,以应对不同设备间的互联问题。自从2019年首次发布以来,HarmonyOS迅速成长,并迅速应用于智能手机、平板、智能穿戴、车载设备等多种平台。该系