feat(透视表): 添加检查今日透视表是否存在的功能并优化空状态显示
添加checkCoilStatisticsSummaryExist接口检查今日是否已创建同类型透视表 在创建透视表前进行校验并提示用户是否覆盖 优化空状态显示为el-empty组件
This commit is contained in:
@@ -42,3 +42,16 @@ export function delCoilStatisticsSummary(summaryId) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 检查今天是否已经创建过该类型的透视表
|
||||
// 如果已经创建过,返回该透视表的id
|
||||
// 如果没有创建过,返回null
|
||||
export function checkCoilStatisticsSummaryExist(statType) {
|
||||
return request({
|
||||
url: '/wms/coilStatisticsSummary/checkToday',
|
||||
method: 'get',
|
||||
params: {
|
||||
statType
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
<Preview :data="currentRow.statJson" :statType="currentRow.statType" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<div>钢卷生产统计详情</div>
|
||||
<div>
|
||||
<el-empty description="请点击左侧列表查看或创建透视表" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -33,7 +35,9 @@
|
||||
<Preview :data="liveData" :statType="form.statType" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<div>钢卷生产统计详情</div>
|
||||
<div>
|
||||
<el-empty description="未知的透视表" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -41,7 +45,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCoilStatisticsSummary, delCoilStatisticsSummary, addCoilStatisticsSummary, updateCoilStatisticsSummary } from "@/api/wms/coilStatisticsSummary";
|
||||
import { getCoilStatisticsSummary, delCoilStatisticsSummary, addCoilStatisticsSummary, updateCoilStatisticsSummary, checkCoilStatisticsSummaryExist } from "@/api/wms/coilStatisticsSummary";
|
||||
import LeftList from "./components/LeftList.vue";
|
||||
import Preview from "@/views/wms/coil/panels/Perspective/index.vue";
|
||||
|
||||
@@ -136,9 +140,39 @@ export default {
|
||||
};
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd(form) {
|
||||
this.previewOpen = true;
|
||||
async handleAdd(form) {
|
||||
this.form = form;
|
||||
// 先检查今天是否已经创建过该类型的透视表
|
||||
const {data: existingSummary} = await checkCoilStatisticsSummaryExist(form.statType);
|
||||
// 如果已经创建过
|
||||
if (existingSummary) {
|
||||
// 先提示是否继续创建
|
||||
try {
|
||||
await this.$confirm('该类型已存在透视表,是否继续创建?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
});
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
// 如果要继续创建,则提示是否要覆盖已经存在的透视表
|
||||
try {
|
||||
await this.$confirm('是否覆盖已存在的透视表?', '提示', {
|
||||
confirmButtonText: '删除并重新创建',
|
||||
cancelButtonText: '保留已有透视表',
|
||||
type: 'warning'
|
||||
});
|
||||
delCoilStatisticsSummary(existingSummary).then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
this.previewOpen = true;
|
||||
|
||||
if (form.statType == '热轧原料') {
|
||||
this.previewLoading = true;
|
||||
listRawMaterialPerspective().then(response => {
|
||||
|
||||
Reference in New Issue
Block a user