This commit is contained in:
朱文强 2024-10-16 09:55:22 +08:00
parent 9fc6f013cc
commit 9699e90ab3
21 changed files with 1621 additions and 829 deletions

View File

@ -1,3 +1,10 @@
/*
* @Author: zwq
* @Date: 2024-06-28 17:03:29
* @LastEditors: zwq
* @LastEditTime: 2024-09-27 09:24:09
* @Description:
*/
import request from '@/utils/request'
// 获取走势分析数据
@ -17,6 +24,15 @@ export function exportTrend(data) {
responseType: 'blob'
})
}
// 导出对比分析数据
export function exportCompare(data) {
return request({
url: '/analysis/energy-analysis/exportCompare',
method: 'post',
data: data,
responseType: 'blob'
})
}
// 获取对比分析数据
export function getCompare(data) {
return request({
@ -35,6 +51,24 @@ export function getYoy(data) {
})
}
// 导出同比分析数据
export function exportYoy(data) {
return request({
url: '/analysis/energy-analysis/exportYoy',
method: 'post',
data: data,
responseType: 'blob'
})
}
// 导出环比分析数据
export function exportChain(data) {
return request({
url: '/analysis/energy-analysis/exportChain',
method: 'post',
data: data,
responseType: 'blob'
})
}
// 获取环比分析数据(1:月,2:周,3:日)
export function getQoq(data) {
return request({

View File

@ -16,6 +16,14 @@ export function createCoreWO(data) {
})
}
// 获取工艺模式工单预计消耗物料
export function getMaterialCostWorkOrder(data) {
return request({
url: '/extend/process-retrospect/getMaterialCostWorkOrder',
method: 'post',
data: data
})
}
// 更新工单
export function updateCoreWO(data) {
return request({

View File

@ -50,6 +50,22 @@ export function getOrderById(query) {
params: query
})
}
// 订单进度-获取普通模式订单剩余数量
export function getOrderRemainNum(id) {
return request({
url: '/base/order/getOrderRemainNum?id=' + id,
method: 'get'
})
}
// 订单进度-获取工艺模式订单预计消耗物料(计算后)
export function getMaterialCostOrder(data) {
return request({
url: '/extend/process-retrospect/getMaterialCostOrder',
method: 'post',
data: data
})
}
// 获得工艺流程列表
export function getProcessFlowList() {
@ -59,6 +75,16 @@ export function getProcessFlowList() {
})
}
// 获得工艺流程列表
export function getProcessFlowPage(query) {
return request({
url: '/extend/process-flow/page',
method: 'get',
params: query
})
}
// 创建订单
export function orderCreate(data) {
return request({

View File

@ -150,6 +150,10 @@
<el-button type="primary" size="small" @click="search">查询</el-button>
<span class="separateStyle"></span>
<el-button size="small" @click="resetBtn">重置</el-button>
<span class="separateStyle"></span>
<el-button type="primary" size="small" @click="exportData" plain>
导出
</el-button>
</el-form-item>
</el-form>
<span v-if="isFold" class="foldClass" @click='switchMode'>
@ -328,6 +332,14 @@ export default {
},
//
search() {
if (this.validateData()) {
this.queryParams.startTime = this.queryParams.startTime + '';
this.queryParams.endTime = this.queryParams.endTime + '';
this.$emit('submit', this.queryParams);
}
},
//
validateData() {
if (!this.queryParams.energyTypeId) {
this.$modal.msgError('请选择能源类型')
return false
@ -397,10 +409,7 @@ export default {
this.$modal.msgError('请选择对象')
return false
}
this.queryParams.startTime = this.queryParams.startTime + ''
this.queryParams.endTime = this.queryParams.endTime + ''
console.log(this.queryParams)
this.$emit('submit', this.queryParams)
return true;
},
resetBtn() {
this.queryParams.energyTypeId = null
@ -436,7 +445,14 @@ export default {
} else {
element.classList.add('divHeight')
}
},
exportData() {
if (this.validateData()) {
this.queryParams.startTime = this.queryParams.startTime + '';
this.queryParams.endTime = this.queryParams.endTime + '';
this.$emit('exportD', this.queryParams);
}
},
}
}
</script>

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container contrastAnalysisBox" id="contrastAnalysisBox">
<!-- 搜索工作栏 -->
<search-area :isFold="isFold" @submit="getList"/>
<search-area :isFold="isFold" @submit="getList" @exportD="exportData"/>
<div v-show="chartData.length">
<bar-chart
ref="analysisBarChart"
@ -18,7 +18,7 @@
</div>
</template>
<script>
import { getCompare } from "@/api/analysis/energyAnalysis"
import { getCompare ,exportCompare} from "@/api/analysis/energyAnalysis"
import SearchArea from "./components/searchArea"
import BarChart from "./components/barChart"
import tableHeightMixin from '@/mixins/tableHeightMixin';
@ -85,32 +85,17 @@ export default {
}
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
},
//
exportExl() {
if (this.list.length > 0) {
var wb = XLSX.utils.table_to_book(
document.querySelector('.contrast-out-table')
);
let fileName = '对比分析.xlsx';
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: true,
type: 'array',
});
try {
FileSaver.saveAs(
new Blob([wbout], { type: 'application/octet-stream' }),
fileName
);
this.$message.success('导出成功');
} catch (e) {
if (typeof console !== 'undefined') console.log(e, wbout);
/** 导出按钮操作 */
exportData(val) {
//
this.$modal.confirm('是否确认导出对比分析数据?').then(() => {
this.exportLoading = true;
return exportCompare(val);
}).then(response => {
this.$download.excel(response, '对比分析数据.xlsx');
this.exportLoading = false;
}).catch(() => {});
}
return wbout;
} else {
this.$modal.msgWarning('暂无数据导出');
}
},
}
}
</script>

View File

@ -158,14 +158,33 @@ export default {
this.$emit('submit', this.queryParams)
},
exportData() {
let name
if (this.queryParams.objId) {
name = this.getObjName(this.objList, this.queryParams.objId)
if (this.objArr.length === 0) {
this.$modal.msgError('请选择对象')
return false
} else {
this.$modal.msgWarning("对象不能为空")
this.queryParams.objId = this.objArr[this.objArr.length-1]
}
if (!this.queryParams.type) {
this.$modal.msgError('请选择时间维度')
return false
}
this.$emit('exportD', {name: name})
if (!this.queryParams.searchTime) {
this.$modal.msgError('请选择时间')
return false
}
switch (this.queryParams.type) {
case 1:
this.queryParams.searchTime = this.transformTime(this.monthValue)
break;
case 2:
let value = moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59'
this.queryParams.searchTime = new Date(value).getTime()
break;
default:
let value2 = moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59'
this.queryParams.searchTime = new Date(value2).getTime()
}
this.$emit('exportD', this.queryParams)
},
// name
getObjName(list, id) {

View File

@ -19,7 +19,7 @@
</div>
</template>
<script>
import { getQoq } from "@/api/analysis/energyAnalysis"
import { getQoq,exportChain } from "@/api/analysis/energyAnalysis"
import SearchArea from "./components/searchArea"
import LineChart from "./components/lineChart"
import FileSaver from "file-saver"
@ -89,26 +89,14 @@ export default {
this.chartData = this.list
},
exportData(val) {
if (this.list.length > 0) {
var wb = XLSX.utils.table_to_book(document.querySelector(".qoq-out-table"))
let fileName = val.name + "环比分析.xlsx"
var wbout = XLSX.write(wb, {
bookType: "xlsx",
bookSST: true,
type: "array"
})
try {
FileSaver.saveAs(
new Blob([wbout], { type: "application/octet-stream" }),
fileName
)
} catch (e) {
if (typeof console !== "undefined") console.log(e, wbout);
}
return wbout
} else {
this.$modal.msgWarning("暂无数据导出")
}
//
this.$modal.confirm('是否确认导出环比分析数据?').then(() => {
this.exportLoading = true;
return exportChain(val);
}).then(response => {
this.$download.excel(response, '环比分析数据.xlsx');
this.exportLoading = false;
}).catch(() => {});
}
}
}

