自动数据更新功能添加拦截

This commit is contained in:
2025-07-17 15:29:14 +08:00
parent d84c6b4f29
commit a6dc0f2ed3
2 changed files with 24 additions and 8 deletions

View File

@@ -45,7 +45,7 @@
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出 </el-button> <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出 </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="handleRecordSync(1)">自动记录同步</el-button> <el-button :disabled="syncLoading" type="primary" icon="el-icon-refresh" size="mini" @click="handleRecordSync(1)">自动记录同步</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" icon="el-icon-warning" size="mini" @click="errorDialogShow = true">异常检测</el-button> <el-button type="danger" icon="el-icon-warning" size="mini" @click="errorDialogShow = true">异常检测</el-button>
@@ -185,7 +185,7 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="resetRecordQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="resetRecordQuery">搜索</el-button>
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="handleRecordSync(2)">自动记录同步</el-button> <el-button :disabled="syncLoading" type="primary" icon="el-icon-refresh" size="mini" @click="handleRecordSync(2)">自动记录同步</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- 数据区域 --> <!-- 数据区域 -->
@@ -265,6 +265,7 @@ export default {
}, },
data() { data() {
return { return {
syncLoading: false,
labelWidth: '100px', labelWidth: '100px',
formLabelWidth: '100px', formLabelWidth: '100px',
// 选中id数组 // 选中id数组
@@ -676,7 +677,8 @@ export default {
}) })
}, },
handleRecordSync(actionType = 1) { handleRecordSync(actionType = 1) {
let partnumber = '' this.syncLoading = true
let _partnumber = this.RecordQueryParams.partnumber
let startTime = this.$dayjs(this.MinStocktakingTime) let startTime = this.$dayjs(this.MinStocktakingTime)
// 1-全部 2-指定零件同步 // 1-全部 2-指定零件同步
let params = { let params = {
@@ -685,7 +687,7 @@ export default {
endTime: this.$dayjs().endOf('month').format('YYYY-MM-DD HH:mm:ss'), endTime: this.$dayjs().endOf('month').format('YYYY-MM-DD HH:mm:ss'),
} }
if (actionType === 2) { if (actionType === 2) {
params.partnumber = this.RecordQueryParams.partnumber params.partnumber = _partnumber
} }
// 执行同步操作 // 执行同步操作
generateWmOneTimeRecord(params).then((res) => { generateWmOneTimeRecord(params).then((res) => {
@@ -693,8 +695,14 @@ export default {
this.msgSuccess('同步成功') this.msgSuccess('同步成功')
this.getRecordList() this.getRecordList()
this.getList() this.getList()
setTimeout(() => {
this.syncLoading = false
}, 2000)
} else { } else {
this.msgError('同步异常') this.msgError('同步异常')
setTimeout(() => {
this.syncLoading = false
}, 2000)
} }
}) })
}, },

View File

@@ -45,7 +45,7 @@
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">库存清单导出</el-button> <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">库存清单导出</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="handleRecordSync(1)">自动记录同步</el-button> <el-button :disabled="syncLoading" type="primary" icon="el-icon-refresh" size="mini" @click="handleRecordSync(1)">自动记录同步</el-button>
</el-col> </el-col>
<right-toolbar :columns="columns" :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :columns="columns" :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@@ -174,7 +174,7 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="resetRecordQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="resetRecordQuery">搜索</el-button>
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="handleRecordSync(2)">自动记录同步</el-button> <el-button :disabled="syncLoading" type="primary" icon="el-icon-refresh" size="mini" @click="handleRecordSync(2)">自动记录同步</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- 数据区域 --> <!-- 数据区域 -->
@@ -250,6 +250,7 @@ export default {
}, },
data() { data() {
return { return {
syncLoading: false,
labelWidth: '100px', labelWidth: '100px',
formLabelWidth: '100px', formLabelWidth: '100px',
// 选中id数组 // 选中id数组
@@ -672,7 +673,8 @@ export default {
}) })
}, },
handleRecordSync(actionType = 1) { handleRecordSync(actionType = 1) {
let partnumber = '' this.syncLoading = true
let _partnumber = this.RecordQueryParams.partnumber
let startTime = this.$dayjs(this.MinStocktakingTime) let startTime = this.$dayjs(this.MinStocktakingTime)
// 1-全部 2-指定零件同步 // 1-全部 2-指定零件同步
let params = { let params = {
@@ -681,7 +683,7 @@ export default {
endTime: this.$dayjs().endOf('month').format('YYYY-MM-DD HH:mm:ss'), endTime: this.$dayjs().endOf('month').format('YYYY-MM-DD HH:mm:ss'),
} }
if (actionType === 2) { if (actionType === 2) {
params.partnumber = this.RecordQueryParams.partnumber params.partnumber = _partnumber
} }
// 执行同步操作 // 执行同步操作
generateWmPolishRecord(params).then((res) => { generateWmPolishRecord(params).then((res) => {
@@ -689,8 +691,14 @@ export default {
this.msgSuccess('同步成功') this.msgSuccess('同步成功')
this.getRecordList() this.getRecordList()
this.getList() this.getList()
setTimeout(() => {
this.syncLoading = false
}, 2000)
} else { } else {
this.msgError('同步异常') this.msgError('同步异常')
setTimeout(() => {
this.syncLoading = false
}, 2000)
} }
}) })
}, },