This commit is contained in:
朱文强 2024-11-29 16:42:13 +08:00
parent ca390fd764
commit 43ba33062b
8 changed files with 418 additions and 3 deletions

View File

@ -0,0 +1,28 @@
import request from '@/utils/request'
// 切换工艺
export function switchLineBindProcess(data) {
return request({
url: '/base/line-bind-process/switch',
method: 'put',
data: data
})
}
// 获得产线工艺目前生产工艺
export function getLineBindProcessPage(query) {
return request({
url: '/base/line-bind-process/nowList',
method: 'get',
params: query
})
}
// 获得产线工艺log分页
export function getLineBindProcessLogPage(query) {
return request({
url: '/base/line-bind-process/logPage',
method: 'get',
params: query
})
}

View File

@ -16,6 +16,14 @@ export function switchLineBindProduct(data) {
data: data data: data
}) })
} }
// 切换产线是否可以自动
export function switchAutoProduct(data) {
return request({
url: '/base/line-bind-product/switchAuto',
method: 'put',
data: data
})
}
// 更新产线目前生产产品表 主要为更新 // 更新产线目前生产产品表 主要为更新
export function updateLineBindProduct(data) { export function updateLineBindProduct(data) {
return request({ return request({

View File

@ -86,6 +86,7 @@ export const DICT_TYPE = {
// ============== PRODUCT - 产品模块 ============= // ============== PRODUCT - 产品模块 =============
UNIT_DICT: 'unit_dict', UNIT_DICT: 'unit_dict',
PRODUCT_TYPE: 'product_type', PRODUCT_TYPE: 'product_type',
PROCESS_TYPE: 'process_type',
// ============== ENERGY - 能源模块 ============= // ============== ENERGY - 能源模块 =============
ENERGY_UNIT: 'energy_unit', ENERGY_UNIT: 'energy_unit',

View File

@ -0,0 +1,99 @@
<!--
* @Author: zwq
* @Date: 2023-08-02 15:12:42
* @LastEditors: zwq
* @LastEditTime: 2024-11-29 13:25:51
* @Description:
-->
<template>
<div class="app-container">
<search-bar
:formConfigs="[{ label: '产线在制工艺', type: 'title' }]"
ref="searchBarForm" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData"
@emitFun="inputChange" />
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import { getLineBindProcessPage } from '@/api/core/base/lineBindProcess';
import selectProduct from './selectProduct';
const tableProps = [
{
prop: 'lineName',
label: '产线'
},
{
prop: 'processDictName',
label: '在制工艺',
list: [],
subcomponent: selectProduct,
},
{
prop: 'recordTime',
label: '开始时间',
filter: parseTime,
},
];
export default {
mixins: [basicPage, selectProduct],
data() {
return {
urlOptions: {
getDataListURL: getLineBindProcessPage,
},
tableProps,
tableData: [],
// formConfig: [
// {
// type: 'button',
// btnName: '',
// name: 'search',
// color: 'primary',
// },
// ],
};
},
components: {},
created() {
},
methods: {
//
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data;
this.dataListLoading = false;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
default:
console.log(val);
}
},
inputChange() {
this.getDataList();
},
},
};
</script>

View File

@ -0,0 +1,80 @@
<!--
* @Author: zwq
* @Date: 2023-08-03 14:09:18
* @LastEditors: zwq
* @LastEditTime: 2024-11-29 13:29:28
* @Description:
-->
<template>
<div class="tableInner">
<el-popover
placement="top"
title="切换在制工艺"
width="160"
v-model="visible">
<el-select v-model="list.processDict" style="margin: 5px" filterable>
<el-option
v-for="opt in getDictDatas(DICT_TYPE.PROCESS_TYPE)"
:key="opt.value"
:label="opt.label"
:value="opt.value + '+' + opt.label"></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">
<svg-icon icon-class="changelogo" />
</el-button>
</el-popover>
<el-input
readonly
v-model="list.processDictName"
style="width: 50%; margin-left: 5px"></el-input>
</div>
</template>
<script>
import { switchLineBindProcess } from '@/api/core/base/lineBindProcess';
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
list: this.injectData,
visible: false,
};
},
mounted() {},
methods: {
changeInput() {
const data = {
id: this.list.id,
processDict: this.list.processDict.split('+')[0],
processDictName: this.list.processDict.split('+')[1],
};
switchLineBindProcess(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.list.processDictName = this.list.processDict.split('+')[1];
this.$emit('emitData');
});
},
},
};
</script>
<style scoped>
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

View File

@ -0,0 +1,140 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData" />
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import { getLineBindProcessLogPage } from '@/api/core/base/lineBindProcess';
import { getProductionLinePage } from '@/api/core/base/productionLine';
const tableProps = [
{
prop: 'lineName',
label: '产线',
},
{
prop: 'processDictName',
label: '在制工艺',
},
{
prop: 'recordTime',
label: '开始时间',
filter: parseTime,
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getLineBindProcessLogPage,
},
tableProps,
tableData: [],
optionArrUrl: [getProductionLinePage],
formConfig: [
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'productionLineId',
defaultSelect: '',
filterable: true,
},
{
type: 'select',
label: '在制工艺',
selectOptions: this.getDictDatas(this.DICT_TYPE.PROCESS_TYPE),
labelField: 'label',
valueField: 'value',
param: 'processDict',
defaultSelect: '',
filterable: true,
},
{
type: 'datePicker',
label: '时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'startTime',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
},
],
};
},
components: {},
created() {
this.getArr();
},
methods: {
getArr() {
const params = {
page: 1,
limit: 500,
};
this.optionArrUrl.forEach((item, index) => {
item(params).then((response) => {
this.formConfig[index].selectOptions = response.data.list;
});
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.productionLineId = val.productionLineId;
this.listQuery.processDict = val.processDict;
this.listQuery.recordTime = val.startTime
? [val.startTime[0], val.startTime[1].substr(0, 10) + ' 23:59:59']
: null;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -0,0 +1,53 @@
<!--
* @Author: zhp
* @Date: 2023-01-31 14:12:10
* @LastEditTime: 2024-11-29 10:49:37
* @LastEditors: zwq
* @Description:
-->
<template>
<span>
<el-switch
@change="changeStatus"
v-model="injectData.allowAuto"
:active-value="true"
:inactive-value="false"></el-switch>
</span>
</template>
<script>
import { switchAutoProduct } from '@/api/core/base/lineBindProduct';
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
urlOptions: {
submitURL: switchAutoProduct,
},
};
},
methods: {
//
changeStatus() {
//
let obj = {
allowAuto: this.injectData.allowAuto,
id: this.injectData.id,
};
this.urlOptions.submitURL(obj).then((res) => {
console.log(res)
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$modal.msgSuccess('切换状态成功');
this.$emit('emitData');
});
},
},
};
</script>

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2023-08-02 15:12:42 * @Date: 2023-08-02 15:12:42
* @LastEditors: DY * @LastEditors: zwq
* @LastEditTime: 2023-10-13 16:35:03 * @LastEditTime: 2024-11-29 10:47:46
* @Description: * @Description:
--> -->
<template> <template>
@ -30,6 +30,7 @@ import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter'; import { parseTime } from '../../mixins/code-filter';
import { getLineBindProductPage } from '@/api/core/base/lineBindProduct'; import { getLineBindProductPage } from '@/api/core/base/lineBindProduct';
import selectProduct from './selectProduct'; import selectProduct from './selectProduct';
import changeStatus from './changeStatus';
import { getProductPage } from '@/api/core/base/product'; import { getProductPage } from '@/api/core/base/product';
const tableProps = [ const tableProps = [
@ -43,6 +44,11 @@ const tableProps = [
list: [], list: [],
subcomponent: selectProduct, subcomponent: selectProduct,
}, },
{
prop: 'allowAuto',
label: '允许自动',
subcomponent: changeStatus,
},
{ {
prop: 'recordTime', prop: 'recordTime',
label: '开始时间', label: '开始时间',