DbSl Trace: Cannot run a UNICODE kernel against a non-UTF8 database (charset = AL32UTF8)

本文介绍了解决Oracle数据库中Unicode UTF8内核与非UTF8字符集数据库之间的兼容性问题的方法。通过一系列步骤调整数据库的字符集设置,确保系统能够正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、问题


DbSl Trace: Cannot run a UNICODE kernel against a non-UTF8 database (charset = AL32UTF8)





2、分析



安装的编码要求是unicode UTF8的,要是你安装的不是UTF 8子集编码的就转不了,要重新自定义安装时选择UTF8。可以用下列语句查寻当前的oracle数据库编码



select * from v$nls_parameters;

select * from nls_database_parameters;

select * from sys.props$;


3、办法




SHUTDOWN IMMEDIATE; 
STARTUP MOUNT EXCLUSIVE; 
ALTER SYSTEM ENABLE RESTRICTED SESSION; 
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; 
ALTER SYSTEM SET AQ_TM_PROCESSES=0; 
ALTER DATABASE OPEN; 
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE UTF8; 

update props$ set VALUE$='UTF8' where NAME='NLS_NCHAR_CHARACTERSET';

update props$ set value$='UTF8' where name='NLS_CHARACTERSET';

commit;

SHUTDOWN immediate; 
startup; 

