This commit is contained in:
helloDy 2024-07-29 15:04:54 +08:00
commit 7ca1f07f56
112 changed files with 8097 additions and 6776 deletions

View File

@ -1,7 +1,7 @@
### ###
# @Author: Do not edit # @Author: Do not edit
# @Date: 2023-08-29 09:40:39 # @Date: 2023-08-29 09:40:39
# @LastEditTime: 2023-11-21 10:36:47 # @LastEditTime: 2024-07-29 15:00:13
# @LastEditors: DY # @LastEditors: DY
# @Description: # @Description:
### ###
@ -14,9 +14,9 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://100.64.0.26:48082' # VUE_APP_BASE_API = 'http://100.64.0.26:48082'
VUE_APP_BASE_API = 'http://192.168.0.33:48082' VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.4.173:48080' # VUE_APP_BASE_API = 'http://192.168.1.164:48082'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080' # VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48082' # VUE_APP_BASE_API = 'http://192.168.1.81:48082'
# VUE_APP_BASE_API = 'http://192.168.1.8:48082' # VUE_APP_BASE_API = 'http://192.168.1.8:48082'
# VUE_APP_BASE_API = 'http://192.168.4.159:48080' # VUE_APP_BASE_API = 'http://192.168.4.159:48080'
# VUE_APP_BASE_API = 'http://192.168.1.56:48082' # VUE_APP_BASE_API = 'http://192.168.1.56:48082'

View File

@ -53,6 +53,7 @@
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"diagram-js": "^12.3.0", "diagram-js": "^12.3.0",
"echarts": "5.4.0", "echarts": "5.4.0",
"el-tree-transfer": "^2.4.7",
"element-ui": "2.15.12", "element-ui": "2.15.12",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"fuse.js": "6.6.2", "fuse.js": "6.6.2",

View File

@ -1,8 +1,8 @@
/* /*
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-10-21 11:50:46 * @Date: 2023-10-21 11:50:46
* @LastEditTime: 2023-11-04 10:42:50 * @LastEditTime: 2024-07-08 14:35:17
* @LastEditors: DY * @LastEditors: zwq
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
@ -61,7 +61,7 @@ export function getCoreProductPage(query) {
// 获得所有列表 // 获得所有列表
export function getCoreProductList(query) { export function getCoreProductList(query) {
return request({ return request({
url: '/base/core-product/listAll', url: '/base/core-product-material/listAll',
method: 'get', method: 'get',
params: query params: query
}) })

View File

@ -51,6 +51,13 @@ export function getCode() {
}) })
} }
// 获得可用的班次列表
export function listClassesEnabled() {
return request({
url: '/base/group-classes/listEnable',
method: 'get'
})
}
// 导出班次基础信息 Excel // 导出班次基础信息 Excel
export function exportGroupClassesExcel(query) { export function exportGroupClassesExcel(query) {
return request({ return request({

View File

@ -0,0 +1,125 @@
import request from '@/utils/request'
// 创建排班计划配置基础信息
export function createGroupPlan(data) {
return request({
url: '/base/group-scheduling-plan/create',
method: 'post',
data: data
})
}
// 更新排班计划配置基础信息
export function updateGroupPlan(data) {
return request({
url: '/base/group-scheduling-plan/update',
method: 'put',
data: data
})
}
// 删除排班计划配置基础信息
export function deleteGroupPlan(id) {
return request({
url: '/base/group-scheduling-plan/delete?id=' + id,
method: 'delete'
})
}
// 获得排班计划配置基础信息
export function getGroupPlan(id) {
return request({
url: '/base/group-scheduling-plan/get?id=' + id,
method: 'get'
})
}
// 获得排班计划配置基础信息分页
export function getGroupPlanPage(query) {
return request({
url: '/base/group-scheduling-plan/page',
method: 'get',
params: query
})
}
// 获得所有排班计划列表
export function groupPlanList() {
return request({
url: '/base/group-scheduling-plan/listAll',
method: 'get'
})
}
// 获得排班计划相关班组列表
export function groupPlanTeamList(id) {
return request({
url: '/base/group-scheduling-plan-team/teamListByPlanId?planId=' + id,
method: 'get'
})
}
// 获得排班计划相关班次列表
export function groupPlanClassesList(id) {
return request({
url: '/base/group-scheduling-plan-classes/classesListByPlanId?planId=' + id,
method: 'get'
})
}
// 获取code
export function getCode() {
return request({
url: '/base/group-scheduling-plan/getCode',
method: 'get'
})
}
// 导出排班计划配置基础信息 Excel
export function exportGroupPlanExcel(query) {
return request({
url: '/base/group-scheduling-plan/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得产线工段树形结构
export function getGroupPlanTree() {
return request({
url: '/base/group-scheduling-plan/getLineSectionTree',
method: 'get'
})
}
// 创建排班计划产线工段
export function createGroupPlanLine(data) {
return request({
url: '/base/group-scheduling-plan-line-section/createPlanLineSection',
method: 'post',
data: data
})
}
// 更新排班计划产线工段
export function updateGroupPlanLine(data) {
return request({
url: '/base/group-scheduling-plan-line-section/updatePlanLineSection',
method: 'put',
data: data
})
}
// 获得排班计划配置基础信息
export function getGroupPlanLine(id) {
return request({
url: '/base/group-scheduling-plan-line-section/getLineSectionByPlanId?planId=' + id,
method: 'get'
})
}
// 获得当前登录用户所在部门id
export function getLoginUserDeptId() {
return request({
url: '/base/group-scheduling-plan-line-section/getLoginUserDeptId',
method: 'get'
})
}

View File

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 创建排班规则基础信息
export function createGroupRule(data) {
return request({
url: '/base/group-scheduling-rule/create',
method: 'post',
data: data
})
}
// 更新排班规则基础信息
export function updateGroupRule(data) {
return request({
url: '/base/group-scheduling-rule/update',
method: 'put',
data: data
})
}
// 删除排班规则基础信息
export function deleteGroupRule(id) {
return request({
url: '/base/group-scheduling-rule/delete?id=' + id,
method: 'delete'
})
}
// 获得排班规则基础信息
export function getGroupRule(id) {
return request({
url: '/base/group-scheduling-rule/get?id=' + id,
method: 'get'
})
}
// 获得排班规则基础信息分页
export function getGroupRulePage(query) {
return request({
url: '/base/group-scheduling-rule/page',
method: 'get',
params: query
})
}
// 导出排班规则基础信息 Excel
export function exportGroupRuleExcel(query) {
return request({
url: '/base/group-scheduling-rule/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -8,7 +8,14 @@ export function getPreset(query) {
params: query params: query
}) })
} }
// 获取某月预排班
export function getScheduling(query) {
return request({
url: '/base/group-team-scheduling/getScheduling',
method: 'get',
params: query
})
}
// 批量创建-更新排班信息 // 批量创建-更新排班信息
export function createOrUpdateList(data) { export function createOrUpdateList(data) {
return request({ return request({

View File

@ -1,8 +1,8 @@
/* /*
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-10-21 11:50:46 * @Date: 2023-10-21 11:50:46
* @LastEditTime: 2023-10-24 11:22:28 * @LastEditTime: 2024-07-05 10:09:18
* @LastEditors: DY * @LastEditors: zwq
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
@ -61,7 +61,7 @@ export function getMaterialPage(query) {
// 获得物料列表 // 获得物料列表
export function getMaterialList(query) { export function getMaterialList(query) {
return request({ return request({
url: '/base/material/listbyfilter', url: '/base/core-product-material/listAll',
method: 'get', method: 'get',
params: query params: query
}) })
@ -119,3 +119,84 @@ export function getMaterialAttr(query) {
params: query params: query
}) })
} }
// 获得物料树结构
export function getMaterialTree() {
return request({
url: '/base/core-product-material-type/listTree',
method: 'get'
})
}
// 创建物料树
export function createMaterialTree(data) {
return request({
url: '/base/core-product-material-type/create',
method: 'post',
data: data
})
}
// 更新物料树
export function updateMaterialTree(data) {
return request({
url: '/base/core-product-material-type/update',
method: 'put',
data: data
})
}
// 删除物料树
export function deleteMaterialTree(id) {
return request({
url: '/base/core-product-material-type/delete?id=' + id,
method: 'delete'
})
}
// 获得产品物料分页
export function getProductMaterialPage(query) {
return request({
url: '/base/core-product-material/page',
method: 'get',
params: query
})
}
// 删除产品物料
export function deleteProductMaterial(id) {
return request({
url: '/base/core-product-material/delete?id=' + id,
method: 'delete'
})
}
// 创建产品物料
export function createProductMaterial(data) {
return request({
url: '/base/core-product-material/create',
method: 'post',
data: data
})
}
// 更新产品物料
export function updateProductMaterial(data) {
return request({
url: '/base/core-product-material/update',
method: 'put',
data: data
})
}
// 获得产品物料
export function getProductMaterial(id) {
return request({
url: '/base/core-product-material/get?id=' + id,
method: 'get'
})
}
// 获得产品物料code
export function getProductMaterialCode() {
return request({
url: '/base/core-product-material/getCode',
method: 'POST'
})
}

View File

@ -70,7 +70,7 @@ export function getMaterialPBList(query) {
// 获得产品列表 // 获得产品列表
export function getProList(query) { export function getProList(query) {
return request({ return request({
url: '/base/core-product/listAll', url: '/base/core-product-material/listAll',
method: 'get', method: 'get',
params: query params: query
}) })

View File

@ -2,7 +2,7 @@ import request from '@/utils/request'
// 获得产品列表 // 获得产品列表
export function getProductAll() { export function getProductAll() {
return request({ return request({
url: '/base/core-product/listAll', url: '/base/core-product-material/listAll',
method: 'get' method: 'get'
}) })
} }

View File

@ -25,3 +25,13 @@ export function exportEqAnalysisExcel(query) {
responseType: 'blob' responseType: 'blob'
}) })
} }
// 导出设备状态追溯
export function exportEfficiencyExcel(query) {
return request({
url: '/analysis/equipment-analysis/export-efficiency',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -1,8 +1,8 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2023-11-07 19:47:48 * @Date: 2023-11-07 19:47:48
* @LastEditTime: 2023-11-23 13:57:41 * @LastEditTime: 2024-07-08 14:33:12
* @LastEditors: zhp * @LastEditors: zwq
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
@ -99,7 +99,7 @@ export function getProcessEquMaterialBomDet(data) {
export function getMaterialList(data) { export function getMaterialList(data) {
return request({ return request({
url: '/base/material/listbyfilter', url: '/base/core-product-material/listAll',
method: 'get', method: 'get',
data: data data: data
}) })

View File

@ -25,7 +25,7 @@ export function getWorkOrderList(query) {
} }
export function getProductList(query) { export function getProductList(query) {
return request({ return request({
url: '/base/core-product/listAll', url: '/base/core-product-material/listAll',
method: 'get', method: 'get',
params: query, params: query,
}) })
@ -38,3 +38,11 @@ export function getInspectionData(query) {
params: query, params: query,
}) })
} }
export function getRecordInOneDay(query) {
return request({
url: '/analysis/record-in-one-day/get',
method: 'get',
params: query,
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -0,0 +1,20 @@
export default {
data() {
return {
tableH: this.tableHeight(260),
};
},
created() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
window.addEventListener('resize', this._setTableHeight);
},
destroyed() {
window.removeEventListener('resize', this._setTableHeight);
},
methods: {
_setTableHeight() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
// this.tableH = this.tableHeight(260);
},
},
};

View File

@ -59,6 +59,33 @@ export default {
type: "warning", type: "warning",
}) })
}, },
// 删除确认窗体UI规范
delConfirm(title) {
return MessageBox.confirm("确定删除后不可恢复该数据", `是否确认删除 【${title}】 数据项?`, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: "warning",
showClose:false
})
},
// 关闭页面确认窗体UI规范
closeConfirm() {
return MessageBox.confirm("确定关闭将不保留编辑内容", "是否确认要关闭页面?", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: "warning",
showClose:false
})
},
// 确认窗体UI规范
newConfirm(content,title) {
return MessageBox.confirm(content, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: "warning",
showClose:false
})
},
// 提交内容 // 提交内容
prompt(content) { prompt(content) {
return MessageBox.prompt(content, "系统提示", { return MessageBox.prompt(content, "系统提示", {

View File

@ -201,3 +201,34 @@ input, textarea{
.el-form--label-top .el-form-item__label { .el-form--label-top .el-form-item__label {
padding: 0; padding: 0;
} }
// 确认弹窗(UI样式修改和原样式有区别--start)
.el-message-box__status+.el-message-box__message {
padding-left: 58px;
}
.el-message-box {
width: auto;
min-width: 424px;
.el-message-box__header {
padding:32px 32px 0px 72px;
.el-message-box__title {
font-size: 16px;
font-weight: 600;
color: rgba(0,0,0,0.85);
}
}
.el-message-box__content {
padding-bottom: 24px;
.el-message-box__status {
top:-72%;
left:20px;
font-size:21px !important
}
}
.el-message-box__btns {
padding-right: 32px;
padding-bottom:14px;
}
}
// 确认弹窗(UI样式修改和原样式有区别--end)

View File

@ -1,44 +1,60 @@
<template> <template>
<div class="choicepart-container"> <div class="choicepart-container">
<navbar /> <navbar />
<div class="choicepart-wrapper"> <div class="choicepart-wrapper">
<div class="choicepart-box" id="choicepartBox" :style="'transform:scale('+scale+');width:1574px;height:538px;'" v-show="showItem"> <div
<div class="choicepart-line1"> class="choicepart-box"
<div id="choicepartBox"
v-for="(item, index) in menuArr1" :style="'transform:scale(' + scale + ');width:1574px;height:538px;'"
:key="index" v-show="showItem">
class="choicepart-item" <div class="choicepart-line1">
@click="handelClick(item, item.choicepart)" <div
:style="{opacity: item.visible?1:0.4, pointerEvents:item.visible?'auto':'none'}" v-for="(item, index) in menuArr1"
> :key="index"
<div> class="choicepart-item"
<img :src="require(`../../assets/images/choicepart/${item.name}.png`)" alt=""> @click="handelClick(item, item.choicepart)"
</div> :style="{
<div class="choicepart-item-title">{{item.meta.title}}</div> opacity: item.visible ? 1 : 0.4,
</div> pointerEvents: item.visible ? 'auto' : 'none',
</div> }">
<div class="choicepart-line2"> <div>
<div <img
v-for="(item, index) in menuArr2" :src="
:key="index" require(`../../assets/images/choicepart/${item.name}.png`)
class="choicepart-item" "
@click="handelClick(item, item.choicepart)" alt="" />
:style="{opacity: item.visible?1:0.4, pointerEvents:item.visible?'auto':'none'}" </div>
> <div class="choicepart-item-title">{{ item.meta.title }}</div>
<div> </div>
<img :src="require(`../../assets/images/choicepart/${item.name}.png`)" alt=""> </div>
</div> <div class="choicepart-line2">
<div class="choicepart-item-title">{{item.meta.title}}</div> <div
</div> v-for="(item, index) in menuArr2"
</div> :key="index"
</div> class="choicepart-item"
</div> @click="handelClick(item, item.choicepart)"
<div class="choicepart-footer">&copy; 中建材智能自动化研究院有限公司</div> :style="{
</div> opacity: item.visible ? 1 : 0.4,
pointerEvents: item.visible ? 'auto' : 'none',
}">
<div>
<img
:src="
require(`../../assets/images/choicepart/${item.name}.png`)
"
alt="" />
</div>
<div class="choicepart-item-title">{{ item.meta.title }}</div>
</div>
</div>
</div>
</div>
<div class="choicepart-footer">&copy; 中建材智能自动化研究院有限公司</div>
</div>
</template> </template>
<script> <script>
import Navbar from './components/Navbar' import Navbar from './components/Navbar';
import { debounce } from '@/utils/debounce' import { debounce } from '@/utils/debounce';
export default { export default {
components: { Navbar }, components: { Navbar },
name: 'choicePart', name: 'choicePart',
@ -57,7 +73,7 @@ export default {
}, },
{ {
name: 'Produce', name: 'Produce',
title: '订单管理', title: '生产管理',
visible: false, visible: false,
meta: { meta: {
title: '' title: ''
@ -242,84 +258,85 @@ export default {
} }
} }
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.choicepart-container { .choicepart-container {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: url('../../assets/images/choicepart/choicepart-back.png') repeat; background: url('../../assets/images/choicepart/choicepart-back.png') repeat;
background-size: 100% 100%; background-size: 100% 100%;
.choicepart-wrapper { .choicepart-wrapper {
width: 100vw; width: 100vw;
height: calc(100vh - 94px); height: calc(100vh - 94px);
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.choicepart-box { .choicepart-box {
// transition: all 0.3s linear; // transition: all 0.3s linear;
.choicepart-line1 { .choicepart-line1 {
width: 100%; width: 100%;
margin-bottom: 80px; margin-bottom: 80px;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
} }
.choicepart-line2 { .choicepart-line2 {
width: 100%; width: 100%;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
justify-content: center; justify-content: center;
} }
.choicepart-item { .choicepart-item {
width: 184px; width: 184px;
height: 224px; height: 224px;
background: url('../../assets/images/choicepart/choice-item-back.png') no-repeat; background: url('../../assets/images/choicepart/choice-item-back.png')
background-size: 100% 100%; no-repeat;
border-radius: 5px; background-size: 100% 100%;
overflow: hidden; border-radius: 5px;
cursor: pointer; overflow: hidden;
position: relative; cursor: pointer;
margin: 0 20px; position: relative;
img { margin: 0 20px;
width: 184px; img {
height: 224px; width: 184px;
} height: 224px;
.choicepart-item-title { }
overflow: hidden; .choicepart-item-title {
padding: 0 10px; overflow: hidden;
text-overflow: ellipsis; padding: 0 10px;
white-space: nowrap; text-overflow: ellipsis;
position: absolute; white-space: nowrap;
bottom: 0; position: absolute;
left: 2px; bottom: 0;
right: 2px; left: 2px;
text-align: center; right: 2px;
color: #fff; text-align: center;
font-size: 16px; color: #fff;
line-height: 40px; font-size: 16px;
height: 40px; line-height: 40px;
letter-spacing: 2px; height: 40px;
background-color: rgba($color: #0b58ff, $alpha: 0.45); letter-spacing: 2px;
} background-color: rgba($color: #0b58ff, $alpha: 0.45);
} }
.choicepart-item:hover { }
.choicepart-item-title { .choicepart-item:hover {
background-color: rgba($color: #0b58ff, $alpha: 1); .choicepart-item-title {
} background-color: rgba($color: #0b58ff, $alpha: 1);
} }
} }
.choicepart-footer { }
position: absolute; .choicepart-footer {
width: 100%; position: absolute;
color: #C7C7C7; width: 100%;
user-select: none; color: #c7c7c7;
font-size: 12px; user-select: none;
letter-spacing: 1px; font-size: 12px;
height: 30px; letter-spacing: 1px;
display: grid; height: 30px;
place-content: center; display: grid;
bottom: 0; place-content: center;
opacity: 0.5; bottom: 0;
} opacity: 0.5;
}
} }
</style> </style>

View File

@ -0,0 +1,215 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel">
<energy-plc-add ref="energyPlc" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyPlcPage, deleteEnergyPlc } from '@/api/base/energyPlc';
// import { publicFormatter } from '@/utils/dict'
import EnergyPlcAdd from './components/energyPlcAdd.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'plcTableName',
label: '关联表名',
},
{
prop: 'code',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: 'name',
label: '标识名',
},
{
prop: 'enName',
label: '英文标识名',
},
{
prop: 'collection',
label: '是否采集',
},
{
prop: 'description',
label: '描述',
showOverflowtooltip: true,
},
];
export default {
name: 'EnergyPlc',
components: { EnergyPlcAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:energy-plc:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
collectionList: [
{ value: 0, label: '否' },
{ value: 1, label: '是' },
],
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.energyPlc.init();
});
}
},
/** 查询列表 */
getList() {
getEnergyPlcPage(this.queryParams).then((response) => {
let arr = response.data.list || [];
arr &&
arr.map((item) => {
this.collectionList.map((i) => {
if (item.collection === i.value) {
item.collection = i.label;
}
});
});
this.list = arr;
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.energyPlc.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.energyPlc.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.energyPlc.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.delConfirm(row.name)
.then(function () {
return deleteEnergyPlc(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -6,37 +6,67 @@
--> -->
<template> <template>
<el-form ref="form" :model="dataForm" label-width="120px" v-loading="formLoading"> <el-form
<el-row :gutter="20"> ref="form"
<el-col :span="12"> :model="dataForm"
<el-form-item label="产线" prop="productionLineId" label-width="110px"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> v-loading="formLoading">
<el-select v-model="dataForm.productionLineId" placeholder="请选择产线" filterable <el-row :gutter="20">
@change="handleProductlineChange"> <el-col :span="12">
<el-option v-for="opt in productionLineList" :key="opt.value" :label="opt.label" :value="opt.value" /> <el-form-item
</el-select> label="产线"
</el-form-item> prop="productionLineId"
</el-col> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-col :span="12"> <el-select
<el-form-item label="工段" prop="sectionId" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> v-model="dataForm.productionLineId"
<el-select v-model="dataForm.sectionId" placeholder="请选择工段" filterable @change="$emit('update', dataForm)"> placeholder="请选择产线"
<el-option v-for="opt in workshopSectionList" :key="opt.value" :label="opt.label" :value="opt.value" /> filterable
</el-select> @change="handleProductlineChange">
</el-form-item> <el-option
</el-col> v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="工段"
prop="sectionId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="dataForm.sectionId"
placeholder="请选择工段"
filterable
@change="$emit('update', dataForm)">
<el-option
v-for="opt in workshopSectionList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="按钮盒识别码" prop="buttonId" :rules="[ <el-form-item
{ required: true, message: '不能为空', trigger: 'blur' }, label="按钮盒识别码"
{ prop="buttonId"
type: 'number', :rules="[
message: '请输入整数', { required: true, message: '不能为空', trigger: 'blur' },
trigger: 'blur', {
transform: (val) => Number.isInteger(Number(val)) && Number(val), type: 'number',
}, message: '请输入整数',
]"> trigger: 'blur',
<el-input v-model="dataForm.buttonId" @change="$emit('update', dataForm)" placeholder="请输入整数" /> transform: (val) => Number.isInteger(Number(val)) && Number(val),
</el-form-item> },
]">
<el-input
v-model="dataForm.buttonId"
@change="$emit('update', dataForm)"
placeholder="请输入整数" />
</el-form-item>
<el-form-item <el-form-item
label="产线" label="产线"
prop="productionLineId" prop="productionLineId"
@ -101,35 +131,50 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="按钮值" prop="keyValue" :rules="[ <el-form-item
{ required: true, message: '不能为空', trigger: 'blur' }, label="按钮值"
{ prop="keyValue"
type: 'number', :rules="[
message: '请输入100以内的整数', { required: true, message: '不能为空', trigger: 'blur' },
trigger: 'blur', {
transform: (val) => type: 'number',
Number.isInteger(+val) && message: '请输入100以内的整数',
Number(val) >= 0 && trigger: 'blur',
Number(val) <= 100 && transform: (val) =>
Number(val), Number.isInteger(+val) &&
}, Number(val) >= 0 &&
]"> Number(val) <= 100 &&
<el-input v-model="dataForm.keyValue" type="number" min="0" max="100" @change="$emit('update', dataForm)" Number(val),
placeholder="请输入按钮盒模式" /> },
</el-form-item> ]">
</el-col> <el-input
v-model="dataForm.keyValue"
type="number"
min="0"
max="100"
@change="$emit('update', dataForm)"
placeholder="请输入按钮盒模式" />
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="检测内容" prop="inspectionDetId"> <el-form-item label="检测内容" prop="inspectionDetId">
<el-select v-model="dataForm.inspectionDetId" placeholder="请选择检测内容" filterable <el-select
@change="$emit('update', dataForm)"> v-model="dataForm.inspectionDetId"
<el-option v-for="opt in inspectionDetList" :key="opt.value" :label="opt.label" :value="opt.value" /> placeholder="请选择检测内容"
</el-select> filterable
</el-form-item> @change="$emit('update', dataForm)">
</el-col> <el-option
</el-row> v-for="opt in inspectionDetList"
</el-form> :key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template> </template>
<script> <script>
@ -150,14 +195,14 @@ export default {
data() { data() {
return { return {
formLoading: true, formLoading: true,
productionLineList: [], productionLineList: [],
inspectionDetList:[], inspectionDetList: [],
workshopSectionList: [], workshopSectionList: [],
}; };
}, },
mounted() { mounted() {
this.getProductionLineList() this.getProductionLineList();
this.getQualityInspectionDetList() this.getQualityInspectionDetList();
// this.getWorksectionList(); // this.getWorksectionList();
// this.getCode('/base/equipment-group-alarm/getCode').then((code) => { // this.getCode('/base/equipment-group-alarm/getCode').then((code) => {
// this.formLoading = false; // this.formLoading = false;
@ -197,20 +242,20 @@ export default {
} }
this.formLoading = false; this.formLoading = false;
}, },
async getQualityInspectionDetList() { async getQualityInspectionDetList() {
this.formLoading = true; this.formLoading = true;
const res = await this.$axios({ const res = await this.$axios({
url: '/base/quality-inspection-det/listAll', url: '/base/quality-inspection-det/listAll',
method: 'get', method: 'get',
}); });
if (res.code == 0) { if (res.code == 0) {
this.inspectionDetList = res.data.map((item) => ({ this.inspectionDetList = res.data.map((item) => ({
label: item.content, label: item.content,
value: item.id, value: item.id,
})); }));
} }
this.formLoading = false; this.formLoading = false;
}, },
async getWorksectionList(id) { async getWorksectionList(id) {
this.formLoading = true; this.formLoading = true;
const res = await this.$axios({ const res = await this.$axios({

View File

@ -12,12 +12,13 @@
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-data="list" :table-data="list"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:width="120" :width="80"
fixed="right" fixed="right"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
@ -56,10 +57,11 @@ import {
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import moment from 'moment'; import moment from 'moment';
import DialogForm from './dialogForm.vue'; import DialogForm from './dialogForm.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default { export default {
name: 'QualityInspectionBoxBtn', name: 'QualityInspectionBoxBtn',
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
components: { DialogForm }, components: { DialogForm },
data() { data() {
return { return {
@ -70,7 +72,9 @@ export default {
label: '产线', label: '产线',
url: '/base/production-line/listAll', url: '/base/production-line/listAll',
prop: 'productionId', prop: 'productionId',
rules: [{ required: true, message: '产线不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '产线不能为空', trigger: 'blur' },
],
bind: { bind: {
filterable: true, filterable: true,
}, },
@ -80,7 +84,9 @@ export default {
label: '工段', label: '工段',
url: '/base/workshop-section/listAll', url: '/base/workshop-section/listAll',
prop: 'sectionId', prop: 'sectionId',
rules: [{ required: true, message: '工段不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '工段不能为空', trigger: 'blur' },
],
bind: { bind: {
filterable: true, filterable: true,
}, },
@ -118,17 +124,17 @@ export default {
}, },
], ],
bind: { type: 'number', min: 0, max: 100 }, bind: { type: 'number', min: 0, max: 100 },
}, },
{ {
select: true, select: true,
label: '检测内容', label: '检测内容',
url: '/base/quality-inspection-det/listAll', url: '/base/quality-inspection-det/listAll',
prop: 'inspectionDetId', prop: 'inspectionDetId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }], rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: { bind: {
filterable: true, filterable: true,
}, },
}, },
], ],
], ],
searchBarFormConfig: [ searchBarFormConfig: [
@ -180,41 +186,42 @@ export default {
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ {
prop: 'productionLineName', prop: 'productionLineName',
label: '产线', label: '产线',
showOverflowtooltip: true,
}, },
{ {
prop: 'sectionName', prop: 'sectionName',
label: '工段', label: '工段',
showOverflowtooltip: true,
}, },
{ {
prop: 'inspectionDetContent', prop: 'inspectionDetContent',
label: '检测内容', label: '检测内容',
showOverflowtooltip: true,
}, },
{ {
width: 160, width: 160,
prop: 'buttonId', prop: 'buttonId',
label: '按钮盒识别码', label: '按钮盒识别码',
}, },
// { {
// width: 256, width: 90,
// prop: 'productionId', prop: 'keyValue',
// label: '线ID', label: '按钮值',
// , showOverflowtooltip: true,
// }, },
// { {
// width: 256, width: 128,
// prop: 'sectionId', prop: 'model',
// label: 'ID', label: '按钮盒模式',
// , showOverflowtooltip: true,
// }, },
{ width: 90, prop: 'keyValue', label: '按钮值' },
{ width: 128, prop: 'model', label: '按钮盒模式' },
], ],
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
inspectionDetContent: null, inspectionDetContent: null,
}, },
// keys, queryParams pageNo, pageSize key // keys, queryParams pageNo, pageSize key
@ -222,8 +229,8 @@ export default {
form: { form: {
id: null, id: null,
buttonId: null, buttonId: null,
inspectionDetId: null, inspectionDetId: null,
productionLineId: null, productionLineId: null,
sectionId: null, sectionId: null,
model: null, model: null,
keyValue: null, keyValue: null,
@ -261,7 +268,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = '添加安灯按钮16键对应'; this.title = '新增';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -270,7 +277,7 @@ export default {
getQualityInspectionBoxBtn(id).then((response) => { getQualityInspectionBoxBtn(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = '修改安灯按钮16键对应'; this.title = '编辑';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -300,7 +307,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除"' + row.sectionName + '"?') .delConfirm(row.buttonId)
.then(function () { .then(function () {
return deleteQualityInspectionBoxBtn(id); return deleteQualityInspectionBoxBtn(id);
}) })

View File

@ -1,53 +1,93 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" /> <SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list" <base-table
@emitFun="handleEmitFun"> :table-props="tableProps"
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn" :page="queryParams.pageNo"
@clickBtn="handleTableBtnClick" /> :limit="queryParams.pageSize"
</base-table> :table-data="list"
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="80"
fixed="right"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination
@pagination="getList" /> v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<base-dialog :dialogTitle="title" :dialogVisible="open" width="40%" @close="cancel" @cancel="cancel" <base-dialog
@confirm="submitForm"> :dialogTitle="title"
<DialogForm v-if="open" ref="form" v-model="form" :rows="[ :dialogVisible="open"
[ width="40%"
{ @close="cancel"
select: true, @cancel="cancel"
label: '检测类型', @confirm="submitForm">
prop: 'typeId', <DialogForm
url: '/base/quality-inspection-type/listAll', v-if="open"
rules: [{ required: true, message: '检测类型不能为空', trigger: 'blur' }], ref="form"
bind: { v-model="form"
filterable: true, :rows="[
}, [
}, {
{ select: true,
input: true, label: '检测类型',
label: '检测内容', prop: 'typeId',
prop: 'content', url: '/base/quality-inspection-type/listAll',
rules: [{ required: true, message: '检测内容不能为空', trigger: 'blur' }], rules: [
}, {
], required: true,
message: '检测类型不能为空',
trigger: 'blur',
},
],
bind: {
filterable: true,
},
},
{
input: true,
label: '检测内容',
prop: 'content',
rules: [
{
required: true,
message: '检测内容不能为空',
trigger: 'blur',
},
],
},
],
[ [
{ {
input: true, input: true,
label: '内容编码', label: '内容编码',
prop: 'code', prop: 'code',
url: '/base/quality-inspection-det/getCode', url: '/base/quality-inspection-det/getCode',
}, },
{ input: true, label: '备注', prop: 'remark' }], { input: true, label: '备注', prop: 'remark' },
]" /> ],
</base-dialog> ]" />
</div> </base-dialog>
</div>
</template> </template>
<script> <script>
@ -63,10 +103,11 @@ import {
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default { export default {
name: 'QualityInspectionDet', name: 'QualityInspectionDet',
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
typeList: [], // typeList: [], //
@ -141,19 +182,18 @@ export default {
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
fixed: true, width: 160,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ prop: 'typeName', label: '类型名称', }, { prop: 'typeName', label: '检测类型', showOverflowtooltip: true },
{ prop: 'content', label: '检测内容', }, { prop: 'content', label: '检测内容', showOverflowtooltip: true },
{ prop: 'code', label: '检测编码', }, { prop: 'code', label: '检测编码', showOverflowtooltip: true },
{ prop: 'remark', label: '备注', }, { prop: 'remark', label: '备注', showOverflowtooltip: true },
], ],
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
content: null, content: null,
createTime: [], createTime: [],
}, },
@ -248,7 +288,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除检测信息"' + row.content + '"?') .delConfirm(row.content)
.then(function () { .then(function () {
return deleteQualityInspectionDet(id); return deleteQualityInspectionDet(id);
}) })

View File

@ -1,52 +1,78 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" /> <SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list" <base-table
@emitFun="handleEmitFun"> :table-props="tableProps"
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" :method-list="tableBtn" :page="queryParams.pageNo"
@clickBtn="handleTableBtnClick" /> :limit="queryParams.pageSize"
</base-table> :table-data="list"
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="80"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination
@pagination="getList" /> v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<base-dialog :dialogTitle="title" :dialogVisible="open" @close="cancel" width="30%" @cancel="cancel" <base-dialog
@confirm="submitForm"> :dialogTitle="title"
<DialogForm v-if="open" ref="form" v-model="form" :rows="[ :dialogVisible="open"
[ @close="cancel"
{ width="40%"
input: true, @cancel="cancel"
label: '检测类型名称', @confirm="submitForm">
prop: 'name', <DialogForm
rules: [ v-if="open"
{ ref="form"
required: true, v-model="form"
message: '检测类型名称不能为空', :rows="[
trigger: 'blur', [
}, {
], input: true,
// bind: { label: '检测类型',
// disabled: true, // some condition, like detail mode... prop: 'name',
// } rules: [
}, {
], required: true,
[ message: '检测类型不能为空',
{ trigger: 'blur',
input: true, },
label: '检测类型编码', ],
prop: 'code', // bind: {
url: '/base/quality-inspection-type/getCode', // disabled: true, // some condition, like detail mode...
}, // }
], },
[{ input: true, label: '备注', prop: 'remark' }], ],
]" /> [
</base-dialog> {
</div> input: true,
label: '检测类型编码',
prop: 'code',
url: '/base/quality-inspection-type/getCode',
},
],
[{ input: true, label: '备注', prop: 'remark' }],
]" />
</base-dialog>
</div>
</template> </template>
<script> <script>
@ -61,10 +87,11 @@ import {
exportQualityInspectionTypeExcel, exportQualityInspectionTypeExcel,
} from '@/api/base/qualityInspectionType'; } from '@/api/base/qualityInspectionType';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default { export default {
name: 'QualityInspectionType', name: 'QualityInspectionType',
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
tableBtn: [ tableBtn: [
@ -85,45 +112,12 @@ export default {
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
fixed: true, width: 160,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ prop: 'name', label: '检测类型名称' }, { prop: 'name', label: '检测类型', showOverflowtooltip: true },
{ prop: 'code', label: '检测类型编码' }, { prop: 'code', label: '类型编码', showOverflowtooltip: true },
{ prop: 'remark', label: '备注' }, { prop: 'remark', label: '备注', showOverflowtooltip: true },
// {
// label: '',
// alignt: 'center',
// subcomponent: {
// render: function (h) {
// return h('div', null, [
// h(
// 'el-button',
// {
// props: {
// icon: 'el-icon-edit',
// size: 'mini',
// type: 'text',
// },
// },
// ' '
// ),
// h(
// 'el-button',
// {
// props: {
// icon: 'el-icon-edit',
// size: 'mini',
// type: 'text',
// },
// },
// ' '
// ),
// ]);
// },
// },
// },
], ],
// //
searchBarFormConfig: [ searchBarFormConfig: [
@ -139,11 +133,6 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
{ {
type: 'separate', type: 'separate',
}, },
@ -162,7 +151,7 @@ export default {
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
name: null, name: null,
}, },
// //
@ -242,7 +231,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = '添加质量检测类型基础'; this.title = '新增';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -251,7 +240,7 @@ export default {
getQualityInspectionType(id).then((response) => { getQualityInspectionType(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = '修改质量检测类型基础'; this.title = '编辑';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -284,7 +273,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除该质量检测类型?') .delConfirm(row.name)
.then(function () { .then(function () {
return deleteQualityInspectionType(id); return deleteQualityInspectionType(id);
}) })

View File

@ -0,0 +1,104 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-20 15:23:59
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="auto">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报废原因编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入报废原因编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报废原因" prop="content">
<el-input v-model="dataForm.content" placeholder="请输入报废原因" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报废类型" prop="typeId">
<el-select v-model="dataForm.typeId" placeholder="请选择报废类型">
<el-option
v-for="dict in typeList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../../core/mixins/basic-add';
import {
createQualityScrapDet,
updateQualityScrapDet,
getQualityScrapDet,
getCode,
} from '@/api/base/qualityScrapDet';
import { getList } from '@/api/base/qualityScrapType';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createQualityScrapDet,
updateURL: updateQualityScrapDet,
infoURL: getQualityScrapDet,
},
typeList: [],
dataForm: {
id: undefined,
code: undefined,
content: undefined,
typeId: null,
remark: undefined,
},
dataRule: {
code: [
{ required: true, message: '报废原因编码不能为空', trigger: 'blur' },
],
content: [
{ required: true, message: '报废原因不能为空', trigger: 'blur' },
],
typeId: [
{ required: true, message: '报废类型不能为空', trigger: 'change' },
],
},
};
},
mounted() {
this.getDict();
},
methods: {
async getDict() {
//
const res = await getList();
this.typeList = res.data;
},
},
};
</script>

View File

@ -0,0 +1,159 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: DY
* @LastEditTime: 2023-09-21 16:02:07
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
getDataListURL: '',
deleteURL: '',
statusUrl: '',
exportURL: ''
},
tableData: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 1,
},
exportLoading: false,
dataListLoading: false,
addOrEditTitle: '',
addOrUpdateVisible: false,
}
},
created() {
},
mounted() {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
cancel(id) {
this.$refs["popover-" + id].showPopper = false;
},
//改变状态
changeStatus(id) {
this.$http
.post(this.urlOptions.statusUrl, { id })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$refs["popover-" + id].showPopper = false;
this.$message({
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.getDataList();
},
});
})
.catch(() => { });
},
//tableBtn点击
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.content)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id,name) {
this.$modal
.delConfirm(name)
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.getDataList();
this.$modal.msgSuccess('删除成功');
});
})
.catch(() => { });
},
//search-bar点击
buttonClick(val) {
switch (val.btnName) {
case "search":
this.listQuery.xm1 = val.xm1;
this.listQuery.xm2 = val.xm2;
this.listQuery.pageNo = 1;
this.getDataList();
break;
case "add":
this.addOrEditTitle = '新增'
this.addOrUpdateVisible = true;
this.addOrUpdateHandle()
break;
default:
console.log(val)
}
},
handleCancel() {
this.$refs.addOrUpdate.formClear()
this.addOrUpdateVisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.addOrUpdate.dataFormSubmit()
},
successSubmit() {
this.handleCancel()
this.getDataList()
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return this.urlOptions.exportURL(params);
}).then(response => {
this.$download.excel(response, '工厂.xls');
this.exportLoading = false;
}).catch(() => { });
}
}
}

