工艺管理
修复“重置导致选中丢失” 修复“新增保存后不会停留在新方案” 修复“搜索后左右不同步” 生产计划 定位生产计划页 plan.vue 的查询参数、日期范围、完成按钮与方案下拉逻辑 修复日期范围筛选:前端按后端约定写入 queryParams.params.beginTime/endTime 修复“不显示生产完成”筛选:前后端新增 excludeDone 过滤并落到 SQL 条件 修复完成计划幂等:后端避免重复插入实绩;前端对已完成禁用按钮 生产绩效 修复“明细信息显示旧数据” 修复“点击表格行只看明细但不能直接修改/删除 修复“时间字段时分秒丢失” 修复“补录/修改表单无校验”
This commit is contained in:
@@ -126,18 +126,18 @@ public class MillProductionActual extends BaseEntity
|
||||
private String customer;
|
||||
|
||||
/** 上线时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "上线时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "上线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date onlineTime;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
/** 机组号 */
|
||||
|
||||
@@ -27,6 +27,14 @@ public interface MillProductionActualMapper
|
||||
*/
|
||||
public List<MillProductionActual> selectMillProductionActualList(MillProductionActual millProductionActual);
|
||||
|
||||
/**
|
||||
* 查询某计划是否已生成实绩
|
||||
*
|
||||
* @param planId 计划ID
|
||||
* @return 数量
|
||||
*/
|
||||
public int countByPlanId(Long planId);
|
||||
|
||||
/**
|
||||
* 新增轧线生产实绩
|
||||
*
|
||||
|
||||
@@ -96,28 +96,32 @@ public class MillProductionPlanServiceImpl implements IMillProductionPlanService
|
||||
throw new RuntimeException("计划不存在: " + planId);
|
||||
}
|
||||
|
||||
// 2. 更新计划状态为完成(2)
|
||||
plan.setProdStatus("Done");
|
||||
plan.setUpdateBy(SecurityUtils.getUsername());
|
||||
int updateResult = planMapper.update(plan);
|
||||
if (updateResult <= 0) {
|
||||
throw new RuntimeException("更新计划状态失败");
|
||||
// 2. 更新计划状态为完成(幂等)
|
||||
if (!"Done".equals(plan.getProdStatus())) {
|
||||
plan.setProdStatus("Done");
|
||||
plan.setUpdateBy(SecurityUtils.getUsername());
|
||||
int updateResult = planMapper.update(plan);
|
||||
if (updateResult <= 0) {
|
||||
throw new RuntimeException("更新计划状态失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 创建生产实绩记录
|
||||
MillProductionActual actual = new MillProductionActual();
|
||||
actual.setPlanId(plan.getPlanId());
|
||||
actual.setPlanNo(plan.getPlanNo());
|
||||
actual.setEntryMatId(plan.getInMatNo()); // 来料卷号 = 生产计划钢卷号
|
||||
actual.setSteelGrade(plan.getAlloyNo()); // 钢种
|
||||
actual.setStatus("已完成"); // 实绩状态:已完成
|
||||
actual.setEndTime(new Date()); // 结束时间
|
||||
actual.setCreateBy(SecurityUtils.getUsername());
|
||||
actual.setDelFlag("0"); // 正常状态
|
||||
// 3. 创建生产实绩记录(幂等)
|
||||
if (actualMapper.countByPlanId(planId) <= 0) {
|
||||
MillProductionActual actual = new MillProductionActual();
|
||||
actual.setPlanId(plan.getPlanId());
|
||||
actual.setPlanNo(plan.getPlanNo());
|
||||
actual.setEntryMatId(plan.getInMatNo());
|
||||
actual.setSteelGrade(plan.getAlloyNo());
|
||||
actual.setStatus("已完成");
|
||||
actual.setEndTime(new Date());
|
||||
actual.setCreateBy(SecurityUtils.getUsername());
|
||||
actual.setDelFlag("0");
|
||||
|
||||
int actualResult = actualMapper.insertMillProductionActual(actual);
|
||||
if (actualResult <= 0) {
|
||||
throw new RuntimeException("创建生产实绩记录失败");
|
||||
int actualResult = actualMapper.insertMillProductionActual(actual);
|
||||
if (actualResult <= 0) {
|
||||
throw new RuntimeException("创建生产实绩记录失败");
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -101,6 +101,10 @@
|
||||
where actual_id = #{actualId}
|
||||
</select>
|
||||
|
||||
<select id="countByPlanId" parameterType="Long" resultType="int">
|
||||
select count(1) from mill_production_actual where plan_id = #{planId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertMillProductionActual" parameterType="MillProductionActual" useGeneratedKeys="true" keyProperty="actualId">
|
||||
insert into mill_production_actual
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
<if test="planStatus != null and planStatus != ''">
|
||||
AND plan_status = #{planStatus}
|
||||
</if>
|
||||
<if test="params != null and (params.excludeDone == true or params.excludeDone == 'true')">
|
||||
AND prod_status != 'Done'
|
||||
</if>
|
||||
<if test="params != null and params.beginTime != null and params.beginTime != ''">
|
||||
AND DATE(create_time) >= #{params.beginTime}
|
||||
</if>
|
||||
|
||||
@@ -89,9 +89,9 @@
|
||||
}
|
||||
|
||||
.el-menu-item.is-active {
|
||||
background-color: #1d4e89 !important;
|
||||
background-color: rgba(93, 173, 226, 0.24) !important;
|
||||
color: #ffffff !important;
|
||||
border-left: 3px solid #5dade2;
|
||||
border-left: 3px solid #85c1e9;
|
||||
}
|
||||
|
||||
& .nest-menu .el-submenu>.el-submenu__title,
|
||||
|
||||
@@ -74,8 +74,10 @@ export default {
|
||||
& .sidebar-logo-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
& .sidebar-logo {
|
||||
@@ -87,19 +89,20 @@ export default {
|
||||
}
|
||||
|
||||
& .sidebar-title {
|
||||
display: inline-block;
|
||||
display: block;
|
||||
margin: 0;
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
line-height: 56px;
|
||||
font-size: 15px;
|
||||
line-height: 18px;
|
||||
font-size: 13px;
|
||||
font-family: Avenir, Helvetica Neue, Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
vertical-align: middle;
|
||||
letter-spacing: 0.5px;
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.2px;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 140px;
|
||||
max-height: 36px;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,328 +1,329 @@
|
||||
<template>
|
||||
<div id="tags-view-container" class="tags-view-container">
|
||||
<scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll">
|
||||
<router-link
|
||||
v-for="tag in visitedViews"
|
||||
ref="tag"
|
||||
:key="tag.path"
|
||||
:class="isActive(tag)?'active':''"
|
||||
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
|
||||
tag="span"
|
||||
class="tags-view-item"
|
||||
:style="activeStyle(tag)"
|
||||
@click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''"
|
||||
@contextmenu.prevent.native="openMenu(tag,$event)"
|
||||
>
|
||||
{{ tag.title }}
|
||||
<span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
|
||||
</router-link>
|
||||
</scroll-pane>
|
||||
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
|
||||
<li @click="refreshSelectedTag(selectedTag)"><i class="el-icon-refresh-right"></i> 刷新页面</li>
|
||||
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><i class="el-icon-close"></i> 关闭当前</li>
|
||||
<li @click="closeOthersTags"><i class="el-icon-circle-close"></i> 关闭其他</li>
|
||||
<li v-if="!isFirstView()" @click="closeLeftTags"><i class="el-icon-back"></i> 关闭左侧</li>
|
||||
<li v-if="!isLastView()" @click="closeRightTags"><i class="el-icon-right"></i> 关闭右侧</li>
|
||||
<li @click="closeAllTags(selectedTag)"><i class="el-icon-circle-close"></i> 全部关闭</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ScrollPane from './ScrollPane'
|
||||
import path from 'path'
|
||||
|
||||
export default {
|
||||
components: { ScrollPane },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
top: 0,
|
||||
left: 0,
|
||||
selectedTag: {},
|
||||
affixTags: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visitedViews() {
|
||||
return this.$store.state.tagsView.visitedViews
|
||||
},
|
||||
routes() {
|
||||
return this.$store.state.permission.routes
|
||||
},
|
||||
theme() {
|
||||
return this.$store.state.settings.theme;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
this.addTags()
|
||||
this.moveToCurrentTag()
|
||||
},
|
||||
visible(value) {
|
||||
if (value) {
|
||||
document.body.addEventListener('click', this.closeMenu)
|
||||
} else {
|
||||
document.body.removeEventListener('click', this.closeMenu)
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initTags()
|
||||
this.addTags()
|
||||
},
|
||||
methods: {
|
||||
isActive(route) {
|
||||
return route.path === this.$route.path
|
||||
},
|
||||
activeStyle(tag) {
|
||||
if (!this.isActive(tag)) return {};
|
||||
return {
|
||||
"background-color": this.theme,
|
||||
"border-color": this.theme
|
||||
};
|
||||
},
|
||||
isAffix(tag) {
|
||||
return tag.meta && tag.meta.affix
|
||||
},
|
||||
isFirstView() {
|
||||
try {
|
||||
return this.selectedTag.fullPath === '/index' || this.selectedTag.fullPath === this.visitedViews[1].fullPath
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
isLastView() {
|
||||
try {
|
||||
return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
filterAffixTags(routes, basePath = '/') {
|
||||
let tags = []
|
||||
routes.forEach(route => {
|
||||
if (route.meta && route.meta.affix) {
|
||||
const tagPath = path.resolve(basePath, route.path)
|
||||
tags.push({
|
||||
fullPath: tagPath,
|
||||
path: tagPath,
|
||||
name: route.name,
|
||||
meta: { ...route.meta }
|
||||
})
|
||||
}
|
||||
if (route.children) {
|
||||
const tempTags = this.filterAffixTags(route.children, route.path)
|
||||
if (tempTags.length >= 1) {
|
||||
tags = [...tags, ...tempTags]
|
||||
}
|
||||
}
|
||||
})
|
||||
return tags
|
||||
},
|
||||
initTags() {
|
||||
const affixTags = this.affixTags = this.filterAffixTags(this.routes)
|
||||
for (const tag of affixTags) {
|
||||
// Must have tag name
|
||||
if (tag.name) {
|
||||
this.$store.dispatch('tagsView/addVisitedView', tag)
|
||||
}
|
||||
}
|
||||
},
|
||||
addTags() {
|
||||
const { name } = this.$route
|
||||
if (name) {
|
||||
this.$store.dispatch('tagsView/addView', this.$route)
|
||||
}
|
||||
},
|
||||
moveToCurrentTag() {
|
||||
const tags = this.$refs.tag
|
||||
this.$nextTick(() => {
|
||||
for (const tag of tags) {
|
||||
if (tag.to.path === this.$route.path) {
|
||||
this.$refs.scrollPane.moveToTarget(tag)
|
||||
// when query is different then update
|
||||
if (tag.to.fullPath !== this.$route.fullPath) {
|
||||
this.$store.dispatch('tagsView/updateVisitedView', this.$route)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
refreshSelectedTag(view) {
|
||||
this.$tab.refreshPage(view);
|
||||
if (this.$route.meta.link) {
|
||||
this.$store.dispatch('tagsView/delIframeView', this.$route)
|
||||
}
|
||||
},
|
||||
closeSelectedTag(view) {
|
||||
this.$tab.closePage(view).then(({ visitedViews }) => {
|
||||
if (this.isActive(view)) {
|
||||
this.toLastView(visitedViews, view)
|
||||
}
|
||||
})
|
||||
},
|
||||
closeRightTags() {
|
||||
this.$tab.closeRightPage(this.selectedTag).then(visitedViews => {
|
||||
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
||||
this.toLastView(visitedViews)
|
||||
}
|
||||
})
|
||||
},
|
||||
closeLeftTags() {
|
||||
this.$tab.closeLeftPage(this.selectedTag).then(visitedViews => {
|
||||
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
||||
this.toLastView(visitedViews)
|
||||
}
|
||||
})
|
||||
},
|
||||
closeOthersTags() {
|
||||
this.$router.push(this.selectedTag.fullPath).catch(()=>{});
|
||||
this.$tab.closeOtherPage(this.selectedTag).then(() => {
|
||||
this.moveToCurrentTag()
|
||||
})
|
||||
},
|
||||
closeAllTags(view) {
|
||||
this.$tab.closeAllPage().then(({ visitedViews }) => {
|
||||
if (this.affixTags.some(tag => tag.path === this.$route.path)) {
|
||||
return
|
||||
}
|
||||
this.toLastView(visitedViews, view)
|
||||
})
|
||||
},
|
||||
toLastView(visitedViews, view) {
|
||||
const latestView = visitedViews.slice(-1)[0]
|
||||
if (latestView) {
|
||||
this.$router.push(latestView.fullPath)
|
||||
} else {
|
||||
// now the default is to redirect to the home page if there is no tags-view,
|
||||
// you can adjust it according to your needs.
|
||||
if (view.name === 'Dashboard') {
|
||||
// to reload home page
|
||||
this.$router.replace({ path: '/redirect' + view.fullPath })
|
||||
} else {
|
||||
this.$router.push('/')
|
||||
}
|
||||
}
|
||||
},
|
||||
openMenu(tag, e) {
|
||||
const menuMinWidth = 105
|
||||
const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
|
||||
const offsetWidth = this.$el.offsetWidth // container width
|
||||
const maxLeft = offsetWidth - menuMinWidth // left boundary
|
||||
const left = e.clientX - offsetLeft + 15 // 15: margin right
|
||||
|
||||
if (left > maxLeft) {
|
||||
this.left = maxLeft
|
||||
} else {
|
||||
this.left = left
|
||||
}
|
||||
|
||||
this.top = e.clientY
|
||||
this.visible = true
|
||||
this.selectedTag = tag
|
||||
},
|
||||
closeMenu() {
|
||||
this.visible = false
|
||||
},
|
||||
handleScroll() {
|
||||
this.closeMenu()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tags-view-container {
|
||||
height: 34px;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #d8dce5;
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
|
||||
.tags-view-wrapper {
|
||||
.tags-view-item {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
border: 1px solid #d8dce5;
|
||||
color: #495060;
|
||||
background: #fff;
|
||||
padding: 0 8px;
|
||||
font-size: 12px;
|
||||
margin-left: 5px;
|
||||
margin-top: 4px;
|
||||
&:first-of-type {
|
||||
margin-left: 15px;
|
||||
}
|
||||
&:last-of-type {
|
||||
margin-right: 15px;
|
||||
}
|
||||
&.active {
|
||||
background-color: #42b983;
|
||||
color: #fff;
|
||||
border-color: #42b983;
|
||||
&::before {
|
||||
content: '';
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.contextmenu {
|
||||
margin: 0;
|
||||
background: #fff;
|
||||
z-index: 3000;
|
||||
position: absolute;
|
||||
list-style-type: none;
|
||||
padding: 5px 0;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #333;
|
||||
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 7px 16px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background: #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
//reset element css of el-icon-close
|
||||
.tags-view-wrapper {
|
||||
.tags-view-item {
|
||||
.el-icon-close {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
vertical-align: 2px;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
transition: all .3s cubic-bezier(.645, .045, .355, 1);
|
||||
transform-origin: 100% 50%;
|
||||
&:before {
|
||||
transform: scale(.6);
|
||||
display: inline-block;
|
||||
vertical-align: -3px;
|
||||
}
|
||||
&:hover {
|
||||
background-color: #b4bccc;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div id="tags-view-container" class="tags-view-container">
|
||||
<scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll">
|
||||
<router-link
|
||||
v-for="tag in visitedViews"
|
||||
ref="tag"
|
||||
:key="tag.path"
|
||||
:class="isActive(tag)?'active':''"
|
||||
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
|
||||
tag="span"
|
||||
class="tags-view-item"
|
||||
:style="activeStyle(tag)"
|
||||
@click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''"
|
||||
@contextmenu.prevent.native="openMenu(tag,$event)"
|
||||
>
|
||||
{{ tag.title }}
|
||||
<span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
|
||||
</router-link>
|
||||
</scroll-pane>
|
||||
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
|
||||
<li @click="refreshSelectedTag(selectedTag)"><i class="el-icon-refresh-right"></i> 刷新页面</li>
|
||||
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><i class="el-icon-close"></i> 关闭当前</li>
|
||||
<li @click="closeOthersTags"><i class="el-icon-circle-close"></i> 关闭其他</li>
|
||||
<li v-if="!isFirstView()" @click="closeLeftTags"><i class="el-icon-back"></i> 关闭左侧</li>
|
||||
<li v-if="!isLastView()" @click="closeRightTags"><i class="el-icon-right"></i> 关闭右侧</li>
|
||||
<li @click="closeAllTags(selectedTag)"><i class="el-icon-circle-close"></i> 全部关闭</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ScrollPane from './ScrollPane'
|
||||
import path from 'path'
|
||||
|
||||
export default {
|
||||
components: { ScrollPane },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
top: 0,
|
||||
left: 0,
|
||||
selectedTag: {},
|
||||
affixTags: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visitedViews() {
|
||||
return this.$store.state.tagsView.visitedViews
|
||||
},
|
||||
routes() {
|
||||
return this.$store.state.permission.routes
|
||||
},
|
||||
theme() {
|
||||
return this.$store.state.settings.theme;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
this.addTags()
|
||||
this.moveToCurrentTag()
|
||||
},
|
||||
visible(value) {
|
||||
if (value) {
|
||||
document.body.addEventListener('click', this.closeMenu)
|
||||
} else {
|
||||
document.body.removeEventListener('click', this.closeMenu)
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initTags()
|
||||
this.addTags()
|
||||
},
|
||||
methods: {
|
||||
isActive(route) {
|
||||
return route.path === this.$route.path
|
||||
},
|
||||
activeStyle(tag) {
|
||||
if (!this.isActive(tag)) return {};
|
||||
return {
|
||||
"background-color": "rgba(93, 173, 226, 0.16)",
|
||||
"border-color": "#85c1e9",
|
||||
"color": "#2f5d84"
|
||||
};
|
||||
},
|
||||
isAffix(tag) {
|
||||
return tag.meta && tag.meta.affix
|
||||
},
|
||||
isFirstView() {
|
||||
try {
|
||||
return this.selectedTag.fullPath === '/index' || this.selectedTag.fullPath === this.visitedViews[1].fullPath
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
isLastView() {
|
||||
try {
|
||||
return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
filterAffixTags(routes, basePath = '/') {
|
||||
let tags = []
|
||||
routes.forEach(route => {
|
||||
if (route.meta && route.meta.affix) {
|
||||
const tagPath = path.resolve(basePath, route.path)
|
||||
tags.push({
|
||||
fullPath: tagPath,
|
||||
path: tagPath,
|
||||
name: route.name,
|
||||
meta: { ...route.meta }
|
||||
})
|
||||
}
|
||||
if (route.children) {
|
||||
const tempTags = this.filterAffixTags(route.children, route.path)
|
||||
if (tempTags.length >= 1) {
|
||||
tags = [...tags, ...tempTags]
|
||||
}
|
||||
}
|
||||
})
|
||||
return tags
|
||||
},
|
||||
initTags() {
|
||||
const affixTags = this.affixTags = this.filterAffixTags(this.routes)
|
||||
for (const tag of affixTags) {
|
||||
// Must have tag name
|
||||
if (tag.name) {
|
||||
this.$store.dispatch('tagsView/addVisitedView', tag)
|
||||
}
|
||||
}
|
||||
},
|
||||
addTags() {
|
||||
const { name } = this.$route
|
||||
if (name) {
|
||||
this.$store.dispatch('tagsView/addView', this.$route)
|
||||
}
|
||||
},
|
||||
moveToCurrentTag() {
|
||||
const tags = this.$refs.tag
|
||||
this.$nextTick(() => {
|
||||
for (const tag of tags) {
|
||||
if (tag.to.path === this.$route.path) {
|
||||
this.$refs.scrollPane.moveToTarget(tag)
|
||||
// when query is different then update
|
||||
if (tag.to.fullPath !== this.$route.fullPath) {
|
||||
this.$store.dispatch('tagsView/updateVisitedView', this.$route)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
refreshSelectedTag(view) {
|
||||
this.$tab.refreshPage(view);
|
||||
if (this.$route.meta.link) {
|
||||
this.$store.dispatch('tagsView/delIframeView', this.$route)
|
||||
}
|
||||
},
|
||||
closeSelectedTag(view) {
|
||||
this.$tab.closePage(view).then(({ visitedViews }) => {
|
||||
if (this.isActive(view)) {
|
||||
this.toLastView(visitedViews, view)
|
||||
}
|
||||
})
|
||||
},
|
||||
closeRightTags() {
|
||||
this.$tab.closeRightPage(this.selectedTag).then(visitedViews => {
|
||||
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
||||
this.toLastView(visitedViews)
|
||||
}
|
||||
})
|
||||
},
|
||||
closeLeftTags() {
|
||||
this.$tab.closeLeftPage(this.selectedTag).then(visitedViews => {
|
||||
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
||||
this.toLastView(visitedViews)
|
||||
}
|
||||
})
|
||||
},
|
||||
closeOthersTags() {
|
||||
this.$router.push(this.selectedTag.fullPath).catch(()=>{});
|
||||
this.$tab.closeOtherPage(this.selectedTag).then(() => {
|
||||
this.moveToCurrentTag()
|
||||
})
|
||||
},
|
||||
closeAllTags(view) {
|
||||
this.$tab.closeAllPage().then(({ visitedViews }) => {
|
||||
if (this.affixTags.some(tag => tag.path === this.$route.path)) {
|
||||
return
|
||||
}
|
||||
this.toLastView(visitedViews, view)
|
||||
})
|
||||
},
|
||||
toLastView(visitedViews, view) {
|
||||
const latestView = visitedViews.slice(-1)[0]
|
||||
if (latestView) {
|
||||
this.$router.push(latestView.fullPath)
|
||||
} else {
|
||||
// now the default is to redirect to the home page if there is no tags-view,
|
||||
// you can adjust it according to your needs.
|
||||
if (view.name === 'Dashboard') {
|
||||
// to reload home page
|
||||
this.$router.replace({ path: '/redirect' + view.fullPath })
|
||||
} else {
|
||||
this.$router.push('/')
|
||||
}
|
||||
}
|
||||
},
|
||||
openMenu(tag, e) {
|
||||
const menuMinWidth = 105
|
||||
const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
|
||||
const offsetWidth = this.$el.offsetWidth // container width
|
||||
const maxLeft = offsetWidth - menuMinWidth // left boundary
|
||||
const left = e.clientX - offsetLeft + 15 // 15: margin right
|
||||
|
||||
if (left > maxLeft) {
|
||||
this.left = maxLeft
|
||||
} else {
|
||||
this.left = left
|
||||
}
|
||||
|
||||
this.top = e.clientY
|
||||
this.visible = true
|
||||
this.selectedTag = tag
|
||||
},
|
||||
closeMenu() {
|
||||
this.visible = false
|
||||
},
|
||||
handleScroll() {
|
||||
this.closeMenu()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tags-view-container {
|
||||
height: 34px;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #d8dce5;
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
|
||||
.tags-view-wrapper {
|
||||
.tags-view-item {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
border: 1px solid #d8dce5;
|
||||
color: #495060;
|
||||
background: #fff;
|
||||
padding: 0 8px;
|
||||
font-size: 12px;
|
||||
margin-left: 5px;
|
||||
margin-top: 4px;
|
||||
&:first-of-type {
|
||||
margin-left: 15px;
|
||||
}
|
||||
&:last-of-type {
|
||||
margin-right: 15px;
|
||||
}
|
||||
&.active {
|
||||
background-color: rgba(93, 173, 226, 0.16);
|
||||
color: #2f5d84;
|
||||
border-color: #85c1e9;
|
||||
&::before {
|
||||
content: '';
|
||||
background: #85c1e9;
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.contextmenu {
|
||||
margin: 0;
|
||||
background: #fff;
|
||||
z-index: 3000;
|
||||
position: absolute;
|
||||
list-style-type: none;
|
||||
padding: 5px 0;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #333;
|
||||
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 7px 16px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background: #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
//reset element css of el-icon-close
|
||||
.tags-view-wrapper {
|
||||
.tags-view-item {
|
||||
.el-icon-close {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
vertical-align: 2px;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
transition: all .3s cubic-bezier(.645, .045, .355, 1);
|
||||
transform-origin: 100% 50%;
|
||||
&:before {
|
||||
transform: scale(.6);
|
||||
display: inline-block;
|
||||
vertical-align: -3px;
|
||||
}
|
||||
&:hover {
|
||||
background-color: #b4bccc;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="actualList" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row>
|
||||
<el-table ref="actualTable" v-loading="loading" :data="actualList" row-key="actualId" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="成品卷号" align="center" prop="exitMatId" />
|
||||
<el-table-column label="来料卷号" align="center" prop="entryMatId" />
|
||||
@@ -108,9 +108,9 @@
|
||||
<el-table-column label="成品厚度" align="center" prop="exitThickness" />
|
||||
<el-table-column label="成品宽度" align="center" prop="exitWidth" />
|
||||
<el-table-column label="实际重量" align="center" prop="actualWeight" />
|
||||
<el-table-column label="上线时间" align="center" prop="onlineTime" width="120">
|
||||
<el-table-column label="上线时间" align="center" prop="onlineTime" width="170">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.onlineTime, '{y}-{m}-{d}') }}</span>
|
||||
<span>{{ parseTime(scope.row.onlineTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="状态" align="center" prop="status" /> -->
|
||||
@@ -476,6 +476,9 @@ export default {
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
exitMatId: [{ required: true, message: '请输入成品卷号', trigger: 'blur' }],
|
||||
entryMatId: [{ required: true, message: '请输入来料卷号', trigger: 'blur' }],
|
||||
planNo: [{ required: true, message: '请输入计划号', trigger: 'blur' }],
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -486,9 +489,17 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listActual(this.queryParams).then(response => {
|
||||
this.actualList = response.rows;
|
||||
this.actualList = response.rows || [];
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.ids = [];
|
||||
this.single = true;
|
||||
this.multiple = true;
|
||||
if (this.$refs.actualTable) this.$refs.actualTable.clearSelection();
|
||||
if (this.currentRow && this.currentRow.actualId != null) {
|
||||
const updated = this.actualList.find(r => r.actualId === this.currentRow.actualId);
|
||||
this.currentRow = updated || null;
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
@@ -549,6 +560,11 @@ export default {
|
||||
},
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.currentRow = null;
|
||||
this.ids = [];
|
||||
this.single = true;
|
||||
this.multiple = true;
|
||||
if (this.$refs.actualTable) this.$refs.actualTable.clearSelection();
|
||||
this.handleQuery();
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
@@ -558,6 +574,10 @@ export default {
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.currentRow = row;
|
||||
if (this.$refs.actualTable) {
|
||||
this.$refs.actualTable.clearSelection();
|
||||
this.$refs.actualTable.toggleRowSelection(row, true);
|
||||
}
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
@@ -600,6 +620,8 @@ export default {
|
||||
this.$modal.confirm('是否确认删除轧线生产实绩编号为"' + actualIds + '"的数据项?').then(function() {
|
||||
return delActual(actualIds);
|
||||
}).then(() => {
|
||||
const deleted = String(actualIds).split(',').map(v => Number(v));
|
||||
if (this.currentRow && deleted.includes(Number(this.currentRow.actualId))) this.currentRow = null;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
<div class="op-btn-group">
|
||||
<el-button size="mini" type="primary" icon="el-icon-plus" @click="handleAdd">钢卷增加</el-button>
|
||||
<el-button size="mini" icon="el-icon-edit" :disabled="!selectedPlan" @click="handleEdit">修改</el-button>
|
||||
<el-button size="mini" icon="el-icon-document" :disabled="!selectedPlan" @click="handleFinish">完成</el-button>
|
||||
<el-button size="mini" icon="el-icon-document" :disabled="!selectedPlan || selectedPlan.prodStatus === 'Done'" @click="handleFinish">完成</el-button>
|
||||
<el-button size="mini" type="danger" icon="el-icon-delete" :disabled="!selectedPlan" @click="handleDelete">删除</el-button>
|
||||
</div>
|
||||
<div class="op-btn-sep"></div>
|
||||
@@ -404,11 +404,24 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
refreshRecipeOptions() {
|
||||
listAllRecipe({}).then(res => { this.recipeOptions = res.data || [] })
|
||||
listAllRecipe({}).then(res => {
|
||||
const all = res.data || []
|
||||
const keepIds = new Set()
|
||||
if (this.selectedPlan && this.selectedPlan.recipeId) keepIds.add(this.selectedPlan.recipeId)
|
||||
if (this.form && this.form.recipeId) keepIds.add(this.form.recipeId)
|
||||
if (this.selectRecipeId) keepIds.add(this.selectRecipeId)
|
||||
|
||||
const visible = all.filter(r => !String(r.recipeNo || '').startsWith('__'))
|
||||
all.forEach(r => {
|
||||
if (keepIds.has(r.recipeId) && !visible.some(x => x.recipeId === r.recipeId)) visible.push(r)
|
||||
})
|
||||
this.recipeOptions = visible
|
||||
})
|
||||
},
|
||||
handleFinish() {
|
||||
const planId = this.selectedPlan.planId
|
||||
const planId = this.selectedPlan && this.selectedPlan.planId
|
||||
if (!planId) return this.$message.warning('请先选择钢卷')
|
||||
if (this.selectedPlan.prodStatus === 'Done') return this.$message.info('该计划已完成')
|
||||
finishPlan(planId).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success('完成成功')
|
||||
@@ -419,12 +432,13 @@ export default {
|
||||
})
|
||||
},
|
||||
loadList() {
|
||||
const params = { inMatNo: this.query.inMatNo }
|
||||
if (this.query.hideFinished) params.Idle = 'Idle'
|
||||
const params = { inMatNo: this.query.inMatNo, params: {} }
|
||||
if (this.query.hideFinished) params.params.excludeDone = true
|
||||
if (this.query.dateRange && this.query.dateRange.length === 2) {
|
||||
params.beginTime = this.query.dateRange[0]
|
||||
params.endTime = this.query.dateRange[1]
|
||||
params.params.beginTime = this.query.dateRange[0]
|
||||
params.params.endTime = this.query.dateRange[1]
|
||||
}
|
||||
if (!Object.keys(params.params).length) delete params.params
|
||||
listPlan(params).then(res => { this.planList = res.data || [] })
|
||||
},
|
||||
resetQuery() {
|
||||
|
||||
@@ -175,7 +175,7 @@ const emptyPass = (no) => ({
|
||||
})
|
||||
|
||||
const emptyForm = () => ({
|
||||
id: null, recipeNo: '', alloyNo: '', passCount: 0,
|
||||
recipeId: null, recipeNo: '', alloyNo: '', passCount: 0,
|
||||
inThick: '', outThick: '', outWidth: '', status: '0', remark: ''
|
||||
})
|
||||
|
||||
@@ -200,16 +200,29 @@ export default {
|
||||
mounted() { this.loadList() },
|
||||
methods: {
|
||||
loadList() {
|
||||
listRecipe({ recipeNo: this.searchKey, alloyNo: this.searchKey }).then(res => {
|
||||
this.recipeList = res.rows || []
|
||||
return listRecipe({ recipeNo: this.searchKey, alloyNo: this.searchKey }).then(res => {
|
||||
const list = res.rows || []
|
||||
this.recipeList = list
|
||||
if (this.isNew) return
|
||||
if (this.selectedId != null && !list.some(item => item.recipeId === this.selectedId)) {
|
||||
this.clearSelection()
|
||||
}
|
||||
})
|
||||
},
|
||||
clearSelection() {
|
||||
this.selectedId = null
|
||||
this.isNew = false
|
||||
this.form = emptyForm()
|
||||
this.passList = []
|
||||
if (this.$refs.formRef) this.$refs.formRef.clearValidate()
|
||||
},
|
||||
handleSelect(r) {
|
||||
this.selectedId = r.recipeId
|
||||
this.isNew = false
|
||||
getRecipeDetail(r.recipeId).then(res => {
|
||||
this.form = { ...res.data }
|
||||
this.passList = res.data.passList || []
|
||||
if (this.$refs.formRef) this.$refs.formRef.clearValidate()
|
||||
})
|
||||
},
|
||||
handleAdd() {
|
||||
@@ -217,6 +230,7 @@ export default {
|
||||
this.selectedId = null
|
||||
this.form = emptyForm()
|
||||
this.passList = []
|
||||
if (this.$refs.formRef) this.$refs.formRef.clearValidate()
|
||||
},
|
||||
handleSave() {
|
||||
this.$refs.formRef.validate(valid => {
|
||||
@@ -224,23 +238,27 @@ export default {
|
||||
this.form.passList = this.passList
|
||||
this.form.passCount = this.passList.length
|
||||
const api = this.isNew ? addRecipe : updateRecipe
|
||||
api(this.form).then(() => {
|
||||
api(this.form).then((res) => {
|
||||
this.$message.success('保存成功')
|
||||
this.loadList()
|
||||
const targetId = this.isNew ? res.data : this.form.recipeId
|
||||
this.isNew = false
|
||||
this.loadList().then(() => {
|
||||
if (targetId != null) this.handleSelect({ recipeId: targetId })
|
||||
else this.clearSelection()
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
handleReset() {
|
||||
if (this.isNew) { this.form = emptyForm(); this.passList = [] }
|
||||
else this.handleSelect({ id: this.selectedId })
|
||||
else if (this.selectedId != null) this.handleSelect({ recipeId: this.selectedId })
|
||||
else this.clearSelection()
|
||||
},
|
||||
handleDelete() {
|
||||
this.$confirm('确定删除该方案?', '提示', { type: 'warning' }).then(() => {
|
||||
delRecipe([this.form.recipeId]).then(() => {
|
||||
this.$message.success('删除成功')
|
||||
this.form = emptyForm(); this.passList = []
|
||||
this.selectedId = null; this.isNew = false
|
||||
this.clearSelection()
|
||||
this.loadList()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user