<template> <div class="app-container"> <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"> <span>{{ parseTime(scope.row.time, '{y}-{m}-{d}') }}</span> </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"> <span>{{ parseTime(scope.row.sgsj, '{y}-{m}-{d}') }}</span> </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"> <span>{{ parseTime(scope.row.scrq, '{y}-{m}-{d}') }}</span> </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> <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="900px" append-to-body> <template slot="title"> <div style="text-align: center; font-size: 16px; font-weight: bold;"> 钢筋丝头加工记录表 </div> </template> <el-form ref="form" :model="form" :rules="rules" label-width="0"> <!-- 施工单位 + 合同号 --> <div style="display: flex; margin-bottom: 12px;"> <div style="flex: 1; display: flex; align-items: center; margin-right: 20px;"> <span style="min-width: 70px;">施工单位:</span> <el-input v-model="form.sgdw" placeholder="请输入施工单位"></el-input> </div> <div style="flex: 1; display: flex; align-items: center;"> <span style="min-width: 70px;">合同号:</span> <el-input v-model="form.hth" placeholder="请输入合同号"></el-input> </div> </div> <!-- 监理单位 + 编号 --> <div style="display: flex; margin-bottom: 12px;"> <div style="flex: 1; display: flex; align-items: center; margin-right: 20px;"> <span style="min-width: 70px;">监理单位:</span> <el-input v-model="form.jldw" placeholder="请输入监理单位"></el-input> </div> <div style="flex: 1; display: flex; align-items: center;"> <span style="min-width: 70px;">编号:</span> <el-input v-model="form.bh" placeholder="请输入编号"></el-input> </div> </div> <!-- 工程名称 + 施工时间 --> <div style="display: flex; margin-bottom: 12px;"> <div style="flex: 1; display: flex; align-items: center; margin-right: 20px;"> <span style="min-width: 70px;">工程名称:</span> <el-input v-model="form.gcmc" placeholder="请输入工程名称"></el-input> </div> <div style="flex: 1; display: flex; align-items: center;"> <span style="min-width: 70px;">施工时间:</span> <el-date-picker v-model="form.sgsj" type="date" placeholder="选择施工时间" style="width: 100%;"></el-date-picker> </div> </div> <!-- 工程部位 --> <div style="display: flex; margin-bottom: 12px; align-items: center;"> <span style="min-width: 150px;">工程部位(桩号、墩台号、孔号):</span> <el-input v-model="form.gcbwZh" placeholder="桩号" style="width: 120px;"></el-input> <span style="margin: 0 5px;">-</span> <el-input v-model="form.gcbwDth" placeholder="墩台号" style="width: 120px;"></el-input> <span style="margin: 0 5px;">-</span> <el-input v-model="form.gcbwKh" placeholder="孔号" style="width: 120px;"></el-input> </div> <!-- 钢筋规格 + 抽检数量 --> <div style="display: flex; margin-bottom: 12px;"> <div style="flex: 1; display: flex; align-items: center; margin-right: 20px;"> <span style="min-width: 70px;">钢筋规格:</span> <el-input v-model="form.gjgg" placeholder="请输入钢筋规格"></el-input> </div> <div style="flex: 1; display: flex; align-items: center;"> <span style="min-width: 90px;">抽检数量(根):</span> <el-input-number v-model="form.cjsl" :placeholder="form.cjsl ? '' : '数量'" style="width: 100%;"></el-input-number> </div> </div> <!-- 生产日期 + 代表数量 --> <div style="display: flex; margin-bottom: 15px;"> <div style="flex: 1; display: flex; align-items: center; margin-right: 20px;"> <span style="min-width: 70px;">生产日期:</span> <el-date-picker v-model="form.scrq" type="date" placeholder="选择生产日期" style="width: 100%;"></el-date-picker> </div> <div style="flex: 1; display: flex; align-items: center;"> <span style="min-width: 90px;">代表数量(根):</span> <el-input-number v-model="form.dbsl" :placeholder="form.dbsl ? '' : '数量'" style="width: 100%;"></el-input-number> </div> </div> <!-- 表格标题 --> <div style="text-align: center; font-weight: bold; margin: 15px 0;"> 施工实际情况 </div> <!-- 表格部分 --> <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> <!-- 检验结论 + 不合格处理 --> <div style="display: flex; margin-bottom: 12px;"> <div style="flex: 1; display: flex; align-items: center; margin-right: 20px;"> <span style="min-width: 70px;">检验结论:</span> <el-input v-model="form.jyjl" placeholder="检验结论"></el-input> </div> <div style="flex: 1; display: flex; align-items: center;"> <span style="min-width: 80px;">不合格处理:</span> <el-input v-model="form.bhgcl" placeholder="不合格处理"></el-input> </div> </div> <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> <!-- 签名栏 --> <div style="display: flex; justify-content: flex-end; align-items: center;"> <span style="margin-right: 15px;">施工员:</span> <el-input v-model="form.sgy" placeholder="姓名" style="width: 120px; margin-right: 40px;"></el-input> <span>专业工程师:</span> <el-input v-model="form.zygcs" placeholder="姓名" style="width: 120px;"></el-input> </div> </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 { 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> 分析以上代码
07-26
<template> <view class="app-container"> <!-- 顶部操作栏 --> <view class="action-bar"> <button type="default" size="mini" @click="handleExport" v-if="hasPermi(['gjstjgjlb:sj32:export'])">导出</button> </view> <!-- 查询按钮 --> <view class="search-button"> <button type="primary" @click="openSearchDialog">查询记录</button> </view> <!-- 数据列表 - 多行形式 --> <view class="data-list" v-if="sj32List.length > 0"> <view class="data-card" v-for="(item, index) in sj32List" :key="index"> <!-- 卡片头部 --> <view class="card-header"> <text class="card-title">{{ item.gcmc || '未命名工程' }}</text> <text class="card-subtitle">ID: {{ item.id }}</text> </view> <!-- 卡片内容 - 每个字段单独一行 --> <view class="card-body"> <!-- 采集时间 --> <view class="data-row"> <view class="data-label">采集时间:</view> <view class="data-value">{{ formatDate(item.time) }}</view> </view> <!-- 施工时间 --> <view class="data-row"> <view class="data-label">施工时间:</view> <view class="data-value">{{ formatDate(item.sgsj) }}</view> </view> <!-- 采集地点 --> <view class="data-row"> <view class="data-label">采集地点:</view> <view class="data-value">{{ item.position || '-' }}</view> </view> <!-- 施工单位 --> <view class="data-row"> <view class="data-label">施工单位:</view> <view class="data-value">{{ item.sgdw || '-' }}</view> </view> <!-- 监理单位 --> <view class="data-row"> <view class="data-label">监理单位:</view> <view class="data-value">{{ item.jldw || '-' }}</view> </view> <!-- 合同号 --> <view class="data-row"> <view class="data-label">合同号:</view> <view class="data-value">{{ item.hth || '-' }}</view> </view> <!-- 编号 --> <view class="data-row"> <view class="data-label">编号:</view> <view class="data-value">{{ item.bh || '-' }}</view> </view> <!-- 人员编号 --> <view class="data-row"> <view class="data-label">人员编号:</view> <view class="data-value">{{ item.userid || '-' }}</view> </view> <!-- 抽检数量 --> <view class="data-row"> <view class="data-label">抽检数量:</view> <view class="data-value">{{ item.cjsl || 0 }}根</view> </view> <!-- 工程部位 --> <view class="data-row"> <view class="data-label">工程部位:</view> <view class="data-value">{{ formatGcbw(item) }}</view> </view> <!-- 钢筋规格 --> <view class="data-row"> <view class="data-label">钢筋规格:</view> <view class="data-value">{{ item.gjgg || '-' }}</view> </view> <!-- 代表数量 --> <view class="data-row"> <view class="data-label">代表数量:</view> <view class="data-value">{{ item.dbsl || 0 }}根</view> </view> <!-- 检验结论 --> <view class="data-row"> <view class="data-label">检验结论:</view> <view class="data-value">{{ item.jyjl || '-' }}</view> </view> <!-- 不合格处理 --> <view class="data-row"> <view class="data-label">不合格处理:</view> <view class="data-value">{{ item.bhgcl || '-' }}</view> </view> <!-- 施工员 --> <view class="data-row"> <view class="data-label">施工员:</view> <view class="data-value">{{ item.sgy || '-' }}</view> </view> <!-- 专业工程师 --> <view class="data-row"> <view class="data-label">专业工程师:</view> <view class="data-value">{{ item.zygcs || '-' }}</view> </view> <!-- 环通规 --> <view class="data-row"> <view class="data-label">环通规:</view> <view class="data-value"> <view :class="['check-icon', item.htg ? 'checked' : '']"> {{ item.htg ? '√' : '×' }} </view> </view> </view> <!-- 环止规 --> <view class="data-row"> <view class="data-label">环止规:</view> <view class="data-value"> <view :class="['check-icon', item.hzg ? 'checked' : '']"> {{ item.hzg ? '√' : '×' }} </view> </view> </view> <!-- 有效螺纹长度 --> <view class="data-row"> <view class="data-label">有效螺纹长度:</view> <view class="data-value"> <view :class="['check-icon', item.yxlwcd ? 'checked' : '']"> {{ item.yxlwcd ? '√' : '×' }} </view> </view> </view> <!-- 不完整螺纹 --> <view class="data-row"> <view class="data-label">不完整螺纹:</view> <view class="data-value"> <view :class="['check-icon', item.bzlw ? 'checked' : '']"> {{ item.bzlw ? '√' : '×' }} </view> </view> </view> </view> </view> </view> <!-- 无数据提示 --> <view class="no-data" v-else> <text>暂无数据,请点击查询按钮获取记录</text> </view> <!-- 分页控件 --> <uni-pagination v-if="sj32List.length > 0" :current="queryParams.pageNum" :page-size="queryParams.pageSize" :total="total" @change="handlePageChange" /> <!-- 查询弹窗 --> <uni-popup ref="searchPopup" type="dialog"> <view class="search-dialog"> <view class="dialog-title">查询条件</view> <scroll-view scroll-y="true" class="scroll-view"> <view class="form-section"> <!-- 采集时间范围 --> <view class="form-row"> <text class="form-label">采集时间范围:</text> <uni-datetime-picker type="daterange" v-model="daterangeTime" placeholder="选择时间范围" /> </view> <!-- 采集地点 --> <view class="form-row"> <text class="form-label">采集地点:</text> <uni-easyinput v-model="queryParams.position" placeholder="请输入采集地点" /> </view> <!-- 采集人员编号 --> <view class="form-row"> <text class="form-label">采集人员编号:</text> <uni-easyinput v-model="queryParams.userid" placeholder="请输入人员编号" /> </view> <!-- 施工单位 --> <view class="form-row"> <text class="form-label">施工单位:</text> <uni-easyinput v-model="queryParams.sgdw" placeholder="请输入施工单位" /> </view> <!-- 监理单位 --> <view class="form-row"> <text class="form-label">监理单位:</text> <uni-easyinput v-model="queryParams.jldw" placeholder="请输入监理单位" /> </view> <!-- 合同号 --> <view class="form-row"> <text class="form-label">合同号:</text> <uni-easyinput v-model="queryParams.hth" placeholder="请输入合同号" /> </view> <!-- 编号 --> <view class="form-row"> <text class="form-label">编号:</text> <uni-easyinput v-model="queryParams.bh" placeholder="请输入编号" /> </view> <!-- 工程名称 --> <view class="form-row"> <text class="form-label">工程名称:</text> <uni-easyinput v-model="queryParams.gcmc" placeholder="请输入工程名称" /> </view> <!-- 施工时间范围 --> <view class="form-row"> <text class="form-label">施工时间范围:</text> <uni-datetime-picker type="daterange" v-model="daterangeSgsj" placeholder="选择时间范围" /> </view> </view> </scroll-view> <view class="dialog-buttons"> <button type="primary" @click="handleQuery">查询</button> <button @click="resetQuery">重置</button> <button @click="closeSearchDialog">取消</button> </view> </view> </uni-popup> </view> </template> <script> import { listSj32 } from '@/api/gjstjgjlb/sj32' export default { data() { return { // 主数据 sj32List: [], total: 0, loading: false, // 查询参数 queryParams: { pageNum: 1, pageSize: 10, position: null, userid: null, sgdw: null, jldw: null, hth: null, bh: null, gcmc: null, time: null, sgsj: null }, daterangeTime: [], daterangeSgsj: [] } }, onLoad() { // 初始加载数据 this.getList() }, methods: { // 权限检查 hasPermi(permissions) { // 简化权限检查逻辑 return true }, // 打开查询弹窗 openSearchDialog() { this.$refs.searchPopup.open() }, // 关闭查询弹窗 closeSearchDialog() { this.$refs.searchPopup.close() }, // 加载数据 async getList() { this.loading = true // 处理日期范围参数 const params = { ...this.queryParams, params: {} } // 采集时间范围处理 if (this.daterangeTime.length === 2) { params.params.beginTime = this.daterangeTime[0] params.params.endTime = this.daterangeTime[1] } // 施工时间范围处理 if (this.daterangeSgsj.length === 2) { params.params.beginSgsj = this.daterangeSgsj[0] params.params.endSgsj = this.daterangeSgsj[1] } try { const res = await listSj32(params) // 确保布尔字段处理正确 this.sj32List = res.rows.map(item => { // 确保布尔字段转换为布尔值 ['htg', 'hzg', 'yxlwcd', 'bzlw'].forEach(field => { if (item[field] === 'true' || item[field] === 1) { item[field] = true } else if (item[field] === 'false' || item[field] === 0 || item[field] === null) { item[field] = false } }) return item }) this.total = res.total } catch (error) { console.error('加载数据失败:', error) uni.showToast({ title: '加载数据失败', icon: 'none' }) } finally { this.loading = false } }, // 查询处理 handleQuery() { this.queryParams.pageNum = 1 this.getList() this.closeSearchDialog() }, // 重置查询 resetQuery() { this.daterangeTime = [] this.daterangeSgsj = [] this.queryParams = { pageNum: 1, pageSize: 10, position: null, userid: null, sgdw: null, jldw: null, hth: null, bh: null, gcmc: null, time: null, sgsj: null } }, // 分页处理 handlePageChange(e) { this.queryParams.pageNum = e.current this.getList() }, // 导出处理 handleExport() { uni.navigateTo({ url: '/pages/gjstjgjlb/sj32/export' }) }, // 日期格式化 formatDate(dateString) { if (!dateString) return '-' const date = new Date(dateString) return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}` }, // 格式化工程部位 formatGcbw(item) { if (!item.gcbwZh && !item.gcbwDth && !item.gcbwKh) return '-' const parts = [] if (item.gcbwZh) parts.push(`桩号:${item.gcbwZh}`) if (item.gcbwDth) parts.push(`墩台号:${item.gcbwDth}`) if (item.gcbwKh) parts.push(`孔号:${item.gcbwKh}`) return parts.join(' - ') } } } </script> <style lang="scss"> .app-container { padding: 10px; background-color: #f5f7fa; } /* 操作栏样式 */ .action-bar { display: flex; justify-content: flex-end; margin-bottom: 15px; button { font-size: 12px; padding: 4px 8px; } } /* 查询按钮样式 */ .search-button { margin-bottom: 15px; button { width: 100%; background-color: #409eff; color: white; border-radius: 4px; } } /* 数据列表样式 - 多行卡片形式 */ .data-list { display: flex; flex-direction: column; gap: 15px; } .data-card { background-color: #fff; border-radius: 8px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); padding: 15px; } .card-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1px solid #eee; margin-bottom: 10px; } .card-title { font-size: 16px; font-weight: bold; color: #333; } .card-subtitle { font-size: 12px; color: #999; } .card-body { display: flex; flex-direction: column; gap: 8px; } .data-row { display: flex; align-items: center; font-size: 14px; line-height: 1.6; min-height: 30px; } .data-label { min-width: 120px; color: #606266; font-weight: bold; margin-right: 5px; } .data-value { flex: 1; color: #303133; word-break: break-word; display: flex; align-items: center; } /* 特殊字段样式 - √/× */ .check-icon { display: inline-flex; justify-content: center; align-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid #dcdfe6; font-size: 18px; font-weight: bold; margin-right: 5px; &.checked { border-color: #67c23a; color: #67c23a; } &:not(.checked) { color: #f56c6c; } } /* 无数据提示 */ .no-data { text-align: center; padding: 40px 0; color: #909399; font-size: 14px; } /* 查询弹窗样式 */ .search-dialog { background: #fff; border-radius: 8px; width: 95vw; max-height: 80vh; overflow: hidden; padding: 20px; } .dialog-title { text-align: center; font-size: 16px; font-weight: bold; margin-bottom: 15px; } .scroll-view { max-height: 60vh; padding-bottom: 15px; } .form-section { padding: 10px; } .form-row { display: flex; flex-direction: column; margin-bottom: 15px; } .form-label { font-weight: bold; font-size: 14px; margin-bottom: 5px; } .dialog-buttons { display: flex; justify-content: space-between; margin-top: 15px; button { flex: 1; margin: 0 5px; &:first-child { background-color: #409eff; color: white; } } } </style> 根据我给你的第一份代码,来简化我现在给你的这份代码
07-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值