View File

@ -9,11 +9,12 @@
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:table-data="tableData"> :table-data="tableData"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="120" :width="80"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
@ -21,7 +22,7 @@
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="total"
@pagination="getDataList" /> @pagination="getDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@ -29,7 +30,7 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width="30%"> width="50%">
<add-or-update <add-or-update
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update> @refreshDataList="successSubmit"></add-or-update>
@ -39,77 +40,84 @@
<script> <script>
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from '../../../core/mixins/basic-page'; import basicPage from './basic-page';
import { parseTime } from '../../../core/mixins/code-filter'; import { parseTime } from '../../../core/mixins/code-filter';
import { import {
getQualityScrapDetPage, getQualityScrapDetPage,
deleteQualityScrapDet, deleteQualityScrapDet,
} from '@/api/base/qualityScrapDet'; } from '@/api/base/qualityScrapDet';
import { getList, } from "@/api/base/qualityScrapType"; import { getList } from '@/api/base/qualityScrapType';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
filter: parseTime filter: parseTime,
}, width: 160,
{ },
prop: 'content', {
label: '报废原因' prop: 'content',
}, label: '报废原因',
showOverflowtooltip: true,
},
{ {
prop: 'code', prop: 'code',
label: '报废原因编码' label: '报废原因编码',
showOverflowtooltip: true,
}, },
{ {
prop: 'typeName', prop: 'typeName',
label: '报废类型' label: '报废类型',
showOverflowtooltip: true,
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注' label: '备注',
showOverflowtooltip: true,
}, },
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
getDataListURL: getQualityScrapDetPage, getDataListURL: getQualityScrapDetPage,
deleteURL: deleteQualityScrapDet, deleteURL: deleteQualityScrapDet,
// exportURL: exportFactoryExcel, // exportURL: exportFactoryExcel,
}, },
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`base:quality-inspection-det:update`) this.$auth.hasPermi(`base:quality-inspection-det:update`)
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi(`base:quality-inspection-det:delete`) this.$auth.hasPermi(`base:quality-inspection-det:delete`)
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
} }
: undefined, : undefined,
].filter((v)=>v), ].filter((v) => v),
tableData: [], tableData: [],
formConfig: [ formConfig: [
{ {
type: 'input', type: 'input',
label: '报废原因', label: '报废原因',
placeholder: '报废原因', placeholder: '报废原因',
param: 'content', param: 'content',
}, },
{ {
type: 'select', type: 'select',
label: '报废类型', label: '报废类型',
selectOptions: [], selectOptions: [],
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
param: 'typeId', param: 'typeId',
}, filterable: true,
},
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -120,53 +128,50 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:quality-scrap-det:create') ? 'button' : '', type: this.$auth.hasPermi('base:quality-scrap-det:create')
? 'button'
: '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true,
}, },
], ],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
}; };
}, },
components: { components: {
AddOrUpdate, AddOrUpdate,
}, },
created() { }, created() {},
mounted () { mounted() {
this.getDict(); this.getDict();
}, },
methods: { methods: {
// //
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => { this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list; this.tableData = response.data.list;
this.listQuery.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
async getDict() { async getDict() {
// //
const res = await getList(); const res = await getList();
this.formConfig[1].selectOptions = res.data; this.formConfig[1].selectOptions = res.data;
}, },
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.content = val.content ? val.content : undefined;
this.listQuery.content = val.content ? val.content : undefined; this.listQuery.typeId = val.typeId ? val.typeId : undefined;
this.listQuery.typeId = val.typeId ? val.typeId : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList(); this.getDataList();
break; break;
case 'add': case 'add':

View File

@ -0,0 +1,88 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-24 08:42:18
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="报废类型编码" prop="code" label-width="120px">
<el-input v-model="dataForm.code" placeholder="请输入报废类型编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报废类型" prop="name" label-width="90px">
<el-input v-model="dataForm.name" placeholder="请输入报废类型" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item
label="报废类型描述"
prop="description"
label-width="120px">
<el-input
v-model="dataForm.description"
clearable
placeholder="报废类型描述" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark" label-width="90px">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../../core/mixins/basic-add';
import {
createQualityScrapType,
updateQualityScrapType,
getQualityScrapType,
getCode,
} from '@/api/base/qualityScrapType';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createQualityScrapType,
updateURL: updateQualityScrapType,
infoURL: getQualityScrapType,
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
description: undefined,
remark: undefined,
},
dataRule: {
code: [
{ required: true, message: '报废类型编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '报废类型不能为空', trigger: 'blur' },
],
},
};
},
};
</script>

View File

@ -0,0 +1,159 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: DY
* @LastEditTime: 2023-09-21 16:02:07
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
getDataListURL: '',
deleteURL: '',
statusUrl: '',
exportURL: ''
},
tableData: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 1,
},
exportLoading: false,
dataListLoading: false,
addOrEditTitle: '',
addOrUpdateVisible: false,
}
},
created() {
},
mounted() {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
cancel(id) {
this.$refs["popover-" + id].showPopper = false;
},
//改变状态
changeStatus(id) {
this.$http
.post(this.urlOptions.statusUrl, { id })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$refs["popover-" + id].showPopper = false;
this.$message({
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.getDataList();
},
});
})
.catch(() => { });
},
//tableBtn点击
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.name)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id,name) {
this.$modal
.delConfirm(name)
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.getDataList();
this.$modal.msgSuccess('删除成功');
});
})
.catch(() => { });
},
//search-bar点击
buttonClick(val) {
switch (val.btnName) {
case "search":
this.listQuery.xm1 = val.xm1;
this.listQuery.xm2 = val.xm2;
this.listQuery.pageNo = 1;
this.getDataList();
break;
case "add":
this.addOrEditTitle = '新增'
this.addOrUpdateVisible = true;
this.addOrUpdateHandle()
break;
default:
console.log(val)
}
},
handleCancel() {
this.$refs.addOrUpdate.formClear()
this.addOrUpdateVisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.addOrUpdate.dataFormSubmit()
},
successSubmit() {
this.handleCancel()
this.getDataList()
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return this.urlOptions.exportURL(params);
}).then(response => {
this.$download.excel(response, '工厂.xls');
this.exportLoading = false;
}).catch(() => { });
}
}
}

View File