View File

@ -125,14 +125,26 @@ export default {
this.$emit('submit', this.queryParams)
},
exportData() {
let name
if (this.queryParams.objId) {
name = this.getObjName(this.objList, this.queryParams.objId)
if (this.objArr.length === 0) {
this.$modal.msgError('请选择对象')
return false
} else {
this.$modal.msgWarning("对象不能为空")
this.queryParams.objId = this.objArr[this.objArr.length-1]
}
if (!this.queryParams.type) {
this.$modal.msgError('请选择时间维度')
return false
}
this.$emit('exportD', {name: name})
if (!this.queryParams.searchTime) {
this.$modal.msgError('请选择时间')
return false
}
if (this.queryParams.type === 3) {
this.queryParams.searchTime = this.transformTime(this.yearMonth) + ''
} else {
this.queryParams.searchTime = this.transformYear(this.yearValue) + ''
}
this.$emit('exportD', this.queryParams)
},
// name
getObjName(list, id) {

View File

@ -20,7 +20,7 @@
</div>
</template>
<script>
import { getYoy } from "@/api/analysis/energyAnalysis"
import { getYoy,exportYoy } from "@/api/analysis/energyAnalysis"
import subRate from "./components/subRate.vue"
import SearchArea from "./components/searchArea"
import LineChart from "./components/lineChart"
@ -101,26 +101,14 @@ export default {
this.chartData = this.list
},
exportData(val) {
if (this.list.length > 0) {
var wb = XLSX.utils.table_to_book(document.querySelector(".yoy-out-table"))
let fileName = val.name + "同比分析.xlsx"
var wbout = XLSX.write(wb, {
bookType: "xlsx",
bookSST: true,
type: "array"
})
try {
FileSaver.saveAs(
new Blob([wbout], { type: "application/octet-stream" }),
fileName
)
} catch (e) {
if (typeof console !== "undefined") console.log(e, wbout);
}
return wbout
} else {
this.$modal.msgWarning("暂无数据导出")
}
//
this.$modal.confirm('是否确认导出同比分析数据?').then(() => {
this.exportLoading = true;
return exportYoy(val);
}).then(response => {
this.$download.excel(response, '同比分析数据.xlsx');
this.exportLoading = false;
}).catch(() => {});
}
}
}

View File

