Compare commits

..

14 Commits

Author SHA1 Message Date
gtz
be430ebbff Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-30 09:08:59 +08:00
gtz
61b4bf784b Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-29 10:17:02 +08:00
gtz
b0f10b9002 '1' 2023-11-29 10:16:58 +08:00
gtz
e6b9d75f16 Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-28 09:03:13 +08:00
gtz
d9f3434712 Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-27 09:31:52 +08:00
gtz
de15716b7c Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-22 14:53:49 +08:00
gtz
c736992a34 '1' 2023-11-22 14:49:56 +08:00
gtz
dcbb2c719b Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-22 14:15:39 +08:00
gtz
bc2940ca99 Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-21 17:30:38 +08:00
gtz
76938951ed Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-20 16:07:12 +08:00
gtz
8b91e7812f '1' 2023-11-17 10:38:44 +08:00
gtz
9cffa01414 Merge branch 'projects/mes-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mes-test 2023-11-17 10:38:35 +08:00
gtz
905479d5f4 'del_dist' 2023-11-17 10:29:23 +08:00
gtz
c1ae248234 '1' 2023-11-17 10:28:39 +08:00
73 changed files with 5061 additions and 4727 deletions

View File

@@ -13,10 +13,10 @@ 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.1.164:48082' # VUE_APP_BASE_API = 'http://192.168.4.173:48080'
# 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.81:48082' # VUE_APP_BASE_API = 'http://192.168.1.49: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

@@ -15,15 +15,14 @@ VUE_APP_TITLE = MES系统
VUE_APP_BASE_API = '/prod-api' VUE_APP_BASE_API = '/prod-api'
# 积木报表指向地址 # 积木报表指向地址
VUE_APP_JIMU_API = 'http://192.168.0.33:48082' VUE_APP_JIMU_API = 'http://10.70.2.2:8080'
# 根据服务器或域名修改 # 根据服务器或域名修改
# PUBLIC_PATH = 'http://my-pi.com:8888/yudao-admin/' PUBLIC_PATH = 'http://10.70.2.32'
PUBLIC_PATH = 'http://192.168.0.33:8889/'
# 二级部署路径 # 二级部署路径
VUE_APP_APP_NAME ='yudao-admin' # VUE_APP_APP_NAME ='yudao-admin'
# 多租户的开关 # 多租户的开关
VUE_APP_TENANT_ENABLE = true VUE_APP_TENANT_ENABLE = true

View File

@@ -1,16 +1,21 @@
NODE_ENV = production # 生产环境配置
ENV = 'production'
# 页面标题 # 页面标题
VUE_APP_TITLE = 产线监控系统 VUE_APP_TITLE = MES系统
# 测试环境配置 # 芋道管理系统/生产环境
ENV = 'staging' VUE_APP_BASE_API = '/prod-api'
# 芋道管理系统/测试环境 # 积木报表指向地址
VUE_APP_BASE_API = 'http://api-dashboard.yudao.iocoder.cn' VUE_APP_JIMU_API = 'http://192.168.0.33:48082'
# 静态资源地址
PUBLIC_PATH = 'http://static.yudao.iocoder.cn/' # 根据服务器或域名修改
PUBLIC_PATH = 'http://192.168.0.33:8889/'
# 二级部署路径
# VUE_APP_APP_NAME ='yudao-admin'
# 多租户的开关 # 多租户的开关
VUE_APP_TENANT_ENABLE = true VUE_APP_TENANT_ENABLE = true
@@ -20,4 +25,3 @@ VUE_APP_DOC_ENABLE = false
# 百度统计 # 百度统计
VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab

View File

@@ -25,13 +25,3 @@ 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

@@ -38,11 +38,3 @@ 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.

Before

Width:  |  Height:  |  Size: 8.8 KiB

View File

