Compare commits

..

No commits in common. "33ff942fc639061ee0ea9b9025b4e737209b0969" and "bd56b125601d6e4a2f12d343d9118f75943e14cf" have entirely different histories.

22 changed files with 1605 additions and 2370 deletions

View File

@ -33,13 +33,7 @@ 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,14 +8,7 @@ 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,13 +9,6 @@ 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,13 +8,6 @@ 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,13 +9,6 @@ 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

@ -1,78 +0,0 @@
<!--
* @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,202 +1,258 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar
:formConfigs="formConfig" <!-- 搜索工作栏 -->
ref="searchBarForm" <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
@headBtnClick="buttonClick" /> <el-form-item label="工厂编码" prop="code">
<base-table <el-input v-model="queryParams.code" placeholder="请输入工厂编码" clearable @keyup.enter.native="handleQuery"/>
v-loading="dataListLoading" </el-form-item>
:table-props="tableProps" <el-form-item label="工厂名称" prop="name">
:page="listQuery.pageNo" <el-input v-model="queryParams.name" placeholder="请输入工厂名称" clearable @keyup.enter.native="handleQuery"/>
:limit="listQuery.pageSize" </el-form-item>
:table-data="tableData"> <el-form-item label="创建时间" prop="createTime">
<method-btn <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
v-if="tableBtn.length" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
slot="handleBtn" </el-form-item>
:width="120" <el-form-item>
label="操作" <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
:method-list="tableBtn" <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
@clickBtn="handleClick" /> </el-form-item>
</base-table> </el-form>
<pagination
:limit.sync="listQuery.pageSize" <!-- 操作工具栏 -->
:page.sync="listQuery.pageNo" <el-row :gutter="10" class="mb8">
:total="listQuery.total" <el-col :span="1.5">
@pagination="getDataList" /> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
<base-dialog v-hasPermi="['base:factory:create']">新增</el-button>
:dialogTitle="addOrEditTitle" </el-col>
:dialogVisible="addOrUpdateVisible" <el-col :span="1.5">
@cancel="handleCancel" <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
@confirm="handleConfirm" v-hasPermi="['base:factory:export']">导出</el-button>
:before-close="handleCancel" </el-col>
width="70%"> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<add-or-update </el-row>
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update> <!-- 列表 -->
</base-dialog> <el-table v-loading="loading" :data="list">
</div> <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>
</template> </template>
<script> <script>
import AddOrUpdate from './add-or-updata'; import { createFactory, updateFactory, deleteFactory, getFactory, getFactoryPage, exportFactoryExcel } from "@/api/core/base/factory";
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 {
mixins: [basicPage], name: "Factory",
data() { components: {
return { },
urlOptions: { data() {
getDataListURL: getFactoryPage, return {
deleteURL: deleteFactory, //
exportURL: exportFactoryExcel, loading: true,
}, //
tableProps, exportLoading: false,
tableBtn: [ //
this.$auth.hasPermi(`base:factory:update`) showSearch: true,
? { //
type: 'edit', total: 0,
btnName: '编辑', //
} list: [],
: undefined, //
this.$auth.hasPermi(`base:factory:delete`) title: "",
? { //
type: 'delete', open: false,
btnName: '删除', //
} queryParams: {
: undefined, pageNo: 1,
].filter((v)=>v), pageSize: 10,
tableData: [], code: null,
formConfig: [ name: null,
{ createTime: [],
type: 'input', },
label: '工厂编码', //
placeholder: '工厂编码', form: {},
param: 'code', //
}, rules: {
{ code: [{ required: true, message: "工厂编码不能为空", trigger: "blur" }],
type: 'input', name: [{ required: true, message: "工厂名称不能为空", trigger: "blur" }],
label: '工厂名称', enabled: [{ required: true, message: "启用状态:0 、停用1、启用不能为空", trigger: "change" }],
placeholder: '工厂名称', externalCode: [{ required: true, message: "外部系统编码不能为空", trigger: "blur" }],
param: 'name', }
}, };
{ },
type: 'datePicker', created() {
label: '创建时间', this.getList();
dateType: 'daterange', },
format: 'yyyy-MM-dd', methods: {
valueFormat: 'yyyy-MM-dd HH:mm:ss', /** 查询列表 */
rangeSeparator: '-', getList() {
startPlaceholder: '开始时间', this.loading = true;
endPlaceholder: '结束时间', //
param: 'createTime', getFactoryPage(this.queryParams).then(response => {
}, this.list = response.data.list;
{ this.total = response.data.total;
type: 'button', this.loading = false;
btnName: '搜索', });
name: 'search', },
color: 'primary', /** 取消按钮 */
}, cancel() {
{ this.open = false;
type: 'separate', this.reset();
}, },
{ /** 表单重置 */
type: 'button', reset() {
btnName: '重置', this.form = {
name: 'reset', id: undefined,
}, code: undefined,
{ name: undefined,
type: 'separate', address: undefined,
}, description: undefined,
{ enabled: undefined,
type: this.$auth.hasPermi('base:factory:create') ? 'button' : '', remark: undefined,
btnName: '新增', version: undefined,
name: 'add', externalCode: undefined,
color: 'success', };
plain: true, this.resetForm("form");
}, },
// { /** 搜索按钮操作 */
// type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '', handleQuery() {
// }, this.queryParams.pageNo = 1;
// { this.getList();
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '', },
// btnName: '', /** 重置按钮操作 */
// name: 'export', resetQuery() {
// color: 'warning', this.resetForm("queryForm");
// }, this.handleQuery();
], },
}; /** 新增按钮操作 */
}, handleAdd() {
components: { this.reset();
AddOrUpdate, this.open = true;
}, this.title = "添加工厂";
created() {}, },
methods: { /** 修改按钮操作 */
buttonClick(val) { handleUpdate(row) {
switch (val.btnName) { this.reset();
case 'search': const id = row.id;
this.listQuery.pageNo = 1; getFactory(id).then(response => {
this.listQuery.pageSize = 10; this.form = response.data;
this.listQuery.name = val.name; this.open = true;
this.listQuery.code = val.code; this.title = "修改工厂";
this.listQuery.createTime = val.createTime; });
this.getDataList(); },
break; /** 提交按钮 */
case 'reset': submitForm() {
this.$refs.searchBarForm.resetForm(); this.$refs["form"].validate(valid => {
this.listQuery = { if (!valid) {
pageSize: 10, return;
pageNo: 1, }
total: 1, //
}; if (this.form.id != null) {
this.getDataList(); updateFactory(this.form).then(response => {
break; this.$modal.msgSuccess("修改成功");
case 'add': this.open = false;
this.addOrEditTitle = '新增'; this.getList();
this.addOrUpdateVisible = true; });
this.addOrUpdateHandle(); return;
break; }
case 'export': //
this.handleExport(); createFactory(this.form).then(response => {
break; this.$modal.msgSuccess("新增成功");
default: this.open = false;
console.log(val); 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,103 +1,208 @@
<!--
* @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" <!-- 搜索工作栏 -->
ref="searchBarForm" <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
@headBtnClick="buttonClick" /> <el-form-item>
<base-table <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
v-loading="dataListLoading" <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
:table-props="tableProps" </el-form-item>
:page="listQuery.pageNo" </el-form>
:limit="listQuery.pageSize"
:table-data="tableData" <!-- 操作工具栏 -->
@emitFun="inputChange" /> <el-row :gutter="10" class="mb8">
<pagination <el-col :span="1.5">
:limit.sync="listQuery.pageSize" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
:page.sync="listQuery.pageNo" v-hasPermi="['base:line-bind-product:create']">新增</el-button>
:total="listQuery.total" </el-col>
@pagination="getDataList" /> <el-col :span="1.5">
</div> <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>
</template> </template>
<script> <script>
import basicPage from '../../mixins/basic-page'; import { createLineBindProduct, updateLineBindProduct, deleteLineBindProduct, getLineBindProduct, getLineBindProductPage, exportLineBindProductExcel } from "@/api/core/base/lineBindProduct";
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 {
mixins: [basicPage, selectProduct], name: "LineBindProduct",
data() { components: {
return { },
urlOptions: { data() {
getDataListURL: getLineBindProductPage, return {
}, //
tableProps, loading: true,
tableData: [], //
formConfig: [ exportLoading: false,
{ //
type: 'button', showSearch: true,
btnName: '同步', //
name: 'search', total: 0,
color: 'primary', // 线
}, list: [],
], //
}; title: "",
}, //
components: {}, open: false,
created() { //
const params = { queryParams: {
pageSize: 100, pageNo: 1,
pageNo: 1, pageSize: 10,
}; },
getProductPage(params).then((response) => { //
this.tableProps[1].list = response.data.list; form: {},
}); //
}, rules: {
methods: { }
buttonClick(val) { };
switch (val.btnName) { },
case 'search': created() {
this.listQuery.pageNo = 1; this.getList();
this.listQuery.pageSize = 10; },
this.getDataList(); methods: {
break; /** 查询列表 */
default: getList() {
console.log(val); this.loading = true;
} //
}, getLineBindProductPage(this.queryParams).then(response => {
inputChange() { this.list = response.data.list;
this.getDataList(); this.total = response.data.total;
}, 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

@ -1,73 +0,0 @@
<!--
* @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,147 +1,241 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar
:formConfigs="formConfig" <!-- 搜索工作栏 -->
ref="searchBarForm" <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
@headBtnClick="buttonClick" /> <el-form-item label="产线id" prop="productionLineId">
<base-table <el-select v-model="queryParams.productionLineId" placeholder="请选择产线id" clearable size="small">
v-loading="dataListLoading" <el-option label="请选择字典生成" value="" />
:table-props="tableProps" </el-select>
:page="listQuery.pageNo" </el-form-item>
:limit="listQuery.pageSize" <el-form-item label="产品id" prop="productId">
:table-data="tableData" /> <el-select v-model="queryParams.productId" placeholder="请选择产品id" clearable size="small">
<pagination <el-option label="请选择字典生成" value="" />
:limit.sync="listQuery.pageSize" </el-select>
:page.sync="listQuery.pageNo" </el-form-item>
:total="listQuery.total" <el-form-item label="开始时间" prop="startTime">
@pagination="getDataList" /> <el-date-picker v-model="queryParams.startTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
</div> 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>
</template> </template>
<script> <script>
import basicPage from '../../mixins/basic-page'; import { createLineBindProductLog, updateLineBindProductLog, deleteLineBindProductLog, getLineBindProductLog, getLineBindProductLogPage, exportLineBindProductLogExcel } from "@/api/core/base/lineBindProductLog";
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 {
mixins: [basicPage], name: "LineBindProductLog",
data() { components: {
return { },
urlOptions: { data() {
getDataListURL: getLineBindProductLogPage, return {
}, //
tableProps, loading: true,
tableData: [], //
optionArrUrl: [getProductionLinePage, getProductPage], exportLoading: false,
formConfig: [ //
{ showSearch: true,
type: 'select', //
label: '产线', total: 0,
selectOptions: [], // 线
param: 'productionLineId', list: [],
defaultSelect: '', //
filterable: true, title: "",
}, //
{ open: false,
type: 'select', //
label: '在制产品', queryParams: {
selectOptions: [], pageNo: 1,
param: 'productId', pageSize: 10,
defaultSelect: '', productionLineId: null,
filterable: true, productId: null,
}, startTime: [],
{ },
type: 'datePicker', //
label: '时间', form: {},
dateType: 'daterange', //
format: 'yyyy-MM-dd', rules: {
valueFormat: 'yyyy-MM-dd HH:mm:ss', productionLineId: [{ required: true, message: "产线id不能为空", trigger: "change" }],
rangeSeparator: '-', productId: [{ required: true, message: "产品id不能为空", trigger: "change" }],
startPlaceholder: '开始时间', startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }],
endPlaceholder: '结束时间', }
param: 'createTime', };
}, },
{ created() {
type: 'button', this.getList();
btnName: '搜索', },
name: 'search', methods: {
color: 'primary', /** 查询列表 */
}, getList() {
{ this.loading = true;
type: 'button', //
btnName: '重置', getLineBindProductLogPage(this.queryParams).then(response => {
name: 'reset', this.list = response.data.list;
}, this.total = response.data.total;
], this.loading = false;
}; });
}, },
components: { /** 取消按钮 */
}, cancel() {
created() { this.open = false;
this.getArr(); this.reset();
}, },
methods: { /** 表单重置 */
getArr() { reset() {
const params = { this.form = {
page: 1, id: undefined,
limit: 500, productionLineId: undefined,
}; productId: undefined,
this.optionArrUrl.forEach((item, index) => { startTime: undefined,
item(params).then((response) => { endTime: undefined,
this.formConfig[index].selectOptions = response.data.list; };
}); this.resetForm("form");
}); },
}, /** 搜索按钮操作 */
buttonClick(val) { handleQuery() {
switch (val.btnName) { this.queryParams.pageNo = 1;
case 'search': this.getList();
this.listQuery.pageNo = 1; },
this.listQuery.pageSize = 10; /** 重置按钮操作 */
this.listQuery.productionLineId = val.productionLineId; resetQuery() {
this.listQuery.productId = val.productId; this.resetForm("queryForm");
this.listQuery.createTime = val.createTime; this.handleQuery();
this.getDataList(); },
break; /** 新增按钮操作 */
case 'reset': handleAdd() {
this.$refs.searchBarForm.resetForm(); this.reset();
this.listQuery = { this.open = true;
pageSize: 10, this.title = "添加产线目前生产产品表 主要为更新";
pageNo: 1, },
total: 1, /** 修改按钮操作 */
}; handleUpdate(row) {
this.getDataList(); this.reset();
break; const id = row.id;
default: getLineBindProductLog(id).then(response => {
console.log(val); 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();
});
});
},
/** 删除按钮操作 */
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

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

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

@ -1,139 +0,0 @@
<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,205 +1,498 @@
<!--
* @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 <!-- 搜索工作栏 -->
:formConfigs="formConfig" <el-form
ref="searchBarForm" class="search-form"
@headBtnClick="buttonClick" /> :model="queryParams"
<base-table ref="queryForm"
:table-props="tableProps" size="small"
:page="listQuery.pageNo" :inline="true"
:limit="listQuery.pageSize" v-show="showSearch"
:table-data="tableData"> label-width="68px">
<method-btn <el-form-item prop="name">
v-if="tableBtn.length" <el-input
slot="handleBtn" v-model="queryParams.name"
:width="120" placeholder="名称"
label="操作" clearable
:method-list="tableBtn" @keyup.enter.native="handleQuery" />
@clickBtn="handleClick" /> </el-form-item>
</base-table> <el-form-item prop="code">
<pagination <el-input
:limit.sync="listQuery.pageSize" v-model="queryParams.code"
:page.sync="listQuery.pageNo" placeholder="编码"
:total="listQuery.total" clearable
@pagination="getDataList" /> @keyup.enter.native="handleQuery" />
<add-or-update </el-form-item>
v-if="addOrUpdateVisible" <el-form-item>
ref="addOrUpdate" <el-button type="primary" icon="el-icon-search" @click="handleQuery">
@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 {
mixins: [basicPage], name: 'Product',
components: {},
data() { data() {
return { return {
urlOptions: { //
getDataListURL: getProductPage, loading: true,
deleteURL: deleteProduct, //
exportURL: exportProductExcel, exportLoading: false,
//
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',
// },
],
}; };
}, },
components: { created() {
AddOrUpdate, console.log('DICTYPE', this.DICT_TYPE);
this.getList();
}, },
created() {},
methods: { methods: {
buttonClick(val) { /** 查询列表 */
switch (val.btnName) { getList() {
case 'search': this.loading = true;
this.listQuery.pageNo = 1; //
this.listQuery.pageSize = 10; getProductPage(this.queryParams).then((response) => {
this.listQuery.name = val.name; this.list = response.data.list;
this.listQuery.code = val.code; this.total = response.data.total;
this.getDataList(); this.loading = false;
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

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

View File

@ -1,104 +0,0 @@
<!--
* @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,188 +1,236 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<search-bar
:formConfigs="formConfig" <!-- 搜索工作栏 -->
ref="searchBarForm" <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
@headBtnClick="buttonClick" /> <el-form-item label="名称" prop="name">
<base-table <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
v-loading="dataListLoading" </el-form-item>
:table-props="tableProps" <el-form-item>
:page="listQuery.pageNo" <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
:limit="listQuery.pageSize" <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
:table-data="tableData"> </el-form-item>
<method-btn </el-form>
v-if="tableBtn.length"
slot="handleBtn" <!-- 操作工具栏 -->
:width="120" <el-row :gutter="10" class="mb8">
label="操作" <el-col :span="1.5">
:method-list="tableBtn" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
@clickBtn="handleClick" /> v-hasPermi="['base:production-line:create']">新增</el-button>
</base-table> </el-col>
<pagination <el-col :span="1.5">
:limit.sync="listQuery.pageSize" <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
:page.sync="listQuery.pageNo" v-hasPermi="['base:production-line:export']">导出</el-button>
:total="listQuery.total" </el-col>
@pagination="getDataList" /> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<base-dialog </el-row>
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" <!-- 列表 -->
@cancel="handleCancel" <el-table v-loading="loading" :data="list">
@confirm="handleConfirm" <el-table-column label="id" align="center" prop="id" />
:before-close="handleCancel" <el-table-column label="工厂表ID" align="center" prop="factoryId" />
width="70%"> <el-table-column label="编码" align="center" prop="code" />
<add-or-update <el-table-column label="名称" align="center" prop="name" />
ref="addOrUpdate" <el-table-column label="描述" align="center" prop="description" />
@refreshDataList="successSubmit"></add-or-update> <el-table-column label="备注" align="center" prop="remark" />
</base-dialog> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
</div> <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>
</template> </template>
<script> <script>
import AddOrUpdate from './add-or-updata'; import { createProductionLine, updateProductionLine, deleteProductionLine, getProductionLine, getProductionLinePage, exportProductionLineExcel } from "@/api/core/base/productionLine";
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 {
mixins: [basicPage], name: "ProductionLine",
data() { components: {
return { },
urlOptions: { data() {
getDataListURL: getProductionLinePage, return {
deleteURL: deleteProductionLine, //
exportURL: exportProductionLineExcel, loading: true,
}, //
tableProps, exportLoading: false,
tableBtn: [ //
this.$auth.hasPermi(`base:production-line:update`) showSearch: true,
? { //
type: 'edit', total: 0,
btnName: '编辑', // 线
} list: [],
: undefined, //
this.$auth.hasPermi(`base:production-line:delete`) title: "",
? { //
type: 'delete', open: false,
btnName: '删除', //
} queryParams: {
: undefined, pageNo: 1,
].filter((v)=>v), pageSize: 10,
tableData: [], name: null,
formConfig: [ },
{ //
type: 'input', form: {},
label: '产线名称', //
placeholder: '产线名称', rules: {
param: 'name', factoryId: [{ required: true, message: "工厂表ID不能为空", trigger: "change" }],
}, code: [{ required: true, message: "编码不能为空", trigger: "blur" }],
{ name: [{ 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', getProductionLinePage(this.queryParams).then(response => {
}, this.list = response.data.list;
{ this.total = response.data.total;
type: 'separate', this.loading = false;
}, });
{ },
type: this.$auth.hasPermi('base:production-line:create') ? 'button' : '', /** 取消按钮 */
btnName: '新增', cancel() {
name: 'add', this.open = false;
color: 'success', this.reset();
plain: true, },
}, /** 表单重置 */
// { reset() {
// type: this.$auth.hasPermi('base:production-line:create') ? 'separate' : '', this.form = {
// }, id: undefined,
// { factoryId: undefined,
// type: this.$auth.hasPermi('base:production-line:export') ? 'button' : '', code: undefined,
// btnName: '', name: undefined,
// name: 'export', description: undefined,
// color: 'warning', tvalue: undefined,
// }, externalCode: undefined,
], remark: undefined,
}; };
}, this.resetForm("form");
components: { },
AddOrUpdate, /** 搜索按钮操作 */
}, handleQuery() {
created() {}, this.queryParams.pageNo = 1;
methods: { this.getList();
buttonClick(val) { },
switch (val.btnName) { /** 重置按钮操作 */
case 'search': resetQuery() {
this.listQuery.pageNo = 1; this.resetForm("queryForm");
this.listQuery.pageSize = 10; this.handleQuery();
this.listQuery.name = val.name; },
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; getProductionLine(id).then(response => {
case 'add': this.form = response.data;
this.addOrEditTitle = '新增'; this.open = true;
this.addOrUpdateVisible = true; this.title = "修改工厂产线";
this.addOrUpdateHandle(); });
break; },
case 'export': /** 提交按钮 */
this.handleExport(); submitForm() {
break; this.$refs["form"].validate(valid => {
default: if (!valid) {
console.log(val); 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

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

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

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

@ -1,99 +0,0 @@
/*
* @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]
}
}