Merge pull request 'projects/mes-zjl' (#383) from projects/mes-zjl into projects/mes-test

Reviewed-on: #383
This commit is contained in:
朱菊兰 2024-07-19 15:30:28 +08:00
commit 3e51a00e17
17 changed files with 903 additions and 1057 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -12,12 +12,13 @@
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-data="list" :table-data="list"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:width="120" :width="80"
fixed="right" fixed="right"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
@ -102,10 +103,11 @@ import {
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default { export default {
name: 'QualityInspectionDet', name: 'QualityInspectionDet',
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
typeList: [], // typeList: [], //
@ -180,19 +182,18 @@ export default {
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
fixed: true, width: 160,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ prop: 'typeName', label: '检测类型' }, { prop: 'typeName', label: '检测类型', showOverflowtooltip: true },
{ prop: 'content', label: '检测内容' }, { prop: 'content', label: '检测内容', showOverflowtooltip: true },
{ prop: 'code', label: '检测编码' }, { prop: 'code', label: '检测编码', showOverflowtooltip: true },
{ prop: 'remark', label: '备注' }, { prop: 'remark', label: '备注', showOverflowtooltip: true },
], ],
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
content: null, content: null,
createTime: [], createTime: [],
}, },

View File

@ -18,7 +18,7 @@
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:width="120" :width="80"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
@ -36,7 +36,7 @@
:dialogTitle="title" :dialogTitle="title"
:dialogVisible="open" :dialogVisible="open"
@close="cancel" @close="cancel"
width="30%" width="40%"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">
<DialogForm <DialogForm
@ -112,13 +112,12 @@ export default {
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
fixed: true, width: 160,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ prop: 'name', label: '检测类型' }, { prop: 'name', label: '检测类型', showOverflowtooltip: true },
{ prop: 'code', label: '类型编码' }, { prop: 'code', label: '类型编码', showOverflowtooltip: true },
{ prop: 'remark', label: '备注' }, { prop: 'remark', label: '备注', showOverflowtooltip: true },
], ],
// //
searchBarFormConfig: [ searchBarFormConfig: [
@ -152,7 +151,7 @@ export default {
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
name: null, name: null,
}, },
// //
@ -232,7 +231,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = '添加质量检测类型基础'; this.title = '新增';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -241,7 +240,7 @@ export default {
getQualityInspectionType(id).then((response) => { getQualityInspectionType(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = '修改质量检测类型基础'; this.title = '编辑';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */

View File

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

View File

@ -9,11 +9,12 @@
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:table-data="tableData"> :table-data="tableData"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="120" :width="80"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
@ -21,7 +22,7 @@
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="total"
@pagination="getDataList" /> @pagination="getDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@ -29,7 +30,7 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width="40%"> width="50%">
<add-or-update <add-or-update
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update> @refreshDataList="successSubmit"></add-or-update>
@ -46,32 +47,38 @@ import {
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], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@ -109,6 +116,7 @@ export default {
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
param: 'typeId', param: 'typeId',
filterable: true,
}, },
{ {
type: 'button', type: 'button',
@ -129,6 +137,11 @@ export default {
plain: true, plain: true,
}, },
], ],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
}; };
}, },
components: { components: {
@ -144,7 +157,7 @@ export default {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then((response) => { this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list; this.tableData = response.data.list;
this.listQuery.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
@ -157,20 +170,10 @@ export default {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.content = val.content ? val.content : undefined; this.listQuery.content = val.content ? val.content : undefined;
this.listQuery.typeId = val.typeId ? val.typeId : undefined; this.listQuery.typeId = val.typeId ? val.typeId : undefined;
this.getDataList(); 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

@ -55,7 +55,6 @@ import {
getQualityScrapType, getQualityScrapType,
getCode, getCode,
} from '@/api/base/qualityScrapType'; } from '@/api/base/qualityScrapType';
// import { getMaterialList } from "@/api/base/material";
export default { export default {
mixins: [basicAdd], mixins: [basicAdd],
@ -75,9 +74,7 @@ export default {
description: undefined, description: undefined,
remark: undefined, remark: undefined,
}, },
// materialList: [],
dataRule: { dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
code: [ code: [
{ required: true, message: '报废类型编码不能为空', trigger: 'blur' }, { required: true, message: '报废类型编码不能为空', trigger: 'blur' },
], ],
@ -87,22 +84,5 @@ export default {
}, },
}; };
}, },
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> </script>

View File

@ -9,11 +9,12 @@
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:table-data="tableData"> :table-data="tableData"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="120" :width="80"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
@ -21,7 +22,7 @@
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="total"
@pagination="getDataList" /> @pagination="getDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@ -29,7 +30,7 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width="40%"> width="50%">
<add-or-update <add-or-update
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update> @refreshDataList="successSubmit"></add-or-update>
@ -45,33 +46,39 @@ 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], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@ -121,6 +128,11 @@ export default {
plain: true, plain: true,
}, },
], ],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
}; };
}, },
components: { components: {
@ -133,7 +145,7 @@ export default {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then((response) => { this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list; this.tableData = response.data.list;
this.listQuery.total = response.data.total; this.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
@ -141,19 +153,9 @@ export default {
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,10 +1,3 @@
<!--
filename: index.vue
author: liubin
date: 2023-09-04 09:34:52
description: 设备效率分析
-->
<template> <template>
<div class="app-container allow-overflow"> <div class="app-container allow-overflow">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
@ -15,10 +8,7 @@
<el-row> <el-row>
<el-col class="custom-tabs"> <el-col class="custom-tabs">
<el-tabs <el-tabs v-model="activeName" :stretch="true">
v-model="activeName"
:stretch="true"
@tab-click="handleTabClick">
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table"> <el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
@ -27,7 +17,7 @@
:page="1" :page="1"
:limit="10" :limit="10"
:table-data="list" :table-data="list"
@emitFun="handleEmitFun"></base-table> :max-height="tableH"></base-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane <el-tab-pane
:label="'\u3000可视化\u3000'" :label="'\u3000可视化\u3000'"
@ -74,7 +64,6 @@
v-for="item in list" v-for="item in list"
:key="item.id" :key="item.id"
:value="item" /> :value="item" />
<!-- <pie-chart v-for="item in 5" :key="item" :value="item" /> -->
</div> </div>
</div> </div>
</div> </div>
@ -86,40 +75,43 @@
</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';
export default { export default {
name: 'EfficiencyAnalysis', name: 'EfficiencyAnalysis',
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
components: { PieChart }, components: { PieChart },
props: {}, props: {},
data() { data() {
return { return {
activeName: 'table', activeName: 'table',
open: false,
visualizationOpen: false,
trendOpen: false,
// tableBtn: [
// this.$auth.hasPermi('base:equipment-group:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:equipment-group:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'factoryName', label: '工厂' }, {
{ prop: 'lineName', label: '产线' }, prop: 'factoryName',
{ prop: 'sectionName', label: '工段' }, label: '工厂',
{ prop: 'equipmentName', label: '设备' }, minWidth: 120,
showOverflowtooltip: true,
},
{
prop: 'lineName',
label: '产线',
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: 'sectionName',
label: '工段',
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: 'equipmentName',
label: '设备',
minWidth: 120,
showOverflowtooltip: true,
},
{ {
label: '有效时间', label: '有效时间',
children: [ children: [
@ -127,12 +119,13 @@ export default {
width: 128, width: 128,
prop: 'workTime', prop: 'workTime',
label: '工作时长[h]', label: '工作时长[h]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ {
width: 128, width: 128,
prop: 'workRate', prop: 'workRate',
label: '百分比[%]', label: '百分比[%]',
filter: (val) => (val != null ? +val.toFixed(3) : '-'), filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
], ],
}, },
@ -143,8 +136,14 @@ export default {
width: 128, width: 128,
prop: 'stopTime', prop: 'stopTime',
label: '停机时长[h]', label: '停机时长[h]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
{
width: 128,
prop: 'stopRate',
label: '百分比[%]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ width: 128, prop: 'stopRate', label: '百分比[%]' },
], ],
}, },
{ {
@ -154,14 +153,19 @@ export default {
width: 128, width: 128,
prop: 'downTime', prop: 'downTime',
label: '故障时长[h]', label: '故障时长[h]',
filter: (val) => (val != null ? +val.toFixed(3) : '-'), filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
{
width: 128,
prop: 'downRate',
label: '百分比[%]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ width: 128, prop: 'downRate', label: '百分比[%]' },
{ {
width: 128, width: 128,
prop: 'timeEfficiency', prop: 'timeEfficiency',
label: '时间开动率', label: '时间开动率',
filter: (val) => (val != null ? +val.toFixed(3) : '-'), filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
], ],
}, },
@ -172,87 +176,31 @@ export default {
width: 128, width: 128,
prop: 'realProcSpeed', prop: 'realProcSpeed',
label: '实际加工速度', label: '实际加工速度',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ {
width: 128, width: 128,
prop: 'designProcSpeed', prop: 'designProcSpeed',
label: '理论加工速度', label: '理论加工速度',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
{ {
width: 128, width: 128,
prop: 'peEfficiency', prop: 'peEfficiency',
label: '速度开动率', label: '速度开动率',
filter: (val) => (val != null ? +val.toFixed(3) : '-'), filter: (val) => (val != null ? +val.toFixed(2) : '-'),
}, },
], ],
}, },
// {
// prop: 'oee',
// label: 'OEE',
// filter: (val) => (val != null ? +val.toFixed(3) : '-'),
// },
// {
// prop: 'teep',
// label: 'TEEP',
// filter: (val) => (val != null ? +val.toFixed(3) : '-'),
// },
// {
// _action: 'view-trend',
// label: '',
// ,
// subcomponent: {
// props: ['injectData'],
// render: function (h) {
// const _this = this;
// return h(
// 'el-button',
// {
// props: { type: 'text' },
// on: {
// click: function () {
// console.log('inejctdata', _this.injectData);
// _this.$emit('emitData', {
// action: _this.injectData._action,
// // value: _this.injectData.id,
// value: _this.injectData,
// });
// },
// },
// },
// ''
// );
// },
// },
// },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'select', type: 'select',
label: '工单', label: '工单名称',
placeholder: '请选择工单',
param: 'workOrderId', param: 'workOrderId',
selectOptions: [], selectOptions: [],
filterable: true, filterable: true,
}, },
// {
// 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', // parent: 'dateFilterType',
// //
@ -265,21 +213,8 @@ export default {
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始时间', startPlaceholder: '开始时间',
endPlaceholder: '结束时间', endPlaceholder: '结束时间',
param: 'timerange', param: 'recordTime',
}, },
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -296,26 +231,9 @@ export default {
plain: true, plain: true,
color: 'success', color: 'success',
}, },
// {
// type: 'button',
// btnName: 'OEE',
// name: 'add',
// plain: true,
// color: 'success',
// },
// {
// type: 'button',
// btnName: 'TEEP',
// name: 'add',
// plain: true,
// color: 'warning',
// },
], ],
//
open: false,
// //
queryParams: { queryParams: {
// lineId: null,
workOrderId: null, workOrderId: null,
recordTime: [], recordTime: [],
}, },
@ -326,19 +244,16 @@ export default {
}, },
created() { created() {
this.getWorkOrder(); this.getWorkOrder();
// this.getLine();
this.getList(); 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,
@ -347,33 +262,6 @@ export default {
}); });
} }
}, },
// /** 线 */
// 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() {
this.loading = true; this.loading = true;
@ -388,41 +276,17 @@ export default {
}, },
handleSearchBarBtnClick({ btnName, ...payload }) { handleSearchBarBtnClick({ btnName, ...payload }) {
console.log('handleSearchBarBtnClick', btnName, payload); console.log(btnName);
if (btnName == 'visualization') { console.log(payload);
//
this.visualizationOpen = true;
this.open = true;
}
if (btnName == 'search') { if (btnName == 'search') {
this.queryParams.workOrderId = payload.workOrderId || null; this.queryParams.workOrderId = payload.workOrderId || null;
// this.queryParams.lineId = payload.lineId || null; this.queryParams.recordTime = payload.recordTime || undefined;
if (0 == payload.dateFilterType) { this.getList();
this.queryParams.recordTime = payload.timerange;
} else if (1 == payload.dateFilterType) {
this.queryParams.recordTime = [
`${payload.timeday} 00:00:00`,
`${payload.timeday} 23:59:59`,
];
}
} else { } else {
this.queryParams.recordTime = null; this.queryParams.recordTime = null;
console.log('导出');
} }
this.getList();
}, },
cancel() {
this.open = false;
},
closed() {
this.visualizationOpen = false;
this.trendOpen = false;
},
submitForm() {},
handleTabClick() {},
}, },
}; };
</script> </script>