@@ -360,6 +360,7 @@ export default {
ts: Date.now(), // 现在的时间戳 ts: Date.now(), // 现在的时间戳
} }
reqGet(data).then(res => { reqGet(data).then(res => {
console.log(1)
if (res.repCode === '0000') { if (res.repCode === '0000') {
this.backImgBase = res.repData.originalImageBase64 this.backImgBase = res.repData.originalImageBase64
this.blockBackImgBase = res.repData.jigsawImageBase64 this.blockBackImgBase = res.repData.jigsawImageBase64

View File

@@ -78,6 +78,7 @@ export default {
return this.http(this.infoUrl == '' ? this.infoPath : this.infoUrl, 'get', payload); return this.http(this.infoUrl == '' ? this.infoPath : this.infoUrl, 'get', payload);
}, },
del(payload) { del(payload) {
debugger;
return this.http(this.deleteUrl == '' ? this.deletePath : this.deleteUrl, 'delete', payload); return this.http(this.deleteUrl == '' ? this.deletePath : this.deleteUrl, 'delete', payload);
}, },

View File

@@ -1,20 +0,0 @@
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,33 +59,6 @@ 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,34 +201,3 @@ 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,349 +1,324 @@
<template> <template>
<div class="choicepart-container"> <div class="choicepart-container">
<navbar /> <navbar />
<div class="choicepart-wrapper"> <div class="choicepart-wrapper">
<div <div class="choicepart-box" id="choicepartBox" :style="'transform:scale('+scale+');width:1574px;height:538px;'" v-show="showItem">
class="choicepart-box" <div class="choicepart-line1">
id="choicepartBox" <div
:style="'transform:scale(' + scale + ');width:1574px;height:538px;'" v-for="(item, index) in menuArr1"
v-show="showItem"> :key="index"
<div class="choicepart-line1"> class="choicepart-item"
<div @click="handelClick(item, item.choicepart)"
v-for="(item, index) in menuArr1" :style="{opacity: item.visible?1:0.4, pointerEvents:item.visible?'auto':'none'}"
:key="index" >
class="choicepart-item" <div>
@click="handelClick(item, item.choicepart)" <img :src="require(`../../assets/images/choicepart/${item.name}.png`)" alt="">
:style="{ </div>
opacity: item.visible ? 1 : 0.4, <div class="choicepart-item-title">{{item.meta.title}}</div>
pointerEvents: item.visible ? 'auto' : 'none', </div>
}"> </div>
<div> <div class="choicepart-line2">
<img <div
:src=" v-for="(item, index) in menuArr2"
require(`../../assets/images/choicepart/${item.name}.png`) :key="index"
" class="choicepart-item"
alt="" /> @click="handelClick(item, item.choicepart)"
</div> :style="{opacity: item.visible?1:0.4, pointerEvents:item.visible?'auto':'none'}"
<div class="choicepart-item-title">{{ item.meta.title }}</div> >
</div> <div>
</div> <img :src="require(`../../assets/images/choicepart/${item.name}.png`)" alt="">
<div class="choicepart-line2"> </div>
<div <div class="choicepart-item-title">{{item.meta.title}}</div>
v-for="(item, index) in menuArr2" </div>
:key="index" </div>
class="choicepart-item" </div>
@click="handelClick(item, item.choicepart)" </div>
:style="{ <div class="choicepart-footer">&copy; 中建材智能自动化研究院有限公司</div>
opacity: item.visible ? 1 : 0.4, </div>
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',
data() { data() {
return { return {
boxReset: '', boxReset: '',
scale: 1, scale: 1,
menuArr1: [ menuArr1: [
{ {
name: 'Core', name: 'Core',
title: '基础核心', title: '基础核心',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Order', name: 'Order',
title: '订单管理', title: '订单管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Equipment', name: 'Equipment',
title: '设备管理', title: '设备管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Group', name: 'Group',
title: '班组管理', title: '班组管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Quality', name: 'Quality',
title: '质量管理', title: '质量管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Warehouse', name: 'Warehouse',
title: '仓库管理', title: '仓库管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Energy', name: 'Energy',
title: '能源管理', title: '能源管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, }
], ],
menuArr2: [ menuArr2: [
{ {
name: 'Packaging', name: 'Packaging',
title: '包装管理', title: '包装管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Material', name: 'Material',
title: '物料管理', title: '物料管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Extend', name: 'Extend',
title: '工艺管理', title: '工艺管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Delivery', name: 'Delivery',
title: '成品发货', title: '成品发货',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'Report', name: 'Report',
title: '报表管理', title: '报表管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, },
{ {
name: 'System', name: 'System',
title: '系统管理', title: '系统管理',
visible: false, visible: false,
meta: { meta: {
title: '', title: ''
}, }
}, }
{ ],
name: 'Devconfig', showItem: false
title: '开发配置', }
visible: false, },
meta: { // computed:{
title: '', // ...mapGetters(['sidebarRouters'])
}, // },
}, mounted() {
], this.getMsg()
showItem: false, this.boxReset = debounce(() => {
}; this.resetSize()
}, }, 300)
// computed:{ this.boxReset()
// ...mapGetters(['sidebarRouters']) window.addEventListener('resize', () => {
// }, this.boxReset()
mounted() { })
this.getMsg(); },
this.boxReset = debounce(() => { methods: {
this.resetSize(); getMsg() {
}, 300); let menuList = this.$store.state.permission.sidebarRouters
this.boxReset(); console.log(menuList)
window.addEventListener('resize', () => { if (menuList.length > 0) {
this.boxReset(); for (let i = 0; i < menuList.length; i ++) {
}); for (let k = 0; k < 7; k++) {
}, if (menuList[i].name === this.menuArr1[k].name) {
methods: { this.menuArr1[k].visible = true
getMsg() { this.menuArr1[k].id = menuList[i].id
let menuList = this.$store.state.permission.sidebarRouters; this.menuArr1[k].choicepart = i
console.log(menuList); this.menuArr1[k].children = menuList[i].children
if (menuList.length > 0) { this.menuArr1[k].meta = menuList[i].meta
for (let i = 0; i < menuList.length; i++) { }
for (let k = 0; k < 7; k++) { }
if (menuList[i].name === this.menuArr1[k].name) { for (let j = 0; j < 6; j++) {
this.menuArr1[k].visible = true; if (menuList[i].name === this.menuArr2[j].name) {
this.menuArr1[k].id = menuList[i].id; this.menuArr2[j].visible = true
this.menuArr1[k].choicepart = i; this.menuArr2[j].id = menuList[i].id
this.menuArr1[k].children = menuList[i].children; this.menuArr2[j].choicepart = i
this.menuArr1[k].meta = menuList[i].meta; this.menuArr2[j].children = menuList[i].children
} this.menuArr2[j].meta = menuList[i].meta
} }
for (let j = 0; j < 7; j++) { }
if (menuList[i].name === this.menuArr2[j].name) { }
this.menuArr2[j].visible = true; }
this.menuArr2[j].id = menuList[i].id; console.log(this.menuArr1)
this.menuArr2[j].choicepart = i; console.log(this.menuArr2)
this.menuArr2[j].children = menuList[i].children; },
this.menuArr2[j].meta = menuList[i].meta; handelClick(item, index) {
} // this.$router.push({name: 'SystemUser'})
} this.$store.dispatch('app/setChoicepart', index)
} this.toRouter(item)
} // if (item.meta.unuse) {
console.log(this.menuArr1); // this.$message.warning(this.$t('暂无数据'))
console.log(this.menuArr2); // } else {
}, // this.toRouter(item)
handelClick(item, index) { // }
// this.$router.push({name: 'SystemUser'}) },
this.$store.dispatch('app/setChoicepart', index); toRouter(item) {
this.toRouter(item); console.log(item)
// if (item.meta.unuse) { if (item.children) {
// this.$message.warning(this.$t('暂无数据')) this.toRouter(item.children[0])
// } else { } else {
// this.toRouter(item) this.$router.push({ name: item.name })
// } }
}, },
toRouter(item) { resetSize() {
console.log(item); let _this = this
if (item.children) { _this.showItem = false
this.toRouter(item.children[0]); _this.loading = true
} else { let choicepartBox = document.querySelector('#choicepartBox')
this.$router.push({ name: item.name }); let rw = parseFloat(window.innerWidth)
} let rh = parseFloat(window.innerHeight)
}, let bw = parseFloat(choicepartBox.style.width)
resetSize() { let bh = parseFloat(choicepartBox.style.height)
let _this = this; let wx = 0.82/(bw / rw)
_this.showItem = false; let hx = 0.56/(bh / rh)
_this.loading = true; _this.scale = wx > hx ? hx : wx
let choicepartBox = document.querySelector('#choicepartBox'); setTimeout(_this.showItemFun, 700)
let rw = parseFloat(window.innerWidth); },
let rh = parseFloat(window.innerHeight); showItemFun() {
let bw = parseFloat(choicepartBox.style.width); this.loading = false
let bh = parseFloat(choicepartBox.style.height); this.showItem = true
let wx = 0.82 / (bw / rw); }
let hx = 0.56 / (bh / rh); },
_this.scale = wx > hx ? hx : wx; beforeDestroy() {
setTimeout(_this.showItemFun, 700); this.showItem = false
}, }
showItemFun() { }
this.loading = false;
this.showItem = true;
},
},
beforeDestroy() {
this.showItem = false;
},
};
</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') background: url('../../assets/images/choicepart/choice-item-back.png') no-repeat;
no-repeat; background-size: 100% 100%;
background-size: 100% 100%; border-radius: 5px;
border-radius: 5px; overflow: hidden;
overflow: hidden; cursor: pointer;
cursor: pointer; position: relative;
position: relative; margin: 0 20px;
margin: 0 20px; img {
img { width: 184px;
width: 184px; height: 224px;
height: 224px; }
} .choicepart-item-title {
.choicepart-item-title { overflow: hidden;
overflow: hidden; padding: 0 10px;
padding: 0 10px; text-overflow: ellipsis;
text-overflow: ellipsis; white-space: nowrap;
white-space: nowrap; position: absolute;
position: absolute; bottom: 0;
bottom: 0; left: 2px;
left: 2px; right: 2px;
right: 2px; text-align: center;
text-align: center; color: #fff;
color: #fff; font-size: 16px;
font-size: 16px; line-height: 40px;
line-height: 40px; height: 40px;
height: 40px; letter-spacing: 2px;
letter-spacing: 2px; background-color: rgba($color: #0b58ff, $alpha: 0.45);
background-color: rgba($color: #0b58ff, $alpha: 0.45); }
} }
} .choicepart-item:hover {
.choicepart-item:hover { .choicepart-item-title {
.choicepart-item-title { background-color: rgba($color: #0b58ff, $alpha: 1);
background-color: rgba($color: #0b58ff, $alpha: 1); }
} }
} }
} .choicepart-footer {
.choicepart-footer { position: absolute;
position: absolute; width: 100%;
width: 100%; color: #C7C7C7;
color: #c7c7c7; user-select: none;
user-select: none; font-size: 12px;
font-size: 12px; letter-spacing: 1px;
letter-spacing: 1px; height: 30px;
height: 30px; display: grid;
display: grid; place-content: center;
place-content: center; bottom: 0;
bottom: 0; opacity: 0.5;
opacity: 0.5; }
}
} }
</style> </style>

View File

@@ -1,215 +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';
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

@@ -1,104 +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';
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

@@ -1,159 +0,0 @@
/*
* @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

@@ -1,88 +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" 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

@@ -1,159 +0,0 @@
/*
* @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

@@ -0,0 +1,218 @@
<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

@@ -94,7 +94,7 @@ export default {
return { return {
readOnly: false, readOnly: false,
chosedLogId: false, chosedLogId: false,
searchBarKeys: ['equipmentName', 'createTime'], searchBarKeys: ['equipmentName', 'recordTime'],
tableBtn: [ tableBtn: [
// this.$auth.hasPermi('equipment:spare-parts-config:update') // this.$auth.hasPermi('equipment:spare-parts-config:update')
// ? { // ? {
@@ -124,11 +124,11 @@ export default {
label: '报警级别', label: '报警级别',
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL), filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
}, },
{ prop: 'createTime', label: '报警时间', filter: timeFilter }, { prop: 'createTime', label: '报警时间', filter: timeFilter }, // 接口缺
{ prop: 'alarmCode', label: '设备报警码' }, { prop: 'alarmCode', label: '设备报警码' }, // 接口缺
{ prop: 'alarmContent', label: '报警内容' }, { prop: 'alarmContent', label: '报警内容' },
{ prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn }, { prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn },
{ prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn }, { prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn }, // TODO: 是否换成按钮, 群里问
// { prop: 'remark', label: '备注' }, // { prop: 'remark', label: '备注' },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
@@ -145,8 +145,8 @@ export default {
dateType: 'daterange', // datetimerange dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss', // format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
// valueFormat: 'timestamp', valueFormat: 'timestamp',
valueFormat: 'yyyy-MM-dd HH:mm:ss', // valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始日期', startPlaceholder: '开始日期',
endPlaceholder: '结束日期', endPlaceholder: '结束日期',

View File

@@ -6,67 +6,37 @@
--> -->
<template> <template>
<el-form <el-form ref="form" :model="dataForm" label-width="120px" v-loading="formLoading">
ref="form" <el-row :gutter="20">
:model="dataForm" <el-col :span="12">
label-width="110px" <el-form-item label="产线" prop="productionLineId"
v-loading="formLoading"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-row :gutter="20"> <el-select v-model="dataForm.productionLineId" placeholder="请选择产线" filterable
<el-col :span="12"> @change="handleProductlineChange">
<el-form-item <el-option v-for="opt in productionLineList" :key="opt.value" :label="opt.label" :value="opt.value" />
label="产线" </el-select>
prop="productionLineId" </el-form-item>
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> </el-col>
<el-select <el-col :span="12">
v-model="dataForm.productionLineId" <el-form-item label="工段" prop="sectionId" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
placeholder="请选择产线" <el-select v-model="dataForm.sectionId" placeholder="请选择工段" filterable @change="$emit('update', dataForm)">
filterable <el-option v-for="opt in workshopSectionList" :key="opt.value" :label="opt.label" :value="opt.value" />
@change="handleProductlineChange"> </el-select>
<el-option </el-form-item>
v-for="opt in productionLineList" </el-col>
: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 <el-form-item label="按钮盒识别码" prop="buttonId" :rules="[
label="按钮盒识别码" { required: true, message: '不能为空', trigger: 'blur' },
prop="buttonId" {
:rules="[ type: 'number',
{ required: true, message: '不能为空', trigger: 'blur' }, message: '请输入整数',
{ trigger: 'blur',
type: 'number', transform: (val) => Number.isInteger(Number(val)) && Number(val),
message: '请输入整数', },
trigger: 'blur', ]">
transform: (val) => Number.isInteger(Number(val)) && Number(val), <el-input v-model="dataForm.buttonId" @change="$emit('update', dataForm)" placeholder="请输入整数" />
}, </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"
@@ -131,50 +101,35 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item label="按钮值" prop="keyValue" :rules="[
label="按钮值" { required: true, message: '不能为空', trigger: 'blur' },
prop="keyValue" {
:rules="[ type: 'number',
{ required: true, message: '不能为空', trigger: 'blur' }, message: '请输入100以内的整数',
{ trigger: 'blur',
type: 'number', transform: (val) =>
message: '请输入100以内的整数', Number.isInteger(+val) &&
trigger: 'blur', Number(val) >= 0 &&
transform: (val) => Number(val) <= 100 &&
Number.isInteger(+val) && Number(val),
Number(val) >= 0 && },
Number(val) <= 100 && ]">
Number(val), <el-input v-model="dataForm.keyValue" type="number" min="0" max="100" @change="$emit('update', dataForm)"
}, placeholder="请输入按钮盒模式" />
]"> </el-form-item>
<el-input </el-col>
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 <el-select v-model="dataForm.inspectionDetId" placeholder="请选择检测内容" filterable
v-model="dataForm.inspectionDetId" @change="$emit('update', dataForm)">
placeholder="请选择检测内容" <el-option v-for="opt in inspectionDetList" :key="opt.value" :label="opt.label" :value="opt.value" />
filterable </el-select>
@change="$emit('update', dataForm)"> </el-form-item>
<el-option </el-col>
v-for="opt in inspectionDetList" </el-row>
:key="opt.value" </el-form>
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template> </template>
<script> <script>
@@ -195,14 +150,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;
@@ -242,20 +197,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,13 +12,12 @@
: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="80" :width="120"
fixed="right" fixed="right"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
@@ -57,11 +56,10 @@ 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, tableHeightMixin], mixins: [basicPageMixin],
components: { DialogForm }, components: { DialogForm },
data() { data() {
return { return {
@@ -72,9 +70,7 @@ export default {
label: '产线', label: '产线',
url: '/base/production-line/listAll', url: '/base/production-line/listAll',
prop: 'productionId', prop: 'productionId',
rules: [ rules: [{ required: true, message: '产线不能为空', trigger: 'blur' }],
{ required: true, message: '产线不能为空', trigger: 'blur' },
],
bind: { bind: {
filterable: true, filterable: true,
}, },
@@ -84,9 +80,7 @@ export default {
label: '工段', label: '工段',
url: '/base/workshop-section/listAll', url: '/base/workshop-section/listAll',
prop: 'sectionId', prop: 'sectionId',
rules: [ rules: [{ required: true, message: '工段不能为空', trigger: 'blur' }],
{ required: true, message: '工段不能为空', trigger: 'blur' },
],
bind: { bind: {
filterable: true, filterable: true,
}, },
@@ -124,17 +118,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: [
@@ -186,42 +180,41 @@ 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: 90, // width: 256,
prop: 'keyValue', // prop: 'productionId',
label: '按钮值', // label: '线ID',
showOverflowtooltip: true, // ,
}, // },
{ // {
width: 128, // width: 256,
prop: 'model', // prop: 'sectionId',
label: '按钮盒模式', // label: 'ID',
showOverflowtooltip: true, // ,
}, // },
{ width: 90, prop: 'keyValue', label: '按钮值' },
{ width: 128, prop: 'model', label: '按钮盒模式' },
], ],
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 10,
inspectionDetContent: null, inspectionDetContent: null,
}, },
// keys, queryParams pageNo, pageSize key // keys, queryParams pageNo, pageSize key
@@ -229,8 +222,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,
@@ -268,7 +261,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = '新增'; this.title = '添加安灯按钮16键对应';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@@ -277,7 +270,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 = '编辑'; this.title = '修改安灯按钮16键对应';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@@ -307,7 +300,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.delConfirm(row.buttonId) .confirm('是否确认删除"' + row.sectionName + '"?')
.then(function () { .then(function () {
return deleteQualityInspectionBoxBtn(id); return deleteQualityInspectionBoxBtn(id);
}) })

View File

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

View File

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

View File

@@ -0,0 +1,93 @@
<!--
* @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

@@ -9,12 +9,11 @@
: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="80" :width="120"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
@@ -22,7 +21,7 @@
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@@ -30,7 +29,7 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width="50%"> width="30%">
<add-or-update <add-or-update
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update> @refreshDataList="successSubmit"></add-or-update>
@@ -40,84 +39,77 @@
<script> <script>
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from './basic-page'; import basicPage from '../../../core/mixins/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',
prop: 'content', label: '报废原因'
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, tableHeightMixin], mixins: [basicPage],
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: '查询',
@@ -128,50 +120,53 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:quality-scrap-det:create') type: this.$auth.hasPermi('base:quality-scrap-det:create') ? 'button' : '',
? '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.total = response.data.total; this.listQuery.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.content = val.content ? val.content : undefined; this.listQuery.pageSize = 10;
this.listQuery.typeId = val.typeId ? val.typeId : undefined; this.listQuery.content = val.content ? val.content : 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,209 @@
<!--
* @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

@@ -0,0 +1,222 @@
<!--
* @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

@@ -0,0 +1,213 @@
<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

@@ -0,0 +1,86 @@
<!--
* @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

@@ -9,12 +9,11 @@
: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="80" :width="120"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
@@ -22,7 +21,7 @@
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@@ -30,7 +29,7 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width="50%"> width="30%">
<add-or-update <add-or-update
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update> @refreshDataList="successSubmit"></add-or-update>
@@ -40,45 +39,39 @@
<script> <script>
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from './basic-page'; import basicPage from '../../../core/mixins/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',
prop: 'name', label: '报废类型'
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, tableHeightMixin], mixins: [basicPage],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@@ -88,25 +81,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',
}, },
{ {
@@ -119,20 +112,13 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:quality-scrap-type:create') type: this.$auth.hasPermi('base:quality-scrap-type:create') ? 'button' : '',
? 'button'
: '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true, plain: true
}, },
], ],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
}; };
}, },
components: { components: {
@@ -141,21 +127,31 @@ 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.total = response.data.total; this.listQuery.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,128 +0,0 @@
<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

@@ -1,232 +0,0 @@
<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

@@ -1,86 +0,0 @@
<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

@@ -1,88 +0,0 @@
<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

@@ -12,29 +12,11 @@
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="请选择检测内容"
@@ -49,78 +31,12 @@
</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="请选择来源"
@@ -140,6 +56,81 @@
</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
@@ -173,19 +164,16 @@ export default {
inspectionDetList: [], inspectionDetList: [],
productionLineList: [], productionLineList: [],
sectionList: [], sectionList: [],
workOrderList: [],
innerDataForm: {}, innerDataForm: {},
cacheInspectionDetList: null, cacheInspectionDetList: null,
}; };
}, },
mounted() { mounted() {
Promise.all([ Promise.all([this.getProductLineList(), this.getInspectionDetList()]).then(
this.getProductLineList(), () => {
this.getInspectionDetList(), this.formLoading = false;
this.getWorkOrderList(), }
]).then(() => { );
this.formLoading = false;
});
}, },
watch: { watch: {
// 'innerDataForm.productionLineId': { // 'innerDataForm.productionLineId': {
@@ -236,21 +224,13 @@ 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(
@@ -266,7 +246,7 @@ export default {
// //
async getWorksectionList(plId) { async getWorksectionList(plId) {
const response = await this.$axios( const response = await this.$axios(
'/base/core-workshop-section/listByParentId', '/base/workshop-section/listByParentId',
{ {
params: { params: {
id: plId, id: plId,

View File

@@ -0,0 +1,622 @@
<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,3 +1,10 @@
<!--
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">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
@@ -8,7 +15,10 @@
<el-row> <el-row>
<el-col class="custom-tabs"> <el-col class="custom-tabs">
<el-tabs v-model="activeName" :stretch="true"> <el-tabs
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
@@ -17,7 +27,7 @@
:page="1" :page="1"
:limit="10" :limit="10"
:table-data="list" :table-data="list"
:max-height="tableH"></base-table> @emitFun="handleEmitFun"></base-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane <el-tab-pane
:label="'\u3000可视化\u3000'" :label="'\u3000可视化\u3000'"
@@ -64,6 +74,7 @@
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>
@@ -75,44 +86,40 @@
</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, tableHeightMixin], mixins: [basicPageMixin],
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: 'factoryName', { prop: 'lineName', label: '产线' },
label: '工厂', { prop: 'sectionName', label: '工段' },
minWidth: 120, { prop: 'equipmentName', label: '设备' },
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: [
@@ -120,13 +127,12 @@ 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(2) : '-'), filter: (val) => (val != null ? +val.toFixed(3) : '-'),
}, },
], ],
}, },
@@ -137,14 +143,8 @@ 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,19 +154,14 @@ export default {
width: 128, width: 128,
prop: 'downTime', prop: 'downTime',
label: '故障时长[h]', label: '故障时长[h]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'), filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
{
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(2) : '-'), filter: (val) => (val != null ? +val.toFixed(3) : '-'),
}, },
], ],
}, },
@@ -177,67 +172,150 @@ 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(2) : '-'), filter: (val) => (val != null ? +val.toFixed(3) : '-'),
}, },
], ],
}, },
{
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: '工单',
param: 'workOrderId', placeholder: '请选择工单',
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: 'export', // name: 'visualization',
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: {
workOrderId: null, // lineId: null,
workOrderId: null,
recordTime: [], recordTime: [],
}, },
// 表单参数 // 表单参数
@@ -246,32 +324,54 @@ 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() {
@@ -285,23 +385,43 @@ 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 }) {
this.queryParams.workOrderId = payload.workOrderId || null; console.log('handleSearchBarBtnClick', btnName, payload);
this.queryParams.recordTime = payload.recordTime || undefined; if (btnName == 'visualization') {
if (btnName == 'search') { // 可视化
this.getList(); this.visualizationOpen = true;
} else { this.open = true;
this.exportExcel();
console.log('导出');
} }
if (btnName == 'search') {
this.queryParams.workOrderId = payload.workOrderId || null;
// 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 {
this.queryParams.recordTime = null;
}
this.getList();
}, },
cancel() {
this.open = false;
},
closed() {
this.visualizationOpen = false;
this.trendOpen = false;
},
submitForm() {},
handleTabClick() {},
}, },
}; };
</script> </script>

View File

@@ -1,222 +1,251 @@
<!--
* @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 <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
:formConfigs="formConfig" <base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list">
ref="searchBarForm" <!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@headBtnClick="buttonClick" /> @clickBtn="handleClick" /> -->
<base-table </base-table>
:table-props="tableProps" <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
:page="listQuery.pageNo" @pagination="getList" />
:limit="listQuery.pageSize" <!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
:table-data="list" </div>
: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',
prop: 'materialCode', label: '物料编码'
label: '物料编码', },
showOverflowtooltip: true, {
minWidth: 120, prop: 'dateName',
}, label: '物料批次'
{ },
prop: 'dateName', {
label: '物料批次', prop: 'equipName',
showOverflowtooltip: true, label: '使用设备'
}, },
{ {
prop: 'equipName', prop: 'num',
label: '使用设备', label: '使用数量'
showOverflowtooltip: true, },
}, {
{ prop: 'useTime',
prop: 'num', label: '使用时间',
label: '使用数量', filter: parseTime
showOverflowtooltip: true, },
}, {
{ prop: 'userName',
prop: 'useTime', label: '操作人'
label: '使用时间', },
filter: parseTime, {
width: 160, prop: 'source',
}, label: '数据来源',
{ filter: (val) => val == 1 ? '内部' : '外部'
prop: 'userName', },
label: '操作人', {
showOverflowtooltip: true, prop: 'remark',
}, label: '备注'
{ }
prop: 'source',
label: '数据来源',
filter: (val) => (val == 1 ? '内部' : '外部'),
},
{
prop: 'remark',
label: '备注',
showOverflowtooltip: true,
},
]; ];
export default { export default {
mixins: [tableHeightMixin], // mixins: [basicPage],
data() { data() {
return { return {
heightNum: 220, // 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: [], },
param: 'workOrderId', formConfig: [
defaultSelect: '', {
filterable: true, type: 'select',
clearable: false, label: '工单',
}, selectOptions: [],
{ labelField: 'name',
type: 'datePicker', valueField: 'id',
label: '时间段', param: 'workOrderId'
dateType: 'daterange', },
format: 'yyyy-MM-dd', {
valueFormat: 'yyyy-MM-dd', type: 'datePicker',
rangeSeparator: '-', label: '时间段',
startPlaceholder: '开始时间', dateType: 'daterange',
endPlaceholder: '结束时间', format: 'yyyy-MM-dd',
param: 'timeVal', valueFormat: "yyyy-MM-dd",
defaultSelect: [], rangeSeparator: '-',
width: 250, startPlaceholder: '开始时间',
}, endPlaceholder: '结束时间',
{ param: 'timeVal',
type: 'button', defaultSelect: [],
btnName: '查询', width: 250
name: 'search', },
color: 'primary', {
}, type: 'button',
{ btnName: '搜索',
type: 'separate', name: 'search',
}, color: 'primary',
{ },
type: this.$auth.hasPermi('monitoring:materiel-date-from:export') {
? 'button' type: 'separate',
: '', },
btnName: '导出', // {
name: 'export', // type: 'separate',
plain: true, // },
color: 'success', // {
}, // type: 'button',
], // btnName: '重置',
}; // name: 'reset',
}, // },
components: { // {
// AddOrUpdate, // type: 'separate',
}, // },
created() { // {
this.getDict(); // type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
}, // btnName: '新增',
methods: { // name: 'add',
getList() { // color: 'success',
getMaterialUseLogPage({ ...this.listQuery }).then((res) => { // plain: true,
this.list = res.data || []; // },
this.total = res.data.total || 0; // {
}); // type: 'separate',
}, // type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
getDict() { // },
getWorkOrderList().then((response) => { {
this.formConfig[0].selectOptions = response.data.map((item) => { type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
return { btnName: '导出',
name: item.name, name: 'export',
id: item.id, color: 'warning',
}; },
}); ],
console.log(this.formConfig[0].selectOptions); };
this.formConfig[0].defaultSelect = },
this.formConfig[0].selectOptions[0].id || ''; components: {
this.listQuery.workOrderId = // AddOrUpdate,
this.formConfig[0].selectOptions[0].id || ''; },
this.getList(); created() {
}); this.getList()
}, this.getDict()
handleExport() { },
// 处理查询参数 methods: {
let params = { ...this.listQuery }; getList() {
params.pageNo = undefined; getMaterialUseLogPage({ ...this.listQuery }).then(res => {
params.pageSize = undefined; this.list = res.data || []
this.exportLoading = true; this.listQuery.total = res.data.total || 0
exportEnergyPlcExcel(params) })
.then((response) => { },
this.$download.excel(response, '物料信息追溯 '); getDict() {
this.exportLoading = false; // 获取产品的属性列表
}) // getCustomerList().then((response) => {
.catch(() => {}); // console.log(response);
}, // this.customerList = response.data
buttonClick(val) { // // this.listQuery.total = response.data.total;
console.log(val); // })
if (val.btnName === 'search') { // getModelList().then((response) => {
this.listQuery.workOrderId = val.workOrderId // console.log(response);
? val.workOrderId // this.modelList = response.data
: undefined; // // this.listQuery.total = response.data.total;
if (val.timeVal && val.timeVal.length != 0) { // })
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'; getWorkOrderList().then((response) => {
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'; // console.log(response);
} else { this.formConfig[0].selectOptions = response.data.map((item) => {
this.listQuery.startTime = undefined; return {
this.listQuery.endTime = undefined; name: item.name,
} id: item.id
this.getList(); }
} else { })
this.handleExport(); console.log(this.formConfig[0].selectOptions);
} // this.listQuery.total = response.data.total;
}, })
otherMethods(val) { },
this.addOrUpdateVisible = true; handleExport() {
this.addOrEditTitle = '详情'; // 处理查询参数
this.$nextTick(() => { let params = { ...this.listQuery };
this.$refs.addOrUpdate.init(val.data.id, true); 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

@@ -1,218 +1,279 @@
<!--
* @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 <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
:formConfigs="formConfig" <base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list">
ref="searchBarForm" <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@headBtnClick="buttonClick" /> @clickBtn="handleClick" />
<base-table </base-table>
:table-props="tableProps" <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
:page="listQuery.pageNo" @pagination="getList" />
:limit="listQuery.pageSize" <!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
:table-data="list" </div>
: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: '工单编码', {
showOverflowtooltip: true, prop: 'planProductName',
minWidth: 120, label: '产品名'
}, },
{ {
prop: 'planProductName', prop: 'status',
label: '产品名', label: '状态',
showOverflowtooltip: true, filter: (val) => val == 1 ? '等待' : val == 2 ? '激活' : val == 3 ? '暂停' : val == 4 ? '完成' : '作废',
}, },
{ {
prop: 'status', prop: 'startProduceTime',
label: '状态', label: '开始生产时间',
filter: (val) => filter: parseTime
val == 1 },
? '等待' {
: val == 2 prop: 'finishProduceTime',
? '激活' label: '结束生产时间',
: val == 3 filter: parseTime
? '暂停' },
: val == 4 {
? '完成' prop: 'actualQuantity',
: '作废', label: '生产数量'
}, },
{ {
prop: 'startProduceTime', prop: 'planProductUnit',
label: '开始生产时间', label: '单位',
filter: parseTime, filter: publicFormatter('unit_dict')
width: 160, },
}, {
{ prop: 'processFlowName',
prop: 'finishProduceTime', label: '工艺名称'
label: '结束生产时间', },
filter: parseTime, {
width: 160, prop: 'yield',
}, 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: [tableHeightMixin], // mixins: [basicPage],
data() { data() {
return { return {
tableProps, // urlOptions: {
tableBtn: [ // getDataListURL: getMaterialUseLogPage,
{ // // deleteURL: deletePackingType,
type: 'processDetail', // // exportURL: exportPackingExcel,
btnName: '查看工艺详情', // },
}, tableProps,
].filter((v) => v), tableBtn: [
list: [], // this.$auth.hasPermi(`base:packaging-print-log:update`)
listQuery: { // ? {
pageSize: 10, // type: 'edit',
pageNo: 1, // btnName: '编辑',
}, // }
formConfig: [ // : undefined,
{ {
type: 'select', type: 'processDetail',
label: '工单名称', btnName: '查看工艺详情',
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);
this.$router.push({ ].filter((v) => v),
path: 'process-traceability-detail', list: [],
query: { listQuery: {
id: val.data.processFlowId, pageSize: 10,
orderId: val.data.id, pageNo: 1,
name: val.data.name, // total: 0,
specifications: res.data.specifications, // orderName: '工单',
productName: val.data.planProductName, // startTime: undefined,
processFlowName: val.data.processFlowName, // endTime:undefined,
}, },
}); formConfig: [
}); {
} type: 'select',
}, label: '工单',
getDict() { selectOptions: [],
getWorkOrderList().then((response) => { labelField: 'name',
this.formConfig[0].selectOptions = response.data.map((item) => { valueField: 'id',
return { param: 'orderName',
name: item.name, filterable: true,
id: item.name, },
}; {
}); type: 'datePicker',
console.log(this.formConfig[0].selectOptions); label: '工单开始时间',
}); dateType: 'daterange',
}, format: 'yyyy-MM-dd',
buttonClick(val) { valueFormat: "yyyy-MM-dd",
console.log(val); rangeSeparator: '-',
if (val.btnName === 'search') { startPlaceholder: '开始时间',
this.listQuery.orderName = val.orderName ? val.orderName : undefined; endPlaceholder: '结束时间',
if (val.timeVal && val.timeVal.length != 0) { param: 'timeVal',
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'; defaultSelect: [],
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'; width: 250
} else { },
this.listQuery.startTime = undefined; {
this.listQuery.endTime = undefined; type: 'button',
} btnName: '搜索',
this.getList(); name: 'search',
} color: 'primary',
}, },
otherMethods(val) { // {
this.addOrUpdateVisible = true; // type: 'separate',
this.addOrEditTitle = '详情'; // },
this.$nextTick(() => { // {
this.$refs.addOrUpdate.init(val.data.id, true); // type: 'button',
}); // 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

@@ -0,0 +1,219 @@
<!--
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

@@ -12,13 +12,12 @@
: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="80" :width="120"
fixed="right" fixed="right"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
@@ -59,29 +58,102 @@ import moment from 'moment';
import DialogForm from './dialogForm.vue'; import DialogForm from './dialogForm.vue';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default { export default {
name: 'QualityInspectionRecord', name: 'QualityInspectionRecord',
components: { components: {
DialogForm, DialogForm,
}, },
mixins: [basicPageMixin, tableHeightMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
rows: [
[
{
select: true,
label: '检测内容',
url: '/base/quality-inspection-det/listAll',
prop: 'inspectionDetId',
labelKey: 'content',
rules: [{ required: true, message: '检测内容不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
{
select: true,
label: '来源',
prop: 'source',
value: 1, //
options: [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
],
bind: {
filterable: true,
},
},
],
[
{
select: true,
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionLineId',
bind: {
filterable: true,
},
rules: [{ required: true, message: '产线不能为空', trigger: 'blur' }],
},
{
select: true,
label: '工段',
url: '/base/workshop-section/listAll', // url options
options: [], // options, options
prop: 'sectionId',
bind: {
filterable: true,
},
rules: [{ required: false, message: '不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '检测人员',
prop: 'checkPerson',
},
{
datetime: true,
label: '检测时间',
prop: 'checkTime',
rules: [{ required: true, message: '检测时间不能为空', trigger: 'blur' }],
bind: {
format: 'yyyy-MM-dd HH:mm:ss',
'value-format': 'timestamp',
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
clearable: true,
},
},
],
[{ textarea: true, label: '描述', prop: 'explainText' }],
[{ input: true, label: '备注', prop: 'remark' }],
],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'select', type: 'select',
label: '工单名称', label: '工单名称',
placeholder: '请选择工单名称',
param: 'workOrderId', param: 'workOrderId',
selectOptions: [], selectOptions: [],
filterable: true, filterable:true
}, },
{ {
type: 'select', type: 'select',
label: '检测内容', label: '检测内容',
selectOptions: [], placeholder: '请输入检测内容',
param: 'inspectionDetContent', selectOptions: [],
filterable: true, param: 'inspectionDetContent',
filterable: true
}, },
{ {
type: 'datePicker', type: 'datePicker',
@@ -107,7 +179,9 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:quality-inspection-record:create') type: this.$auth.hasPermi(
'base:quality-inspection-record:create'
)
? 'button' ? 'button'
: '', : '',
btnName: '新增', btnName: '新增',
@@ -120,10 +194,10 @@ export default {
this.$auth.hasPermi('base:quality-inspection-record:update') this.$auth.hasPermi('base:quality-inspection-record:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '修改',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:quality-inspection-record:delete') this.$auth.hasPermi('base:quality-inspection-record:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
@@ -134,31 +208,32 @@ export default {
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
width: 160, fixed: true,
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: 'workOrderName', // width: 128,
label: '工单名称', prop: 'workOrderName',
showOverflowtooltip: true, label: '工单名称',
}, },
{ {
// width: 128,
prop: 'inspectionDetContent', prop: 'inspectionDetContent',
label: '检测内容', label: '检测内容',
showOverflowtooltip: true,
}, },
{ {
prop: 'productionLineName', // width: 128,
prop: 'lineName',
label: '产线', label: '产线',
showOverflowtooltip: true,
}, },
{ {
// width: 128,
prop: 'checkPerson', prop: 'checkPerson',
label: '检测人员', label: '检测人员',
showOverflowtooltip: true,
}, },
{ {
width: 160, // width: 160,
prop: 'checkTime', prop: 'checkTime',
label: '检测时间', label: '检测时间',
filter: (val) => filter: (val) =>
@@ -172,25 +247,25 @@ export default {
}, },
], ],
// keys, queryParams pageNo, pageSize key // keys, queryParams pageNo, pageSize key
searchBarKeys: ['workOrderId', 'inspectionDetContent', 'checkTime'], searchBarKeys: ['inspectionDetContent', 'checkTime', 'productionLineId'],
form: { form: {
id: undefined, id: undefined,
inspectionDetId: undefined, inspectionDetId: undefined,
inspectionDetContent: undefined, inspectionDetContent: undefined,
productionLineId: undefined, productionLineId: undefined,
sectionId: undefined, sectionId: undefined,
checkPerson: undefined, checkPerson: undefined,
workOrderId: undefined, workOrderId:undefined,
checkTime: undefined, checkTime: undefined,
source: undefined, source: undefined,
workOrderId: undefined, explainText: undefined,
remark: undefined, remark: undefined,
}, },
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 10,
workOrderId: null, workOrderId:null,
inspectionDetContent: null, inspectionDetContent: null,
checkTime: [], checkTime: [],
// productionLineId: null, // productionLineId: null,
@@ -199,20 +274,43 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getProductLineList(); this.getProductLineList()
}, },
watch: { watch: {
form: { form: {
handler: function (val) { handler: function (val) {
console.log('form change:', val); console.log('form change:', val);
}, },
deep: true, deep: true
}, }
// 线
// 'form.productionLineId': {
// handler: function (val) {
// if (val == null) return;
// this.$axios('/base/workshop-section/listByParentId', {
// params: {
// id: val,
// },
// }).then((response) => {
// this.$set(
// this.rows[1][1], // this.rows
// 'options',
// response.data.map((item) => {
// return {
// label: item.name,
// value: item.id,
// };
// })
// );
// });
// },
// immediate: true,
// },
}, },
methods: { methods: {
/** 获取搜索栏的产线列表 */ /** 获取搜索栏的产线列表 */
getProductLineList() { getProductLineList() {
this.$axios('/base/core-work-order/listbyfilter').then((response) => { this.$axios('/base/core-work-order/listbyfilter').then((response) => {
this.searchBarFormConfig[0].selectOptions = response.data.map( this.searchBarFormConfig[0].selectOptions = response.data.map(
(item) => { (item) => {
return { return {
@@ -221,17 +319,17 @@ export default {
}; };
} }
); );
}); })
this.$axios('/base/quality-inspection-det/listAll').then((response) => { this.$axios('/base/quality-inspection-det/listAll').then((response) => {
this.searchBarFormConfig[1].selectOptions = response.data.map( this.searchBarFormConfig[1].selectOptions = response.data.map(
(item) => { (item) => {
return { return {
name: item.content, name: item.content,
id: item.content, id: item.content,
}; };
} }
); );
}); });
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
@@ -258,7 +356,7 @@ export default {
checkPerson: undefined, checkPerson: undefined,
checkTime: undefined, checkTime: undefined,
source: undefined, source: undefined,
workOrderId: undefined, explainText: undefined,
remark: undefined, remark: undefined,
productionLineId: undefined, productionLineId: undefined,
}; };
@@ -278,7 +376,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = '新增'; this.title = '添加质量检查信息记录表';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@@ -286,13 +384,13 @@ export default {
const id = row.id; const id = row.id;
getQualityInspectionRecord(id).then((response) => { getQualityInspectionRecord(id).then((response) => {
/** 因为后端返回的时间是时间戳格式,需转换 */ /** 因为后端返回的时间是时间戳格式,需转换 */
const info = {}; const info = {}
Object.keys(this.form).forEach((key) => { Object.keys(this.form).forEach(key => {
info[key] = response.data[key]; info[key] = response.data[key]
}); });
this.form = info; this.form = info;
this.open = true; this.open = true;
this.title = '编辑'; this.title = '修改质量检查信息记录表';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@@ -322,7 +420,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.delConfirm(row.inspectionDetContent) .confirm('是否确认删除"' + row.inspectionDetContent + '"?')
.then(function () { .then(function () {
return deleteQualityInspectionRecord(id); return deleteQualityInspectionRecord(id);
}) })

View File

@@ -0,0 +1,120 @@
<!--
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

@@ -0,0 +1,80 @@
{
"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

@@ -0,0 +1,176 @@
{
"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,160 +1,243 @@
<!--
* @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 <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
:formConfigs="formConfig" <base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="list">
ref="searchBarForm" <!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@headBtnClick="buttonClick" /> @clickBtn="handleClick" /> -->
<base-table </base-table>
:table-props="tableProps" <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
:page="listQuery.pageNo" @pagination="getList" />
:limit="listQuery.pageSize" <!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
:table-data="list" </div>
: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',
prop: 'material', label: '原料名称',
label: '原料名称', filter: publicFormatter('material')
filter: publicFormatter('material'), },
showOverflowtooltip: true, {
}, prop: 'origin',
{ label: '来源',
prop: 'origin', filter: (val)=>val == 1 ? '内部' : '外部'
label: '来源', },
filter: (val) => (val == 1 ? '内部' : '外部'), {
}, prop: 'supplierId',
{ label: '供应商'
prop: 'supplierName', },
label: '供应商', {
}, prop: 'batch',
{ label: '批次'
prop: 'batch', },
label: '批次', {
showOverflowtooltip: true, prop: 'num',
}, label: '数量'
{ },
prop: 'num', {
label: '数量', prop: 'unit',
}, label: '单位',
{ filter: publicFormatter('unit_dict')
prop: 'unit', }
label: '单位',
filter: publicFormatter('unit_dict'),
},
]; ];
export default { export default {
mixins: [tableHeightMixin], // mixins: [basicPage],
data() { data() {
return { return {
tableProps, // urlOptions: {
tableBtn: [ // getDataListURL: getMaterialUseLogPage,
this.$auth.hasPermi(`base:packaging-print-log:update`) // // deleteURL: deletePackingType,
? { // // exportURL: exportPackingExcel,
type: 'edit', // },
btnName: '编辑', tableProps,
} tableBtn: [
: undefined, this.$auth.hasPermi(`base:packaging-print-log:update`)
this.$auth.hasPermi(`base:packaging-print-log:delete`) ? {
? { type: 'edit',
type: 'delete', btnName: '编辑',
btnName: '删除', }
} : undefined,
: undefined, this.$auth.hasPermi(`base:packaging-print-log:delete`)
].filter((v) => v), ? {
list: [], type: 'delete',
listQuery: { btnName: '删除',
pageSize: 10, }
pageNo: 1, : undefined,
workOrderId: undefined,
startTime: undefined, ].filter((v) => v),
endTime: undefined, list: [],
}, listQuery: {
total: 0, pageSize: 10,
formConfig: [ pageNo: 1,
{ total: 0,
type: 'select', workOrderId: undefined,
label: '工单名称', startTime: undefined,
selectOptions: [], endTime:undefined,
labelField: 'name', },
valueField: 'id', formConfig: [
param: 'workOrderId', {
clearable: false, type: 'select',
filterable: true, label: '工单',
defaultSelect: '', selectOptions: [],
}, labelField: 'name',
{ valueField: 'id',
type: 'button', param: 'workOrderId'
btnName: '查询', },
name: 'search', // {
color: 'primary', // type: 'datePicker',
}, // label: '时间段',
], // dateType: 'daterange',
}; // format: 'yyyy-MM-dd',
}, // valueFormat: "yyyy-MM-dd",
created() { // rangeSeparator: '-',
this.getDict(); // startPlaceholder: '开始时间',
}, // endPlaceholder: '结束时间',
methods: { // param: 'timeVal',
getList() { // defaultSelect: [],
getRawMaterialPage({ ...this.listQuery }).then((res) => { // width: 250
this.list = res.data.records || []; // },
this.total = res.data.total || 0; {
}); type: 'button',
}, btnName: '搜索',
getDict() { name: 'search',
getWorkOrderList().then((response) => { color: 'primary',
this.formConfig[0].selectOptions = response.data.map((item) => { },
return { // {
name: item.name, // type: 'separate',
id: item.id, // },
}; // {
}); // type: 'button',
this.formConfig[0].defaultSelect = // btnName: '重置',
this.formConfig[0].selectOptions[0].id || ''; // name: 'reset',
this.listQuery.workOrderId = // },
this.formConfig[0].selectOptions[0].id || ''; // {
this.getList(); // type: 'separate',
}); // },
}, // {
buttonClick(val) { // type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
console.log(val); // btnName: '新增',
if (val.btnName === 'search') { // name: 'add',
this.listQuery.workOrderId = val.workOrderId // color: 'success',
? val.workOrderId // plain: true,
: undefined; // },
this.getList(); // {
} // type: 'separate',
}, // type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
otherMethods(val) { // },
this.addOrUpdateVisible = true; // {
this.addOrEditTitle = '详情'; // type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
this.$nextTick(() => { // btnName: '导出',
this.$refs.addOrUpdate.init(val.data.id, true); // name: 'export',
}); // 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

@@ -1,269 +0,0 @@
<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="workOrderId">
<el-select
v-model="dataForm.workOrderId"
placeholder="请选择工单名称"
style="width: 100%"
:disabled="showDetail">
<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="12">
<el-form-item label="班组" prop="teamId" :disabled="showDetail">
<el-select
v-model="dataForm.teamId"
placeholder="请选择班组"
style="width: 100%"
:disabled="showDetail">
<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="12">
<el-form-item label="数量" prop="num" style="width: 100%">
<el-input
v-model="dataForm.num"
placeholder="请输入数量"
:disabled="showDetail" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产线" prop="lineId">
<el-select
v-model="dataForm.lineId"
placeholder="请选择产线"
style="width: 100%"
:disabled="showDetail">
<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="12">
<el-form-item label="报废原因" prop="detId">
<el-select
v-model="dataForm.detId"
placeholder="请选择报废原因"
style="width: 100%"
:disabled="showDetail">
<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="12">
<el-form-item label="报废时间" prop="logTime">
<el-date-picker
v-model="dataForm.logTime"
type="datetime"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%"
placeholder="选择日期"
:disabled="showDetail"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="来源" prop="source">
<el-select
v-model="dataForm.source"
placeholder="请选择来源"
style="width: 100%"
:disabled="showDetail">
<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="24">
<el-form-item label="描述" prop="description">
<el-input
v-model="dataForm.description"
placeholder="请输入描述"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }"
:disabled="showDetail" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
placeholder="备注"
:disabled="showDetail" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
createQualityScrapLog,
updateQualityScrapLog,
getQualityScrapLog,
getWorkOrderList,
getTeamList,
getDetList,
getLineList,
} from '@/api/base/qualityScrapLog';
// import { getList } from '@/api/base/qualityScrapType';
import moment from 'moment';
export default {
data() {
return {
lineList: [],
workOrderList: [],
detList: [],
teamList: [],
sourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: '自动',
},
],
dataForm: {
id: undefined,
logTime: undefined,
source: 1,
detId: undefined,
workOrderId: null,
teamId: undefined,
num: null,
lineId: undefined,
description: undefined,
remark: undefined,
},
dataRule: {
workOrderId: [
{ required: true, message: '工单号不能为空', trigger: 'change' },
],
num: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
detId: [
{ required: true, message: '报废原因不能为空', trigger: 'change' },
],
logTime: [
{ required: true, message: '报废时间不能为空', trigger: 'change' },
],
},
showDetail: false,
};
},
mounted() {
this.getList();
},
methods: {
init(id, show) {
this.showDetail = show ? true : false;
this.dataForm.id = id || undefined;
if (id) {
// 编辑
getQualityScrapLog(id).then((res) => {
console.log(res);
this.dataForm = res.data;
this.dataForm.logTime = res.data.logTime || null;
console.log('==================');
});
} else {
this.dataForm.logTime = moment().format('yyyy-MM-DD hh:mm:ss');
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
updateQualityScrapLog(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
// 添加的提交
createQualityScrapLog(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
getList() {
// 物料列表
getWorkOrderList().then((res) => {
console.log(res);
this.workOrderList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
});
getLineList().then((res) => {
console.log(res);
this.lineList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
});
getDetList().then((res) => {
console.log(res);
this.detList = res.data.map((item) => {
return {
name: item.content,
id: item.id,
};
});
});
getTeamList().then((res) => {
console.log(res);
this.teamList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
});
},
formClear() {
this.$refs.dataForm.resetFields();
},
},
};
</script>

View File

@@ -1,159 +0,0 @@
/*
* @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.detContent)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id, detContent) {
this.$modal
.delConfirm(detContent)
.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

@@ -1,252 +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"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="110"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<el-row slot="footer" type="flex" justify="end">
<el-col :span="12">
<el-button size="small" class="btnTextStyle" @click="handleCancel">
{{ this.addOrEditTitle === '详情' ? '关闭' : '取消' }}
</el-button>
<el-button
v-show="this.addOrEditTitle !== '详情'"
type="primary"
size="small"
class="btnTextStyle"
@click="handleConfirm">
确定
</el-button>
</el-col>
</el-row>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from './basic-page';
import { parseTime } from '../../core/mixins/code-filter';
import {
getQualityScrapLogPage,
deleteQualityScrapLog,
getWorkOrderList,
getTeamList,
} from '@/api/base/qualityScrapLog';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
width: 160,
},
{
prop: 'workOrderName',
label: '工单',
showOverflowtooltip: true,
},
{
prop: 'teamName',
label: '班组',
showOverflowtooltip: true,
},
{
prop: 'detContent',
label: '报废原因',
showOverflowtooltip: true,
},
{
prop: 'logTime',
label: '报废时间',
filter: parseTime,
width: 160,
},
{
prop: 'num',
label: '数量',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getQualityScrapLogPage,
deleteURL: deleteQualityScrapLog,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:quality-scrap-log:detail`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`base:quality-scrap-log:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:quality-scrap-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'select',
label: '工单名称',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId',
filterable: true,
},
{
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-log:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
teamList: [],
showDetail: false,
};
},
components: {
AddOrUpdate,
},
created() {
this.getDict();
},
methods: {
otherMethods(val) {
if (val.type === 'detail') {
this.addOrEditTitle = '详情';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
}
},
// 获取数据列表
getDict() {
getWorkOrderList().then((res) => {
this.formConfig[0].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
});
getTeamList().then((res) => {
this.formConfig[1].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
this.teamList = res.data;
});
},
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
let arr = response.data.list;
arr.forEach((item) => {
item.teamName = this.teamList.find((v) => v.id == item.teamId)
? this.teamList.find((v) => v.id == item.teamId).name
: '';
});
this.tableData = arr;
this.total = response.data.total;
this.dataListLoading = false;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.workOrderId = val.workOrderId
? val.workOrderId
: undefined;
this.listQuery.teamId = val.teamId ? val.teamId : undefined;
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,424 +1,317 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
:model="queryParams" <el-form-item label="部门名称" prop="name">
ref="queryForm" <el-input v-model="queryParams.name" placeholder="请输入部门名称" clearable @keyup.enter.native="handleQuery"/>
size="small" </el-form-item>
:inline="true" <el-form-item label="状态" prop="status">
v-show="showSearch"> <el-select v-model="queryParams.status" placeholder="菜单状态" clearable>
<el-form-item label="部门名称" prop="name"> <el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
<el-input </el-select>
v-model="queryParams.name" </el-form-item>
placeholder="请输入部门名称" <el-form-item>
clearable <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
@keyup.enter.native="handleQuery" /> <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> </el-form>
<el-select
v-model="queryParams.status"
placeholder="菜单状态"
clearable>
<el-option
v-for="dict in statusDictDatas"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">
搜索
</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
type="primary" v-hasPermi="['system:dept:create']">新增</el-button>
plain </el-col>
icon="el-icon-plus" <el-col :span="1.5">
size="mini" <el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">展开/折叠</el-button>
@click="handleAdd" </el-col>
v-hasPermi="['system:dept:create']"> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
新增 </el-row>
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll">
展开/折叠
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"></right-toolbar>
</el-row>
<el-table <el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="id" :default-expand-all="isExpandAll"
v-if="refreshTable" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
v-loading="loading" <el-table-column prop="name" label="部门名称" width="260"></el-table-column>
:data="deptList" <el-table-column prop="leader" label="负责人" :formatter="userNicknameFormat" width="120"/>
row-key="id" <el-table-column prop="sort" label="排序" width="200"></el-table-column>
:default-expand-all="isExpandAll" <el-table-column prop="status" label="状态" width="100">
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> <template v-slot="scope">
<el-table-column <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
prop="name" </template>
label="部门名称" </el-table-column>
width="260"></el-table-column> <el-table-column label="创建时间" align="center" prop="createTime" width="200">
<el-table-column <template v-slot="scope">
prop="leader" <span>{{ parseTime(scope.row.createTime) }}</span>
label="负责人" </template>
:formatter="userNicknameFormat" </el-table-column>
width="120" /> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column prop="sort" label="排序" width="200"></el-table-column> <template v-slot="scope">
<el-table-column prop="status" label="状态" width="100"> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
<template v-slot="scope"> v-hasPermi="['system:dept:update']">修改</el-button>
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)"
</template> v-hasPermi="['system:dept:create']">新增</el-button>
</el-table-column> <el-button v-if="scope.row.parentId !== 0" size="mini" type="text" icon="el-icon-delete"
<el-table-column @click="handleDelete(scope.row)" v-hasPermi="['system:dept:delete']">删除</el-button>
label="创建时间" </template>
align="center" </el-table-column>
prop="createTime" </el-table>
width="200">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:dept:update']">
修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['system:dept:create']">
新增
</el-button>
<el-button
v-if="scope.row.parentId !== 0"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:dept:delete']">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改部门对话框 --> <!-- 添加或修改部门对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="上级部门" prop="parentId"> <el-form-item label="上级部门" prop="parentId">
<treeselect <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
v-model="form.parentId" </el-form-item>
:options="deptOptions" </el-col>
:normalizer="normalizer" <el-col :span="12">
placeholder="选择上级部门" /> <el-form-item label="部门名称" prop="name">
</el-form-item> <el-input v-model="form.name" placeholder="请输入部门名称" />
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="部门名称" prop="name"> <el-col :span="12">
<el-input v-model="form.name" placeholder="请输入部门名称" /> <el-form-item label="显示排序" prop="sort">
</el-form-item> <el-input-number v-model="form.sort" controls-position="right" :min="0" />
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="显示排序" prop="sort"> <el-col :span="12">
<el-input-number <el-form-item label="负责人" prop="leaderUserId">
v-model="form.sort" <el-select v-model="form.leaderUserId" placeholder="请输入负责人" clearable style="width: 100%">
controls-position="right" <el-option v-for="item in users" :key="parseInt(item.id)" :label="item.nickname" :value="parseInt(item.id)" />
:min="0" /> </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="leaderUserId"> <el-form-item label="联系电话" prop="phone">
<el-select <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
v-model="form.leaderUserId" </el-form-item>
placeholder="请输入负责人" </el-col>
clearable <el-col :span="12">
style="width: 100%"> <el-form-item label="邮箱" prop="email">
<el-option <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
v-for="item in users" </el-form-item>
:key="parseInt(item.id)" </el-col>
:label="item.nickname" <el-col :span="12">
:value="parseInt(item.id)" /> <el-form-item label="部门状态" prop="status">
</el-select> <el-radio-group v-model="form.status">
</el-form-item> <el-radio v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)">
</el-col> {{dict.label}}</el-radio>
<el-col :span="12"> </el-radio-group>
<el-form-item label="联系电话" prop="phone"> </el-form-item>
<el-input </el-col>
v-model="form.phone" </el-row>
placeholder="请输入联系电话" </el-form>
maxlength="11" /> <div slot="footer" class="dialog-footer">
</el-form-item> <el-button type="primary" @click="submitForm"> </el-button>
</el-col> <el-button @click="cancel"> </el-button>
<el-col :span="12"> </div>
<el-form-item label="邮箱" prop="email"> </el-dialog>
<el-input </div>
v-model="form.email"
placeholder="请输入邮箱"
maxlength="50" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusDictDatas"
:key="parseInt(dict.value)"
:label="parseInt(dict.value)">
{{ dict.label }}
</el-radio>
</el-radio-group>
</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>
</template> </template>
<script> <script>
import { import { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/dept";
listDept, import Treeselect from "@riophae/vue-treeselect";
getDept, import "@riophae/vue-treeselect/dist/vue-treeselect.css";
delDept,
addDept,
updateDept,
} from '@/api/system/dept';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
import { CommonStatusEnum } from '@/utils/constants'; import {CommonStatusEnum} from '@/utils/constants'
import { getDictDatas, DICT_TYPE } from '@/utils/dict'; import { getDictDatas, DICT_TYPE } from '@/utils/dict'
import { listSimpleUsers } from '@/api/system/user'; import {listSimpleUsers} from "@/api/system/user";
export default { export default {
name: 'SystemDept', name: "SystemDept",
components: { Treeselect }, components: { Treeselect },
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 显示搜索条件 // 显示搜索条件
showSearch: true, showSearch: true,
// 表格树数据 // 表格树数据
deptList: [], deptList: [],
// 部门树选项 // 部门树选项
deptOptions: [], deptOptions: [],
// 用户下拉列表 // 用户下拉列表
users: [], users: [],
// 弹出层标题 // 弹出层标题
title: '', title: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 是否展开,默认全部展开 // 是否展开,默认全部展开
isExpandAll: true, isExpandAll: true,
// 重新渲染表格状态 // 重新渲染表格状态
refreshTable: true, refreshTable: true,
// 是否展开 // 是否展开
expand: false, expand: false,
// 查询参数 // 查询参数
queryParams: { queryParams: {
name: undefined, name: undefined,
status: undefined, status: undefined
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
name: [ name: [
{ required: true, message: '部门名称不能为空', trigger: 'blur' }, { required: true, message: "部门名称不能为空", trigger: "blur" }
], ],
sort: [ sort: [
{ required: true, message: '显示排序不能为空', trigger: 'blur' }, { required: true, message: "显示排序不能为空", trigger: "blur" }
], ],
email: [ email: [
{ {
type: 'email', type: "email",
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ['blur', 'change'], trigger: ["blur", "change"]
}, }
], ],
phone: [ phone: [
{ {
pattern: pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
/^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/, message: "请输入正确的手机号码",
message: '请输入正确的手机号码', trigger: "blur"
trigger: 'blur', }
}, ],
], status: [
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }], { required: true, message: "状态不能为空", trigger: "blur" }
}, ]
},
// 枚举 // 枚举
CommonStatusEnum: CommonStatusEnum, CommonStatusEnum: CommonStatusEnum,
// 数据字典 // 数据字典
statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS), statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS)
}; };
}, },
created() { created() {
this.getList(); this.getList();
// 获得用户列表 // 获得用户列表
listSimpleUsers().then((response) => { listSimpleUsers().then(response => {
this.users = response.data; this.users = response.data;
}); });
}, },
methods: { methods: {
/** 查询部门列表 */ /** 查询部门列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listDept(this.queryParams).then((response) => { listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, 'id'); this.deptList = this.handleTree(response.data, "id");
this.loading = false; this.loading = false;
}); });
}, },
/** 转换部门数据结构 */ /** 转换部门数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children;
} }
return { return {
id: node.id, id: node.id,
label: node.name, label: node.name,
children: node.children, children: node.children
}; };
}, },
// 用户昵称展示 // 用户昵称展示
userNicknameFormat(row, column) { userNicknameFormat(row, column) {
if (!row.leaderUserId) { if (!row.leaderUserId) {
return '未设置'; return '未设置';
} }
for (const user of this.users) { for (const user of this.users) {
if (row.leaderUserId === user.id) { if (row.leaderUserId === user.id) {
return user.nickname; return user.nickname;
} }
} }
return '未知【' + row.leaderUserId + '】'; return '未知【' + row.leaderUserId + '】';
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form = {
id: undefined, id: undefined,
parentId: undefined, parentId: undefined,
name: undefined, name: undefined,
sort: undefined, sort: undefined,
leaderUserId: undefined, leaderUserId: undefined,
phone: undefined, phone: undefined,
email: undefined, email: undefined,
status: CommonStatusEnum.ENABLE, status: CommonStatusEnum.ENABLE,
}; };
this.resetForm('form'); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm'); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd(row) { handleAdd(row) {
this.reset(); this.reset();
if (row !== undefined) { if (row !== undefined) {
this.form.parentId = row.id; this.form.parentId = row.id;
} }
this.open = true; this.open = true;
this.title = '添加部门'; this.title = "添加部门";
listDept().then((response) => { listDept().then(response => {
this.deptOptions = this.handleTree(response.data, 'id'); this.deptOptions = this.handleTree(response.data, "id");
}); });
}, },
/** 展开/折叠操作 */ /** 展开/折叠操作 */
toggleExpandAll() { toggleExpandAll() {
this.refreshTable = false; this.refreshTable = false;
this.isExpandAll = !this.isExpandAll; this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => { this.$nextTick(() => {
this.refreshTable = true; this.refreshTable = true;
}); });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
getDept(row.id).then((response) => { getDept(row.id).then(response => {
this.form = response.data; this.form = response.data;
if (this.form.parentId === 0) { if (this.form.parentId === 0) { // 无父部门时,标记为 undefined避免展示为 Unknown
// 无父部门时,标记为 undefined避免展示为 Unknown this.form.parentId = undefined;
this.form.parentId = undefined; }
} this.open = true;
this.open = true; this.title = "修改部门";
this.title = '修改部门'; });
}); listDept(row.id).then(response => {
listDept(row.id).then((response) => { this.deptOptions = this.handleTree(response.data, "id");
this.deptOptions = this.handleTree(response.data, 'id'); });
}); },
}, /** 提交按钮 */
/** 提交按钮 */ submitForm: function() {
submitForm: function () { this.$refs["form"].validate(valid => {
this.$refs['form'].validate((valid) => { if (valid) {
if (valid) { if (this.form.id !== undefined) {
if (this.form.id !== undefined) { updateDept(this.form).then(response => {
updateDept(this.form).then((response) => { this.$modal.msgSuccess("修改成功");
this.$modal.msgSuccess('修改成功'); this.open = false;
this.open = false; this.getList();
this.getList(); });
}); } else {
} else { addDept(this.form).then(response => {
addDept(this.form).then((response) => { this.$modal.msgSuccess("新增成功");
this.$modal.msgSuccess('新增成功'); this.open = false;
this.open = false; this.getList();
this.getList(); });
}); }
} }
} });
}); },
}, /** 删除按钮操作 */
/** 删除按钮操作 */ handleDelete(row) {
handleDelete(row) { this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function() {
this.$modal return delDept(row.id);
.delConfirm(row.name) }).then(() => {
.then(function () { this.getList();
return delDept(row.id); this.$modal.msgSuccess("删除成功");
}) }).catch(() => {});
.then(() => { }
this.getList(); }
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
}; };
</script> </script>