@ -9,11 +9,12 @@
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:table-data="tableData"> :table-data="tableData"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="120" :width="80"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
@ -21,7 +22,7 @@
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="total"
@pagination="getDataList" /> @pagination="getDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@ -29,7 +30,7 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width="30%"> width="50%">
<add-or-update <add-or-update
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update> @refreshDataList="successSubmit"></add-or-update>
@ -39,39 +40,45 @@
<script> <script>
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from '../../../core/mixins/basic-page'; import basicPage from './basic-page';
import { parseTime } from '../../../core/mixins/code-filter'; import { parseTime } from '../../../core/mixins/code-filter';
import { import {
getQualityScrapTypePage, getQualityScrapTypePage,
deleteQualityScrapType deleteQualityScrapType,
} from '@/api/base/qualityScrapType'; } from '@/api/base/qualityScrapType';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
filter: parseTime filter: parseTime,
}, width: 160,
{ },
prop: 'name', {
label: '报废类型' prop: 'name',
}, label: '报废类型',
showOverflowtooltip: true,
},
{ {
prop: 'code', prop: 'code',
label: '报废类型编码' label: '报废类型编码',
showOverflowtooltip: true,
}, },
{ {
prop: 'description', prop: 'description',
label: '描述信息' label: '描述信息',
showOverflowtooltip: true,
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注' label: '备注',
showOverflowtooltip: true,
}, },
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@ -81,25 +88,25 @@ export default {
}, },
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`base:quality-scrap-type:update`) this.$auth.hasPermi(`base:quality-scrap-type:update`)
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi(`base:quality-scrap-type:delete`) this.$auth.hasPermi(`base:quality-scrap-type:delete`)
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
} }
: undefined, : undefined,
].filter((v)=>v), ].filter((v) => v),
tableData: [], tableData: [],
formConfig: [ formConfig: [
{ {
type: 'input', type: 'input',
label: '报废类型', label: '报废类型',
placeholder: '报废类型', placeholder: '报废类型',
param: 'name', param: 'name',
}, },
{ {
@ -112,13 +119,20 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:quality-scrap-type:create') ? 'button' : '', type: this.$auth.hasPermi('base:quality-scrap-type:create')
? 'button'
: '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true,
}, },
], ],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
}; };
}, },
components: { components: {
@ -127,31 +141,21 @@ export default {
created() {}, created() {},
methods: { methods: {
// //
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => { this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list; this.tableData = response.data.list;
this.listQuery.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name ? val.name : undefined; this.listQuery.name = val.name ? val.name : undefined;
this.getDataList(); this.getDataList();
break; break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add': case 'add':
this.addOrEditTitle = '新增'; this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;

View File

@ -1,218 +0,0 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<energy-plc-add ref="energyPlc" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyPlcPage, deleteEnergyPlc } from "@/api/base/energyPlc";
// import { publicFormatter } from '@/utils/dict'
import EnergyPlcAdd from './components/energyPlcAdd.vue'
const tableProps = [
{
prop: 'plcTableName',
label: '关联表名'
},
{
prop: 'code',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'name',
label: '标识名'
},
{
prop: 'enName',
label: '英文标识名'
},
{
prop: 'collection',
label: '是否采集'
},
{
prop: 'description',
label: '描述',
showOverflowtooltip: true
}
]
export default {
name: "EnergyPlc",
components: { EnergyPlcAdd },
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'name'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-plc:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
collectionList: [
{value: 0,label: '否'},
{value: 1,label: '是'}
],
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null
}
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyPlc.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyPlcPage(this.queryParams).then(response => {
let arr = response.data.list || [];
arr&&arr.map(item => {
this.collectionList.map(i => {
if (item.collection === i.value) {
item.collection = i.label
}
})
})
this.list = arr
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyPlc.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
},
handleCancel() {
this.$refs.energyPlc.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyPlc.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?').then(function() {
return deleteEnergyPlc(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

View File

@ -280,7 +280,7 @@ export default {
async fillProductOptions() { async fillProductOptions() {
const { data } = await this.$axios({ const { data } = await this.$axios({
url: '/base/core-product/listAll', url: '/base/core-product-material/listAll',
method: 'get', method: 'get',
}); });
const cfg = this.searchBarFormConfig.find( const cfg = this.searchBarFormConfig.find(

View File

@ -383,7 +383,7 @@ export default {
// //
handleAddAttr() { handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备分组信息'); if (!this.dataId) return this.$message.warning('请先创建设备分组信息');
this.attrForm = { this.attrForm = {
id: null, id: null,
equipmentGroupId: this.dataId, equipmentGroupId: this.dataId,

View File

@ -382,7 +382,7 @@ export default {
// //
handleAddAttr() { handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备分组信息'); if (!this.dataId) return this.$message.warning('请先创建设备分组信息');
this.attrForm = { this.attrForm = {
id: null, id: null,
equipmentGroupId: this.dataId, equipmentGroupId: this.dataId,

View File

@ -270,7 +270,7 @@ export default {
switch (btnName) { switch (btnName) {
case 'search': case 'search':
if (!payload.recordTime || payload.recordTime.length <= 0) { if (!payload.recordTime || payload.recordTime.length <= 0) {
this.$message.error('请选择时间段'); this.$message.warning('请选择时间段');
return; return;
} }
this.startTime = new Date(payload.recordTime).getTime(); this.startTime = new Date(payload.recordTime).getTime();
@ -493,7 +493,7 @@ export default {
if (code == 0) { if (code == 0) {
const newEqlist = this.objectToArray(data); const newEqlist = this.objectToArray(data);
if (!newEqlist || newEqlist.length == 0) { if (!newEqlist || newEqlist.length == 0) {
this.$message.error('该设备没有产量数据'); this.$message.warning('该设备没有产量数据');
return; return;
} }
this.graphList.push(...newEqlist); this.graphList.push(...newEqlist);

View File

@ -338,7 +338,7 @@ export default {
switch (btnName) { switch (btnName) {
case 'search': case 'search':
if (!payload.recordTime || payload.recordTime.length <= 0) { if (!payload.recordTime || payload.recordTime.length <= 0) {
this.$message.error('请选择时间段'); this.$message.warning('请选择时间段');
return; return;
} }
@ -373,7 +373,7 @@ export default {
async submitForm() { async submitForm() {
if (this.existingEquipments.indexOf(this.queryParams.equipmentId) >= 0) { if (this.existingEquipments.indexOf(this.queryParams.equipmentId) >= 0) {
this.$message.error('该设备已存在'); this.$message.warning('该设备已存在');
return; return;
} }
const { code, data } = await this.$axios({ const { code, data } = await this.$axios({
@ -387,7 +387,7 @@ export default {
if (code == 0) { if (code == 0) {
const newEqlist = this.objectToArray(data); const newEqlist = this.objectToArray(data);
if (!newEqlist || newEqlist.length == 0) { if (!newEqlist || newEqlist.length == 0) {
this.$message.error('该设备没有状态数据'); this.$message.warning('该设备没有状态数据');
return; return;
} }
this.graphList.push(newEqlist[0]); this.graphList.push(newEqlist[0]);

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zhp * @LastEditors: zwq
* @LastEditTime: 2023-11-28 10:03:20 * @LastEditTime: 2024-07-09 13:40:03
* @Description: * @Description:
--> -->
<template> <template>

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-11-08 15:30:27 * @Date: 2023-11-08 15:30:27
* @LastEditTime: 2023-11-23 14:27:59 * @LastEditTime: 2024-07-09 13:29:06
* @LastEditors: zhp * @LastEditors: zwq
* @Description: * @Description:
--> -->
<template> <template>
@ -42,8 +42,8 @@ import {
getProcessEquMaterialBomDet, getProcessEquMaterialBomDet,
createProcessEquMaterialBomDetList, createProcessEquMaterialBomDetList,
updateProcessEquMaterialBomDet, updateProcessEquMaterialBomDet,
getMaterialList
} from '@/api/extend/processEquMaterialBom'; } from '@/api/extend/processEquMaterialBom';
import { getMaterialTree,getMaterialList } from '@/api/base/material';
export default { export default {
props: { props: {
@ -94,12 +94,16 @@ export default {
} }
}); });
}, },
getDict() { async getDict() {
getMaterialList().then((res) => [ const materRes = await getMaterialTree();
this.materialList = res.data, let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id
console.log(res) const listQuery= {
]) typeId:typeId
}, }
const materData = await getMaterialList(listQuery);
this.materialList = [];
this.materialList = materData.data;
},
// //
dataFormSubmit() { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {

View File

@ -12,32 +12,6 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="12">
<el-form-item label="生效时间" prop="enableTime">
<el-date-picker
v-model="form.enableTime"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="失效时间" prop="disableTime">
<el-date-picker
v-model="form.disableTime"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="班次开始时间" prop="startTime"> <el-form-item label="班次开始时间" prop="startTime">
@ -91,8 +65,6 @@ export default {
id: '', id: '',
name: '', name: '',
code: '', code: '',
enableTime: '',
disableTime: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
daySpan: '', daySpan: '',
@ -101,7 +73,6 @@ export default {
isEdit: false, // isEdit: false, //
rules: { rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }], name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
enableTime: [{ required: true, message: '请选择班次开始时间', trigger: 'change' }],
code: [{ required: true, message: '请输入编码', trigger: 'blur' }], code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
startTime: [{ required: true, message: '请输入生效时间', trigger: 'change' }], startTime: [{ required: true, message: '请输入生效时间', trigger: 'change' }],
endTime: [{ required: true, message: '请选择班次结束时间', trigger: 'change' }] endTime: [{ required: true, message: '请选择班次结束时间', trigger: 'change' }]
@ -116,7 +87,6 @@ export default {
getGroupClasses(id).then((res) => { getGroupClasses(id).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data
this.form.disableTime = res.data.disableTime || ''
} }
}) })
} else { } else {
@ -146,7 +116,6 @@ export default {
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
this.form.disableTime = this.form.disableTime || ''
if (this.isEdit) { if (this.isEdit) {
// //
updateGroupClasses({ ...this.form }).then((res) => { updateGroupClasses({ ...this.form }).then((res) => {

View File

@ -0,0 +1,52 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2024-07-10 10:28:05
* @Description:
-->
<template>
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
state: false
}
},
computed: {
readonly() {
return !!this.injectData.readonly
}
},
mounted() {
this.mapToState()
},
methods: {
mapToState() {
if (this.injectData.prop === 'enabled') {
this.state = this.injectData.enabled === 1 ? true : false
}
},
changeHandler() {
let params = {}
let payload = {}
params.name = 'state'
payload.id = this.injectData.id
payload.enabled = this.state ? '1' : '0'
payload.startTime = this.injectData.startTime
payload.endTime = this.injectData.endTime
params.payload = payload
this.$emit('emitData', params)
}
}
}
</script>

View File

@ -1,262 +1,263 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2024-07-12 16:19:13
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 -->
<!-- 搜索工作栏 --> <search-bar
<search-bar :formConfigs="formConfig"
:formConfigs="formConfig" ref="searchBarForm"
ref="searchBarForm" @headBtnClick="buttonClick" />
@headBtnClick="buttonClick" <!-- 列表 -->
/> <base-table
<!-- 列表 --> :page="queryParams.pageNo"
<base-table :limit="queryParams.pageSize"
:page="queryParams.pageNo" :table-props="tableProps"
:limit="queryParams.pageSize" :table-data="list"
:table-props="tableProps" :max-height="tableH"
:table-data="list" @emitFun="handleTableEvents">
:max-height="tableH" <method-btn
> v-if="tableBtn.length"
<method-btn slot="handleBtn"
v-if="tableBtn.length" :width="120"
slot="handleBtn" label="操作"
:width="120" :method-list="tableBtn"
label="操作" @clickBtn="handleClick" />
:method-list="tableBtn" </base-table>
@clickBtn="handleClick" <pagination
/> :page.sync="queryParams.pageNo"
</base-table> :limit.sync="queryParams.pageSize"
<pagination :total="total"
:page.sync="queryParams.pageNo" @pagination="getList" />
:limit.sync="queryParams.pageSize" <!-- 新增 -->
:total="total" <base-dialog
@pagination="getList" :dialogTitle="addOrEditTitle"
/> :dialogVisible="centervisible"
<!-- 新增 --> @cancel="handleCancel"
<base-dialog @confirm="handleConfirm"
:dialogTitle="addOrEditTitle" :before-close="handleCancel"
:dialogVisible="centervisible" width="50%">
@cancel="handleCancel" <group-class-add ref="classList" @successSubmit="successSubmit" />
@confirm="handleConfirm" </base-dialog>
:before-close="handleCancel" </div>
width='50%'
>
<group-class-add ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template> </template>
<script> <script>
import { getGroupClassesPage, deleteGroupClasses, updateGroupClasses } from "@/api/base/groupClasses"; import {
import GroupClassAdd from './components/groupClassAdd.vue' getGroupClassesPage,
import { formatDate } from '@/utils' deleteGroupClasses,
updateGroupClasses,
} from '@/api/base/groupClasses';
import GroupClassAdd from './components/groupClassAdd.vue';
import StatusBtn from './components/statusBtn';
const tableProps = [ const tableProps = [
{ {
prop: 'enableTimeStr', prop: 'name',
label: '生效时段', label: '班次名称',
minWidth: 300 },
}, {
{ prop: 'timeStr',
prop: 'name', label: '班次时间',
label: '班次名称' minWidth: 100,
}, },
{ {
prop: 'timeStr', prop: 'code',
label: '班次时间', label: '班次编码',
minWidth: 100 minWidth: 200,
}, },
{ {
prop: 'code', prop: 'enabled',
label: '班次编码', label: '班次状态',
minWidth: 200 subcomponent: StatusBtn,
}, },
{ {
prop: 'status', prop: 'remark',
label: '班次状态' label: '备注',
}, },
{ ];
prop: 'remark',
label: '备注'
}
]
export default { export default {
name: "GroupClass", name: 'GroupClass',
components: { GroupClassAdd }, components: { GroupClassAdd },
data() { data() {
return { return {
formConfig: [ formConfig: [
{ {
type: 'input', type: 'input',
label: '班次名称', label: '班次名称',
placeholder: '班次名称', placeholder: '班次名称',
param: 'name' param: 'name',
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:group-classes:create') ? 'button' : '', type: this.$auth.hasPermi('base:group-classes:create')
btnName: '新增', ? 'button'
name: 'add', : '',
color: 'success', btnName: '新增',
plain: true name: 'add',
} color: 'success',
], plain: true,
tableProps, },
tableBtn: [ ],
this.$auth.hasPermi('base:group-classes:cancel') tableProps,
? { tableBtn: [
type: 'cancel', this.$auth.hasPermi('base:group-classes:update')
btnName: '作废', ? {
showParam: { type: 'edit',
type: '&', btnName: '编辑',
data: [ }
{ : undefined,
type: 'unequal', this.$auth.hasPermi('base:group-classes:delete')
name: 'status', ? {
value: '不可用' type: 'delete',
} btnName: '删除',
] }
} : undefined,
} ].filter((v) => v),
: undefined, tableH: this.tableHeight(260),
this.$auth.hasPermi('base:group-classes:update') //
? { total: 0,
type: 'edit', //
btnName: '编辑' list: [],
} //
: undefined, addOrEditTitle: '',
this.$auth.hasPermi('base:group-classes:delete') //
? { centervisible: false,
type: 'delete', //
btnName: '删除' queryParams: {
} pageNo: 1,
: undefined pageSize: 20,
].filter((v) => v), name: null,
tableH: this.tableHeight(260), },
// };
total: 0, },
// created() {
list: [], window.addEventListener('resize', () => {
// this.tableH = this.tableHeight(260);
addOrEditTitle: "", });
// this.getList();
centervisible: false, },
// methods: {
queryParams: { buttonClick(val) {
pageNo: 1, switch (val.btnName) {
pageSize: 20, case 'search':
name: null this.queryParams.pageNo = 1;
} this.queryParams.name = val.name;
}; this.getList();
}, break;
created() { default:
window.addEventListener('resize', () => { this.addOrEditTitle = '新增';
this.tableH = this.tableHeight(260) this.centervisible = true;
}) this.$nextTick(() => {
this.getList() this.$refs.classList.init();
}, });
methods: { }
buttonClick(val) { },
switch (val.btnName) { //
case 'search': handleTableEvents(params) {
this.queryParams.pageNo = 1; if (params.name === 'state') {
this.queryParams.name = val.name //
this.getList() updateGroupClasses({ ...params.payload })
break .then((res) => {
default: if (res.code === 0) {
this.addOrEditTitle = '新增' this.$modal.msgSuccess('操作成功');
this.centervisible = true this.getList();
this.$nextTick(() => { }
this.$refs.classList.init() })
}) .catch((res) => {
} this.getList();
}, });
/** 查询列表 */ }
getList() { },
getGroupClassesPage(this.queryParams).then(res => { /** 查询列表 */
if (res.code === 0 && res.data.list.length > 0) { getList() {
res.data.list.map(item => { getGroupClassesPage(this.queryParams).then((res) => {
item.enableTimeStr = formatDate(item.enableTime) + '至' + (item.disableTime ? formatDate(item.disableTime) : '永久') if (res.code === 0 && res.data.list && res.data.list.length > 0) {
item.timeStr = item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5) res.data.list.map((item) => {
item.status = item.status === true ? '可用' : '不可用' item.timeStr =
}) item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5);
this.list = res.data.list; });
this.total = res.data.total; this.list = res.data.list;
} else { this.total = res.data.total;
this.list = [] } else {
this.total = 0 this.list = [];
} this.total = 0;
}); }
}, });
handleClick(val) { },
switch (val.type) { handleClick(val) {
case 'edit': switch (val.type) {
this.addOrEditTitle = '编辑' case 'edit':
this.$nextTick(() => { this.addOrEditTitle = '编辑';
this.$refs.classList.init(val.data.id) this.$nextTick(() => {
}) this.$refs.classList.init(val.data.id);
this.centervisible = true });
break this.centervisible = true;
case 'cancel': break;
this.discard(val.data) default:
break this.handleDelete(val.data);
default: }
this.handleDelete(val.data) },
} handleCancel() {
}, this.$refs.classList.formClear();
handleCancel() { this.centervisible = false;
this.$refs.classList.formClear() this.addOrEditTitle = '';
this.centervisible = false },
this.addOrEditTitle = '' handleConfirm() {
}, this.$refs.classList.submitForm();
handleConfirm() { },
this.$refs.classList.submitForm() successSubmit() {
}, this.handleCancel();
successSubmit() { this.getList();
this.handleCancel() },
this.getList() /** 删除按钮操作 */
}, handleDelete(row) {
discard(row) { console.log(row);
let obj = {} let _this = this;
obj.id = row.id if (row.enabled) {
obj.startTime = row.startTime //
obj.endTime = row.endTime _this.$modal
obj.enableTime = row.enableTime .confirm(
obj.disableTime = Date.parse(new Date()) '删除的班次"' +
this.$modal.confirm('是否确认作废班次名称为"' + row.name + '"的数据项?').then(function() { row.name +
return updateGroupClasses({ ...obj }) '"可能会影响交接班计划,请点取消再次确认!'
}).then(() => { )
this.getList(); .then(function () {
this.$modal.msgSuccess("操作成功"); return _this.$modal
}).catch(() => {}); .confirm('是否确认删除班次名称为"' + row.name + '"的数据项?')
}, .then(function () {
/** 删除按钮操作 */ return deleteGroupClasses(row.id);
handleDelete(row) { })
console.log(row) .then(() => {
let _this = this _this.getList();
if (row.status === '可用') {// _this.$modal.msgSuccess('删除成功');
_this.$modal.confirm('删除的班次"' + row.name + '"可能会影响交接班计划,请点取消再次确认!').then(function() { })
return _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() { .catch(() => {});
return deleteGroupClasses(row.id); });
}).then(() => { } else {
_this.getList(); _this.$modal
_this.$modal.msgSuccess("删除成功"); .confirm('是否确认删除班次名称为"' + row.name + '"的数据项?')
}).catch(() => {}); .then(function () {
}) return deleteGroupClasses(row.id);
} else { })
_this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() { .then(() => {
return deleteGroupClasses(row.id); _this.getList();
}).then(() => { _this.$modal.msgSuccess('删除成功');
_this.getList(); })
_this.$modal.msgSuccess("删除成功"); .catch(() => {});
}).catch(() => {}); }
} },
} },
}
}; };
</script> </script>

View File

@ -14,20 +14,18 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="班组组长" prop="leaderId"> <el-form-item label="班组组长" prop="leaderName">
<el-select v-model="form.leaderId" placeholder="请选择" style="width: 100%;" filterable @change="selectLeader"> <el-input v-model="form.leaderName" clearable></el-input>
<el-option
v-for="item in workerList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号" prop="telephone"> <el-form-item label="手机号" prop="leaderPhone">
<el-input v-model="form.telephone" disabled></el-input> <el-input v-model="form.leaderPhone" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组人数" prop="num">
<el-input-number style="width: 100%;" v-model="form.num" :step="1" step-strictly></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -35,7 +33,6 @@
</template> </template>
<script> <script>
import { getGroupTeam, updateGroupTeam, createGroupTeam, getCode } from '@/api/base/groupTeam' import { getGroupTeam, updateGroupTeam, createGroupTeam, getCode } from '@/api/base/groupTeam'
import { getWorkerList } from '@/api/base/worker'
export default { export default {
name: 'groupTeamAdd', name: 'groupTeamAdd',
data() { data() {
@ -44,28 +41,26 @@ export default {
id: '', id: '',
name: '', name: '',
code: '', code: '',
leaderId: '', leaderName: '',
telephone: '' leaderPhone: '',
num: ''
}, },
isEdit: false, // isEdit: false, //
rules: { rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }], name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
code: [{ required: true, message: '请输入班组编码', trigger: 'blur' }], code: [{ required: true, message: '请输入班组编码', trigger: 'blur' }],
leaderId: [{ required: true, message: '请选择组长', trigger: 'select' }] leaderName: [{ required: true, message: '请输入组长', trigger: 'blur' }]
}, },
workerList: []
} }
}, },
methods: { methods: {
init(id) { init(id) {
this.getWorkerList()
if (id) { if (id) {
this.isEdit = true this.isEdit = true
this.form.id = id this.form.id = id
getGroupTeam( id ).then((res) => { getGroupTeam( id ).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data
this.selectLeader()
} }
}) })
} else { } else {
@ -76,24 +71,6 @@ export default {
}) })
} }
}, },
// list
getWorkerList() {
getWorkerList().then(res => {
this.workerList = res.data
})
},
//
selectLeader() {
if (this.form.leaderId) {
this.workerList.map(item => {
if (item.id === this.form.leaderId) {
this.form.telephone = item.telephone || ''
}
})
} else {
this.form.telephone = ''
}
},
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {

View File

@ -1,3 +1,10 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2024-07-10 10:00:03
* @Description:
-->
<template> <template>
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" /> <el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
</template> </template>
@ -37,7 +44,7 @@ export default {
payload.enabled = this.state ? '1' : '0' payload.enabled = this.state ? '1' : '0'
payload.code = this.injectData.code payload.code = this.injectData.code
payload.name = this.injectData.name payload.name = this.injectData.name
payload.leaderId = this.injectData.leaderId payload.leaderName = this.injectData.leaderName
params.payload = payload params.payload = payload
this.$emit('emitData', params) this.$emit('emitData', params)
} }

View File

@ -193,7 +193,7 @@ export default {
}, },
getList() { getList() {
groupTeamPage({ ...this.queryParams }).then(res => { groupTeamPage({ ...this.queryParams }).then(res => {
if (res.code === 0 && res.data.list.length > 0) { if (res.code === 0 && res.data.list && res.data.list.length > 0) {
let arr = [] let arr = []
res.data.list.map(item => { res.data.list.map(item => {
let obj = {} let obj = {}

View File

@ -42,8 +42,6 @@
> >
<group-team-add ref="groupList" @successSubmit="successSubmit" /> <group-team-add ref="groupList" @successSubmit="successSubmit" />
</base-dialog> </base-dialog>
<!-- 组员编辑 -->
<worker-edit v-if='paramVisible' ref='workerEditParam' @closeDrawer="closeDrawer"></worker-edit>
</div> </div>
</template> </template>
@ -52,8 +50,6 @@ import { getGroupTeamPage, deleteGroupTeam, updateGroupTeam } from "@/api/base/g
import { parseTime } from '@/utils/ruoyi' import { parseTime } from '@/utils/ruoyi'
import GroupTeamAdd from './components/groupTeamAdd' import GroupTeamAdd from './components/groupTeamAdd'
import StatusBtn from './components/statusBtn' import StatusBtn from './components/statusBtn'
import WorkerOperate from './components/workerOperate'
import WorkerEdit from './components/workerEdit'
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
@ -83,15 +79,10 @@ const tableProps = [
label: '班组状态', label: '班组状态',
subcomponent: StatusBtn subcomponent: StatusBtn
}, },
{
prop: 'workerName',
label: '组员',
subcomponent: WorkerOperate
},
] ]
export default { export default {
name: "GroupTeam", name: "GroupTeam",
components: { GroupTeamAdd, WorkerEdit }, components: { GroupTeamAdd },
data() { data() {
return { return {
formConfig: [ formConfig: [
@ -155,7 +146,6 @@ export default {
name: null, name: null,
code: null code: null
}, },
paramVisible: false
}; };
}, },
created() { created() {
@ -203,17 +193,14 @@ export default {
}, },
// //
handleTableEvents(params) { handleTableEvents(params) {
console.log(params)
if (params.name === 'state') {// if (params.name === 'state') {//
updateGroupTeam({ ...params.payload }).then((res) => { updateGroupTeam({ ...params.payload }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess("操作成功");
this.getList()
} }
}) }).catch((res)=>{
}else {// & this.getList()
this.paramVisible = true
this.$nextTick(() => {
this.$refs.workerEditParam.init(params)
}) })
} }
}, },

View File

@ -1,478 +1,520 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2024-07-15 14:55:35
* @Description:
-->
<template> <template>
<div class="groupTeamScheduling"> <div class="groupTeamScheduling">
<div class="operationArea"> <div class="operationArea">
<el-form :inline="true" class="demo-form-inline"> <el-tabs v-model="planId" @tab-click="setPlan">
<span class="blue-block"></span> <el-tab-pane
<el-form-item label="月份选择"> v-for="item in planArr"
<el-date-picker :key="item.id"
v-model="startDay" :label="item.name"
type="month" :name="item.id" />
placeholder="选择月" </el-tabs>
size="small" <el-form :inline="true" class="demo-form-inline">
:disabled="showSetting" <span class="blue-block"></span>
@change="selectMonth" <el-form-item label="月份选择">
:clearable="false" <el-date-picker
style="width: 120px"> v-model="startDay"
</el-date-picker> type="month"
</el-form-item> placeholder="选择月"
<el-form-item> size="small"
<span class="separateStyle" v-if="this.$auth.hasPermi('base:group-team-scheduling:set')"></span> :disabled="showSetting"
</el-form-item> @change="selectMonth"
<el-form-item> :clearable="false"
<el-button type="primary" size="small" v-if="this.$auth.hasPermi('base:group-team-scheduling:set')" :disabled="showSetting || settingBtnDis" @click="settingMsg">设置</el-button> style="width: 120px"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" size="small" v-show="showSetting && autoScheduling" @click="schedulingBtn">自动排班</el-button> <span
</el-form-item> class="separateStyle"
<el-form-item> v-if="this.$auth.hasPermi('base:group-team-scheduling:set')"></span>
<span class="separateStyle" v-show="showSetting"></span> </el-form-item>
</el-form-item> <el-form-item>
<el-form-item> <el-button
<el-button type="primary" size="small" v-show="showSetting" @click="confirmSetting">确认</el-button> type="primary"
</el-form-item> size="small"
<el-form-item> v-if="this.$auth.hasPermi('base:group-team-scheduling:set')"
<el-button type="primary" size="small" plain v-show="showSetting" @click="cancelSetting">取消</el-button> :disabled="showSetting || settingBtnDis"
</el-form-item> @click="settingMsg">
<el-form-item label="请先选择查询的班组" class="rightItem"> 设置
<!-- <el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('1')">班组上下片查询</el-button> --> </el-button>
<el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('2')">班组能源查询</el-button> </el-form-item>
<el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('3')">班组检测查询</el-button> <el-form-item>
</el-form-item> <span class="separateStyle" v-show="showSetting"></span>
</el-form> </el-form-item>
</div> <el-form-item>
<!-- 日历区域 --> <el-button
<div class="calenderArea"> type="primary"
<div style="font-size: 24px;font-weight: 500">{{ this.month }} {{ this.year }}</div> size="small"
<el-calendar v-model="startDay"> v-show="showSetting"
<!-- 这里使用的是 2.5 slot 语法对于新项目请使用 2.6 slot 语法--> @click="confirmSetting">
<template 确认
slot="dateCell" </el-button>
slot-scope="{date, data}"> </el-form-item>
<div v-if="data.type === 'current-month'"> <el-form-item>
<!-- 日期 --> <el-button
<div class="dateStyle"> type="primary"
{{ Number(data.day.split('-')[2]) }} size="small"
</div> plain
<!-- 班次班组 --> v-show="showSetting"
<!-- class有两个样式一个是类似class1还有个是选中红框显示 --> @click="cancelSetting">
<el-row :gutter="2" :class="'class' + (index+1) + (chooseTip === (item.startDay+item.classesId) ? ' team-active' : '')" v-for="(item, index) in list[Number(data.day.split('-')[2])]" :key='index'> 取消
<el-col :span="12"> </el-button>
<div class="selectDiv"> </el-form-item>
<!-- 选择班组图标 --> </el-form>
<div class="toggle-icon" v-show="showSetting && (new Date(data.day).valueOf() < new Date().valueOf() ? false: true)"> </div>
<svg-icon icon-class="toggle"/> <!-- 日历区域 -->
</div> <div class="calenderArea">
<!-- 不能选择班组 --> <div style="font-size: 24px; font-weight: 500">
<div class="toggle-icon-hide" v-show="!(showSetting && (new Date(data.day).valueOf() < new Date().valueOf() ? false: true))"></div> {{ this.month }} {{ this.year }}
<el-select v-model="item.teamId" size='small' :disabled="!showSetting || (new Date(data.day).valueOf() > new Date().valueOf() ? false: true)"> </div>
<el-option <el-calendar v-model="startDay">
v-for="i in teamList" <!-- 这里使用的是 2.5 slot 语法对于新项目请使用 2.6 slot 语法-->
:key="i.id" <template slot="dateCell" slot-scope="{ date, data }">
:label="i.name" <div v-if="data.type === 'current-month'">
:value="i.id"> <!-- 日期 -->
</el-option> <div class="dateStyle">
</el-select> {{ Number(data.day.split('-')[2]) }}
</div> </div>
</el-col> <!-- 班次班组 -->
<el-col :span="12"> <!-- class有两个样式一个是类似class1还有个是选中红框显示 -->
<el-button class="labelClass" @click="chooseTeam(item)">{{ item.classesName }}</el-button> <el-row
</el-col> :gutter="2"
</el-row> :class="
</div> 'class' +
</template> (index + 1) +
</el-calendar> (chooseTip === item.startDay + item.classesId
</div> ? ' team-active'
</div> : '')
"
v-for="(item, index) in list[Number(data.day.split('-')[2])]"
:key="index">
<el-col :span="12">
<div class="selectDiv">
<!-- 选择班组图标 -->
<div
class="toggle-icon"
v-show="
showSetting &&
(new Date(data.day).valueOf() < new Date().valueOf()
? false
: true)
">
<svg-icon icon-class="toggle" />
</div>
<!-- 不能选择班组 -->
<div
class="toggle-icon-hide"
v-show="
!(
showSetting &&
(new Date(data.day).valueOf() < new Date().valueOf()
? false
: true)
)
"></div>
<el-select
v-model="item.teamId"
size="small"
:disabled="
!showSetting ||
(new Date(data.day).valueOf() > new Date().valueOf()
? false
: true)
">
<el-option
v-for="i in teamList"
:key="i.id"
:label="i.name"
:value="i.id"></el-option>
</el-select>
</div>
</el-col>
<el-col :span="12">
<el-button class="labelClass" @click="chooseTeam(item)">
{{ item.classesName }}
</el-button>
</el-col>
</el-row>
</div>
</template>
</el-calendar>
</div>
</div>
</template> </template>
<script> <script>
import { getPreset, createOrUpdateList, autoSet } from "@/api/base/groupTeamScheduling"; import {
import { listEnabled } from "@/api/base/groupTeam"; getScheduling,
createOrUpdateList,
} from '@/api/base/groupTeamScheduling';
import {
groupPlanList,
groupPlanTeamList,
} from '@/api/base/groupSchedulingPlan';
import { listEnabled } from '@/api/base/groupTeam';
import moment from 'moment'; import moment from 'moment';
export default { export default {
name: "GroupTeamScheduling", name: 'GroupTeamScheduling',
data() { data() {
return { return {
startDay: '',// startDay: '', //
year: '',// 2023 year: '', // 2023
month: '',// month: '', //
monthList: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"], monthList: [
list: {}, '一月',
teamList: [],// '二月',
showSetting: false,// '三月',
settingBtnDis: false, '四月',
jumpDisabled: true,// '五月',
chooseObj: {}, // '六月',
chooseTip: '',// '七月',
autoScheduling: false // '八月',
}; '九月',
}, '十月',
created() { '十一月',
this.startDay = new Date() '十二月',
// ],
this.settingBtn() planId: undefined, //id
this.getTeamList() list: {},
this.toggleMonth() planArr: [], //
this.getList() teamList: [], //
}, showSetting: false, //
methods: { settingBtnDis: false,
// jumpDisabled: true, //
selectMonth() { chooseObj: {}, //
if (this.startDay) { chooseTip: '', //
this.settingBtn() // ,getlist autoScheduling: false, //
this.toggleMonth() };
this.getList() },
this.clearChoose() created() {
if ( moment(this.startDay).valueOf() > moment().endOf('month').valueOf()) { this.startDay = new Date();
this.autoScheduling = true groupPlanList().then((res) => {
} else { this.planArr = res.data || [];
this.autoScheduling = false this.planId = this.planArr[0] ? this.planArr[0].id : undefined;
} if (this.planId) {
} this.getList();
}, this.getTeamList();
// }
getTeamList() { });
listEnabled().then(res => { //
this.teamList = res.data || [] this.settingBtn();
}) this.toggleMonth();
}, },
// methods: {
getList() { setPlan() {
let year = moment(this.startDay).format('YYYY') this.getList();
let month = moment(this.startDay).format('M') this.getTeamList();
getPreset({ },
year: year, //
month: month selectMonth() {
}).then(res => { if (this.startDay) {
let obj = res.data || {} this.settingBtn(); // ,getlist
if (obj) { this.toggleMonth();
for (let item in obj) { this.getList();
for (let i = 0; i < obj[item].length; i++) { this.clearChoose();
if (!obj[item][i].teamId) { if (
obj[item][i].teamId = '' moment(this.startDay).valueOf() > moment().endOf('month').valueOf()
} ) {
} this.autoScheduling = true;
} } else {
} this.autoScheduling = false;
this.list = obj }
}).catch(() => { }
this.list = {} },
this.settingBtnDis = true // //
}) getTeamList() {
}, groupPlanTeamList(this.planId).then((res) => {
// this.teamList = res.data || [];
settingMsg() { });
this.showSetting = !this.showSetting },
this.clearChoose() //
}, getList() {
// let year = moment(this.startDay).format('YYYY');
cancelSetting() { let month = moment(this.startDay).format('M');
this.showSetting = !this.showSetting getScheduling({
this.getList() // year: year,
}, month: month,
// planId: this.planId,
confirmSetting() { })
let num = 0 .then((res) => {
// let obj = res.data || {};
if (moment(this.startDay).format('YYYY-MM') === moment().format('YYYY-MM')) { if (obj) {
num = Number(moment().format('DD')) for (let item in obj) {
} else { for (let i = 0; i < obj[item].length; i++) {
num = 0 if (!obj[item][i].teamId) {
} obj[item][i].teamId = '';
// }
// }
let tempArr = Object.values(this.list) }
let arr = [] }
for (let i = num; i < tempArr.length; i++) { this.list = obj;
for (let j = 0; j < tempArr[i].length; j++) { })
arr.push(tempArr[i][j]) .catch(() => {
} this.list = {};
} this.settingBtnDis = true; //
createOrUpdateList(arr).then(res => { });
if (res.code === 0) { },
this.showSetting = !this.showSetting //
this.$modal.msgSuccess("操作成功") settingMsg() {
this.getList() // this.showSetting = !this.showSetting;
} this.clearChoose();
}) },
}, //
// cancelSetting() {
chooseTeam(value) { this.showSetting = !this.showSetting;
if (this.showSetting) { this.getList(); //
this.$modal.msgWarning("当前处于设置模式") },
return false //
} confirmSetting() {
this.chooseObj = value let num = 0;
this.chooseTip = value.startDay + value.classesId // //
this.jumpDisabled = false // if (
}, moment(this.startDay).format('YYYY-MM') === moment().format('YYYY-MM')
// ) {
schedulingBtn() { num = Number(moment().format('DD'));
let tempData = this.list } else {
// 1 num = 0;
if (this.list[1][0].teamId) { }
let tempArr = Object.values(this.list) //
let arr = [] //
let n = 0 let tempArr = Object.values(this.list);
for (let i = 0; i < tempArr.length; i++) { let arr = [];
if (n > 0) { for (let i = num; i < tempArr.length; i++) {
break; for (let j = 0; j < tempArr[i].length; j++) {
} arr.push(tempArr[i][j]);
for (let j = 0; j < tempArr[i].length; j++) { }
if (tempArr[i][j].teamId) { }
arr.push(tempArr[i][j].teamId) createOrUpdateList(arr).then((res) => {
} else { if (res.code === 0) {
n++ this.showSetting = !this.showSetting;
} this.$modal.msgSuccess('操作成功');
} this.getList(); //
} }
let tempNum = 0 });
for (let k = 0; k < tempArr.length; k++) { },
for (let v = 0; v < tempArr[k].length; v++) { //
let t = tempNum % arr.length chooseTeam(value) {
if (arr.length === 1) { // if (this.showSetting) {
tempData[k+1][v].teamId = arr[0] // this.$modal.msgWarning('');
} else { // return false;
tempData[k+1][v].teamId = arr[t] // }
} this.chooseObj = value;
tempNum++ this.chooseTip = value.startDay + value.classesId; //
} this.jumpDisabled = false; //
} },
this.list = [] //
this.list = tempData settingBtn() {
} else { let nowMonth = moment().startOf('month').valueOf();
// 1, let startMonth = moment(this.startDay).valueOf();
// console.log(moment(this.startDay).format("YYYY-MM-DD")) let nowDate = moment(new Date()).date();
autoSet({ let sumDate = moment().daysInMonth();
year: this.year, if (nowMonth > startMonth) {
month: moment(this.startDay).month() + 1 //
}).then(res => { this.settingBtnDis = true;
this.list = res.data || {} } else {
}) if (nowDate < sumDate) {
} this.settingBtnDis = false;
}, } else {
// this.settingBtnDis = true;
settingBtn() { }
let nowMonth = moment().startOf('month').valueOf() }
let startMonth = moment(this.startDay).valueOf() },
let nowDate = moment(new Date()).date() //
let sumDate = moment().daysInMonth() clearChoose() {
if (nowMonth > startMonth) { // this.chooseObj = {};
this.settingBtnDis = true this.chooseTip = '';
} else { this.jumpDisabled = true;
if (nowDate < sumDate) { },
this.settingBtnDis = false //
} else { toggleMonth() {
this.settingBtnDis = true this.year = moment(this.startDay).format('YYYY');
} let month = Number(moment(this.startDay).format('MM'));
} this.month = this.monthList[month - 1];
}, },
// },
clearChoose() { };
this.chooseObj = {}
this.chooseTip = ""
this.jumpDisabled = true
},
//
toggleMonth() {
this.year = moment(this.startDay).format("YYYY")
let month = Number(moment(this.startDay).format("MM"))
this.month = this.monthList[month - 1]
},
// 3
toOtherPage(val) {
switch (val) {
case '1':
this.$router.push({
path: '/core/enhance/product-line-24h?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime,
})
break;
case '2': //
this.$router.push({
// path: '/energy/monitoring/energy-report-search?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime
path: '/energy/base/energy-quantity-realtime?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime
})
break;
default:
this.$router.push({
path: '/quality/base/quality-inspection-data/detection-information/statistical-data?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime,
// name: 'QualityStatistics',
// params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
})
}
}
}
}
</script> </script>
<style lang='scss'> <style lang="scss">
.demo-form-inline { .demo-form-inline {
.el-date-editor .el-range__icon { .el-date-editor .el-range__icon {
font-size: 16px; font-size: 16px;
color: #0B58FF; color: #0b58ff;
} }
.el-input__prefix .el-icon-date { .el-input__prefix .el-icon-date {
font-size: 16px; font-size: 16px;
color: #0B58FF; color: #0b58ff;
} }
} }
.groupTeamScheduling { .groupTeamScheduling {
background-color: #F2F4F9; background-color: #f2f4f9;
.operationArea { .operationArea {
padding: 14px 10px 0 16px; padding: 14px 10px 0 16px;
margin-bottom: 8px; margin-bottom: 8px;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
.blue-block { .blue-block {
display: inline-block; display: inline-block;
width: 4px; width: 4px;
height: 16px; height: 16px;
background-color: #0B58FF; background-color: #0b58ff;
border-radius: 1px; border-radius: 1px;
margin-right: 8px; margin-right: 8px;
margin-top: 10px; margin-top: 10px;
} }
.separateStyle { .separateStyle {
display: inline-block; display: inline-block;
width: 1px; width: 1px;
height: 24px; height: 24px;
background: #E8E8E8; background: #e8e8e8;
vertical-align: middle; vertical-align: middle;
} }
.el-form-item { .el-form-item {
margin-bottom: 10px; margin-bottom: 10px;
} }
.rightItem { .rightItem {
float: right; float: right;
} }
} }
// //
.calenderArea { .calenderArea {
padding: 14px 10px 0 20px; padding: 14px 10px 0 20px;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
.el-calendar__body { .el-calendar__body {
padding: 10px 16px 16px 0; padding: 10px 16px 16px 0;
} }
.el-calendar__header { .el-calendar__header {
display: none; display: none;
} }
.el-calendar-table > thead { .el-calendar-table > thead {
height: 48px; height: 48px;
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
color: #000000; color: #000000;
background-color: rgba(242, 244, 249, 1); background-color: rgba(242, 244, 249, 1);
} }
.el-calendar-table__row { .el-calendar-table__row {
height: 133px; height: 133px;
.prev, .next { .prev,
pointer-events: none; .next {
} pointer-events: none;
.el-calendar-day { }
padding: 0 10px; .el-calendar-day {
height: 100%; padding: 0 10px;
.dateStyle { height: 100%;
font-size: 20px; .dateStyle {
font-weight: 500; font-size: 20px;
color: #000000; font-weight: 500;
text-align: right; color: #000000;
height: 32px; text-align: right;
line-height: 28px; height: 32px;
padding-right: 10px; line-height: 28px;
} padding-right: 10px;
} }
} }
.team-active {// }
border:2px solid red .team-active {
} //
.class1, .class2, .class3 { border: 2px solid #409eff;
padding: 0; }
font-weight: 600; .class1,
margin-bottom: 2px; .class2,
.selectDiv { .class3 {
position: relative; padding: 0;
.toggle-icon { font-weight: 600;
position: absolute; margin-bottom: 2px;
width: 26px; .selectDiv {
height: 26px; position: relative;
line-height: 26px; .toggle-icon {
font-size: 14px; position: absolute;
z-index: 1; width: 26px;
text-align: center; height: 26px;
} line-height: 26px;
.toggle-icon-hide { font-size: 14px;
position: absolute; z-index: 1;
width: 2px; text-align: center;
height: 28px; }
z-index: 1; .toggle-icon-hide {
} position: absolute;
.el-input__suffix { width: 2px;
display: none; height: 28px;
} z-index: 1;
.el-input--suffix .el-input__inner { }
padding: 0 4px 0 28px; .el-input__suffix {
} display: none;
.el-input--small .el-input__inner { }
height: 28px; .el-input--suffix .el-input__inner {
border: none; padding: 0 4px 0 28px;
font-weight: 600; }
} .el-input--small .el-input__inner {
} height: 28px;
.labelClass { border: none;
width: 100%; font-weight: 600;
height: 28px; }
border: none; }
padding: 0; .labelClass {
font-weight: 600; width: 100%;
text-align: center; height: 28px;
} border: none;
} padding: 0;
.class1 { font-weight: 600;
.selectDiv { text-align: center;
.toggle-icon, .toggle-icon-hide { }
background-color: #FACE00; }
} .class1 {
.el-input--small .el-input__inner { .selectDiv {
color: #E7A200; .toggle-icon,
background-color: #FFEFC0; .toggle-icon-hide {
} background-color: #face00;
} }
.labelClass { .el-input--small .el-input__inner {
color: #E7A200; color: #e7a200;
background-color: #FFEFC0; background-color: #ffefc0;
} }
} }
.class2 { .labelClass {
.selectDiv { color: #e7a200;
.toggle-icon, .toggle-icon-hide { background-color: #ffefc0;
background-color: #3984FF; }
} }
.el-input--small .el-input__inner { .class2 {
color: #2D7BFF; .selectDiv {
background-color: #BEEAFF; .toggle-icon,
} .toggle-icon-hide {
} background-color: #3984ff;
.labelClass { }
color: #2D7BFF; .el-input--small .el-input__inner {
background-color: #BEEAFF; color: #2d7bff;
} background-color: #beeaff;
} }
.class3 { }
.selectDiv { .labelClass {
.toggle-icon, .toggle-icon-hide { color: #2d7bff;
background-color: #37D97F; background-color: #beeaff;
} }
.el-input--small .el-input__inner { }
color: #129F51; .class3 {
background-color: #E0FFEE; .selectDiv {
} .toggle-icon,
} .toggle-icon-hide {
.labelClass { background-color: #37d97f;
color: #129F51; }
background-color: #E0FFEE; .el-input--small .el-input__inner {
} color: #129f51;
} background-color: #e0ffee;
} }
}
.labelClass {
color: #129f51;
background-color: #e0ffee;
}
}
}
} }
</style> </style>

View File

@ -0,0 +1,260 @@
<!--
* @Author: zwq
* @Date: 2024-07-10 13:43:41
* @LastEditors: zwq
* @LastEditTime: 2024-07-15 16:00:36
* @Description:
-->
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="部门名称" prop="deptId">
<el-select
v-model="form.deptId"
filterable
clearable
style="width: 100%"
placeholder="请选择部门">
<el-option
v-for="item in deptArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计划名称" prop="name">
<el-input v-model="form.name" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="相关班组" prop="teamIdList">
<el-select
v-model="form.teamIdList"
filterable
clearable
multiple
style="width: 100%"
placeholder="请选择班组">
<el-option
v-for="item in teamList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="相关班次" prop="classesIdList">
<el-select
v-model="form.classesIdList"
filterable
clearable
multiple
style="width: 100%"
placeholder="请选择班次">
<el-option
v-for="item in classList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否生产班组" prop="isProduction">
<el-radio-group v-model="form.isProduction">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24" v-show="form.isProduction">
<tree-transfer
:title="title"
:from_data="fromData"
:to_data="toData"
@add-btn="add"
@remove-btn="remove"
pid="productionLineId"
:defaultProps="{ label: 'name' }"
height="450px"
:mode="mode"
filter
openAll></tree-transfer>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
getGroupPlan,
updateGroupPlan,
createGroupPlan,
getGroupPlanTree,
createGroupPlanLine,
updateGroupPlanLine,
getGroupPlanLine,
getLoginUserDeptId,
} from '@/api/base/groupSchedulingPlan';
import { listDept } from '@/api/system/dept';
import { listEnabled } from '@/api/base/groupTeam';
import { listClassesEnabled } from '@/api/base/groupClasses';
import treeTransfer from 'el-tree-transfer';
export default {
components: { treeTransfer },
name: '',
data() {
return {
form: {
id: '',
name: '',
deptId: '',
teamIdList: [],
classesIdList: [],
remark: '',
isProduction: false,
},
deptArr: [], //
teamList: [], //
classList: [], //
rules: {
name: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
deptId: [{ required: true, message: '请选择部门', trigger: 'change' }],
teamIdList: [
{ required: true, message: '请选择相关班组', trigger: 'change' },
],
classesIdList: [
{ required: true, message: '请选择相关班次', trigger: 'change' },
],
},
title: ['待选', '已选'], // Array false ["", ""]
mode: 'transfer',
fromData: [], //
toData: [], //
};
},
methods: {
init(id) {
this.form.id = id || undefined;
this.fromData = [];
this.toData = [];
this.getArr();
this.$nextTick(() => {
this.$refs['form'].resetFields();
if (this.form.id) {
getGroupPlan(id).then((response) => {
this.form = response.data;
if (this.form.isProduction) {
getGroupPlanLine(id).then((res) => {
this.toData = res.data ? res.data.datas : [];
this.getFilterLeftData(this.fromData, this.toData); //bug
});
}
});
} else {
getLoginUserDeptId().then((res) => {
this.form.deptId = res.data;
});
}
});
},
getArr() {
listDept().then((response) => {
this.deptArr = response.data;
});
listEnabled().then((res) => {
this.teamList = res.data || [];
});
listClassesEnabled().then((res) => {
this.classList = res.data || [];
});
getGroupPlanTree().then((res) => {
this.fromData = res.data;
this.fromData.forEach((item) => {
item.productionLineId = 0;
});
});
},
// 穿
add(fromData, toData, obj) {
console.log('fromData:', fromData);
console.log('toData:', toData);
},
// 穿
remove(fromData, toData, obj) {
console.log('fromData:', fromData);
console.log('toData:', toData);
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.id) {
//
updateGroupPlan({ ...this.form }).then((res) => {
if (res.code === 0) {
if (this.form.isProduction) {
const params = {
planId: this.form.id,
list: this.toData,
};
updateGroupPlanLine(params).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
}
}
});
} else {
createGroupPlan({ ...this.form }).then((res) => {
if (res.code === 0) {
if (this.form.isProduction) {
const params = {
planId: res.data,
list: this.toData,
};
createGroupPlanLine(params).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
}
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
},
/** 消除组件左边与右边选中数据相同项 */
//
getFilterLeftData(data, selData) {
for (let i = data.length - 1; i >= 0; i--) {
for (let j = selData.length - 1; j >= 0; j--) {
if (data[i] && data[i].id === selData[j].id) {
// id
if (!data[i].children) {
data.splice(i, 1);
} else {
this.getFilterLeftData(data[i].children, selData[j].children);
}
}
}
}
},
},
};
</script>

View File

@ -0,0 +1,233 @@
<!--
* @Author: zwq
* @Date: 2024-07-10 11:08:48
* @LastEditors: zwq
* @LastEditTime: 2024-07-12 16:19:28
* @Description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<schedulingPlanConfigAdd ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import {
getGroupPlanPage,
deleteGroupPlan,
} from '@/api/base/groupSchedulingPlan';
import { listDept } from '@/api/system/dept';
import schedulingPlanConfigAdd from './components/schedulingPlanConfigAdd.vue';
const tableProps = [
{
prop: 'deptName',
label: '部门名称',
},
{
prop: 'name',
label: '计划名称',
},
{
prop: 'str',
label: '产线及工段',
minWidth: 200,
},
{
prop: 'teamName',
label: '班组名称',
},
{
prop: 'classesName',
label: '班次名称',
},
];
export default {
name: 'schedulingPlanConfig',
components: { schedulingPlanConfigAdd },
data() {
return {
formConfig: [
{
type: 'select',
label: '部门名称',
selectOptions: [],
param: 'deptId',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '计划名称',
placeholder: '计划名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-scheduling-plan:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-scheduling-plan:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-plan:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
listDept().then((response) => {
this.formConfig[0].selectOptions = response.data;
});
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name || undefined;
this.queryParams.deptId = val.deptId || undefined;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.classList.init();
});
}
},
/** 查询列表 */
getList() {
getGroupPlanPage(this.queryParams).then((res) => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) {
res.data.list.forEach(item => {
if(item.isProduction){
item.str = item.strList?item.strList.join(','):'-'
}
});
this.list = res.data.list;
this.total = res.data.total;
} else {
this.list = [];
this.total = 0;
}
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.classList.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.classList.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.classList.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
let _this = this;
_this.$modal
.confirm('是否确认删除名称为"' + row.name + '"的数据项?')
.then(function () {
return deleteGroupPlan(row.id);
})
.then(() => {
_this.getList();
_this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,280 @@
<!--
* @Author: zwq
* @Date: 2024-07-11 09:30:21
* @LastEditors: zwq
* @LastEditTime: 2024-07-12 16:09:46
* @Description:
-->
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="排班开始日期" prop="startDay">
<el-date-picker
v-model="form.startDay"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排班结束日期" prop="endDay">
<el-date-picker
v-model="form.endDay"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排班计划" prop="planId">
<el-select
v-model="form.planId"
filterable
clearable
@change="setTableArr"
style="width: 100%"
placeholder="请选择排班计划">
<el-option
v-for="item in planArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<div class="min-title">班组上班顺序</div>
<base-table
border
:table-props="tableProps"
:table-data="tableData"
:page="1"
:limit="100"
:height="300"
@emitButtonClick="addNew"
@emitFun="inputChange"
:add-button-show="addButtonShow">
<method-btn
slot="handleBtn"
:width="60"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
getGroupRule,
updateGroupRule,
createGroupRule,
} from '@/api/base/groupSchedulingRule';
import {
groupPlanList,
groupPlanTeamList,
groupPlanClassesList,
} from '@/api/base/groupSchedulingPlan';
import tableSelect from './tableSelect';
const tableBtn = [
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'classesId',
label: '班次',
classesArr: [],
subcomponent: tableSelect,
},
{
prop: 'teamId',
label: '班组',
teamArr: [],
subcomponent: tableSelect,
},
];
export default {
name: 'schedulingRuleConfigAdd',
data() {
return {
form: {
id: '',
startDay: '',
endDay: '',
planId: '',
remark: '',
},
tableBtn,
tableProps,
tableData: [],
addButtonShow: '',
planArr: [], //
rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
startDay: [
{ required: true, message: '请选择排班开始时间', trigger: 'change' },
],
endDay: [
{ required: true, message: '请选择排班结束时间', trigger: 'change' },
],
},
};
},
methods: {
init(id) {
this.form = {
id: id || undefined,
startDay: '',
endDay: '',
planId: '',
remark: '',
};
this.getArr();
this.tableData = [];
this.$nextTick(() => {
this.$refs['form'].resetFields();
if (this.form.id) {
getGroupRule(id).then((response) => {
this.form = response.data;
this.getTableArr(response.data.planId);
this.tableData = [];
});
}
});
},
getArr() {
groupPlanList().then((res) => {
this.planArr = res.data || [];
});
},
setTableArr() {
if (this.form.planId) {
this.tableData = [];
this.getTableArr(this.form.planId);
} else {
this.tableData = [];
this.addButtonShow = '';
}
},
async getTableArr(id) {
//
this.addButtonShow = '新增';
const res0 = await groupPlanClassesList(id);
this.tableProps[0].classesArr = res0.data || [];
const res1 = await groupPlanTeamList(id);
this.tableProps[1].teamArr = res1.data || [];
if (this.form.id) {
//
this.form.sequenceList.forEach((item) => {
this.tableData.push(item);
});
}
},
inputChange(data) {
this.tableData[data._pageIndex - 1][data.prop] = data[data.prop];
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
this.tableData.splice(raw.data._pageIndex - 1, 1);
this.tableData.forEach((item, index) => {
item.sequence = index;
});
console.log(this.tableData);
})
.catch(() => {});
}
},
//
addNew() {
this.tableData.push({ sequence: this.tableData.length });
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.id) {
//
let list = [];
this.tableData.forEach((item) => {
const obj = {
classesId: item.classesId,
sequence: item.sequence,
teamId: item.teamId,
};
list.push(obj);
});
this.form.list = list;
updateGroupRule({ ...this.form }).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
} else {
let list = [];
this.tableData.forEach((item) => {
const obj = {
classesId: item.classesId,
sequence: item.sequence,
teamId: item.teamId,
};
list.push(obj);
});
this.form.list = list;
createGroupRule({ ...this.form }).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
},
},
};
</script>
<style scoped>
.min-title {
margin-bottom: 5px;
}
.min-title::before {
content: '';
display: inline-block;
vertical-align: middle;
width: 6px;
height: 6px;
border-radius: 50%;
margin: auto 5px;
background-color: #0b58ff;
}
</style>

View File

@ -0,0 +1,44 @@
<template>
<div class="tableInner">
<el-select :key="itemProp+list._pageIndex" v-model="list[itemProp]" @change="changeInput">
<el-option
v-for="item in itemProp==='classesId'?list.classesArr:list.teamArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</div>
</template>
<script>
export default {
name: 'tableSelect',
props: {
injectData: {
type: Object,
default: () => ({}),
},
itemProp: {
type: String,
},
},
data() {
return {
list: this.injectData,
};
},
methods: {
changeInput() {
this.$emit('emitData', this.list);
},
},
};
</script>
<style scoped>
.tableInner >>> .el-input__inner {
color: #409EFF;
border: 1px rgb(232, 231, 231) solid;
padding: 0;
text-align: center;
height: 30px;
}
</style>

View File

@ -0,0 +1,261 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<schedulingRuleConfigAdd ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import {
getGroupRulePage,
deleteGroupRule,
updateGroupRule,
getGroupRule,
} from '@/api/base/groupSchedulingRule';
import schedulingRuleConfigAdd from './components/schedulingRuleConfigAdd.vue';
import { formatDate } from '@/utils';
const tableProps = [
{
prop: 'enableTimeStr',
label: '排班日期',
minWidth: 200,
},
{
prop: 'planName',
label: '排班计划',
},
{
prop: 'str',
label: '排班规则',
minWidth: 100,
},
{
prop: 'enabled',
label: '状态',
filter: (val) => (val ? '正常' : '作废'),
},
];
export default {
name: 'schedulingRuleConfig',
components: { schedulingRuleConfigAdd },
data() {
return {
formConfig: [
{
type: 'input',
label: '班次',
placeholder: '班次',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-scheduling-rule:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-scheduling-rule:cancel')
? {
type: 'cancel',
btnName: '作废',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'enabled',
value: 0,
},
],
},
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-rule:update')
? {
type: 'edit',
btnName: '编辑',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'enabled',
value: 0,
},
],
},
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-rule:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.classesName = val.name || undefined;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.classList.init();
});
}
},
/** 查询列表 */
getList() {
getGroupRulePage(this.queryParams).then((res) => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) {
res.data.list.map((item) => {
item.enableTimeStr =
formatDate(item.startDay) +
'至' +
(item.endDay ? formatDate(item.endDay) : '永久');
item.str = item.strList.join(',');
});
this.list = res.data.list;
this.total = res.data.total;
} else {
this.list = [];
this.total = 0;
}
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.classList.init(val.data.id);
});
this.centervisible = true;
break;
case 'cancel':
this.discard(val.data);
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.classList.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.classList.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
discard(row) {
let _this = this
this.$modal
.confirm('是否确认作废序号为"' + row._pageIndex + '"的数据项?')
.then(() => {
getGroupRule(row.id).then((response) => {
let datas = response.data;
datas.list = datas.sequenceList;
datas.enabled = 0;
updateGroupRule(datas).then(() => {
_this.getList();
_this.$modal.msgSuccess('操作成功');
});
});
})
.catch(() => {});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除序号为"' + row._pageIndex + '"的数据项?')
.then(function () {
return deleteGroupRule(row.id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -36,8 +36,8 @@ export default {
minWidth: 150 minWidth: 150
}, },
{ {
prop: 'workOrderList', prop: 'specifications',
label: '生产工单' label: '产品规格'
} }
], ],
tableData: [], tableData: [],
@ -147,8 +147,8 @@ export default {
minWidth: 150 minWidth: 150
}, },
{ {
prop: 'workOrderList', prop: 'specifications',
label: '生产工单' label: '产品规格'
} }
] ]
} }

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: zwq
* @LastEditTime: 2023-11-16 09:14:35 * @LastEditTime: 2024-07-03 14:19:01
* @Description: * @Description:
--> -->
<template> <template>
@ -105,7 +105,7 @@
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder'; import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder';
import SmallTitle from '../material/SmallTitle'; import SmallTitle from '../coreWorkOrder/SmallTitle';
// import { parseTime } from '../../core/mixins/code-filter'; // import { parseTime } from '../../core/mixins/code-filter';
// import attrAdd from './attr-add'; // import attrAdd from './attr-add';

View File

@ -1,459 +1,223 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: zwq
* @LastEditTime: 2023-11-27 15:26:12 * @LastEditTime: 2024-07-08 16:52:34
* @Description: * @Description:
--> -->
<template> <template>
<el-drawer <el-form
:visible.sync="visible" :model="dataForm"
:show-close="false" :rules="dataRule"
:wrapper-closable="isdetail" ref="dataForm"
class="drawer" @keyup.enter.native="dataFormSubmit()"
size="60%"> label-width="100px"
<small-title slot="title" :no-padding="true"> label-position="top">
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }} <el-row :gutter="20">
</small-title> <el-col :span="8">
<div class="content"> <el-form-item label="物料产品名称" prop="name">
<div class="visual-part"> <el-input
<el-form v-model="dataForm.name"
:model="dataForm" clearable
:rules="dataRule" placeholder="请输入物料产品名称" />
ref="dataForm" </el-form-item>
@keyup.enter.native="dataFormSubmit()" </el-col>
label-width="100px" <el-col :span="8">
label-position="top"> <el-form-item label="物料产品编码" prop="code">
<el-row :gutter="20"> <el-input
<el-col :span="12"> v-model="dataForm.code"
<el-form-item label="物料编码" prop="code"> clearable
<el-input placeholder="请输入物料产品编码" />
v-model="dataForm.code" </el-form-item>
clearable </el-col>
:disabled="isdetail" <el-col :span="8">
placeholder="请输入物料编码" /> <el-form-item label="物料产品类型" prop="typeId">
</el-form-item> <treeselect
</el-col> v-model="dataForm.typeId"
<el-col :span="12"> :options="deptOptions"
<el-form-item label="物料名称" prop="name"> :normalizer="normalizer"
<el-input v-model="dataForm.name" :disabled="isdetail" clearable placeholder="请输入物料名称" /> @select="setShowTime"
</el-form-item> :show-count="true"
</el-col> :appendToBody="true"
</el-row> z-index="99999"
<el-row :gutter="20"> placeholder="选择物料产品类型" />
<el-col :span="12"> </el-form-item>
<el-form-item label="英文名称" prop="engName"> </el-col>
<el-input <el-col :span="8">
v-model="dataForm.engName" <el-form-item label="单位" prop="unit">
clearable <el-select
:disabled="isdetail" v-model="dataForm.unit"
placeholder="请输入英文名称" /> filterable
</el-form-item> style="width: 100%"
</el-col> placeholder="请选择单位">
<el-col :span="12"> <el-option
<el-form-item label="物料类型" prop="type"> v-for="dict in getDictDatas(DICT_TYPE.UNIT_DICT)"
<el-select :key="dict.value"
v-model="dataForm.type" :label="dict.label"
filterable :value="dict.value" />
:disabled="isdetail" </el-select>
style="width: 100%" </el-form-item>
placeholder="请选择物料类型"> </el-col>
<el-option <el-col :span="8">
v-for="dict in materialList" <el-form-item label="规格" prop="specifications">
:key="dict.value" <el-input
:label="dict.label" v-model="dataForm.specifications"
:value="dict.value" /> clearable
</el-select> placeholder="请输入规格" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> <el-col :span="8">
<el-row :gutter="20"> <el-form-item label="供应商" prop="supplierId">
<el-col :span="12"> <el-select
<el-form-item label="规格" prop="spec"> v-model="dataForm.supplierId"
<el-input filterable
v-model="dataForm.spec" clearable
clearable :style="{ width: '100%' }"
:disabled="isdetail" placeholder="请选择供应商">
placeholder="请输入规格" /> <el-option
</el-form-item> v-for="item in supplierArr"
</el-col> :key="item.id"
<el-col :span="12"> :label="item.name"
<el-form-item label="供应商" prop="supplierId"> :value="item.id"></el-option>
<el-select </el-select>
v-model="dataForm.supplierId" </el-form-item>
filterable </el-col>
clearable <el-col :span="8" v-if="showTime">
:disabled="isdetail" <el-form-item label="生产单位用时" prop="processTime">
style="width: 100%" <el-input
placeholder="请选择供应商"> v-model.number="dataForm.processTime"
<el-option type="number"
v-for="dict in supplierList" clearable
:key="dict.id" placeholder="请输入产线生产单位用时" />
:label="dict.name" </el-form-item>
:value="dict.id" /> </el-col>
</el-select> <el-col :span="8">
</el-form-item> <el-form-item label="备注" prop="remark">
</el-col> <el-input
</el-row> v-model="dataForm.remark"
<el-row :gutter="20"> clearable
<el-col :span="12"> placeholder="请输入备注" />
<el-form-item label="单位" prop="unit"> </el-form-item>
<el-select </el-col>
v-model="dataForm.unit" </el-row>
filterable </el-form>
:disabled="isdetail"
style="width: 100%"
placeholder="请选择物料单位">
<el-option
v-for="dict in getDictDatas('unit_dict')"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
物料属性
</small-title>
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
</span>
</template>
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="materialAttrList">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</div>
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:material-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template> </template>
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { createMaterial, updateMaterial, getMaterial, getCode, getSupplierList, getMaterialAttrList, deleteMaterialAttr } from "@/api/base/material"; import { getTreeArr } from '../mixins/code-filter';
import { listData } from "@/api/system/dict/data"; import {
import SmallTitle from './SmallTitle'; createProductMaterial,
import { parseTime } from '../../core/mixins/code-filter'; updateProductMaterial,
import attrAdd from './attr-add'; getProductMaterial,
import { getDictDatas } from "@/utils/dict"; getProductMaterialCode,
getSupplierList,
const tableBtn = [ getMaterialTree,
{ } from '@/api/base/material';
type: 'edit', import Treeselect from '@riophae/vue-treeselect';
btnName: '编辑', import '@riophae/vue-treeselect/dist/vue-treeselect.css';
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
},
{
prop: 'attrName',
label: '属性名',
},
{
prop: 'attrValue',
label: '属性值',
},
];
export default { export default {
mixins: [basicAdd], mixins: [basicAdd],
components: { SmallTitle, attrAdd }, components: {
Treeselect,
},
data() { data() {
return { return {
tableBtn,
tableProps,
addOrUpdateVisible: false,
urlOptions: { urlOptions: {
isGetCode: true, isGetCode: true,
codeURL: getCode, codeURL: getProductMaterialCode,
createURL: createMaterial, createURL: createProductMaterial,
updateURL: updateMaterial, updateURL: updateProductMaterial,
infoURL: getMaterial, infoURL: getProductMaterial,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
}, },
deptOptions: undefined,
showTime: false,
dataForm: { dataForm: {
id: undefined, id: undefined,
code: undefined, code: undefined,
name: '', name: '',
engName: '', typeId: undefined,
type: '', unit: undefined,
spec: undefined, specifications: undefined,
supplierId: undefined, supplierId: undefined,
remark: undefined, processTime: 0,
unit: '' remark: undefined,
}, },
materialList: [], supplierArr: [],
supplierList: [], treeArr: [],
materialAttrList: [],
unitList: [],
visible: false,
isdetail: false,
idAttrShow: false,
dataRule: { dataRule: {
code: [{ required: true, message: "物料编码不能为空", trigger: "blur" }], code: [{ required: true, message: '编号不能为空', trigger: 'blur' }],
name: [{ required: true, message: "物料名称不能为空", trigger: "blur" }], name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
type: [{ required: true, message: "物料类型不能为空", trigger: "blur" }] typeId: [
} {
required: true,
message: '物料产品类型不能为空',
trigger: 'blur',
},
],
},
}; };
}, },
mounted() { mounted() {},
this.getDict()
},
methods: { methods: {
async getDict() { init(id) {
// this.dataForm.id = id || '';
const res = await listData({
pageNo: 1,
pageSize: 99,
dictType: 'material_type',
});
this.materialList = res.data.list.map(item => {
return {
label: item.label,
value: Number(item.value)
}
});
//
const supplierRes = await getSupplierList();
this.supplierList = supplierRes.data;
//
// const unitRes = await listData({
// pageNo: 1,
// pageSize: 99,
// dictType: 'goods_unit',
// });
// this.unitList = unitRes.data.list.map(item => {
// return {
// label: item.label,
// value: Number(item.value)
// }
// });
},
initData() {
this.materialAttrList.splice(0);
this.listQuery.total = 0;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`是否确认删除属性名为"${raw.data.attrName}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteMaterialAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
getMaterialAttrList({
...this.listQuery,
materialId: this.dataForm.id,
}).then((response) => {
this.materialAttrList = response.data.list;
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true; this.visible = true;
if (id) {
this.idAttrShow = true
} else {
this.idAttrShow = false
}
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields(); this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
// this.urlOptions.infoURL(id).then((response) => {
this.urlOptions.infoURL(id).then(response => { this.dataForm = response.data;
this.dataForm = response.data; this.setDataForm();
if (this.dataForm.unit) { });
this.dataForm.unit = String(this.dataForm.unit)
}
});
//
this.getList();
} else { } else {
if (this.urlOptions.isGetCode) { if (this.urlOptions.isGetCode) {
this.getCode() this.getCode();
} this.setDataForm();
}
} }
}); });
}, },
// typeId(typeId, product) {
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false
this.$emit("refreshDataList");
});
return;
}
//
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.idAttrShow = true
this.$emit("refreshDataList");
});
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id); this.dataForm.typeId = typeId || undefined;
this.showTime = product || false;
}); });
} },
} setDataForm() {
getSupplierList().then((res) => {
this.supplierArr = res.data;
});
//
getMaterialTree().then((response) => {
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id'));
this.$nextTick(() => {
if (this.dataForm.id) {
this.treeArr = [];
this.treeArr = getTreeArr(response.data);//
this.showTime = this.treeArr.find(
(item) => item.id == this.dataForm.typeId
).product;
}
});
});
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
setShowTime(node) {
this.showTime = node.product || false;
},
},
}; };
</script> </script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: -40px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
</style>

View File

@ -1,32 +1,135 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2024-07-08 15:12:18
* @Description:
-->
<template> <template>
<div class="app-container"> <div style="display: flex; gap: 16px; flex: 1; background: #eff1f6">
<search-bar <div
:formConfigs="formConfig" class="app-container"
ref="searchBarForm" style="background: white; width: 280px; border-radius: 8px">
@headBtnClick="buttonClick" /> <div class="head-container">
<base-table <el-input
v-loading="dataListLoading" v-model="treeName"
:table-props="tableProps" placeholder="请输入名称"
:page="listQuery.pageNo" clearable
:limit="listQuery.pageSize" size="small"
:table-data="tableData"> prefix-icon="el-icon-search"
<method-btn style="margin-bottom: 20px" />
v-if="tableBtn.length" </div>
slot="handleBtn" <div class="head-container">
:width="120" <el-tree
label="操作" v-loading="treeLoading"
:method-list="tableBtn" element-loading-text="拼命加载中"
@clickBtn="handleClick" /> element-loading-spinner="el-icon-loading"
</base-table> element-loading-background="rgba(0, 0, 0, 0.8)"
<pagination :data="deptOptions1"
:limit.sync="listQuery.pageSize" :props="defaultProps"
:page.sync="listQuery.pageNo" node-key="id"
:total="listQuery.total" :expand-on-click-node="false"
@pagination="getDataList" /> :filter-node-method="filterNode"
<add-or-update ref="tree"
v-if="addOrUpdateVisible" default-expand-all
ref="addOrUpdate" highlight-current
@refreshDataList="getDataList" /> @node-click="handleNodeClick">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span style="float: right" v-if="data.parentId !== -1">
<el-button
class="btnHover"
type="text"
icon="el-icon-edit"
size="mini"
v-if="data.parentId !== 0"
@click="() => edit(node, data)" />
<el-button
class="btnHover"
type="text"
icon="el-icon-circle-plus-outline"
size="mini"
@click="() => append(data)" />
<el-button
class="btnHover"
type="text"
icon="el-icon-remove-outline"
size="mini"
v-if="data.parentId !== 0"
@click="() => remove(node, data)" />
</span>
</span>
</el-tree>
</div>
</div>
<div
class="app-container"
style="background: #fff; border-radius: 8px; width: 1px; flex: 1">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
<!-- 添加或修改菜单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="父类型">
<treeselect
v-model="form.parentId"
:options="deptOptions"
:normalizer="normalizer"
:show-count="true"
:appendToBody="true"
z-index="99999"
placeholder="选择父类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -34,97 +137,129 @@
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from '../../core/mixins/basic-page'; import basicPage from '../../core/mixins/basic-page';
import { parseTime } from '../../core/mixins/code-filter'; import { parseTime } from '../../core/mixins/code-filter';
import {
getMaterialPage,
deleteMaterial
} from '@/api/base/material';
import { listData } from "@/api/system/dict/data";
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import {
getProductMaterialPage,
deleteProductMaterial,
getMaterialTree,
createMaterialTree,
updateMaterialTree,
deleteMaterialTree,
} from '@/api/base/material';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
filter: parseTime filter: parseTime,
}, width: 150,
{
prop: 'code',
label: '物料编码'
}, },
{ {
prop: 'name', prop: 'name',
label: '物料名称' label: '物料产品名称',
}, },
{ {
prop: 'engName', prop: 'code',
label: '英文名称' label: '物料产品编码',
}, },
{ {
prop: 'type', prop: 'typeNameChain',
label: '物料类型', label: '物料产品类型',
filter: publicFormatter('material_type') },
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
width: 60,
},
{
prop: 'specifications',
label: '规格',
}, },
{ {
prop: 'supplierName', prop: 'supplierName',
label: '供应商' label: '供应商',
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注' label: '备注',
} },
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage],
name: '',
components: {
AddOrUpdate,
Treeselect,
},
data() { data() {
return { return {
//
treeName: undefined,
deptOptions: undefined,
deptOptions1: undefined,
treeLoading: false,
defaultProps: {
children: 'children',
label: 'name',
},
//
title: '',
//
open: false,
//
form: {
id: undefined,
parentId: undefined,
name: undefined,
defaultType: false,
},
//
rules: {
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
urlOptions: { urlOptions: {
getDataListURL: getMaterialPage, getDataListURL: getProductMaterialPage,
deleteURL: deleteMaterial deleteURL: deleteProductMaterial,
// exportURL: exportFactoryExcel,
}, },
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`base:material:queryAttr`) this.$auth.hasPermi(`base:core-product:update`)
? {
type: 'detail',
btnName: '查看属性',
}
: undefined,
this.$auth.hasPermi(`base:material:update`)
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',
} }
: undefined, : undefined,
// this.$auth.hasPermi(`base:material:editAttr`) this.$auth.hasPermi(`base:core-product:delete`)
// ? {
// type: 'editAttr',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi(`base:material:delete`)
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
} }
: undefined, : undefined,
].filter((v)=>v), ].filter((v) => v),
tableData: [], tableData: [],
typeList: [],
formConfig: [ formConfig: [
{ {
type: 'input', type: 'input',
label: '物料名称', label: '物料产品名称',
placeholder: '物料名称', placeholder: '物料产品名称',
param: 'name', param: 'name',
}, },
{ {
type: 'input', type: 'input',
label: '物料编码', label: '物料产品编号',
placeholder: '物料编码', placeholder: '物料产品编号',
param: 'code', param: 'code',
}, },
{
type: 'input',
label: '物料产品类型',
param: 'type',
disabled: true,
},
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -139,63 +274,43 @@ export default {
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true,
}, },
], ],
}; };
}, },
components: { watch: {
AddOrUpdate, //
treeName(val) {
this.$refs.tree.filter(val);
},
}, },
created() { created() {
this.getDict() this.getDataList();
this.getTreeselect();
}, },
methods: { methods: {
async getDict() { //
// deleteHandle(id, name, index) {
const res = await listData({ this.$confirm(`是否确认删除物料产品名称为"${name}"的数据项`, '提示', {
pageNo: 1, confirmButtonText: '确定',
pageSize: 99, cancelButtonText: '取消',
dictType: 'material_type', type: 'warning',
}); })
this.typeList = res.data.list.map(item => { .then(() => {
return { this.urlOptions.deleteURL(id).then(({ data }) => {
label: item.label, this.$message({
value: Number(item.value) message: '操作成功',
} type: 'success',
}); duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => {});
}, },
otherMethods(val) {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
} else {
this.addOrEditTitle = '编辑';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
}
},
//
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.records.map(item => {
this.typeList.filter(t => {
if (item.type === t.value) {
item.materialType = t.label
}
})
return item
});
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
@ -205,19 +320,13 @@ export default {
this.listQuery.code = val.code ? val.code : undefined; this.listQuery.code = val.code ? val.code : undefined;
this.getDataList(); this.getDataList();
break; break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add': case 'add':
this.addOrEditTitle = '新增'; this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.addOrUpdateHandle(); this.$nextTick(() => {
this.$refs.addOrUpdate.init();
this.$refs.addOrUpdate.typeId(this.listQuery.typeId,this.listQuery.product);
});
break; break;
case 'export': case 'export':
this.handleExport(); this.handleExport();
@ -226,27 +335,126 @@ export default {
console.log(val); console.log(val);
} }
}, },
//
deleteHandle(id, name, index) { /** 树操作 */
this.$confirm(`是否删除物料名称为"${name}"的数据项?`, "提示", {
confirmButtonText: "确定", //
cancelButtonText: "取消", getTreeselect() {
type: "warning", this.treeLoading = true;
}) getMaterialTree().then((response) => {
.then(() => { // treeArr[0].push(...this.handleTree(response.data, 'id'));
this.urlOptions.deleteURL(id).then(({ data }) => { // deptOptions
this.$message({ this.deptOptions = [];
message: "操作成功", this.treeLoading = false;
type: "success", this.deptOptions.push(...this.handleTree(response.data, 'id'));
duration: 1500, const arr = [{ name: '全部', parentId: -1 }];
onClose: () => { this.deptOptions1 = arr.concat(this.deptOptions);
this.getDataList(); });
}, },
}); //
}); filterNode(value, data) {
}) if (!value) return true;
.catch(() => { }); return data.name.indexOf(value) !== -1;
} },
//
handleNodeClick(data) {
this.listQuery.typeId = data.id || undefined;
this.listQuery.product = data.product;
this.$refs.searchBarForm.formInline.type = data.name || undefined;
},
//
append(data) {
this.open = true;
this.title = '新增物料产品类型';
this.form.id = undefined;
this.form.parentId = data.id;
},
//
remove(node, data) {
this.$confirm(`是否确认删除名称为"${data.name}"的数据项`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
deleteMaterialTree(data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getTreeselect();
},
});
});
})
.catch(() => {});
},
//
edit(node, data) {
this.open = true;
this.title = '编辑物料产品类型';
this.form.id = data.id;
this.form.name = data.name;
this.form.parentId = data.parentId;
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
parentId: 0,
name: undefined,
defaultType: false,
};
this.resetForm('form');
},
//
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.form.id) {
updateMaterialTree(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.cancel();
this.getTreeselect();
});
return;
}
//
createMaterialTree(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.cancel();
this.getTreeselect();
});
});
},
}, },
}; };
</script> </script>
<style scoped>
.btnHover:hover {
color: #67c23a;
transform: scale(1.5);
}
</style>

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: zwq
* @LastEditTime: 2023-11-27 19:50:36 * @LastEditTime: 2024-07-09 09:59:11
* @Description: * @Description:
--> -->
<template> <template>
@ -107,10 +107,9 @@
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { createMaterialPB, updateMaterialPB, getMaterialPB, getCode, getProList, getProBomList, createMaterialPBDet, updateMaterialPBDet, deleteMaterialPBDet } from "@/api/base/materialProductBom"; import { createMaterialPB, updateMaterialPB, getMaterialPB, getCode, getProBomList, createMaterialPBDet, updateMaterialPBDet, deleteMaterialPBDet } from "@/api/base/materialProductBom";
import { getMaterialList } from "@/api/base/material"; import { getMaterialTree,getMaterialList } from '@/api/base/material';
import { listData } from "@/api/system/dict/data"; import SmallTitle from '../coreWorkOrder/SmallTitle';
import SmallTitle from '../material/SmallTitle';
import { parseTime } from '../../core/mixins/code-filter'; import { parseTime } from '../../core/mixins/code-filter';
import attrAdd from './attr-add'; import attrAdd from './attr-add';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
@ -183,7 +182,6 @@ export default {
productList: [], productList: [],
materialAttrList: [], materialAttrList: [],
tableData: [], tableData: [],
unitList: [],
visible: false, visible: false,
isdetail: false, isdetail: false,
idAttrShow: false, idAttrShow: false,
@ -229,21 +227,14 @@ export default {
}); });
}, },
async getDict() { async getDict() {
// const materRes = await getMaterialTree();
const proRes = await getProList(); let typeId = materRes.data[0].product?materRes.data[0].id:materRes.data[1].id
this.productList = proRes.data; const listQuery= {
// typeId:typeId
const unitRes = await listData({ }
pageNo: 1, const materData = await getMaterialList(listQuery);
pageSize: 99, this.productList = [];
dictType: 'unit_dict', this.productList = materData.data;
});
this.unitList = unitRes.data.list.map(item => {
return {
label: item.label,
value: Number(item.value)
}
});
}, },
initData() { initData() {
// this.materialAttrList.splice(0); // this.materialAttrList.splice(0);

View File

@ -83,7 +83,7 @@
</template> </template>
<script> <script>
import { getMaterialList } from '@/api/base/material'; import { getMaterialTree,getMaterialList } from '@/api/base/material';
import { createMaterialPBDet, updateMaterialPBDet, getMaterialPBDet } from "@/api/base/materialProductBom"; import { createMaterialPBDet, updateMaterialPBDet, getMaterialPBDet } from "@/api/base/materialProductBom";
export default { export default {
@ -117,8 +117,14 @@ export default {
methods: { methods: {
async getDict() { async getDict() {
// //
const res = await getMaterialList(); const materRes = await getMaterialTree();
this.materialList = res.data; let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id
const listQuery= {
typeId:typeId
}
const materData = await getMaterialList(listQuery);
this.materialList = [];
this.materialList = materData.data;
}, },
init(id) { init(id) {
this.dataForm.id = id || ''; this.dataForm.id = id || '';

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: zwq
* @LastEditTime: 2023-11-27 19:57:23 * @LastEditTime: 2024-07-09 09:58:24
* @Description: * @Description:
--> -->
<template> <template>
@ -22,8 +22,7 @@
clearable clearable
filterable filterable
@change="setCode" @change="setCode"
style="width: 100%" style="width: 100%">
>
<el-option <el-option
v-for="dict in materialList" v-for="dict in materialList"
:key="dict.id" :key="dict.id"
@ -42,14 +41,13 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="批次" prop="materialDateId"> <el-form-item label="物料批次" prop="materialDateId">
<el-select <el-select
v-model="dataForm.materialDateId" v-model="dataForm.materialDateId"
clearable clearable
filterable filterable
placeholder="请选择物料批次" placeholder="请选择物料批次"
style="width: 100%" style="width: 100%">
>
<el-option <el-option
v-for="dict in materialDateList" v-for="dict in materialDateList"
:key="dict.id" :key="dict.id"
@ -81,8 +79,8 @@
<el-date-picker <el-date-picker
v-model="dataForm.useTime" v-model="dataForm.useTime"
type="datetime" type="datetime"
format='yyyy-MM-dd HH:mm:ss' format="yyyy-MM-dd HH:mm:ss"
value-format='timestamp' value-format="timestamp"
placeholder="选择日期时间" /> placeholder="选择日期时间" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -98,8 +96,8 @@
<el-option <el-option
v-for="dict in workersList" v-for="dict in workersList"
:key="dict.id" :key="dict.id"
:label="dict.name" :label="dict.nickname"
:value="dict.name" /> :value="dict.nickname" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -107,7 +105,12 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="使用数量" prop="num"> <el-form-item label="使用数量" prop="num">
<el-input-number v-model="dataForm.num" clearable controls-position="right" placeholder="请输入使用数量" style="width: 100%" /> <el-input-number
v-model="dataForm.num"
clearable
controls-position="right"
placeholder="请输入使用数量"
style="width: 100%" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -126,7 +129,10 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" /> <el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -135,9 +141,15 @@
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { createMaterialLog, updateMaterialLog, getMaterialLog, getEqListAll, getworkerAll } from "@/api/base/materialUseLog"; import {
import { getMaterialList } from "@/api/base/material" createMaterialLog,
import { getMaterDateList } from "@/api/base/materialDate" updateMaterialLog,
getMaterialLog,
getEqListAll,
} from '@/api/base/materialUseLog';
import { getMaterialTree,getMaterialList } from '@/api/base/material';
import { getMaterDateList } from '@/api/base/materialDate';
import { listSimpleUsers } from '@/api/system/user';
export default { export default {
mixins: [basicAdd], mixins: [basicAdd],
@ -146,115 +158,127 @@ export default {
urlOptions: { urlOptions: {
createURL: createMaterialLog, createURL: createMaterialLog,
updateURL: updateMaterialLog, updateURL: updateMaterialLog,
infoURL: getMaterialLog infoURL: getMaterialLog,
}, },
dataForm: { dataForm: {
id: undefined, id: undefined,
materialId: undefined, materialId: undefined,
materialCode: undefined, materialCode: undefined,
materialDateId: undefined, materialDateId: undefined,
equipmentId: undefined, equipmentId: undefined,
userName: undefined, userName: undefined,
userNames: [], userNames: [],
useTime: new Date().getTime(), useTime: new Date().getTime(),
address: undefined, address: undefined,
num: 0, num: 0,
source: undefined, source: undefined,
remark: undefined remark: undefined,
}, },
dataSourceList: [ dataSourceList: [
{ {
id: 1, id: 1,
name: '手动' name: '手动',
}, },
{ {
id: 2, id: 2,
name: 'PDA' name: 'PDA',
} },
], ],
materialList: [], materialList: [],
materialDateList: [], materialDateList: [],
eqList: [], eqList: [],
workersList: [], workersList: [],
dataRule: { dataRule: {
materialId: [{ required: true, message: "物料不能为空", trigger: "blur" }], materialId: [
materialDateId: [{ required: true, message: "批次号不能为空", trigger: "blur" }], { required: true, message: '物料不能为空', trigger: 'blur' },
useTime: [{ required: true, message: "使用时间不能为空", trigger: "blur" }], ],
userNames: [{ required: true, message: "操作员不能为空", trigger: "blur" }], useTime: [
num: [{ required: true, message: "使用数量不能为空", trigger: "blur" }] { required: true, message: '使用时间不能为空', trigger: 'blur' },
} ],
userNames: [
{ required: true, message: '操作员不能为空', trigger: 'blur' },
],
num: [{ required: true, message: '使用数量不能为空', trigger: 'blur' }],
},
}; };
}, },
mounted() { mounted() {
this.getDictData() this.getDictData();
}, },
methods: { methods: {
async getDictData() { async getDictData() {
const materRes = await getMaterialList() const materRes = await getMaterialTree();
this.materialList = materRes.data let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id
const dateRes = await getMaterDateList() const listQuery= {
this.materialDateList = dateRes.data typeId:typeId
const eqRes = await getEqListAll() }
this.eqList = eqRes.data const materData = await getMaterialList(listQuery);
const workerRes = await getworkerAll() this.materialList = [];
this.workersList = workerRes.data this.materialList = materData.data;
const dateRes = await getMaterDateList();
this.materialDateList = dateRes.data;
const eqRes = await getEqListAll();
this.eqList = eqRes.data;
const workerRes = await listSimpleUsers();
this.workersList = workerRes.data;
}, },
// //
dataFormSubmit() { dataFormSubmit() {
this.dataForm.userName = this.dataForm.userNames.join(',') this.dataForm.userName = this.dataForm.userNames.join(',');
this.$refs["dataForm"].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (!valid) { if (!valid) {
return false; return false;
} }
// //
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => { this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功');
this.visible = false; this.visible = false;
this.$emit("refreshDataList"); this.$emit('refreshDataList');
}); });
return; return;
} }
// //
this.urlOptions.createURL(this.dataForm).then(response => { this.urlOptions.createURL(this.dataForm).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功');
this.visible = false; this.visible = false;
this.$emit("refreshDataList"); this.$emit('refreshDataList');
}); });
}); });
}, },
init(id) { init(id) {
this.dataForm.id = id || undefined; this.dataForm.id = id || undefined;
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["dataForm"].resetFields(); this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => { this.urlOptions.infoURL(id).then((response) => {
this.dataForm.id = response.data.id this.dataForm.id = response.data.id;
this.dataForm.materialCode = response.data.materialCode this.dataForm.materialCode = response.data.materialCode;
this.dataForm.materialId = response.data.materialId this.dataForm.materialId = response.data.materialId;
this.dataForm.materialDateId = response.data.materialDateId this.dataForm.materialDateId = response.data.materialDateId;
this.dataForm.equipmentId = response.data.equipmentId this.dataForm.equipmentId = response.data.equipmentId;
this.dataForm.useTime = response.data.useTime this.dataForm.useTime = response.data.useTime;
// this.dataForm.userName = response.data.userName // this.dataForm.userName = response.data.userName
this.dataForm.num = response.data.num this.dataForm.num = response.data.num;
this.dataForm.source = response.data.source this.dataForm.source = response.data.source;
this.dataForm.remark = response.data.remark this.dataForm.remark = response.data.remark;
this.dataForm.userNames = response.data.userName.split(',') this.dataForm.userNames = response.data.userName.split(',');
}); });
} else {} } else {
}); }
}, });
},
setCode() { setCode() {
const tempMaterial = this.materialList.filter(item =>{ const tempMaterial = this.materialList.filter((item) => {
return item.id === this.dataForm.materialId return item.id === this.dataForm.materialId;
}) });
this.dataForm.materialCode = tempMaterial[0].code this.dataForm.materialCode = tempMaterial[0].code;
getMaterDateList({materialId: this.dataForm.materialId}).then(res =>{ getMaterDateList({ materialId: this.dataForm.materialId }).then((res) => {
this.materialDateList = res.data this.materialDateList = res.data;
}) });
} },
}, },
}; };
</script> </script>

View File

@ -1,8 +1,8 @@
/* /*
* @Author: zwq * @Author: zwq
* @Date: 2022-08-24 11:19:43 * @Date: 2022-08-24 11:19:43
* @LastEditors: zhp * @LastEditors: zwq
* @LastEditTime: 2023-11-24 09:29:36 * @LastEditTime: 2024-07-05 10:10:12
* @Description: * @Description:
*/ */
export default { export default {
@ -53,11 +53,12 @@ export default {
this.listQuery.pageNo = val; this.listQuery.pageNo = val;
this.getDataList(); this.getDataList();
}, },
// 新增 / 修改 // 新增
addOrUpdateHandle(id) { addOrUpdateHandle() {
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id); this.$refs.addOrUpdate.init();
}); });
}, },
cancel(id) { cancel(id) {

View File

@ -1,8 +1,8 @@
/* /*
* @Date: 2020-12-29 16:49:28 * @Date: 2020-12-29 16:49:28
* @LastEditors: DY * @LastEditors: zwq
* @LastEditTime: 2023-09-12 11:13:34 * @LastEditTime: 2024-07-08 16:27:39
* @FilePath: \basic-admin\src\filters\basicData\index.js * @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description: * @Description:
*/ */
@ -33,7 +33,7 @@ export function parseTime(time, pattern) {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time) time = parseInt(time)
} else if (typeof time === 'string') { } else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),''); time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm), '');
} }
if ((typeof time === 'number') && (time.toString().length === 10)) { if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000 time = time * 1000
@ -62,6 +62,22 @@ export function parseTime(time, pattern) {
}) })
return time_str return time_str
} }
// 遍历树结构返回数组
export function getTreeArr(arr) {
let result =[]
arr.forEach(item => {
if(item.children && item.children.length>0){
let {children,...obj} = item
result.push(obj)
result = result.concat(getTreeArr(children))
}else{
let {children,...obj} = item
result.push(obj)
}
});
return result
}
export default function (dictTable) { export default function (dictTable) {
return function (val) { return function (val) {
return table?.[dictTable]?.[val] return table?.[dictTable]?.[val]

View File

@ -1,93 +0,0 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-20 15:23:59
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="auto">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报废原因编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入报废原因编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报废原因" prop="content">
<el-input v-model="dataForm.content" placeholder="请输入报废原因" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报废类型" prop="typeId">
<el-select v-model="dataForm.typeId" placeholder="请选择报废类型">
<el-option v-for="dict in typeList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../../core/mixins/basic-add';
import { createQualityScrapDet, updateQualityScrapDet, getQualityScrapDet, getCode } from "@/api/base/qualityScrapDet";
import { getList,} from "@/api/base/qualityScrapType";
// import { getMaterialList } from "@/api/base/material";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createQualityScrapDet,
updateURL: updateQualityScrapDet,
infoURL: getQualityScrapDet,
},
typeList:[],
dataForm: {
id: undefined,
code: undefined,
content: undefined,
typeId:null,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
code: [{ required: true, message: "报废原因编码不能为空", trigger: "blur" }],
content: [{ required: true, message: "报废原因不能为空", trigger: "blur" }],
typeId: [{ required: true, message: "报废类型不能为空", trigger: "change" }],
}
};
},
mounted() {
this.getDict()
console.log('我看看', this.dataForm)
},
methods: {
async getDict() {
//
const res = await getList();
this.typeList = res.data;
},
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -1,209 +0,0 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-21 14:11:18
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="auto">
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="工单号" prop="workOrderId">
<el-select v-model="dataForm.workOrderId" placeholder="请选择工单号">
<el-option v-for="dict in workOrderList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班组" prop="teamId">
<el-select v-model="dataForm.teamId" placeholder="请选择班组">
<el-option v-for="dict in teamList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="数量" prop="num">
<el-input v-model="dataForm.num" placeholder="请输入数量" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.lineId" placeholder="请选择产线">
<el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因">
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废时间" prop="logTime">
<el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="来源" prop="source">
<el-select v-model="dataForm.source" placeholder="请选择来源">
<el-option v-for="dict in sourceList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../../core/mixins/basic-add';
import {
createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList,
getTeamList, getDetList,getLineList } from "@/api/base/qualityScrapLog";
import { getList,} from "@/api/base/qualityScrapType";
// import { getMaterialList } from "@/api/base/material";
import moment from 'moment';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
// codeURL: getCode,
createURL: createQualityScrapLog,
updateURL: updateQualityScrapLog,
infoURL: getQualityScrapLog,
},
lineList:[],
typeList: [],
workOrderList: [],
detList:[],
teamList: [],
sourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: '自动',
}
],
dataForm: {
id: undefined,
logTime: undefined,
source:1,
detId: undefined,
workOrderId: null,
teamId: undefined,
num: undefined,
lineId:undefined,
description:undefined,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
workOrderId: [{ required: true, message: "工单号不能为空", trigger: "change" }],
num: [{ required: true, message: "数量不能为空", trigger: "blur" }],
detId: [{ required: true, message: "报废原因不能为空", trigger: "change" }],
logTime: [{ required: true, message: "报废时间不能为空", trigger: "change" }],
}
};
},
mounted() {
this.getDict()
console.log('我看看', this.dataForm)
this.getCurrentTime()
},
methods: {
getCurrentTime() {
// new Date().Format("yyyy-MM-dd HH:mm:ss")
this.dataForm.logTime = new Date()
// this.dataForm.logTime = year + "-" + month + "-" + day;
console.log(this.dataForm.logTime);
},
async getDict() {
//
const res = await getList()
this.typeList = res.data
getWorkOrderList().then((res) => {
console.log(res);
// console.log(response);
this.workOrderList = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
getLineList().then((res) => {
console.log(res);
// console.log(response);
this.lineList = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
getDetList().then((res) => {
console.log(res);
// console.log(response);
this.detList = res.data.map((item) => {
return {
name: item.content,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
getTeamList().then((res) => {
console.log(res);
// console.log(response);
this.teamList = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -1,222 +0,0 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-07 19:38:13
* @LastEditors: zhp
* @Description:
-->
<template>
<el-dialog :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
<small-title slot="title" :no-padding="true">
{{ '详情' }}
</small-title>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="auto">
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="工单号" prop="workOrderId">
<el-select v-model="dataForm.workOrderId" placeholder="请选择工单号" disabled>
<el-option v-for="dict in workOrderList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班组" prop="teamId">
<el-select v-model="dataForm.teamId" placeholder="请选择班组" disabled>
<el-option v-for="dict in teamList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="数量" prop="sum">
<el-input v-model="dataForm.sum" placeholder="请输入数量" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.lineId" placeholder="请选择产线" disabled>
<el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因" disabled>
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废时间" prop="logTime">
<el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" disabled
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="来源" prop="source">
<el-select v-model="dataForm.source" placeholder="请选择来源" disabled>
<el-option v-for="dict in sourceList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</template>
<script>
import basicAdd from '../../../core/mixins/basic-add';
import {
createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList,
getTeamList, getDetList,getLineList } from "@/api/base/qualityScrapLog";
import { getList,} from "@/api/base/qualityScrapType";
import SmallTitle from './SmallTitle';
export default {
components: {
SmallTitle,
},
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
// codeURL: getCode,
createURL: createQualityScrapLog,
updateURL: updateQualityScrapLog,
infoURL: getQualityScrapLog,
},
lineList:[],
typeList: [],
workOrderList: [],
detList:[],
teamList: [],
sourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: '自动',
}
],
dialogVisible:false,
dataForm: {
id: undefined,
logTime: undefined,
source:1,
detId: undefined,
workOrderId: null,
teamId: undefined,
num: undefined,
lineId:undefined,
description:undefined,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
workOrderId: [{ required: true, message: "工单号不能为空", trigger: "change" }],
num: [{ required: true, message: "数量不能为空", trigger: "blur" }],
detId: [{ required: true, message: "报废原因不能为空", trigger: "change" }],
logTime: [{ required: true, message: "报废时间不能为空", trigger: "change" }],
}
};
},
mounted() {
// this.getDict()
console.log('我看看', this.dataForm)
this.getCurrentTime()
},
methods: {
init() {
this.dialogVisible = true
},
getCurrentTime() {
// new Date().Format("yyyy-MM-dd HH:mm:ss")
this.dataForm.logTime = new Date()
// this.dataForm.logTime = year + "-" + month + "-" + day;
console.log(this.dataForm.logTime);
},
// async getDict() {
// //
// const res = await getList()
// this.typeList = res.data
// getWorkOrderList().then((res) => {
// console.log(res);
// // console.log(response);
// this.workOrderList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getLineList().then((res) => {
// console.log(res);
// // console.log(response);
// this.lineList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getDetList().then((res) => {
// console.log(res);
// // console.log(response);
// this.workOrderList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getTeamList().then((res) => {
// console.log(res);
// // console.log(response);
// this.teamList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// },
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -1,213 +0,0 @@
<template>
<div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table v-loading="dataListLoading" :table-props="tableProps" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" />
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" @cancel="handleCancel"
@confirm="handleConfirm" :before-close="handleCancel" width="50%">
<add-or-update ref="addOrUpdate" @refreshDataList="successSubmit"></add-or-update>
</base-dialog>
<detail-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" @refreshDataList="successSubmit" />
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import DetailOrUpdate from './detail-or-updata';
import basicPage from '../../../core/mixins/basic-page';
import { parseTime } from '../../../core/mixins/code-filter';
import {
getQualityScrapLogPage,
deleteQualityScrapLog,
getWorkOrderList,
getTeamList
} from '@/api/base/qualityScrapLog';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
},
{
prop: 'workOrderName',
label: '工单'
},
{
prop: 'teamId',
label: '班组'
},
{
prop: 'detContent',
label: '报废原因'
},
{
prop: 'logTime',
label: '报废时间',
filter: parseTime
},
{
prop: 'num',
label: '数量'
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getQualityScrapLogPage,
deleteURL: deleteQualityScrapLog,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:quality-scrap-log:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:quality-scrap-log:detail`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`base:quality-scrap-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
detailOrUpdateVisible:false,
formConfig: [
{
type: 'select',
label: '工单',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId',
},
{
type: 'select',
label: '班组',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'teamId',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-scrap-det:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
components: {
AddOrUpdate,
DetailOrUpdate
},
created() {
this.getDict()
},
methods: {
otherMethods(val) {
if (val.type === 'detail') {
this.detailOrUpdateVisible = true;
// this.addOrEditTitle = "";
this.$nextTick(() => {
this.$refs.detailOrUpdate.init(val.data.id, true);
});
}
},
//
getDict() {
getWorkOrderList().then((res) => {
console.log(res);
// console.log(response);
this.formConfig[0].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
getTeamList().then((res) => {
console.log(res);
// console.log(response);
this.formConfig[1].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId : undefined;
this.listQuery.teamId = val.teamId ? val.teamId : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -1,86 +0,0 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-24 08:42:18
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="报废类型编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入报废类型编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报废类型" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入报废类型" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="描述类型" prop="description">
<el-input v-model="dataForm.description" clearable placeholder="描述类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../../core/mixins/basic-add';
import { createQualityScrapType, updateQualityScrapType, getQualityScrapType, getCode } from "@/api/base/qualityScrapType";
// import { getMaterialList } from "@/api/base/material";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createQualityScrapType,
updateURL: updateQualityScrapType,
infoURL: getQualityScrapType,
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
code: [{ required: true, message: "报废类型编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "报废类型不能为空", trigger: "blur" }],
}
};
},
mounted() {
// this.getDict()
console.log('我看看', this.dataForm)
},
methods: {
// async getDict() {
// //
// const res = await getMaterialList();
// this.materialList = res.data;
// },
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -0,0 +1,128 @@
<template>
<div
:id="'currentDataChart' + chartN"
style="width: 100%; height: 300px"></div>
</template>
<script>
import * as echarts from 'echarts';
import resize from '@/utils/chartMixins/resize';
export default {
name: 'BaseChart',
mixins: [resize],
data() {
return {
chartDom: '',
chart: '',
};
},
props: {
chartData: {
type: Array,
required: true,
default: () => {
return [];
},
},
lineName: {
type: Array,
required: true,
default: () => {
return [];
},
},
chartN: {
type: Number,
required: true,
default: () => {
return 0;
},
},
},
watch: {
chartData: function () {
this.getChart();
},
},
mounted() {
this.getChart();
},
methods: {
getChart() {
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose(); // Dom
}
this.chartDom = document.getElementById('currentDataChart' + this.chartN);
this.chart = echarts.init(this.chartDom);
if (this.chartData.length === 0) {
return false;
}
console.log('chartData:', this.chartData);
console.log('lineName:', this.lineName);
let xData = this.chartData.map((item) => {
return item.inspectionContent;
});
console.log('xData:', xData);
let series = [];
this.lineName.map((item) => {
let obj = {
data: [],
type: 'bar',
stack: 'a',
barWidth: 20,
name: item.prop,
};
this.chartData.forEach((ele) => {
obj.data.push(ele[item.prop]);
});
series.push(obj);
});
console.log('series:', series);
var option = {
color: [
'#288AFF',
'#73DE93',
'#FFCE6A',
'#63BDFF',
'#7164FF',
'#FF6860',
'#FF9747',
'#B0EB42',
'#D680FF',
'#0043D2',
],
legend: {
itemWidth: 10,
itemHeight: 10,
textStyle: {
color: '#8c8c8c',
},
right: 0,
},
tooltip: {
trigger: 'axis',
},
grid: {
left: 20,
right: 0,
bottom: '3%',
containLabel: true,
},
xAxis: {
type: 'category',
data: xData,
},
yAxis: {
type: 'value',
},
series: series,
};
option && this.chart.setOption(option);
},
},
};
</script>

View File

@ -0,0 +1,232 @@
<template>
<div>
<base-table
:table-props="tableProps"
:page="1"
:limit="1000"
:table-data="list" />
<div class="orderBox" v-for="(item, index) in downList" :key="index">
<div class="title">
<span>工单{{ item.workOrderName }}</span>
<span>产品名称{{ item.productionName }}</span>
<span>规格{{ item.productionSize }}</span>
</div>
<div class="custom-tabs">
<el-tabs v-model="item.activeName" :stretch="true">
<el-tab-pane :label="'\u2002表格\u2002'" name="table"></el-tab-pane>
<el-tab-pane
:label="'\u3000图表\u3000'"
name="chart"
style="overflow: inherit"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<base-table
v-if="item.activeName === 'table'"
:table-props="item.tableProps"
:page="1"
:limit="1000"
:table-data="item.list"
:height="300" />
<baseChart
v-else
:chartN="index"
:chartData="item.list"
:lineName="item.downProps" />
</div>
</div>
</div>
</template>
<script>
import BaseChart from './baseChart.vue';
import { getInspectionData } from '@/api/monitoring/statisticalData';
export default {
name: 'CurrentTest',
components: { BaseChart },
computed: {
tableProps() {
return [
{
prop: 'workOrderName',
label: '工单名称',
showOverflowtooltip: true,
},
...this.dynamicProps,
{
prop: 'sumInput',
label: '上片总数',
},
{
prop: 'sumOutput',
label: '下片总数',
},
];
},
},
data() {
return {
dynamicProps: [],
list: [],
downList: [],
};
},
mounted() {
this.getList();
},
methods: {
/** 查询列表 */
async getList() {
const res = await getInspectionData();
// const res = {
// data: [],
// };
if (res.data && res.data.length > 0) {
this.dynamicProps = this.filterNameData(res.data[0].upPart.nameData);
this.list = this.filterData(res.data[0].upPart.data);
//
res.data.forEach((item) => {
let downProps = this.filterNameData(item.downPart[0].nameData);
console.log('downProps:', downProps);
let obj = this.downPartData(item.downPart[0].data, downProps);
obj.tableProps = [
{
prop: 'inspectionContent',
label: '检测内容',
showOverflowtooltip: true,
},
{
prop: 'sumInput',
label: '原片总数',
showOverflowtooltip: true,
},
...downProps,
{
prop: 'sumScrap',
label: '未通过检测总数',
},
{
prop: 'scrapRatio',
label: '报废比例',
},
];
this.downList.push(obj);
});
console.log(this.downList);
} else {
this.list = [];
this.dynamicProps = [];
}
},
filterNameData(nameData) {
const ndSet = new Set();
nameData.forEach((nd) => {
ndSet.add(nd.name);
});
return Array.from(ndSet.values())
.sort()
.map((name) => ({
prop: name,
label: name,
}));
},
filterData(data) {
return data.map((item) => {
const { data: innerData } = item;
const keyValuePairs = {};
console.log('innerData:', innerData);
this.dynamicProps.map((item) => {
keyValuePairs[item.prop] = '-';
});
innerData.forEach((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
workOrderName: item.workOrderName,
...keyValuePairs,
sumInput: item.sumInput,
sumOutput: item.sumOutput,
};
});
},
downPartData(data, downProps) {
let obj = {
workOrderName: '',
productionName: '',
productionSize: '',
activeName: 'table',
tableProps: [],
downProps: downProps,
list: [],
};
obj.workOrderName = data[0].workOrderName;
obj.productionName = data[0].productionName;
obj.productionSize = data[0].productionSize;
obj.list = data.map((item) => {
const { data: innerData } = item;
const keyValuePairs = {};
downProps.map((item) => {
keyValuePairs[item.prop] = '-';
});
innerData.map((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
sumInput: item.sumInput,
...keyValuePairs,
sumScrap: item.sumScrap,
scrapRatio: item.scrapRatio,
};
});
return obj;
},
},
};
</script>
<style scoped lang="scss">
.orderBox {
padding-top: 16px;
}
.title {
position: relative;
padding: 4px 0;
padding-left: 12px;
font-size: 14px;
color: #606266;
font-weight: 700;
margin-bottom: 12px;
&::before {
content: '';
position: absolute;
left: 0;
top: 6px;
height: 16px;
width: 4px;
border-radius: 1px;
background: #0b58ff;
}
span {
display: inline-block;
width: 300px;
}
}
:deep(.custom-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
}
</style>

View File

@ -0,0 +1,86 @@
<template>
<base-table
:table-props="tableProps"
:table-data="list"
:max-height="tableH" />
</template>
<script>
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { getRecordInOneDay } from '@/api/monitoring/statisticalData';
import moment from 'moment';
export default {
name: 'HourData',
mixins: [tableHeightMixin],
computed: {
tableProps() {
return [
{
prop: 'inspectionDetContent',
label: '检测内容',
},
...this.nameData,
];
},
},
data() {
return {
heightNum: 200,
nameData: [],
list: [],
};
},
mounted() {
this.getList();
},
methods: {
async getList() {
const res = await getRecordInOneDay();
if (res.data) {
this.nameData = this.filterNameData(res.data.nameData);
this.list = this.filterData(res.data.data);
} else {
this.nameData = [];
this.list = [];
}
},
filterNameData(nameData) {
let arr = [];
nameData.forEach((ele) => {
if (ele.tree === 1) {
arr.push({
prop: ele.id,
label: moment(ele.name).format('yyyy-MM-DD HH:mm:ss'),
});
}
});
nameData.forEach((ele) => {
arr.forEach((inner) => {
if (ele.parentId === inner.prop) {
inner.children = [
{
prop: ele.parentId + ele.name,
label: ele.name,
},
];
}
});
});
return arr;
},
filterData(data) {
let list = [];
data.forEach((ele) => {
let obj = {};
obj.inspectionDetContent = ele.inspectionDetContent;
ele.data.forEach((inner) => {
inner.children.forEach((item) => {
obj[item.parentId + item.dynamicName] = item.dynamicValue;
});
});
list.push(obj);
});
return list;
},
},
};
</script>

View File

@ -0,0 +1,88 @@
<template>
<div class="currentDataContainer">
<div class="topBox">
<el-menu
:default-active="activeName"
mode="horizontal"
@select="handleSelect">
<el-menu-item index="currentTest">当前检测数据</el-menu-item>
<el-menu-item index="24hour">24小时检测数据</el-menu-item>
</el-menu>
</div>
<div class="bottomBox">
<!-- 当前检测数据 -->
<div v-if="activeName === 'currentTest'">
<CurrentTest />
</div>
<!-- 24小时检测数据 -->
<div v-if="activeName === '24hour'">
<HourData />
</div>
</div>
</div>
</template>
<script>
import CurrentTest from './currentTest.vue';
import HourData from './hourData.vue';
export default {
name: 'currentData',
data() {
return {
activeName: 'currentTest',
};
},
components: {
CurrentTest,
HourData,
},
methods: {
handleSelect(name) {
this.activeName = name;
},
},
};
</script>
<style scoped lang="scss">
.currentDataContainer {
width: 100%;
min-height: calc(100vh - 120px - 8px);
background: rgba(242, 244, 249, 1);
.topBox {
.el-menu {
background-color: #f2f4f9;
margin-bottom: 8px;
}
.el-menu.el-menu--horizontal {
border-bottom: none;
width: 100%;
.el-menu-item {
height: 48px;
line-height: 48px;
width: calc((100% / 2) - 4px);
border-radius: 8px;
background-color: #fff;
font-size: 16px;
font-weight: 500;
color: rgba(22, 22, 22, 0.65);
text-align: center;
}
:first-child {
margin-right: 8px;
}
.el-menu-item.is-active {
border-width: 4px;
color: #161616;
}
}
.el-tabs__active-bar {
display: none;
}
}
.bottomBox {
min-height: calc(100vh - 184px);
background: #fff;
padding: 16px;
border-radius: 8px;
}
}
</style>

View File

@ -1,622 +0,0 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<!-- 列表 -->
<el-row>
<el-col class="custom-tabs">
<el-tabs v-model="activeName" :stretch="true" @tab-click="handleTabClick">
<el-tab-pane :label="'\u2002表格数据\u2002'" name="table">
<!-- 列表 -->
<div class="blue-title">产品名{{ productDetail.name }} 产品规格{{ productDetail.specifications }}</div>
<base-table class="base-table__margin" :table-props="productProps" :page="1" :limit="10" :table-data="list">
</base-table>
<div v-for="(item,index) in downProps" :key="index">
<div class="blue-title">工单名称:{{ list[index].workOrderName }}</div>
<base-table class="base-table__margin" :table-props="item" :page="1" :limit="10"
:table-data="downList[index]">
</base-table>
</div>
</el-tab-pane>
<el-tab-pane :label="'\u3000图形数据\u3000'" name="chart" style="overflow: inherit">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
<div id="main" style="height: 500px;width: 1000px;"></div>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
<!-- 分页组件 -->
<!-- <pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" /> -->
<!-- 对话框(添加 / 修改) -->
<!-- <base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="50%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" />
</base-dialog> -->
</div>
</template>
<script>
import {
getInspectionData,
getProductList,
getWorkOrderList
} from '@/api/monitoring/statisticalData';
// import Editor from '@/components/Editor';
import moment from 'moment';
// import DialogForm from './dialogForm.vue';
import * as echarts from 'echarts';
// import basicPageMixin from '@/mixins/lb/basicPageMixin';
export default {
name: 'statisticalData',
// components: {
// DialogForm,
// },
// mixins: [basicPageMixin],
data() {
return {
list: [],
dynamicProps: [],
downProps: [],
downList: [],
productDetail: {
name: null,
specifications:null,
},
activeName: 'table',
searchBarFormConfig: [
{
type: 'label',
label: '当前检测数据柱状图',
// placeholder: '',
// param: 'workOrderId',
// selectOptions: [],
},
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'productionId',
// selectOptions: [],
// },
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'inspectionDetContent',
// },
// {
// type: 'datePicker',
// label: '',
// dateType: 'daterange', // datetimerange
// // format: 'yyyy-MM-dd HH:mm:ss',
// format: 'yyyy-MM-dd',
// valueFormat: 'timestamp',
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// defaultTime: ['00:00:00', '23:59:59'],
// param: 'checkTime',
// // width: 350,
// },
// {
// type: 'button',
// btnName: '',
// name: 'search',
// color: 'primary',
// },
// {
// type: 'separate',
// },
// // {
// // type: this.$auth.hasPermi(
// // 'base:quality-inspection-record:create'
// // )
// // ? 'button'
// // : '',
// // btnName: '',
// // name: 'add',
// // plain: true,
// // color: 'success',
// // },
],
// tableBtn: [
// this.$auth.hasPermi('base:quality-inspection-record:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:quality-inspection-record:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ].filter((v) => v),
// tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
// {
// // width: 128,
// prop: 'inspectionDetContent',
// label: '',
// },
// {
// // width: 128,
// prop: 'lineName',
// label: '线',
// },
// {
// // width: 128,
// prop: 'checkPerson',
// label: '',
// },
// {
// // width: 160,
// prop: 'checkTime',
// label: '',
// filter: (val) =>
// val != null ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '-',
// },
// {
// width: 90,
// prop: 'source',
// label: '',
// filter: (val) => ['', '', ''][val],
// },
// ],
// keys, queryParams pageNo, pageSize key
// searchBarKeys: ['inspectionDetContent', 'checkTime', 'productionLineId'],
// form: {
// id: undefined,
// inspectionDetId: undefined,
// inspectionDetContent: undefined,
// productionLineId: undefined,
// sectionId: undefined,
// checkPerson: undefined,
// checkTime: undefined,
// source: undefined,
// explainText: undefined,
// remark: undefined,
// },
//
queryParams: {
workOrderId: undefined,
productId: undefined,
startTime: undefined,
endTime: undefined,
// productionLineId: null,
},
};
},
created() {
// this.getProductLineList();
},
computed: {
productProps() {
return [
{
// width: 160,
prop: 'workOrderName',
label: '工单名称',
},
...this.dynamicProps,
{
// width: 128,
prop: 'sumInput',
label: '上片总数',
},
{
// width: 128,
prop: 'sumOutput',
label: '下片总数',
// subcomponent: {
// name: 'TextOnly',
// props: {
// injectData: {
// type: Object,
// default: () => ({}),
// },
// },
// data() {
// return {
// text: '',
// };
// },
// methods: {
// handleEmit(payload) {
// console.log('handleEmit', payload);
// },
// },
// render(h) {
// return h('el-button', { props: { type: 'text' } }, this.text);
// },
// },
},
];
},
},
mounted() {
if (this.$route.params.startTime && this.$route.params.endTime) {
this.searchBarFormConfig[0].defaultSelect = [
this.$route.params.startTime,
this.$route.params.endTime,
];
this.queryParams.param = {};
this.$set(
this.queryParams.param,
'startTime',
this.$route.params.startTime
);
this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime);
} else {
this.searchBarFormConfig[0].defaultSelect = [];
}
this.getList()
},
methods: {
handleTabClick() {
if (this.activeName === 'chart') {
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;
let arrXAxis = []
this.list.forEach((ele) => {
arrXAxis.push(ele.workOrderName)
})
this.downList.forEach((ele) => {
ele.forEach((item) => {
if (ele.length !==0 && item.productionline) {
arrXAxis.push('产线' + item.productionline)
}
})
})
let arrYAxis = []
this.list.forEach((ele) => {
// console.log(ele);
arrYAxis.push(ele.sumInput)
})
this.downList.forEach((ele) => {
ele.forEach((item) => {
console.log(item);
// if (ele.length !== 0 && item.productionline) {
arrYAxis.push(item.sumInput)
// }
})
})
// console.log(arrXAxis);
option = {
xAxis: {
type: 'category',
data: arrXAxis
},
yAxis: {
type: 'value'
},
series: [
{
data: arrYAxis,
type: 'bar',
showBackground: true,
barWidth: '20',
label: {
show: true,
position: 'top'
},
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
}
}
]
};
option && myChart.setOption(option);
}
},
/** 获取搜索栏的产线列表 */
// async getDict() {
// const res = await getProductList()
// const result = await getWorkOrderList()
// console.log(res);
// this.searchBarFormConfig[1].selectOptions = res.data.map((item) => {
// return {
// name: item.name,
// id:item.id
// }
// })
// this.searchBarFormConfig[0].selectOptions = result.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// },
// getProductLineList() {
// this.$axios('/base/production-line/listAll').then((response) => {
// this.searchBarFormConfig[0].selectOptions = response.data.map(
// (item) => {
// return {
// name: item.name,
// id: item.id,
// };
// }
// );
// });
// },
getList() {
this.getDataList()
// this.getDict()
},
/** 查询列表 */
async getDataList() {
this.loading = true;
//
this.downProps= []
const res = await getInspectionData(this.queryParams)
console.log(res);
this.productDetail.name = res.data[0].productName
this.productDetail.specifications = res.data[0].specifications
// this.productName = res.data[0].productName
this.dynamicProps = this.filterNameData(res.data[0].upPart.nameData)
console.log(this.dynamicProps)
this.list = this.filterData(res.data[0].upPart.data)
console.log(this.list)
res.data[0].downPart.forEach((ele) => {
// console.log(ele.data);
let arr = this.downFilterNameData(ele.nameData)
if (arr.length !== 0) {
let propArr = [{
// width: 160,
prop: 'inspectionContent',
label: '检测内容',
},
...arr,
{
// width: 128,
prop: 'sumInput',
label: '原片总数',
},
{
// width: 128,
prop: 'sumScrap',
label: '未通过检测总数',
},
{
// width: 128,
prop: 'scrapRatio',
label: '报废比例',
}]
this.downProps.push(propArr)
}
// this.downProps = []
})
res.data[0].downPart.forEach((ele) => {
// console.log(ele.data);
let arr =this.downFilterData(ele.data)
if (arr.length !== 0) {
this.downList.push(arr)
}
// this.downProps = []
})
// console.log(this.downList);
},
downFilterNameData(nameData) {
const ndSet = new Set();
nameData.forEach((nd) => {
ndSet.add(nd.name);
});
return Array.from(ndSet.values())
.sort()
.map((name) => ({
prop: name,
label: name,
}));
// })
},
downFilterData(data) {
return data.map((item) => {
const { data: innerData } = item;
const keyValuePairs = {};
innerData.map((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
...keyValuePairs,
sumInput: item.sumInput,
scrapRatio: item.scrapRatio,
sumScrap: item.sumScrap
};
});
},
filterNameData(nameData) {
// console.log(upData);
// upData.forEach((ele) => {
const ndSet = new Set();
nameData.forEach((nd) => {
ndSet.add(nd.name);
});
return Array.from(ndSet.values())
.sort()
.map((name) => ({
prop: name,
label: name,
}));
// })
},
filterData(data) {
return data.map((item) => {
const { data: innerData } = item;
const keyValuePairs = {};
innerData.map((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
workOrderName: item.workOrderName,
...keyValuePairs,
sumInput: item.sumInput,
sumOutput: item.sumOutput,
};
});
},
/** 取消按钮 */
handleSearchBarBtnClick(val) {
if (val.btnName === 'search') {
this.queryParams.workOrderId = val.workOrderId ? val.workOrderId : undefined
this.queryParams.productId = val.productId ? val.productId : undefined
this.queryParams.startTime = val.checkTime ? val.checkTime[0] : undefined
this.queryParams.endTime = val.checkTime ? val.checkTime[1] : undefined
this.getList()
}
console.log(val);
}
/** 搜索按钮操作 */
// handleQuery() {
// this.queryParams.pageNo = 1;
// this.getList();
// },
// /** */
// resetQuery() {
// this.resetForm('queryForm');
// this.handleQuery();
// },
// /** */
// handleAdd() {
// this.reset();
// this.open = true;
// this.title = '';
// },
// /** */
// handleUpdate(row) {
// this.reset();
// const id = row.id;
// getQualityInspectionRecord(id).then((response) => {
// /** */
// const info = {}
// Object.keys(this.form).forEach(key => {
// info[key] = response.data[key]
// });
// this.form = info;
// this.open = true;
// this.title = '';
// });
// },
// /** */
// submitForm() {
// this.$refs['form'].validate((valid) => {
// if (!valid) {
// return;
// }
// //
// if (this.form.id != null) {
// updateQualityInspectionRecord(this.form).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// return;
// }
// //
// createQualityInspectionRecord(this.form).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// });
// },
// /** */
// handleDelete(row) {
// const id = row.id;
// this.$modal
// .confirm('"' + row.inspectionDetContent + '"?')
// .then(function () {
// return deleteQualityInspectionRecord(id);
// })
// .then(() => {
// this.getList();
// this.$modal.msgSuccess('');
// })
// .catch(() => {});
// },
// /** */
// handleExport() {
// //
// let params = { ...this.queryParams };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal
// .confirm('?')
// .then(() => {
// this.exportLoading = true;
// return exportQualityInspectionRecordExcel(params);
// })
// .then((response) => {
// this.$download.excel(response, '.xls');
// this.exportLoading = false;
// })
// .catch(() => {});
// },
},
};
</script>
<style scoped lang="scss">
:deep(.custom-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
}
.blue-title {
position: relative;
padding: 4px 0;
padding-left: 12px;
font-size: 14px;
color: #606266;
font-weight: 700;
margin-bottom: 12px;
&::before {
content: '';
position: absolute;
left: 0;
top: 6px;
height: 16px;
width: 4px;
border-radius: 1px;
background: #0b58ff;
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,3 @@
<!--
filename: index.vue
author: liubin
date: 2023-09-04 09:34:52
description: 设备效率分析
-->
<template> <template>
<div class="app-container allow-overflow"> <div class="app-container allow-overflow">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
@ -15,10 +8,7 @@
<el-row> <el-row>
<el-col class="custom-tabs"> <el-col class="custom-tabs">
<el-tabs <el-tabs v-model="activeName" :stretch="true">
v-model="activeName"
:stretch="true"
@tab-click="handleTabClick">
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table"> <el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
@ -27,7 +17,7 @@
:page="1" :page="1"
:limit="10" :limit="10"
:table-data="list" :table-data="list"
@emitFun="handleEmitFun"></base-table> :max-height="tableH"></base-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane <el-tab-pane
:label="'\u3000可视化\u3000'" :label="'\u3000可视化\u3000'"
@ -74,7 +64,6 @@
v-for="item in list" v-for="item in list"
:key="item.id" :key="item.id"
:value="item" /> :value="item" />
<!-- <pie-chart v-for="item in 5" :key="item" :value="item" /> -->
</div> </div>
</div> </div>
</div> </div>
@ -86,40 +75,44 @@
</template> </template>
<script> <script>
// import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import PieChart from './components/pieChart.vue'; import PieChart from './components/pieChart.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { exportEfficiencyExcel } from '@/api/equipment/analysis/statistics.js';
export default { export default {
name: 'EfficiencyAnalysis', name: 'EfficiencyAnalysis',
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
components: { PieChart }, components: { PieChart },
props: {}, props: {},
data() { data() {
return { return {
activeName: 'table', activeName: 'table',
open: false,
visualizationOpen: false,
trendOpen: false,
// tableBtn: [
// this.$auth.hasPermi('base:equipment-group:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:equipment-group:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'factoryName', label: '工厂' }, {
{ prop: 'lineName', label: '产线' }, prop: 'factoryName',
{ prop: 'sectionName', label: '工段' }, label: '工厂',
{ prop: 'equipmentName', label: '设备' }, minWidth: 120,
showOverflowtooltip: true,
},
{
prop: 'lineName',
label: '产线',
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: 'sectionName',
label: '工段',
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: 'equipmentName',
label: '设备',
minWidth: 120,
showOverflowtooltip: true,
},
{ {
label: '有效时间', label: '有效时间',
children: [ children: [
@ -127,12 +120,13 @@ export default {
width: 128, width: 128,
prop: 'workTime', prop: 'workTime',
label: '工作时长[h]', label: '工作时长[h]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ {
width: 128, width: 128,
prop: 'workRate', prop: 'workRate',
label: '百分比[%]', label: '百分比[%]',
filter: (val) => (val != null ? +val.toFixed(3) : '-'), filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
], ],
}, },
@ -143,8 +137,14 @@ export default {
width: 128, width: 128,
prop: 'stopTime', prop: 'stopTime',
label: '停机时长[h]', label: '停机时长[h]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
{
width: 128,
prop: 'stopRate',
label: '百分比[%]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ width: 128, prop: 'stopRate', label: '百分比[%]' },
], ],
}, },
{ {
@ -154,14 +154,19 @@ export default {
width: 128, width: 128,
prop: 'downTime', prop: 'downTime',
label: '故障时长[h]', label: '故障时长[h]',
filter: (val) => (val != null ? +val.toFixed(3) : '-'), filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
{
width: 128,
prop: 'downRate',
label: '百分比[%]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ width: 128, prop: 'downRate', label: '百分比[%]' },
{ {
width: 128, width: 128,
prop: 'timeEfficiency', prop: 'timeEfficiency',
label: '时间开动率', label: '时间开动率',
filter: (val) => (val != null ? +val.toFixed(3) : '-'), filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
], ],
}, },
@ -172,150 +177,67 @@ export default {
width: 128, width: 128,
prop: 'realProcSpeed', prop: 'realProcSpeed',
label: '实际加工速度', label: '实际加工速度',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ {
width: 128, width: 128,
prop: 'designProcSpeed', prop: 'designProcSpeed',
label: '理论加工速度', label: '理论加工速度',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ {
width: 128, width: 128,
prop: 'peEfficiency', prop: 'peEfficiency',
label: '速度开动率', label: '速度开动率',
filter: (val) => (val != null ? +val.toFixed(3) : '-'), filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
], ],
}, },
{
prop: 'oee',
label: 'OEE',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
{
prop: 'teep',
label: 'TEEP',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
// {
// _action: 'view-trend',
// label: '',
// ,
// subcomponent: {
// props: ['injectData'],
// render: function (h) {
// const _this = this;
// return h(
// 'el-button',
// {
// props: { type: 'text' },
// on: {
// click: function () {
// console.log('inejctdata', _this.injectData);
// _this.$emit('emitData', {
// action: _this.injectData._action,
// // value: _this.injectData.id,
// value: _this.injectData,
// });
// },
// },
// },
// ''
// );
// },
// },
// },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'select', type: 'select',
label: '工单', label: '工单名称',
placeholder: '请选择工单', param: 'workOrderId',
param: 'workOrderId',
selectOptions: [], selectOptions: [],
filterable: true,
clearable: false,
defaultSelect: '',
},
{
// parent: 'dateFilterType',
//
type: 'datePicker',
label: '时间段',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
defaultTime: ['00:00:00', '00:00:00'],
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'recordTime',
}, },
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
{
// parent: 'dateFilterType',
//
type: 'datePicker',
// label: '',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
defaultTime: ['00:00:00', '00:00:00'],
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timerange',
},
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
// { {
// type: 'separate', type: 'separate',
// }, },
// { {
// type: 'button', type: 'button',
// btnName: '', btnName: '导出',
// name: 'visualization', name: 'export',
// plain: true, plain: true,
// color: 'success', color: 'success',
// }, },
// {
// type: 'button',
// btnName: 'OEE',
// name: 'add',
// plain: true,
// color: 'success',
// },
// {
// type: 'button',
// btnName: 'TEEP',
// name: 'add',
// plain: true,
// color: 'warning',
// },
], ],
//
open: false,
// //
queryParams: { queryParams: {
// lineId: null, workOrderId: null,
workOrderId: null,
recordTime: [], recordTime: [],
}, },
// //
@ -324,54 +246,32 @@ export default {
}; };
}, },
created() { created() {
this.getWorkOrder() this.getWorkOrder();
// this.getLine();
this.getList();
}, },
methods: { methods: {
/** 准备工厂数据 */ /** 准备工厂数据 */
async getWorkOrder() { async getWorkOrder() {
console.log(1111);
const { code, data } = await this.$axios({ const { code, data } = await this.$axios({
url: '/base/core-work-order/listbyfilter', url: '/base/core-work-order/listbyfilter',
method: 'get', method: 'get',
}); });
if (code == 0) { if (code == 0) {
console.log('1111', data);
this.searchBarFormConfig[0].selectOptions = data.map((item) => { this.searchBarFormConfig[0].selectOptions = data.map((item) => {
return { return {
name: item.name, name: item.name,
id: item.id, id: item.id,
}; };
}); });
this.searchBarFormConfig[0].defaultSelect =
this.searchBarFormConfig[0].selectOptions[0].id;
this.queryParams.workOrderId =
this.searchBarFormConfig[0].selectOptions[0].id;
} else {
this.searchBarFormConfig[0].selectOptions = [];
this.searchBarFormConfig[0].defaultSelect = '';
this.queryParams.workOrderId = '';
} }
}, this.getList();
// /** 线 */
// async getLine() {
// const { code, data } = await this.$axios({
// url: '/base/production-line/listAll',
// method: 'get',
// });
// if (code == 0) {
// this.searchBarFormConfig[1].selectOptions = data.map((item) => {
// return {
// name: item.name,
// id: item.id,
// };
// });
// }
// },
/** 覆盖 handleEmitFun 的默认实现 */
handleEmitFun({ action, value }) {
switch (action) {
case 'view-trend':
const { id } = value;
this.open = true;
this.trendOpen = true;
break;
}
}, },
/** 查询列表 */ /** 查询列表 */
async getList() { async getList() {
@ -385,43 +285,23 @@ export default {
this.list = data; this.list = data;
} }
}, },
exportExcel() {
this.loading = true;
exportEfficiencyExcel({ ...this.queryParams }).then((res) => {
this.$download.excel(res, '设备状态追溯.xls');
this.loading = false;
});
},
handleSearchBarBtnClick({ btnName, ...payload }) { handleSearchBarBtnClick({ btnName, ...payload }) {
console.log('handleSearchBarBtnClick', btnName, payload); this.queryParams.workOrderId = payload.workOrderId || null;
if (btnName == 'visualization') { this.queryParams.recordTime = payload.recordTime || undefined;
//
this.visualizationOpen = true;
this.open = true;
}
if (btnName == 'search') { if (btnName == 'search') {
this.queryParams.workOrderId = payload.workOrderId || null; this.getList();
// this.queryParams.lineId = payload.lineId || null;
if (0 == payload.dateFilterType) {
this.queryParams.recordTime = payload.timerange;
} else if (1 == payload.dateFilterType) {
this.queryParams.recordTime = [
`${payload.timeday} 00:00:00`,
`${payload.timeday} 23:59:59`,
];
}
} else { } else {
this.queryParams.recordTime = null; this.exportExcel();
console.log('导出');
} }
this.getList();
}, },
cancel() {
this.open = false;
},
closed() {
this.visualizationOpen = false;
this.trendOpen = false;
},
submitForm() {},
handleTabClick() {},
}, },
}; };
</script> </script>

View File

@ -1,251 +1,222 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-11-24 10:55:54
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list"> :formConfigs="formConfig"
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" ref="searchBarForm"
@clickBtn="handleClick" /> --> @headBtnClick="buttonClick" />
</base-table> <base-table
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total" :table-props="tableProps"
@pagination="getList" /> :page="listQuery.pageNo"
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> --> :limit="listQuery.pageSize"
</div> :table-data="list"
:max-height="tableH"></base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="total"
@pagination="getList" />
</div>
</template> </template>
<script> <script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter'; import { parseTime } from '../mixins/code-filter';
import { import {
getMaterialUseLogPage, getMaterialUseLogPage,
getWorkOrderList, getWorkOrderList,
exportEnergyPlcExcel exportEnergyPlcExcel,
} from '@/api/quality/materialTraceability'; } from '@/api/quality/materialTraceability';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'materialName', prop: 'materialName',
label: '物料名称' label: '物料名称',
}, showOverflowtooltip: true,
{ },
prop: 'materialCode', {
label: '物料编码' prop: 'materialCode',
}, label: '物料编码',
{ showOverflowtooltip: true,
prop: 'dateName', minWidth: 120,
label: '物料批次' },
}, {
{ prop: 'dateName',
prop: 'equipName', label: '物料批次',
label: '使用设备' showOverflowtooltip: true,
}, },
{ {
prop: 'num', prop: 'equipName',
label: '使用数量' label: '使用设备',
}, showOverflowtooltip: true,
{ },
prop: 'useTime', {
label: '使用时间', prop: 'num',
filter: parseTime label: '使用数量',
}, showOverflowtooltip: true,
{ },
prop: 'userName', {
label: '操作人' prop: 'useTime',
}, label: '使用时间',
{ filter: parseTime,
prop: 'source', width: 160,
label: '数据来源', },
filter: (val) => val == 1 ? '内部' : '外部' {
}, prop: 'userName',
{ label: '操作人',
prop: 'remark', showOverflowtooltip: true,
label: '备注' },
} {
prop: 'source',
label: '数据来源',
filter: (val) => (val == 1 ? '内部' : '外部'),
},
{
prop: 'remark',
label: '备注',
showOverflowtooltip: true,
},
]; ];
export default { export default {
// mixins: [basicPage], mixins: [tableHeightMixin],
data() { data() {
return { return {
// urlOptions: { heightNum: 220,
// getDataListURL: getMaterialUseLogPage, tableProps,
// // deleteURL: deletePackingType, tableBtn: [
// // exportURL: exportPackingExcel, this.$auth.hasPermi(`base:packaging-print-log:update`)
// }, ? {
tableProps, type: 'edit',
tableBtn: [ btnName: '编辑',
this.$auth.hasPermi(`base:packaging-print-log:update`) }
? { : undefined,
type: 'edit', this.$auth.hasPermi(`base:packaging-print-log:delete`)
btnName: '编辑', ? {
} type: 'delete',
: undefined, btnName: '删除',
this.$auth.hasPermi(`base:packaging-print-log:delete`) }
? { : undefined,
type: 'delete', ].filter((v) => v),
btnName: '删除', list: [],
} listQuery: {
: undefined, pageSize: 10,
pageNo: 1,
].filter((v) => v), workOrderId: undefined,
list: [], startTime: undefined,
listQuery: { endTime: undefined,
pageSize: 10, },
pageNo: 1, total: 0,
total: 0, formConfig: [
workOrderId: undefined, {
startTime: undefined, type: 'select',
endTime:undefined, label: '工单名称',
}, selectOptions: [],
formConfig: [ param: 'workOrderId',
{ defaultSelect: '',
type: 'select', filterable: true,
label: '工单', clearable: false,
selectOptions: [], },
labelField: 'name', {
valueField: 'id', type: 'datePicker',
param: 'workOrderId' label: '时间段',
}, dateType: 'daterange',
{ format: 'yyyy-MM-dd',
type: 'datePicker', valueFormat: 'yyyy-MM-dd',
label: '时间段', rangeSeparator: '-',
dateType: 'daterange', startPlaceholder: '开始时间',
format: 'yyyy-MM-dd', endPlaceholder: '结束时间',
valueFormat: "yyyy-MM-dd", param: 'timeVal',
rangeSeparator: '-', defaultSelect: [],
startPlaceholder: '开始时间', width: 250,
endPlaceholder: '结束时间', },
param: 'timeVal', {
defaultSelect: [], type: 'button',
width: 250 btnName: '查询',
}, name: 'search',
{ color: 'primary',
type: 'button', },
btnName: '搜索', {
name: 'search', type: 'separate',
color: 'primary', },
}, {
{ type: this.$auth.hasPermi('monitoring:materiel-date-from:export')
type: 'separate', ? 'button'
}, : '',
// { btnName: '导出',
// type: 'separate', name: 'export',
// }, plain: true,
// { color: 'success',
// type: 'button', },
// btnName: '', ],
// name: 'reset', };
// }, },
// { components: {
// type: 'separate', // AddOrUpdate,
// }, },
// { created() {
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '', this.getDict();
// btnName: '', },
// name: 'add', methods: {
// color: 'success', getList() {
// plain: true, getMaterialUseLogPage({ ...this.listQuery }).then((res) => {
// }, this.list = res.data || [];
// { this.total = res.data.total || 0;
// type: 'separate', });
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '', },
// }, getDict() {
{ getWorkOrderList().then((response) => {
type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '', this.formConfig[0].selectOptions = response.data.map((item) => {
btnName: '导出', return {
name: 'export', name: item.name,
color: 'warning', id: item.id,
}, };
], });
}; console.log(this.formConfig[0].selectOptions);
}, this.formConfig[0].defaultSelect =
components: { this.formConfig[0].selectOptions[0].id || '';
// AddOrUpdate, this.listQuery.workOrderId =
}, this.formConfig[0].selectOptions[0].id || '';
created() { this.getList();
this.getList() });
this.getDict() },
}, handleExport() {
methods: { //
getList() { let params = { ...this.listQuery };
getMaterialUseLogPage({ ...this.listQuery }).then(res => { params.pageNo = undefined;
this.list = res.data || [] params.pageSize = undefined;
this.listQuery.total = res.data.total || 0 this.exportLoading = true;
}) exportEnergyPlcExcel(params)
}, .then((response) => {
getDict() { this.$download.excel(response, '物料信息追溯 ');
// this.exportLoading = false;
// getCustomerList().then((response) => { })
// console.log(response); .catch(() => {});
// this.customerList = response.data },
// // this.listQuery.total = response.data.total; buttonClick(val) {
// }) console.log(val);
// getModelList().then((response) => { if (val.btnName === 'search') {
// console.log(response); this.listQuery.workOrderId = val.workOrderId
// this.modelList = response.data ? val.workOrderId
// // this.listQuery.total = response.data.total; : undefined;
// }) if (val.timeVal && val.timeVal.length != 0) {
getWorkOrderList().then((response) => { this.listQuery.startTime = val.timeVal[0] + ' 00:00:00';
// console.log(response); this.listQuery.endTime = val.timeVal[1] + ' 23:59:59';
this.formConfig[0].selectOptions = response.data.map((item) => { } else {
return { this.listQuery.startTime = undefined;
name: item.name, this.listQuery.endTime = undefined;
id: item.id }
} this.getList();
}) } else {
console.log(this.formConfig[0].selectOptions); this.handleExport();
// this.listQuery.total = response.data.total; }
}) },
}, otherMethods(val) {
handleExport() { this.addOrUpdateVisible = true;
// this.addOrEditTitle = '详情';
let params = { ...this.listQuery }; this.$nextTick(() => {
params.pageNo = undefined; this.$refs.addOrUpdate.init(val.data.id, true);
params.pageSize = undefined; });
this.$modal.confirm('是否确认导出所有数据项?').then(() => { },
this.exportLoading = true; },
return exportEnergyPlcExcel(params);
}).then(response => {
this.$download.excel(response, '物料信息追溯 ');
this.exportLoading = false;
}).catch(() => { });
},
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId :undefined
// this.queryParams.status = val.status
if (val.timeVal && val.timeVal.length != 0 ) {
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
} else {
this.listQuery.startTime = undefined
this.listQuery.endTime = undefined
}
this.getList()
} else {
this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
},
}; };
</script> </script>

View File

@ -1,279 +1,218 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-11-28 10:51:44
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list"> :formConfigs="formConfig"
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" ref="searchBarForm"
@clickBtn="handleClick" /> @headBtnClick="buttonClick" />
</base-table> <base-table
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total" :table-props="tableProps"
@pagination="getList" /> :page="listQuery.pageNo"
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> --> :limit="listQuery.pageSize"
</div> :table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getList" />
</div>
</template> </template>
<script> <script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter'; import { parseTime } from '../mixins/code-filter';
import { import {
getProcessTraceabilityPage, getProcessTraceabilityPage,
getWorkOrderList, getWorkOrderList,
getCoreProduct getCoreProduct,
// exportEnergyPlcExcel
} from '@/api/quality/processTraceability'; } from '@/api/quality/processTraceability';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'name', prop: 'name',
label: '工单名称' label: '工单名称',
}, showOverflowtooltip: true,
{ minWidth: 120,
prop: 'code', },
label: '工单编码' {
}, prop: 'code',
{ label: '工单编码',
prop: 'planProductName', showOverflowtooltip: true,
label: '产品名' minWidth: 120,
}, },
{ {
prop: 'status', prop: 'planProductName',
label: '状态', label: '产品名',
filter: (val) => val == 1 ? '等待' : val == 2 ? '激活' : val == 3 ? '暂停' : val == 4 ? '完成' : '作废', showOverflowtooltip: true,
}, },
{ {
prop: 'startProduceTime', prop: 'status',
label: '开始生产时间', label: '状态',
filter: parseTime filter: (val) =>
}, val == 1
{ ? '等待'
prop: 'finishProduceTime', : val == 2
label: '结束生产时间', ? '激活'
filter: parseTime : val == 3
}, ? '暂停'
{ : val == 4
prop: 'actualQuantity', ? '完成'
label: '生产数量' : '作废',
}, },
{ {
prop: 'planProductUnit', prop: 'startProduceTime',
label: '单位', label: '开始生产时间',
filter: publicFormatter('unit_dict') filter: parseTime,
}, width: 160,
{ },
prop: 'processFlowName', {
label: '工艺名称' prop: 'finishProduceTime',
}, label: '结束生产时间',
{ filter: parseTime,
prop: 'yield', width: 160,
label: '合格率' },
} {
prop: 'actualQuantity',
label: '生产数量',
},
{
prop: 'planProductUnit',
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'yield',
label: '合格率',
filter: (val) => (val ? val.toFixed(2) + '%' : '-'),
align: 'center',
},
{
prop: 'processFlowName',
label: '工艺名称',
showOverflowtooltip: true,
},
]; ];
export default { export default {
// mixins: [basicPage], mixins: [tableHeightMixin],
data() { data() {
return { return {
// urlOptions: { tableProps,
// getDataListURL: getMaterialUseLogPage, tableBtn: [
// // deleteURL: deletePackingType, {
// // exportURL: exportPackingExcel, type: 'processDetail',
// }, btnName: '查看工艺详情',
tableProps, },
tableBtn: [ ].filter((v) => v),
// this.$auth.hasPermi(`base:packaging-print-log:update`) list: [],
// ? { listQuery: {
// type: 'edit', pageSize: 10,
// btnName: '', pageNo: 1,
// } },
// : undefined, formConfig: [
{ {
type: 'processDetail', type: 'select',
btnName: '查看工艺详情', label: '工单名称',
}, selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'orderName',
filterable: true,
},
{
type: 'datePicker',
label: '工单开始时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 250,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
};
},
created() {
this.getList();
this.getDict();
},
methods: {
getList() {
getProcessTraceabilityPage(this.listQuery).then((res) => {
this.list = res.data.list || [];
this.listQuery.total = res.data.total || 0;
});
},
handleClick(val) {
if (val.type === 'processDetail') {
console.log(val);
let specificationsData = '';
getCoreProduct(val.data.planProductId).then((res) => {
console.log(res);
].filter((v) => v), this.$router.push({
list: [], path: 'process-traceability-detail',
listQuery: { query: {
pageSize: 10, id: val.data.processFlowId,
pageNo: 1, orderId: val.data.id,
// total: 0, name: val.data.name,
// orderName: '', specifications: res.data.specifications,
// startTime: undefined, productName: val.data.planProductName,
// endTime:undefined, processFlowName: val.data.processFlowName,
}, },
formConfig: [ });
{ });
type: 'select', }
label: '工单', },
selectOptions: [], getDict() {
labelField: 'name', getWorkOrderList().then((response) => {
valueField: 'id', this.formConfig[0].selectOptions = response.data.map((item) => {
param: 'orderName', return {
filterable: true, name: item.name,
}, id: item.name,
{ };
type: 'datePicker', });
label: '工单开始时间', console.log(this.formConfig[0].selectOptions);
dateType: 'daterange', });
format: 'yyyy-MM-dd', },
valueFormat: "yyyy-MM-dd", buttonClick(val) {
rangeSeparator: '-', console.log(val);
startPlaceholder: '开始时间', if (val.btnName === 'search') {
endPlaceholder: '结束时间', this.listQuery.orderName = val.orderName ? val.orderName : undefined;
param: 'timeVal', if (val.timeVal && val.timeVal.length != 0) {
defaultSelect: [], this.listQuery.startTime = val.timeVal[0] + ' 00:00:00';
width: 250 this.listQuery.endTime = val.timeVal[1] + ' 23:59:59';
}, } else {
{ this.listQuery.startTime = undefined;
type: 'button', this.listQuery.endTime = undefined;
btnName: '搜索', }
name: 'search', this.getList();
color: 'primary', }
}, },
// { otherMethods(val) {
// type: 'separate', this.addOrUpdateVisible = true;
// }, this.addOrEditTitle = '详情';
// { this.$nextTick(() => {
// type: 'button', this.$refs.addOrUpdate.init(val.data.id, true);
// btnName: '', });
// name: 'reset', },
// }, },
// {
// type: 'separate',
// },
// {
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
// btnName: '',
// name: 'add',
// color: 'success',
// plain: true,
// },
// {
// type: 'separate',
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
},
methods: {
getList() {
getProcessTraceabilityPage(this.listQuery).then(res => {
this.list = res.data.list || []
this.listQuery.total = res.data.total || 0
})
},
handleClick(val) {
if (val.type === "processDetail") {
console.log(val);
let specificationsData =''
getCoreProduct(val.data.planProductId).then((res) => {
console.log(res)
this.$router.push({
path: 'process-traceability-detail',
query: {
id: val.data.processFlowId,
orderId: val.data.id,
name: val.data.name,
specifications: res.data.specifications,
productName: val.data.planProductName,
processFlowName: val.data.processFlowName,
// planProductId: val.data.planProductId
// equipmentName,
},
});
})
// this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
}
},
getDict() {
//
// getCustomerList().then((response) => {
// console.log(response);
// this.customerList = response.data
// // this.listQuery.total = response.data.total;
// })
// getModelList().then((response) => {
// console.log(response);
// this.modelList = response.data
// // this.listQuery.total = response.data.total;
// })
getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.name
}
})
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
// handleExport() {
// //
// let params = { ...this.listQuery };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal.confirm('?').then(() => {
// this.exportLoading = true;
// return exportEnergyPlcExcel(params);
// }).then(response => {
// this.$download.excel(response, ' ');
// this.exportLoading = false;
// }).catch(() => { });
// },
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.listQuery.orderName = val.orderName ? val.orderName :undefined
// this.queryParams.status = val.status
if (val.timeVal && val.timeVal.length != 0 ) {
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
} else {
this.listQuery.startTime = undefined
this.listQuery.endTime = undefined
}
this.getList()
} else {
// this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
},
}; };
</script> </script>

View File

@ -1,219 +0,0 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-09-11 15:55:13
description: DialogForm for qualityInspectionRecord only
-->
<template>
<el-form ref="form" :model="innerDataForm" label-width="100px" v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="工单名称" prop="workOrderId" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.workOrderId" placeholder="请选择工单名称" filterable clearable>
<el-option v-for="opt in workOrderList" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检测内容" prop="inspectionDetId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.inspectionDetId" placeholder="请选择检测内容" filterable clearable
@change="handleInspectionDetChange">
<el-option v-for="opt in inspectionDetList" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.productionLineId" placeholder="请选择产线" filterable clearable
@change="handleProductlineChange">
<el-option v-for="opt in productionLineList" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工段" prop="sectionId" :rules="[{ required: false, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.sectionId" placeholder="请选择工段" clearable filterable
@change="$emit('update', innerDataForm)">
<el-option v-for="opt in sectionList" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="检测人员" prop="checkPerson">
<el-input v-model="innerDataForm.checkPerson" clearable @change="$emit('update', innerDataForm)"
placeholder="请输入检测人员" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检测时间" prop="checkTime" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-date-picker v-model="innerDataForm.checkTime" type="datetime" placeholder="请选择检测时间"
value-format="timestamp" @change="$emit('update', innerDataForm)"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="来源" prop="source" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.source" placeholder="请选择来源" filterable clearable
@change="$emit('update', innerDataForm)">
<el-option v-for="opt in [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
]" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col>
<el-form-item label="备注" prop="remark">
<el-input v-model="innerDataForm.remark" @change="$emit('update', innerDataForm)" placeholder="请输入备注">
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: {},
props: {
dataForm: {
type: Object,
default: () => ({}),
},
},
data() {
return {
formLoading: true,
inspectionDetList: [],
productionLineList: [],
sectionList: [],
workOrderList:[],
innerDataForm: {},
cacheInspectionDetList: null,
};
},
mounted() {
Promise.all([this.getProductLineList(), this.getInspectionDetList(), this.getWorkOrderList()]).then(
() => {
this.formLoading = false;
}
);
},
watch: {
// 'innerDataForm.productionLineId': {
// handler: async function (plId) {
// if (plId) await this.getWorksectionList(plId);
// },
// immediate: true,
// },
dataForm: {
handler: function (dataForm) {
this.innerDataForm = Object.assign({}, dataForm);
if (dataForm.productionLineId)
this.getWorksectionList(dataForm.productionLineId);
},
immediate: true,
},
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
handleInspectionDetChange(value) {
const { id, content } = this.cacheInspectionDetList.find(
(item) => item.id == value
);
this.innerDataForm.inspectionDetId = id;
this.innerDataForm.inspectionDetContent = content;
this.$emit('update', this.innerDataForm);
},
async handleProductlineChange(id) {
// await this.getWorksectionList(id);
this.innerDataForm.sectionId = null;
this.$emit('update', this.innerDataForm);
},
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
// 线
async getProductLineList() {
const response = await this.$axios('/base/core-production-line/listAll');
this.productionLineList = response.data.map((item) => ({
label: item.name,
value: item.id,
}));
},
async getWorkOrderList() {
const response = await this.$axios('base/core-work-order/listbyfilter');
this.workOrderList = response.data.map((item) => ({
label: item.name,
value: item.id,
}));
},
//
async getInspectionDetList() {
const response = await this.$axios(
'/base/quality-inspection-det/listAll'
);
this.cacheInspectionDetList = response.data;
this.inspectionDetList = response.data.map((item) => ({
label: item.content,
value: item.id,
}));
},
//
async getWorksectionList(plId) {
const response = await this.$axios(
'/base/core-workshop-section/listByParentId',
{
params: {
id: plId,
},
}
);
this.sectionList = response.data.map((item) => ({
label: item.name,
value: item.id,
}));
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
</style>

View File

@ -1,120 +0,0 @@
<!--
filename: index.vue
author: liubin
date: 2023-08-04 14:44:58
description:
-->
<template>
<div class="app-container">
<SearchBar
:formConfigs="[{ label: '近24小时检测记录', type: 'title' }]"
ref="search-bar" />
<!-- <pre><code v-html="jsondemo"></code></pre> -->
<el-skeleton v-if="initing" :rows="6" animated />
<div v-else >
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun"></base-table>
</div>
</div>
</template>
<script>
// import response from './response.json';
import { handleNameData, handleDynamicData } from '@/utils/dynamicProps';
// import hljs from 'highlight.js/lib/highlight';
// import json from 'highlight.js/lib/languages/json';
// import 'highlight.js/styles/github-gist.css';
// hljs.registerLanguage('json', json);
export default {
name: 'QualityRecentHours',
components: {},
props: {},
data() {
return {
initing: false,
queryParams: {
pageNo: 1,
pageSize: 10,
},
list: [
// {
// inspectionContent: '1',
// '2023-03-18T00:00:00-线1': '线1-asdf',
// '2023-03-18T01:00:00-线2': '线2-kldf',
// '2023-03-18T02:00:00-线1': '线1-vasdkj',
// },
],
tableProps: [
{
prop: 'inspectionContent',
label: '检测内容',
},
],
};
},
computed: {},
mounted() {
this.getList();
},
methods: {
async getList() {
const response = await this.$axios({
url: '/analysis/record-in-one-day/get',
method: 'get',
});
const {
data: { data: dyanmicData, nameData },
} = response;
this.initing = true;
const dynamicProps = handleNameData(nameData);
this.tableProps.push(...dynamicProps);
const dataList = handleDynamicData(dyanmicData);
this.list = dataList;
this.queryParams.pageSize = dataList.length;
setTimeout(() => {
this.initing = false;
}, 1000);
},
handleEmitFun(payload) {
console.log('payload', payload);
},
},
};
</script>
<style scoped lang="scss">
::-webkit-scrollbar {
display: none;
}
pre {
margin: 10px;
background: #f6f8faf6;
border: 1px solid #e1e4e8;
padding: 12px;
border-radius: 12px;
position: fixed;
// top: 15vh;
top: 10vh;
left: 0;
max-height: 80vh;
overflow-y: auto;
z-index: 100000;
box-shadow: 0 0 32px 12px #0001;
}
code {
font-family: 'IntelOne Mono', 'Ubuntu', 'Courier New', Courier, monospace;
}
</style>

View File

@ -1,80 +0,0 @@
{
"tableProps": [
{
"prop": "inspectionContent",
"label": "检测内容",
"align": "center"
},
{
"prop": "2023-03-18T00:00:00",
"label": "2023-03-18T00:00:00",
"align": "center",
"children": [
{
"prop": "2023-03-18T00:00:00-产线1",
"label": "产线1",
"align": "center"
},
{
"prop": "2023-03-18T00:00:00-产线2",
"label": "产线2",
"align": "center"
},
{
"prop": "2023-03-18T00:00:00-产线3",
"label": "产线3",
"align": "center"
},
{
"prop": "2023-03-18T00:00:00-产线4",
"label": "产线4",
"align": "center"
},
{
"prop": "2023-03-18T00:00:00-产线5",
"label": "产线5",
"align": "center"
}
]
},
{
"prop": "2023-03-18T01:00:00",
"label": "2023-03-18T01:00:00",
"align": "center",
"children": [
{
"prop": "2023-03-18T01:00:00-产线1",
"label": "产线1",
"align": "center"
},
{
"prop": "2023-03-18T01:00:00-产线2",
"label": "产线2",
"align": "center"
},
{
"prop": "2023-03-18T01:00:00-产线3",
"label": "产线3",
"align": "center"
}
]
},
{
"prop": "2023-03-18T02:00:00",
"label": "2023-03-18T02:00:00",
"align": "center",
"children": [
{
"prop": "2023-03-18T02:00:00-产线1",
"label": "产线1",
"align": "center"
},
{
"prop": "2023-03-18T02:00:00-产线2",
"label": "产线2",
"align": "center"
}
]
}
]
}

View File

@ -1,176 +0,0 @@
{
"code": 0,
"data": {
"data": [
{
"data": [
{
"id": "测试222023-08-09T02:00",
"parentId": "测试22",
"dynamicName": "2023-08-09T02:00",
"dynamicValue": 1691517600000,
"children": [
{
"id": "1672847052717821953",
"parentId": "测试222023-08-09T02:00",
"dynamicName": "产线1",
"dynamicValue": 1
}
]
},
{
"id": "测试222023-08-09T08:00",
"parentId": "测试22",
"dynamicName": "2023-08-09T08:00",
"dynamicValue": 1691539200000,
"children": [
{
"id": "1672847052717821953",
"parentId": "测试222023-08-09T08:00",
"dynamicName": "产线1",
"dynamicValue": 1
}
]
},
{
"id": "测试222023-08-09T11:00",
"parentId": "测试22",
"dynamicName": "2023-08-09T11:00",
"dynamicValue": 1691550000000,
"children": [
{
"id": "1672847052717821953",
"parentId": "测试222023-08-09T11:00",
"dynamicName": "产线1",
"dynamicValue": 1
}
]
}
],
"inspectionDetContent": "测试22"
},
{
"data": [
{
"id": "测试112023-08-09T02:00",
"parentId": "测试11",
"dynamicName": "2023-08-09T02:00",
"dynamicValue": 1691517600000,
"children": [
{
"id": "1672847052717821954",
"parentId": "测试112023-08-09T02:00",
"dynamicName": "产线22",
"dynamicValue": 1
}
]
},
{
"id": "测试112023-08-09T08:00",
"parentId": "测试11",
"dynamicName": "2023-08-09T08:00",
"dynamicValue": 1691539200000,
"children": [
{
"id": "1672847052717821953",
"parentId": "测试112023-08-09T08:00",
"dynamicName": "产线1",
"dynamicValue": 1
}
]
},
{
"id": "测试112023-08-09T09:00",
"parentId": "测试11",
"dynamicName": "2023-08-09T09:00",
"dynamicValue": 1691542800000,
"children": [
{
"id": "1672847052717821954",
"parentId": "测试112023-08-09T09:00",
"dynamicName": "产线22",
"dynamicValue": 2
}
]
}
],
"inspectionDetContent": "测试11"
}
],
"nameData": [
{
"name": "2023-08-09T02:00",
"tree": 1,
"id": "测试222023-08-09T02:00",
"parentId": "测试22"
},
{
"name": "产线1",
"tree": 2,
"id": "1672847052717821953",
"parentId": "测试222023-08-09T02:00"
},
{
"name": "2023-08-09T08:00",
"tree": 1,
"id": "测试222023-08-09T08:00",
"parentId": "测试22"
},
{
"name": "产线1",
"tree": 2,
"id": "1672847052717821953",
"parentId": "测试222023-08-09T08:00"
},
{
"name": "2023-08-09T11:00",
"tree": 1,
"id": "测试222023-08-09T11:00",
"parentId": "测试22"
},
{
"name": "产线1",
"tree": 2,
"id": "1672847052717821953",
"parentId": "测试222023-08-09T11:00"
},
{
"name": "2023-08-09T02:00",
"tree": 1,
"id": "测试112023-08-09T02:00",
"parentId": "测试11"
},
{
"name": "产线22",
"tree": 2,
"id": "1672847052717821954",
"parentId": "测试112023-08-09T02:00"
},
{
"name": "2023-08-09T08:00",
"tree": 1,
"id": "测试112023-08-09T08:00",
"parentId": "测试11"
},
{
"name": "产线1",
"tree": 2,
"id": "1672847052717821953",
"parentId": "测试112023-08-09T08:00"
},
{
"name": "2023-08-09T09:00",
"tree": 1,
"id": "测试112023-08-09T09:00",
"parentId": "测试11"
},
{
"name": "产线22",
"tree": 2,
"id": "1672847052717821954",
"parentId": "测试112023-08-09T09:00"
}
]
},
"msg": ""
}

View File

@ -1,243 +1,160 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-11-10 16:26:45
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <search-bar
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list"> :formConfigs="formConfig"
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" ref="searchBarForm"
@clickBtn="handleClick" /> --> @headBtnClick="buttonClick" />
</base-table> <base-table
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total" :table-props="tableProps"
@pagination="getList" /> :page="listQuery.pageNo"
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> --> :limit="listQuery.pageSize"
</div> :table-data="list"
:max-height="tableH"></base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="total"
@pagination="getList" />
</div>
</template> </template>
<script> <script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import { parseTime } from '../mixins/code-filter'; import { parseTime } from '../mixins/code-filter';
import { import {
getRawMaterialPage, getRawMaterialPage,
getWorkOrderList, getWorkOrderList,
// exportEnergyPlcExcel
} from '@/api/quality/rawMaterialTraceability'; } from '@/api/quality/rawMaterialTraceability';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
filter: parseTime filter: parseTime,
}, width: 150,
{ },
prop: 'material', {
label: '原料名称', prop: 'material',
filter: publicFormatter('material') label: '原料名称',
}, filter: publicFormatter('material'),
{ showOverflowtooltip: true,
prop: 'origin', },
label: '来源', {
filter: (val)=>val == 1 ? '内部' : '外部' prop: 'origin',
}, label: '来源',
{ filter: (val) => (val == 1 ? '内部' : '外部'),
prop: 'supplierId', },
label: '供应商' {
}, prop: 'supplierName',
{ label: '供应商',
prop: 'batch', },
label: '批次' {
}, prop: 'batch',
{ label: '批次',
prop: 'num', showOverflowtooltip: true,
label: '数量' },
}, {
{ prop: 'num',
prop: 'unit', label: '数量',
label: '单位', },
filter: publicFormatter('unit_dict') {
} prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
},
]; ];
export default { export default {
// mixins: [basicPage], mixins: [tableHeightMixin],
data() { data() {
return { return {
// urlOptions: { tableProps,
// getDataListURL: getMaterialUseLogPage, tableBtn: [
// // deleteURL: deletePackingType, this.$auth.hasPermi(`base:packaging-print-log:update`)
// // exportURL: exportPackingExcel, ? {
// }, type: 'edit',
tableProps, btnName: '编辑',
tableBtn: [ }
this.$auth.hasPermi(`base:packaging-print-log:update`) : undefined,
? { this.$auth.hasPermi(`base:packaging-print-log:delete`)
type: 'edit', ? {
btnName: '编辑', type: 'delete',
} btnName: '删除',
: undefined, }
this.$auth.hasPermi(`base:packaging-print-log:delete`) : undefined,
? { ].filter((v) => v),
type: 'delete', list: [],
btnName: '删除', listQuery: {
} pageSize: 10,
: undefined, pageNo: 1,
workOrderId: undefined,
].filter((v) => v), startTime: undefined,
list: [], endTime: undefined,
listQuery: { },
pageSize: 10, total: 0,
pageNo: 1, formConfig: [
total: 0, {
workOrderId: undefined, type: 'select',
startTime: undefined, label: '工单名称',
endTime:undefined, selectOptions: [],
}, labelField: 'name',
formConfig: [ valueField: 'id',
{ param: 'workOrderId',
type: 'select', clearable: false,
label: '工单', filterable: true,
selectOptions: [], defaultSelect: '',
labelField: 'name', },
valueField: 'id', {
param: 'workOrderId' type: 'button',
}, btnName: '查询',
// { name: 'search',
// type: 'datePicker', color: 'primary',
// label: '', },
// dateType: 'daterange', ],
// format: 'yyyy-MM-dd', };
// valueFormat: "yyyy-MM-dd", },
// rangeSeparator: '-', created() {
// startPlaceholder: '', this.getDict();
// endPlaceholder: '', },
// param: 'timeVal', methods: {
// defaultSelect: [], getList() {
// width: 250 getRawMaterialPage({ ...this.listQuery }).then((res) => {
// }, this.list = res.data.records || [];
{ this.total = res.data.total || 0;
type: 'button', });
btnName: '搜索', },
name: 'search', getDict() {
color: 'primary', getWorkOrderList().then((response) => {
}, this.formConfig[0].selectOptions = response.data.map((item) => {
// { return {
// type: 'separate', name: item.name,
// }, id: item.id,
// { };
// type: 'button', });
// btnName: '', this.formConfig[0].defaultSelect =
// name: 'reset', this.formConfig[0].selectOptions[0].id || '';
// }, this.listQuery.workOrderId =
// { this.formConfig[0].selectOptions[0].id || '';
// type: 'separate', this.getList();
// }, });
// { },
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '', buttonClick(val) {
// btnName: '', console.log(val);
// name: 'add', if (val.btnName === 'search') {
// color: 'success', this.listQuery.workOrderId = val.workOrderId
// plain: true, ? val.workOrderId
// }, : undefined;
// { this.getList();
// type: 'separate', }
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '', },
// }, otherMethods(val) {
// { this.addOrUpdateVisible = true;
// type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '', this.addOrEditTitle = '详情';
// btnName: '', this.$nextTick(() => {
// name: 'export', this.$refs.addOrUpdate.init(val.data.id, true);
// color: 'warning', });
// }, },
], },
};
},
components: {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
},
methods: {
getList() {
getRawMaterialPage({ ...this.listQuery }).then(res => {
this.list = res.data.list || []
this.listQuery.total = res.data.total || 0
})
},
getDict() {
//
// getCustomerList().then((response) => {
// console.log(response);
// this.customerList = response.data
// // this.listQuery.total = response.data.total;
// })
// getModelList().then((response) => {
// console.log(response);
// this.modelList = response.data
// // this.listQuery.total = response.data.total;
// })
getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
},
// handleExport() {
// //
// let params = { ...this.listQuery };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal.confirm('?').then(() => {
// this.exportLoading = true;
// return exportEnergyPlcExcel(params);
// }).then(response => {
// this.$download.excel(response, ' ');
// this.exportLoading = false;
// }).catch(() => { });
// },
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId :undefined
// this.queryParams.status = val.status
// if (val.timeVal && val.timeVal.length != 0 ) {
// this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
// this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
// } else {
// this.listQuery.startTime = undefined
// this.listQuery.endTime = undefined
// }
this.getList()
} else {
// this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
},
}; };
</script> </script>

View File

@ -12,11 +12,29 @@
label-width="100px" label-width="100px"
v-loading="formLoading"> v-loading="formLoading">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="工单名称"
prop="workOrderId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.workOrderId"
placeholder="请选择工单名称"
filterable
clearable>
<el-option
v-for="opt in workOrderList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
label="检测内容" label="检测内容"
prop="inspectionDetId" prop="inspectionDetId"
:rules="[{ required: true, message: '检测内容不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="innerDataForm.inspectionDetId" v-model="innerDataForm.inspectionDetId"
placeholder="请选择检测内容" placeholder="请选择检测内容"
@ -31,12 +49,78 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="产线"
prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.productionLineId"
placeholder="请选择产线"
filterable
clearable
@change="handleProductlineChange">
<el-option
v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="工段"
prop="sectionId"
:rules="[{ required: false, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.sectionId"
placeholder="请选择工段"
clearable
filterable
@change="$emit('update', innerDataForm)">
<el-option
v-for="opt in sectionList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="检测人" prop="checkPerson">
<el-input
v-model="innerDataForm.checkPerson"
clearable
@change="$emit('update', innerDataForm)"
placeholder="请输入检测人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="检测时间"
prop="checkTime"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-date-picker
v-model="innerDataForm.checkTime"
type="datetime"
placeholder="请选择检测时间"
value-format="timestamp"
@change="$emit('update', innerDataForm)"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
label="来源" label="来源"
prop="source" prop="source"
:rules="[{ required: true, message: '来源不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="innerDataForm.source" v-model="innerDataForm.source"
placeholder="请选择来源" placeholder="请选择来源"
@ -56,81 +140,6 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="产线"
prop="productionLineId"
:rules="[{ required: true, message: '产线不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.productionLineId"
placeholder="请选择产线"
filterable
clearable
@change="handleProductlineChange">
<el-option
v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="工段"
prop="sectionId"
:rules="[{ required: true, message: '工段不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.sectionId"
placeholder="请选择工段"
clearable
filterable
@change="$emit('update', innerDataForm)">
<el-option
v-for="opt in sectionList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="检测人员" prop="checkPerson">
<el-input
v-model="innerDataForm.checkPerson"
clearable
@change="$emit('update', innerDataForm)"
placeholder="请输入检测人员" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="检测时间"
prop="checkTime"
:rules="[{ required: true, message: '检测时间不能为空', trigger: 'blur' }]">
<el-date-picker
v-model="innerDataForm.checkTime"
type="datetime"
placeholder="请选择检测时间"
value-format="timestamp"
@change="$emit('update', innerDataForm)"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col>
<el-form-item label="描述" prop="explainText">
<el-input
v-model="innerDataForm.explainText"
placeholder="请输入描述信息"
@change="$emit('update', innerDataForm)"
type="textarea"></el-input>
</el-form-item>
</el-col>
<el-col> <el-col>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input <el-input
@ -164,16 +173,19 @@ export default {
inspectionDetList: [], inspectionDetList: [],
productionLineList: [], productionLineList: [],
sectionList: [], sectionList: [],
workOrderList: [],
innerDataForm: {}, innerDataForm: {},
cacheInspectionDetList: null, cacheInspectionDetList: null,
}; };
}, },
mounted() { mounted() {
Promise.all([this.getProductLineList(), this.getInspectionDetList()]).then( Promise.all([
() => { this.getProductLineList(),
this.formLoading = false; this.getInspectionDetList(),
} this.getWorkOrderList(),
); ]).then(() => {
this.formLoading = false;
});
}, },
watch: { watch: {
// 'innerDataForm.productionLineId': { // 'innerDataForm.productionLineId': {
@ -224,13 +236,21 @@ export default {
// 线 // 线
async getProductLineList() { async getProductLineList() {
const response = await this.$axios('/base/core-production-line/listAll'); const response = await this.$axios('/base/core-production-line/listAll');
this.productionLineList = response.data.map((item) => ({ this.productionLineList = response.data.map((item) => ({
label: item.name, label: item.name,
value: item.id, value: item.id,
})); }));
}, },
async getWorkOrderList() {
const response = await this.$axios('base/core-work-order/listbyfilter');
this.workOrderList = response.data.map((item) => ({
label: item.name,
value: item.id,
}));
},
// //
async getInspectionDetList() { async getInspectionDetList() {
const response = await this.$axios( const response = await this.$axios(
@ -246,7 +266,7 @@ export default {
// //
async getWorksectionList(plId) { async getWorksectionList(plId) {
const response = await this.$axios( const response = await this.$axios(
'/base/workshop-section/listByParentId', '/base/core-workshop-section/listByParentId',
{ {
params: { params: {
id: plId, id: plId,

Some files were not shown because too many files have changed in this diff Show More