@ -0,0 +1,430 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-08-15 10:32:36
description: 弹窗的表单组件
-->
<template>
<el-form ref="form" :model="form" :label-width="`${labelWidth}px`" :size="size" :label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
<el-input v-if="col.input" v-model="form[col.prop]" @change="$emit('update', form)"
:placeholder="`请输入${col.label}`" v-bind="col.bind" />
<el-input v-if="col.textarea" type="textarea" v-model="form[col.prop]" :disabled="disabled"
@change="$emit('update', form)" :placeholder="`请输入${col.label}`" v-bind="col.bind" />
<el-select v-if="col.select" v-model="form[col.prop]" :placeholder="`请选择${col.label}`"
@change="$emit('selectupdate', form)" v-bind="col.bind">
<el-option v-for="opt in optionListOf[col.prop]" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
<el-date-picker v-if="col.datetime" v-model="form[col.prop]" type="datetime"
:disabled="col.disabled ? col.disabled : disabled" :placeholder="`请选择${col.label}`" value-format="timestamp"
@change="$emit('update', form)" v-bind="col.bind">
</el-date-picker>
<el-switch v-if="col.switch" v-model="form[col.prop]" :disabled="disabled" active-color="#0b58ff"
inactive-color="#e1e1e1" @change="$emit('update', form)" v-bind="col.bind"></el-switch>
<component v-if="col.subcomponent" :key="col.key" :disabled="disabled" :read-only="disabled"
:is="col.subcomponent" v-model="form[col.prop]" :inlineStyle="col.style" @on-change="$emit('update', form)"
v-bind="col.bind"></component>
<div class="upload-area" :class="uploadOpen ? '' : 'height-48'" ref="uploadArea" :key="col.prop"
v-if="col.upload">
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
<el-button type="text" icon="el-icon-arrow-right" @click="handleFilesOpen" />
</span>
<!-- :file-list="uploadedFileList" -->
<el-upload class="upload-in-dialog" v-if="col.upload" :key="col.prop + '__el-upload'" :action="uploadUrl"
:headers="uploadHeaders" :show-file-list="false" icon="el-icon-upload2" :disabled="disabled"
:before-upload="beforeUpload" :on-success="
(response, file, fileList) => {
handleUploadSuccess(response, file, col.prop);
}
" v-bind="col.bind">
<el-button size="mini" :disabled="col.bind?.disabled || false">
<svg-icon icon-class="icon-upload" style="color: inherit"></svg-icon>
上传文件
</el-button>
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
{{ col.uploadTips || '只能上传jpg/png文件, 大小不超过2MB' }}
</div>
</el-upload>
<uploadedFile class="file" v-for="file in form[col.prop]" :file="file" :key="file.fileUrl"
@delete="!disabled && handleDeleteFile(file, col.prop)" />
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getAccessToken } from '@/utils/auth';
import tupleImg from '@/assets/images/tuple.png';
import cache from '@/utils/cache';
/**
* 找到最长的label
* @param {*} options
*/
function findMaxLabelWidth(rows) {
let max = 0;
rows.forEach((row) => {
row.forEach((opt) => {
// debugger;
if (!opt.label) return 0;
if (opt.label.length > max) {
max = opt.label.length;
if (opt.label.includes('(')) {
max = max - 3
}
}
});
});
return max;
}
const uploadedFile = {
name: 'UploadedFile',
props: ['file'],
data() {
return {};
},
methods: {
handleDelete() {
this.$emit('delete', this.file);
},
async handleDownload() {
const data = await this.$axios({
url: this.file.fileUrl,
method: 'get',
responseType: 'blob',
});
await this.$message.success('开始下载');
// create download link
const url = window.URL.createObjectURL(data);
const link = document.createElement('a');
link.href = url;
link.download = this.file.fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
},
mounted() {},
render: function (h) {
return (
<div
title={this.file.fileName}
onClick={this.handleDownload}
style={{
background: `url(${tupleImg}) no-repeat`,
backgroundSize: '14px',
backgroundPosition: '0 55%',
paddingLeft: '20px',
paddingRight: '24px',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
cursor: 'pointer',
display: 'inline-block',
}}>
{this.file.fileName}
<el-button
type="text"
icon="el-icon-close"
style="float: right; position: relative; top: 2px; left: 8px; z-index: 100"
class="dialog__upload_component__close"
onClick={this.handleDelete}
/>
</div>
);
},
};
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: { uploadedFile },
props: {
rows: {
type: Array,
default: () => [],
},
dataForm: {
type: Object,
default: () => ({}),
},
disabled: {
type: Boolean,
default: false,
},
hasFiles: {
type: Boolean | Array,
default: false,
},
labelPosition: {
type: String,
default: 'right',
},
size: {
type: String,
default: '',
}
},
data() {
return {
uploadOpen: false,
form: {},
formLoading: true,
optionListOf: {},
uploadedFileList: [],
dataLoaded: false,
uploadHeaders: { Authorization: 'Bearer ' + getAccessToken() },
uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', // headersurl
};
},
computed: {
labelWidth() {
let max = findMaxLabelWidth(this.rows);
// 20px
return max * 20;
// return max * 20 + 'px';
},
},
watch: {
rows: {
handler() {
this.$nextTick(() => {
this.handleOptions('watch');
});
},
deep: true,
immediate: false,
},
dataForm: {
handler(val) {
this.form = JSON.parse(JSON.stringify(val));
if (this.hasFiles) {
if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
this.form.files = this.form.files ?? [];
} else if (Array.isArray(this.hasFiles)) {
this.hasFiles.forEach((prop) => {
this.form[prop] = this.form[prop] ?? [];
});
}
}
},
deep: true,
immediate: true,
},
},
mounted() {
// options
this.handleOptions();
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
async handleOptions(trigger = 'monuted') {
console.log('[dialogForm:handleOptions]');
const promiseList = [];
this.rows.forEach((cols) => {
cols.forEach((opt) => {
if (opt.value && !this.form[opt.prop]) {
//
this.form[opt.prop] = opt.value;
}
if (opt.options) {
this.$set(this.optionListOf, opt.prop, opt.options);
} else if (opt.url) {
// dependswatcher
if (opt.depends) {
this.$watch(
() => this.form[opt.depends],
(id) => {
console.log('<', opt.depends, '>', 'changed', id);
if (id == null) return;
//
this.form[opt.prop] = null;
//
this.$axios({
url: `${opt.url}?id=${id}`,
}).then((res) => {
this.$set(
this.optionListOf,
opt.prop,
res.data.map((item) => ({
label: item[opt.labelKey ?? 'name'],
value: item[opt.valueKey ?? 'id'],
}))
);
});
},
{
immediate: false,
}
);
return;
}
//
if (opt.select || (opt.input && !this.form?.id)) {
promiseList.push(async () => {
const response = await this.$axios(opt.url, {
method: opt.method ?? 'get',
});
console.log('[dialogForm:handleOptions:response]', response);
if (opt.select) {
//
const list =
'list' in response.data
? response.data.list
: response.data;
if (opt.cache) {
cache.store(opt.cache, list);
}
this.$set(
this.optionListOf,
opt.prop,
list.map((item) => ({
label: item[opt.labelKey ?? 'name'],
value: item[opt.valueKey ?? 'id'],
}))
);
} else if (opt.input) {
console.log('setting code: ', response.data);
//
this.form[opt.prop] = response.data;
// dataFormcodebug
this.$emit('update', this.form);
}
});
}
}
});
});
console.log('[dialogForm:handleOptions] done!');
// watch
if (trigger == 'watch') {
this.formLoading = false;
return;
}
try {
await Promise.all(promiseList.map((fn) => fn()));
this.formLoading = false;
this.dataLoaded = true;
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
} catch (error) {
console.log('[dialogForm:handleOptions:error]', error);
this.formLoading = false;
}
if (!promiseList.length) this.formLoading = false;
},
//
beforeUpload() {},
// bind
handleUploadSuccess(response, file, prop) {
console.log('[handleUploadSuccess]', response, file, prop);
this.form[prop].push({
fileName: file.name,
fileUrl: response.data,
fileType: prop == 'files' ? 2 : 1,
});
this.$modal.msgSuccess('上传成功');
this.$emit('update', this.form);
},
getFileName(fileUrl) {
return fileUrl.split('/').pop();
},
handleFilesOpen() {
this.uploadOpen = !this.uploadOpen;
},
handleDeleteFile(file, prop) {
this.form[prop] = this.form[prop].filter(
(item) => item.fileUrl != file.fileUrl
);
this.$emit('update', this.form);
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
.upload-area {
// background: #ccc;
// display: grid;
// grid-auto-rows: 34px;
// grid-template-columns: repeat(6, minmax(32px, max-content));
// gap: 8px;
// align-items: center;
position: relative;
overflow: hidden;
transition: height 0.3s ease-out;
}
.upload-in-dialog {
// display: inline-block;
margin-right: 24px;
// background: #ccc;
position: relative;
// top: -13px;
float: left;
}
.close-icon {
// background: #ccc;
position: absolute;
top: 0;
right: 12px;
z-index: 100;
transition: transform 0.3s ease-out;
}
.close-icon.open {
transform: rotateZ(90deg);
}
</style>
<style>
.dialog__upload_component__close {
color: #ccc;
}
.dialog__upload_component__close:hover {
/* color: #777; */
color: red;
}
.height-48 {
height: 35px !important;
}
</style>

View File

@ -37,12 +37,14 @@
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm
<DialogFormZ
v-if="open"
ref="form"
v-model="form"
label-position="top"
:disabled="mode == 'detail'"
:has-files="false"
@selectupdate="updateDialogFormZ"
:rows="rows" />
</base-dialog>
</div>
@ -51,14 +53,16 @@
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import DialogFormZ from '../../../DialogFormZ.vue';
import { publicFormatter } from '@/utils/dict';
import { deleteSparePart } from '@/api/equipment/base/spare-parts/list';
import { getMaterialTree, getMaterialList } from '@/api/base/material';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
export default {
name: 'EquipmentSparePartsList',
components: {},
components: { DialogFormZ },
mixins: [basicPageMixin],
data() {
return {
@ -129,33 +133,44 @@ export default {
rows: [
[
{
input: true,
select: true,
label: '备件名称',
prop: 'name',
rules: [
{ required: true, message: '备件名称不能为空', trigger: 'blur' },
],
prop: 'productMaterialId',
options: [],
bind: {
filterable: true,
clearable: false,
},
rules: [
{
input: true,
label: '备件编码',
prop: 'code',
url: '/base/equipment-spare-part/getCode',
rules: [
{ required: true, message: '备件编码不能为空', trigger: 'blur' },
],
required: true,
message: '备件名称不能为空',
trigger: 'change',
},
],
[
},
{
input: true,
label: '备件型号',
prop: 'model',
},
],
[
{
input: true,
label: '备件编码',
prop: 'code',
bind: {
disabled: true,
},
},
{
input: true,
label: '规格',
prop: 'specifications',
bind: {
disabled: true,
},
},
],
[
@ -165,27 +180,32 @@ export default {
prop: 'supplierId',
url: '/base/core-supplier/listAll', // TODO:
bind: {
filterable: true,
clearable: true,
disabled: true,
},
rules: [
{ required: true, message: '供应商不能为空', trigger: 'blur' },
],
},
{
select: true,
label: '物料类型',
prop: 'type',
options: this.getDictDatas('material_type'),
// url: '/base/core-equipment/listAll', // TODO:
label: '单位',
prop: 'unit', //
bind: {
filterable: true,
clearable: true,
disabled: true,
},
rules: [
{ required: true, message: '物料类型不能为空', trigger: 'blur' },
],
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
},
// {
// select: true,
// label: '',
// prop: 'type',
// options: this.getDictDatas('material_type'),
// // url: '/base/core-equipment/listAll', // TODO:
// bind: {
// filterable: true,
// clearable: true,
// },
// rules: [
// { required: true, message: '', trigger: 'blur' },
// ],
// },
],
[
{
@ -201,14 +221,6 @@ export default {
},
],
},
{
select: true,
label: '单位',
prop: 'unit', //
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
},
],
[
{
input: true,
label: '备注',
@ -225,11 +237,23 @@ export default {
name: null,
},
//
form: {},
form: {
id: null,
code: null,
name: null,
model: null,
specifications: null,
life: null,
type: null,
supplierId: null,
unit: null,
remark: null,
},
basePath: '/base/equipment-spare-part',
mode: null,
};
},
mounted() {},
created() {
// this.initSearchBar();
this.getList();
@ -267,8 +291,8 @@ export default {
reset() {
this.form = {
id: null,
productMaterialId: null,
code: null,
name: null,
model: null,
specifications: null,
life: null,
@ -294,6 +318,7 @@ export default {
this.reset();
this.open = true;
this.title = '添加备品备件';
this.getDict();
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -302,13 +327,14 @@ export default {
this.info({ id }).then((response) => {
this.form = response.data;
if (this.form.unit !== undefined) {
this.form.unit = String(this.form.unit)
this.form.unit = String(this.form.unit);
}
if (this.form.type !== undefined) {
this.form.type = String(this.form.type)
this.form.type = String(this.form.type);
}
this.open = true;
this.title = '修改备品备件';
this.getDict();
});
},
/** 提交按钮 */
@ -355,6 +381,7 @@ export default {
this.form = response.data;
this.open = true;
this.title = '修改备品备件';
this.getDict();
});
},
/** 导出按钮操作 */
@ -375,6 +402,30 @@ export default {
})
.catch(() => {});
},
async getDict() {
const materRes = await getMaterialTree(); //
let typeId = materRes.data.find((item) => item.product === 2).id;
const listQuery = {
typeId: typeId,
};
const materData = await getMaterialList(listQuery);
this.rows[0][0].options = (materData.data || []).map((item) => ({
label: item.name,
value: item.id,
...item
}));
},
updateDialogFormZ(val) {
const selectData = this.rows[0][0].options.find(
(item) => item.id === val.productMaterialId
);
this.form.productMaterialId = selectData.id;
this.form.name = selectData.name;
this.form.code = selectData.code;
this.form.specifications = selectData.specifications;
this.form.supplierId = selectData.supplierId;
this.form.unit = selectData.unit;
},
},
};
</script>

View File

@ -1,8 +1,8 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: zhp
* @LastEditTime: 2023-11-28 10:34:24
* @LastEditors: zwq
* @LastEditTime: 2024-10-15 15:59:48
* @Description:
-->
<template>
@ -26,9 +26,11 @@ import { parseTime } from '../../core/mixins/code-filter';
import {
getProcessTraceabilityPage,
getWorkOrderList,
getCoreProduct
// exportEnergyPlcExcel
} from '@/api/quality/processTraceability';
import {
getProductMaterial,
} from '@/api/base/material';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
@ -62,6 +64,14 @@ const tableProps = [
prop: 'actualQuantity',
label: '生产数量'
},
{
prop: 'lineName',
label: '产线名称'
},
{
prop: 'lineNum',
label: '产线预计产量'
},
{
prop: 'planProductUnit',
label: '单位',
@ -187,7 +197,7 @@ export default {
if (val.type === "processDetail") {
console.log(val);
let specificationsData =''
getCoreProduct(val.data.planProductId).then((res) => {
getProductMaterial(val.data.planProductId).then((res) => {
console.log(res)
this.$router.push({
@ -199,6 +209,7 @@ export default {
specifications: res.data.specifications,
productName: val.data.planProductName,
processFlowName: val.data.processFlowName,
lineId: val.data.lineId,
// planProductId: val.data.planProductId
// equipmentName,
},

View File

@ -185,6 +185,7 @@ export default {
pageNo: 1,
pageSize: 10,
orderId: this.$route.query.orderId,
lineId: this.$route.query.lineId,
flowDetId: [this.detId],
// orderId: this.$route.query.orderId,
@ -232,6 +233,7 @@ export default {
pageNo: 1,
pageSize: 10,
orderId: this.$route.query.orderId,
lineId: this.$route.query.lineId,
flowDetId: [this.detId],
// orderId: this.$route.query.orderId,
@ -263,6 +265,7 @@ export default {
pageNo: 1,
pageSize: 10,
orderId: this.$route.query.orderId,
lineId: this.$route.query.lineId,
flowDetId: [this.detId],
}).then((res) => {
console.log(res);

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-08-14 15:26:32
* @LastEditTime: 2024-10-14 09:26:29
* @Description:
-->
<template>
@ -252,10 +252,8 @@ export default {
});
},
async getDict() {
const materRes = await getMaterialTree();
let typeId = materRes.data[0].product
? materRes.data[0].id
: materRes.data[1].id;
const materRes = await getMaterialTree();//
let typeId = materRes.data.find(item=>item.product === 1).id
const listQuery = {
typeId: typeId,
};

View File

@ -117,8 +117,8 @@ export default {
methods: {
async getDict() {
//
const materRes = await getMaterialTree();
let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id
const materRes = await getMaterialTree(); //
let typeId = materRes.data.find(item=>item.product === 1).id
const listQuery= {
typeId:typeId
}

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-08-14 15:27:50
* @LastEditTime: 2024-10-14 09:26:53
* @Description:
-->
<template>
@ -207,8 +207,8 @@ export default {
},
methods: {
async getDictData() {
const materRes = await getMaterialTree();
let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id
const materRes = await getMaterialTree(); //
let typeId = materRes.data.find(item=>item.product === 0).id
const listQuery= {
typeId:typeId
}

View File

@ -283,7 +283,7 @@ export default {
},
//
returnOrderManage() {
this.$router.push({path: '/order/base/order-manage'})
this.$router.go(-1);
}
}
}

View File

@ -5,89 +5,103 @@
<span class="blueTitle"></span>
<span>订单编码: {{ orderMsg.code }}</span>
</div>
<el-button type="primary" plain size="small" style="float: right;" @click="returnOrderManage">
<svg-icon icon-class="return" /> 返回
<el-button
type="primary"
plain
size="small"
style="float: right; margin-top: -10px"
@click="returnOrderManage">
<svg-icon icon-class="return" />
返回
</el-button>
<div style="padding-left: 14px;">
<div style="padding-left: 14px; margin-top: 20px">
<el-row>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">订单名</div>
<div class="lightTip">{{ orderMsg.name }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">产品信息</div>
<div class="lightTip">{{ orderMsg.productName }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">产品规格</div>
<div class="lightTip">{{ orderMsg.specifications }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">客户</div>
<div class="lightTip">{{ orderMsg.customerName }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">包装规格</div>
<div class="lightTip">{{ getDictDataLabel(DICT_TYPE.PACK_SPEC, orderMsg.packSpec)}}</div>
<div class="lightTip">
{{ getDictDataLabel(DICT_TYPE.PACK_SPEC, orderMsg.packSpec) }}
</div>
</el-col>
<!-- <el-col :span='3'>
<div class="blodTip">物料计算方式</div>
<div class="lightTip">{{orderMsg.materialMethod ? (orderMsg.materialMethod === 1 ? '产品基础' : '工艺扩展') : ''}}
</div>
</el-col> -->
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">创建时间</div>
<div class="lightTip">{{ parseTime(orderMsg.createTime) }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">计划开始时间</div>
<div class="lightTip">{{ parseTime(orderMsg.planStartTime) }}</div>
</el-col>
</el-row>
<el-row>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">计划完成时间</div>
<div class="lightTip">{{ parseTime(orderMsg.planFinishTime) }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">计划加工数量</div>
<div class="lightTip">{{ orderMsg.planQuantity }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">加工平方数(平方米)</div>
<div class="lightTip">{{ orderMsg.planArea }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">预计用时()</div>
<div class="lightTip">{{ orderMsg.expectTime }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">状态</div>
<div class="lightTip">{{getDictDataLabel(DICT_TYPE.ORDER_STATUS, orderMsg.status)}}</div>
<div class="lightTip">
{{ getDictDataLabel(DICT_TYPE.ORDER_STATUS, orderMsg.status) }}
</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">实际开始时间</div>
<div class="lightTip">{{ parseTime(orderMsg.startProduceTime) }}</div>
<div class="lightTip">
{{ parseTime(orderMsg.startProduceTime) }}
</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">实际完成时间</div>
<div class="lightTip">{{ parseTime(orderMsg.finishProduceTime) }}</div>
<div class="lightTip">
{{ parseTime(orderMsg.finishProduceTime) }}
</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">实际生产数量</div>
<div class="lightTip">{{ orderMsg.actualQuantity }}</div>
</el-col>
</el-row>
<el-row>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">完成比%</div>
<div class="lightTip">{{ orderMsg.completeProp }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">废片数量</div>
<div class="lightTip">{{ orderMsg.nokQuantity }}</div>
</el-col>
<el-col :span='3'>
<el-col :span="3">
<div class="blodTip">负责人</div>
<div class="lightTip">{{ orderMsg.workers }}</div>
</el-col>
@ -104,109 +118,138 @@
<span>工单信息</span>
</div> -->
<div class="toggleTabBox">
<div :class="{ active: activeModule === 'orderInfo' }" @click="toggleTab('orderInfo')">子订单信息</div>
<!-- <div :class="{ active: activeModule === 'useInfo' }" @click="toggleTab('useInfo')">用料信息</div> -->
<div
:class="{ active: activeModule === 'orderInfo' }"
@click="toggleTab('orderInfo')">
子订单信息
</div>
<div
:class="{ active: activeModule === 'useInfo' }"
@click="toggleTab('useInfo')">
用料信息
</div>
</div>
<!-- 列表 -->
<el-row v-show="activeModule === 'orderInfo'">
<el-col :span="6">
<el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
<el-tree
:data="treeData"
:props="defaultProps"
@node-click="handleNodeClick"></el-tree>
</el-col>
<el-col :span="18">
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps1"
:table-data="list1" :max-height="tableH" />
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps1"
:table-data="list1"
:max-height="tableH" />
</el-col>
</el-row>
<!-- <base-table v-show="activeModule === 'useInfo'" :page="queryParams.pageNo" :limit="queryParams.pageSize"
:table-props="tableProps2" :table-data="list2" :max-height="tableH" /> -->
<base-table
v-show="activeModule === 'useInfo'"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps2"
:table-data="list2"
:max-height="tableH" />
</div>
</div>
</template>
<script>
import { parseTime } from '@/utils/ruoyi'
import { publicFormatter } from '@/utils/dict'
import { getProcessFlowList } from '@/api/base/orderManage'
import { orderDetail, bomUseNum, getDetailTree, getDetailTreeInfo } from '@/api/base/orderManage'
import { parseTime } from '@/utils/ruoyi';
import { publicFormatter } from '@/utils/dict';
import {
getProcessFlowList,
getOrderRemainNum,
getMaterialCostOrder,
} from '@/api/base/orderManage';
import {
orderDetail,
bomUseNum,
getDetailTree,
getDetailTreeInfo,
} from '@/api/base/orderManage';
const tableProps1 = [
{
prop: 'issueTime',
label: '下发时间',
filter: parseTime,
minWidth: 160
minWidth: 160,
},
{
prop: 'name',
label: '工单名',
minWidth: 100,
showOverflowtooltip: true
showOverflowtooltip: true,
},
{
prop: 'code',
label: '工单编码',
minWidth: 150
minWidth: 150,
},
{
prop: 'planAssignmentQuantity',
label: '计划加工量',
width: 100
width: 100,
},
{
prop: 'actualQuantity',
label: '实际加工量',
width: 100
width: 100,
},
{
prop: 'actualArea',
label: '加工平方数',
width: 100
width: 100,
},
{
prop: 'status',
label: '状态',
filter: publicFormatter('order_status')
filter: publicFormatter('order_status'),
},
{
prop: 'startProduceTime',
label: '开始时间',
filter: parseTime,
minWidth: 160
minWidth: 160,
},
{
prop: 'finishProduceTime',
label: '结束时间',
filter: parseTime,
minWidth: 160
minWidth: 160,
},
{
prop: 'productLineNames',
label: '关联产线',
filter: (val) => val ? val.join(',') : '',
showOverflowtooltip: true
filter: (val) => (val ? val.join(',') : ''),
showOverflowtooltip: true,
},
{
prop: 'workers',
label: '负责人'
label: '负责人',
},
{
prop: 'remark',
label: '备注'
}
]
label: '备注',
},
];
const tableProps2 = [
{
prop: 'materialName',
label: '物料名称'
label: '物料名称',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
filter: publicFormatter('unit_dict'),
},
{
prop: 'num',
label: '剩余生产预计消耗'
}
]
label: '剩余生产预计消耗',
},
];
export default {
name: 'OrderDetailData',
data() {
@ -222,97 +265,108 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 500
pageSize: 500,
},
defaultProps: {
children: 'children',
label: 'name'
label: 'name',
},
orderMsg: {},
processFlowName: ''
}
processFlowName: '',
};
},
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(510) / 2
})
this.orderId = location.href.split('?')[1].split('=')[1]
this.getMsg()
this.tableH = this.tableHeight(510) / 2;
});
this.orderId = location.href.split('?')[1].split('=')[1];
this.getMsg();
},
watch: {
$route: 'initData'
$route: 'initData',
},
methods: {
toggleTab(val) {
this.activeModule = val
this.activeModule = val;
},
handleNodeClick(val) {
console.log(val)
console.log(val);
getDetailTreeInfo({
id: val.id
}).then(res => {
this.list1 = res.data.order
console.log(res)
})
id: val.id,
}).then((res) => {
this.list1 = res.data.order;
console.log(res);
});
},
initData(to) {
if (to.name === 'OrderDetailData') {
this.orderId = location.href.split('?')[1].split('=')[1]
this.getMsg()
this.orderId = location.href.split('?')[1].split('=')[1];
this.getMsg();
}
},
getMsg() {
orderDetail({
id: this.orderId
}).then(res => {
this.orderMsg = res.data
this.list1 = res.data.coreWorkOrderRespVOS
id: this.orderId,
}).then((res) => {
this.orderMsg = res.data;
this.list1 = res.data.coreWorkOrderRespVOS;
getOrderRemainNum(this.orderId).then((resNum) => {
bomUseNum({
productId: this.orderMsg.planProductId
}).then(res2 => {
productId: this.orderMsg.planProductId,
}).then((res2) => {
if (res2.data && res2.data.length > 0) {
let arr = res2.data
arr.map(item => {
let arr = res2.data;
arr.map((item) => {
if (item) {
let a = item.num * this.orderMsg.remainingQuantity
item.num = !isNaN(parseFloat(a)) && isFinite(a) ? a : ''
let a = item.num * resNum.data;
item.num = !isNaN(parseFloat(a)) && isFinite(a) ? a : '';
}
})
this.list2 = arr
});
this.list2 = arr;
this.getMaterialCostOrder(this.orderId);
} else {
this.list2 = []
this.list2 = [];
}
})
});
});
getDetailTree({
id: this.orderId
}).then(res => {
console.log(res)
this.treeData =res.data
})
id: this.orderId,
}).then((res) => {
console.log(res);
this.treeData = res.data;
});
//
getProcessFlowList().then(res => {
let arr = res.data || []
getProcessFlowList().then((res) => {
let arr = res.data || [];
if (arr.length > 0) {
arr.map(item => {
arr.map((item) => {
if (item.id === this.orderMsg.processFlowId) {
this.processFlowName = item.name
this.processFlowName = item.name;
}
})
});
}
})
})
});
});
},
getMaterialCostOrder(id) {
getMaterialCostOrder({ id }).then((res) => {
this.list2.push(...res.data);
});
},
//
returnOrderManage() {
this.$router.go(-1);
}
}
}
},
},
};
</script>
<style lang='scss' scoped>
<style lang="scss" scoped>
.orderDetailData {
background-color: rgb(242, 244, 249);
.box1, .box2, .box3 {
.box1,
.box2,
.box3 {
background-color: #fff;
border-radius: 9px;
}
@ -331,7 +385,7 @@ export default {
}
.active {
color: rgba(0, 0, 0, 0.85);
border-bottom-color: #0B58FF;
border-bottom-color: #0b58ff;
}
}
}

View File

@ -1,125 +1,252 @@
<template>
<el-form ref="dataForm" :rules="rules" label-width="130px" :model="dataForm" label-position="top">
<el-form
ref="dataForm"
:rules="rules"
label-width="130px"
:model="dataForm"
label-position="top">
<el-row :gutter="20">
<el-col :span='8'>
<el-col :span="8">
<el-form-item label="工单名称" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入工单名称"></el-input>
<el-input
v-model="dataForm.name"
placeholder="请输入工单名称"></el-input>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-col :span="8">
<el-form-item label="工单编码" prop="code">
<el-input v-model="dataForm.code" disabled placeholder="请输入工单编码"></el-input>
<el-input
v-model="dataForm.code"
disabled
placeholder="请输入工单编码"></el-input>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-col :span="8">
<el-form-item label="产品名称" prop="planProductId">
<el-select v-model="dataForm.planProductId" placeholder="请选择产品" style="width: 100%;" filterable
<el-select
v-model="dataForm.planProductId"
placeholder="请选择产品"
style="width: 100%"
filterable
@change="selectProduct">
<el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='8'>
<el-col :span="8">
<el-form-item label="产品规格" prop="specifications">
<el-input v-model="dataForm.specifications" placeholder="请输入产品规格" />
<el-input
v-model="dataForm.specifications"
placeholder="请输入产品规格" />
</el-form-item>
</el-col>
<el-col :span='8'>
<el-col :span="8">
<el-form-item label="计划开始时间">
<el-date-picker v-model="dataForm.planStartTime" type="datetime" value-format="timestamp" style="width: 100%;"
placeholder="请选择计划开始时间">
</el-date-picker>
<el-date-picker
v-model="dataForm.planStartTime"
type="datetime"
value-format="timestamp"
style="width: 100%"
placeholder="请选择计划开始时间"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-col :span="8">
<el-form-item label="计划完成时间">
<el-date-picker v-model="dataForm.planFinishTime" type="datetime" value-format="timestamp"
style="width: 100%;" placeholder="请选择计划完成时间">
</el-date-picker>
<el-date-picker
v-model="dataForm.planFinishTime"
type="datetime"
value-format="timestamp"
style="width: 100%"
placeholder="请选择计划完成时间"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='8'>
<el-col :span="8">
<el-form-item label="计划投入数量" prop="planAssignQuantity">
<el-input-number v-model="dataForm.planAssignQuantity" :min="0" :max="9999999999999" style="width: 100%;"
<el-input-number
v-model="dataForm.planAssignQuantity"
:min="0"
:max="9999999999999"
style="width: 100%"
placeholder="请输入计划投入数量"></el-input-number>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-col :span="8">
<el-form-item label="计划生产数量" prop="planQuantity">
<el-input-number v-model="dataForm.planQuantity" :min="0" :max="9999999999999" style="width: 100%;"
<el-input-number
v-model="dataForm.planQuantity"
:min="0"
:max="9999999999999"
style="width: 100%"
placeholder="请输入计划生产数量"></el-input-number>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-form-item label="关联工艺" prop="processFlowId">
<el-select v-model="dataForm.processFlowId" placeholder="请选择关联工艺" clearable filterable style="width: 100%;"
@change="processFlowIdChange">
<el-option v-for="item in processFlowList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
<el-col :span="8">
<el-form-item label="优先级" prop="priority">
<el-select
v-model="dataForm.priority"
placeholder="请选择优先级"
style="width: 100%">
<el-option
v-for="item in getDictDatas(DICT_TYPE.ORDER_PRIORITY)"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='8'>
<el-form-item label="物料计算方式" prop="materialMethod">
<!-- <el-radio-group v-model="dataForm.materialMethod" @change="materialMethodChange">
<el-col :span="8">
<el-form-item label="工单类型" prop="type">
<el-select
v-model="dataForm.type"
placeholder="请选择工单类型"
style="width: 100%">
<el-option
v-for="item in workOrderTypeList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="负责部门" prop="deptId">
<el-select
v-model="dataForm.deptId"
placeholder="请选择关联产线"
style="width: 100%">
<el-option
v-for="item in deptList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="负责人" prop="workers">
<el-input
v-model="dataForm.workers"
placeholder="请输入负责人"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<span style="margin: 0 20px 15px 0; display: inline-block">
物料计算方式
</span>
<el-radio-group
v-model="dataForm.materialMethod"
@change="materialMethodChange">
<el-radio :label="1">产品基础BOM</el-radio>
<el-radio :label="2">工艺扩展BOM</el-radio>
</el-radio-group> -->
<el-select v-model="dataForm.materialMethod" placeholder="请选择物料计算方式" style="width: 100%;"
</el-radio-group>
<!-- <el-select v-model="dataForm.materialMethod" placeholder="请选择物料计算方式" style="width: 100%;"
@change="materialMethodChange">
<el-option key="1" label="产品基础BOM" :value="1" />
<el-option key="2" label="工艺扩展BOM" :value="2" />
</el-select>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-form-item label="优先级" prop="priority">
<el-select v-model="dataForm.priority" placeholder="请选择优先级" style="width: 100%;">
<el-option v-for="item in getDictDatas(DICT_TYPE.ORDER_PRIORITY)" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-form-item label="工单类型" prop="type">
<el-select v-model="dataForm.type" placeholder="请选择工单类型" style="width: 100%;">
<el-option v-for="item in workOrderTypeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-select> -->
</el-col>
</el-row>
<div v-if="dataForm.materialMethod === 1">
<el-row :gutter="20">
<el-col :span='8'>
<el-form-item label="关联产线" prop="productLineIds">
<el-select v-model="dataForm.productLineIds" placeholder="请选择关联产线" multiple style="width: 100%;">
<el-option v-for="item in productLineList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-form-item label="负责部门" prop="deptId">
<el-select v-model="dataForm.deptId" placeholder="请选择关联产线" style="width: 100%;">
<el-option v-for="item in deptList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='8'>
<el-form-item label="负责人" prop="workers">
<el-input v-model="dataForm.workers" placeholder="请输入负责人"></el-input>
</el-form-item>
<el-col :span="24">
<span style="margin: 8px 0; display: inline-block">关联产线</span>
<el-button style="margin-left: 20px" type="text" @click="addBind">
新增
</el-button>
</el-col>
</el-row>
<el-row
:gutter="20"
v-for="(item, index) in dataForm.productLineIds"
:key="index + 'line'"
style="margin-bottom: 8px">
<el-col :span="8">
<el-select
v-model="item.lineId"
placeholder="请选择产线"
style="width: 100%">
<el-option
v-for="item in productLineList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-input-number
style="width: 100%"
v-model="item.num"
placeholder="请输入数量"
:step="1"
:min="0"
step-strictly />
</el-col>
</el-row>
</div>
<div v-else>
<el-row :gutter="20">
<el-col :span="24">
<span style="margin: 8px 0; display: inline-block">
关联产线及工艺
</span>
<el-button style="margin-left: 20px" type="text" @click="addBind">
新增
</el-button>
</el-col>
</el-row>
<el-row
:gutter="20"
v-for="(item, index) in dataForm.productLineIds"
:key="index + 'process'"
style="margin-bottom: 8px">
<el-col :span="8">
<el-select
v-model="item.lineId"
placeholder="请选择产线"
style="width: 100%"
@change="processLineIdChange">
<el-option
v-for="item in productLineList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-select
v-model="item.processId"
placeholder="请选择工艺"
filterable
style="width: 100%">
<el-option
v-for="item in processFlowList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-input-number
style="width: 100%"
v-model="item.num"
:step="1"
:min="0"
step-strictly />
</el-col>
</el-row>
</div>
<!-- <el-row>
<el-col :span='12'>
<el-form-item label="计划分配订单量" prop="planAssignmentQuantity">
@ -130,10 +257,15 @@
</el-form>
</template>
<script>
import { getProductAll } from '@/api/base/product'
import { getProcessFlowList, workOrderList } from '@/api/base/orderManage'
import { createCoreWO, updateCoreWO, getCode, getCoreWO } from '@/api/base/coreWorkOrder'
import { getLineAll } from '@/api/base/productionLine'
import { getProductAll } from '@/api/base/product';
import { getProcessFlowPage, workOrderList } from '@/api/base/orderManage';
import {
createCoreWO,
updateCoreWO,
getCode,
getCoreWO,
} from '@/api/base/coreWorkOrder';
import { getLineAll } from '@/api/base/productionLine';
import basicAdd from '../../core/mixins/basic-add';
import { listDept } from '@/api/system/dept';
export default {
@ -146,7 +278,7 @@ export default {
codeURL: getCode,
createURL: createCoreWO,
updateURL: updateCoreWO,
infoURL: getCoreWO
infoURL: getCoreWO,
},
dataForm: {
id: undefined,
@ -160,21 +292,27 @@ export default {
planFinishTime: '',
planAssignQuantity: 0,
planQuantity: 0,
processFlowId: '',
materialMethod: 1,
triggerOrigin: 1,
priority: '',
productLineIds: [],
productLineIds: [{ lineId: null, processId: null, num: null }],
type: '',
workers: '',
status: 1
status: 1,
},
rules: {
name: [{ required: true, message: "工单名称不能为空", trigger: "blur" }],
planProductId: [{ required: true, message: "产品名称不能为空", trigger: "change" }],
planAssignQuantity: [{ required: true, message: "计划投入数量不能为空", trigger: "blur" }],
planQuantity: [{ required: true, message: "计划生产数量不能为空", trigger: "blur" }],
productLineIds: [{ required: true, message: "关联产线不能为空", trigger: "change" }]
name: [
{ required: true, message: '工单名称不能为空', trigger: 'blur' },
],
planProductId: [
{ required: true, message: '产品名称不能为空', trigger: 'change' },
],
planAssignQuantity: [
{ required: true, message: '计划投入数量不能为空', trigger: 'blur' },
],
planQuantity: [
{ required: true, message: '计划生产数量不能为空', trigger: 'blur' },
],
},
productList: [],
processFlowList: [],
@ -182,94 +320,125 @@ export default {
deptList: [],
workOrderTypeList: [
{ id: 1, name: '普通' },
{id: 2, name:'特殊'}
{ id: 2, name: '特殊' },
],
planStartTime: '',
planFinishTime: '',
isBind: false,
workOrderList: []
}
workOrderList: [],
};
},
mounted() {
this.getDict()
this.getDict();
},
methods: {
//
materialMethodChange(val) {
if (val === 2 && !this.dataForm.processFlowId) {
this.dataForm.materialMethod = 1
this.$modal.msgError("请先选择关联工艺");
}
console.log(val);
this.processFlowList = [];
this.dataForm.productLineIds = [];
const obj = { lineId: null, processId: null, num: null };
this.dataForm.productLineIds.push(obj);
// if (val === 2 && !this.dataForm.processFlowId) {
// this.dataForm.materialMethod = 1;
// this.$modal.msgError('');
// }
},
//
processFlowIdChange(val) {
console.log(val)
if (!val) {
this.dataForm.materialMethod = 1
}
// 线
processLineIdChange(val) {
const params = {
pageNo: 1,
pageSize: 100,
lineId: val,
};
//
getProcessFlowPage(params).then((res) => {
this.processFlowList = res.data.list || [];
});
},
init(id) {
this.dataForm.id = id || "";
this.dataForm.id = id || '';
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
this.getArr();
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
this.planStartTime = ''
this.planFinishTime = ''
this.$refs['dataForm'].resetFields();
this.planStartTime = '';
this.planFinishTime = '';
if (this.dataForm.id) {
getCoreWO(id).then(response => {
getCoreWO(id).then((response) => {
this.dataForm = response.data;
if (this.dataForm.priority !== undefined) {
this.dataForm.priority = String(this.dataForm.priority)
this.dataForm.priority = String(this.dataForm.priority);
}
this.dataForm.priority
this.dataForm.priority;
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
this.getCode();
}
}
});
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
let isContinue = true;
if (this.dataForm.materialMethod === 1) {
this.dataForm.productLineIds.forEach((item) => {
if (!item.lineId) {
this.$message('关联产线不能为空');
isContinue = false;
}
});
} else {
this.dataForm.productLineIds.forEach((item) => {
if (!item.lineId || !item.processId) {
this.$message('关联产线及工艺不能为空');
isContinue = false;
}
});
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
if (this.dataForm.id && isContinue) {
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit("refreshDataList");
this.$emit('refreshDataList');
});
return;
}
//
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
if (isContinue) {
this.urlOptions.createURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$confirm('是否添加预使用主原料信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log('121', this.dataForm.name)
this.$emit("refreshDataList", {
type: 'warning',
})
.then(() => {
console.log('121', this.dataForm.name);
this.$emit('refreshDataList', {
id: response.data,
name: this.dataForm.name
name: this.dataForm.name,
});
}).catch(() => {
this.$emit("refreshDataList");
})
.catch(() => {
this.$emit('refreshDataList');
});
});
}
});
},
getCode() {
this.urlOptions.codeURL()
this.urlOptions
.codeURL()
.then(({ data: res }) => {
this.dataForm.code = res;
})
@ -277,39 +446,39 @@ export default {
},
getDict() {
//
getProductAll().then(res => {
this.productList = res.data || []
})
getProductAll().then((res) => {
this.productList = res.data || [];
});
// 线
getLineAll().then(res => {
this.productLineList = res.data || []
})
listDept().then(res => {
this.deptList = res.data || []
})
//
getProcessFlowList().then(res => {
this.processFlowList = res.data || []
})
getLineAll().then((res) => {
this.productLineList = res.data || [];
});
listDept().then((res) => {
this.deptList = res.data || [];
});
// list
workOrderList({
status: 1
}).then(res => {
this.workOrderList = res.data || []
})
status: 1,
}).then((res) => {
this.workOrderList = res.data || [];
});
},
//
selectProduct(val) {
if (val) {
this.productList.map(item => {
this.productList.map((item) => {
if (val === item.id) {
this.dataForm.specifications = item.specifications
this.dataForm.specifications = item.specifications;
}
})
});
} else {
this.dataForm.specifications = ''
}
}
}
this.dataForm.specifications = '';
}
},
addBind() {
const obj = { lineId: null, processId: null, num: null };
this.dataForm.productLineIds.push(obj);
},
},
};
</script>

