Compare commits

..

31 Commits

Author SHA1 Message Date
18a9a4f51b 能源类型 2023-08-14 16:19:12 +08:00
cee4ebfd43 Merge pull request 'lb' (#12) from lb into test
Reviewed-on: #12
2023-08-04 14:34:51 +08:00
9831026c5a Merge pull request '更新生产基础' (#11) from zwq into test
Reviewed-on: #11
2023-08-04 14:32:19 +08:00
zwq
1e538579a8 更新生产基础 2023-08-04 14:32:01 +08:00
lb
33ff942fc6 Merge branch 'test' into lb 2023-08-04 14:24:48 +08:00
lb
bd56b12560 update 完成dialogForm的字段监听更新逻辑 2023-08-04 14:22:42 +08:00
lb
61a6e7dafb update 更新dialogForm的关联监听方案 2023-08-04 11:24:12 +08:00
lb
f5fb852d5d update 质量检查信息记录 2023-08-04 11:08:21 +08:00
lb
810b4b87a8 add 质量检测记录 2023-08-03 15:48:24 +08:00
c946f12004 Merge pull request '更新生产管理-生产基础' (#10) from zwq into test
Reviewed-on: #10
2023-08-03 15:27:59 +08:00
zwq
4350bafa23 更新生产管理-生产基础 2023-08-03 15:27:39 +08:00
a49db190e3 Merge pull request 'lb' (#9) from lb into test
Reviewed-on: #9
2023-08-03 15:15:37 +08:00
lb
ecfed2eddf Merge remote-tracking branch 'origin/test' into lb 2023-08-03 15:13:56 +08:00
lb
6b988bbaf7 merge 2023-08-03 15:10:49 +08:00
lb
4d0c0ae91a update 基本完成质量基础 2023-08-03 15:09:15 +08:00
lb
7c665484a7 update getCode逻辑 2023-08-03 15:03:59 +08:00
lb
1299ebd0c9 update 安灯按钮 2023-08-03 14:45:38 +08:00
lb
78777d5d24 update 2023-08-03 13:37:24 +08:00
lb
c357ab8005 update 质量检测信息 2023-08-03 11:35:16 +08:00
lb
73831ea8cf update 质量检测信息 2023-08-03 11:19:06 +08:00
3d1bc2cc98 Merge pull request '公共样式' (#8) from zjl into test
Reviewed-on: #8
2023-08-03 11:18:18 +08:00
lb
a402a8bf63 update 2023-08-03 10:51:44 +08:00
lb
d3760f5dee update quality type 2023-08-02 15:25:44 +08:00
lb
006e94a865 apply DialogForm & debug 2023-08-02 15:16:40 +08:00
lb
b6e4767346 add mixin & dialog 2023-08-02 11:27:33 +08:00
lb
77688fed77 update 质量信息 2023-08-02 09:49:14 +08:00
lb
6d4f44fd68 update 质量信息 2023-08-01 17:01:59 +08:00
lb
30e8548a0d update 质量检测类型 2023-08-01 16:42:17 +08:00
lb
63931b883c update 质量类型 2023-08-01 14:02:36 +08:00
lb
6fdc9b2826 update 质量类型 2023-08-01 11:20:37 +08:00
lb
443ca29d3f update 质量类型 2023-07-31 17:04:07 +08:00
41 changed files with 4967 additions and 2248 deletions

View File

@ -5,7 +5,8 @@ ENV = 'development'
VUE_APP_TITLE = 芋道管理系统 VUE_APP_TITLE = 芋道管理系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
VUE_APP_BASE_API = 'http://192.168.0.33:48080' # VUE_APP_BASE_API = 'http://192.168.0.33:48080'
VUE_APP_BASE_API = 'http://192.168.1.188:48080'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -58,6 +58,7 @@
"js-beautify": "1.13.0", "js-beautify": "1.13.0",
"jsencrypt": "3.3.1", "jsencrypt": "3.3.1",
"min-dash": "3.5.2", "min-dash": "3.5.2",
"moment": "^2.29.4",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"qrcode.vue": "^1.7.0", "qrcode.vue": "^1.7.0",
"quill": "1.3.7", "quill": "1.3.7",

View File

@ -0,0 +1,62 @@
import request from '@/utils/request'
// 创建能源类型
export function createEnergyType(data) {
return request({
url: '/base/energy-type/create',
method: 'post',
data: data
})
}
// 更新能源类型
export function updateEnergyType(data) {
return request({
url: '/base/energy-type/update',
method: 'put',
data: data
})
}
// 删除能源类型
export function deleteEnergyType(id) {
return request({
url: '/base/energy-type/delete?id=' + id,
method: 'delete'
})
}
// 获得能源类型
export function getEnergyType(id) {
return request({
url: '/base/energy-type/get?id=' + id,
method: 'get'
})
}
// 获得能源类型分页
export function getEnergyTypePage(data) {
return request({
url: '/base/energy-type/page',
method: 'post',
data: data
})
}
// 获得能源类型编码
export function getEnergyTypeCode() {
return request({
url: '/base/energy-type/getCode',
method: 'get'
})
}
// 导出能源类型 Excel
export function exportEnergyTypeExcel(query) {
return request({
url: '/base/energy-type/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -33,7 +33,13 @@ export function getFactory(id) {
method: 'get' method: 'get'
}) })
} }
// 获得工厂code
export function getCode() {
return request({
url: '/base/factory/getCode',
method: 'get'
})
}
// 获得工厂分页 // 获得工厂分页
export function getFactoryPage(query) { export function getFactoryPage(query) {
return request({ return request({

View File

@ -8,7 +8,14 @@ export function createLineBindProduct(data) {
data: data data: data
}) })
} }
// 切换产品
export function switchLineBindProduct(data) {
return request({
url: '/base/line-bind-product/switch',
method: 'put',
data: data
})
}
// 更新产线目前生产产品表 主要为更新 // 更新产线目前生产产品表 主要为更新
export function updateLineBindProduct(data) { export function updateLineBindProduct(data) {
return request({ return request({

View File

@ -9,6 +9,13 @@ export function createProduct(data) {
}) })
} }
// 获得产品code
export function getCode() {
return request({
url: '/base/product/getCode',
method: 'get'
})
}
// 更新产品 // 更新产品
export function updateProduct(data) { export function updateProduct(data) {
return request({ return request({

View File

@ -1,3 +1,10 @@
/*
* @Author: zwq
* @Date: 2023-07-26 09:56:38
* @LastEditors: zwq
* @LastEditTime: 2023-08-04 13:59:23
* @Description:
*/
import request from '@/utils/request' import request from '@/utils/request'
// 创建工厂产线 // 创建工厂产线
@ -8,7 +15,20 @@ export function createProductionLine(data) {
data: data data: data
}) })
} }
// 获得产线code
export function getCode() {
return request({
url: '/base/production-line/getCode',
method: 'get'
})
}
// 获得产线status
export function getStatus(ids) {
return request({
url: '/base/equipment-status-realtime/lineStatus?ids=' + ids,
method: 'get'
})
}
// 更新工厂产线 // 更新工厂产线
export function updateProductionLine(data) { export function updateProductionLine(data) {
return request({ return request({

View File

@ -9,6 +9,13 @@ export function createWorkshopSection(data) {
}) })
} }
// 获得工段code
export function getCode() {
return request({
url: '/base/workshop-section/getCode',
method: 'get'
})
}
// 更新产线工段 // 更新产线工段
export function updateWorkshopSection(data) { export function updateWorkshopSection(data) {
return request({ return request({

View File

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 创建质量检查信息记录表
export function createQualityInspectionRecord(data) {
return request({
url: '/monitoring/quality-inspection-record/create',
method: 'post',
data: data
})
}
// 更新质量检查信息记录表
export function updateQualityInspectionRecord(data) {
return request({
url: '/monitoring/quality-inspection-record/update',
method: 'put',
data: data
})
}
// 删除质量检查信息记录表
export function deleteQualityInspectionRecord(id) {
return request({
url: '/monitoring/quality-inspection-record/delete?id=' + id,
method: 'delete'
})
}
// 获得质量检查信息记录表
export function getQualityInspectionRecord(id) {
return request({
url: '/monitoring/quality-inspection-record/get?id=' + id,
method: 'get'
})
}
// 获得质量检查信息记录表分页
export function getQualityInspectionRecordPage(query) {
return request({
url: '/monitoring/quality-inspection-record/page',
method: 'get',
params: query
})
}
// 导出质量检查信息记录表 Excel
export function exportQualityInspectionRecordExcel(query) {
return request({
url: '/monitoring/quality-inspection-record/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -85,7 +85,7 @@ import Tinymce from '@/components/tinymce/index.vue';
Vue.component('tinymce', Tinymce); Vue.component('tinymce', Tinymce);
import '@/assets/icons'; import '@/assets/icons';
import request from '@/utils/request'; // 实现 form generator 使用自己定义的 axios request 对象 import request from '@/utils/request'; // 实现 form generator 使用自己定义的 axios request 对象
console.log(request); // console.log(request);
Vue.prototype.$axios = request; Vue.prototype.$axios = request;
import '@/styles/index.scss'; import '@/styles/index.scss';

View File

@ -86,6 +86,9 @@ export const DICT_TYPE = {
// ============== PRODUCT - 产品模块 ============= // ============== PRODUCT - 产品模块 =============
UNIT_DICT: 'unit_dict', UNIT_DICT: 'unit_dict',
PRODUCT_TYPE: 'product_type', PRODUCT_TYPE: 'product_type',
// ============== ENERGY - 能源模块 =============
ENERGY_UNIT: 'energy_unit'
} }
/** /**
@ -95,7 +98,7 @@ export const DICT_TYPE = {
* @returns {*|Array} 数据字典数组 * @returns {*|Array} 数据字典数组
*/ */
export function getDictDatas(dictType) { export function getDictDatas(dictType) {
console.log('---> ', dictType, store.getters.dict_datas) // console.log('---> ', dictType, store.getters.dict_datas)
return store.getters.dict_datas[dictType] || [] return store.getters.dict_datas[dictType] || []
} }
@ -145,3 +148,15 @@ export function getDictDataLabel(dictType, value) {
const dict = getDictData(dictType, value); const dict = getDictData(dictType, value);
return dict ? dict.label : ''; return dict ? dict.label : '';
} }
// table中用来过滤字典
export function publicFormatter(dictTable) {
const dictDatas = getDictDatas(dictTable)
return function (val) {
const arr = {}
dictDatas.map((item) => {
arr[item.value] = item.label
})
return arr?.[val]
}
}

View File

@ -0,0 +1,78 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:59:06
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-form-item label="工厂编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
placeholder="请输入工厂编码" />
</el-form-item>
<el-form-item label="工厂名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
placeholder="请输入工厂名称" />
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="dataForm.address" clearable placeholder="请输入地址" />
</el-form-item>
<!-- <el-form-item label="启用状态" prop="enabled">
<el-select
v-model="dataForm.enabled"
placeholder="请选择启用状态">
<el-option
v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_BOOLEAN_STRING)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item> -->
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import { createFactory, updateFactory, getFactory, getCode } from "@/api/core/base/factory";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createFactory,
updateURL: updateFactory,
infoURL: getFactory,
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
address: undefined,
remark: undefined,
},
dataRule: {
code: [{ required: true, message: "工厂编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "工厂名称不能为空", trigger: "blur" }],
}
};
},
methods: {
},
};
</script>

View File

@ -1,258 +1,190 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar
<!-- 搜索工作栏 --> :formConfigs="formConfig"
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> ref="searchBarForm"
<el-form-item label="工厂编码" prop="code"> @headBtnClick="buttonClick" />
<el-input v-model="queryParams.code" placeholder="请输入工厂编码" clearable @keyup.enter.native="handleQuery"/> <base-table
</el-form-item> v-loading="dataListLoading"
<el-form-item label="工厂名称" prop="name"> :table-props="tableProps"
<el-input v-model="queryParams.name" placeholder="请输入工厂名称" clearable @keyup.enter.native="handleQuery"/> :page="listQuery.pageNo"
</el-form-item> :limit="listQuery.pageSize"
<el-form-item label="创建时间" prop="createTime"> :table-data="tableData">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" <method-btn
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> v-if="tableBtn.length"
</el-form-item> slot="handleBtn"
<el-form-item> :width="120"
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> label="操作"
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> :method-list="tableBtn"
</el-form-item> @clickBtn="handleClick" />
</el-form> </base-table>
<pagination
<!-- 操作工具栏 --> :limit.sync="listQuery.pageSize"
<el-row :gutter="10" class="mb8"> :page.sync="listQuery.pageNo"
<el-col :span="1.5"> :total="listQuery.total"
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" @pagination="getDataList" />
v-hasPermi="['base:factory:create']">新增</el-button> <base-dialog
</el-col> :dialogTitle="addOrEditTitle"
<el-col :span="1.5"> :dialogVisible="addOrUpdateVisible"
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" @cancel="handleCancel"
v-hasPermi="['base:factory:export']">导出</el-button> @confirm="handleConfirm"
</el-col> :before-close="handleCancel"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> width="70%">
</el-row> <add-or-update
ref="addOrUpdate"
<!-- 列表 --> @refreshDataList="successSubmit"></add-or-update>
<el-table v-loading="loading" :data="list"> </base-dialog>
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="工厂编码" align="center" prop="code" />
<el-table-column label="工厂名称" align="center" prop="name" />
<el-table-column label="地址" align="center" prop="address" />
<el-table-column label="描述" align="center" prop="description" />
<el-table-column label="启用状态:0 、停用1、启用" align="center" prop="enabled">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.enabled" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="版本号" align="center" prop="version" />
<el-table-column label="外部系统编码" align="center" prop="externalCode" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<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="['base:factory:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:factory:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="工厂编码" prop="code">
<el-input v-model="form.code" placeholder="请输入工厂编码" />
</el-form-item>
<el-form-item label="工厂名称" prop="name">
<el-input v-model="form.name" placeholder="请输入工厂名称" />
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="启用状态:0 、停用1、启用" prop="enabled">
<el-select v-model="form.enabled" placeholder="请选择启用状态:0 、停用1、启用">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_BOOLEAN_STRING)"
:key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="版本号" prop="version">
<el-input v-model="form.version" placeholder="请输入版本号" />
</el-form-item>
<el-form-item label="外部系统编码" prop="externalCode">
<el-input v-model="form.externalCode" placeholder="请输入外部系统编码" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createFactory, updateFactory, deleteFactory, getFactory, getFactoryPage, exportFactoryExcel } from "@/api/core/base/factory"; import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
deleteFactory,
getFactoryPage,
exportFactoryExcel,
} from '@/api/core/base/factory';
const tableProps = [
{
prop: 'code',
label: '工厂编码',
align: 'center',
},
{
prop: 'name',
label: '工厂名称',
align: 'center',
},
{
prop: 'address',
label: '地址',
align: 'center',
},
{
prop: 'remark',
label: '备注',
align: 'center',
},
{
prop: 'createTime',
label: '创建时间',
align: 'center',
filter: parseTime,
},
];
export default { export default {
name: "Factory", mixins: [basicPage],
components: {
},
data() { data() {
return { return {
// urlOptions: {
loading: true, getDataListURL: getFactoryPage,
// deleteURL: deleteFactory,
exportLoading: false, exportURL: exportFactoryExcel,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
code: null,
name: null,
createTime: [],
}, },
// tableProps,
form: {}, tableBtn: [
// this.$auth.hasPermi(`base:factory:update`)
rules: { ? {
code: [{ required: true, message: "工厂编码不能为空", trigger: "blur" }], type: 'edit',
name: [{ required: true, message: "工厂名称不能为空", trigger: "blur" }], btnName: '编辑',
enabled: [{ required: true, message: "启用状态:0 、停用1、启用不能为空", trigger: "change" }],
externalCode: [{ required: true, message: "外部系统编码不能为空", trigger: "blur" }],
} }
: undefined,
this.$auth.hasPermi(`base:factory:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'input',
label: '工厂编码',
placeholder: '工厂编码',
param: 'code',
},
{
type: 'input',
label: '工厂名称',
placeholder: '工厂名称',
param: 'name',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:factory:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
}; };
}, },
created() { components: {
this.getList(); AddOrUpdate,
}, },
created() {},
methods: { methods: {
/** 查询列表 */ buttonClick(val) {
getList() { switch (val.btnName) {
this.loading = true; case 'search':
// this.listQuery.pageNo = 1;
getFactoryPage(this.queryParams).then(response => { this.listQuery.pageSize = 10;
this.list = response.data.list; this.listQuery.name = val.name;
this.total = response.data.total; this.listQuery.code = val.code;
this.loading = false; this.getDataList();
}); break;
}, case 'reset':
/** 取消按钮 */ this.$refs.searchBarForm.resetForm();
cancel() { this.listQuery = {
this.open = false; pageSize: 10,
this.reset(); pageNo: 1,
}, total: 1,
/** 表单重置 */
reset() {
this.form = {
id: undefined,
code: undefined,
name: undefined,
address: undefined,
description: undefined,
enabled: undefined,
remark: undefined,
version: undefined,
externalCode: undefined,
}; };
this.resetForm("form"); this.getDataList();
}, break;
/** 搜索按钮操作 */ case 'add':
handleQuery() { this.addOrEditTitle = '新增';
this.queryParams.pageNo = 1; this.addOrUpdateVisible = true;
this.getList(); this.addOrUpdateHandle();
}, break;
/** 重置按钮操作 */ case 'export':
resetQuery() { this.handleExport();
this.resetForm("queryForm"); break;
this.handleQuery(); default:
}, console.log(val);
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加工厂";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getFactory(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工厂";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
} }
//
if (this.form.id != null) {
updateFactory(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createFactory(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
}, },
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除工厂编号为"' + id + '"的数据项?').then(function() {
return deleteFactory(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}, },
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有工厂数据项?').then(() => {
this.exportLoading = true;
return exportFactoryExcel(params);
}).then(response => {
this.$download.excel(response, '工厂.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
}; };
</script> </script>

View File

@ -1,208 +1,103 @@
<!--
* @Author: zwq
* @Date: 2023-08-02 15:12:42
* @LastEditors: zwq
* @LastEditTime: 2023-08-03 14:24:36
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar
<!-- 搜索工作栏 --> :formConfigs="formConfig"
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> ref="searchBarForm"
<el-form-item> @headBtnClick="buttonClick" />
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> <base-table
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> v-loading="dataListLoading"
</el-form-item> :table-props="tableProps"
</el-form> :page="listQuery.pageNo"
:limit="listQuery.pageSize"
<!-- 操作工具栏 --> :table-data="tableData"
<el-row :gutter="10" class="mb8"> @emitFun="inputChange" />
<el-col :span="1.5"> <pagination
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" :limit.sync="listQuery.pageSize"
v-hasPermi="['base:line-bind-product:create']">新增</el-button> :page.sync="listQuery.pageNo"
</el-col> :total="listQuery.total"
<el-col :span="1.5"> @pagination="getDataList" />
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:line-bind-product:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="产线id" align="center" prop="productionLineId" />
<el-table-column label="产品id" align="center" prop="productId" />
<el-table-column label="记录时间" align="center" prop="recordTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.recordTime) }}</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="['base:line-bind-product:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:line-bind-product:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="产线id" prop="productionLineId">
<el-input v-model="form.productionLineId" placeholder="请输入产线id" />
</el-form-item>
<el-form-item label="产品id" prop="productId">
<el-input v-model="form.productId" placeholder="请输入产品id" />
</el-form-item>
<el-form-item label="记录时间" prop="recordTime">
<el-date-picker clearable v-model="form.recordTime" type="date" value-format="timestamp" placeholder="选择记录时间" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createLineBindProduct, updateLineBindProduct, deleteLineBindProduct, getLineBindProduct, getLineBindProductPage, exportLineBindProductExcel } from "@/api/core/base/lineBindProduct"; import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import { getLineBindProductPage } from '@/api/core/base/lineBindProduct';
import selectProduct from './selectProduct';
import { getProductPage } from '@/api/core/base/product';
const tableProps = [
{
prop: 'lineName',
label: '产线',
align: 'center',
},
{
prop: 'productName',
label: '在制产品',
align: 'center',
list: [],
subcomponent: selectProduct,
},
{
prop: 'recordTime',
label: '开始时间',
align: 'center',
filter: parseTime,
},
];
export default { export default {
name: "LineBindProduct", mixins: [basicPage, selectProduct],
components: {
},
data() { data() {
return { return {
// urlOptions: {
loading: true, getDataListURL: getLineBindProductPage,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
// 线
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
}, },
// tableProps,
form: {}, tableData: [],
// formConfig: [
rules: { {
} type: 'button',
btnName: '同步',
name: 'search',
color: 'primary',
},
],
}; };
}, },
components: {},
created() { created() {
this.getList(); const params = {
pageSize: 100,
pageNo: 1,
};
getProductPage(params).then((response) => {
this.tableProps[1].list = response.data.list;
});
}, },
methods: { methods: {
/** 查询列表 */ buttonClick(val) {
getList() { switch (val.btnName) {
this.loading = true; case 'search':
// this.listQuery.pageNo = 1;
getLineBindProductPage(this.queryParams).then(response => { this.listQuery.pageSize = 10;
this.list = response.data.list; this.getDataList();
this.total = response.data.total; break;
this.loading = false; default:
}); console.log(val);
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
productionLineId: undefined,
productId: undefined,
recordTime: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加产线目前生产产品表 主要为更新";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getLineBindProduct(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产线目前生产产品表 主要为更新";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
} }
//
if (this.form.id != null) {
updateLineBindProduct(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLineBindProduct(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
}, },
/** 删除按钮操作 */ inputChange() {
handleDelete(row) { this.getDataList();
const id = row.id; },
this.$modal.confirm('是否确认删除产线目前生产产品表 主要为更新编号为"' + id + '"的数据项?').then(function() {
return deleteLineBindProduct(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}, },
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有产线目前生产产品表 主要为更新数据项?').then(() => {
this.exportLoading = true;
return exportLineBindProductExcel(params);
}).then(response => {
this.$download.excel(response, '产线目前生产产品表 主要为更新.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
}; };
</script> </script>

View File

@ -0,0 +1,73 @@
<!--
* @Author: zwq
* @Date: 2023-08-03 14:09:18
* @LastEditors: zwq
* @LastEditTime: 2023-08-03 14:51:16
* @Description:
-->
<template>
<div class="tableInner">
<el-input readonly v-model="list.productName" style="width: 50%;" ></el-input>
<el-popover
placement="top"
title="切换在制产品"
width="160"
v-model="visible">
<el-select v-model="list.string" style="margin: 5px;" filterable>
<el-option
v-for="item in injectData.list"
:key="item.id"
:label="item.name"
:value="item.id + '+' + item.name"></el-option>
</el-select>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="visible = false">
取消
</el-button>
<el-button type="primary" size="mini" @click="changeInput">
确定
</el-button>
</div>
<el-button type="text" slot="reference">切换</el-button>
</el-popover>
</div>
</template>
<script>
import { switchLineBindProduct } from '@/api/core/base/lineBindProduct';
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
list: this.injectData,
visible: false,
};
},
methods: {
changeInput() {
const data = {
id: this.list.id,
productId: this.list.string.split('+')[0],
productName: this.list.string.split('+')[1],
};
switchLineBindProduct(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('emitData');
});
},
},
};
</script>
<style scoped>
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

View File

@ -1,241 +1,147 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar
<!-- 搜索工作栏 --> :formConfigs="formConfig"
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> ref="searchBarForm"
<el-form-item label="产线id" prop="productionLineId"> @headBtnClick="buttonClick" />
<el-select v-model="queryParams.productionLineId" placeholder="请选择产线id" clearable size="small"> <base-table
<el-option label="请选择字典生成" value="" /> v-loading="dataListLoading"
</el-select> :table-props="tableProps"
</el-form-item> :page="listQuery.pageNo"
<el-form-item label="产品id" prop="productId"> :limit="listQuery.pageSize"
<el-select v-model="queryParams.productId" placeholder="请选择产品id" clearable size="small"> :table-data="tableData" />
<el-option label="请选择字典生成" value="" /> <pagination
</el-select> :limit.sync="listQuery.pageSize"
</el-form-item> :page.sync="listQuery.pageNo"
<el-form-item label="开始时间" prop="startTime"> :total="listQuery.total"
<el-date-picker v-model="queryParams.startTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" @pagination="getDataList" />
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</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="['base:line-bind-product-log:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:line-bind-product-log:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="产线id" align="center" prop="productionLineId" />
<el-table-column label="产品id" align="center" prop="productId" />
<el-table-column label="开始时间" align="center" prop="startTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.startTime) }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" align="center" prop="endTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</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="['base:line-bind-product-log:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:line-bind-product-log:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="产线id" prop="productionLineId">
<el-select v-model="form.productionLineId" placeholder="请选择产线id">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="产品id" prop="productId">
<el-select v-model="form.productId" placeholder="请选择产品id">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择开始时间" />
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择结束时间" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createLineBindProductLog, updateLineBindProductLog, deleteLineBindProductLog, getLineBindProductLog, getLineBindProductLogPage, exportLineBindProductLogExcel } from "@/api/core/base/lineBindProductLog"; import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import { getLineBindProductLogPage } from '@/api/core/base/lineBindProductLog';
import { getProductionLinePage } from '@/api/core/base/productionLine';
import { getProductPage } from '@/api/core/base/product';
const tableProps = [
{
prop: 'productionLineName',
label: '产线',
align: 'center',
},
{
prop: 'productName',
label: '在制产品',
align: 'center',
},
{
prop: 'startTime',
label: '开始时间',
align: 'center',
filter: parseTime,
},
{
prop: 'endTime',
label: '结束时间',
align: 'center',
filter: parseTime,
},
];
export default { export default {
name: "LineBindProductLog", mixins: [basicPage],
components: {
},
data() { data() {
return { return {
// urlOptions: {
loading: true, getDataListURL: getLineBindProductLogPage,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
// 线
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
productionLineId: null,
productId: null,
startTime: [],
}, },
// tableProps,
form: {}, tableData: [],
// optionArrUrl: [getProductionLinePage, getProductPage],
rules: { formConfig: [
productionLineId: [{ required: true, message: "产线id不能为空", trigger: "change" }], {
productId: [{ required: true, message: "产品id不能为空", trigger: "change" }], type: 'select',
startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }], label: '产线',
} selectOptions: [],
param: 'productionLineId',
defaultSelect: '',
filterable: true,
},
{
type: 'select',
label: '在制产品',
selectOptions: [],
param: 'productId',
defaultSelect: '',
filterable: true,
},
{
type: 'datePicker',
label: '时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'createTime',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
},
],
}; };
}, },
components: {
},
created() { created() {
this.getList(); this.getArr();
}, },
methods: { methods: {
/** 查询列表 */ getArr() {
getList() { const params = {
this.loading = true; page: 1,
// limit: 500,
getLineBindProductLogPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
productionLineId: undefined,
productId: undefined,
startTime: undefined,
endTime: undefined,
}; };
this.resetForm("form"); this.optionArrUrl.forEach((item, index) => {
}, item(params).then((response) => {
/** 搜索按钮操作 */ this.formConfig[index].selectOptions = response.data.list;
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加产线目前生产产品表 主要为更新";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getLineBindProductLog(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产线目前生产产品表 主要为更新";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateLineBindProductLog(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLineBindProductLog(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}); });
}); });
}, },
/** 删除按钮操作 */ buttonClick(val) {
handleDelete(row) { switch (val.btnName) {
const id = row.id; case 'search':
this.$modal.confirm('是否确认删除产线目前生产产品表 主要为更新编号为"' + id + '"的数据项?').then(function() { this.listQuery.pageNo = 1;
return deleteLineBindProductLog(id); this.listQuery.pageSize = 10;
}).then(() => { this.listQuery.productionLineId = val.productionLineId;
this.getList(); this.listQuery.productId = val.productId;
this.$modal.msgSuccess("删除成功"); this.listQuery.createTime = val.createTime;
}).catch(() => {}); this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
default:
console.log(val);
}
},
}, },
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有产线目前生产产品表 主要为更新数据项?').then(() => {
this.exportLoading = true;
return exportLineBindProductLogExcel(params);
}).then(response => {
this.$download.excel(response, '产线目前生产产品表 主要为更新.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
}; };
</script> </script>

View File

@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -0,0 +1,425 @@
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
</small-title>
<div class="content">
<div class="visual-part">
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
label-position="top"
@keyup.enter.native="dataFormSubmit">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产品编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
:disabled="isdetail"
placeholder="请输入产品编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产品名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
:disabled="isdetail"
placeholder="请输入产品名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产品类型" prop="typeDictValue">
<el-select
v-model="dataForm.typeDictValue"
style="width: 100%"
:disabled="isdetail"
placeholder="请选择产品类型">
<el-option
v-for="dict in getDictDatas(DICT_TYPE.PRODUCT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unitDictValue">
<el-select
v-model="dataForm.unitDictValue"
style="width: 100%"
:disabled="isdetail"
placeholder="请选择单位">
<el-option
v-for="dict in getDictDatas(DICT_TYPE.UNIT_DICT)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="规格" prop="specifications">
<el-input
:disabled="isdetail"
v-model="dataForm.specifications"
placeholder="请输入规格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位平方数" prop="area">
<el-input
:disabled="isdetail"
v-model="dataForm.area"
placeholder="请输入单位平方数" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="完成单位产品用时" prop="processTime">
<el-input
:disabled="isdetail"
v-model="dataForm.processTime"
placeholder="请输入完成单位产品用时" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
产品属性列表
</small-title>
<div class="attr-list">
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="productAttributeList">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
</div>
</div>
<div style="position: absolute; bottom: 24px; right: 24px">
<el-button style="margin-right: 10px" @click="goback()">返回</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">保存</el-button>
<el-button
v-if="dataForm.id && !isdetail"
type="primary"
@click="addNew()">
添加属性
</el-button>
</span>
</div>
<product-attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:product-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template>
<script>
import {
deleteProductAttr,
getProductAttrPage,
} from '@/api/core/base/productAttr';
import {
createProduct,
updateProduct,
getProduct,
getCode,
} from '@/api/core/base/product';
import productAttrAdd from './attr-add';
import { parseTime } from '../../mixins/code-filter';
import SmallTitle from './SmallTitle';
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
},
{
prop: 'name',
label: '属性名',
},
{
prop: 'value',
label: '属性值',
},
];
export default {
components: { productAttrAdd, SmallTitle },
data() {
return {
visible: false,
addOrUpdateVisible: false,
tableBtn,
tableProps,
productAttributeList: [],
dataForm: {
id: null,
name: '', //
code: '', //
area: 0, // (float only)
typeDictValue: null, // id
processTime: null, // (s)
specifications: '', //
unitDictValue: '', // id
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataRule: {
code: [
{
required: true,
message: '产品编码不能为空',
trigger: 'blur',
},
// {
// type: 'number',
// message: '',
// trigger: 'blur',
// transfom: 'val => Number(val)',
// },
],
name: [
{
required: true,
message: '产品名称不能为空',
trigger: 'blur',
},
],
typeDictValue: [
{
required: true,
message: '产品类型不能为空',
trigger: 'blur',
},
],
area: [
// {
// type: 'float',
// message: '',
// trigger: 'blur',
// transfom: 'val => Float(val)',
// },
],
processTime: [
{
required: true,
message: '完成单位产品用时不能为空',
trigger: 'blur',
},
// {
// type: 'number',
// message: '',
// trigger: 'blur',
// transfom: 'val => Number(val)',
// },
],
},
isdetail: false,
};
},
methods: {
initData() {
this.productAttributeList.splice(0);
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || null;
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
getProduct(id).then((response) => {
this.dataForm = response.data;
});
//
this.getList();
} else {
getCode().then((res) => {
this.dataForm.code = res.data;
});
}
});
},
getList() {
//
const params = {
pageSize: 10,
pageNo: 1,
productId: this.dataForm.id,
};
getProductAttrPage(params).then((response) => {
this.productAttributeList = response.data.list;
this.listQuery.total = response.data.total;
});
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteProductAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateProduct(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createProduct(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
this.initData();
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 30px;
}
.drawer >>> .content {
padding: 0 24px 30px;
display: flex;
flex-direction: column;
height: 100%;
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
</style>

View File

@ -0,0 +1,139 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'35%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="属性名" prop="name">
<el-input
v-model="dataForm.name"
placeholder="请输入属性名"
clearable />
</el-form-item>
<el-form-item label="属性值" prop="value">
<el-input
v-model="dataForm.value"
placeholder="请输入属性值"
clearable />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import {
createProductAttr,
updateProductAttr,
getProductAttr,
} from '@/api/core/base/productAttr';
export default {
props: {
productId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
value: '',
},
dataRule: {
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
};
},
methods: {
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getProductAttr(this.dataForm.id).then((res) => {
const { name, value } = res.data;
this.dataForm.name = name;
this.dataForm.value = value;
});
}
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateProductAttr({
...this.dataForm,
productId: this.productId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createProductAttr({
...this.dataForm,
productId: this.productId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@ -1,498 +1,205 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zwq
* @LastEditTime: 2023-08-03 15:22:53
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <search-bar
<el-form :formConfigs="formConfig"
class="search-form" ref="searchBarForm"
:model="queryParams" @headBtnClick="buttonClick" />
ref="queryForm" <base-table
size="small" :table-props="tableProps"
:inline="true" :page="listQuery.pageNo"
v-show="showSearch" :limit="listQuery.pageSize"
label-width="68px"> :table-data="tableData">
<el-form-item prop="name"> <method-btn
<el-input v-if="tableBtn.length"
v-model="queryParams.name" slot="handleBtn"
placeholder="名称" :width="120"
clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item prop="code">
<el-input
v-model="queryParams.code"
placeholder="编码"
clearable
@keyup.enter.native="handleQuery" />
</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-item>
<el-button
type="primary"
plain
icon="el-icon-plus"
@click="handleAdd"
v-hasPermi="['base:product:create']">
新增
</el-button>
</el-form-item>
<!-- <el-form-item>
<el-button
type="warning"
plain
icon="el-icon-download"
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['base:product:export']">
导出
</el-button>
</el-form-item> -->
</el-form>
<div class="data-list">
<!-- <el-row :gutter="10" class="mb8">
<el-col :span="1.5"></el-col>
<el-col :span="1.5"></el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"></right-toolbar>
</el-row> -->
<!-- 列表 -->
<el-table class="f-table-list" v-loading="loading" :data="list">
<!-- <el-table-column label="ID" align="center" prop="id" /> -->
<el-table-column
label="添加时间"
align="center"
prop="createTime"
width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="产品名称" align="center" prop="name" />
<el-table-column label="产品编码" align="center" prop="code" />
<el-table-column label="规格" align="center" prop="specifications" />
<el-table-column label="单位" align="center" prop="unitDictValue">
<template v-slot="scope">
<dict-tag
:type="DICT_TYPE.UNIT_DICT"
:value="scope.row.unitDictValue" />
</template>
</el-table-column>
<!-- <el-table-column label="产品类型" align="center" prop="typeDictValue">
<template v-slot="scope">
<dict-tag
:type="DICT_TYPE.PRODUCT_TYPE"
:value="scope.row.typeDictValue" />
</template>
</el-table-column> -->
<el-table-column
label="操作" label="操作"
align="center" :method-list="tableBtn"
class-name="small-padding fixed-width"> @clickBtn="handleClick" />
<template v-slot="scope"> </base-table>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['base:product:update']">
修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['base:product:delete']">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination <pagination
v-show="total > 0" :limit.sync="listQuery.pageSize"
:total="total" :page.sync="listQuery.pageNo"
:page.sync="queryParams.pageNo" :total="listQuery.total"
:limit.sync="queryParams.pageSize" @pagination="getDataList" />
@pagination="getList" /> <add-or-update
</div> v-if="addOrUpdateVisible"
ref="addOrUpdate"
<!-- 对话框(添加 / 修改) --> @refreshDataList="getDataList" />
<el-dialog
:title="title"
:visible.sync="open"
width="50%"
v-dialogDrag
append-to-body>
<el-form ref="form" :model="form" :rules="rules">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产品编码" prop="code">
<el-input v-model="form.code" placeholder="请输入产品编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入产品名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产品类型" prop="typeDictValue">
<el-select
v-model="form.typeDictValue"
placeholder="请选择产品类型">
<el-option
v-for="dict in getDictDatas(DICT_TYPE.PRODUCT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unitDictValue">
<el-select v-model="form.unitDictValue" placeholder="请选择单位">
<el-option
v-for="dict in getDictDatas(DICT_TYPE.UNIT_DICT)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="规格" prop="specifications">
<el-input
v-model="form.specifications"
placeholder="请输入规格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位平方数" prop="area">
<el-input v-model="form.area" placeholder="请输入单位平方数" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="完成单位产品用时" prop="processTime">
<el-input
v-model="form.processTime"
placeholder="请输入完成单位产品用时" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<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 { import {
createProduct,
updateProduct,
deleteProduct, deleteProduct,
getProduct,
getProductPage, getProductPage,
exportProductExcel, exportProductExcel,
} from '@/api/core/base/product'; } from '@/api/core/base/product';
const tableProps = [
{
prop: 'code',
label: '产品编码',
align: 'center',
},
{
prop: 'name',
label: '产品名称',
align: 'center',
},
{
prop: 'specifications',
label: '规格',
align: 'center',
},
{
prop: 'unitDictValue',
label: '单位',
align: 'center',
subcomponent: unitDict,
},
{
prop: 'createTime',
label: '创建时间',
align: 'center',
filter: parseTime,
},
];
export default { export default {
name: 'Product', mixins: [basicPage],
components: {},
data() { data() {
return { return {
// urlOptions: {
loading: true, getDataListURL: getProductPage,
// deleteURL: deleteProduct,
exportLoading: false, exportURL: exportProductExcel,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
code: null,
name: null,
}, },
// tableProps,
form: {}, tableBtn: [
// this.$auth.hasPermi(`base:product:update`)
rules: { ? {
code: [ type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:product:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
this.$auth.hasPermi(`base:product:update`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{ {
required: true, type: 'input',
message: '产品编码不能为空', label: '产品编码',
trigger: 'blur', placeholder: '产品编码',
param: 'code',
}, },
{ {
type: 'number', type: 'input',
message: '产品编码为数字类型', label: '产品名称',
trigger: 'blur', placeholder: '产品名称',
transfom: 'val => Number(val)', param: 'name',
}, },
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:product:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: 'separate',
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('base:product:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
], ],
name: [
{
required: true,
message: '产品名称不能为空',
trigger: 'blur',
},
],
typeDictValue: [
{
required: true,
message: '产品类型不能为空',
trigger: 'blur',
},
],
area: [
{
type: 'number',
message: '单位平方数为浮点类型',
trigger: 'blur',
transfom: 'val => Number(val)',
},
],
processTime: [
{
required: true,
message: '完成单位产品用时不能为空',
trigger: 'blur',
},
{
type: 'number',
message: '完成单位产品用时为浮点类型',
trigger: 'blur',
transfom: 'val => Number(val)',
},
],
},
}; };
}, },
created() { components: {
console.log('DICTYPE', this.DICT_TYPE); AddOrUpdate,
this.getList();
}, },
created() {},
methods: { methods: {
/** 查询列表 */ buttonClick(val) {
getList() { switch (val.btnName) {
this.loading = true; case 'search':
// this.listQuery.pageNo = 1;
getProductPage(this.queryParams).then((response) => { this.listQuery.pageSize = 10;
this.list = response.data.list; this.listQuery.name = val.name;
this.total = response.data.total; this.listQuery.code = val.code;
this.loading = false; this.getDataList();
}); break;
}, case 'reset':
/** 取消按钮 */ this.$refs.searchBarForm.resetForm();
cancel() { this.listQuery = {
this.open = false; pageSize: 10,
this.reset(); pageNo: 1,
}, total: 1,
/** 表单重置 */
reset() {
this.form = {
id: undefined,
code: undefined,
name: undefined,
specifications: undefined,
unitDictValue: undefined,
area: undefined,
processTime: undefined,
typeDictValue: undefined,
}; };
this.resetForm('form'); this.getDataList();
}, break;
/** 搜索按钮操作 */ case 'add':
handleQuery() { this.addOrEditTitle = '新增';
this.queryParams.pageNo = 1; this.addOrUpdateVisible = true;
this.getList(); this.addOrUpdateHandle();
}, break;
/** 重置按钮操作 */ case 'export':
resetQuery() { this.handleExport();
this.resetForm('queryForm'); break;
this.handleQuery(); default:
}, console.log(val);
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加产品';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getProduct(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改产品';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
} }
//
if (this.form.id != null) {
updateProduct(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createProduct(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
}, },
/** 删除按钮操作 */ otherMethods(val) {
handleDelete(row) { this.addOrUpdateVisible = true;
const id = row.id; this.addOrEditTitle = '详情';
this.$modal this.$nextTick(() => {
.confirm('是否确认删除产品编号为"' + id + '"的数据项?') this.$refs.addOrUpdate.init(val.data.id, true);
.then(function () { });
return deleteProduct(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有产品数据项?')
.then(() => {
this.exportLoading = true;
return exportProductExcel(params);
})
.then((response) => {
this.$download.excel(response, '产品.xls');
this.exportLoading = false;
})
.catch(() => {});
}, },
}, },
}; };
</script> </script>
<style scoped lang="scss">
// .app-container {
// padding: 20px 0;
// }
// .el-form {
// // border: 1px solid red;
// .el-form-item {
// // border: 1px solid blue;
// margin: 0;
// &:not(:last-child) {
// margin-right: 8px;
// }
// // input,select,textarea {
// // border: none;
// // }
// }
// }
// .search-form {
// margin-bottom: 12px;
// .el-button {
// border: none;
// border-radius: 0;
// }
// :deep(.el-form-item__content) {
// [class*='__inner'] {
// border: none;
// border-bottom: 1px solid #ccc;
// margin-bottom: 8px;
// border-radius: 0;
// &:focus {
// background-color: #ffa70020;
// border-color: #ffa700;
// }
// }
// }
// }
// form.el-form.search-form.el-form--inline {
// position: relative;
// padding-left: 100px;
// }
// .f-table-list {
// :deep(th) {
// &.el-table__cell {
// border-top: 1px solid #dfe6ec;
// }
// }
// }
// .flex {
// display: flex;
// }
// .items-center {
// align-items: center;
// }
// form.el-form.search-form.el-form--inline::before {
// content: '';
// display: inline-block;
// height: 28px;
// line-height: 28px;
// width: 80px;
// background: #ffa700;
// color: white;
// letter-spacing: 1px;
// font-weight: 600;
// padding-left: 8px;
// position: absolute;
// top: 2px;
// left: 0;
// border-top-right-radius: 6px;
// border-bottom-right-radius: 6px;
// }
</style>

View File

@ -0,0 +1,15 @@
<template>
<dict-tag
:type="DICT_TYPE.UNIT_DICT"
:value="injectData.unitDictValue" />
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
};
</script>

View File

@ -0,0 +1,104 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:59:35
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="90px">
<el-form-item label="产线编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
placeholder="请输入产线编码" />
</el-form-item>
<el-form-item label="产线名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
placeholder="请输入产线名称" />
</el-form-item>
<el-form-item prop="factoryId" label="工厂名称">
<el-select
v-model="dataForm.factoryId" filterable clearable placeholder="请选择工厂">
<el-option
v-for="item in urlOptions.optionArr.arr0"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="产线TT值(h)" prop="tvalue">
<el-input v-model="dataForm.tvalue" clearable placeholder="请输入每小时下片数量" />
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input
v-model="dataForm.description"
type="textarea"
placeholder="请输入内容" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
createProductionLine,
updateProductionLine,
getProductionLine,
getCode,
} from '@/api/core/base/productionLine';
import {
getFactoryPage,
} from '@/api/core/base/factory';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
getOption: true,
isGetCode: true,
codeURL: getCode,
createURL: createProductionLine,
updateURL: updateProductionLine,
infoURL: getProductionLine,
optionArrUrl: [getFactoryPage],
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
tvalue: undefined,
factoryId: undefined,
remark: undefined,
description: undefined,
},
dataRule: {
code: [
{ required: true, message: '产线编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '产线名称不能为空', trigger: 'blur' },
],
factoryId: [
{ required: true, message: '工厂不能为空', trigger: 'change' },
],
},
};
},
methods: {
},
};
</script>

View File

@ -1,236 +1,225 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar
<!-- 搜索工作栏 --> :formConfigs="formConfig"
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> ref="searchBarForm"
<el-form-item label="名称" prop="name"> @headBtnClick="buttonClick" />
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/> <base-table
</el-form-item> v-loading="dataListLoading"
<el-form-item> :table-props="tableProps"
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> :page="listQuery.pageNo"
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> :limit="listQuery.pageSize"
</el-form-item> :table-data="tableData">
</el-form> <method-btn
v-if="tableBtn.length"
<!-- 操作工具栏 --> slot="handleBtn"
<el-row :gutter="10" class="mb8"> :width="120"
<el-col :span="1.5"> label="操作"
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" :method-list="tableBtn"
v-hasPermi="['base:production-line:create']">新增</el-button> @clickBtn="handleClick" />
</el-col> </base-table>
<el-col :span="1.5"> <pagination
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" :limit.sync="listQuery.pageSize"
v-hasPermi="['base:production-line:export']">导出</el-button> :page.sync="listQuery.pageNo"
</el-col> :total="listQuery.total"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> @pagination="getDataList" />
</el-row> <base-dialog
:dialogTitle="addOrEditTitle"
<!-- 列表 --> :dialogVisible="addOrUpdateVisible"
<el-table v-loading="loading" :data="list"> @cancel="handleCancel"
<el-table-column label="id" align="center" prop="id" /> @confirm="handleConfirm"
<el-table-column label="工厂表ID" align="center" prop="factoryId" /> :before-close="handleCancel"
<el-table-column label="编码" align="center" prop="code" /> width="70%">
<el-table-column label="名称" align="center" prop="name" /> <add-or-update
<el-table-column label="描述" align="center" prop="description" /> ref="addOrUpdate"
<el-table-column label="备注" align="center" prop="remark" /> @refreshDataList="successSubmit"></add-or-update>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> </base-dialog>
<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="['base:production-line:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:production-line:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="工厂表ID" prop="factoryId">
<el-select v-model="form.factoryId" placeholder="请选择工厂表ID">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="编码" prop="code">
<el-input v-model="form.code" placeholder="请输入编码" />
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="每小时下片数量" prop="tvalue">
<el-input v-model="form.tvalue" placeholder="请输入每小时下片数量" />
</el-form-item>
<el-form-item label="外部系统编码大屏数据使用LINE_1,LINE_2,LINE_3,LINE_4" prop="externalCode">
<el-input v-model="form.externalCode" placeholder="请输入外部系统编码大屏数据使用LINE_1,LINE_2,LINE_3,LINE_4" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createProductionLine, updateProductionLine, deleteProductionLine, getProductionLine, getProductionLinePage, exportProductionLineExcel } from "@/api/core/base/productionLine"; import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import codeFilter from '../../mixins/code-filter';
import { parseTime } from '../../mixins/code-filter';
import {
deleteProductionLine,
getProductionLinePage,
exportProductionLineExcel,
getStatus,
} from '@/api/core/base/productionLine';
const tableProps = [
{
prop: 'code',
label: '产线编码',
align: 'center',
},
{
prop: 'name',
label: '产线名称',
align: 'center',
},
{
prop: 'factoryName',
label: '工厂',
align: 'center',
},
{
prop: 'externalCode',
label: '额外编码',
align: 'center',
},
{
prop: 'status',
label: '当前状态',
align: 'center',
filter: codeFilter('lineStatus'),
},
{
prop: 'description',
label: '描述',
align: 'center',
},
{
prop: 'remark',
label: '备注',
align: 'center',
},
{
prop: 'createTime',
label: '创建时间',
align: 'center',
filter: parseTime,
},
];
export default { export default {
name: "ProductionLine", mixins: [basicPage],
components: {
},
data() { data() {
return { return {
// urlOptions: {
loading: true, getDataListURL: getProductionLinePage,
// deleteURL: deleteProductionLine,
exportLoading: false, exportURL: exportProductionLineExcel,
//
showSearch: true,
//
total: 0,
// 线
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
name: null,
}, },
// tableProps,
form: {}, tableBtn: [
// this.$auth.hasPermi(`base:production-line:update`)
rules: { ? {
factoryId: [{ required: true, message: "工厂表ID不能为空", trigger: "change" }], type: 'edit',
code: [{ required: true, message: "编码不能为空", trigger: "blur" }], btnName: '编辑',
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
} }
: undefined,
this.$auth.hasPermi(`base:production-line:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'input',
label: '产线名称',
placeholder: '产线名称',
param: 'name',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:production-line:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: this.$auth.hasPermi('base:production-line:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('base:production-line:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
}; };
}, },
created() { components: {
this.getList(); AddOrUpdate,
}, },
created() {},
methods: { methods: {
/** 查询列表 */ //
getList() { getDataList() {
this.loading = true; this.dataListLoading = true;
// this.urlOptions.getDataListURL(this.listQuery).then((response) => {
getProductionLinePage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.getStatus(response.data.list);
this.dataListLoading = false;
}); });
}, },
/** 取消按钮 */ getStatus(list) {
cancel() { const ids = list.map((i) => {
this.open = false; return i.id;
this.reset(); });
getStatus(ids).then((response) => {
response.forEach((a) => {
list.forEach((b) => {
if (b.id === a.id) b.status = a.status;
});
});
this.tableData = list;
});
}, },
/** 表单重置 */ buttonClick(val) {
reset() { switch (val.btnName) {
this.form = { case 'search':
id: undefined, this.listQuery.pageNo = 1;
factoryId: undefined, this.listQuery.pageSize = 10;
code: undefined, this.listQuery.name = val.name;
name: undefined, this.getDataList();
description: undefined, break;
tvalue: undefined, case 'reset':
externalCode: undefined, this.$refs.searchBarForm.resetForm();
remark: undefined, this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
}; };
this.resetForm("form"); this.getDataList();
}, break;
/** 搜索按钮操作 */ case 'add':
handleQuery() { this.addOrEditTitle = '新增';
this.queryParams.pageNo = 1; this.addOrUpdateVisible = true;
this.getList(); this.addOrUpdateHandle();
}, break;
/** 重置按钮操作 */ case 'export':
resetQuery() { this.handleExport();
this.resetForm("queryForm"); break;
this.handleQuery(); default:
}, console.log(val);
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加工厂产线";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getProductionLine(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工厂产线";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
} }
//
if (this.form.id != null) {
updateProductionLine(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createProductionLine(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
}, },
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除工厂产线编号为"' + id + '"的数据项?').then(function() {
return deleteProductionLine(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}, },
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有工厂产线数据项?').then(() => {
this.exportLoading = true;
return exportProductionLineExcel(params);
}).then(response => {
this.$download.excel(response, '工厂产线.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
}; };
</script> </script>

View File

@ -0,0 +1,100 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:58:44
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="90px">
<el-form-item label="工段编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
placeholder="请输入工段编码" />
</el-form-item>
<el-form-item label="工段名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
placeholder="请输入工段名称" />
</el-form-item>
<el-form-item prop="productionLineId" label="产线">
<el-select
v-model="dataForm.productionLineId" filterable clearable placeholder="请选择产线">
<el-option
v-for="item in urlOptions.optionArr.arr0"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number v-model="dataForm.sort" :min="1" clearable placeholder="请输入排序" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
createWorkshopSection,
updateWorkshopSection,
getWorkshopSection,
getCode,
} from '@/api/core/base/workshopSection';
import {
getProductionLinePage,
} from '@/api/core/base/productionLine';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
getOption: true,
isGetCode: true,
codeURL: getCode,
createURL: createWorkshopSection,
updateURL: updateWorkshopSection,
infoURL: getWorkshopSection,
optionArrUrl: [getProductionLinePage],
},
dataForm: {
id: undefined,
code: undefined,
productionLineId: undefined,
sort: undefined,
name: undefined,
remark: undefined,
},
dataRule: {
code: [
{ required: true, message: '工段编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '工段名称不能为空', trigger: 'blur' },
],
sort: [
{ required: true, message: '排序不能为空', trigger: 'blur' },
],
productionLineId: [
{ required: true, message: '产线不能为空', trigger: 'change' },
],
},
};
},
methods: {
},
};
</script>

View File

@ -1,227 +1,188 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar
<!-- 搜索工作栏 --> :formConfigs="formConfig"
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> ref="searchBarForm"
<el-form-item label="名称" prop="name"> @headBtnClick="buttonClick" />
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/> <base-table
</el-form-item> v-loading="dataListLoading"
<el-form-item> :table-props="tableProps"
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> :page="listQuery.pageNo"
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> :limit="listQuery.pageSize"
</el-form-item> :table-data="tableData">
</el-form> <method-btn
v-if="tableBtn.length"
<!-- 操作工具栏 --> slot="handleBtn"
<el-row :gutter="10" class="mb8"> :width="120"
<el-col :span="1.5"> label="操作"
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" :method-list="tableBtn"
v-hasPermi="['base:workshop-section:create']">新增</el-button> @clickBtn="handleClick" />
</el-col> </base-table>
<el-col :span="1.5"> <pagination
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" :limit.sync="listQuery.pageSize"
v-hasPermi="['base:workshop-section:export']">导出</el-button> :page.sync="listQuery.pageNo"
</el-col> :total="listQuery.total"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> @pagination="getDataList" />
</el-row> <base-dialog
:dialogTitle="addOrEditTitle"
<!-- 列表 --> :dialogVisible="addOrUpdateVisible"
<el-table v-loading="loading" :data="list"> @cancel="handleCancel"
<el-table-column label="id" align="center" prop="id" /> @confirm="handleConfirm"
<el-table-column label="产线ID" align="center" prop="productionLineId" /> :before-close="handleCancel"
<el-table-column label="编码" align="center" prop="code" /> width="70%">
<el-table-column label="名称" align="center" prop="name" /> <add-or-update
<el-table-column label="排序" align="center" prop="sort" /> ref="addOrUpdate"
<el-table-column label="备注" align="center" prop="remark" /> @refreshDataList="successSubmit"></add-or-update>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> </base-dialog>
<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="['base:workshop-section:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:workshop-section:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="产线ID" prop="productionLineId">
<el-input v-model="form.productionLineId" placeholder="请输入产线ID" />
</el-form-item>
<el-form-item label="编码" prop="code">
<el-input v-model="form.code" placeholder="请输入编码" />
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createWorkshopSection, updateWorkshopSection, deleteWorkshopSection, getWorkshopSection, getWorkshopSectionPage, exportWorkshopSectionExcel } from "@/api/core/base/workshopSection"; import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
deleteWorkshopSection,
getWorkshopSectionPage,
exportWorkshopSectionExcel
} from "@/api/core/base/workshopSection";
const tableProps = [
{
prop: 'code',
label: '工段编码',
align: 'center',
},
{
prop: 'name',
label: '工段名称',
align: 'center',
},
{
prop: 'productionLineName',
label: '产线',
align: 'center',
},
{
prop: 'sort',
label: '排序',
align: 'center',
},
{
prop: 'remark',
label: '备注',
align: 'center',
},
{
prop: 'createTime',
label: '创建时间',
align: 'center',
filter: parseTime,
},
];
export default { export default {
name: "WorkshopSection", mixins: [basicPage],
components: {
},
data() { data() {
return { return {
// urlOptions: {
loading: true, getDataListURL: getWorkshopSectionPage,
// deleteURL: deleteWorkshopSection,
exportLoading: false, exportURL: exportWorkshopSectionExcel,
//
showSearch: true,
//
total: 0,
// 线
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
name: null,
}, },
// tableProps,
form: {}, tableBtn: [
// this.$auth.hasPermi(`base:workshop-section:update`)
rules: { ? {
productionLineId: [{ required: true, message: "产线ID不能为空", trigger: "blur" }], type: 'edit',
code: [{ required: true, message: "编码不能为空", trigger: "blur" }], btnName: '编辑',
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
sort: [{ required: true, message: "排序不能为空", trigger: "blur" }],
} }
: undefined,
this.$auth.hasPermi(`base:workshop-section:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'input',
label: '工段名称',
placeholder: '工段名称',
param: 'name',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:workshop-section:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: this.$auth.hasPermi('base:workshop-section:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('base:workshop-section:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
}; };
}, },
created() { components: {
this.getList(); AddOrUpdate,
}, },
created() {},
methods: { methods: {
/** 查询列表 */ buttonClick(val) {
getList() { switch (val.btnName) {
this.loading = true; case 'search':
// this.listQuery.pageNo = 1;
getWorkshopSectionPage(this.queryParams).then(response => { this.listQuery.pageSize = 10;
this.list = response.data.list; this.listQuery.name = val.name;
this.total = response.data.total; this.getDataList();
this.loading = false; break;
}); case 'reset':
}, this.$refs.searchBarForm.resetForm();
/** 取消按钮 */ this.listQuery = {
cancel() { pageSize: 10,
this.open = false; pageNo: 1,
this.reset(); total: 1,
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
productionLineId: undefined,
code: undefined,
name: undefined,
sort: undefined,
remark: undefined,
}; };
this.resetForm("form"); this.getDataList();
}, break;
/** 搜索按钮操作 */ case 'add':
handleQuery() { this.addOrEditTitle = '新增';
this.queryParams.pageNo = 1; this.addOrUpdateVisible = true;
this.getList(); this.addOrUpdateHandle();
}, break;
/** 重置按钮操作 */ case 'export':
resetQuery() { this.handleExport();
this.resetForm("queryForm"); break;
this.handleQuery(); default:
}, console.log(val);
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加产线工段";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getWorkshopSection(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产线工段";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
} }
//
if (this.form.id != null) {
updateWorkshopSection(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createWorkshopSection(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
}, },
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除产线工段编号为"' + id + '"的数据项?').then(function() {
return deleteWorkshopSection(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}, },
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有产线工段数据项?').then(() => {
this.exportLoading = true;
return exportWorkshopSectionExcel(params);
}).then(response => {
this.$download.excel(response, '产线工段.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
}; };
</script> </script>

View File

@ -0,0 +1,100 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2023-08-03 14:21:04
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
createURL: '',
updateURL: '',
infoURL: '',
codeURL: '',
getOption: false,
isGetCode: false,
optionArrUrl: [],
optionArr: {}
},
visible: false,
setData: false
}
},
created() {
},
activated() {
},
methods: {
init(id) {
this.dataForm.id = id || "";
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data;
if (this.setData) {
this.setDataForm()
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
getCode() {
this.urlOptions.codeURL()
.then(({ data: res }) => {
this.dataForm.code = res;
})
.catch(() => {});
},
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
}
this.urlOptions.optionArrUrl.forEach((item, index) => {
item(params).then(({ data: res }) => {
this.$set(this.urlOptions.optionArr, `arr${index}`, res.list)
})
.catch(() => {
});
});
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
formClear() {
this.$refs.dataForm.resetFields()
}
}
}

View File

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

View File

@ -0,0 +1,64 @@
/*
* @Date: 2020-12-29 16:49:28
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 11:10:04
* @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description:
*/
const table = {
lineStatus: {
1: '生产中',
2: '停止',
3: '未知',
},
}
// 日期格式化
export function parseTime(time, pattern) {
if (arguments.length === 0 || !time) {
return null
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),'');
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
export default function (dictTable) {
return function (val) {
return table?.[dictTable]?.[val]
}
}

View File

@ -0,0 +1,107 @@
<template>
<el-popover placement="right" width="400" trigger="click">
<el-table :data="tableData" v-if='tableProps.length'>
<el-table-column
v-for='item in tableProps'
:key="item.prop"
:prop="item.prop"
:label="item.label"
width="120">
</el-table-column>
</el-table>
<span v-if='singlePrice'><span class='priceTitle'>单价(): </span>{{ singlePrice }}</span>
<el-button
slot="reference"
type="text"
class="tableInnerButton"
@click="showInnerTable(injectData)"
>详情</el-button
>
</el-popover>
</template>
<script>
import { getEnergyType } from '@/api/base/energyType'
const temp1 = [
{
prop: 'startTime',
label: '开始时间'
},
{
prop: 'endTime',
label: '结束时间'
},
{
prop: 'price',
label: '单价(元)'
}
]
const temp2 = [
{
prop: 'startUsed',
label: '下限值'
},
{
prop: 'endUsed',
label: '上限值'
},
{
prop: 'price',
label: '单价(元)'
}
]
export default {
name: 'InnerTable',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData,
tableData: [],
tableProps: [],
singlePrice:'',
temp1,
temp2
}
},
methods: {
showInnerTable(data) {
let id = data.id
getEnergyType(id).then((res) => {
if (res.code === 0) {
console.log(res)
if (res.data.pricingMethod === 0) {
this.tableProps = this.temp1
this.tableData = res.data.segPriceList
this.singlePrice = ''
} else if (res.data.pricingMethod === 1) {
this.tableProps = this.temp2
this.tableData = res.data.usedPriceList
this.singlePrice = ''
} else {
this.tableProps = []
this.tableData = []
this.singlePrice = res.data.singlePrice
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
.tableInnerButton {
padding: 0;
}
.priceTitle {
color: #515A5E;
font-weight: bold;
margin-right: 10px;
}
</style>

View File

@ -0,0 +1,37 @@
<template>
<div class="tableInner">
<el-input-number v-model="list[itemProp]" @blur="changeInput" :min="0" :max="100000000" style="width: 100%" :controls='false'></el-input-number>
</div>
</template>
<script>
export default {
name: 'InputArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeInput() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style lang="scss">
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

View File

@ -0,0 +1,43 @@
<template>
<div class="tableInner">
<el-time-picker
v-model="list[itemProp]"
@blur="changeInput"
style="width: 100%"
format='HH:mm:ss'
value-format='HH:mm:ss'
></el-time-picker>
</div>
</template>
<script>
export default {
name: 'TimePickerArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeInput() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style lang="scss">
.tableInner .el-input--prefix .el-input__inner {
border: none;
padding-left: 30px;
height: 33px;
}
</style>

View File

@ -0,0 +1,332 @@
<template>
<el-form ref="form" :rules="rules" label-width="80px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="能源类型" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类型编码" prop="code">
<el-input v-model="form.code" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-select v-model="form.unit" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计价方式" prop="pricingMethod">
<el-select v-model="form.pricingMethod" placeholder="请选择" style="width: 100%;">
<el-option label="时间段" :value= '0' ></el-option>
<el-option label="使用量" :value= '1' ></el-option>
<el-option label="固定价位" :value= '2' ></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12" v-show="form.pricingMethod === 2">
<el-form-item label="单价(元)" prop="singlePrice">
<el-input v-model="form.singlePrice"></el-input>
</el-form-item>
</el-col>
<el-col :span="24" v-show="form.pricingMethod === 0">
<el-form-item label="时间段">
<base-table
:key='timeKye'
:table-props="tableProps1"
:table-data="tableData1"
:add-button-show="addButtonShow"
@emitButtonClick="emitButtonClick1"
@emitFun="inputChange1"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick1"
/>
</base-table>
</el-form-item>
</el-col>
<el-col :span="24" v-show="form.pricingMethod === 1">
<el-form-item label="使用量">
<base-table
:key='usedKye'
:table-props="tableProps2"
:table-data="tableData2"
:add-button-show="addButtonShow"
@emitButtonClick="emitButtonClick2"
@emitFun="inputChange2"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick2"
/>
</base-table>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="描述" prop="description">
<el-input v-model="form.description"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getEnergyType, updateEnergyType, createEnergyType, getEnergyTypeCode } from '@/api/base/energyType'
import inputArea from './InputArea.vue'
import timePickerArea from './TimePickerArea.vue'
const tableProps1 = [
{
prop: 'startTime',
label: '开始时间',
subcomponent: timePickerArea
},
{
prop: 'endTime',
label: '结束时间',
subcomponent: timePickerArea
},
{
prop: 'price',
label: '单价(元)',
subcomponent: inputArea
}
]
const tableProps2 = [
{
prop: 'startUsed',
label: '下限值',
// subcomponent: inputArea
},
{
prop: 'endUsed',
label: '上限量',
subcomponent: inputArea
},
{
prop: 'price',
label: '单价(元)',
subcomponent: inputArea
}
]
export default {
name: 'energyTypeAdd',
data() {
return {
form: {
id: '',
name: '',
code: '',
nuit: '',
pricingMethod: 1,
leaderName: ''
},
isEdit: false, //
rules: {
name: [{ required: true, message: '能源类型不能为空', trigger: 'blur' }]
},
timeKye: 0,
usedKye: 0,
tableProps1,
tableProps2,
tableData1: [],
tableData2: [],
tableBtn: [
{
type: 'delete',
name: '删除'
}
],
addButtonShow: '新增'
}
},
methods: {
init(id) {
if (id) {
this.isEdit = true
this.form.id = id
getEnergyType( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
switch(this.form.pricingMethod) {
case 0:
this.tableData1 = this.form.segPriceList
break;
case 1:
this.tableData2 = this.form.usedPriceList
break;
default:
}
}
})
} else {
this.isEdit = false
this.form.id = ''
getEnergyTypeCode().then((res) => {
this.form.code = res.data
})
}
},
//
inputChange1(val) {
this.tableData1[val._pageIndex - 1][val.prop] = val[val.prop]
if ((this.tableData1.length > val._pageIndex) && val.prop === 'endTime') {
this.tableData1[val._pageIndex].startTime = val[val.prop]
}
this.timeKye++
},
inputChange2(val) {
//
if (!!val.endUsed && (val.endUsed <= val.startUsed)) {
this.$modal.msgError('上限值不能等于或者小于下限值')
return false
}
this.tableData2[val._pageIndex - 1][val.prop] = val[val.prop]
if ((this.tableData2.length > val._pageIndex) && val.prop === 'endUsed') {
this.tableData2[val._pageIndex].startUsed = val[val.prop]
}
this.usedKye++
},
//
emitButtonClick1() {
let n = this.tableData1.length
if (n >=3) {
this.$modal.msgWarning('最多可添加3档计价')
return false
}
let obj = {}
obj.startTime = n === 0 ? '' : this.tableData1[n-1].endTime
obj.endTime = ''
obj.price = 0
this.tableData1.push(obj)
},
emitButtonClick2() {
let n = this.tableData2.length
if (n >=3) {
this.$modal.msgWarning('最多可添加3档计价')
return false
}
let obj = {}
obj.startUsed = n === 0 ? 0 : this.tableData2[n-1].endUsed
obj.endUsed = 0
obj.price = 0
this.tableData2.push(obj)
},
//
handleClick1(val) {
this.tableData1.splice(val.data._pageIndex - 1, 1)
this.timeKye++
},
handleClick2(val) {
this.tableData2.splice(val.data._pageIndex - 1, 1)
this.usedKye++
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
switch(this.form.pricingMethod) {
case 0://
if (this.tableData1.length === 0) {
this.$modal.msgError('时间段表格数据不能为空')
return false
} else {
this.tableData1.map(item => {
if (item.price <= 0) {
this.$modal.msgError('单价有误请检查,请检查')
return false
}
})
}
break;
case 1:// 使
if (this.tableData2.length === 0) {
this.$modal.msgError('使用量表格数据不能为空')
return false
} else {
this.tableData1.map(item => {
if (item.price <= 0) {
this.$modal.msgError('单价有误请检查,请检查')
return false
}
})
}
break;
default://
if (!this.form.singlePrice) {
this.$modal.msgError('单价有误请检查1请检查')
return false
}
}
if (this.isEdit) {
//
updateEnergyType({
id: this.form.id,
code: this.form.code,
name: this.form.name,
unit: this.form.unit,
pricingMethod: this.form.pricingMethod,
description: this.form.description,
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [],
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: []
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyType({
code: this.form.code,
name: this.form.name,
unit: this.form.unit,
pricingMethod: this.form.pricingMethod,
description: this.form.description,
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [],
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: []
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
this.isEdit = false
this.timeKye = 0
this.usedKye = 0
this.tableData1 = []
this.tableData2 = []
}
}
}
</script>

View File

@ -0,0 +1,217 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<energy-type-add ref="energyType" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyTypePage, deleteEnergyType, updateGroupTeam } from "@/api/base/energyType";
import { publicFormatter } from '@/utils/dict'
import InnerTable from './components/InnerTable'
import EnergyTypeAdd from './components/energyTypeAdd.vue'
const tableProps = [
{
prop: 'code',
label: '类型编码'
},
{
prop: 'name',
label: '能源类型'
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('energy_unit')
},
{
prop: 'pricingMethod',
label: '计价方式'
},
{
prop: 'price',
label: '价格(元)',
subcomponent: InnerTable
}
]
export default {
name: "GroupTeam",
components: { EnergyTypeAdd },
data() {
return {
formConfig: [
{
type: 'input',
label: '能源类型',
placeholder: '能源类型',
param: 'name'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-type:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-type:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
pricingMethodList: [
{value: 0,label: '分时间段计价'},
{value: 1,label: '分使用量计价'},
{value: 2,label: '单一计价'}
],
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
code: null
}
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name
this.queryParams.code = val.code
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyType.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyTypePage(this.queryParams).then(response => {
let arr = response.data.list || [];
arr&&arr.map(item => {
this.pricingMethodList.map(i => {
if (item.pricingMethod === i.value) {
item.pricingMethod = i.label
}
})
})
this.list = arr
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyType.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
},
handleCancel() {
this.$refs.energyType.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyType.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?').then(function() {
return deleteEnergyType(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

View File

@ -87,14 +87,14 @@ export default {
formConfig: [ formConfig: [
{ {
type: 'input', type: 'input',
label: '名称', label: '班次名称',
placeholder: '名称', placeholder: '班次名称',
param: 'name' param: 'name'
}, },
{ {
type: 'input', type: 'input',
label: '编码', label: '班次编码',
placeholder: '编码', placeholder: '班次编码',
param: 'code' param: 'code'
}, },
{ {

View File

@ -1,120 +1,233 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <SearchBar
<el-form-item> :formConfigs="searchBarFormConfig"
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> ref="search-bar"
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> @headBtnClick="handleSearchBarBtnClick" />
</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="['base:quality-inspection-box-btn:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:quality-inspection-box-btn:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <base-table
<el-table-column label="ID" align="center" prop="id" /> :table-props="tableProps"
<el-table-column label="该按钮绑定的检测内容id" align="center" prop="inspectionDetId" /> :page="queryParams.pageNo"
<el-table-column label="检测内容设备推送消息时可能无对应id只填这个字段" align="center" prop="inspectionDetContent" /> :limit="queryParams.pageSize"
<el-table-column label="按钮盒所在产线id" align="center" prop="productionId" /> :table-data="list"
<el-table-column label="按钮盒所在工段id" align="center" prop="sectionId" /> @emit-fun="handleEmitFun">
<el-table-column label="按钮盒模式" align="center" prop="model" /> <method-btn
<el-table-column label="按钮值" align="center" prop="keyValue" /> v-if="tableBtn.length"
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> slot="handleBtn"
<template v-slot="scope"> label="操作"
<span>{{ parseTime(scope.row.createTime) }}</span> fixed="right"
</template> :method-list="tableBtn"
</el-table-column> @clickBtn="handleTableBtnClick" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> </base-table>
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['base:quality-inspection-box-btn:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:quality-inspection-box-btn:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" /> @pagination="getList" />
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> <base-dialog
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> :dialogTitle="title"
<el-form-item label="该按钮绑定的检测内容id" prop="inspectionDetId"> :dialogVisible="open"
<el-input v-model="form.inspectionDetId" placeholder="请输入该按钮绑定的检测内容id" /> width="50%"
</el-form-item> @close="cancel"
<el-form-item label="检测内容设备推送消息时可能无对应id只填这个字段" prop="inspectionDetContent"> @cancel="cancel"
<el-input v-model="form.inspectionDetContent" type="textarea" placeholder="请输入内容" /> @confirm="submitForm">
</el-form-item> <DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
<el-form-item label="按钮盒所在产线id" prop="productionId"> </base-dialog>
<el-input v-model="form.productionId" placeholder="请输入按钮盒所在产线id" />
</el-form-item>
<el-form-item label="按钮盒所在工段id" prop="sectionId">
<el-input v-model="form.sectionId" placeholder="请输入按钮盒所在工段id" />
</el-form-item>
<el-form-item label="按钮盒模式" prop="model">
<el-input v-model="form.model" placeholder="请输入按钮盒模式" />
</el-form-item>
<el-form-item label="按钮值" prop="keyValue">
<el-input v-model="form.keyValue" placeholder="请输入按钮值" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createQualityInspectionBoxBtn, updateQualityInspectionBoxBtn, deleteQualityInspectionBoxBtn, getQualityInspectionBoxBtn, getQualityInspectionBoxBtnPage, exportQualityInspectionBoxBtnExcel } from "@/api/base/qualityInspectionBoxBtn"; import {
createQualityInspectionBoxBtn,
updateQualityInspectionBoxBtn,
deleteQualityInspectionBoxBtn,
getQualityInspectionBoxBtn,
getQualityInspectionBoxBtnPage,
exportQualityInspectionBoxBtnExcel,
} from '@/api/base/qualityInspectionBoxBtn';
import basicPageMixin from '../../mixin/basicPageMixin';
import moment from 'moment';
export default { export default {
name: "QualityInspectionBoxBtn", name: 'QualityInspectionBoxBtn',
components: { mixins: [basicPageMixin],
}, components: {},
data() { data() {
return { return {
// rows: [
loading: true, [
// {
exportLoading: false, select: true,
// label: '产线',
showSearch: true, url: '/base/production-line/listAll',
// prop: 'productionId',
total: 0, rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
// 16 bind: {
list: [], filterable: true,
// },
title: "", },
// ],
open: false, [
{
select: true,
label: '工段',
url: '/base/workshop-section/listAll',
prop: 'sectionId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '按钮盒识别码',
prop: 'buttonId',
rules: [
{
type: 'number',
message: '请输入数字',
trigger: 'blur',
transform: (val) => Number(val),
},
],
},
],
[{ input: true, label: '按钮盒模式', prop: 'model' }],
[
{
input: true,
label: '按钮值',
prop: 'keyValue',
rules: [
{
type: 'number',
message: '请输入100以内的数字',
trigger: 'blur',
transform: (val) => Number(val) <= 100 && Number(val),
},
],
bind: { type: 'number', min: 0, max: 100 },
},
],
[
{
textarea: true,
label: '检测内容',
prop: 'inspectionDetContent',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
],
searchBarFormConfig: [
{
type: 'input',
label: '检查内容',
placeholder: '请输入检查内容',
param: 'inspectionDetContent',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-inspection-box-btn:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
],
tableBtn: [
this.$auth.hasPermi('base:quality-inspection-box-btn:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:quality-inspection-box-btn:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{
width: 128,
prop: 'productionName',
label: '产线',
align: 'center',
},
{
width: 128,
prop: 'sectionName',
label: '工段',
align: 'center',
},
{
width: 128,
prop: 'inspectionDetContent',
label: '检测内容',
align: 'center',
},
{
width: 160,
prop: 'buttonId',
label: '按钮盒识别码',
align: 'center',
},
// {
// width: 256,
// prop: 'productionId',
// label: '线ID',
// align: 'center',
// },
// {
// width: 256,
// prop: 'sectionId',
// label: 'ID',
// align: 'center',
// },
{ width: 90, prop: 'keyValue', label: '按钮值', align: 'center' },
{ width: 128, prop: 'model', label: '按钮盒模式', align: 'center' },
],
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
inspectionDetContent: null, inspectionDetContent: null,
}, },
// // keys, queryParams pageNo, pageSize key
form: {}, searchBarKeys: ['inspectionDetContent'],
// form: {
rules: { id: undefined,
productionId: [{ required: true, message: "按钮盒所在产线id不能为空", trigger: "blur" }], inspectionDetId: undefined,
sectionId: [{ required: true, message: "按钮盒所在工段id不能为空", trigger: "blur" }], inspectionDetContent: undefined,
} productionId: undefined,
sectionId: undefined,
model: undefined,
keyValue: undefined,
},
}; };
}, },
created() { created() {
@ -125,17 +238,12 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
// //
getQualityInspectionBoxBtnPage(this.queryParams).then(response => { getQualityInspectionBoxBtnPage(this.queryParams).then((response) => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
@ -147,52 +255,42 @@ export default {
model: undefined, model: undefined,
keyValue: undefined, keyValue: undefined,
}; };
this.resetForm("form"); this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加安灯按钮16键对应"; this.title = '添加安灯按钮16键对应';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id; const id = row.id;
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 = '修改安灯按钮16键对应';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate((valid) => {
if (!valid) { if (!valid) {
return; return;
} }
// //
if (this.form.id != null) { if (this.form.id != null) {
updateQualityInspectionBoxBtn(this.form).then(response => { updateQualityInspectionBoxBtn(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
return; return;
} }
// //
createQualityInspectionBoxBtn(this.form).then(response => { createQualityInspectionBoxBtn(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
@ -201,12 +299,16 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal.confirm('是否确认删除安灯按钮16键对应编号为"' + id + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除安灯按钮16键对应编号为"' + id + '"的数据项?')
.then(function () {
return deleteQualityInspectionBoxBtn(id); return deleteQualityInspectionBoxBtn(id);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -214,14 +316,18 @@ export default {
let params = { ...this.queryParams }; let params = { ...this.queryParams };
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有安灯按钮16键对应数据项?').then(() => { this.$modal
.confirm('是否确认导出所有安灯按钮16键对应数据项?')
.then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportQualityInspectionBoxBtnExcel(params); return exportQualityInspectionBoxBtnExcel(params);
}).then(response => { })
.then((response) => {
this.$download.excel(response, '安灯按钮16键对应.xls'); this.$download.excel(response, '安灯按钮16键对应.xls');
this.exportLoading = false; this.exportLoading = false;
}).catch(() => {}); })
} .catch(() => {});
} },
},
}; };
</script> </script>

View File

@ -1,108 +1,182 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <SearchBar
<el-form-item label="检测内容" prop="content"> :formConfigs="searchBarFormConfig"
<el-input v-model="queryParams.content" placeholder="请输入检测内容" clearable @keyup.enter.native="handleQuery"/> ref="search-bar"
</el-form-item> @headBtnClick="handleSearchBarBtnClick" />
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</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="['base:quality-inspection-det:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:quality-inspection-det:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <base-table
<el-table-column label="ID" align="center" prop="id" /> :table-props="tableProps"
<el-table-column label="检测类型id" align="center" prop="typeId" /> :page="queryParams.pageNo"
<el-table-column label="检测内容" align="center" prop="content" /> :limit="queryParams.pageSize"
<el-table-column label="检测编码" align="center" prop="code" /> :table-data="list"
<el-table-column label="备注" align="center" prop="remark" /> @emit-fun="handleEmitFun">
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <method-btn
<template v-slot="scope"> v-if="tableBtn.length"
<span>{{ parseTime(scope.row.createTime) }}</span> slot="handleBtn"
</template> label="操作"
</el-table-column> fixed="right"
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> :method-list="tableBtn"
<template v-slot="scope"> @clickBtn="handleTableBtnClick" />
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" </base-table>
v-hasPermi="['base:quality-inspection-det:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:quality-inspection-det:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" /> @pagination="getList" />
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> <base-dialog
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> :dialogTitle="title"
<el-form-item label="检测类型id" prop="typeId"> :dialogVisible="open"
<el-select v-model="form.typeId" placeholder="请选择检测类型id"> width="40%"
<el-option label="请选择字典生成" value="" /> @close="cancel"
</el-select> @cancel="cancel"
</el-form-item> @confirm="submitForm">
<el-form-item label="检测内容" prop="content"> <DialogForm
<el-input v-model="form.content" placeholder="请输入检测内容" /> v-if="open"
</el-form-item> ref="form"
<el-form-item label="检测编码" prop="code"> :dataForm="form"
<el-input v-model="form.code" placeholder="请输入检测编码" /> :rows="[
</el-form-item> [
<el-form-item label="备注" prop="remark"> {
<el-input v-model="form.remark" placeholder="请输入备注" /> select: true,
</el-form-item> label: '检测类型',
</el-form> prop: 'typeId',
<div slot="footer" class="dialog-footer"> url: '/base/quality-inspection-type/listAll',
<el-button type="primary" @click="submitForm"> </el-button> rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
<el-button @click="cancel"> </el-button> bind: {
</div> filterable: true,
</el-dialog> },
},
],
[
{
input: true,
label: '检测内容',
prop: 'content',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '内容编码',
prop: 'code',
url: '/base/quality-inspection-det/getCode',
},
],
[{ input: true, label: '备注', prop: 'remark' }],
]" />
</base-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createQualityInspectionDet, updateQualityInspectionDet, deleteQualityInspectionDet, getQualityInspectionDet, getQualityInspectionDetPage, exportQualityInspectionDetExcel } from "@/api/base/qualityInspectionDet"; import {
createQualityInspectionDet,
updateQualityInspectionDet,
deleteQualityInspectionDet,
getQualityInspectionDet,
getQualityInspectionDetPage,
exportQualityInspectionDetExcel,
} from '@/api/base/qualityInspectionDet';
import moment from 'moment';
import basicPageMixin from '../../mixin/basicPageMixin';
export default { export default {
name: "QualityInspectionDet", name: 'QualityInspectionDet',
components: { mixins: [basicPageMixin],
},
data() { data() {
return { return {
// typeList: [], //
loading: true, searchBarFormConfig: [
// {
exportLoading: false, type: 'input',
// label: '检测内容',
showSearch: true, placeholder: '请输入检测内容',
// param: 'content',
total: 0, },
// // {
list: [], // type: 'datePicker',
// // label: '',
title: "", // dateType: 'daterange', // datetimerange
// // // format: 'yyyy-MM-dd HH:mm:ss',
open: false, // format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// defaultTime: ['00:00:00', '23:59:59'],
// param: 'createTime',
// width: 350,
// },
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-inspection-det:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:quality-inspection-type:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
tableBtn: [
this.$auth.hasPermi('base:quality-inspection-det:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:quality-inspection-det:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'typeName', label: '类型名称', align: 'center' },
{ prop: 'content', label: '检测内容', align: 'center' },
{ prop: 'code', label: '检测编码', align: 'center' },
{ prop: 'remark', label: '备注', align: 'center' },
],
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
@ -110,34 +184,43 @@ export default {
content: null, content: null,
createTime: [], createTime: [],
}, },
// // keys, queryParams pageNo, pageSize key
form: {}, searchBarKeys: ['content', 'createTime'],
// form: {
rules: { id: undefined,
typeId: [{ required: true, message: "检测类型id不能为空", trigger: "change" }], typeId: undefined,
content: [{ required: true, message: "检测内容不能为空", trigger: "blur" }], content: undefined,
} code: undefined,
remark: undefined,
},
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getTypeList();
}, },
methods: { methods: {
/** 获取检测类型id */
getTypeList() {
this.$axios('/base/quality-inspection-type/listAll').then((response) => {
this.typeList = response.data.map((item) => {
return {
label: item.name,
value: item.id,
};
});
});
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
// //
getQualityInspectionDetPage(this.queryParams).then(response => { getQualityInspectionDetPage(this.queryParams).then((response) => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
@ -147,52 +230,42 @@ export default {
code: undefined, code: undefined,
remark: undefined, remark: undefined,
}; };
this.resetForm("form"); this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加质量检测信息基础"; this.title = '添加质量检测信息';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id; const id = row.id;
getQualityInspectionDet(id).then(response => { getQualityInspectionDet(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改质量检测信息基础"; this.title = '修改质量检测信息';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate((valid) => {
if (!valid) { if (!valid) {
return; return;
} }
// //
if (this.form.id != null) { if (this.form.id != null) {
updateQualityInspectionDet(this.form).then(response => { updateQualityInspectionDet(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
return; return;
} }
// //
createQualityInspectionDet(this.form).then(response => { createQualityInspectionDet(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
@ -201,12 +274,16 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal.confirm('是否确认删除质量检测信息基础编号为"' + id + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除质量检测信息基础编号为"' + id + '"的数据项?')
.then(function () {
return deleteQualityInspectionDet(id); return deleteQualityInspectionDet(id);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -214,14 +291,24 @@ export default {
let params = { ...this.queryParams }; let params = { ...this.queryParams };
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有质量检测信息基础数据项?').then(() => { this.$modal
.confirm('是否确认导出所有质量检测信息基础数据项?')
.then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportQualityInspectionDetExcel(params); return exportQualityInspectionDetExcel(params);
}).then(response => { })
.then((response) => {
this.$download.excel(response, '质量检测信息基础.xls'); this.$download.excel(response, '质量检测信息基础.xls');
this.exportLoading = false; this.exportLoading = false;
}).catch(() => {}); })
} .catch(() => {});
} },
},
}; };
</script> </script>
<style>
.el-select {
width: 100% !important;
}
</style>

View File

@ -1,96 +1,203 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <SearchBar
<el-form-item label="检测类型名称" prop="name"> :formConfigs="searchBarFormConfig"
<el-input v-model="queryParams.name" placeholder="请输入检测类型名称" clearable @keyup.enter.native="handleQuery"/> ref="search-bar"
</el-form-item> @headBtnClick="handleSearchBarBtnClick" />
<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="['base:quality-inspection-type:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:quality-inspection-type:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <base-table
<el-table-column label="ID" align="center" prop="id" /> :table-props="tableProps"
<el-table-column label="检测类型名称" align="center" prop="name" /> :page="queryParams.pageNo"
<el-table-column label="检测类型编码" align="center" prop="code" /> :limit="queryParams.pageSize"
<el-table-column label="备注" align="center" prop="remark" /> :table-data="list"
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> @emit-fun="handleEmitFun">
<template v-slot="scope"> <method-btn
<span>{{ parseTime(scope.row.createTime) }}</span> v-if="tableBtn.length"
</template> slot="handleBtn"
</el-table-column> label="操作"
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> :method-list="tableBtn"
<template v-slot="scope"> @clickBtn="handleTableBtnClick" />
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" </base-table>
v-hasPermi="['base:quality-inspection-type:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:quality-inspection-type:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" /> @pagination="getList" />
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> <base-dialog
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> :dialogTitle="title"
<el-form-item label="检测类型名称" prop="name"> :dialogVisible="open"
<el-input v-model="form.name" placeholder="请输入检测类型名称" /> @close="cancel"
</el-form-item> @cancel="cancel"
<el-form-item label="检测类型编码" prop="code"> @confirm="submitForm">
<el-input v-model="form.code" placeholder="请输入检测类型编码" /> <DialogForm
</el-form-item> v-if="open"
<el-form-item label="备注" prop="remark"> ref="form"
<el-input v-model="form.remark" placeholder="请输入备注" /> :dataForm="form"
</el-form-item> :rows="[
</el-form> [
<div slot="footer" class="dialog-footer"> {
<el-button type="primary" @click="submitForm"> </el-button> input: true,
<el-button @click="cancel"> </el-button> label: '检测类型名称',
</div> prop: 'name',
</el-dialog> rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
],
[
{
input: true,
label: '检测类型编码',
prop: 'code',
url: '/base/quality-inspection-type/getCode',
},
],
[{ input: true, label: '备注', prop: 'remark' }],
]" />
</base-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createQualityInspectionType, updateQualityInspectionType, deleteQualityInspectionType, getQualityInspectionType, getQualityInspectionTypePage, exportQualityInspectionTypeExcel } from "@/api/base/qualityInspectionType"; import moment from 'moment';
import {
createQualityInspectionType,
updateQualityInspectionType,
deleteQualityInspectionType,
getQualityInspectionType,
getQualityInspectionTypePage,
exportQualityInspectionTypeExcel,
} from '@/api/base/qualityInspectionType';
import basicPageMixin from '../../mixin/basicPageMixin';
export default { export default {
name: "QualityInspectionType", name: 'QualityInspectionType',
components: { mixins: [basicPageMixin],
},
data() { data() {
return { return {
// tableBtn: [
loading: true, this.$auth.hasPermi('base:quality-inspection-type:update')
// ? {
exportLoading: false, type: 'edit',
// btnName: '修改',
showSearch: true, }
// : undefined,
total: 0, this.$auth.hasPermi('base:quality-inspection-type:delete')
// ? {
list: [], type: 'delete',
// btnName: '删除',
title: "", }
: undefined,
].filter((v) => v),
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'name', label: '检测类型名称', align: 'center' },
{ prop: 'code', label: '检测类型编码', align: 'center' },
{ prop: 'remark', label: '备注', align: 'center' },
// {
// label: '',
// alignt: 'center',
// subcomponent: {
// render: function (h) {
// return h('div', null, [
// h(
// 'el-button',
// {
// props: {
// icon: 'el-icon-edit',
// size: 'mini',
// type: 'text',
// },
// },
// ' '
// ),
// h(
// 'el-button',
// {
// props: {
// icon: 'el-icon-edit',
// size: 'mini',
// type: 'text',
// },
// },
// ' '
// ),
// ]);
// },
// },
// },
],
//
searchBarFormConfig: [
{
type: 'input',
label: '检测类型',
placeholder: '请输入检测类型',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:quality-inspection-type:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:quality-inspection-type:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
//
// formRows: [
// [
// {
// input: true,
// label: '',
// prop: 'name',
// rules: [{ required: true, message: '', trigger: 'blur' }],
// // bind: {
// // disabled: true, // some condition, like detail mode...
// // }
// },
// ],
// [{ input: true, label: '', prop: 'code' }],
// [{ input: true, label: '', prop: 'remark' }],
// ],
// //
open: false, open: false,
// //
@ -101,31 +208,63 @@ export default {
}, },
// //
form: {}, form: {},
//
rules: {
name: [{ required: true, message: "检测类型名称不能为空", trigger: "blur" }],
}
}; };
}, },
// watch: {
// form: {
// handler: (val) => {
// console.log('form changed', val);
// },
// deep: true
// },
// },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
/** base table related */
handleTableBtnClick({ data, type }) {
switch (type) {
case 'edit':
this.handleUpdate(data);
break;
case 'delete':
this.handleDelete(data);
break;
}
},
/** search bar related */
handleSearchBarBtnClick(btn) {
const keys = ['name'];
switch (btn.btnName) {
case 'search':
keys.forEach((key) => {
this.queryParams[key] = btn[key] || null;
});
this.handleQuery();
break;
case 'add':
this.handleAdd();
break;
case 'export':
this.handleExport();
break;
case 'reset':
this.$refs['search-bar'].resetForm();
this.resetQuery();
break;
}
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
// //
getQualityInspectionTypePage(this.queryParams).then(response => { getQualityInspectionTypePage(this.queryParams).then((response) => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
@ -134,52 +273,45 @@ export default {
code: undefined, code: undefined,
remark: undefined, remark: undefined,
}; };
this.resetForm("form"); this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加质量检测类型基础"; this.title = '添加质量检测类型基础';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id; const id = row.id;
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 = '修改质量检测类型基础';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { // console.log('this.$refs.form', this.$refs.form);
// return;
this.$refs['form'].validate((valid) => {
if (!valid) { if (!valid) {
return; return;
} }
console.log('final form', JSON.stringify(this.form));
// //
if (this.form.id != null) { if (this.form.id != null) {
updateQualityInspectionType(this.form).then(response => { updateQualityInspectionType(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
return; return;
} }
// //
createQualityInspectionType(this.form).then(response => { createQualityInspectionType(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
@ -188,12 +320,16 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal.confirm('是否确认删除质量检测类型基础编号为"' + id + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除质量检测类型基础编号为"' + id + '"的数据项?')
.then(function () {
return deleteQualityInspectionType(id); return deleteQualityInspectionType(id);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -201,14 +337,18 @@ export default {
let params = { ...this.queryParams }; let params = { ...this.queryParams };
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有质量检测类型基础数据项?').then(() => { this.$modal
.confirm('是否确认导出所有质量检测类型基础数据项?')
.then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportQualityInspectionTypeExcel(params); return exportQualityInspectionTypeExcel(params);
}).then(response => { })
.then((response) => {
this.$download.excel(response, '质量检测类型基础.xls'); this.$download.excel(response, '质量检测类型基础.xls');
this.exportLoading = false; this.exportLoading = false;
}).catch(() => {}); })
} .catch(() => {});
} },
},
}; };
</script> </script>

View File

@ -0,0 +1,208 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-08-02 10:32:36
description: 弹窗的表单组件
-->
<template>
<el-form
ref="form"
:model="form"
:label-width="`${labelWidth}px`"
v-loading="formLoading">
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
<el-input
v-if="col.input"
v-model="form[col.prop]"
@change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
v-bind="col.bind" />
<el-input
v-if="col.textarea"
type="textarea"
v-model="form[col.prop]"
@change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
v-bind="col.bind" />
<el-select
v-if="col.select"
v-model="form[col.prop]"
:placeholder="`请选择${col.label}`"
@change="$emit('update', form)"
v-bind="col.bind">
<el-option
v-for="opt in optionListOf[col.prop]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
<el-date-picker
v-if="col.datetime"
v-model="form[col.prop]"
type="datetime"
:placeholder="`请选择${col.label}`"
v-bind="col.bind"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
/**
* 找到最长的label
* @param {*} options
*/
function findMaxLabelWidth(rows) {
let max = 0;
rows.forEach((row) => {
row.forEach((opt) => {
if (opt.label.length > max) {
max = opt.label.length;
}
});
});
return max;
}
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: {},
props: {
rows: {
type: Array,
default: () => [],
},
dataForm: {
type: Object,
default: () => ({}),
},
},
data() {
return {
formLoading: true,
optionListOf: {},
};
},
computed: {
labelWidth() {
let max = findMaxLabelWidth(this.rows);
// 20px
return max * 20;
// return max * 20 + 'px';
},
form: {
get() {
return this.dataForm;
},
set(val) {
console.log('set form', val);
},
},
},
watch: {
rows: {
handler() {
console.log('watch triggered!');
this.$nextTick(() => {
this.handleOptions('watch');
});
},
deep: true,
immediate: false,
},
},
mounted() {
// options
this.handleOptions();
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
async handleOptions(trigger = 'monuted') {
// console.log("[dialogForm:handleOptions]")
const promiseList = [];
this.rows.forEach((cols) => {
cols.forEach((opt) => {
if (opt.value && !this.form[opt.prop]) {
//
this.form[opt.prop] = opt.value;
}
if (opt.options) {
this.$set(this.optionListOf, opt.prop, opt.options);
} else if (opt.url) {
//
if (opt.select || (opt.input && !this.form?.id)) {
promiseList.push(async () => {
const response = await this.$axios(opt.url, {
method: opt.method ?? 'get',
});
console.log('[dialogForm:handleOptions:response]', response);
if (opt.select) {
//
const list =
'list' in response.data
? response.data.list
: response.data;
this.$set(
this.optionListOf,
opt.prop,
list.map((item) => ({
label: item[opt.labelKey ?? 'name'],
value: item[opt.valueKey ?? 'id'],
}))
);
} else if (opt.input) {
//
this.form[opt.prop] = response.data;
}
});
}
}
});
});
// watch
if (trigger == 'watch') {
this.formLoading = false;
return;
}
try {
await Promise.all(promiseList.map((fn) => fn()));
this.formLoading = false;
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
} catch (error) {
console.log('[dialogForm:handleOptions:error]', error);
this.formLoading = false;
}
if (!promiseList.length) this.formLoading = false;
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
</style>

View File

@ -0,0 +1,109 @@
import DialogForm from '../components/dialogForm.vue';
export default {
components: { DialogForm },
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 质量检测信息基础列表
list: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 列表数据
tableData: [],
// 弹窗的表单
// form: {}, // 占位
// 搜索框需要的 keys
// searchBarKeys: [], // 占位
// tableProps: [], // 占位
// tableBtn: [], // 占位
// searchBarFormConfig: [], // 占位
// // 弹窗表单配置
// dialogFormConfig: [], // 占位
};
},
mounted() {},
methods: {
// 过滤后端传回的详情数据
filterData(data, keys) {
const obj = {};
keys.forEach((key) => {
if (/time/i.test(key)) {
obj[key] = new Date(data[key]);
} else {
obj[key] = data[key];
}
});
return obj;
},
// 处理搜索条件
handleSearchBarBtnClick() {},
// 处理表格按钮
handleTableBtnClick({ data, type }) {
switch (type) {
case 'edit':
this.handleUpdate(data);
break;
case 'delete':
this.handleDelete(data);
break;
}
},
// 处理搜索栏按钮
handleSearchBarBtnClick(btn) {
// const keys = ['name', 'createTime']; // timeVal // 已被 searchBarKeys 替代
switch (btn.btnName) {
case 'search':
this.searchBarKeys.forEach((key) => {
if (key == 'timeVal') {
this.queryParams['startTime'] = btn.timeVal[0];
this.queryParams['endTime'] = btn.timeVal[1];
return;
}
this.queryParams[key] = btn[key] || null;
});
this.handleQuery();
break;
case 'add':
this.handleAdd();
break;
case 'export':
this.handleExport();
break;
case 'reset':
this.$refs['search-bar'].resetForm();
this.resetQuery();
break;
}
},
handleEmitFun(val) {
console.log('emit unf', val);
},
// 获取列表数据
getList() {},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
},
};

View File

@ -0,0 +1,427 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emit-fun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
fixed="right"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="50%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
</base-dialog>
</div>
</template>
<script>
import {
createQualityInspectionRecord,
updateQualityInspectionRecord,
deleteQualityInspectionRecord,
getQualityInspectionRecord,
getQualityInspectionRecordPage,
exportQualityInspectionRecordExcel,
} from '@/api/monitoring/qualityInspectionRecord';
import Editor from '@/components/Editor';
import moment from 'moment';
import basicPageMixin from '../../mixin/basicPageMixin';
export default {
name: 'QualityInspectionRecord',
components: {
Editor,
},
mixins: [basicPageMixin],
data() {
return {
rows: [
[
{
select: true,
label: '检测内容ID',
url: '/base/quality-inspection-det/listAll',
prop: 'inspectionDetId',
labelKey: 'content',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
{
select: true,
label: '来源',
prop: 'source',
value: 1, //
options: [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
],
bind: {
filterable: true,
},
},
],
[
{
select: true,
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionLineId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
{
select: true,
label: '工段',
url: '/base/workshop-section/listAll', // url options
options: [], // options, options
prop: 'sectionId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '检测人员',
prop: 'checkPerson',
},
{
datetime: true,
label: '检测时间',
prop: 'checkTime',
bind: {
format: 'yyyy-MM-dd HH:mm:ss',
'value-format': 'timestamp',
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
clearable: true,
},
},
],
[
{
textarea: true,
label: '检测内容',
prop: 'inspectionDetContent',
value: '',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[{ textarea: true, label: '描述', prop: 'explainText' }],
[{ input: true, label: '备注', prop: 'remark' }],
],
searchBarFormConfig: [
{
type: 'select',
label: '产线',
placeholder: '请选择产线',
param: 'productionLineId',
selectOptions: [],
},
{
type: 'input',
label: '检测内容',
placeholder: '请输入检测内容',
param: 'inspectionDetContent',
},
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'checkTime',
// width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi(
'monitoring:quality-inspection-record:create'
)
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
],
tableBtn: [
this.$auth.hasPermi('monitoring:quality-inspection-record:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('monitoring:quality-inspection-record:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{
width: 128,
prop: 'inspectionDetContent',
label: '检测内容',
align: 'center',
},
{
// width: 128,
prop: 'lineName',
label: '产线',
align: 'center',
},
{
// width: 128,
prop: 'checkPerson',
label: '检测人员',
align: 'center',
},
{
// width: 160,
prop: 'checkTime',
label: '检测时间',
align: 'center',
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{
width: 90,
prop: 'source',
label: '来源',
align: 'center',
filter: (val) => ['未知', '手动', '自动'][val],
},
],
// keys, queryParams pageNo, pageSize key
searchBarKeys: ['inspectionDetContent', 'checkTime', 'productionLineId'],
form: {
id: undefined,
inspectionDetId: undefined,
inspectionDetContent: undefined,
productionLineId: undefined,
sectionId: undefined,
checkPerson: undefined,
checkTime: undefined,
source: undefined,
explainText: undefined,
remark: undefined,
},
//
queryParams: {
pageNo: 1,
pageSize: 10,
inspectionDetContent: null,
checkTime: [],
productionLineId: null,
},
};
},
created() {
this.getList();
this.getProductLineList();
},
watch: {
// 线
'form.productionLineId': {
handler: function (val) {
if (val == null) return;
this.$axios('/base/workshop-section/listByParentId', {
params: {
id: val,
},
}).then((response) => {
this.$set(
this.rows[1][1], // this.rows
'options',
response.data.map((item) => {
return {
label: item.name,
value: item.id,
};
})
);
});
},
immediate: true,
},
},
methods: {
/** 获取搜索栏的产线列表 */
getProductLineList() {
this.$axios('/base/production-line/listAll').then((response) => {
this.searchBarFormConfig[0].selectOptions = response.data.map(
(item) => {
return {
name: item.name,
id: item.id,
};
}
);
});
},
/** 查询列表 */
getList() {
this.loading = true;
//
getQualityInspectionRecordPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
inspectionDetId: undefined,
inspectionDetContent: undefined,
sectionId: undefined,
checkPerson: undefined,
checkTime: undefined,
source: undefined,
explainText: undefined,
remark: undefined,
productionLineId: undefined,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加质量检查信息记录表';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getQualityInspectionRecord(id).then((response) => {
/** 因为后端返回的时间是时间戳格式,需转换 */
this.form = this.filterData(response.data, Object.keys(this.form));
this.open = true;
this.title = '修改质量检查信息记录表';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateQualityInspectionRecord(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createQualityInspectionRecord(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除质量检查信息记录表编号为"' + id + '"的数据项?')
.then(function () {
return deleteQualityInspectionRecord(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有质量检查信息记录表数据项?')
.then(() => {
this.exportLoading = true;
return exportQualityInspectionRecordExcel(params);
})
.then((response) => {
this.$download.excel(response, '质量检查信息记录表.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>

View File

@ -6842,6 +6842,11 @@ moddle@^5.0.2:
dependencies: dependencies:
min-dash "^3.0.0" min-dash "^3.0.0"
moment@^2.29.4:
version "2.29.4"
resolved "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
move-concurrently@^1.0.1: move-concurrently@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.npmmirror.com/move-concurrently/-/move-concurrently-1.0.1.tgz" resolved "https://registry.npmmirror.com/move-concurrently/-/move-concurrently-1.0.1.tgz"