同步学生信息修改
This commit is contained in:
@@ -24,3 +24,10 @@ export function listStudent(query) {
|
|||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 新同步学生信息
|
||||||
|
export function syncStudentInfo() {
|
||||||
|
return request({
|
||||||
|
url: '/syncdata/synchronousStudent',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,18 +7,20 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="年级代码" prop="gradeCode">
|
||||||
|
<el-select v-model="queryParams.gradeCode" filterable clearable placeholder="请选择年级代码">
|
||||||
|
<el-option v-for="item in grade_list" :key="item.gradeCode" :label="item.gradeCode"
|
||||||
|
:value="item.gradeCode" size="mini" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button v-hasPermi="['system:middle:add']" type="primary" plain icon="el-icon-plus" size="mini"
|
||||||
|
@click="handleSync">同步数据</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button v-hasPermi="['system:middle:export']" type="warning" plain icon="el-icon-download"
|
|
||||||
size="mini" @click="handleExport">导出</el-button>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button v-hasPermi="['system:middle:add']" type="primary" plain icon="el-icon-plus" size="mini"
|
|
||||||
@click="handleSync">同步数据</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@@ -39,7 +41,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listStudent} from '@/api/stuCQS/synchronous-data/sync-stu'
|
import { listStudent, syncStudentInfo } from '@/api/stuCQS/synchronous-data/sync-stu'
|
||||||
|
import { listGrade } from '@/api/stuCQS/basedata/grade'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Middle',
|
name: 'Middle',
|
||||||
@@ -75,24 +78,33 @@ export default {
|
|||||||
xf: null,
|
xf: null,
|
||||||
jd: null,
|
jd: null,
|
||||||
cj: null,
|
cj: null,
|
||||||
fzlx: null
|
fzlx: null,
|
||||||
|
gradeCode: null
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
}
|
},
|
||||||
|
grade_list: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList()
|
this.getList()
|
||||||
|
this.listGrade();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async listGrade() {
|
||||||
|
let res = await listGrade()
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.grade_list = [...res.rows]
|
||||||
|
}
|
||||||
|
},
|
||||||
/** 查询【请填写功能名称】列表 */
|
/** 查询【请填写功能名称】列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
listStudent(this.queryParams).then(response => {
|
listStudent(this.queryParams).then(response => {
|
||||||
this.middleList =response.data
|
this.middleList = response.data
|
||||||
console.log(response)
|
console.log(response)
|
||||||
this.total = response.total
|
this.total = response.total
|
||||||
this.loading = false
|
this.loading = false
|
||||||
@@ -136,10 +148,28 @@ export default {
|
|||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `middle_${new Date().getTime()}.xlsx`)
|
}, `middle_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
handleSync() {
|
async handleSync() {
|
||||||
syncStuinfo().then(res => {
|
if (this.queryParams.gradeCode == null || this.queryParams.gradeCode == "") {
|
||||||
this.$modal.msgSuccess(res.msg)
|
this.$modal.msgError('请选择年级代码')
|
||||||
})
|
return
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
try {
|
||||||
|
this.$modal.msgSuccess('正在同步')
|
||||||
|
const res = await syncStudentInfo(this.queryParams)
|
||||||
|
// 增加接口返回值校验,避免res.msg不存在导致的二次报错
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.$modal.msgSuccess('同步完成')
|
||||||
|
}
|
||||||
|
//this.getList() // 仅接口正常返回时刷新列表
|
||||||
|
} catch (error) {
|
||||||
|
// 捕获接口报错,提示用户并打印错误日志(便于排查)
|
||||||
|
this.$modal.msgError('同步失败:' + (error.message || '网络异常'))
|
||||||
|
//console.error('同步数据报错:', error)
|
||||||
|
} finally {
|
||||||
|
// 无论成功/失败,最终都会执行这里,重置加载状态
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,8 +150,6 @@ export default {
|
|||||||
// 增加接口返回值校验,避免res.msg不存在导致的二次报错
|
// 增加接口返回值校验,避免res.msg不存在导致的二次报错
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.$modal.msgSuccess('同步完成')
|
this.$modal.msgSuccess('同步完成')
|
||||||
} else {
|
|
||||||
this.$modal.msgError('同步失败')
|
|
||||||
}
|
}
|
||||||
//this.getList() // 仅接口正常返回时刷新列表
|
//this.getList() // 仅接口正常返回时刷新列表
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
@click="handleSync">同步数据</el-button>
|
@click="handleSync">同步数据</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table v-loading="loading" :data="middleList">
|
<el-table v-loading="loading" :data="middleList">
|
||||||
<el-table-column label="职工号" align="center" prop="zgh" />
|
<el-table-column label="职工号" align="center" prop="zgh" />
|
||||||
@@ -117,8 +117,6 @@ export default {
|
|||||||
// 增加接口返回值校验,避免res.msg不存在导致的二次报错
|
// 增加接口返回值校验,避免res.msg不存在导致的二次报错
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.$modal.msgSuccess('同步完成')
|
this.$modal.msgSuccess('同步完成')
|
||||||
} else {
|
|
||||||
this.$modal.msgError('同步失败')
|
|
||||||
}
|
}
|
||||||
//this.getList() // 仅接口正常返回时刷新列表
|
//this.getList() // 仅接口正常返回时刷新列表
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -103,8 +103,6 @@ export default {
|
|||||||
// 增加接口返回值校验,避免res.msg不存在导致的二次报错
|
// 增加接口返回值校验,避免res.msg不存在导致的二次报错
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.$modal.msgSuccess('同步完成')
|
this.$modal.msgSuccess('同步完成')
|
||||||
} else {
|
|
||||||
this.$modal.msgError('同步失败')
|
|
||||||
}
|
}
|
||||||
//this.getList() // 仅接口正常返回时刷新列表
|
//this.getList() // 仅接口正常返回时刷新列表
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user