View File

@ -1,10 +1,3 @@
<!--
* @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
@ -15,59 +8,62 @@
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:table-data="list"> :table-data="list"
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" :max-height="tableH"></base-table>
@clickBtn="handleClick" /> -->
</base-table>
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="listQuery.total"
@pagination="getList" /> @pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div> </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', prop: 'dateName',
label: '物料批次', label: '物料批次',
showOverflowtooltip: true,
}, },
{ {
prop: 'equipName', prop: 'equipName',
label: '使用设备', label: '使用设备',
showOverflowtooltip: true,
}, },
{ {
prop: 'num', prop: 'num',
label: '使用数量', label: '使用数量',
showOverflowtooltip: true,
}, },
{ {
prop: 'useTime', prop: 'useTime',
label: '使用时间', label: '使用时间',
filter: parseTime, filter: parseTime,
width: 160,
}, },
{ {
prop: 'userName', prop: 'userName',
label: '操作人', label: '操作人',
showOverflowtooltip: true,
}, },
{ {
prop: 'source', prop: 'source',
@ -77,18 +73,15 @@ const tableProps = [
{ {
prop: 'remark', prop: 'remark',
label: '备注', label: '备注',
showOverflowtooltip: true,
}, },
]; ];
export default { export default {
// mixins: [basicPage], mixins: [tableHeightMixin],
data() { data() {
return { return {
// urlOptions: { heightNum: 220,
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`) this.$auth.hasPermi(`base:packaging-print-log:update`)
@ -116,7 +109,7 @@ export default {
formConfig: [ formConfig: [
{ {
type: 'select', type: 'select',
label: '工单', label: '工单名称',
selectOptions: [], selectOptions: [],
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
@ -144,28 +137,6 @@ export default {
{ {
type: 'separate', type: 'separate',
}, },
// {
// type: 'separate',
// },
// {
// 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') type: this.$auth.hasPermi('monitoring:materiel-date-from:export')
? 'button' ? 'button'
@ -193,19 +164,7 @@ export default {
}); });
}, },
getDict() { 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) => { getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => { this.formConfig[0].selectOptions = response.data.map((item) => {
return { return {
name: item.name, name: item.name,
@ -213,7 +172,6 @@ export default {
}; };
}); });
console.log(this.formConfig[0].selectOptions); console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
}); });
}, },
handleExport() { handleExport() {
@ -239,7 +197,6 @@ export default {
this.listQuery.workOrderId = val.workOrderId this.listQuery.workOrderId = val.workOrderId
? val.workOrderId ? val.workOrderId
: undefined; : undefined;
// this.queryParams.status = val.status
if (val.timeVal && val.timeVal.length != 0) { if (val.timeVal && val.timeVal.length != 0) {
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'; this.listQuery.startTime = val.timeVal[0] + ' 00:00:00';
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'; this.listQuery.endTime = val.timeVal[1] + ' 23:59:59';
@ -250,11 +207,6 @@ export default {
this.getList(); this.getList();
} else { } else {
this.handleExport(); this.handleExport();
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
} }
}, },
otherMethods(val) { otherMethods(val) {

View File

@ -1,10 +1,3 @@
<!--
* @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
@ -15,7 +8,8 @@
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:table-data="list"> :table-data="list"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
@ -29,34 +23,35 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="listQuery.total"
@pagination="getList" /> @pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div> </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', prop: 'code',
label: '工单编码', label: '工单编码',
showOverflowtooltip: true,
minWidth: 120,
}, },
{ {
prop: 'planProductName', prop: 'planProductName',
label: '产品名', label: '产品名',
showOverflowtooltip: true,
}, },
{ {
prop: 'status', prop: 'status',
@ -76,11 +71,13 @@ const tableProps = [
prop: 'startProduceTime', prop: 'startProduceTime',
label: '开始生产时间', label: '开始生产时间',
filter: parseTime, filter: parseTime,
width: 160,
}, },
{ {
prop: 'finishProduceTime', prop: 'finishProduceTime',
label: '结束生产时间', label: '结束生产时间',
filter: parseTime, filter: parseTime,
width: 160,
}, },
{ {
prop: 'actualQuantity', prop: 'actualQuantity',
@ -91,33 +88,25 @@ const tableProps = [
label: '单位', label: '单位',
filter: publicFormatter('unit_dict'), filter: publicFormatter('unit_dict'),
}, },
{
prop: 'processFlowName',
label: '工艺名称',
},
{ {
prop: 'yield', prop: 'yield',
label: '合格率', label: '合格率',
filter: (val) => (val ? val.toFixed(2) + '%' : '-'),
align: 'center',
},
{
prop: 'processFlowName',
label: '工艺名称',
showOverflowtooltip: true,
}, },
]; ];
export default { export default {
// mixins: [basicPage], mixins: [tableHeightMixin],
data() { data() {
return { return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps, tableProps,
tableBtn: [ tableBtn: [
// this.$auth.hasPermi(`base:packaging-print-log:update`)
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
{ {
type: 'processDetail', type: 'processDetail',
btnName: '查看工艺详情', btnName: '查看工艺详情',
@ -127,10 +116,6 @@ export default {
listQuery: { listQuery: {
pageSize: 10, pageSize: 10,
pageNo: 1, pageNo: 1,
// total: 0,
// orderName: '',
// startTime: undefined,
// endTime:undefined,
}, },
formConfig: [ formConfig: [
{ {
@ -161,40 +146,9 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
// {
// type: 'separate',
// },
// {
// 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() { created() {
this.getList(); this.getList();
this.getDict(); this.getDict();
@ -222,29 +176,13 @@ export default {
specifications: res.data.specifications, specifications: res.data.specifications,
productName: val.data.planProductName, productName: val.data.planProductName,
processFlowName: val.data.processFlowName, processFlowName: val.data.processFlowName,
// planProductId: val.data.planProductId
// equipmentName,
}, },
}); });
}); });
// this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
} }
}, },
getDict() { 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) => { getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => { this.formConfig[0].selectOptions = response.data.map((item) => {
return { return {
name: item.name, name: item.name,
@ -252,27 +190,12 @@ export default {
}; };
}); });
console.log(this.formConfig[0].selectOptions); 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) { buttonClick(val) {
console.log(val); console.log(val);
if (val.btnName === 'search') { if (val.btnName === 'search') {
this.listQuery.orderName = val.orderName ? val.orderName : undefined; this.listQuery.orderName = val.orderName ? val.orderName : undefined;
// this.queryParams.status = val.status
if (val.timeVal && val.timeVal.length != 0) { if (val.timeVal && val.timeVal.length != 0) {
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'; this.listQuery.startTime = val.timeVal[0] + ' 00:00:00';
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'; this.listQuery.endTime = val.timeVal[1] + ' 23:59:59';
@ -281,13 +204,6 @@ export default {
this.listQuery.endTime = undefined; this.listQuery.endTime = undefined;
} }
this.getList(); this.getList();
} else {
// this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
} }
}, },
otherMethods(val) { otherMethods(val) {

View File

@ -1,10 +1,3 @@
<!--
* @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
@ -15,30 +8,24 @@
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:table-data="list"> :table-data="list"
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" :max-height="tableH"></base-table>
@clickBtn="handleClick" /> -->
</base-table>
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="total"
@pagination="getList" /> @pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div> </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 = [
{ {
@ -51,6 +38,7 @@ const tableProps = [
prop: 'material', prop: 'material',
label: '原料名称', label: '原料名称',
filter: publicFormatter('material'), filter: publicFormatter('material'),
showOverflowtooltip: true,
}, },
{ {
prop: 'origin', prop: 'origin',
@ -58,12 +46,13 @@ const tableProps = [
filter: (val) => (val == 1 ? '内部' : '外部'), filter: (val) => (val == 1 ? '内部' : '外部'),
}, },
{ {
prop: 'supplierId', prop: 'supplierName',
label: '供应商', label: '供应商',
}, },
{ {
prop: 'batch', prop: 'batch',
label: '批次', label: '批次',
showOverflowtooltip: true,
}, },
{ {
prop: 'num', prop: 'num',
@ -77,14 +66,9 @@ const tableProps = [
]; ];
export default { export default {
// mixins: [basicPage], mixins: [tableHeightMixin],
data() { data() {
return { return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`) this.$auth.hasPermi(`base:packaging-print-log:update`)
@ -104,73 +88,29 @@ export default {
listQuery: { listQuery: {
pageSize: 10, pageSize: 10,
pageNo: 1, pageNo: 1,
total: 0,
workOrderId: undefined, workOrderId: undefined,
startTime: undefined, startTime: undefined,
endTime: undefined, endTime: undefined,
}, },
total: 0,
formConfig: [ formConfig: [
{ {
type: 'select', type: 'select',
label: '工单', label: '工单名称',
selectOptions: [], selectOptions: [],
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
param: 'workOrderId', param: 'workOrderId',
}, },
// {
// type: 'datePicker',
// label: '',
// dateType: 'daterange',
// format: 'yyyy-MM-dd',
// valueFormat: "yyyy-MM-dd",
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// param: 'timeVal',
// defaultSelect: [],
// width: 250
// },
{ {
type: 'button', type: 'button',
btnName: '搜索', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
// {
// type: 'separate',
// },
// {
// 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() { created() {
this.getList(); this.getList();
this.getDict(); this.getDict();
@ -179,23 +119,11 @@ export default {
getList() { getList() {
getRawMaterialPage({ ...this.listQuery }).then((res) => { getRawMaterialPage({ ...this.listQuery }).then((res) => {
this.list = res.data.records || []; this.list = res.data.records || [];
this.listQuery.total = res.data.total || 0; this.total = res.data.total || 0;
}); });
}, },
getDict() { 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) => { getWorkOrderList().then((response) => {
// console.log(response);
this.formConfig[0].selectOptions = response.data.map((item) => { this.formConfig[0].selectOptions = response.data.map((item) => {
return { return {
name: item.name, name: item.name,
@ -203,44 +131,15 @@ export default {
}; };
}); });
console.log(this.formConfig[0].selectOptions); 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) { buttonClick(val) {
console.log(val); console.log(val);
if (val.btnName === 'search') { if (val.btnName === 'search') {
this.listQuery.workOrderId = val.workOrderId this.listQuery.workOrderId = val.workOrderId
? val.workOrderId ? val.workOrderId
: undefined; : 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(); this.getList();
} else {
// this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
} }
}, },
otherMethods(val) { otherMethods(val) {

View File

@ -12,7 +12,8 @@
: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"
@ -58,19 +59,19 @@ 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], mixins: [basicPageMixin, tableHeightMixin],
data() { data() {
return { return {
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'select', type: 'select',
label: '工单名称', label: '工单名称',
placeholder: '请选择工单名称',
param: 'workOrderId', param: 'workOrderId',
selectOptions: [], selectOptions: [],
filterable: true, filterable: true,
@ -78,7 +79,6 @@ export default {
{ {
type: 'select', type: 'select',
label: '检测内容', label: '检测内容',
placeholder: '请输入检测内容',
selectOptions: [], selectOptions: [],
param: 'inspectionDetContent', param: 'inspectionDetContent',
filterable: true, filterable: true,
@ -134,32 +134,31 @@ export default {
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
fixed: true, width: 160,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ {
// width: 128,
prop: 'workOrderName', prop: 'workOrderName',
label: '工单名称', label: '工单名称',
showOverflowtooltip: true,
}, },
{ {
// width: 128,
prop: 'inspectionDetContent', prop: 'inspectionDetContent',
label: '检测内容', label: '检测内容',
showOverflowtooltip: true,
}, },
{ {
// width: 128,
prop: 'productionLineName', prop: 'productionLineName',
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) =>
@ -190,7 +189,7 @@ export default {
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
workOrderId: null, workOrderId: null,
inspectionDetContent: null, inspectionDetContent: null,
checkTime: [], checkTime: [],

View File

@ -9,11 +9,12 @@
:table-props="tableProps" :table-props="tableProps"
:page="listQuery.pageNo" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :limit="listQuery.pageSize"
:table-data="tableData"> :table-data="tableData"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="120" :width="110"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" /> @clickBtn="handleClick" />
@ -21,7 +22,7 @@
<pagination <pagination
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:total="listQuery.total" :total="total"
@pagination="getDataList" /> @pagination="getDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@ -61,29 +62,35 @@ import {
getWorkOrderList, getWorkOrderList,
getTeamList, getTeamList,
} from '@/api/base/qualityScrapLog'; } from '@/api/base/qualityScrapLog';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
filter: parseTime, filter: parseTime,
width: 160,
}, },
{ {
prop: 'workOrderName', prop: 'workOrderName',
label: '工单', label: '工单',
showOverflowtooltip: true,
}, },
{ {
prop: 'teamId', prop: 'teamName',
label: '班组', label: '班组',
showOverflowtooltip: true,
}, },
{ {
prop: 'detContent', prop: 'detContent',
label: '报废原因', label: '报废原因',
showOverflowtooltip: true,
}, },
{ {
prop: 'logTime', prop: 'logTime',
label: '报废时间', label: '报废时间',
filter: parseTime, filter: parseTime,
width: 160,
}, },
{ {
prop: 'num', prop: 'num',
@ -92,7 +99,7 @@ const tableProps = [
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage, tableHeightMixin],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@ -159,6 +166,12 @@ export default {
plain: true, plain: true,
}, },
], ],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
teamList: [],
showDetail: false, showDetail: false,
}; };
}, },
@ -181,35 +194,34 @@ export default {
// //
getDict() { getDict() {
getWorkOrderList().then((res) => { getWorkOrderList().then((res) => {
console.log(res);
// console.log(response);
this.formConfig[0].selectOptions = res.data.map((item) => { this.formConfig[0].selectOptions = res.data.map((item) => {
return { return {
name: item.name, name: item.name,
id: item.id, id: item.id,
}; };
}); });
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
}); });
getTeamList().then((res) => { getTeamList().then((res) => {
console.log(res);
// console.log(response);
this.formConfig[1].selectOptions = res.data.map((item) => { this.formConfig[1].selectOptions = res.data.map((item) => {
return { return {
name: item.name, name: item.name,
id: item.id, id: item.id,
}; };
}); });
// console.log(this.formConfig[0].selectOptions); this.teamList = res.data;
// this.listQuery.total = response.data.total;
}); });
}, },
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; let arr = response.data.list;
this.listQuery.total = response.data.total; 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; this.dataListLoading = false;
}); });
}, },
@ -217,22 +229,12 @@ export default {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.workOrderId = val.workOrderId this.listQuery.workOrderId = val.workOrderId
? val.workOrderId ? val.workOrderId
: undefined; : undefined;
this.listQuery.teamId = val.teamId ? val.teamId : undefined; this.listQuery.teamId = val.teamId ? val.teamId : 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,317 +1,425 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form
<el-form-item label="部门名称" prop="name"> :model="queryParams"
<el-input v-model="queryParams.name" placeholder="请输入部门名称" clearable @keyup.enter.native="handleQuery"/> ref="queryForm"
</el-form-item> size="small"
<el-form-item label="状态" prop="status"> :inline="true"
<el-select v-model="queryParams.status" placeholder="菜单状态" clearable> v-show="showSearch">
<el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/> <el-form-item label="部门名称" prop="name">
</el-select> <el-input
</el-form-item> v-model="queryParams.name"
<el-form-item> placeholder="请输入部门名称"
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> clearable
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> @keyup.enter.native="handleQuery" />
</el-form-item> </el-form-item>
</el-form> <el-form-item label="状态" prop="status">
<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 type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button
v-hasPermi="['system:dept:create']">新增</el-button> type="primary"
</el-col> plain
<el-col :span="1.5"> icon="el-icon-plus"
<el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">展开/折叠</el-button> size="mini"
</el-col> @click="handleAdd"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> v-hasPermi="['system:dept:create']">
</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 v-if="refreshTable" v-loading="loading" :data="deptList" row-key="id" :default-expand-all="isExpandAll" <el-table
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"> v-if="refreshTable"
<el-table-column prop="name" label="部门名称" width="260"></el-table-column> v-loading="loading"
<el-table-column prop="leader" label="负责人" :formatter="userNicknameFormat" width="120"/> :data="deptList"
<el-table-column prop="sort" label="排序" width="200"></el-table-column> row-key="id"
<el-table-column prop="status" label="状态" width="100"> :default-expand-all="isExpandAll"
<template v-slot="scope"> :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> <el-table-column
</template> prop="name"
</el-table-column> label="部门名称"
<el-table-column label="创建时间" align="center" prop="createTime" width="200"> width="260"></el-table-column>
<template v-slot="scope"> <el-table-column
<span>{{ parseTime(scope.row.createTime) }}</span> prop="leader"
</template> label="负责人"
</el-table-column> :formatter="userNicknameFormat"
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> width="120" />
<template v-slot="scope"> <el-table-column prop="sort" label="排序" width="200"></el-table-column>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-table-column prop="status" label="状态" width="100">
v-hasPermi="['system:dept:update']">修改</el-button> <template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)" <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
v-hasPermi="['system:dept:create']">新增</el-button> </template>
<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> <el-table-column
</template> label="创建时间"
</el-table-column> align="center"
</el-table> prop="createTime"
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 v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" /> <treeselect
</el-form-item> v-model="form.parentId"
</el-col> :options="deptOptions"
<el-col :span="12"> :normalizer="normalizer"
<el-form-item label="部门名称" prop="name"> placeholder="选择上级部门" />
<el-input v-model="form.name" placeholder="请输入部门名称" /> </el-form-item>
</el-form-item> </el-col>
</el-col> <el-col :span="12">
<el-col :span="12"> <el-form-item label="部门名称" prop="name">
<el-form-item label="显示排序" prop="sort"> <el-input v-model="form.name" placeholder="请输入部门名称" />
<el-input-number v-model="form.sort" controls-position="right" :min="0" /> </el-form-item>
</el-form-item> </el-col>
</el-col> <el-col :span="12">
<el-col :span="12"> <el-form-item label="显示排序" prop="sort">
<el-form-item label="负责人" prop="leaderUserId"> <el-input-number
<el-select v-model="form.leaderUserId" placeholder="请输入负责人" clearable style="width: 100%"> v-model="form.sort"
<el-option v-for="item in users" :key="parseInt(item.id)" :label="item.nickname" :value="parseInt(item.id)" /> controls-position="right"
</el-select> :min="0" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="联系电话" prop="phone"> <el-form-item label="负责人" prop="leaderUserId">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" /> <el-select
</el-form-item> v-model="form.leaderUserId"
</el-col> placeholder="请输入负责人"
<el-col :span="12"> clearable
<el-form-item label="邮箱" prop="email"> style="width: 100%">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" /> <el-option
</el-form-item> v-for="item in users"
</el-col> :key="parseInt(item.id)"
<el-col :span="12"> :label="item.nickname"
<el-form-item label="部门状态" prop="status"> :value="parseInt(item.id)" />
<el-radio-group v-model="form.status"> </el-select>
<el-radio v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)"> </el-form-item>
{{dict.label}}</el-radio> </el-col>
</el-radio-group> <el-col :span="12">
</el-form-item> <el-form-item label="联系电话" prop="phone">
</el-col> <el-input
</el-row> v-model="form.phone"
</el-form> placeholder="请输入联系电话"
<div slot="footer" class="dialog-footer"> maxlength="11" />
<el-button type="primary" @click="submitForm"> </el-button> </el-form-item>
<el-button @click="cancel"> </el-button> </el-col>
</div> <el-col :span="12">
</el-dialog> <el-form-item label="邮箱" prop="email">
</div> <el-input
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 { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/dept"; import {
import Treeselect from "@riophae/vue-treeselect"; listDept,
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; getDept,
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: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/, pattern:
message: "请输入正确的手机号码", /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
trigger: "blur" message: '请输入正确的手机号码',
} trigger: 'blur',
], },
status: [ ],
{ required: true, message: "状态不能为空", trigger: "blur" } status: [{ 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) { // undefined Unknown if (this.form.parentId === 0) {
this.form.parentId = undefined; // undefined Unknown
} this.form.parentId = undefined;
this.open = true; }
this.title = "修改部门"; this.open = true;
}); this.title = '修改部门';
listDept(row.id).then(response => { });
this.deptOptions = this.handleTree(response.data, "id"); listDept(row.id).then((response) => {
}); this.deptOptions = this.handleTree(response.data, 'id');
}, });
/** 提交按钮 */ },
submitForm: function() { /** 提交按钮 */
this.$refs["form"].validate(valid => { submitForm: function () {
if (valid) { this.$refs['form'].validate((valid) => {
if (this.form.id !== undefined) { if (valid) {
updateDept(this.form).then(response => { if (this.form.id !== undefined) {
this.$modal.msgSuccess("修改成功"); updateDept(this.form).then((response) => {
this.open = false; this.$modal.msgSuccess('修改成功');
this.getList(); this.open = false;
}); this.getList();
} else { });
addDept(this.form).then(response => { } else {
this.$modal.msgSuccess("新增成功"); addDept(this.form).then((response) => {
this.open = false; this.$modal.msgSuccess('新增成功');
this.getList(); this.open = false;
}); this.getList();
} });
} }
}); }
}, });
/** 删除按钮操作 */ },
handleDelete(row) { /** 删除按钮操作 */
this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function() { handleDelete(row) {
return delDept(row.id); this.$modal
}).then(() => { .delConfirm(row.name)
this.getList(); .closeConfirm()
this.$modal.msgSuccess("删除成功"); .then(function () {
}).catch(() => {}); return delDept(row.id);
} })
} .then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
}; };
</script> </script>