更新生产管理-生产基础

This commit is contained in:
朱文强 2023-08-03 15:27:39 +08:00
parent a49db190e3
commit 4350bafa23
22 changed files with 2370 additions and 1605 deletions

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

@ -8,6 +8,13 @@ export function createProductionLine(data) {
data: data data: data
}) })
} }
// 获得产线code
export function getCode() {
return request({
url: '/base/production-line/getCode',
method: 'get'
})
}
// 更新工厂产线 // 更新工厂产线
export function updateProductionLine(data) { export function updateProductionLine(data) {

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,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,202 @@
<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" /> </div>
<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>
</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() {
}, return {
data() { urlOptions: {
return { getDataListURL: getFactoryPage,
// deleteURL: deleteFactory,
loading: true, exportURL: exportFactoryExcel,
// },
exportLoading: false, tableProps,
// tableBtn: [
showSearch: true, this.$auth.hasPermi(`base:factory:update`)
// ? {
total: 0, type: 'edit',
// btnName: '编辑',
list: [], }
// : undefined,
title: "", this.$auth.hasPermi(`base:factory:delete`)
// ? {
open: false, type: 'delete',
// btnName: '删除',
queryParams: { }
pageNo: 1, : undefined,
pageSize: 10, ].filter((v)=>v),
code: null, tableData: [],
name: null, formConfig: [
createTime: [], {
}, type: 'input',
// label: '工厂编码',
form: {}, placeholder: '工厂编码',
// param: 'code',
rules: { },
code: [{ required: true, message: "工厂编码不能为空", trigger: "blur" }], {
name: [{ required: true, message: "工厂名称不能为空", trigger: "blur" }], type: 'input',
enabled: [{ required: true, message: "启用状态:0 、停用1、启用不能为空", trigger: "change" }], label: '工厂名称',
externalCode: [{ required: true, message: "外部系统编码不能为空", trigger: "blur" }], placeholder: '工厂名称',
} param: 'name',
}; },
}, {
created() { type: 'datePicker',
this.getList(); label: '创建时间',
}, dateType: 'daterange',
methods: { format: 'yyyy-MM-dd',
/** 查询列表 */ valueFormat: 'yyyy-MM-dd HH:mm:ss',
getList() { rangeSeparator: '-',
this.loading = true; startPlaceholder: '开始时间',
// endPlaceholder: '结束时间',
getFactoryPage(this.queryParams).then(response => { param: 'createTime',
this.list = response.data.list; },
this.total = response.data.total; {
this.loading = false; type: 'button',
}); btnName: '搜索',
}, name: 'search',
/** 取消按钮 */ color: 'primary',
cancel() { },
this.open = false; {
this.reset(); type: 'separate',
}, },
/** 表单重置 */ {
reset() { type: 'button',
this.form = { btnName: '重置',
id: undefined, name: 'reset',
code: undefined, },
name: undefined, {
address: undefined, type: 'separate',
description: undefined, },
enabled: undefined, {
remark: undefined, type: this.$auth.hasPermi('base:factory:create') ? 'button' : '',
version: undefined, btnName: '新增',
externalCode: undefined, name: 'add',
}; color: 'success',
this.resetForm("form"); plain: true,
}, },
/** 搜索按钮操作 */ // {
handleQuery() { // type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '',
this.queryParams.pageNo = 1; // },
this.getList(); // {
}, // type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
/** 重置按钮操作 */ // btnName: '',
resetQuery() { // name: 'export',
this.resetForm("queryForm"); // color: 'warning',
this.handleQuery(); // },
}, ],
/** 新增按钮操作 */ };
handleAdd() { },
this.reset(); components: {
this.open = true; AddOrUpdate,
this.title = "添加工厂"; },
}, created() {},
/** 修改按钮操作 */ methods: {
handleUpdate(row) { buttonClick(val) {
this.reset(); switch (val.btnName) {
const id = row.id; case 'search':
getFactory(id).then(response => { this.listQuery.pageNo = 1;
this.form = response.data; this.listQuery.pageSize = 10;
this.open = true; this.listQuery.name = val.name;
this.title = "修改工厂"; this.listQuery.code = val.code;
}); this.listQuery.createTime = val.createTime;
}, this.getDataList();
/** 提交按钮 */ break;
submitForm() { case 'reset':
this.$refs["form"].validate(valid => { this.$refs.searchBarForm.resetForm();
if (!valid) { this.listQuery = {
return; pageSize: 10,
} pageNo: 1,
// total: 1,
if (this.form.id != null) { };
updateFactory(this.form).then(response => { this.getDataList();
this.$modal.msgSuccess("修改成功"); break;
this.open = false; case 'add':
this.getList(); this.addOrEditTitle = '新增';
}); this.addOrUpdateVisible = true;
return; this.addOrUpdateHandle();
} break;
// case 'export':
createFactory(this.form).then(response => { this.handleExport();
this.$modal.msgSuccess("新增成功"); break;
this.open = false; default:
this.getList(); console.log(val);
}); }
}); },
}, },
/** 删除按钮操作 */
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" </div>
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>
</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() {
}, return {
data() { urlOptions: {
return { getDataListURL: getLineBindProductPage,
// },
loading: true, tableProps,
// tableData: [],
exportLoading: false, formConfig: [
// {
showSearch: true, type: 'button',
// btnName: '同步',
total: 0, name: 'search',
// 线 color: 'primary',
list: [], },
// ],
title: "", };
// },
open: false, components: {},
// created() {
queryParams: { const params = {
pageNo: 1, pageSize: 100,
pageSize: 10, pageNo: 1,
}, };
// getProductPage(params).then((response) => {
form: {}, this.tableProps[1].list = response.data.list;
// });
rules: { },
} methods: {
}; buttonClick(val) {
}, switch (val.btnName) {
created() { case 'search':
this.getList(); this.listQuery.pageNo = 1;
}, this.listQuery.pageSize = 10;
methods: { this.getDataList();
/** 查询列表 */ break;
getList() { default:
this.loading = true; console.log(val);
// }
getLineBindProductPage(this.queryParams).then(response => { },
this.list = response.data.list; inputChange() {
this.total = response.data.total; this.getDataList();
this.loading = false; },
}); },
},
/** 取消按钮 */
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();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
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']" /> </div>
</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>
</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() {
}, return {
data() { urlOptions: {
return { getDataListURL: getLineBindProductLogPage,
// },
loading: true, tableProps,
// tableData: [],
exportLoading: false, optionArrUrl: [getProductionLinePage, getProductPage],
// formConfig: [
showSearch: true, {
// type: 'select',
total: 0, label: '产线',
// 线 selectOptions: [],
list: [], param: 'productionLineId',
// defaultSelect: '',
title: "", filterable: true,
// },
open: false, {
// type: 'select',
queryParams: { label: '在制产品',
pageNo: 1, selectOptions: [],
pageSize: 10, param: 'productId',
productionLineId: null, defaultSelect: '',
productId: null, filterable: true,
startTime: [], },
}, {
// type: 'datePicker',
form: {}, label: '时间',
// dateType: 'daterange',
rules: { format: 'yyyy-MM-dd',
productionLineId: [{ required: true, message: "产线id不能为空", trigger: "change" }], valueFormat: 'yyyy-MM-dd HH:mm:ss',
productId: [{ required: true, message: "产品id不能为空", trigger: "change" }], rangeSeparator: '-',
startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }], startPlaceholder: '开始时间',
} endPlaceholder: '结束时间',
}; param: 'createTime',
}, },
created() { {
this.getList(); type: 'button',
}, btnName: '搜索',
methods: { name: 'search',
/** 查询列表 */ color: 'primary',
getList() { },
this.loading = true; {
// type: 'button',
getLineBindProductLogPage(this.queryParams).then(response => { btnName: '重置',
this.list = response.data.list; name: 'reset',
this.total = response.data.total; },
this.loading = false; ],
}); };
}, },
/** 取消按钮 */ components: {
cancel() { },
this.open = false; created() {
this.reset(); this.getArr();
}, },
/** 表单重置 */ methods: {
reset() { getArr() {
this.form = { const params = {
id: undefined, page: 1,
productionLineId: undefined, limit: 500,
productId: undefined, };
startTime: undefined, this.optionArrUrl.forEach((item, index) => {
endTime: undefined, item(params).then((response) => {
}; this.formConfig[index].selectOptions = response.data.list;
this.resetForm("form"); });
}, });
/** 搜索按钮操作 */ },
handleQuery() { buttonClick(val) {
this.queryParams.pageNo = 1; switch (val.btnName) {
this.getList(); case 'search':
}, this.listQuery.pageNo = 1;
/** 重置按钮操作 */ this.listQuery.pageSize = 10;
resetQuery() { this.listQuery.productionLineId = val.productionLineId;
this.resetForm("queryForm"); this.listQuery.productId = val.productId;
this.handleQuery(); this.listQuery.createTime = val.createTime;
}, this.getDataList();
/** 新增按钮操作 */ break;
handleAdd() { case 'reset':
this.reset(); this.$refs.searchBarForm.resetForm();
this.open = true; this.listQuery = {
this.title = "添加产线目前生产产品表 主要为更新"; pageSize: 10,
}, pageNo: 1,
/** 修改按钮操作 */ total: 1,
handleUpdate(row) { };
this.reset(); this.getDataList();
const id = row.id; break;
getLineBindProductLog(id).then(response => { default:
this.form = response.data; console.log(val);
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();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除产线目前生产产品表 主要为更新编号为"' + id + '"的数据项?').then(function() {
return deleteLineBindProductLog(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 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(
`确定对${
val.data.name
? '[名称=' + val.data.name + ']'
: '[序号=' + val.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteProductAttr(val.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 label="操作"
@keyup.enter.native="handleQuery" /> :method-list="tableBtn"
</el-form-item> @clickBtn="handleClick" />
<el-form-item prop="code"> </base-table>
<el-input <pagination
v-model="queryParams.code" :limit.sync="listQuery.pageSize"
placeholder="编码" :page.sync="listQuery.pageNo"
clearable :total="listQuery.total"
@keyup.enter.native="handleQuery" /> @pagination="getDataList" />
</el-form-item> <add-or-update
<el-form-item> v-if="addOrUpdateVisible"
<el-button type="primary" icon="el-icon-search" @click="handleQuery"> ref="addOrUpdate"
搜索 @refreshDataList="getDataList" />
</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="操作"
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: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
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
</div>
<!-- 对话框(添加 / 修改) -->
<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,
},
//
form: {},
//
rules: {
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: 'number',
message: '单位平方数为浮点类型',
trigger: 'blur',
transfom: 'val => Number(val)',
},
],
processTime: [
{
required: true,
message: '完成单位产品用时不能为空',
trigger: 'blur',
},
{
type: 'number',
message: '完成单位产品用时为浮点类型',
trigger: 'blur',
transfom: 'val => Number(val)',
},
],
}, },
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:product:update`)
? {
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: [
{
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: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',
// },
],
}; };
}, },
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();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
}); });
}, },
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
code: undefined,
name: undefined,
specifications: undefined,
unitDictValue: undefined,
area: undefined,
processTime: undefined,
typeDictValue: 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;
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();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除产品编号为"' + id + '"的数据项?')
.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,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: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"> </div>
<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>
</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 { parseTime } from '../../mixins/code-filter';
import {
deleteProductionLine,
getProductionLinePage,
exportProductionLineExcel
} from "@/api/core/base/productionLine";
const tableProps = [
{
prop: 'code',
label: '产线编码',
align: 'center',
},
{
prop: 'name',
label: '产线名称',
align: 'center',
},
{
prop: 'factoryName',
label: '工厂',
align: 'center',
},
{
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() {
}, return {
data() { urlOptions: {
return { getDataListURL: getProductionLinePage,
// deleteURL: deleteProductionLine,
loading: true, exportURL: exportProductionLineExcel,
// },
exportLoading: false, tableProps,
// tableBtn: [
showSearch: true, this.$auth.hasPermi(`base:production-line:update`)
// ? {
total: 0, type: 'edit',
// 线 btnName: '编辑',
list: [], }
// : undefined,
title: "", this.$auth.hasPermi(`base:production-line:delete`)
// ? {
open: false, type: 'delete',
// btnName: '删除',
queryParams: { }
pageNo: 1, : undefined,
pageSize: 10, ].filter((v)=>v),
name: null, tableData: [],
}, formConfig: [
// {
form: {}, type: 'input',
// label: '产线名称',
rules: { placeholder: '产线名称',
factoryId: [{ required: true, message: "工厂表ID不能为空", trigger: "change" }], param: 'name',
code: [{ required: true, message: "编码不能为空", trigger: "blur" }], },
name: [{ required: true, message: "名称不能为空", trigger: "blur" }], {
} type: 'button',
}; btnName: '搜索',
}, name: 'search',
created() { color: 'primary',
this.getList(); },
}, {
methods: { type: 'separate',
/** 查询列表 */ },
getList() { {
this.loading = true; type: 'button',
// btnName: '重置',
getProductionLinePage(this.queryParams).then(response => { name: 'reset',
this.list = response.data.list; },
this.total = response.data.total; {
this.loading = false; type: 'separate',
}); },
}, {
/** 取消按钮 */ type: this.$auth.hasPermi('base:production-line:create') ? 'button' : '',
cancel() { btnName: '新增',
this.open = false; name: 'add',
this.reset(); color: 'success',
}, plain: true,
/** 表单重置 */ },
reset() { // {
this.form = { // type: this.$auth.hasPermi('base:production-line:create') ? 'separate' : '',
id: undefined, // },
factoryId: undefined, // {
code: undefined, // type: this.$auth.hasPermi('base:production-line:export') ? 'button' : '',
name: undefined, // btnName: '',
description: undefined, // name: 'export',
tvalue: undefined, // color: 'warning',
externalCode: undefined, // },
remark: undefined, ],
}; };
this.resetForm("form"); },
}, components: {
/** 搜索按钮操作 */ AddOrUpdate,
handleQuery() { },
this.queryParams.pageNo = 1; created() {},
this.getList(); methods: {
}, buttonClick(val) {
/** 重置按钮操作 */ switch (val.btnName) {
resetQuery() { case 'search':
this.resetForm("queryForm"); this.listQuery.pageNo = 1;
this.handleQuery(); this.listQuery.pageSize = 10;
}, this.listQuery.name = val.name;
/** 新增按钮操作 */ this.getDataList();
handleAdd() { break;
this.reset(); case 'reset':
this.open = true; this.$refs.searchBarForm.resetForm();
this.title = "添加工厂产线"; this.listQuery = {
}, pageSize: 10,
/** 修改按钮操作 */ pageNo: 1,
handleUpdate(row) { total: 1,
this.reset(); };
const id = row.id; this.getDataList();
getProductionLine(id).then(response => { break;
this.form = response.data; case 'add':
this.open = true; this.addOrEditTitle = '新增';
this.title = "修改工厂产线"; this.addOrUpdateVisible = true;
}); this.addOrUpdateHandle();
}, break;
/** 提交按钮 */ case 'export':
submitForm() { this.handleExport();
this.$refs["form"].validate(valid => { break;
if (!valid) { default:
return; console.log(val);
} }
// },
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"> </div>
<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>
</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() {
}, return {
data() { urlOptions: {
return { getDataListURL: getWorkshopSectionPage,
// deleteURL: deleteWorkshopSection,
loading: true, exportURL: exportWorkshopSectionExcel,
// },
exportLoading: false, tableProps,
// tableBtn: [
showSearch: true, this.$auth.hasPermi(`base:workshop-section:update`)
// ? {
total: 0, type: 'edit',
// 线 btnName: '编辑',
list: [], }
// : undefined,
title: "", this.$auth.hasPermi(`base:workshop-section:delete`)
// ? {
open: false, type: 'delete',
// btnName: '删除',
queryParams: { }
pageNo: 1, : undefined,
pageSize: 10, ].filter((v)=>v),
name: null, tableData: [],
}, formConfig: [
// {
form: {}, type: 'input',
// label: '工段名称',
rules: { placeholder: '工段名称',
productionLineId: [{ required: true, message: "产线ID不能为空", trigger: "blur" }], param: 'name',
code: [{ required: true, message: "编码不能为空", trigger: "blur" }], },
name: [{ required: true, message: "名称不能为空", trigger: "blur" }], {
sort: [{ required: true, message: "排序不能为空", trigger: "blur" }], type: 'button',
} btnName: '搜索',
}; name: 'search',
}, color: 'primary',
created() { },
this.getList(); {
}, type: 'separate',
methods: { },
/** 查询列表 */ {
getList() { type: 'button',
this.loading = true; btnName: '重置',
// name: 'reset',
getWorkshopSectionPage(this.queryParams).then(response => { },
this.list = response.data.list; {
this.total = response.data.total; type: 'separate',
this.loading = false; },
}); {
}, type: this.$auth.hasPermi('base:workshop-section:create') ? 'button' : '',
/** 取消按钮 */ btnName: '新增',
cancel() { name: 'add',
this.open = false; color: 'success',
this.reset(); plain: true,
}, },
/** 表单重置 */ // {
reset() { // type: this.$auth.hasPermi('base:workshop-section:create') ? 'separate' : '',
this.form = { // },
id: undefined, // {
productionLineId: undefined, // type: this.$auth.hasPermi('base:workshop-section:export') ? 'button' : '',
code: undefined, // btnName: '',
name: undefined, // name: 'export',
sort: undefined, // color: 'warning',
remark: undefined, // },
}; ],
this.resetForm("form"); };
}, },
/** 搜索按钮操作 */ components: {
handleQuery() { AddOrUpdate,
this.queryParams.pageNo = 1; },
this.getList(); created() {},
}, methods: {
/** 重置按钮操作 */ buttonClick(val) {
resetQuery() { switch (val.btnName) {
this.resetForm("queryForm"); case 'search':
this.handleQuery(); this.listQuery.pageNo = 1;
}, this.listQuery.pageSize = 10;
/** 新增按钮操作 */ this.listQuery.name = val.name;
handleAdd() { this.getDataList();
this.reset(); break;
this.open = true; case 'reset':
this.title = "添加产线工段"; this.$refs.searchBarForm.resetForm();
}, this.listQuery = {
/** 修改按钮操作 */ pageSize: 10,
handleUpdate(row) { pageNo: 1,
this.reset(); total: 1,
const id = row.id; };
getWorkshopSection(id).then(response => { this.getDataList();
this.form = response.data; break;
this.open = true; case 'add':
this.title = "修改产线工段"; this.addOrEditTitle = '新增';
}); this.addOrUpdateVisible = true;
}, this.addOrUpdateHandle();
/** 提交按钮 */ break;
submitForm() { case 'export':
this.$refs["form"].validate(valid => { this.handleExport();
if (!valid) { break;
return; default:
} console.log(val);
// }
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,99 @@
/*
* @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 = {
eightDisciplineType: {
1: '客诉问题',
2: '重大质量问题',
0: '重复发生问题',
},
examineStatus: {
1: '需要审批',
0: '不需要审批',
},
gradeFinish: {
1: '已打分',
0: '未打分',
},
step: {
0: 'D0',
1: 'D1',
2: 'D2',
3: 'D3',
4: 'D4',
5: 'D5',
6: 'D6',
7: 'D7',
8: 'D8',
},
containmentLocaleName:
{
1: "装配线",
2: "生产线",
3: "实验室",
4: "成品在途",
5: "第三方中间商",
},
developCountermeasuresName:
{
1: "让步接收",
2: "分选返工",
3: "隔离",
4: "退换货",
5: "通知供应商",
},
}
// 日期格式化
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]
}
}