View File

@ -1,8 +1,8 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zhp
* @LastEditTime: 2024-09-11 10:27:13
* @LastEditors: zwq
* @LastEditTime: 2024-10-15 16:16:22
* @Description:
-->
<template>
@ -157,7 +157,7 @@
<script>
// import basicAdd from '../../core/mixins/basic-add';
import { getCoreWO, getMaterialBomPage, getConOrderList, getCoreWOListById } from "@/api/base/coreWorkOrder";
import { getCoreWO, getMaterialBomPage, getConOrderList, getCoreWOListById,getMaterialCostWorkOrder } from "@/api/base/coreWorkOrder";
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { getOrderEnergyData } from "@/api/monitoring/orderEnergy";
// import { orderList } from "@/api/base/orderManage";
@ -215,7 +215,7 @@ const tableProps1 = [
filter: publicFormatter('unit_dict')
},
{
prop: 'num',
prop: 'remainingNum',
label: '剩余生产预计消耗'
},
];
@ -390,8 +390,8 @@ export default {
// this.listQuery.total = response.data.total;
});
}else if (this.activeName === 'material') {
getConOrderList({
workOrderId: this.dataForm.id,
getMaterialCostWorkOrder({
id: this.dataForm.id,
}).then((response) => {
this.materialList = response.data;
// this.listQuery.total = response.data.total;

View File

@ -102,14 +102,14 @@ export default {
bottom: '3%',
bottom: '55%',
},
{
containLabel: true,
top: 40,
left: '4%',
right: '2%',
bottom: '3%',
top: '55%',
},
// {
// containLabel: true,
// top: 40,
// left: '4%',
// right: '2%',
// bottom: '3%',
// top: '55%',
// },
],
xAxis: [
{
@ -128,22 +128,22 @@ export default {
},
},
},
{
type: 'category',
data: nameArr,
gridIndex: 1,
axisTick: {
alignWithLabel: true,
},
axisLabel: {
color: '#979797',
},
axisLine: {
lineStyle: {
color: '#979797',
},
},
},
// {
// type: 'category',
// data: nameArr,
// gridIndex: 1,
// axisTick: {
// alignWithLabel: true,
// },
// axisLabel: {
// color: '#979797',
// },
// axisLine: {
// lineStyle: {
// color: '#979797',
// },
// },
// },
],
yAxis: [
{
@ -159,19 +159,19 @@ export default {
color: '#979797',
},
},
{
gridIndex: 1,
name: '剩余使用天数',
axisTick: {
show: false,
},
splitArea: {
show: false,
},
axisLabel: {
color: '#979797',
},
},
// {
// gridIndex: 1,
// name: '使',
// axisTick: {
// show: false,
// },
// splitArea: {
// show: false,
// },
// axisLabel: {
// color: '#979797',
// },
// },
],
series: [
{
@ -181,15 +181,15 @@ export default {
data: valueArr,
animationDuration,
},
{
name: '天数',
type: 'bar',
barWidth: '20',
data: dayArr,
animationDuration,
xAxisIndex: 1,
yAxisIndex: 1,
},
// {
// name: '',
// type: 'bar',
// barWidth: '20',
// data: dayArr,
// animationDuration,
// xAxisIndex: 1,
// yAxisIndex: 1,
// },
],
});
},