This commit is contained in:
=
2025-11-17 08:59:19 +08:00
36 changed files with 573 additions and 126 deletions
@@ -2,9 +2,9 @@ const jcdt = {
template: /*language=HTML*/ `
<div class="jcdt-wrapper">
<div class="jcdt-container">
<div class="jcdt-title">
<span>基层动态</span>
</div>
<!-- <div class="jcdt-title">-->
<!-- <span>基层动态</span>-->
<!-- </div> -->
<div class="jcdt-content">
<div class="jcdt-list">
<div class="jcdt-item" v-for="item in list" :key="item.title" @click="onLink(item)">
@@ -48,6 +48,12 @@ const jcdt = {
width: 80%;
max-width: 80%;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 12px;
padding: 20px;
margin-bottom: 10px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}
.jcdt-title{
@@ -97,6 +103,8 @@ const jcdt = {
transition: all 0.3s ease;
cursor: pointer;
height: auto;
border-radius: 12px;
}
.jcdt-item:hover{
@@ -133,67 +133,6 @@ const user = {
};
},
methods: {
getWeatherEmoji(iconCode) {
// 在 data 或 methods 外部定义(或作为 computed
const WEATHER_ICON_EMOJI = {
'100': '☀️', // 晴
'101': '⛅', // 多云
'102': '🌤️', // 少云
'103': '🌥️', // 晴间多云
'104': '☁️', // 阴
'300': '🌦️', // 阵雨
'301': '🌧️', // 强阵雨
'302': '⛈️', // 雷阵雨
'303': '⛈️', // 强雷阵雨
'304': '⛈️', // 雷阵雨伴有冰雹
'305': '🌧️', // 小雨
'306': '🌧️', // 中雨
'307': '暴雨', // 暴雨及以上可用文字
'308': '🌧️',
'309': '🌧️',
'310': '🌧️',
'311': '🌨️', // 雨夹雪
'312': '🌨️',
'313': '🌨️',
'314': '🌨️',
'315': '🌨️',
'316': '🌨️',
'317': '🌨️',
'318': '🌨️',
'399': '🌧️', // 阵雨(其他)
'400': '🌨️', // 小雪
'401': '🌨️', // 中雪
'402': '❄️', // 大雪
'403': '❄️', // 暴雪
'404': '🌫️', // 雾
'405': '🌫️', // 冻雾
'406': '🌫️', // 强浓雾
'407': '🌫️', // 霾
'408': '🌫️', // 浮尘
'409': '🌫️', // 扬沙
'410': '🌫️', // 沙尘暴
'499': '🌫️',
'500': '🌪️', // 龙卷风
'501': '🌀', // 飓风
'502': '🌫️', // 热带风暴
'503': '🌫️', // 热带低压
'504': '🌫️', // 台风
'507': '🌫️', // 雾凇
'508': '🌫️', // 冰粒
'509': '🌫️', // 米雪
'510': '🌫️', // 雨凇
'511': '🌫️', // 冰雹
'512': '🌫️', // 尘卷风
'513': '🌫️', // 沙尘
'514': '🌫️', // 浓积云
'515': '🌫️', // 积雨云
'900': '❓', // 未知
'901': '🌫️', // 热
'902': '❄️', // 冷
'999': '❓'
};
return WEATHER_ICON_EMOJI[iconCode] || '🌤️';
},
getWeatherInfo(iconCode, temp) {
const info = {
emoji: '🌤️',
@@ -250,8 +189,8 @@ const user = {
async fetchWeather() {
try {
// 存localStorage 112.13,32.01 广州 113.27,23.14
const AppMapCenterPointX = '113.27'
const AppMapCenterPointY = '23.14'
const AppMapCenterPointX = await this.getConfigKey("AppMapCenterPointX")
const AppMapCenterPointY = await this.getConfigKey("AppMapCenterPointY")
// 1. 先通过城市名获取 locationId
this.$axios.get("https://mx5rk62kvj.re.qweatherapi.com/geo/v2/city/lookup?location=" + AppMapCenterPointX + "," + AppMapCenterPointY + "&key=" + this.QWEATHER_KEY).then((geoRes) => {
@@ -331,7 +270,7 @@ const user = {
this.getRoleNames()
},
mounted() {
// this.fetchWeather();
this.fetchWeather()
},
style: /*language=CSS*/ `
.user-wrapper {
@@ -0,0 +1,92 @@
const COMMON_QUERY = {
template: /*language=HTML*/ `
<search @search="doSearch">
<search-item label="姓名/工号">
<el-input placeholder="请输入姓名或工号" clearable v-model="pageForm.searchKeyword"></el-input>
</search-item>
<template v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN, BRANCH_UNION_ADMIN, BRANCH_UNION_CHAIRMAN, BRANCH_UNION_GROUP_LEADER')">
<search-item label="所属工会">
<el-select @change="flushUnits" @clear="flushUnits" clearable filterable
placeholder="请选择所属工会" style="width: 100%;" v-model="pageForm.unionId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in unions"></el-option>
</el-select>
</search-item>
<search-item label="所属单位">
<el-select clearable filterable placeholder="请选择所属单位" style="width: 100%"
v-model="pageForm.unitId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</search-item>
<search-item label="在职状态">
<dict-select v-model="pageForm.userStates" placeholder="请选择在职状态" @change="doSearch"
code="USER_STATE" multiple collapse-tags></dict-select>
</search-item>
<search-item label="教职工类别">
<dict-select v-model="pageForm.personTypes" placeholder="请选择教职工类别" @change="doSearch"
code="USER_PERSON_TYPE" multiple collapse-tags></dict-select>
</search-item>
<search-item label="编制类别">
<dict-select v-model="pageForm.preparedBys" placeholder="请选择编制类别" @change="doSearch"
code="USER_PREPARED_BY_TYPE" multiple collapse-tags></dict-select>
</search-item>
</template>
</search>
`,
store,
mixins: [initTableMixins],
data() {
return{
unions: [],
units: [],
pageForm: {
searchKeyword: '',
unionId: '',
unitId: '',
userStates: [],
personTypes: [],
preparedBys: [],
}
}
},
methods: {
doSearch(){
const pageForm = clone(this.pageForm)
pageForm.userStates = JSON.stringify(this.pageForm.userStates)
pageForm.personTypes = JSON.stringify(this.pageForm.personTypes)
pageForm.preparedBys = JSON.stringify(this.pageForm.preparedBys)
this.$emit('search', pageForm)
},
async initData(){
if (this.$auth.hasRoleOr("SYSADMIN, SCHOOL_UNION_ADMIN, SCHOOL_UNION_MEMBER_ADMIN")) {
this.$businessTool.listUnion(this.pageForm.unionId).then((data) => {
this.unions = data
})
this.$businessTool.listUnit().then((data) => {
this.units = data
})
} else {
this.$businessTool.listUnion(this.$store.state.user.union.id).then((data) => {
this.unions = data
})
this.$businessTool.listUnit(this.$store.state.user.union.id).then((data) => {
this.units = data
})
}
},
async flushUnits(){
this.$set(this.pageForm, "unitId", null)
this.units = []
if (this.pageForm.unionId) {
this.$businessTool.listUnit(this.pageForm.unionId).then((data) => {
this.units = data
})
}
}
},
async created() {
this.initData()
}
}
@@ -81,12 +81,9 @@ const importAndMap = {
<el-option
v-for="field in dbFieldOptions"
:key="field.value"
:label="field.label + '(' + field.value + ')'"
:label="field.label"
:value="field.value"
>
<span style="float: left">{{ field.value }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ field.label }}</span>
</el-option>
></el-option>
</el-select>
</template>
</el-table-column>
@@ -104,7 +101,7 @@ const importAndMap = {
:key="col"
:prop="col"
:label="col"
/>
></el-table-column>
</el-table>
</div>
</div>
@@ -164,7 +161,18 @@ const importAndMap = {
{ value: "arrivalAtSchoolDate", label: "来校时间" },
{ value: "teachingTime", label: "从教年月" },
{ value: "expectedLeaveSchoolDate", label: "预计/最后离校时间" },
]
],
excelToDbFieldMap:{
loginname: ['工号', '员工编号', '职工号', '学号', '账号', 'ID', '编号'],
username: ['姓名', '名字', '全名', '人员姓名'],
sex: ['性别', '男女性别'],
birthday: ['出生日期', '出生年月', '生日', 'DOB'],
mobile: ['电话', '手机号', '联系电话', '手机'],
idCard: ['身份证', '身份证号', '证件号码'],
arrivalAtSchoolDate: ['来校时间', '入职时间', '入职日期', '入职年月'],
}
}
},
computed: {
@@ -219,11 +227,12 @@ const importAndMap = {
this.headers = jsonData[0].filter(h => h)
this.rawData = jsonData.slice(1)
// 初始化字段选择列表(所有字段默认可编辑?或让用户选)
// 初始化字段选择列表
this.headerList = this.headers.map((h, idx) => ({
name: h,
sample: this.rawData[0] ? this.rawData[0][idx] : '',
selected: true // 默认都允许修改,也可以让用户决定
selected: true,
dbField: this.autoMatchDbField(h)
}))
this.$message.success('成功加载 ' + this.rawData.length + ' 条数据,共 ' + this.headers.length + ' 个字段')
@@ -256,6 +265,29 @@ const importAndMap = {
this.fileList = []
},
// 自动匹配数据库字段
autoMatchDbField(excelHeader) {
const cleanHeader = (excelHeader || '').toString().trim();
if (!cleanHeader) return '';
// 遍历所有数据库字段
for (const [dbField, keywords] of Object.entries(this.excelToDbFieldMap)) {
if (keywords.some(keyword => cleanHeader.includes(keyword))) {
return dbField;
}
}
// 如果没匹配上,也可以尝试精确匹配
const exactMatch = this.dbFieldOptions.find(opt =>
opt.label === cleanHeader || opt.value === cleanHeader
);
if (exactMatch) {
return exactMatch.value;
}
return ''; // 未匹配
},
generatePreview() {
try {
this.previewData = this.rawData.slice(0, 5).map(row => {
@@ -297,7 +329,7 @@ const importAndMap = {
try {
this.baseData.fieldConfig = this.headerList
.map(h => ({
fieldCode: h.name,
fieldCode: h.dbField,
fieldName: h.name,
isRequired: h.selected,
sortOrder: this.headers.indexOf(h.name)
@@ -314,7 +346,7 @@ const importAndMap = {
} finally {
this.submitting = false
}
}
},
},
mounted() {
const s = document.createElement("script")
@@ -45,8 +45,12 @@ layout("/layouts/platform.html"){
:prop="column.prop"
:width="column.width"
:sortable="column.sortable"
></el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="200px" fixed="right">
>
<template scope="{row}" v-if="column.prop === 'status'">
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="220px" fixed="right">
<template scope="{row}">
<el-button size="mini" @click="openView(row)" type="primary">查看</el-button>
<el-button size="mini" @click="openEdit(row)" type="primary">编辑</el-button>
@@ -76,8 +80,8 @@ layout("/layouts/platform.html"){
data() {
return{
tableColumns: [
{ prop: "taskName", label: "任务名称", sortable: true },
{ prop: "fileName", label: "导入文件名称", sortable: true },
{ prop: "title", label: "任务名称", sortable: true },
{ prop: "fileName", label: "文件名称", sortable: true },
{ prop: "startTime", label: "开始时间", sortable: true },
{ prop: "endTime", label: "结束时间", sortable: true },
{ prop: "status", label: "当前状态" }
@@ -117,7 +121,7 @@ layout("/layouts/platform.html"){
}
},
created() {
this.pageData()
}
})
</script>
@@ -2,14 +2,25 @@
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<common-query ref="commonQueryRef"></common-query>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool></table-tool>
</el-card>
</guava>
</div>
<script>
new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
formData: {}
tableColumns: []
}
},
methods: {