vue3页面编写-导入导出excel、展开查询项等

数据保持

<router-view v-slot="{ Component, route }"><keep-alive><component :is="Component" :key="route.name" v-if="route.meta.keepAlive" /></keep-alive><component :is="Component" :key="route.name"  v-if="!route.meta.keepAlive"/>
</router-view>
{   // path: "/main/rvCarBom",meta: {keepAlive: true,isBack: false},component: () => import('@/pages/rv/bom/rvCarBom.vue'),},

功能页面

<!----><template><div class="rv_root_container"><div class="rv_container"><div><el-form :inline="true" label-position="right" size="small"><el-row><el-form-item label="装车基地"><el-select v-model="dddd.form.city" clearable placeholder="请选择" style="width:150px" @change="handleChangeFactory"><el-optionv-for="item in dddd.cityList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="车系"><el-select v-model="dddd.form.carModel" clearable placeholder="请选择" style="width:150px" @change="handleChangeFactory"><el-optionv-for="item in dddd.carModelList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="车型"><el-select v-model="dddd.form.carType" clearable placeholder="请选择" style="width:150px" @change="handleChangeFactory"><el-optionv-for="item in dddd.carTypeList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="配置"><el-select v-model="dddd.form.carConf" clearable placeholder="请选择" style="width:150px" @change="handleChangeFactory"><el-optionv-for="item in dddd.carConfList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="选装"><el-select v-model="dddd.form.carSel" clearable placeholder="请选择" style="width:150px" @change="handleChangeFactory"><el-optionv-for="item in dddd.carSelList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="国家"><el-select v-model="dddd.form.country" clearable placeholder="请选择" style="width:150px" @change="handleChangeFactory"><el-optionv-for="item in dddd.countryList":key="item":label="item":value="item"></el-option></el-select></el-form-item></el-row><el-row v-if="dddd.isShow"><el-form-item label="总成料号"><el-input type="textarea" :rows="1" :clearable="true" v-model="dddd.form.assemblyMatNumber" style="width:150px"></el-input></el-form-item><el-form-item label="总成描述"><el-input type="textarea" :rows="1" :clearable="true" v-model="dddd.form.assemblyDes" style="width:150px"></el-input></el-form-item><el-form-item label="工厂"><el-select v-model="dddd.form.factory" clearable placeholder="请选择" style="width:150px" @change="handleChangeFactory"><el-optionv-for="item in dddd.factoryList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="线体名称"><el-select v-model="dddd.form.lineName" clearable placeholder="请选择" style="width:150px"><el-optionv-for="item in dddd.lineNameList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="代装厂"><el-input type="textarea" :rows="1" :clearable="true" v-model="dddd.form.buyLocation" style="width:150px"></el-input></el-form-item><el-form-item label="产能检查"><el-select v-model="dddd.form.capacityCheck" clearable placeholder="请选择" style="width:150px"><el-optionv-for="item in dddd.capacityCheckList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="产品大类"><el-select v-model="dddd.form.product" clearable placeholder="请选择" style="width:150px" @change="handleChangeProduct"><el-optionv-for="item in dddd.productList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="产品小类"><el-select v-model="dddd.form.productSub" clearable placeholder="请选择" style="width:150px"><el-optionv-for="item in dddd.productSubList":key="item":label="item":value="item"></el-option></el-select></el-form-item><el-form-item label="计划员"><el-select v-model="dddd.form.planPerson" clearable placeholder="请选择" style="width:150px"><el-optionv-for="item in dddd.planPersonList":key="item":label="item":value="item"></el-option></el-select></el-form-item></el-row><el-row><el-button type="primary" @click="clickSearch" :icon="IconReload">查询</el-button><el-button @click="clickReset" :icon="IconRefresh">重置</el-button><el-button type="primary" @click="clickExport" :icon="IconDownload">导出</el-button><el-button type="primary" @click="clickEdit" :icon="IconPlus">新增</el-button><el-button type="primary" @click="clickDelete" :icon="IconRowRemove">删除</el-button><el-upload class="rv_upload" action="" :show-file-list="false" :on-change="handleOnChange"><el-button type="primary" :icon="IconUpload">导入</el-button></el-upload><el-button text @click="clickTemplate">模板下载</el-button><el-button type="primary" @click="clickShow" :icon="dddd.isShow ? IconArrowUp : IconArrowDown">{{ dddd.isShow ? "收起" : "展开" }}</el-button><a id="aExport" href="#" class="hide"></a></el-row></el-form></div><div class="rv_table"><el-table stripe border show-overflow-tooltip highlight-current-row size="small" class-name="custom-table" header-cell-class-name="custom-header-cell-class-name" :row-class-name="tableRowClassName":data="dddd.tableList" @selection-change="handleSelectionChange"><el-table-column type="selection" align="center" width="50" fixed="left"></el-table-column><el-table-column align="center" width="100" label="操作" fixed="left"><template #default="scope"><el-button type="primary" size="small" @click="clickEdit1(scope.row)" :icon="IconEdit"></el-button><el-button type="danger" size="small" @click="clickDelete1(scope.row)" :icon="IconRowRemove"></el-button></template></el-table-column><el-table-column align="center" type="index" label="序号" width="50" fixed="left"></el-table-column><el-table-column align="center" prop="city" label="装车基地" width="75" fixed="left"></el-table-column><el-table-column align="center" prop="carModel" label="车系" width="75" fixed="left"></el-table-column><el-table-column align="center" prop="carType" label="车型" width="75" fixed="left"></el-table-column><el-table-column align="center" prop="carConf" label="配置" width="75" fixed="left"></el-table-column><el-table-column align="center" prop="carSel" label="选装" width="75" fixed="left"></el-table-column><el-table-column align="center" prop="country" label="国家" width="75" fixed="left"></el-table-column><el-table-column align="center" prop="assemblyMatNumber" label="总成料号" width="150" fixed="left"></el-table-column><el-table-column align="center" prop="assemblyDes" label="总成描述" width="220" fixed="left"></el-table-column><el-table-column align="center" prop="num" label="用量" width="75"></el-table-column><el-table-column align="center" prop="factory" label="工厂" width="75"></el-table-column><el-table-column align="center" prop="carScale" label="份额" width="75"></el-table-column><el-table-column align="center" prop="speLineName" label="线体名称" width="150"></el-table-column><el-table-column align="center" prop="buyLocation" label="代装厂" width="75"></el-table-column><el-table-column align="center" prop="capacityCheck" label="产能检查" width="75"></el-table-column><el-table-column align="center" prop="product" label="产品大类" width="75"></el-table-column><el-table-column align="center" prop="productSub" label="产品小类" width="75"></el-table-column><el-table-column align="center" prop="planPerson" label="计划员" width="75"></el-table-column><el-table-column align="center" prop="carScale1" label="1月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale2" label="2月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale3" label="3月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale4" label="4月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale5" label="5月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale6" label="6月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale7" label="7月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale8" label="8月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale9" label="9月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale10" label="10月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale11" label="11月份额" width="75"></el-table-column><el-table-column align="center" prop="carScale12" label="12月份额" width="75"></el-table-column><el-table-column align="center" prop="lineName" label="特殊线体" width="150"></el-table-column><el-table-column align="center" prop="createName" label="创建人" width="75"></el-table-column><el-table-column align="center" prop="createTime" label="创建时间" width="150"></el-table-column><el-table-column align="center" prop="updateName" label="修改人" width="75"></el-table-column><el-table-column align="center" prop="updateTime" label="修改时间" width="150"></el-table-column></el-table></div><div class="rv_center"><el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange":current-page="dddd.pageNum":page-size="dddd.pageSize":page-sizes="[10, 100, 500, 1000, 2000]":total="dddd.total"layout="total, sizes, prev, pager, next, jumper"></el-pagination></div></div></div>
</template>
<style>
.rv_root_container {flex: 1;display: flex;background-color: #f3f3f3;padding: 16px;overflow: hidden;
}
.rv_container {flex: 1;display: flex;flex-direction: column;background-color: white;border-radius: 5px;padding: 16px;overflow: hidden;position: relative;
}
.rv_center {display: flex;align-content: center;justify-content: center;
}
.rv_table {flex: 1;margin-top: 16px;margin-bottom: 16px;position: relative;
}
.rv_upload {line-height: 0.8;margin-left: 16px;
}
.custom-table .cell {padding: 0;justify-content: center;
}
.el-table .warning-row {color: tomato;
}
</style>
<script setup>
import { IconReload, IconRefresh, IconDownload, IconPlus, IconRowRemove, IconUpload, IconArrowUp, IconArrowDown,IconEdit } from "@tabler/icons-vue"
import { basePostReq, sendPostReq } from "@/service/baseReq.js"
import { ApiPaths } from "@/service/Request.js"
import { ElMessage, ElMessageBox } from "element-plus"
import { useRoute, useRouter } from "vue-router"
import { reactive, onActivated } from "vue"const dddd = reactive({form: {},tableList: [],pageSize: 10,pageNum: 1,total: 0,selectBatch: [],isShow: false,factoryList: ['SZ55','X157','C157','HFF5'],lineNameList: [],capacityCheckList: ['是', '否'],productList: [],productSubList: [],planPersonList: [],cityList: [],carModelList: [],carTypeList: [],carConfList: [],carSelList: [],countryList: []
})const route = useRoute()
const router = useRouter()onActivated(() => {if (!route.meta.isBack) {clickReset()dddd.tableList = []}route.meta.isBack = false
})function handleSizeChange(val) {dddd.pageSize = valgetPage()
}
function handleCurrentChange(val) {dddd.pageNum = valgetPage()
}
function handleSelectionChange(val) {dddd.selectBatch = val
}
function tableRowClassName(item) {if (item.row.capacityCheck != '是') {return 'warning-row'}return ''
}
function getParam() {var param = {}if (dddd.form.city) {param.city = dddd.form.city.replace(/[\r\n]/g, ";")}if (dddd.form.carModel) {param.carModel = dddd.form.carModel.replace(/[\r\n]/g, ";")}if (dddd.form.carType) {param.carType = dddd.form.carType.replace(/[\r\n]/g, ";")}if (dddd.form.carConf) {param.carConf = dddd.form.carConf.replace(/[\r\n]/g, ";")}if (dddd.form.carSel) {param.carSel = dddd.form.carSel.replace(/[\r\n]/g, ";")}if (dddd.form.country) {param.country = dddd.form.country.replace(/[\r\n]/g, ";")}if (dddd.form.assemblyMatNumber) {param.assemblyMatNumber = dddd.form.assemblyMatNumber.replace(/[\r\n]/g, ";")}if (dddd.form.assemblyDes) {param.assemblyDes = dddd.form.assemblyDes.replace(/[\r\n]/g, ";")}if (dddd.form.factory) {param.factory = dddd.form.factory}if (dddd.form.buyLocation) {param.buyLocation = dddd.form.buyLocation.replace(/[\r\n]/g, ";")}if (dddd.form.lineName) {param.lineName = dddd.form.lineName}if (dddd.form.capacityCheck) {param.capacityCheck = dddd.form.capacityCheck}if (dddd.form.product) {param.product = dddd.form.product}if (dddd.form.productSub) {param.productSub = dddd.form.productSub}if (dddd.form.planPerson) {param.planPerson = dddd.form.planPerson}return param
}
function clickSearch() {getPage()
}
function getPage() {var param = getParam()param.pageNum = dddd.pageNumparam.pageSize = dddd.pageSizebasePostReq(ApiPaths.rvNeedCarBomGetPage, param, (res) => {if (res) {dddd.tableList = res.datadddd.total = res.total}})
}
function clickReset() {dddd.form = {}dddd.pageNum = 1getInitMap()getCarTypeInitMap()
}
function clickExport() {var param = getParam()var config = {responseType: "blob",}const data = sendPostReq(ApiPaths.rvNeedCarBomExport, param, config, true, true, true, (res) => {if (res) {const blob = new Blob([res])let $a = document.getElementById("aExport")$a.download = "整车bom.xlsx"$a.href = URL.createObjectURL(blob)$a.click()URL.revokeObjectURL($a.href)}})
}
function clickTemplate() {var config = {responseType: "blob",}sendPostReq(ApiPaths.rvNeedCarBomExportTemplate,null,config,true,true,true,(res) => {if (res) {const blob = new Blob([res])let $a = document.getElementById("aExport")$a.download = "整车bom模板.xlsx"$a.href = URL.createObjectURL(blob)$a.click()URL.revokeObjectURL($a.href)}})
}
function handleOnChange(file) {if (file.status == "ready") {var curFile = file.rawconst isExcel = ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",].includes(curFile.type)const isLt1M = curFile.size / 1024 / 1024 < 100if (!isExcel) {ElMessage.error("文件格式为.xlsx")return}if (!isLt1M) {ElMessage.error("文件要小于100M")return}var formData = new FormData()formData.append("file", file.raw)formData.append("param", JSON.stringify(getParam()))var config = {headers: {"Content-Type": "multipart/form-data",},}sendPostReq(ApiPaths.rvNeedCarBomImportFileCheck1,formData,config,true,true,false,(res) => {if (res && res.code == 200) {ElMessage.success("上传成功")}})}
}
function clickDelete() {if (!dddd.selectBatch.length) {ElMessage.error("没有数据被选中")return}ElMessageBox.confirm("是否删除", "温馨提示", {confirmButtonText: "确定",cancelButtonText: "取消",type: "warning",}).then(() => {var ids = dddd.selectBatch.map((p) => p.id)var param = {}param.ids = idssendPostReq(ApiPaths.rvNeedCarBomRemoveListByIds,param,null,true,true,false,(res) => {if (res && res.code == 200) {ElMessage.success("删除成功")clickSearch()}})})
}
function clickDelete1(item) {if (!item || !item.id) {ElMessage.error("没有id")return}ElMessageBox.confirm("是否删除", "温馨提示", {confirmButtonText: "确定",cancelButtonText: "取消",type: "warning",}).then(() => {var param = {}param.ids = [item.id]sendPostReq(ApiPaths.rvNeedCarBomRemoveListByIds,param,null,true,true,false,(res) => {if (res && res.code == 200) {ElMessage.success("删除成功")clickSearch()}})})
}
function clickEdit() {router.push({ path: "/main/rvCarBomEdit" })
}
function clickEdit1(item) {if (item && item.id) {item.edit = "update"router.push({ path: "/main/rvCarBomEdit",query:item })}
}
function clickShow() {dddd.isShow = !dddd.isShow
}
function getLineName() {var param = {}param.factory = dddd.form.factorybasePostReq(ApiPaths.rvBomCarProductMatGetListLineName, param, (res) => {dddd.lineNameList = res})
}
function handleChangeFactory() {getLineName()
}
function getInitMap() {var param = {}basePostReq(ApiPaths.rvNeedCarBomGetInitMap, param, (res) => {if (res) {dddd.productList = res.productListdddd.productSubList = res.productSubListdddd.planPersonList = res.planPersonListdddd.lineNameList = res.lineNameListdddd.factoryList = res.factoryList}})
}
function getProductSub() {var param = {}if (dddd.form.product) {param.product = dddd.form.product}basePostReq(ApiPaths.rvBomCarProductMatGetListProductSub, param, (res) => {dddd.productSubList = res})
}
function handleChangeProduct() {getProductSub()
}
function getCarTypeInitMap() {var param = {}basePostReq(ApiPaths.rvNeedCarTypeManagerGetCarTypeInitMap, param, (res) => {if (res) {dddd.cityList = res.cityListdddd.carModelList = res.carModelListdddd.carTypeList = res.carTypeListdddd.carSelList = res.carSelListdddd.carConfList = res.carConfListdddd.countryList = res.countryList}})
}
</script>

编辑页面


<!----><template><div class="rv_root_container_edit"><div class="rv_container_edit"><div><el-form label-position="right" size="small"><el-form-item label="装车基地" required><el-input :clearable="true" v-model="dddd.form.city" style="width:150px"></el-input></el-form-item><el-form-item label="车系" required><el-input :clearable="true" v-model="dddd.form.carModel" style="width:150px"></el-input></el-form-item><el-form-item label="车型" required><el-input :clearable="true" v-model="dddd.form.carType" style="width:150px"></el-input></el-form-item><el-form-item label="配置" required><el-input :clearable="true" v-model="dddd.form.carConf" style="width:150px"></el-input></el-form-item><el-form-item label="选装" required><el-input :clearable="true" v-model="dddd.form.carSel" style="width:150px"></el-input></el-form-item><el-form-item label="国家" required><el-input :clearable="true" v-model="dddd.form.country" style="width:150px"></el-input></el-form-item><el-form-item label="总成料号" required><el-input :clearable="true" v-model="dddd.form.assemblyMatNumber" style="width:150px"></el-input></el-form-item><el-form-item label="总成描述" required><el-input :clearable="true" v-model="dddd.form.assemblyDes" style="width:220px"></el-input></el-form-item><el-form-item label="用量" required><el-input :clearable="true" v-model="dddd.form.num" style="width:150px"></el-input></el-form-item><el-form-item label="工厂" required><el-input :clearable="true" v-model="dddd.form.factory" style="width:150px"></el-input></el-form-item><el-form-item label="份额" required><el-input :clearable="true" v-model="dddd.form.carScale" style="width:150px"></el-input></el-form-item><el-form-item label="线体名称"><el-input :clearable="true" v-model="dddd.form.speLineName" style="width:150px" disabled></el-input></el-form-item><el-form-item label="代装厂"><el-input :clearable="true" v-model="dddd.form.buyLocation" style="width:150px"></el-input></el-form-item><el-form-item label="产能检查"><el-input :clearable="true" v-model="dddd.form.capacityCheck" style="width:150px" disabled></el-input></el-form-item><el-form-item label="产品大类"><el-input :clearable="true" v-model="dddd.form.product" style="width:150px" disabled></el-input></el-form-item><el-form-item label="产品小类"><el-input :clearable="true" v-model="dddd.form.productSub" style="width:150px" disabled></el-input></el-form-item><el-form-item label="计划员"><el-input :clearable="true" v-model="dddd.form.planPerson" style="width:150px" disabled></el-input></el-form-item><el-form-item label="1月份额"><el-input :clearable="true" v-model="dddd.form.carScale1" style="width:150px"></el-input></el-form-item><el-form-item label="2月份额"><el-input :clearable="true" v-model="dddd.form.carScale2" style="width:150px"></el-input></el-form-item><el-form-item label="3月份额"><el-input :clearable="true" v-model="dddd.form.carScale3" style="width:150px"></el-input></el-form-item><el-form-item label="4月份额"><el-input :clearable="true" v-model="dddd.form.carScale4" style="width:150px"></el-input></el-form-item><el-form-item label="5月份额"><el-input :clearable="true" v-model="dddd.form.carScale5" style="width:150px"></el-input></el-form-item><el-form-item label="6月份额"><el-input :clearable="true" v-model="dddd.form.carScale6" style="width:150px"></el-input></el-form-item><el-form-item label="7月份额"><el-input :clearable="true" v-model="dddd.form.carScale7" style="width:150px"></el-input></el-form-item><el-form-item label="8月份额"><el-input :clearable="true" v-model="dddd.form.carScale8" style="width:150px"></el-input></el-form-item><el-form-item label="9月份额"><el-input :clearable="true" v-model="dddd.form.carScale9" style="width:150px"></el-input></el-form-item><el-form-item label="10月份额"><el-input :clearable="true" v-model="dddd.form.carScale10" style="width:150px"></el-input></el-form-item><el-form-item label="11月份额"><el-input :clearable="true" v-model="dddd.form.carScale11" style="width:150px"></el-input></el-form-item><el-form-item label="12月份额"><el-input :clearable="true" v-model="dddd.form.carScale12" style="width:150px"></el-input></el-form-item><el-form-item label="特殊线体"><el-input :clearable="true" v-model="dddd.form.lineName" style="width:150px"></el-input></el-form-item><el-form-item><el-button type="primary" @click="clickBack" :icon="IconBackpackOff">返回</el-button><el-button type="primary" @click="clickConfirm" :icon="IconDoorEnter">确定</el-button></el-form-item></el-form></div></div></div>
</template><style>
.rv_root_container_edit {display: flex;flex: 1;background-color: #f3f3f3;padding: 16px;overflow: hidden;
}
.rv_container_edit {flex: 1;background-color: white;border-radius: 5px;padding: 16px;overflow: auto;
}
</style><script setup>
import { IconBackpackOff, IconDoorEnter } from "@tabler/icons-vue";
import { sendPostReq } from "@/service/baseReq.js";
import { ApiPaths } from "@/service/Request.js";
import { ElMessage } from "element-plus";
import { onBeforeRouteLeave, useRoute, useRouter } from "vue-router"
import { reactive, onActivated } from "vue"const dddd = reactive({form: {id: null}
})const route = useRoute()
const router = useRouter()
onBeforeRouteLeave((to, from, next) => {to.meta.isBack = truenext()
})onActivated(() => {if (route.query && route.query.id) {dddd.form = route.query} else {dddd.form = {}}
})if (route.query && route.query.id) {dddd.form = route.query
}function clickConfirm() {if (dddd.form.edit == "update") {sendPostReq(ApiPaths.rvNeedCarBomUpdateOneById, dddd.form, null, true, true, false, (res) => {if (res && res.code == 200) {ElMessage.success("更新成功")clickBack()}})} else {sendPostReq(ApiPaths.rvNeedCarBomSave, dddd.form, null, true, true, false, (res) => {if (res && res.code == 200) {ElMessage.success("新增成功")clickBack()}})}
}function clickBack() {router.back()
}</script>

改变cell颜色

//
.el-table .warning-row {color: tomato;
}
.el-table .ws-normal .el-tooltip{white-space: pre-line;
}//
:cell-class-name="tableCellClassName"//
function tableCellClassName(item) {if (item.rowIndex % 5  == 3 && item.columnIndex == 15) {return 'ws-normal'} else if (item.rowIndex % 5  == 2) {for(var i = 0; i < dddd.titleList.length; i ++) {var curCell = dddd.titleList[i]if (item.columnIndex == 15 + i && item.row[curCell] < 0) {return 'warning-row'}}}return ''
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/49503.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

HarmonyOS应用开发者高级认证,Next版本发布后最新题库 - 多选题序号4

基础认证题库请移步&#xff1a;HarmonyOS应用开发者基础认证题库 注&#xff1a;有读者反馈&#xff0c;题库的代码块比较多&#xff0c;打开文章时会卡死。所以笔者将题库拆分&#xff0c;单选题20个为一组&#xff0c;多选题10个为一组&#xff0c;题库目录如下&#xff0c;…

大语言模型-RetroMAE-检索预训练模型

一、背景信息&#xff1a; RetroMAE是2022年10月由北邮和华为提出的一种密集检索预训练策略。 RetroMAE主要应用于检索模型的预训练&#xff0c;模型架构为非对称的Encoder-Decode结构。 二、整体结构&#xff1a; RetroMAE的模型架构为非对称的Encoder-Decode结构。 Encod…

C++学习笔记-operator关键字:重载与自定义操作符

在C编程中&#xff0c;operator关键字扮演着极其重要且独特的角色。它允许开发者为内置类型或自定义类型重载或定义新的操作符行为。这一特性极大地增强了C的表达能力&#xff0c;使得代码更加直观、易于理解和维护。本文将深入探讨C中operator关键字的使用&#xff0c;包括操作…

Interesting bug caused by getattr

题意&#xff1a;由 getattr 引起的有趣的 bug 问题背景&#xff1a; I try to train 8 CNN models with the same structures simultaneously. After training a model on a batch, I need to synchronize the weights of the feature extraction layers in other 7 models. …

Elasticsearch:Golang ECS 日志记录 - zap

ECS 记录器是你最喜欢的日志库的格式化程序/编码器插件。它们可让你轻松地将日志格式化为与 ECS 兼容的 JSON。 编码器以 JSON 格式记录日志&#xff0c;并在可能的情况下依赖默认的 zapcore/json_encoder。它还处理 ECS 错误格式的错误字段记录。 默认情况下&#xff0c;会添…

OpenWrt 为软件包和docker空间扩容

参考资料 【openwrt折腾日记】解决openwrt固件刷入后磁盘空间默认小的问题&#xff0c;关联openwrt磁盘扩容空间扩容【openwrt分区扩容】轻松解决空间可用不足的尴尬丨老李一瓶奶油的YouTube 划分空间 参考一瓶奶油的YouTube 系统 -> 磁盘管理 -> 磁盘 -> 修改 格…

【机器学习】不同操作系统下如何安装Jupyter Notebook和Anaconda

引言 Jupyter Notebook 是一个非常流行的开源Web应用程序&#xff0c;允许你创建和共享包含代码、方程、可视化和解释性文本的文档 文章目录 引言一、如何安装Jupyter Notebook1.1 对于Windows用户1.2 对于macOS用户1.3 对于Linux用户&#xff1a; 二、如何安装Anaconda2.1 对于…

Vue中filter的使用

在 Vue.js 中&#xff0c;filter() 方法用于创建一个新数组&#xff0c;其中包含通过所提供函数实现的测试的所有元素。filter() 不会改变原数组&#xff0c;而是返回一个新的数组。 语法 array.filter(callback(element[, index[, array]])[, thisArg])callback&#xff1a;…

基于Element UI内置的Select下拉和Tree树形组件,组合封装的树状下拉选择器

目录 简述 效果 功能描述 代码实现 总结 简述 基于Element UI内置的Select下拉和Tree树形组件&#xff0c;组合封装的树状下拉选择器。 效果 先看效果&#xff1a; 下拉状态&#xff1a; 选择后状态&#xff1a; 选择的数据&#xff1a; 功能描述 1、加载树结构&…

Linux云计算 |【第一阶段】SERVICES-DAY2

主要内容&#xff1a; DNS服务基础及搭建、特殊解析(针对地址库文件&#xff1a;DNS轮询 DNS泛域名解析 DNS别名&#xff09;、缓存DNS&#xff08;全局转发forwarders&#xff09;、DNS递归迭代&#xff08;子域授权&#xff09;、DNS主从架构搭建、DNS主从数据同步 一、DNS工…

【技术升级】Docker环境下Nacos平滑升级攻略,安全配置一步到位

目前项目当中使用的Nacos版本为2.0.2&#xff0c;该版本可能存在一定的安全风险。软件的安全性是一个持续关注的问题&#xff0c;尤其是对于像Nacos这样的服务发现与配置管理平台&#xff0c;它在微服务架构中扮演着核心角色。随着新版本的发布&#xff0c;开发团队会修复已知的…

光伏模拟器应用

太阳能光伏 (PV) 模拟器是一种可编程电源&#xff0c;用于模拟太阳能电池板。模拟器具有快速瞬态响应&#xff0c;可响应负载条件的变化并保持电压-电流特性的输出。 用户可以根据系统规格定义太阳能电池板配置&#xff0c;并通过选择环境条件来选择适当的环境条件进行模拟。用…

安全产品在防御勒索病毒中的作用

在数字时代&#xff0c;网络安全威胁日益严峻&#xff0c;其中勒索病毒尤为猖獗&#xff0c;它通过加密受害者的数据并要求赎金换取解密密钥&#xff0c;给个人和企业带来了巨大的经济损失。然而&#xff0c;关于安全产品是否真正有效的问题一直存在争议。本文将通过一个模拟实…

pytest+allure

安装 下载&#xff1a;github win环境下载zip 环境变量&#xff1a; pycharm&#xff1a; pip install allure-pytest 验证安装 生成结果&#xff1a; if __name__ __main__:pytest.main([-s,test_createTag2.py,--alluredir,result]) 生成报告&#xff1a; allure gener…

如何查看Kafka的偏移量offset

本文介绍三种方法查看Kafka的偏移量offset。 1. API&#xff1a;ConsumerRecord的offset()方法查看offset。 2. API&#xff1a;KafkaConsumer的position(TopicPartition partition)方法查看offset。 3. 命令行&#xff1a;kafka-consumer-groups.sh命令查看offset。 前提条…

pglogical扩展的基本用法介绍

瀚高数据库 目录 环境 文档用途 详细信息 环境 系统平台&#xff1a;Linux x86-64 Red Hat Enterprise Linux 7 版本&#xff1a;14 文档用途 本文翻译了pglogical扩展的官方文档,介绍了pglogical扩展的各类管理函数及使用限制,详情请看下文. 一、节点管理 节点可以使用以下…

前置-Linux相关知识速记

linux Linux命令大全 [!IMPORTANT] chown-chmod-ls-chgrp-cdpwd-mkdir-rmdir-cp-rm-mv-cat-tac-nl-more-less-head-tail 应用领域 通常服务器使用 LAMP&#xff08;Linux Apache MySQL PHP&#xff09;或 LNMP&#xff08;Linux Nginx MySQL PHP&#xff09;组合。 目前…

STM32 BootLoader 刷新项目 (五) 获取软件版本号-命令0x51

STM32 BootLoader 刷新项目 (五) 获取软件版本号-命令0x51 下面我们来讲解第一个指令&#xff0c;获取软件版本号命令-0x51. 在BootLoader中获取软件版本号的操作有多个重要的作用&#xff0c;具体如下&#xff1a; 版本管理&#xff1a; 识别当前版本&#xff1a;通过获取软…

无人机上磁航技术详解

磁航技术&#xff0c;也被称为地磁导航&#xff0c;是一种利用地球磁场信息来实现导航的技术。在无人机领域&#xff0c;磁航技术主要用于辅助惯性导航系统&#xff08;INS&#xff09;进行航向角的测量与校正&#xff0c;提高无人机的飞行稳定性和准确性。其技术原理是&#x…

vue3 + antd vue 纯前端 基于xlsx 实现导入excel 转 json,将json数据转换XLSX导出(模版下载)

一、导入 0、关键代码 // 安装插件 npm i xlsx/yarn add xlsx // 导入xlsx import * as XLSX from xlsx; 点击提交的时候才整理数据。上传的时候文件保存在 state.form.file[0] 中的 // 定义字段映射关系 const fieldMap {sheet2json: {技能名称: skill_name,技能等级: …