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",
})
},
// 删除确认窗体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) {
return MessageBox.prompt(content, "系统提示", {

View File

@ -200,4 +200,35 @@ input, textarea{
// 弹出框上下分布去掉label的padding-bottom
.el-form--label-top .el-form-item__label {
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>
<el-form ref="form" :model="dataForm" label-width="120px" v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="dataForm.productionLineId" placeholder="请选择产线" filterable
@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="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-form
ref="form"
:model="dataForm"
label-width="110px"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="产线"
prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="dataForm.productionLineId"
placeholder="请选择产线"
filterable
@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="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-form-item label="按钮盒识别码" prop="buttonId" :rules="[
{ required: true, message: '不能为空', trigger: 'blur' },
{
type: 'number',
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-col :span="12">
<el-form-item
label="按钮盒识别码"
prop="buttonId"
:rules="[
{ required: true, message: '不能为空', trigger: 'blur' },
{
type: 'number',
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-form-item
label="产线"
prop="productionLineId"
@ -101,35 +131,50 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="按钮值" prop="keyValue" :rules="[
{ required: true, message: '不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入100以内的整数',
trigger: 'blur',
transform: (val) =>
Number.isInteger(+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-col>
<el-col :span="12">
<el-form-item
label="按钮值"
prop="keyValue"
:rules="[
{ required: true, message: '不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入100以内的整数',
trigger: 'blur',
transform: (val) =>
Number.isInteger(+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-col>
<el-col :span="12">
<el-form-item label="检测内容" prop="inspectionDetId">
<el-select v-model="dataForm.inspectionDetId" placeholder="请选择检测内容" filterable
@change="$emit('update', dataForm)">
<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-form>
<el-col :span="12">
<el-form-item label="检测内容" prop="inspectionDetId">
<el-select
v-model="dataForm.inspectionDetId"
placeholder="请选择检测内容"
filterable
@change="$emit('update', dataForm)">
<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-form>
</template>
<script>
@ -150,14 +195,14 @@ export default {
data() {
return {
formLoading: true,
productionLineList: [],
inspectionDetList:[],
productionLineList: [],
inspectionDetList: [],
workshopSectionList: [],
};
},
mounted() {
this.getProductionLineList()
this.getQualityInspectionDetList()
this.getProductionLineList();
this.getQualityInspectionDetList();
// this.getWorksectionList();
// this.getCode('/base/equipment-group-alarm/getCode').then((code) => {
// this.formLoading = false;
@ -197,20 +242,20 @@ export default {
}
this.formLoading = false;
},
async getQualityInspectionDetList() {
this.formLoading = true;
const res = await this.$axios({
url: '/base/quality-inspection-det/listAll',
method: 'get',
});
if (res.code == 0) {
this.inspectionDetList = res.data.map((item) => ({
label: item.content,
value: item.id,
}));
}
this.formLoading = false;
},
async getQualityInspectionDetList() {
this.formLoading = true;
const res = await this.$axios({
url: '/base/quality-inspection-det/listAll',
method: 'get',
});
if (res.code == 0) {
this.inspectionDetList = res.data.map((item) => ({
label: item.content,
value: item.id,
}));
}
this.formLoading = false;
},
async getWorksectionList(id) {
this.formLoading = true;
const res = await this.$axios({

View File

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

View File

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

View File

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

View File

@ -6,88 +6,99 @@
* @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>
<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";
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,
// description: undefined,
remark: undefined,
isGetCode: true,
codeURL: getCode,
createURL: createQualityScrapDet,
updateURL: updateQualityScrapDet,
infoURL: getQualityScrapDet,
},
typeList: [],
dataForm: {
id: undefined,
code: undefined,
content: undefined,
typeId: null,
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" }],
}
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)
this.getDict();
},
methods: {
async getDict() {
//
const res = await getList();
//
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,11 +9,12 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
@ -21,7 +22,7 @@
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
:total="total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
@ -29,7 +30,7 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
@ -46,32 +47,38 @@ import {
deleteQualityScrapDet,
} from '@/api/base/qualityScrapDet';
import { getList } from '@/api/base/qualityScrapType';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
width: 160,
},
{
prop: 'content',
label: '报废原因',
showOverflowtooltip: true,
},
{
prop: 'code',
label: '报废原因编码',
showOverflowtooltip: true,
},
{
prop: 'typeName',
label: '报废类型',
showOverflowtooltip: true,
},
{
prop: 'remark',
label: '备注',
showOverflowtooltip: true,
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -109,6 +116,7 @@ export default {
labelField: 'name',
valueField: 'id',
param: 'typeId',
filterable: true,
},
{
type: 'button',
@ -129,6 +137,11 @@ export default {
plain: true,
},
],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
};
},
components: {
@ -144,7 +157,7 @@ export default {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.total = response.data.total;
this.dataListLoading = false;
});
},
@ -157,20 +170,10 @@ export default {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
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();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;

View File

@ -55,7 +55,6 @@ import {
getQualityScrapType,
getCode,
} from '@/api/base/qualityScrapType';
// import { getMaterialList } from "@/api/base/material";
export default {
mixins: [basicAdd],
@ -75,9 +74,7 @@ export default {
description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
code: [
{ 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>

View File

@ -9,11 +9,12 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
@ -21,7 +22,7 @@
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
:total="total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
@ -29,7 +30,7 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
@ -45,33 +46,39 @@ import {
getQualityScrapTypePage,
deleteQualityScrapType,
} from '@/api/base/qualityScrapType';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
width: 160,
},
{
prop: 'name',
label: '报废类型',
showOverflowtooltip: true,
},
{
prop: 'code',
label: '报废类型编码',
showOverflowtooltip: true,
},
{
prop: 'description',
label: '描述信息',
showOverflowtooltip: true,
},
{
prop: 'remark',
label: '备注',
showOverflowtooltip: true,
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -121,6 +128,11 @@ export default {
plain: true,
},
],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
};
},
components: {
@ -133,7 +145,7 @@ export default {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.total = response.data.total;
this.dataListLoading = false;
});
},
@ -141,19 +153,9 @@ export default {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name ? val.name : 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;

View File

@ -1,10 +1,3 @@
<!--
filename: index.vue
author: liubin
date: 2023-09-04 09:34:52
description: 设备效率分析
-->
<template>
<div class="app-container allow-overflow">
<!-- 搜索工作栏 -->
@ -15,10 +8,7 @@
<el-row>
<el-col class="custom-tabs">
<el-tabs
v-model="activeName"
:stretch="true"
@tab-click="handleTabClick">
<el-tabs v-model="activeName" :stretch="true">
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
<!-- 列表 -->
<base-table
@ -27,7 +17,7 @@
:page="1"
:limit="10"
:table-data="list"
@emitFun="handleEmitFun"></base-table>
:max-height="tableH"></base-table>
</el-tab-pane>
<el-tab-pane
:label="'\u3000可视化\u3000'"
@ -74,7 +64,6 @@
v-for="item in list"
:key="item.id"
:value="item" />
<!-- <pie-chart v-for="item in 5" :key="item" :value="item" /> -->
</div>
</div>
</div>
@ -86,40 +75,43 @@
</template>
<script>
// import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import PieChart from './components/pieChart.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'EfficiencyAnalysis',
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
components: { PieChart },
props: {},
data() {
return {
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: [
{ prop: 'factoryName', label: '工厂' },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备' },
{
prop: 'factoryName',
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: '有效时间',
children: [
@ -127,12 +119,13 @@ export default {
width: 128,
prop: 'workTime',
label: '工作时长[h]',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
{
width: 128,
prop: 'workRate',
label: '百分比[%]',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
],
},
@ -143,8 +136,14 @@ export default {
width: 128,
prop: 'stopTime',
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,
prop: 'downTime',
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,
prop: 'timeEfficiency',
label: '时间开动率',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
],
},
@ -172,87 +176,31 @@ export default {
width: 128,
prop: 'realProcSpeed',
label: '实际加工速度',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
{
width: 128,
prop: 'designProcSpeed',
label: '理论加工速度',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
{
width: 128,
prop: 'peEfficiency',
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: [
{
type: 'select',
label: '工单',
placeholder: '请选择工单',
label: '工单名称',
param: 'workOrderId',
selectOptions: [],
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',
//
@ -265,21 +213,8 @@ export default {
rangeSeparator: '-',
startPlaceholder: '开始时间',
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',
btnName: '查询',
@ -296,26 +231,9 @@ export default {
plain: true,
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: {
// lineId: null,
workOrderId: null,
recordTime: [],
},
@ -326,19 +244,16 @@ export default {
},
created() {
this.getWorkOrder();
// this.getLine();
this.getList();
},
methods: {
/** 准备工厂数据 */
async getWorkOrder() {
console.log(1111);
const { code, data } = await this.$axios({
url: '/base/core-work-order/listbyfilter',
method: 'get',
});
if (code == 0) {
console.log('1111', data);
this.searchBarFormConfig[0].selectOptions = data.map((item) => {
return {
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() {
this.loading = true;
@ -388,41 +276,17 @@ export default {
},
handleSearchBarBtnClick({ btnName, ...payload }) {
console.log('handleSearchBarBtnClick', btnName, payload);
if (btnName == 'visualization') {
//
this.visualizationOpen = true;
this.open = true;
}
console.log(btnName);
console.log(payload);
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`,
];
}
this.queryParams.recordTime = payload.recordTime || undefined;
this.getList();
} else {
this.queryParams.recordTime = null;
console.log('导出');
}
this.getList();
},
cancel() {
this.open = false;
},
closed() {
this.visualizationOpen = false;
this.trendOpen = false;
},
submitForm() {},
handleTabClick() {},
},
};
</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>
<div class="app-container">
<search-bar
@ -15,59 +8,62 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="list">
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" /> -->
</base-table>
:table-data="list"
:max-height="tableH"></base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import {
getMaterialUseLogPage,
getWorkOrderList,
exportEnergyPlcExcel,
} from '@/api/quality/materialTraceability';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'materialName',
label: '物料名称',
showOverflowtooltip: true,
},
{
prop: 'materialCode',
label: '物料编码',
showOverflowtooltip: true,
minWidth: 120,
},
{
prop: 'dateName',
label: '物料批次',
showOverflowtooltip: true,
},
{
prop: 'equipName',
label: '使用设备',
showOverflowtooltip: true,
},
{
prop: 'num',
label: '使用数量',
showOverflowtooltip: true,
},
{
prop: 'useTime',
label: '使用时间',
filter: parseTime,
width: 160,
},
{
prop: 'userName',
label: '操作人',
showOverflowtooltip: true,
},
{
prop: 'source',
@ -77,18 +73,15 @@ const tableProps = [
{
prop: 'remark',
label: '备注',
showOverflowtooltip: true,
},
];
export default {
// mixins: [basicPage],
mixins: [tableHeightMixin],
data() {
return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
heightNum: 220,
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`)
@ -116,7 +109,7 @@ export default {
formConfig: [
{
type: 'select',
label: '工单',
label: '工单名称',
selectOptions: [],
labelField: 'name',
valueField: 'id',
@ -144,28 +137,6 @@ export default {
{
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')
? 'button'
@ -193,19 +164,7 @@ export default {
});
},
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,
@ -213,7 +172,6 @@ export default {
};
});
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
});
},
handleExport() {
@ -239,7 +197,6 @@ export default {
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';
@ -250,11 +207,6 @@ export default {
this.getList();
} else {
this.handleExport();
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
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>
<div class="app-container">
<search-bar
@ -15,7 +8,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="list">
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -29,34 +23,35 @@
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import {
getProcessTraceabilityPage,
getWorkOrderList,
getCoreProduct,
// exportEnergyPlcExcel
} from '@/api/quality/processTraceability';
import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'name',
label: '工单名称',
showOverflowtooltip: true,
minWidth: 120,
},
{
prop: 'code',
label: '工单编码',
showOverflowtooltip: true,
minWidth: 120,
},
{
prop: 'planProductName',
label: '产品名',
showOverflowtooltip: true,
},
{
prop: 'status',
@ -76,11 +71,13 @@ const tableProps = [
prop: 'startProduceTime',
label: '开始生产时间',
filter: parseTime,
width: 160,
},
{
prop: 'finishProduceTime',
label: '结束生产时间',
filter: parseTime,
width: 160,
},
{
prop: 'actualQuantity',
@ -91,33 +88,25 @@ const tableProps = [
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'processFlowName',
label: '工艺名称',
},
{
prop: 'yield',
label: '合格率',
filter: (val) => (val ? val.toFixed(2) + '%' : '-'),
align: 'center',
},
{
prop: 'processFlowName',
label: '工艺名称',
showOverflowtooltip: true,
},
];
export default {
// mixins: [basicPage],
mixins: [tableHeightMixin],
data() {
return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps,
tableBtn: [
// this.$auth.hasPermi(`base:packaging-print-log:update`)
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
{
type: 'processDetail',
btnName: '查看工艺详情',
@ -127,10 +116,6 @@ export default {
listQuery: {
pageSize: 10,
pageNo: 1,
// total: 0,
// orderName: '',
// startTime: undefined,
// endTime:undefined,
},
formConfig: [
{
@ -161,40 +146,9 @@ export default {
name: 'search',
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() {
this.getList();
this.getDict();
@ -222,29 +176,13 @@ export default {
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,
@ -252,27 +190,12 @@ export default {
};
});
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';
@ -281,13 +204,6 @@ export default {
this.listQuery.endTime = undefined;
}
this.getList();
} else {
// this.handleExport()
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
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>
<div class="app-container">
<search-bar
@ -15,30 +8,24 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="list">
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" /> -->
</base-table>
:table-data="list"
:max-height="tableH"></base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
:total="total"
@pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
import { publicFormatter } from '@/utils/dict';
import { parseTime } from '../mixins/code-filter';
import {
getRawMaterialPage,
getWorkOrderList,
// exportEnergyPlcExcel
} from '@/api/quality/rawMaterialTraceability';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
@ -51,6 +38,7 @@ const tableProps = [
prop: 'material',
label: '原料名称',
filter: publicFormatter('material'),
showOverflowtooltip: true,
},
{
prop: 'origin',
@ -58,12 +46,13 @@ const tableProps = [
filter: (val) => (val == 1 ? '内部' : '外部'),
},
{
prop: 'supplierId',
prop: 'supplierName',
label: '供应商',
},
{
prop: 'batch',
label: '批次',
showOverflowtooltip: true,
},
{
prop: 'num',
@ -77,14 +66,9 @@ const tableProps = [
];
export default {
// mixins: [basicPage],
mixins: [tableHeightMixin],
data() {
return {
// urlOptions: {
// getDataListURL: getMaterialUseLogPage,
// // deleteURL: deletePackingType,
// // exportURL: exportPackingExcel,
// },
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`)
@ -104,73 +88,29 @@ export default {
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
workOrderId: undefined,
startTime: undefined,
endTime: undefined,
},
total: 0,
formConfig: [
{
type: 'select',
label: '工单',
label: '工单名称',
selectOptions: [],
labelField: 'name',
valueField: 'id',
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',
btnName: '搜索',
btnName: '查询',
name: 'search',
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() {
this.getList();
this.getDict();
@ -179,23 +119,11 @@ export default {
getList() {
getRawMaterialPage({ ...this.listQuery }).then((res) => {
this.list = res.data.records || [];
this.listQuery.total = res.data.total || 0;
this.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,
@ -203,44 +131,15 @@ export default {
};
});
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) {

View File

@ -12,7 +12,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -58,19 +59,19 @@ import moment from 'moment';
import DialogForm from './dialogForm.vue';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'QualityInspectionRecord',
components: {
DialogForm,
},
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
searchBarFormConfig: [
{
type: 'select',
label: '工单名称',
placeholder: '请选择工单名称',
param: 'workOrderId',
selectOptions: [],
filterable: true,
@ -78,7 +79,6 @@ export default {
{
type: 'select',
label: '检测内容',
placeholder: '请输入检测内容',
selectOptions: [],
param: 'inspectionDetContent',
filterable: true,
@ -134,32 +134,31 @@ export default {
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
width: 160,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{
// width: 128,
prop: 'workOrderName',
label: '工单名称',
showOverflowtooltip: true,
},
{
// width: 128,
prop: 'inspectionDetContent',
label: '检测内容',
showOverflowtooltip: true,
},
{
// width: 128,
prop: 'productionLineName',
label: '产线',
showOverflowtooltip: true,
},
{
// width: 128,
prop: 'checkPerson',
label: '检测人员',
showOverflowtooltip: true,
},
{
// width: 160,
width: 160,
prop: 'checkTime',
label: '检测时间',
filter: (val) =>
@ -190,7 +189,7 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
workOrderId: null,
inspectionDetContent: null,
checkTime: [],

View File

@ -9,11 +9,12 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
:width="110"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
@ -21,7 +22,7 @@
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
:total="total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
@ -61,29 +62,35 @@ import {
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: 'teamId',
prop: 'teamName',
label: '班组',
showOverflowtooltip: true,
},
{
prop: 'detContent',
label: '报废原因',
showOverflowtooltip: true,
},
{
prop: 'logTime',
label: '报废时间',
filter: parseTime,
width: 160,
},
{
prop: 'num',
@ -92,7 +99,7 @@ const tableProps = [
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
@ -159,6 +166,12 @@ export default {
plain: true,
},
],
listQuery: {
pageNo: 1,
pageSize: 20,
},
total: 0,
teamList: [],
showDetail: false,
};
},
@ -181,35 +194,34 @@ export default {
//
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;
this.teamList = res.data;
});
},
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
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;
});
},
@ -217,22 +229,12 @@ export default {
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;

View File

@ -1,317 +1,425 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="部门名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入部门名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<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>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch">
<el-form-item label="部门名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入部门名称"
clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<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-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:dept:create']">新增</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-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:dept:create']">
新增
</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"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column prop="name" label="部门名称" width="260"></el-table-column>
<el-table-column prop="leader" label="负责人" :formatter="userNicknameFormat" width="120"/>
<el-table-column prop="sort" label="排序" width="200"></el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" 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-table
v-if="refreshTable"
v-loading="loading"
:data="deptList"
row-key="id"
:default-expand-all="isExpandAll"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table-column
prop="name"
label="部门名称"
width="260"></el-table-column>
<el-table-column
prop="leader"
label="负责人"
:formatter="userNicknameFormat"
width="120" />
<el-table-column prop="sort" label="排序" width="200"></el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
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-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="上级部门" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门名称" prop="name">
<el-input v-model="form.name" placeholder="请输入部门名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="显示排序" prop="sort">
<el-input-number v-model="form.sort" controls-position="right" :min="0" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="leaderUserId">
<el-select v-model="form.leaderUserId" placeholder="请输入负责人" clearable style="width: 100%">
<el-option v-for="item in users" :key="parseInt(item.id)" :label="item.nickname" :value="parseInt(item.id)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="邮箱" prop="email">
<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>
<!-- 添加或修改部门对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="上级部门" prop="parentId">
<treeselect
v-model="form.parentId"
:options="deptOptions"
:normalizer="normalizer"
placeholder="选择上级部门" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门名称" prop="name">
<el-input v-model="form.name" placeholder="请输入部门名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="显示排序" prop="sort">
<el-input-number
v-model="form.sort"
controls-position="right"
:min="0" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="leaderUserId">
<el-select
v-model="form.leaderUserId"
placeholder="请输入负责人"
clearable
style="width: 100%">
<el-option
v-for="item in users"
:key="parseInt(item.id)"
:label="item.nickname"
:value="parseInt(item.id)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-input
v-model="form.phone"
placeholder="请输入联系电话"
maxlength="11" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="邮箱" prop="email">
<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>
<script>
import { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {
listDept,
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 { getDictDatas, DICT_TYPE } from '@/utils/dict'
import {listSimpleUsers} from "@/api/system/user";
import { CommonStatusEnum } from '@/utils/constants';
import { getDictDatas, DICT_TYPE } from '@/utils/dict';
import { listSimpleUsers } from '@/api/system/user';
export default {
name: "SystemDept",
components: { Treeselect },
data() {
return {
//
loading: true,
//
showSearch: true,
//
deptList: [],
//
deptOptions: [],
//
users: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
expand: false,
//
queryParams: {
name: undefined,
status: undefined
},
//
form: {},
//
rules: {
name: [
{ required: true, message: "部门名称不能为空", trigger: "blur" }
],
sort: [
{ required: true, message: "显示排序不能为空", trigger: "blur" }
],
email: [
{
type: "email",
message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
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}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
],
status: [
{ required: true, message: "状态不能为空", trigger: "blur" }
]
},
name: 'SystemDept',
components: { Treeselect },
data() {
return {
//
loading: true,
//
showSearch: true,
//
deptList: [],
//
deptOptions: [],
//
users: [],
//
title: '',
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
expand: false,
//
queryParams: {
name: undefined,
status: undefined,
},
//
form: {},
//
rules: {
name: [
{ required: true, message: '部门名称不能为空', trigger: 'blur' },
],
sort: [
{ required: true, message: '显示排序不能为空', trigger: 'blur' },
],
email: [
{
type: 'email',
message: "'请输入正确的邮箱地址",
trigger: ['blur', 'change'],
},
],
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}$/,
message: '请输入正确的手机号码',
trigger: 'blur',
},
],
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
},
//
CommonStatusEnum: CommonStatusEnum,
//
statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS)
};
},
created() {
this.getList();
//
listSimpleUsers().then(response => {
this.users = response.data;
});
},
methods: {
/** 查询部门列表 */
getList() {
this.loading = true;
listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "id");
this.loading = false;
});
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children
};
},
//
userNicknameFormat(row, column) {
if (!row.leaderUserId) {
return '未设置';
}
for (const user of this.users) {
if (row.leaderUserId === user.id) {
return user.nickname;
}
}
return '未知【' + row.leaderUserId + '】';
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
parentId: undefined,
name: undefined,
sort: undefined,
leaderUserId: undefined,
phone: undefined,
email: undefined,
status: CommonStatusEnum.ENABLE,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
if (row !== undefined) {
this.form.parentId = row.id;
}
this.open = true;
this.title = "添加部门";
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "id");
});
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
getDept(row.id).then(response => {
this.form = response.data;
if (this.form.parentId === 0) { // undefined Unknown
this.form.parentId = undefined;
}
this.open = true;
this.title = "修改部门";
});
listDept(row.id).then(response => {
this.deptOptions = this.handleTree(response.data, "id");
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id !== undefined) {
updateDept(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDept(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function() {
return delDept(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
//
CommonStatusEnum: CommonStatusEnum,
//
statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS),
};
},
created() {
this.getList();
//
listSimpleUsers().then((response) => {
this.users = response.data;
});
},
methods: {
/** 查询部门列表 */
getList() {
this.loading = true;
listDept(this.queryParams).then((response) => {
this.deptList = this.handleTree(response.data, 'id');
this.loading = false;
});
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
//
userNicknameFormat(row, column) {
if (!row.leaderUserId) {
return '未设置';
}
for (const user of this.users) {
if (row.leaderUserId === user.id) {
return user.nickname;
}
}
return '未知【' + row.leaderUserId + '】';
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
parentId: undefined,
name: undefined,
sort: undefined,
leaderUserId: undefined,
phone: undefined,
email: undefined,
status: CommonStatusEnum.ENABLE,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
if (row !== undefined) {
this.form.parentId = row.id;
}
this.open = true;
this.title = '添加部门';
listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, 'id');
});
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
getDept(row.id).then((response) => {
this.form = response.data;
if (this.form.parentId === 0) {
// undefined Unknown
this.form.parentId = undefined;
}
this.open = true;
this.title = '修改部门';
});
listDept(row.id).then((response) => {
this.deptOptions = this.handleTree(response.data, 'id');
});
},
/** 提交按钮 */
submitForm: function () {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.id !== undefined) {
updateDept(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
} else {
addDept(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.delConfirm(row.name)
.closeConfirm()
.then(function () {
return delDept(row.id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>