merge test
This commit is contained in:
commit
1a7e8cfc19
2
.env.dev
2
.env.dev
@ -16,7 +16,7 @@ VUE_APP_TITLE = MES系统
|
||||
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.4.173:48080'
|
||||
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.49:48080'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.4.159:48080'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.56:48082'
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Author: Do not edit
|
||||
* @Date: 2023-10-21 11:50:46
|
||||
* @LastEditTime: 2023-10-26 20:06:29
|
||||
* @LastEditTime: 2023-11-27 17:54:28
|
||||
* @LastEditors: DY
|
||||
* @Description:
|
||||
*/
|
||||
@ -110,3 +110,11 @@ export function deleteMaterialPBDet(id) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得产品Bom详细
|
||||
export function getMaterialPBDet(id) {
|
||||
return request({
|
||||
url: '/base/material-product-bom-det/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Author: zhp
|
||||
* @Date: 2023-10-31 15:05:06
|
||||
* @LastEditTime: 2023-11-03 09:05:50
|
||||
* @LastEditTime: 2023-11-28 09:28:05
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
*/
|
||||
@ -24,6 +24,14 @@ export function getWorkOrderList(query) {
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function getCoreProduct(id) {
|
||||
return request({
|
||||
url: '/base/core-product/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出物料信息
|
||||
// export function exportEnergyPlcExcel(query) {
|
||||
// return request({
|
||||
|
14
src/assets/icons/svg/table_edit.svg
Normal file
14
src/assets/icons/svg/table_edit.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="1_基础资料" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="1-1工厂信息" transform="translate(-1834.000000, -253.000000)">
|
||||
<g id="icon/界面内/编辑" transform="translate(1834.000000, 253.000000)">
|
||||
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
|
||||
<g id="常用购票人/编辑32" fill-rule="nonzero">
|
||||
<rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="16" height="16"></rect>
|
||||
<path d="M13.5,7.8285 C13.5,7.55235763 13.7238576,7.3285 14,7.3285 C14.2761424,7.3285 14.5,7.55235763 14.5,7.8285 L14.5,12 C14.5,13.3807119 13.3807119,14.5 12,14.5 L4,14.5 C2.61928813,14.5 1.5,13.3807119 1.5,12 L1.5,4 C1.5,2.61928813 2.61928813,1.5 4,1.5 L8.759,1.5 C8.9376328,1.5 9.10269631,1.59529946 9.19201271,1.75 C9.28132911,1.90470054 9.28132911,2.09529946 9.19201271,2.25 C9.10269631,2.40470054 8.9376328,2.5 8.759,2.5 L4,2.5 C3.17157288,2.5 2.5,3.17157288 2.5,4 L2.5,12 C2.5,12.8284271 3.17157288,13.5 4,13.5 L12,13.5 C12.8284271,13.5 13.5,12.8284271 13.5,12 L13.5,7.8285 Z M13.284,2.312 C13.4738226,2.11757837 13.784168,2.11034095 13.9828473,2.2957025 C14.1815266,2.48106405 14.1958051,2.79116533 14.015,2.994 L8.56,8.845 C8.43817243,8.97566989 8.25588756,9.03141962 8.08181033,8.9912488 C7.90773311,8.95107798 7.76830999,8.82108951 7.71606033,8.65024879 C7.66381067,8.47940808 7.70667243,8.29366989 7.8285,8.163 L13.284,2.312 Z" id="形状" stroke="#0B58FF" stroke-width="0.1" fill="#0B58FF"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Po Szerokość: | Wysokość: | Rozmiar: 1.8 KiB |
@ -76,6 +76,7 @@
|
||||
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
|
||||
@ -87,13 +88,18 @@
|
||||
<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="handleUploadSuccess"
|
||||
: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
|
||||
@ -108,10 +114,10 @@
|
||||
|
||||
<uploadedFile
|
||||
class="file"
|
||||
v-for="file in form[col.prop] || []"
|
||||
v-for="file in form[col.prop]"
|
||||
:file="file"
|
||||
:key="file.fileUrl"
|
||||
@delete="!disabled && handleDeleteFile(file)" />
|
||||
@delete="!disabled && handleDeleteFile(file, col.prop)" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -152,12 +158,30 @@ const uploadedFile = {
|
||||
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',
|
||||
@ -205,7 +229,7 @@ export default {
|
||||
default: false,
|
||||
},
|
||||
hasFiles: {
|
||||
type: Boolean,
|
||||
type: Boolean | Array,
|
||||
default: false,
|
||||
},
|
||||
labelPosition: {
|
||||
@ -251,7 +275,13 @@ export default {
|
||||
handler(val) {
|
||||
this.form = JSON.parse(JSON.stringify(val));
|
||||
if (this.hasFiles) {
|
||||
this.form.files = this.form.files ?? [];
|
||||
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,
|
||||
@ -348,7 +378,7 @@ export default {
|
||||
// 处理输入框数据
|
||||
this.form[opt.prop] = response.data;
|
||||
// 更新下外部的 dataForm,防止code字段有数据也报空的bug
|
||||
this.$emit('update', this.form)
|
||||
this.$emit('update', this.form);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -377,11 +407,12 @@ export default {
|
||||
// 上传成功的特殊处理
|
||||
beforeUpload() {},
|
||||
// 上传前的验证规则可通过 bind 属性传入
|
||||
handleUploadSuccess(response, file, fileList) {
|
||||
this.form.files.push({
|
||||
handleUploadSuccess(response, file, prop) {
|
||||
console.log('[handleUploadSuccess]', response, file, prop);
|
||||
this.form[prop].push({
|
||||
fileName: file.name,
|
||||
fileUrl: response.data,
|
||||
fileType: 2,
|
||||
fileType: prop == 'files' ? 2 : 1,
|
||||
});
|
||||
this.$modal.msgSuccess('上传成功');
|
||||
this.$emit('update', this.form);
|
||||
@ -395,8 +426,8 @@ export default {
|
||||
this.uploadOpen = !this.uploadOpen;
|
||||
},
|
||||
|
||||
handleDeleteFile(file) {
|
||||
this.form.files = this.form.files.filter(
|
||||
handleDeleteFile(file, prop) {
|
||||
this.form[prop] = this.form[prop].filter(
|
||||
(item) => item.fileUrl != file.fileUrl
|
||||
);
|
||||
this.$emit('update', this.form);
|
||||
|
@ -124,9 +124,9 @@ export default {
|
||||
this.Quill = new Quill(editor, this.options);
|
||||
// 取消自动聚焦 start
|
||||
this.$nextTick(() => {
|
||||
this.Quill.blur();
|
||||
this.Quill?.blur();
|
||||
if (!this.readOnly) {
|
||||
this.Quill.enable();
|
||||
this.Quill?.enable();
|
||||
}
|
||||
});
|
||||
// 如果设置了上传地址则自定义图片上传事件
|
||||
|
@ -1,978 +0,0 @@
|
||||
<template>
|
||||
<el-dialog class="dialog-with-menu" :visible="dialogVisible" :destroy-on-close="false" @close="handleClose"
|
||||
:close-on-click-modal="configs.clickModalToClose ?? true">
|
||||
<!-- title -->
|
||||
<div slot="title" class="dialog-title">
|
||||
<h1 class="">
|
||||
{{ detailMode ? "查看详情" : dataForm.id ? "编辑" : "新增" }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body__inner relative">
|
||||
<!-- v-if="dataForm.id && !detailMode && /属性|详情/.test(activeMenu) && $hasPermission()" -->
|
||||
<el-button v-if="configs.allowAdd ?? (dataForm.id && !detailMode && /属性|详情|参数/.test(activeMenu))" plain
|
||||
type="primary" size="small" class="at-right-top" style="margin-bottom: 16px" @click="handleAddParam()">+
|
||||
添加</el-button>
|
||||
<template v-if="dataForm.id && !detailMode && /附件/.test(activeMenu)">
|
||||
<el-upload style="position: absolute; width: 100%; height: 0" name="files" :action="uploadUrl"
|
||||
:show-file-list="false" :headers="uploadHeaders" :on-success="handleUploadSuccess"
|
||||
:before-upload="handleUploadCheck">
|
||||
<el-button plain type="primary" size="small" class="at-right-top" style=""> <i class="el-icon-upload"></i> 上传
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
|
||||
<!-- menu -->
|
||||
<el-tabs v-model="activeMenu" type="card" @tab-click="handleTabClick">
|
||||
<!-- <el-tab-pane v-for="(tab, index) in configs.menu" :key="index" :label="tab.name" :name="tab.name"> -->
|
||||
<el-tab-pane v-for="(tab, index) in actualMenus" :key="index" :name="tab.name">
|
||||
<span class="slot" slot="label">
|
||||
<i :class="{
|
||||
'el-icon-edit': tab.key === 'info',
|
||||
'el-icon-s-data': tab.key === 'attr',
|
||||
'el-icon-folder-opened': tab.key === 'attachment',
|
||||
}"></i>
|
||||
{{ tab.name }}
|
||||
</span>
|
||||
|
||||
<!-- 表单标签页 -->
|
||||
<div v-if="tab.key === 'info'">
|
||||
<!-- form -->
|
||||
<el-form ref="dataForm" :model="dataForm" v-loading="loadingStatus">
|
||||
<el-row v-for="(row, rowIndex) in configs.form.rows" :key="'row_' + rowIndex" :gutter="20">
|
||||
<el-col v-for="(col, colIndex) in row" :key="colIndex" :span="24 / row.length">
|
||||
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules || null"
|
||||
v-show="!col.forceDisabled || (col.forceDisabled && dataForm.id)">
|
||||
<div v-if="col.forceDisabled && dataForm.id" class="force-disabled">
|
||||
<el-tag :key="col.key" :type="col.type">{{ dataForm[col.prop] || "-" }}</el-tag>
|
||||
</div>
|
||||
<el-input v-if="col.input" v-model="dataForm[col.prop]" clearable
|
||||
:disabled="disableCondition(col.prop)" v-bind="col.elparams" />
|
||||
<el-cascader v-if="col.cascader" v-model="dataForm[col.prop]" :options="col.options"
|
||||
:disabled="detailMode" v-bind="col.elparams"></el-cascader>
|
||||
<el-select v-if="col.select" v-model="dataForm[col.prop]" clearable
|
||||
:disabled="disableCondition(col.prop)" v-bind="col.elparams"
|
||||
@change="handleSelectChange(col, $event)">
|
||||
<el-option v-for="(opt, optIdx) in col.options" :key="'option_' + optIdx" :label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
<el-switch v-if="col.switch" v-model="dataForm[col.prop]" :active-value="1" :inactive-value="0"
|
||||
@change="handleSwitchChange" :disabled="disableCondition(col.prop)" />
|
||||
<el-input v-if="col.textarea" type="textarea" v-model="dataForm[col.prop]"
|
||||
:disabled="disableCondition(col.prop)" v-bind="col.elparams" />
|
||||
<quillEditor v-if="col.richInput" ref="quill-editor" v-model="dataForm[col.prop]"
|
||||
:options="col.quillConfig ?? defaultQuillConfig" style="margin-top: 42px"
|
||||
:disabled="disableCondition(col.prop)" />
|
||||
|
||||
<div class="" v-if="col.component" style="margin: 42px 0 0">
|
||||
<!-- 下面这个 component 几乎是为 富文本 quill 定制的了... TODO:后续可能会根据业务需求创建新的版本 -->
|
||||
<component :is="col.component" :key="'component_' + col.prop"
|
||||
@update:modelValue="handleComponentModelUpdate(col.prop, $event)" :modelValue="dataForm[col.prop]"
|
||||
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'" />
|
||||
</div>
|
||||
<!-- add more... -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 表格标签页 -->
|
||||
<div v-if="dataForm.id && tab.key === 'attr'" key="attr-list">
|
||||
<BaseListTable :table-config="null" :column-config="filteredTableProps" :table-data="subList"
|
||||
@operate-event="handleTableRowOperate" :current-page="attrPage" :current-size="attrSize"
|
||||
:refresh-layout-key="Math.random()" v-loading="loadingStatus" />
|
||||
<!-- paginator -->
|
||||
<el-pagination class="" style="text-align: left" background @size-change="handleSizeChange"
|
||||
@current-change="handlePageChange" :current-page.sync="attrPage" :page-sizes="[5, 10, 20]"
|
||||
:page-size="attrSize" :total="attrTotal" layout="total, sizes, prev, next"></el-pagination>
|
||||
</div>
|
||||
|
||||
<!-- 附件标签页 -->
|
||||
<div v-if="dataForm.id && tab.key === 'attachment'" key="attachment">
|
||||
<div class="upload-tips" style="font-size: 0.8em; margin-bottom: 12px">文件大小不要超过 2MB</div>
|
||||
<!-- 附件列表 -->
|
||||
<div class="" v-loading="loadingStatus">
|
||||
<ul class="file-list">
|
||||
<li v-for="(file, index) in fileList" :key="index">
|
||||
<span class="file-name">{{ file.name }}</span>
|
||||
<span class="file-operations">
|
||||
<span class="file-icon preview" @click="handleFileClick('view', file)">
|
||||
<i class="el-icon-view" style="cursor: pointer"></i>
|
||||
</span>
|
||||
<span class="file-icon download" @click="handleFileClick('download', file)">
|
||||
<i class="el-icon-download" style="color: #0b58ff; cursor: pointer"></i>
|
||||
</span>
|
||||
<span class="file-icon delete" @click="handleFileClick('delete', file)">
|
||||
<i class="el-icon-delete" style="color: red; cursor: pointer"></i>
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- img preview dialog -->
|
||||
<el-dialog key="image-preview-dialog" class="image-preview-dialog" :visible.sync="imgPreviewDialogVisible"
|
||||
:append-to-body="true">
|
||||
<div class="img-container">
|
||||
<img width="100%" :src="currentImgUrl" alt="" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<!-- sub dialog -->
|
||||
<small-dialog :append-to-body="true" v-if="showSubDialog" ref="subDialog" :url="urls.subase"
|
||||
:configs="configs.subDialog" :related-id="dataForm.id" @refreshDataList="getSubList"></small-dialog>
|
||||
|
||||
<!-- footer -->
|
||||
<div slot="footer">
|
||||
<template v-for="(operate, index) in configs.form.operations">
|
||||
<el-button v-if="showButton(operate)" :key="'operation_' + index" :type="operate.type"
|
||||
@click="handleBtnClick(operate)"
|
||||
:loading="(operate.name === 'add' || operate.name === 'update') && btnLoading">{{ operate.label }}</el-button>
|
||||
</template>
|
||||
<el-button @click="handleBtnClick({ name: 'cancel' })">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { pick as __pick } from "@/utils/filters";
|
||||
import SmallDialog from "@/components/SmallDialog.vue";
|
||||
import BaseListTable from "@/components/BaseListTable.vue";
|
||||
import Cookies from "js-cookie";
|
||||
import "quill/dist/quill.core.css";
|
||||
import "quill/dist/quill.snow.css";
|
||||
import "quill/dist/quill.bubble.css";
|
||||
|
||||
import { quillEditor } from "vue-quill-editor";
|
||||
|
||||
function reConstructTreeData(listObj) {
|
||||
const entry = [];
|
||||
Object.keys(listObj).map((key) => {
|
||||
const currentNode = listObj[key];
|
||||
currentNode.label = currentNode.name;
|
||||
currentNode.value = currentNode.id;
|
||||
if (currentNode.parentId === "0") {
|
||||
entry.push(listObj[key]);
|
||||
return; // return { label: currentNode.name, value: currentNode.id, children: currentNode.children ?? [] };
|
||||
}
|
||||
const parentNode = listObj[currentNode.parentId];
|
||||
if (!parentNode.children) {
|
||||
parentNode.children = [];
|
||||
}
|
||||
parentNode.children.push(currentNode);
|
||||
});
|
||||
return entry;
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "DialogWithMenu",
|
||||
components: { SmallDialog, BaseListTable, quillEditor },
|
||||
props: {
|
||||
configs: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
dialogVisible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
inject: ["urls"],
|
||||
data() {
|
||||
const dataForm = {};
|
||||
const autoDisabledQueue = [];
|
||||
const watingToRefreshQueue = [];
|
||||
const cached = {}
|
||||
|
||||
this.configs.form.rows.forEach((row) => {
|
||||
row.forEach((col) => {
|
||||
if (col.upload) dataForm[col.prop] = col.default ?? [];
|
||||
else dataForm[col.prop] = col.default ?? null;
|
||||
|
||||
if (col.autoDisabled) autoDisabledQueue.push(col.prop);
|
||||
if (!!col.refreshOptionsAfterConfirm) watingToRefreshQueue.push(col);
|
||||
|
||||
if (col.fetchData)
|
||||
col.fetchData().then(({ data: res }) => {
|
||||
console.log("[Fetch Data]", "list" in res.data, res.data, res.data.list);
|
||||
if (res.code === 0) {
|
||||
if (col.cacheFetchedData) {
|
||||
// cache fetched data
|
||||
cached[col.prop] = 'list' in res.data ? res.data.list : (Array.isArray(res.data) ? res.data : [])
|
||||
}
|
||||
|
||||
if (!col.options || !col.options.length) {
|
||||
this.$set(
|
||||
col,
|
||||
"options",
|
||||
"list" in res.data
|
||||
? res.data.list.map((i) => ({
|
||||
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||
}))
|
||||
: res.data.map((i) => ({
|
||||
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||
}))
|
||||
);
|
||||
}
|
||||
// col.options = res.data.list;
|
||||
else if (col.options.length) {
|
||||
"list" in res.data ? res.data.list.unshift(...col.options) : res.data.unshift(...col.options);
|
||||
this.$set(
|
||||
col,
|
||||
"options",
|
||||
"list" in res.data
|
||||
? res.data.list.map((i) => ({
|
||||
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||
}))
|
||||
: res.data.map((i) => ({
|
||||
label: col.optionLabel ? i[col.optionLabel] : i.name,
|
||||
value: col.optionValue ? i[col.optionValue] : i.id,
|
||||
}))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
col.options.splice(0);
|
||||
}
|
||||
// dataForm[col.prop] = col.default ?? null; // not perfect!
|
||||
});
|
||||
else if (col.fetchTreeData) {
|
||||
// 获取设备类型时触发的,用于前端构建属性结构,约定,parentId 为0时是顶级节点
|
||||
col.fetchTreeData().then(({ data: res }) => {
|
||||
console.log("[Fetch Tree Data]", res.data);
|
||||
if (res.code === 0) {
|
||||
// 先把数据先重构成一个对象
|
||||
const obj = {};
|
||||
|
||||
if ("list" in res.data) {
|
||||
res.data.list.map((item) => {
|
||||
obj[item.id] = item;
|
||||
});
|
||||
} else if (Array.isArray(res.data)) {
|
||||
res.data.map((item) => {
|
||||
obj[item.id] = item;
|
||||
});
|
||||
}
|
||||
// 再过滤这个对象
|
||||
let filteredList = reConstructTreeData(obj);
|
||||
console.log("** filteredList **", filteredList);
|
||||
// 最后设置 options
|
||||
this.$set(col, "options", filteredList);
|
||||
} else {
|
||||
col.options.splice(0);
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
// configs,
|
||||
btnLoading: false,
|
||||
loadingStatus: false,
|
||||
activeMenu: this.configs.menu[0].name,
|
||||
dataForm,
|
||||
detailMode: false,
|
||||
autoDisabledQueue,
|
||||
watingToRefreshQueue,
|
||||
cached,
|
||||
showBaseDialog: false,
|
||||
baseDialogConfig: null,
|
||||
subList: [],
|
||||
showSubDialog: false,
|
||||
disableXXX: false,
|
||||
defaultQuillConfig: {
|
||||
modules: {
|
||||
toolbar: [
|
||||
[{ font: [] }],
|
||||
[{ size: ["small", false, "large", "huge"] }], // custom dropdown
|
||||
["bold", "italic", "underline", "strike"], // toggled buttons
|
||||
[{ color: [] }, { background: [] }], // dropdown with defaults from theme
|
||||
["blockquote", "code-block"],
|
||||
[{ header: 1 }, { header: 2 }], // custom button values
|
||||
[{ list: "ordered" }, { list: "bullet" }],
|
||||
// [{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
|
||||
[{ indent: "-1" }, { indent: "+1" }], // outdent/indent
|
||||
// [{ 'direction': 'rtl' }], // text direction
|
||||
// [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
|
||||
// [{ 'align': [] }],
|
||||
// ['clean'] // remove formatting button
|
||||
],
|
||||
},
|
||||
theme: "snow",
|
||||
readOnly: false,
|
||||
placeholder: "在这里输入描述信息...",
|
||||
scrollingContainer: null,
|
||||
},
|
||||
attrPage: 1,
|
||||
attrSize: 10,
|
||||
attrTotal: 0,
|
||||
fileList: [],
|
||||
imgPreviewDialogVisible: false,
|
||||
currentImgUrl: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.configs.form.rows.forEach((row) => {
|
||||
row.forEach((col) => {
|
||||
if (col.changeReflects && typeof col.changeReflects === 'object' && 'fromKey' in col.changeReflects && 'toProp' in col.changeReflects) {
|
||||
this.$watch(
|
||||
() => this.dataForm[col.prop],
|
||||
val => {
|
||||
if (val && (col.prop in this.cached)) {
|
||||
console.log("here changeReflects", col.prop, col.changeReflects.toProp, this.cached[col.prop])
|
||||
if (typeof col.changeReflects.fromKey === 'string') {
|
||||
this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find(item => item.id === val)?.[col.changeReflects.fromKey]
|
||||
} else if (Array.isArray(col.changeReflects.fromKey) && col.changeReflects.delimiter) {
|
||||
const foundItem = this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find(item => item.id === val)
|
||||
if (foundItem) {
|
||||
const values = col.changeReflects.fromKey.map(key => foundItem[key])
|
||||
this.dataForm[col.changeReflects.toProp] = values.join(col.changeReflects.delimiter)
|
||||
} else {
|
||||
this.dataForm[col.changeReflects.toProp] = col.changeReflects.delimiter
|
||||
console.log("[DialogWithMenu] mounted() 没找到对应数据")
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: false
|
||||
}
|
||||
)
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
watch: {
|
||||
dialogVisible: function (val) {
|
||||
if (!!val) {
|
||||
this.attrPage = 1
|
||||
this.attrSize = 10
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
actualMenus() {
|
||||
return this.configs.menu.filter((m) => {
|
||||
if (m.onlyEditMode && !this.dataForm.id) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
filteredTableProps() {
|
||||
return this.detailMode ? this.configs.table.props.filter((v) => v.prop !== "operations") : this.configs.table.props;
|
||||
},
|
||||
uploadHeaders() {
|
||||
return {
|
||||
token: Cookies.get("token") || "",
|
||||
};
|
||||
},
|
||||
uploadUrl() {
|
||||
return this.configs.menu.find((item) => item.key === "attachment")?.actionUrl || "#";
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
disableCondition(prop) {
|
||||
return this.detailMode || (this.disableXXX && this.autoDisabledQueue.indexOf(prop) !== -1);
|
||||
},
|
||||
/** utitilities */
|
||||
showButton(operate) {
|
||||
const notDetailMode = !this.detailMode;
|
||||
const showAlways = operate.showAlways ?? false;
|
||||
const editMode = operate.showOnEdit && this.dataForm.id;
|
||||
const addMode = !operate.showOnEdit && !this.dataForm.id;
|
||||
const permission = operate.permission ? this.$hasPermission(operate.permission) : true;
|
||||
const currentMenuKey = this.configs.menu.find((item) => item.name === this.activeMenu)?.key;
|
||||
return notDetailMode && (showAlways || ((editMode || addMode) && permission)) && currentMenuKey === "info";
|
||||
},
|
||||
|
||||
resetForm(excludeId = false, immediate = false) {
|
||||
setTimeout(
|
||||
() => {
|
||||
Object.keys(this.dataForm).forEach((key) => {
|
||||
if (excludeId && key === "id") return;
|
||||
if ("files" in this.dataForm) this.dataForm.files = [];
|
||||
if ("fileIds" in this.dataForm) this.dataForm.fileIds = [];
|
||||
else this.dataForm[key] = null;
|
||||
if (Array.isArray(this.fileList)) {
|
||||
this.fileList = [];
|
||||
}
|
||||
});
|
||||
this.activeMenu = this.configs.menu[0].name;
|
||||
this.$refs.dataForm[0].clearValidate();
|
||||
},
|
||||
immediate ? 0 : 200
|
||||
);
|
||||
},
|
||||
|
||||
updateOptions() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.watingToRefreshQueue.length) {
|
||||
this.watingToRefreshQueue.forEach((opt) => {
|
||||
console.log("[刷新数据, ", opt, "]");
|
||||
if ("fetchData" in opt) {
|
||||
opt.fetchData(this.dataForm.id ? this.dataForm.id : -1).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$set(
|
||||
opt,
|
||||
"options",
|
||||
"list" in res.data
|
||||
? res.data.list.map((i) => ({ label: i.code, value: i.id }))
|
||||
: res.data.map((i) => ({ label: i.code, value: i.id }))
|
||||
);
|
||||
|
||||
resolve({ done: true });
|
||||
} else {
|
||||
this.$message({
|
||||
message: `${res.code}: ${res.msg}`,
|
||||
type: "error",
|
||||
duration: 1500,
|
||||
});
|
||||
|
||||
resolve({ done: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else resolve(null);
|
||||
});
|
||||
},
|
||||
|
||||
/** init **/
|
||||
init(id, detailMode, menu) {
|
||||
// this.dialogVisible = true;
|
||||
if (this.$refs.dataForm && this.$refs.dataForm.length) {
|
||||
// 当不是首次渲染dialog的时候,一开始就清空验证信息,本组件的循环里只有一个 dataForm 所以只用取 [0] 即可
|
||||
this.$refs.dataForm[0].clearValidate();
|
||||
}
|
||||
console.log("[dialog] DialogWithHead init():", id, detailMode);
|
||||
|
||||
this.detailMode = detailMode ?? false;
|
||||
this.$nextTick(() => {
|
||||
this.dataForm.id = id || null;
|
||||
if (this.dataForm.id) {
|
||||
// 如果是编辑
|
||||
this.loadingStatus = true;
|
||||
// 提前获取属性列表
|
||||
this.getSubList();
|
||||
// 获取详情
|
||||
this.updateOptions().then((result) => {
|
||||
if (result === null || (typeof result === "object" && result.done)) {
|
||||
this.$http.get(this.urls.base + `/${this.dataForm.id}`).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
const dataFormKeys = Object.keys(this.dataForm);
|
||||
this.dataForm = __pick(res.data, dataFormKeys);
|
||||
if ("files" in res.data) {
|
||||
console.log("[DialogWithMenu] fileList===>", res.data.files, this.fileList);
|
||||
/** 返回的文件列表 */
|
||||
this.fileList = res.data.files
|
||||
? res.data.files.map((file) => ({
|
||||
id: file.id,
|
||||
name: file.fileUrl.split("/").pop(),
|
||||
url: file.fileUrl,
|
||||
typeCode: file.typeCode,
|
||||
}))
|
||||
: [];
|
||||
}
|
||||
}
|
||||
this.loadingStatus = false;
|
||||
// 是否要跳转到附件页
|
||||
if (menu && menu.key) {
|
||||
this.activeMenu = this.configs.menu.find((item) => item.key === menu.key)?.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 如果不是编辑
|
||||
this.updateOptions();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** handlers */
|
||||
handleFileClick(type, file) {
|
||||
switch (type) {
|
||||
case "view": {
|
||||
// 加载图片
|
||||
this.$http
|
||||
.get("/pms/attachment/downloadFile", {
|
||||
params: {
|
||||
attachmentId: file.id,
|
||||
type: 0, // 0 预览,1 下载
|
||||
},
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
console.log("preivew", res);
|
||||
if (/image/i.test(res.type)) {
|
||||
// 显示图片
|
||||
this.currentImgUrl = URL.createObjectURL(res);
|
||||
this.imgPreviewDialogVisible = true;
|
||||
} else if (/pdf/i.test(res.type)) {
|
||||
// 预览pdf
|
||||
let a = document.createElement('a')
|
||||
a.setAttribute('target', '_blank')
|
||||
a.href = URL.createObjectURL(res)
|
||||
a.click()
|
||||
console.log('before remove a ', a)
|
||||
a.remove()
|
||||
console.log('removed a ', a)
|
||||
} else {
|
||||
this.$message({
|
||||
message: "非图片和PDF文件请下载后预览",
|
||||
type: "error",
|
||||
duration: 1500,
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case "download": {
|
||||
// 下载图片
|
||||
this.$http
|
||||
.get("/pms/attachment/downloadFile", {
|
||||
params: {
|
||||
attachmentId: file.id,
|
||||
type: 1, // 0 预览,1 下载
|
||||
},
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
const blob = new Blob([res]);
|
||||
|
||||
/** 通知 */
|
||||
this.$notify({
|
||||
title: "成功",
|
||||
message: "开始下载",
|
||||
type: "success",
|
||||
duration: 1200,
|
||||
});
|
||||
|
||||
if ("download" in document.createElement("a")) {
|
||||
const alink = document.createElement("a");
|
||||
alink.download = file.name;
|
||||
alink.style.display = "none";
|
||||
alink.target = "_blank";
|
||||
alink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(alink);
|
||||
alink.click();
|
||||
URL.revokeObjectURL(alink.href);
|
||||
document.body.removeChild(alink);
|
||||
} else {
|
||||
navigator.msSaveBlob(blob, fileName);
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "delete": {
|
||||
return this.$confirm(`确定删除图片: ${file.name}`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "我再想想",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.loadingStatus = true;
|
||||
const newFilelist = this.fileList.filter((f) => f.id !== file.id);
|
||||
this.updateRemoteFiles(newFilelist).then((msg) => {
|
||||
if (msg && msg === "success") {
|
||||
this.fileList = newFilelist;
|
||||
this.loadingStatus = false;
|
||||
/** 通知 */
|
||||
this.$notify({
|
||||
title: "成功",
|
||||
message: "已删除",
|
||||
type: "success",
|
||||
duration: 1200,
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => { });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleUploadSuccess(response, file, fileList) {
|
||||
console.log("[DialogWithMenu] uploadedFileList", response, file, fileList);
|
||||
|
||||
if (response.code === 0) {
|
||||
const uploadedFile = response.data[0];
|
||||
const fileItem = {
|
||||
id: uploadedFile.id,
|
||||
name: uploadedFile.fileUrl.split("/").pop(),
|
||||
url: uploadedFile.fileUrl,
|
||||
typeCode: file.typeCode,
|
||||
};
|
||||
|
||||
this.loadingStatus = true;
|
||||
this.updateRemoteFiles([...this.fileList, fileItem]).then((msg) => {
|
||||
if (msg && msg === "success") {
|
||||
this.fileList.push(fileItem);
|
||||
this.loadingStatus = false;
|
||||
/** 通知 */
|
||||
this.$notify({
|
||||
title: "成功",
|
||||
message: "上传成功",
|
||||
type: "success",
|
||||
duration: 1200,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
updateRemoteFiles(filelist) {
|
||||
return this.$http
|
||||
.put("/pms/product", {
|
||||
id: "id" in this.dataForm ? this.dataForm.id : "DEFAULT_ID",
|
||||
fileIds: filelist.map((f) => f.id),
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) return "success";
|
||||
});
|
||||
},
|
||||
|
||||
handleUploadCheck(file) {
|
||||
console.log("[before upload]", file);
|
||||
const LIMIT = 2 * 1024 * 1024; // bytes
|
||||
if (file.size > LIMIT) {
|
||||
this.$message({
|
||||
message: "文件大小不能超过 2MB",
|
||||
type: "error",
|
||||
duration: 1500,
|
||||
});
|
||||
return false;
|
||||
} else return true;
|
||||
},
|
||||
|
||||
handleComponentModelUpdate(propName, { subject, payload: { data } }) {
|
||||
this.dataForm[propName] = JSON.stringify(data);
|
||||
console.log("[DialogJustForm] handleComponentModelUpdate", this.dataForm[propName]);
|
||||
},
|
||||
handleSelectChange(col, eventValue) {
|
||||
console.log("[dialog] select change: ", col, eventValue);
|
||||
},
|
||||
handleSwitchChange(val) {
|
||||
console.log("[dialog] switch change: ", val, this.dataForm);
|
||||
},
|
||||
handleBtnClick(payload) {
|
||||
console.log("btn click payload: ", payload);
|
||||
|
||||
if ("name" in payload) {
|
||||
switch (payload.name) {
|
||||
case "cancel":
|
||||
this.handleClose();
|
||||
break;
|
||||
case "reset":
|
||||
this.resetForm(true, true); // true means exclude id
|
||||
break;
|
||||
case "add":
|
||||
case "update": {
|
||||
this.$refs.dataForm[0].validate((passed, result) => {
|
||||
if (passed) {
|
||||
// 如果通过验证
|
||||
this.btnLoading = true
|
||||
this.loadingStatus = true;
|
||||
const method = payload.name === "add" ? "POST" : "PUT";
|
||||
|
||||
// 判断是否有附件选项
|
||||
const hasAttachment = !!this.configs.menu.find((item) => item.key === "attachment");
|
||||
if (hasAttachment) {
|
||||
const fileIds = this.fileList.map((item) => item.id);
|
||||
this.$set(this.dataForm, "fileIds", fileIds);
|
||||
}
|
||||
|
||||
// 加载额外需要的 id
|
||||
let extraIds = {};
|
||||
if (this.configs.extraIds && typeof this.configs.extraIds === "object") {
|
||||
// 如果配置里,有 extraIds 选项
|
||||
Object.entries(this.configs.extraIds).forEach(([key, value]) => {
|
||||
extraIds[key] = value;
|
||||
});
|
||||
}
|
||||
|
||||
// 实际发送请求
|
||||
this.btnLoading = true
|
||||
this.$http({
|
||||
url: this.urls.base,
|
||||
method,
|
||||
data: {
|
||||
...extraIds,
|
||||
...this.dataForm,
|
||||
},
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
this.btnLoading = false
|
||||
this.loadingStatus = false;
|
||||
console.log("[add&update] res is: ", res);
|
||||
if (res.code === 0) {
|
||||
this.$message.success(payload.name === "add" ? "添加成功" : "更新成功");
|
||||
this.$emit("refreshDataList");
|
||||
|
||||
// 如果 watingToRefreshQueue 队列里有数据
|
||||
// if (this.watingToRefreshQueue.length) {
|
||||
// // 刷新队列
|
||||
// this.watingToRefreshQueue.forEach((opt) => {
|
||||
// console.log("[刷新数据, ", opt, "]");
|
||||
// if ("fetchData" in opt) {
|
||||
// opt.fetchData().then(({ data: res }) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$set(
|
||||
// opt,
|
||||
// "options",
|
||||
// "list" in res.data
|
||||
// ? res.data.list.map((i) => ({ label: i.name, value: i.id }))
|
||||
// : res.data.map((i) => ({ label: i.name, value: i.id }))
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
this.handleClose();
|
||||
} else {
|
||||
this.$message({
|
||||
message: `${res.code}: ${res.msg}`,
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
if (this.btnLoading) this.btnLoading = false
|
||||
}
|
||||
})
|
||||
.catch((errMsg) => {
|
||||
this.$message.error("参数错误:" + errMsg);
|
||||
if (this.loadingStatus) this.loadingStatus = false;
|
||||
if (this.btnLoading) this.btnLoading = false
|
||||
});
|
||||
} else {
|
||||
this.$message.error("请核查字段信息");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
handleTabClick(payload) {
|
||||
// console.log("tab click payload: ", this.activeMenu);
|
||||
// if (this.activeMenu === this.configs.menu[1].name) {
|
||||
// // 获取数据
|
||||
// this.getSubList();
|
||||
// }
|
||||
},
|
||||
|
||||
handlePageChange(val) {
|
||||
this.getSubList(val, this.attrSize);
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.attrPage = 1;
|
||||
this.attrSize = val
|
||||
this.getSubList(1, val);
|
||||
},
|
||||
|
||||
getSubList(page, size) {
|
||||
const params = {};
|
||||
params.page = page ?? this.attrPage;
|
||||
params.limit = size ?? this.attrSize;
|
||||
|
||||
const requiredParams = this.configs.table.extraParams;
|
||||
if (requiredParams) {
|
||||
if (Array.isArray(requiredParams)) {
|
||||
requiredParams.forEach((str) => {
|
||||
if (/id/i.test(str)) {
|
||||
params[str] = this.dataForm.id;
|
||||
} else {
|
||||
params[str] = "";
|
||||
}
|
||||
});
|
||||
} else if (typeof requiredParams === "string") {
|
||||
// 如果需要额外参数,一般肯定需要
|
||||
params[this.configs.table.extraParams] = this.dataForm.id;
|
||||
// 此时 dataForm.id 一定是存在的
|
||||
}
|
||||
}
|
||||
this.$http.get(this.urls.subpage, { params }).then(({ data: res }) => {
|
||||
console.log("[DialogWithMenu] getSubList:", res);
|
||||
if (res.code === 0 && res.data?.list) {
|
||||
// 有数据
|
||||
this.subList = res.data.list;
|
||||
this.attrTotal = res.data.total;
|
||||
} else {
|
||||
this.subList.splice(0);
|
||||
this.attrTotal = 0;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleAddParam(id) {
|
||||
this.showSubDialog = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.subDialog.init(id ?? null);
|
||||
});
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
this.resetForm();
|
||||
this.$emit("update:dialogVisible", false);
|
||||
},
|
||||
|
||||
/** 列表handlers */
|
||||
handleAddItem() {
|
||||
// console.log('[dialog] handleAddItem ot list...');
|
||||
this.showBaseDialog = true;
|
||||
this.$nextTick(() => {
|
||||
console.log("[sub-dialog] ", this.$refs["sub-dialog"].init());
|
||||
});
|
||||
},
|
||||
handleTableRowOperate({ type, data }) {
|
||||
console.log("handleTableRowOperate", type, data);
|
||||
|
||||
switch (type) {
|
||||
case "delete": {
|
||||
// 确认是否删除
|
||||
console.log('delete....', data)
|
||||
const itemName = typeof data === 'object' ? (data.attrName || data.name || data.material || data.id) : data
|
||||
return this.$confirm(`是否删除条目: ${itemName}`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "我再想想",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
// this.$http.delete(this.urls.base + `/${data}`).then((res) => {
|
||||
this.$http({
|
||||
url: this.urls.subase,
|
||||
method: "DELETE",
|
||||
data: [`${data.id}`],
|
||||
}).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success({
|
||||
message: "删除成功!",
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.getSubList(1, 20);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => { });
|
||||
}
|
||||
case "edit": {
|
||||
this.handleAddParam(data); /** data is ==> id */
|
||||
break;
|
||||
}
|
||||
// case 'view-detail-action':
|
||||
// this.openDialog(data, true);
|
||||
// break;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-menu {
|
||||
margin: 16px 0 !important;
|
||||
}
|
||||
|
||||
.el-menu.el-menu--horizontal {
|
||||
border: none !important;
|
||||
/* background: #0f02 !important; */
|
||||
}
|
||||
|
||||
/* .el-menu--horizontal > .el-menu-item.is-active { */
|
||||
/* border-bottom-color: #0b58ff; */
|
||||
/* } */
|
||||
|
||||
.dialog-with-menu>>>.el-dialog__body {
|
||||
/* padding-top: 16px !important;
|
||||
padding-bottom: 16px !important; */
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.el-select,
|
||||
.el-cascader {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.dialog-with-menu>>>.el-dialog__header {
|
||||
padding: 10px 20px 10px;
|
||||
/* background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), white); */
|
||||
}
|
||||
|
||||
.relative {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.at-right-top {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
ul.file-list,
|
||||
ul.file-list>li {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.file-list {
|
||||
max-height: 20vh;
|
||||
overflow-y: auto;
|
||||
margin-top: 12px;
|
||||
/* width: 240px; */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
ul.file-list>li {
|
||||
border-radius: 4px;
|
||||
background-color: #edededd2;
|
||||
padding: 8px;
|
||||
margin-bottom: 2px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
ul.file-list>li:hover {
|
||||
background-color: #ededed;
|
||||
}
|
||||
|
||||
.file-operations {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.file-icon {
|
||||
margin-right: 8px;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
display: flex;
|
||||
place-content: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
/* .image-preview-dialog {
|
||||
} */
|
||||
|
||||
.force-disabled {
|
||||
margin-top: 42px;
|
||||
}
|
||||
</style>
|
@ -46,35 +46,36 @@
|
||||
}}文件大小不超过2MB
|
||||
</div>
|
||||
</el-upload>
|
||||
<!-- <div
|
||||
class="file-list__item"
|
||||
v-for="n in 9"
|
||||
:key="n"
|
||||
:style="{
|
||||
display: n > 4 && !expand ? 'none' : 'block',
|
||||
}"
|
||||
:data-name="n"
|
||||
:class="{ 'default-icon': !isPicMode }">
|
||||
<i class="el-icon-delete"></i>
|
||||
</div> -->
|
||||
<div
|
||||
class="file-list__item"
|
||||
v-for="(file, index) in files"
|
||||
:key="file.fileName"
|
||||
:style="{
|
||||
background: isPicMode
|
||||
? `url(${file.fileUrl}) no-repeat`
|
||||
: `url(${defaultBg}) no-repeat`,
|
||||
backgroundSize: isPicMode ? '100% 100%' : '64px',
|
||||
backgroundPosition: isPicMode ? '0% 0%' : 'center',
|
||||
}"
|
||||
:data-name="file.fileName">
|
||||
<el-button
|
||||
v-if="!disabled"
|
||||
type="text"
|
||||
class="el-icon-delete"
|
||||
style="padding: 0"
|
||||
@click="(e) => handleDelete(file)" />
|
||||
style="width: 100%">
|
||||
<div
|
||||
class="file-list__item"
|
||||
v-if="!isPicMode"
|
||||
:style="{
|
||||
background: isPicMode
|
||||
? `url(${file.fileUrl}) no-repeat`
|
||||
: `url(${defaultBg}) no-repeat`,
|
||||
backgroundSize: isPicMode ? '100% 100%' : '64px',
|
||||
backgroundPosition: isPicMode ? '0% 0%' : 'center',
|
||||
}"
|
||||
@click="handleDownload(file)"
|
||||
:data-name="file.fileName">
|
||||
<el-button
|
||||
v-if="!disabled"
|
||||
type="text"
|
||||
class="el-icon-delete"
|
||||
style="padding: 0"
|
||||
@click="(e) => handleDelete(file)" />
|
||||
</div>
|
||||
|
||||
<el-image
|
||||
v-else
|
||||
class="file-list__item"
|
||||
style="width: 100%"
|
||||
:src="file.fileUrl"
|
||||
:preview-src-list="files.map((item) => item.fileUrl)"></el-image>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
@ -189,6 +190,32 @@ export default {
|
||||
}, 500);
|
||||
},
|
||||
|
||||
async handleDownload(file) {
|
||||
if (this.isPicMode) {
|
||||
// this.$emit('preview', file);
|
||||
const link = document.createElement('a');
|
||||
link.href = file.fileUrl;
|
||||
link.target = '_blank';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
} else {
|
||||
// this.$emit('download', file);
|
||||
const data = await this.$axios({
|
||||
url: file.fileUrl,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
});
|
||||
const link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(new Blob([data]));
|
||||
link.download = file.fileName;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(link.href);
|
||||
}
|
||||
},
|
||||
|
||||
emitFilelist() {
|
||||
this.$emit('update', this.files);
|
||||
},
|
||||
|
@ -42,16 +42,26 @@
|
||||
v-model="form" />
|
||||
</div>
|
||||
|
||||
<div v-if="section.key == 'attrs'" style="margin-top: 12px">
|
||||
<div
|
||||
v-if="section.key == 'attrs'"
|
||||
style="margin-top: 12px; position: relative">
|
||||
<div
|
||||
v-if="!mode.includes('detail')"
|
||||
style="position: absolute; top: -40px; right: 0">
|
||||
<el-button @click="handleAddAttr" type="text">
|
||||
<i class="el-icon-plus"></i>
|
||||
添加属性
|
||||
</el-button>
|
||||
</div>
|
||||
<base-table
|
||||
v-loading="attrListLoading"
|
||||
:table-props="section.props"
|
||||
:page="attrQuery?.params.pageNo || 1"
|
||||
:limit="attrQuery?.params.pageSize || 10"
|
||||
:table-data="list"
|
||||
:add-button-show="mode.includes('detail') ? null : '添加属性'"
|
||||
@emitButtonClick="handleAddAttr"
|
||||
@emitFun="handleEmitFun">
|
||||
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
|
||||
@emitButtonClick="handleAddAttr" -->
|
||||
<method-btn
|
||||
v-if="section.tableBtn"
|
||||
slot="handleBtn"
|
||||
@ -76,7 +86,7 @@
|
||||
<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-else type="primary" @click="handleConfirm">确定</el-button>
|
||||
<el-button v-else type="primary" @click="handleConfirm">保存</el-button>
|
||||
<!-- sections的第二项必须是 属性列表 -->
|
||||
<!-- <el-button
|
||||
v-if="sections[1].allowAdd"
|
||||
@ -162,7 +172,9 @@ export default {
|
||||
input: true,
|
||||
label: '属性名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '属性名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '属性名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
|
@ -1,29 +1,62 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-data="list"
|
||||
@emitFun="handleEmitFun">
|
||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="120"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加) -->
|
||||
<base-dialog :dialogTitle="title" :dialogVisible="open" @close="cancel" @cancel="cancel" width="60%"
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
width="60%"
|
||||
@confirm="submitForm">
|
||||
<DialogForm v-if="open" key="index-dialog-form" ref="form" label-position="top" size="small" v-model="form"
|
||||
<DialogForm
|
||||
v-if="open"
|
||||
key="index-dialog-form"
|
||||
ref="form"
|
||||
label-position="top"
|
||||
size="small"
|
||||
v-model="form"
|
||||
:has-files="['files', 'files2']"
|
||||
:rows="computedRows" />
|
||||
</base-dialog>
|
||||
|
||||
<!-- 设备 详情 - 编辑 -->
|
||||
<EquipmentDrawer v-if="editVisible" ref="drawer" :mode="editMode" @update-mode="editMode = $event"
|
||||
:data-id="form.id" :sections="[
|
||||
<EquipmentDrawer
|
||||
v-if="editVisible"
|
||||
ref="drawer"
|
||||
:mode="editMode"
|
||||
@update-mode="editMode = $event"
|
||||
:data-id="form.id"
|
||||
:sections="[
|
||||
{
|
||||
name: '基本信息',
|
||||
key: 'base',
|
||||
@ -50,20 +83,23 @@
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:core-equipment-attr:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:core-equipment-attr:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
allowAdd: true,
|
||||
},
|
||||
]" @refreshDataList="getList" @cancel="cancelEdit" @destroy="cancelEdit" />
|
||||
]"
|
||||
@refreshDataList="getList"
|
||||
@cancel="cancelEdit"
|
||||
@destroy="cancelEdit" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -96,21 +132,21 @@ export default {
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:core-equipment:update`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '详情',
|
||||
}
|
||||
type: 'detail',
|
||||
btnName: '详情',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:core-equipment:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:core-equipment:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
tableProps: [
|
||||
@ -176,14 +212,18 @@ export default {
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:core-equipment:export') ? 'button' : '',
|
||||
type: this.$auth.hasPermi('base:core-equipment:export')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '导出',
|
||||
name: 'export',
|
||||
plain: true,
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:core-equipment:create') ? 'button' : '',
|
||||
type: this.$auth.hasPermi('base:core-equipment:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
plain: true,
|
||||
@ -196,7 +236,9 @@ export default {
|
||||
input: true,
|
||||
label: '设备名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '设备名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
// bind: {
|
||||
// disabled: this.editMode == 'detail', // some condition, like detail mode...
|
||||
// }
|
||||
@ -225,7 +267,9 @@ export default {
|
||||
label: '设备类型',
|
||||
prop: 'equipmentTypeId',
|
||||
url: '/base/core-equipment-type/page?pageNo=1&pageSize=100',
|
||||
rules: [{ required: true, message: '设备类型不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '设备类型不能为空', trigger: 'blur' },
|
||||
],
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
@ -235,7 +279,11 @@ export default {
|
||||
label: '预计生产时间(min/天)',
|
||||
prop: 'workTime',
|
||||
rules: [
|
||||
{ required: true, message: '预计生产时间不能为空', trigger: 'blur' },
|
||||
{
|
||||
required: true,
|
||||
message: '预计生产时间不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入正确的数字值',
|
||||
@ -291,7 +339,11 @@ export default {
|
||||
label: '单件产品加工时间(s)',
|
||||
prop: 'processingTime',
|
||||
rules: [
|
||||
{ required: true, message: '单件产品加工时间不能为空', trigger: 'blur' },
|
||||
{
|
||||
required: true,
|
||||
message: '单件产品加工时间不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入正确的数字值',
|
||||
@ -322,13 +374,19 @@ export default {
|
||||
[
|
||||
{
|
||||
upload: true,
|
||||
label: '上传资料',
|
||||
label: '设备资料',
|
||||
prop: 'files',
|
||||
},
|
||||
],
|
||||
[
|
||||
{ input: true, label: '备注', prop: 'remark' }
|
||||
{
|
||||
upload: true,
|
||||
label: '设备图片',
|
||||
prop: 'files2',
|
||||
fileType: 1,
|
||||
},
|
||||
],
|
||||
[{ input: true, label: '备注', prop: 'remark' }],
|
||||
// [
|
||||
// {
|
||||
// assetUpload: true,
|
||||
@ -429,7 +487,7 @@ export default {
|
||||
// 表单参数
|
||||
form: {
|
||||
id: null,
|
||||
files: []
|
||||
files: [],
|
||||
},
|
||||
showUploadComponents: false, // 是否显示上传组件
|
||||
};
|
||||
@ -441,36 +499,36 @@ export default {
|
||||
computedRows() {
|
||||
return this.showUploadComponents
|
||||
? [
|
||||
...this.rows,
|
||||
[
|
||||
{
|
||||
assetUpload: true,
|
||||
key: 'eq-assets', // 用于区分不同的上传组件
|
||||
label: '上传资料',
|
||||
fieldName: 'assets',
|
||||
subcomponent: AssetsUpload,
|
||||
prop: 'uploadedAssets',
|
||||
default: [],
|
||||
bind: {
|
||||
'is-pic-mode': false,
|
||||
...this.rows,
|
||||
[
|
||||
{
|
||||
assetUpload: true,
|
||||
key: 'eq-assets', // 用于区分不同的上传组件
|
||||
label: '上传资料',
|
||||
fieldName: 'assets',
|
||||
subcomponent: AssetsUpload,
|
||||
prop: 'uploadedAssets',
|
||||
default: [],
|
||||
bind: {
|
||||
'is-pic-mode': false,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
assetUpload: true,
|
||||
key: 'eq-pics', // 用于区分不同的上传组件
|
||||
label: '上传图片',
|
||||
fieldName: 'images',
|
||||
subcomponent: AssetsUpload,
|
||||
// prop: '',
|
||||
// default: [],
|
||||
bind: {
|
||||
'is-pic-mode': true,
|
||||
],
|
||||
[
|
||||
{
|
||||
assetUpload: true,
|
||||
key: 'eq-pics', // 用于区分不同的上传组件
|
||||
label: '上传图片',
|
||||
fieldName: 'images',
|
||||
subcomponent: AssetsUpload,
|
||||
// prop: '',
|
||||
// default: [],
|
||||
bind: {
|
||||
'is-pic-mode': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
: this.rows;
|
||||
},
|
||||
},
|
||||
@ -512,7 +570,8 @@ export default {
|
||||
spec: undefined,
|
||||
description: undefined,
|
||||
remark: undefined,
|
||||
files: []
|
||||
files: [],
|
||||
files2: [],
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
@ -540,9 +599,12 @@ export default {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const payload = Object.assign({}, this.form);
|
||||
payload.files = [...payload.files, ...payload.files2];
|
||||
delete payload.files2;
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateEquipment(this.form).then((response) => {
|
||||
updateEquipment(payload).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@ -550,7 +612,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createEquipment(this.form).then((response) => {
|
||||
createEquipment(payload).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@ -569,7 +631,7 @@ export default {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
@ -587,7 +649,7 @@ export default {
|
||||
this.$download.excel(response, '设备.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
},
|
||||
// 查看详情
|
||||
viewDetail(id) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-25 11:25:23
|
||||
* @LastEditTime: 2023-11-27 20:12:00
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -11,7 +11,7 @@
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
label-width="100px">
|
||||
label-width="90px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="原料名称" prop="name">
|
||||
|
@ -29,7 +29,7 @@
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
:before-close="handleCancel"
|
||||
width="50%">
|
||||
width="45%">
|
||||
<add-or-update
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="successSubmit"></add-or-update>
|
||||
|
@ -2,14 +2,14 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-27 09:23:56
|
||||
* @LastEditTime: 2023-11-27 20:07:09
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer
|
||||
:visible.sync="visible"
|
||||
:show-close="false"
|
||||
:wrapper-closable="false"
|
||||
:wrapper-closable="isdetail"
|
||||
class="drawer"
|
||||
size="60%">
|
||||
<small-title slot="title" :no-padding="true">
|
||||
@ -114,14 +114,6 @@
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="drawer-body__footer">
|
||||
<el-button v-if="!idAttrShow" @click="goback()">取消</el-button>
|
||||
<el-button v-else :disabled="isdetail" @click="init(dataForm.id)">重置</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</div>
|
||||
|
||||
<div class="attr-list" v-if="idAttrShow">
|
||||
<small-title
|
||||
@ -158,14 +150,16 @@
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page-sizes="[5, 10, 15]"
|
||||
@pagination="getList" />
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button type="primary" @click="goback()">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div v-if="!isdetail" class="drawer-body__footer">
|
||||
<el-button @click="goback()">取消</el-button>
|
||||
<el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</div>
|
||||
|
||||
<attr-add
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
@ -270,11 +264,7 @@ export default {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${
|
||||
raw.data.attrName
|
||||
? '[名称=' + raw.data.attrName + ']'
|
||||
: '[序号=' + raw.data._pageIndex + ']'
|
||||
}进行删除操作?`,
|
||||
`是否确认删除属性名为"${raw.data.name}"的数据项?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
|
@ -84,18 +84,18 @@ export default {
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:core-product:detail`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '查看详情',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:core-product:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:core-product:detail`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '查看详情',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:core-product:delete`)
|
||||
? {
|
||||
type: 'delete',
|
||||
@ -141,6 +141,27 @@ export default {
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
// 删除
|
||||
deleteHandle(id, name, index) {
|
||||
this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.urlOptions.deleteURL(id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
// 查看详情
|
||||
otherMethods(val) {
|
||||
if (val.type === 'detail') {
|
||||
|
@ -105,7 +105,7 @@ export default {
|
||||
formConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '关键字',
|
||||
label: '供应商',
|
||||
placeholder: '供应商名称',
|
||||
param: 'name',
|
||||
},
|
||||
|
@ -1,21 +1,19 @@
|
||||
<template>
|
||||
<el-form ref="dataForm" :rules="rules" label-width="130px" :model="dataForm">
|
||||
<el-row>
|
||||
<el-col :span='12'>
|
||||
<el-form ref="dataForm" :rules="rules" label-width="130px" :model="dataForm" label-position="top">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="工单名称" prop="name">
|
||||
<el-input v-model="dataForm.name"></el-input>
|
||||
<el-input v-model="dataForm.name" placeholder="请输入工单名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="工单编码" prop="code">
|
||||
<el-input v-model="dataForm.code" disabled></el-input>
|
||||
<el-input v-model="dataForm.code" disabled placeholder="请输入工单编码"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span='12'>
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="产品名称" prop="planProductId">
|
||||
<el-select v-model="dataForm.planProductId" placeholder="请选择" style="width: 100%;" @change="selectProduct">
|
||||
<el-select v-model="dataForm.planProductId" placeholder="请选择产品" style="width: 100%;" @change="selectProduct">
|
||||
<el-option
|
||||
v-for="item in productList"
|
||||
:key="item.id"
|
||||
@ -25,52 +23,50 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="产品规格" prop="specifications">
|
||||
<el-input v-model="dataForm.specifications" />
|
||||
<el-input v-model="dataForm.specifications" placeholder="请输入产品规格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span='12'>
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="计划开始时间">
|
||||
<el-date-picker
|
||||
v-model="dataForm.planStartTime"
|
||||
type="datetime"
|
||||
value-format="timestamp"
|
||||
style="width: 100%;"
|
||||
placeholder="选择日期">
|
||||
placeholder="请选择计划开始时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="计划完成时间">
|
||||
<el-date-picker
|
||||
v-model="dataForm.planFinishTime"
|
||||
type="datetime"
|
||||
value-format="timestamp"
|
||||
style="width: 100%;"
|
||||
placeholder="选择日期">
|
||||
placeholder="请选择计划完成时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span='12'>
|
||||
<el-row :gutter="20">
|
||||
<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>
|
||||
<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='12'>
|
||||
<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>
|
||||
<el-input-number v-model="dataForm.planQuantity" :min="0" :max="9999999999999" style="width: 100%;" placeholder="请输入计划生产数量"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span='12'>
|
||||
<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-select v-model="dataForm.processFlowId" placeholder="请选择关联工艺" clearable filterable style="width: 100%;" @change="processFlowIdChange">
|
||||
<el-option
|
||||
v-for="item in processFlowList"
|
||||
:key="item.id"
|
||||
@ -80,19 +76,23 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
</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-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-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-row>
|
||||
<el-row>
|
||||
<el-col :span='12'>
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="优先级" prop="priority">
|
||||
<el-select v-model="dataForm.priority" placeholder="请选择" style="width: 100%;">
|
||||
<el-select v-model="dataForm.priority" placeholder="请选择优先级" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in getDictDatas(DICT_TYPE.ORDER_PRIORITY)"
|
||||
:key="item.value"
|
||||
@ -102,9 +102,9 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="工单类型" prop="type">
|
||||
<el-select v-model="dataForm.type" placeholder="请选择" style="width: 100%;">
|
||||
<el-select v-model="dataForm.type" placeholder="请选择工单类型" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in workOrderTypeList"
|
||||
:key="item.id"
|
||||
@ -115,10 +115,10 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span='12'>
|
||||
<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-select v-model="dataForm.productLineIds" placeholder="请选择关联产线" multiple style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in productLineList"
|
||||
:key="item.id"
|
||||
@ -128,9 +128,9 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-col :span='8'>
|
||||
<el-form-item label="负责人" prop="workers">
|
||||
<el-input v-model="dataForm.workers"></el-input>
|
||||
<el-input v-model="dataForm.workers" placeholder="请输入负责人"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -65,7 +65,8 @@ const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
filter: parseTime
|
||||
filter: parseTime,
|
||||
'show-overflow-tooltip': true
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
@ -127,48 +128,10 @@ export default {
|
||||
allocationVisible: false,
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:core-work-order:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
showParam: {
|
||||
type: '&',
|
||||
data: [
|
||||
{
|
||||
name: 'status',
|
||||
type: 'equal',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:core-work-order:detail`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '查看详情',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:core-work-order:delete`)
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
showParam: {
|
||||
type: '|',
|
||||
data: [
|
||||
{
|
||||
name: 'status',
|
||||
type: 'equal',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:core-work-order:material`)
|
||||
this.$auth.hasPermi(`base:core-work-order:material`)
|
||||
? {
|
||||
type: 'material',
|
||||
btnName: '预使用原料信息',
|
||||
btnName: '原料信息',
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
@ -246,7 +209,45 @@ export default {
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
this.$auth.hasPermi(`base:core-work-order:detail`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '查看详情',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:core-work-order:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
showParam: {
|
||||
type: '&',
|
||||
data: [
|
||||
{
|
||||
name: 'status',
|
||||
type: 'equal',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:core-work-order:delete`)
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
showParam: {
|
||||
type: '|',
|
||||
data: [
|
||||
{
|
||||
name: 'status',
|
||||
type: 'equal',
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
: undefined
|
||||
].filter((v)=>v),
|
||||
tableData: [],
|
||||
formConfig: [
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-27 09:36:44
|
||||
* @LastEditTime: 2023-11-27 15:26:12
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -120,6 +120,7 @@
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="attr-list" v-if="idAttrShow">
|
||||
<small-title
|
||||
style="margin: 16px 0; padding-left: 8px"
|
||||
@ -158,11 +159,9 @@
|
||||
|
||||
<div v-if="!isdetail" class="drawer-body__footer">
|
||||
<el-button style="" @click="goback()">取消</el-button>
|
||||
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button> -->
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<attr-add
|
||||
@ -293,11 +292,7 @@ export default {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${
|
||||
raw.data.attrName
|
||||
? '[名称=' + raw.data.attrName + ']'
|
||||
: '[序号=' + raw.data._pageIndex + ']'
|
||||
}进行删除操作?`,
|
||||
`是否确认删除属性名为"${raw.data.attrName}"的数据项?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
@ -363,6 +358,29 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 表单提交
|
||||
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.idAttrShow = true
|
||||
this.$emit("refreshDataList");
|
||||
});
|
||||
});
|
||||
},
|
||||
goback() {
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:width="'35%'"
|
||||
:width="'30%'"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="false"
|
||||
class="dialog">
|
||||
@ -17,7 +17,7 @@
|
||||
ref="dataForm"
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
label-width="100px"
|
||||
label-width="70px"
|
||||
@keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item label="属性名" prop="attrName">
|
||||
<el-input
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-06 19:55:59
|
||||
* @LastEditTime: 2023-11-27 15:10:20
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -18,7 +18,8 @@
|
||||
<el-select
|
||||
v-model="dataForm.materialId"
|
||||
placeholder="请选择物料"
|
||||
@change="setMaterialCode">
|
||||
@change="setMaterialCode"
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in materialList"
|
||||
:key="dict.id"
|
||||
|
@ -29,7 +29,7 @@
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
:before-close="handleCancel"
|
||||
width="50%">
|
||||
width="40%">
|
||||
<add-or-update
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="successSubmit"></add-or-update>
|
||||
|
@ -2,14 +2,14 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-25 19:10:12
|
||||
* @LastEditTime: 2023-11-27 19:50:36
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer
|
||||
:visible.sync="visible"
|
||||
:show-close="false"
|
||||
:wrapper-closable="false"
|
||||
:wrapper-closable="isdetail"
|
||||
class="drawer"
|
||||
size="70%">
|
||||
<small-title slot="title" :no-padding="true">
|
||||
@ -25,7 +25,7 @@
|
||||
label-width="100px"
|
||||
label-position="top">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="产品名称" prop="productId">
|
||||
<el-select
|
||||
v-model="dataForm.productId"
|
||||
@ -42,15 +42,17 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="产品BOM编码" prop="code">
|
||||
<el-input v-model="dataForm.code" :disabled="isdetail" placeholder="请输入产品Bom编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="attr-list" v-if="idAttrShow">
|
||||
@ -60,92 +62,26 @@
|
||||
BOM明细
|
||||
</small-title>
|
||||
|
||||
<!-- <base-table
|
||||
<div v-if="!isdetail" class="action_btn">
|
||||
<template>
|
||||
<span style="display: inline-block;">
|
||||
<el-button type="text" @click="addNew()" icon="el-icon-plus">添加</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="listQuery.pageNo"
|
||||
:limit="listQuery.pageSize"
|
||||
:add-button-show="isdetail ? null : '添加属性'"
|
||||
@emitButtonClick="addNew()"
|
||||
:table-data="materialAttrList">
|
||||
:table-data="tableData">
|
||||
<method-btn
|
||||
v-if="!isdetail"
|
||||
slot="handleBtn"
|
||||
:width="120"
|
||||
:width="90"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table> -->
|
||||
<el-button v-show="!isdetail" type="success" size="small" style="float: right" @click="addRow()">添加一行</el-button>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%">
|
||||
<el-table-column type="index" label="序号" />
|
||||
<el-table-column prop="createTime" label="添加时间">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="materialId" label="物料名称*">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.materialId"
|
||||
filterable
|
||||
clearable
|
||||
:disabled="!scope.row.isEdit"
|
||||
placeholder="请选择物料"
|
||||
@change="setCode(scope.row)">
|
||||
<el-option
|
||||
v-for="dict in materialList"
|
||||
:key="dict.id"
|
||||
:label="dict.name"
|
||||
:value="dict.id" />
|
||||
</el-select>
|
||||
<span v-if="scope.row.isShow" style="color: red">物料不可为空!</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="materialCode" label="物料编码" />
|
||||
<el-table-column prop="mUnit" label="单位" />
|
||||
<el-table-column prop="num" label="数量*">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model.number="scope.row.num" :disabled="!scope.row.isEdit" @input="changeNum(scope.row)"></el-input>
|
||||
<span v-if="scope.row.isNum" style="color: red">数量不可为空!</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.remark" :disabled="!scope.row.isEdit"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!isdetail" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip v-if="!scope.row.isEdit" placement="top" content="编辑">
|
||||
<el-button
|
||||
type="text"
|
||||
:style="{color:'#0B58FF'}"
|
||||
size="mini"
|
||||
@click="edit(scope.row)"
|
||||
>
|
||||
<!-- 此处的icon的名字命名为'table_'加上按钮的type -->
|
||||
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" />
|
||||
<!-- <span>{{ item.btnName | i18nFilter }}</span> -->
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-button v-else type="text" size="small" @click="saveData(scope.row)">保存</el-button>
|
||||
<el-tooltip placement="top" content="删除">
|
||||
<el-button
|
||||
type="text"
|
||||
:style="{color:'#FF5454'}"
|
||||
size="mini"
|
||||
@click="deleteDetail(scope.row)"
|
||||
>
|
||||
<!-- 此处的icon的名字命名为'table_'加上按钮的type -->
|
||||
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="table_delete" />
|
||||
<!-- <span>{{ item.btnName | i18nFilter }}</span> -->
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="listQuery.total > 0"
|
||||
:total="listQuery.total"
|
||||
@ -155,20 +91,17 @@
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button style="" @click="goback()">{{ isdetail ? '关闭' : '取消' }}</el-button>
|
||||
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button> -->
|
||||
<el-button v-if="!isdetail" type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
<div v-if="!isdetail" class="drawer-body__footer">
|
||||
<el-button style="" @click="goback()">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <attr-add
|
||||
<attr-add
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
:material-id="dataForm.id"
|
||||
@refreshDataList="getList" /> -->
|
||||
:bom-id="dataForm.id"
|
||||
@refreshDataList="getList" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
@ -179,7 +112,8 @@ import { getMaterialList } from "@/api/base/material";
|
||||
import { listData } from "@/api/system/dict/data";
|
||||
import SmallTitle from '../material/SmallTitle';
|
||||
import { parseTime } from '../../core/mixins/code-filter';
|
||||
// import attrAdd from './attr-add';
|
||||
import attrAdd from './attr-add';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
@ -198,18 +132,31 @@ const tableProps = [
|
||||
filter: parseTime,
|
||||
},
|
||||
{
|
||||
prop: 'attrName',
|
||||
label: '属性名',
|
||||
prop: 'materialName',
|
||||
label: '物料名称',
|
||||
},
|
||||
{
|
||||
prop: 'attrValue',
|
||||
label: '属性值',
|
||||
prop: 'materialCode',
|
||||
label: '物料编码',
|
||||
},
|
||||
{
|
||||
prop: 'unit',
|
||||
label: '单位',
|
||||
filter: publicFormatter('unit_dict'),
|
||||
},
|
||||
{
|
||||
prop: 'num',
|
||||
label: '数量',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
}
|
||||
];
|
||||
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
components: { SmallTitle },
|
||||
components: { SmallTitle, attrAdd },
|
||||
data() {
|
||||
return {
|
||||
tableBtn,
|
||||
@ -235,7 +182,6 @@ export default {
|
||||
},
|
||||
productList: [],
|
||||
materialAttrList: [],
|
||||
materialList: [],
|
||||
tableData: [],
|
||||
unitList: [],
|
||||
visible: false,
|
||||
@ -250,13 +196,42 @@ export default {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.deleteDetail(raw.data);
|
||||
} else {
|
||||
this.addNew(raw.data.id);
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
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.idAttrShow = true;
|
||||
this.dataForm.id = response.data
|
||||
this.$emit("refreshDataList");
|
||||
});
|
||||
});
|
||||
},
|
||||
async getDict() {
|
||||
// 产品列表
|
||||
const proRes = await getProList();
|
||||
this.productList = proRes.data;
|
||||
// 物料列表
|
||||
const res = await getMaterialList();
|
||||
this.materialList = res.data;
|
||||
// 物料单位列表
|
||||
const unitRes = await listData({
|
||||
pageNo: 1,
|
||||
@ -276,8 +251,7 @@ export default {
|
||||
},
|
||||
deleteDetail(raw) {
|
||||
this.$confirm(
|
||||
`确定删除关于物料编码为${
|
||||
raw.materialCode}的数据?`,
|
||||
`是否确认删除物料名称为"${raw.materialName}"的数据项?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
@ -299,88 +273,13 @@ export default {
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
changeNum(row) {
|
||||
if (row.num !== '') {
|
||||
row.isNum = false
|
||||
} else {
|
||||
row.isNum = true
|
||||
}
|
||||
},
|
||||
setCode(row) {
|
||||
if (row.materialId) {
|
||||
row.isShow = false
|
||||
const tempM = this.materialList.filter(item => {
|
||||
if (row.materialId === item.id) {
|
||||
row.materialCode = item.code
|
||||
}
|
||||
return row.materialId === item.id
|
||||
})
|
||||
if (tempM[0].unit) {
|
||||
this.unitList.filter(u => {
|
||||
if (tempM[0].unit === u.value) {
|
||||
row.unit = u.value
|
||||
row.mUnit = u.label
|
||||
}
|
||||
})
|
||||
} else {
|
||||
row.unit = null
|
||||
row.mUnit = ''
|
||||
}
|
||||
} else {
|
||||
row.isShow = true
|
||||
row.unit = null
|
||||
row.mUnit = ''
|
||||
}
|
||||
// row.materialCode = tempList[0].code
|
||||
// row.unit = tempList[0].unit
|
||||
},
|
||||
edit(row) {
|
||||
row.isEdit = true
|
||||
},
|
||||
saveData(row) {
|
||||
if (row.materialId) {
|
||||
// this.$refs['dataForm'].validate((valid) => {
|
||||
// if (valid) {
|
||||
// 修改的提交
|
||||
if (row.id) {
|
||||
updateMaterialPBDet({
|
||||
...row
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
// this.visible = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createMaterialPBDet({
|
||||
...row
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
// this.visible = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
this.$message.warning('请选择物料!')
|
||||
}
|
||||
// }
|
||||
// });
|
||||
},
|
||||
getList() {
|
||||
// 获取产品Bom详细列表
|
||||
getProBomList({
|
||||
...this.listQuery,
|
||||
bomId: this.dataForm.id
|
||||
}).then((response) => {
|
||||
this.tableData = response.data.records.map(item => {
|
||||
this.unitList.filter(u => {
|
||||
if (item.unit === u.value) {
|
||||
item.mUnit = u.label
|
||||
}
|
||||
})
|
||||
item.isEdit = false
|
||||
return item
|
||||
});
|
||||
this.tableData = response.data.records
|
||||
this.listQuery.total = response.data.total;
|
||||
});
|
||||
},
|
||||
@ -476,7 +375,7 @@ export default {
|
||||
|
||||
.drawer >>> .visual-part {
|
||||
flex: 1 auto;
|
||||
max-height: 30vh;
|
||||
max-height: 20vh;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
padding-right: 10px; /* 调整滚动条样式 */
|
||||
@ -492,4 +391,12 @@ export default {
|
||||
justify-content: flex-end;
|
||||
padding: 18px;
|
||||
}
|
||||
.action_btn {
|
||||
float: right;
|
||||
margin: -40px 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.add {
|
||||
color: #0b58ff;
|
||||
}
|
||||
</style>
|
||||
|
197
src/views/base/materialProductBom/attr-add.vue
Normal file
197
src/views/base/materialProductBom/attr-add.vue
Normal file
@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:width="'40%'"
|
||||
: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="80px"
|
||||
@keyup.enter.native="dataFormSubmit()">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料名称" prop="materialId">
|
||||
<el-select
|
||||
v-model="dataForm.materialId"
|
||||
placeholder="请选择物料"
|
||||
clearable
|
||||
filterable
|
||||
@change="setCode"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in materialList"
|
||||
:key="dict.id"
|
||||
:label="dict.name"
|
||||
:value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input
|
||||
v-model="dataForm.materialCode"
|
||||
clearable
|
||||
disabled
|
||||
placeholder="请输入物料编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-select
|
||||
v-model="dataForm.unit"
|
||||
style="width: 100%"
|
||||
disabled
|
||||
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-col :span="12">
|
||||
<el-form-item label="数量" prop="num">
|
||||
<el-input-number v-model="dataForm.num" controls-position="right" clearable placeholder="请输入数量" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
|
||||
</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 { getMaterialList } from '@/api/base/material';
|
||||
import { createMaterialPBDet, updateMaterialPBDet, getMaterialPBDet } from "@/api/base/materialProductBom";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
bomId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
materialId: '',
|
||||
num: 0,
|
||||
materialCode: undefined,
|
||||
unit: undefined,
|
||||
remark: '',
|
||||
},
|
||||
materialList: [],
|
||||
dataRule: {
|
||||
materialId: [{ required: true, message: '物料名称不能为空', trigger: 'change' }],
|
||||
num: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
async getDict() {
|
||||
// 物料列表
|
||||
const res = await getMaterialList();
|
||||
this.materialList = res.data;
|
||||
},
|
||||
init(id) {
|
||||
this.dataForm.id = id || '';
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
if (this.dataForm.id) {
|
||||
getMaterialPBDet(this.dataForm.id).then((res) => {
|
||||
this.dataForm = res.data
|
||||
this.setCode()
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
setCode() {
|
||||
const tempMaterial = this.materialList.filter(item =>{
|
||||
return item.id === this.dataForm.materialId
|
||||
})
|
||||
this.dataForm.materialCode = tempMaterial[0]?.code
|
||||
this.dataForm.unit = tempMaterial[0].unit === undefined ? undefined : String(tempMaterial[0]?.unit)
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
updateMaterialPBDet({
|
||||
...this.dataForm,
|
||||
bomId: this.bomId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createMaterialPBDet({
|
||||
...this.dataForm,
|
||||
bomId: this.bomId,
|
||||
}).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>
|
@ -13,7 +13,7 @@
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="220"
|
||||
:width="120"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
@ -68,24 +68,24 @@ export default {
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:material-product-bom:update`)
|
||||
this.$auth.hasPermi(`base:material-product-bom:queryMaterial`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '查看物料',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:material-product-bom:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:material-product-bom:queryMaterial`)
|
||||
? {
|
||||
type: 'search',
|
||||
btnName: '查看物料',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:material-product-bom:editMaterial`)
|
||||
? {
|
||||
type: 'editMaterial',
|
||||
btnName: '编辑物料',
|
||||
}
|
||||
: undefined,
|
||||
// this.$auth.hasPermi(`base:material-product-bom:editMaterial`)
|
||||
// ? {
|
||||
// type: 'editMaterial',
|
||||
// btnName: '编辑物料',
|
||||
// }
|
||||
// : undefined,
|
||||
this.$auth.hasPermi(`base:material-product-bom:delete`)
|
||||
? {
|
||||
type: 'delete',
|
||||
@ -123,7 +123,7 @@ export default {
|
||||
created() {},
|
||||
methods: {
|
||||
otherMethods(val) {
|
||||
if (val.type === 'search') {
|
||||
if (val.type === 'detail') {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrEditTitle = '详情';
|
||||
this.$nextTick(() => {
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-22 10:40:08
|
||||
* @LastEditTime: 2023-11-27 19:57:23
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -11,9 +11,10 @@
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
label-width="80px">
|
||||
label-width="80px"
|
||||
label-position="top">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料名称" prop="materialId">
|
||||
<el-select
|
||||
v-model="dataForm.materialId"
|
||||
@ -21,6 +22,7 @@
|
||||
clearable
|
||||
filterable
|
||||
@change="setCode"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in materialList"
|
||||
@ -30,7 +32,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input
|
||||
v-model="dataForm.materialCode"
|
||||
@ -39,15 +41,14 @@
|
||||
placeholder="请输入物料编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="批次号" prop="materialDateId">
|
||||
<el-select
|
||||
v-model="dataForm.materialDateId"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择物料批次"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in materialDateList"
|
||||
@ -57,13 +58,16 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="使用设备" prop="equipmentId">
|
||||
<el-select
|
||||
v-model="dataForm.equipmentId"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择使用设备">
|
||||
placeholder="请选择使用设备"
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in eqList"
|
||||
:key="dict.id"
|
||||
@ -72,9 +76,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="使用时间" prop="useTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.useTime"
|
||||
@ -84,14 +86,15 @@
|
||||
placeholder="选择日期时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="操作员" prop="userNames">
|
||||
<el-select
|
||||
v-model="dataForm.userNames"
|
||||
clearable
|
||||
filterable
|
||||
multiple
|
||||
placeholder="请选择操作员">
|
||||
placeholder="请选择操作员"
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in workersList"
|
||||
:key="dict.id"
|
||||
@ -102,12 +105,12 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="使用数量" prop="num">
|
||||
<el-input-number v-model="dataForm.num" clearable placeholder="请输入使用数量" />
|
||||
<el-input-number v-model="dataForm.num" clearable controls-position="right" placeholder="请输入使用数量" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="数据来源" prop="source">
|
||||
<el-select
|
||||
v-model="dataForm.source"
|
||||
@ -121,10 +124,12 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
@ -237,13 +242,8 @@ export default {
|
||||
this.dataForm.source = response.data.source
|
||||
this.dataForm.remark = response.data.remark
|
||||
this.dataForm.userNames = response.data.userName.split(',')
|
||||
console.log('打印', this.dataForm)
|
||||
});
|
||||
} else {
|
||||
if (this.urlOptions.isGetCode) {
|
||||
this.getCode()
|
||||
}
|
||||
}
|
||||
} else {}
|
||||
});
|
||||
},
|
||||
setCode() {
|
||||
|
@ -29,7 +29,7 @@
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
:before-close="handleCancel"
|
||||
width="50%">
|
||||
width="60%">
|
||||
<add-or-update
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="successSubmit"></add-or-update>
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2022-08-24 11:19:43
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-01 10:30:12
|
||||
* @LastEditTime: 2023-11-24 09:29:36
|
||||
* @Description:
|
||||
*/
|
||||
export default {
|
||||
@ -85,6 +85,7 @@ export default {
|
||||
},
|
||||
//tableBtn点击
|
||||
handleClick(val) {
|
||||
console.log(val.data.packagingCode);
|
||||
if (val.type === "edit") {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrEditTitle = "编辑";
|
||||
@ -92,7 +93,7 @@ export default {
|
||||
this.$refs.addOrUpdate.init(val.data.id);
|
||||
});
|
||||
} else if (val.type === "delete") {
|
||||
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
|
||||
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex,val.data.packagingCode )
|
||||
} else if (val.type === "change") {
|
||||
this.changeStatus(val.data.id)
|
||||
} else {
|
||||
@ -101,7 +102,7 @@ export default {
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id, name, index) {
|
||||
this.$confirm(`是否确认删除${name ? '[' + name + ']' : '[' + index + ']'}数据项?`, "提示", {
|
||||
this.$confirm(`是否确认删除${name ? ' 名称为'+ name : '[' + index + ']'}数据项?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-01 14:55:51
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-22 14:40:59
|
||||
* @LastEditTime: 2023-11-24 09:13:50
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -122,7 +122,8 @@ export default {
|
||||
selectOptions: [],
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
param: 'workOrderId'
|
||||
param: 'workOrderId',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
// parent: 'dateFilterType',
|
||||
@ -214,6 +215,26 @@ export default {
|
||||
// this.listQuery.total = response.data.total;
|
||||
})
|
||||
},
|
||||
deleteHandle(id, name, index, packagingCode) {
|
||||
this.$confirm(`是否确认删除${'[' + packagingCode + ']'}数据项?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.urlOptions.deleteURL(id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
handlePrint(id) {
|
||||
if (id) {
|
||||
getPackingModel(id).then(res => {
|
||||
|
270
src/views/core/analysis/balanceAnalysis/index copy.vue
Normal file
270
src/views/core/analysis/balanceAnalysis/index copy.vue
Normal file
@ -0,0 +1,270 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<search-bar
|
||||
:formConfigs="formConfig"
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="buttonClick" />
|
||||
|
||||
<div v-if="tableData.length">
|
||||
<el-tabs
|
||||
v-model="activeName"
|
||||
@tab-click="handleTabClick"
|
||||
style="height: 100%">
|
||||
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
|
||||
<!-- @emitFun="handleEmitFun"> -->
|
||||
<base-table
|
||||
v-if="mode == 'table'"
|
||||
:span-method="mergeColumnHandler"
|
||||
:page="1"
|
||||
:limit="999"
|
||||
:table-props="tableProps"
|
||||
:table-data="tableData" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000产线平衡分析图\u3000'" name="graph">
|
||||
<div class="graph" style="height: 100%">
|
||||
<!-- graph -->
|
||||
<!-- <Graph
|
||||
v-if="list.length"
|
||||
:equipment-list="list"
|
||||
:render="renderKey" /> -->
|
||||
<BalanceChart ref="lineChart" />
|
||||
<div v-if="list.length == 0" class="no-data-bg"></div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- <SearchBar :formConfigs="[{ label: '产线平衡分析图', type: 'title' }]" /> -->
|
||||
</div>
|
||||
<div v-else class="no-data-bg"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCT } from '@/api/core/analysis/index';
|
||||
import { getCorePLList } from '@/api/base/coreProductionLine';
|
||||
import BalanceChart from '../balanceChart';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BalanceChart,
|
||||
},
|
||||
// mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getCT,
|
||||
},
|
||||
activeName: 'table',
|
||||
tableProps: [],
|
||||
|
||||
tableData: [],
|
||||
listQuery: {
|
||||
// time: ''
|
||||
endTime: undefined,
|
||||
lineId: undefined,
|
||||
startTime: undefined,
|
||||
},
|
||||
timeList: [],
|
||||
spanArr: [],
|
||||
xData: [],
|
||||
yData: [],
|
||||
optionArrUrl: [getCorePLList],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '产线',
|
||||
selectOptions: [],
|
||||
param: 'lineIds',
|
||||
defaultSelect: '',
|
||||
multiple: false,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间',
|
||||
dateType: 'datetimerange',
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
width: 350,
|
||||
param: 'time',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getArr();
|
||||
},
|
||||
methods: {
|
||||
handleTabClick(tab, event) {
|
||||
if (tab.name == 'graph') this.renderKey = Math.random();
|
||||
},
|
||||
|
||||
getArr() {
|
||||
const params = {
|
||||
page: 1,
|
||||
limit: 500,
|
||||
};
|
||||
this.optionArrUrl.forEach((item, index) => {
|
||||
item(params).then((response) => {
|
||||
this.formConfig[index].selectOptions = response.data;
|
||||
});
|
||||
});
|
||||
},
|
||||
setRowSpan(arr) {
|
||||
let count = 0;
|
||||
arr.forEach((item, index) => {
|
||||
if (index === 0) {
|
||||
this.spanArr.push(1);
|
||||
} else {
|
||||
if (item === arr[index - 1]) {
|
||||
this.spanArr[count] += 1;
|
||||
this.spanArr.push(0);
|
||||
} else {
|
||||
count = index;
|
||||
this.spanArr.push(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 合并table列的规则 */
|
||||
mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
|
||||
if (columnIndex == 0) {
|
||||
if (this.spanArr[rowIndex]) {
|
||||
return [
|
||||
this.spanArr[rowIndex], // row span
|
||||
1, // col span
|
||||
];
|
||||
} else {
|
||||
return [0, 0];
|
||||
}
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
// this.listQuery.lineId = '1672847052717821953'
|
||||
// this.listQuery.startTime = '1693497600000';
|
||||
// this.listQuery.endTime = '1693843200000';
|
||||
this.urlOptions.getDataListURL(this.listQuery).then((res) => {
|
||||
console.log(res);
|
||||
let arr = [
|
||||
{
|
||||
prop: 'sectionName',
|
||||
label: '工段',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'equName',
|
||||
label: '设备',
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
let sectionArr = [];
|
||||
res.data.data.forEach((ele, index) => {
|
||||
let tempData = [];
|
||||
let eqData = [];
|
||||
let plData = [];
|
||||
ele.data.forEach((item, index) => {
|
||||
item.children.forEach((params) => {
|
||||
if (params.dynamicName === '设备CT') {
|
||||
tempData[item.dynamicName + '_eq'] = params.dynamicValue;
|
||||
eqData[index] = params.dynamicValue;
|
||||
} else {
|
||||
tempData[item.dynamicName + '_pl'] = params.dynamicValue;
|
||||
plData[index] = params.dynamicValue;
|
||||
}
|
||||
});
|
||||
});
|
||||
const equipment = {
|
||||
name: ele.equName,
|
||||
eqData: eqData,
|
||||
plData: plData,
|
||||
};
|
||||
tempData['equName'] = ele.equName;
|
||||
tempData['sectionName'] = ele.sectionName;
|
||||
this.tableData.push(tempData);
|
||||
const { sectionName } = tempData;
|
||||
sectionArr.push(sectionName);
|
||||
this.yData.push(equipment);
|
||||
console.log('看看equ', this.yData);
|
||||
});
|
||||
this.setRowSpan(sectionArr);
|
||||
res.data.nameData.forEach((item) => {
|
||||
this.timeList.push(item.name);
|
||||
});
|
||||
const timeArray = Array.from(new Set(this.timeList));
|
||||
for (const times of timeArray) {
|
||||
if (times !== '设备CT' && times !== '产线CT') {
|
||||
const subprop = {
|
||||
label: times,
|
||||
align: 'center',
|
||||
children: [
|
||||
{ prop: times + '_eq', label: '设备CT', align: 'center' },
|
||||
{ prop: times + '_pl', label: '产线CT', align: 'center' },
|
||||
],
|
||||
};
|
||||
arr.push(subprop);
|
||||
this.xData.push(times);
|
||||
}
|
||||
}
|
||||
this.tableProps = arr;
|
||||
|
||||
console.log('表格横坐标', this.xData, this.yData);
|
||||
this.$nextTick(() => {
|
||||
this.$refs.lineChart.initChart(this.xData, this.yData);
|
||||
});
|
||||
// this.total = response.data.total;
|
||||
// this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
buttonClick(val) {
|
||||
// console.log(val)
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
// this.listQuery.pageNo = 1;
|
||||
// this.listQuery.pageSize = 10;
|
||||
this.listQuery.lineId = val.lineIds;
|
||||
this.listQuery.startTime = val.time
|
||||
? String(new Date(val.time[0]).getTime())
|
||||
: undefined;
|
||||
this.listQuery.endTime = val.time
|
||||
? String(new Date(val.time[1]).getTime())
|
||||
: undefined;
|
||||
if (val.time && val.lineIds) {
|
||||
this.tableData = [];
|
||||
this.xData = [];
|
||||
this.yData = [];
|
||||
this.tableProps = [];
|
||||
this.spanArr = [];
|
||||
this.timeList = [];
|
||||
this.getData();
|
||||
} else {
|
||||
this.$message({
|
||||
message: '请选择产线和时间',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.listQuery = {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
};
|
||||
this.getDataList();
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -1,137 +1,235 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||
<div v-if="tableData.length">
|
||||
<base-table v-loading="dataListLoading" :span-method="mergeColumnHandler" :table-props="tableProps" :table-data="tableData" />
|
||||
<SearchBar :formConfigs="[{ label: '产线平衡分析图', type: 'title' }]" />
|
||||
<BalanceChart ref="lineChart" />
|
||||
</div>
|
||||
<div v-else class="no-data-bg"></div>
|
||||
<!-- <pagination
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page.sync="listQuery.pageNo"
|
||||
:total="listQuery.total"
|
||||
@pagination="getDataList" /> -->
|
||||
</div>
|
||||
<div class="app-container">
|
||||
<search-bar
|
||||
:formConfigs="formConfig"
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- <div v-if="tableData.length"> -->
|
||||
<el-tabs
|
||||
v-model="activeName"
|
||||
@tab-click="handleTabClick"
|
||||
style="height: 100%">
|
||||
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
|
||||
<!-- @emitFun="handleEmitFun"> -->
|
||||
<base-table
|
||||
v-if="activeName == 'table'"
|
||||
:span-method="mergeColumnHandler"
|
||||
:page="1"
|
||||
:limit="999"
|
||||
:table-props="tableProps"
|
||||
:table-data="tableData" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000产线平衡分析图\u3000'" name="graph">
|
||||
<div class="graph" style="height: 100%">
|
||||
<!-- graph -->
|
||||
<!-- <Graph
|
||||
v-if="list.length"
|
||||
:equipment-list="list"
|
||||
:render="renderKey" /> -->
|
||||
<!-- <BalanceChart ref="lineChart" /> -->
|
||||
<div v-if="list.length == 0" class="no-data-bg"></div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- <SearchBar :formConfigs="[{ label: '产线平衡分析图', type: 'title' }]" /> -->
|
||||
<!-- </div>
|
||||
<div v-else class="no-data-bg"></div> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import basicPage from '../../mixins/basic-page';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import { getCT } from '@/api/core/analysis/index';
|
||||
import { getCorePLList } from '@/api/base/coreProductionLine';
|
||||
import BalanceChart from '../balanceChart'
|
||||
import { time } from 'echarts';
|
||||
// import { getWorkshopSectionPage } from '@/api/core/base/workshopSection';
|
||||
|
||||
// const tableProps = [
|
||||
// // {
|
||||
// // prop: 'lineName',
|
||||
// // label: '产线',
|
||||
// // align: 'center',
|
||||
// // },
|
||||
// // {
|
||||
// // prop: 'sum',
|
||||
// // label: '合计',
|
||||
// // align: 'center',
|
||||
// // },
|
||||
// // {
|
||||
// // prop: 'dynamicValue',
|
||||
// // label: 'dynamicName',
|
||||
// // align: 'center',
|
||||
// // children:[
|
||||
|
||||
// // ]
|
||||
// // }
|
||||
// ];
|
||||
import BalanceChart from '../balanceChart';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BalanceChart
|
||||
},
|
||||
// mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getCT,
|
||||
},
|
||||
tableProps: [],
|
||||
dataListLoading: false,
|
||||
tableData: [],
|
||||
listQuery: {
|
||||
// time: ''
|
||||
endTime: undefined,
|
||||
lineId:undefined,
|
||||
startTime:undefined
|
||||
},
|
||||
timeList: [],
|
||||
spanArr: [],
|
||||
xData: [],
|
||||
yData: [],
|
||||
optionArrUrl: [getCorePLList],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '产线',
|
||||
selectOptions: [],
|
||||
param: 'lineIds',
|
||||
defaultSelect: '',
|
||||
multiple: false,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间',
|
||||
dateType: 'datetimerange',
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
width: 350,
|
||||
param: 'time',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
}
|
||||
],
|
||||
};
|
||||
},
|
||||
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
|
||||
});
|
||||
});
|
||||
},
|
||||
setRowSpan(arr) {
|
||||
let count = 0
|
||||
arr.forEach((item, index) => {
|
||||
if(index === 0) {
|
||||
this.spanArr.push(1)
|
||||
} else {
|
||||
if (item === arr[index - 1]) {
|
||||
this.spanArr[count] += 1
|
||||
this.spanArr.push(0)
|
||||
} else {
|
||||
count = index
|
||||
this.spanArr.push(1)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 合并table列的规则 */
|
||||
components: {
|
||||
BalanceChart,
|
||||
},
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
activeName: 'table',
|
||||
tableProps: [
|
||||
{
|
||||
prop: 'sectionName',
|
||||
label: '工段',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'equName',
|
||||
label: '设备',
|
||||
align: 'center',
|
||||
},
|
||||
],
|
||||
tableData: [],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '产线',
|
||||
selectOptions: [],
|
||||
param: 'lineIds',
|
||||
defaultSelect: '',
|
||||
multiple: false,
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间',
|
||||
dateType: 'monthrange',
|
||||
format: 'yyyy-MM',
|
||||
valueFormat: 'yyyy-MM-ddTHH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
width: 240,
|
||||
param: 'timeArr',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
],
|
||||
queryParams: {
|
||||
lineId: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getLine();
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleTabClick(tab, event) {
|
||||
if (tab.name == 'graph') this.renderKey = Math.random();
|
||||
},
|
||||
|
||||
/** 初始化 tableProps */
|
||||
initTableProps() {
|
||||
this.tableProps = [
|
||||
{
|
||||
prop: 'sectionName',
|
||||
label: '工段',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'equName',
|
||||
label: '设备',
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
/** 获取产线 */
|
||||
async getLine() {
|
||||
this.formConfig[0].selectOptions = [];
|
||||
const { code, data } = await this.http(
|
||||
'/base/core-production-line/listAll',
|
||||
'get'
|
||||
);
|
||||
if (code == 0) {
|
||||
this.formConfig[0].selectOptions = data;
|
||||
}
|
||||
},
|
||||
|
||||
/** 获取产线平衡数据 */
|
||||
async getCT() {
|
||||
const { code, data } = await this.http(
|
||||
'/analysis/equipment-analysis/getCT',
|
||||
'post',
|
||||
this.queryParams
|
||||
);
|
||||
if (code == 0) {
|
||||
return data;
|
||||
}
|
||||
return { data: [], nameData: [] };
|
||||
},
|
||||
|
||||
/** 解析数据 */
|
||||
async getList() {
|
||||
const { data, nameData } = await this.getCT();
|
||||
await this.buildProps(nameData);
|
||||
await this.buildTableData(data);
|
||||
const xxxx = this.tableData;
|
||||
debugger;
|
||||
},
|
||||
|
||||
buildProps(nameData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const dateArr = Array.from(
|
||||
new Set(
|
||||
nameData
|
||||
.map((item) => (item.tree == 1 ? item.name : undefined))
|
||||
.filter((v) => v)
|
||||
)
|
||||
);
|
||||
// 排个序
|
||||
dateArr.sort().forEach((date) => {
|
||||
this.tableProps.push({
|
||||
label: date,
|
||||
align: 'center',
|
||||
children: [
|
||||
{
|
||||
prop: date + '_eq_ct',
|
||||
label: '设备CT',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: date + '_eq_tt',
|
||||
label: '设备TT',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: date + '_pl_ct',
|
||||
label: '产线CT',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: date + '_pl_tt',
|
||||
label: '产线TT',
|
||||
align: 'center',
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
resolve();
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async buildTableData(data) {
|
||||
/** 处理 工段 分组 */
|
||||
const sectionList = data.map((item) => {});
|
||||
},
|
||||
|
||||
setRowSpan(arr) {
|
||||
let count = 0;
|
||||
arr.forEach((item, index) => {
|
||||
if (index === 0) {
|
||||
this.spanArr.push(1);
|
||||
} else {
|
||||
if (item === arr[index - 1]) {
|
||||
this.spanArr[count] += 1;
|
||||
this.spanArr.push(0);
|
||||
} else {
|
||||
count = index;
|
||||
this.spanArr.push(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** 合并table列的规则 */
|
||||
mergeColumnHandler({ row, column, rowIndex, columnIndex }) {
|
||||
if (columnIndex == 0) {
|
||||
if (this.spanArr[rowIndex]) {
|
||||
@ -144,119 +242,142 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
// this.listQuery.lineId = '1672847052717821953'
|
||||
// this.listQuery.startTime = '1693497600000';
|
||||
// this.listQuery.endTime = '1693843200000';
|
||||
this.urlOptions.getDataListURL(this.listQuery).then(res => {
|
||||
console.log(res)
|
||||
let arr = [
|
||||
{
|
||||
prop: 'sectionName',
|
||||
label: '工段',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'equName',
|
||||
label: '设备',
|
||||
align: 'center',
|
||||
}
|
||||
]
|
||||
let sectionArr= []
|
||||
res.data.data.forEach((ele, index) => {
|
||||
let tempData = []
|
||||
let eqData = []
|
||||
let plData = []
|
||||
ele.data.forEach((item, index) => {
|
||||
item.children.forEach(params => {
|
||||
if (params.dynamicName === '设备CT') {
|
||||
tempData[item.dynamicName + '_eq'] = params.dynamicValue
|
||||
eqData[index] = params.dynamicValue
|
||||
} else {
|
||||
tempData[item.dynamicName + '_pl'] = params.dynamicValue
|
||||
plData[index] = params.dynamicValue
|
||||
}
|
||||
})
|
||||
})
|
||||
const equipment = {
|
||||
name: ele.equName,
|
||||
eqData: eqData,
|
||||
plData: plData
|
||||
}
|
||||
tempData['equName'] = ele.equName
|
||||
tempData['sectionName'] = ele.sectionName
|
||||
this.tableData.push(tempData)
|
||||
const { sectionName } = tempData
|
||||
sectionArr.push(sectionName)
|
||||
this.yData.push(equipment)
|
||||
console.log('看看equ', this.yData)
|
||||
})
|
||||
this.setRowSpan(sectionArr)
|
||||
res.data.nameData.forEach(item => {
|
||||
this.timeList.push(item.name)
|
||||
})
|
||||
const timeArray = Array.from(new Set(this.timeList))
|
||||
for (const times of timeArray) {
|
||||
if (times !== '设备CT' && times !== '产线CT') {
|
||||
const subprop = {
|
||||
label: times,
|
||||
align: 'center',
|
||||
children: [
|
||||
{ prop: times + '_eq', label: '设备CT', align: 'center' },
|
||||
{ prop: times + '_pl', label: '产线CT', align: 'center' }
|
||||
]
|
||||
}
|
||||
arr.push(subprop)
|
||||
this.xData.push(times)
|
||||
}
|
||||
}
|
||||
this.tableProps = arr
|
||||
|
||||
console.log('表格横坐标', this.xData, this.yData)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.lineChart.initChart(this.xData, this.yData)
|
||||
})
|
||||
// this.total = response.data.total;
|
||||
// this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
buttonClick(val) {
|
||||
// console.log(val)
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
// this.listQuery.pageNo = 1;
|
||||
// this.listQuery.pageSize = 10;
|
||||
this.listQuery.lineId = val.lineIds
|
||||
this.listQuery.startTime = val.time ? String(new Date(val.time[0]).getTime()) : undefined;
|
||||
this.listQuery.endTime = val.time ? String(new Date(val.time[1]).getTime()) : undefined;
|
||||
if (val.time && val.lineIds) {
|
||||
this.tableData = []
|
||||
this.xData = []
|
||||
this.yData = []
|
||||
this.tableProps = []
|
||||
this.spanArr = []
|
||||
this.timeList = []
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message({
|
||||
message: '请选择产线和时间',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.listQuery = {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
};
|
||||
this.getDataList();
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
},
|
||||
getData() {
|
||||
// this.listQuery.lineId = '1672847052717821953'
|
||||
// this.listQuery.startTime = '1693497600000';
|
||||
// this.listQuery.endTime = '1693843200000';
|
||||
this.urlOptions.getDataListURL(this.listQuery).then((res) => {
|
||||
console.log(res);
|
||||
let arr = [
|
||||
{
|
||||
prop: 'sectionName',
|
||||
label: '工段',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'equName',
|
||||
label: '设备',
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
let sectionArr = [];
|
||||
res.data.data.forEach((ele, index) => {
|
||||
let tempData = [];
|
||||
let eqData = [];
|
||||
let plData = [];
|
||||
ele.data.forEach((item, index) => {
|
||||
item.children.forEach((params) => {
|
||||
if (params.dynamicName === '设备CT') {
|
||||
tempData[item.dynamicName + '_eq'] = params.dynamicValue;
|
||||
eqData[index] = params.dynamicValue;
|
||||
} else {
|
||||
tempData[item.dynamicName + '_pl'] = params.dynamicValue;
|
||||
plData[index] = params.dynamicValue;
|
||||
}
|
||||
});
|
||||
});
|
||||
const equipment = {
|
||||
name: ele.equName,
|
||||
eqData: eqData,
|
||||
plData: plData,
|
||||
};
|
||||
tempData['equName'] = ele.equName;
|
||||
tempData['sectionName'] = ele.sectionName;
|
||||
this.tableData.push(tempData);
|
||||
const { sectionName } = tempData;
|
||||
sectionArr.push(sectionName);
|
||||
this.yData.push(equipment);
|
||||
console.log('看看equ', this.yData);
|
||||
});
|
||||
this.setRowSpan(sectionArr);
|
||||
res.data.nameData.forEach((item) => {
|
||||
this.timeList.push(item.name);
|
||||
});
|
||||
const timeArray = Array.from(new Set(this.timeList));
|
||||
for (const times of timeArray) {
|
||||
if (times !== '设备CT' && times !== '产线CT') {
|
||||
const subprop = {
|
||||
label: times,
|
||||
align: 'center',
|
||||
children: [
|
||||
{ prop: times + '_eq', label: '设备CT', align: 'center' },
|
||||
{ prop: times + '_pl', label: '产线CT', align: 'center' },
|
||||
],
|
||||
};
|
||||
arr.push(subprop);
|
||||
this.xData.push(times);
|
||||
}
|
||||
}
|
||||
this.tableProps = arr;
|
||||
|
||||
console.log('表格横坐标', this.xData, this.yData);
|
||||
this.$nextTick(() => {
|
||||
this.$refs.lineChart.initChart(this.xData, this.yData);
|
||||
});
|
||||
// this.total = response.data.total;
|
||||
// this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
handleSearchBarBtnClick(btn) {
|
||||
switch (btn.btnName) {
|
||||
case 'search':
|
||||
this.queryParams.lineId = btn.lineIds || null;
|
||||
this.queryParams.startTime = btn.timeArr ? btn.timeArr[0] : null;
|
||||
this.queryParams.endTime = btn.timeArr ? btn.timeArr[1] : null;
|
||||
|
||||
if (!btn.lineIds || !btn.timeArr.length) {
|
||||
this.$message({
|
||||
message: '请选择产线和时间',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
this.getList();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
buttonClick(val) {
|
||||
// console.log(val)
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
// this.listQuery.pageNo = 1;
|
||||
// this.listQuery.pageSize = 10;
|
||||
this.listQuery.lineId = val.lineIds;
|
||||
this.listQuery.startTime = val.time
|
||||
? String(new Date(val.time[0]).getTime())
|
||||
: undefined;
|
||||
this.listQuery.endTime = val.time
|
||||
? String(new Date(val.time[1]).getTime())
|
||||
: undefined;
|
||||
if (val.time && val.lineIds) {
|
||||
this.tableData = [];
|
||||
this.xData = [];
|
||||
this.yData = [];
|
||||
this.tableProps = [];
|
||||
this.spanArr = [];
|
||||
this.timeList = [];
|
||||
this.getData();
|
||||
} else {
|
||||
this.$message({
|
||||
message: '请选择产线和时间',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.listQuery = {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
};
|
||||
this.getDataList();
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -8,11 +8,11 @@
|
||||
<template>
|
||||
<div class="app-container allow-overflow">
|
||||
<!-- 搜索工作栏 -->
|
||||
<small-title
|
||||
<!-- <small-title
|
||||
style="margin: 16px 0; padding-left: 8px"
|
||||
:no-padding="true">
|
||||
设备运行状态
|
||||
</small-title>
|
||||
</small-title> -->
|
||||
|
||||
<div
|
||||
class="graph"
|
||||
@ -22,7 +22,8 @@
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
">
|
||||
<div class="blue-title">各设备加工数量</div>
|
||||
<!-- <div class="blue-title">各设备加工数量</div> -->
|
||||
<div class="blue-title">设备运行状态</div>
|
||||
<div class="legend">
|
||||
<div class="legend-item">
|
||||
<span class="icon blue"></span>
|
||||
@ -41,22 +42,17 @@
|
||||
<span class="text">速度开动率</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="graph-grid">
|
||||
<div v-if="list.length" class="graph-grid">
|
||||
<div class="bg-grid grid-line">
|
||||
<div
|
||||
class="grid-item"
|
||||
v-for="item in list.length"
|
||||
:key="item"></div>
|
||||
<div class="grid-item" v-for="item in list.length" :key="item"></div>
|
||||
</div>
|
||||
|
||||
<div class="bg-grid grid-charts">
|
||||
<pie-chart
|
||||
v-for="item in list"
|
||||
:key="item.id"
|
||||
:value="item" />
|
||||
<pie-chart v-for="item in list" :key="item.id" :value="item" />
|
||||
<!-- <pie-chart v-for="item in 5" :key="item" :value="item" /> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="no-data-bg" v-else></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -202,7 +202,9 @@ export default {
|
||||
];
|
||||
this.config.series[1].data = [
|
||||
{ name: '速度开动率', value: peEfficiency },
|
||||
{ name: '', value: Math.ceil(peEfficiency) - peEfficiency },
|
||||
{ name: '', value: 100 },
|
||||
// { name: '速度开动率', value: peEfficiency },
|
||||
// { name: '', value: Math.ceil(peEfficiency) - peEfficiency },
|
||||
];
|
||||
//
|
||||
this.textData = {
|
||||
|
@ -21,18 +21,15 @@ export default {
|
||||
chart: null,
|
||||
};
|
||||
},
|
||||
// watch: {
|
||||
// list: {
|
||||
// handler(listdata) {
|
||||
// if (listdata && listdata.length) {
|
||||
// console.log('[linechart] list changed', listdata);
|
||||
// const option = this.handleList(listdata);
|
||||
// this.setOption(option);
|
||||
// }
|
||||
// },
|
||||
// immediate: true,
|
||||
// },
|
||||
// },
|
||||
watch: {
|
||||
list: {
|
||||
handler(listdata) {
|
||||
this.setOption();
|
||||
},
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
option() {
|
||||
const opt = [];
|
||||
@ -55,7 +52,7 @@ export default {
|
||||
},
|
||||
formatter: (params) => {
|
||||
const name = params[0].name;
|
||||
const goodRate = opt.find((item) => item[0] == name)[4];
|
||||
const goodRate = opt.find((item) => item[0] == name)[4] || '0';
|
||||
return `
|
||||
<h1 style="font-size: 18px; letter-spacing: 1px;">${
|
||||
params[0].axisValue
|
||||
@ -109,6 +106,9 @@ export default {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
axisTick: { show: false },
|
||||
axisLabel: {
|
||||
rotate: 45,
|
||||
},
|
||||
data: opt.map((item) => item[0]),
|
||||
},
|
||||
yAxis: {
|
||||
|
@ -6,15 +6,15 @@
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="app-container" style="flex: 1; height: 1px; display: flex; flex-direction: column;">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<el-row>
|
||||
<el-col class="custom-tabs">
|
||||
<el-row type="flex" style="flex: 1;">
|
||||
<el-col class="custom-tabs" style="flex: 1;">
|
||||
<el-tabs
|
||||
v-model="activeName"
|
||||
:stretch="true"
|
||||
@ -32,7 +32,7 @@
|
||||
<div
|
||||
v-if="activeName == 'graph'"
|
||||
class="graph"
|
||||
style="height: 40vh; display: flex; flex-direction: column">
|
||||
style="height: 100%; display: flex; flex-direction: column">
|
||||
<div class="blue-title">各设备加工数量</div>
|
||||
<LineChart v-if="list && list.length" :list="list" />
|
||||
<div v-else class="no-data-bg"></div>
|
||||
@ -63,13 +63,13 @@ export default {
|
||||
activeName: 'table', // defaults to 'table'
|
||||
searchBarFormConfig: [
|
||||
// 产品
|
||||
{
|
||||
__index: 'product',
|
||||
type: 'select',
|
||||
label: '产品',
|
||||
placeholder: '请选择产品',
|
||||
param: 'productId',
|
||||
},
|
||||
// {
|
||||
// __index: 'product',
|
||||
// type: 'select',
|
||||
// label: '产品',
|
||||
// placeholder: '请选择产品',
|
||||
// param: 'productId',
|
||||
// },
|
||||
// 产线
|
||||
{
|
||||
__index: 'line',
|
||||
@ -156,17 +156,17 @@ export default {
|
||||
{
|
||||
// width: 160,
|
||||
prop: 'inQuantity',
|
||||
label: '进片数量',
|
||||
label: '加工数量',
|
||||
},
|
||||
{
|
||||
// width: 160,
|
||||
prop: 'outQuantity',
|
||||
label: '出片数量',
|
||||
label: '合格数量',
|
||||
},
|
||||
{
|
||||
// width: 160,
|
||||
prop: 'nokQuantity',
|
||||
label: '破损/不合格数',
|
||||
label: '不合格数量',
|
||||
},
|
||||
{
|
||||
// width: 160,
|
||||
@ -377,6 +377,9 @@ export default {
|
||||
}
|
||||
|
||||
:deep(.custom-tabs) {
|
||||
.el-tabs {
|
||||
height: 100%;
|
||||
}
|
||||
.el-tabs__header {
|
||||
margin-bottom: 8px;
|
||||
display: inline-block;
|
||||
@ -389,6 +392,14 @@ export default {
|
||||
line-height: 36px !important;
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.el-tabs__content {
|
||||
height: calc(100% - 48px);
|
||||
}
|
||||
|
||||
#pane-graph {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.blue-title {
|
||||
|
@ -7,27 +7,30 @@
|
||||
-->
|
||||
<template>
|
||||
<div class="alarm-handle">
|
||||
<DialogForm
|
||||
ref="orderForm"
|
||||
key="orderForm"
|
||||
v-model="orderForm"
|
||||
:disabled="readOnly"
|
||||
:has-files="false"
|
||||
label-position="top"
|
||||
:rows="orderFormRows" />
|
||||
<el-skeleton v-if="loading" />
|
||||
<div v-else>
|
||||
<DialogForm
|
||||
ref="orderForm"
|
||||
key="orderForm"
|
||||
v-model="orderForm"
|
||||
:disabled="readOnly"
|
||||
:has-files="false"
|
||||
label-position="top"
|
||||
:rows="orderFormRows" />
|
||||
|
||||
<small-title style="margin: 16px 0" :no-padding="true" size="sm">
|
||||
处理方式
|
||||
</small-title>
|
||||
<small-title style="margin: 16px 0" :no-padding="true" size="sm">
|
||||
处理方式
|
||||
</small-title>
|
||||
|
||||
<DialogForm
|
||||
key="handleMethodForm"
|
||||
ref="handleMethodForm"
|
||||
v-model="handleMethodForm"
|
||||
:disabled="readOnly"
|
||||
:has-files="true"
|
||||
label-position="top"
|
||||
:rows="handleMethodFormRows" />
|
||||
<DialogForm
|
||||
key="handleMethodForm"
|
||||
ref="handleMethodForm"
|
||||
v-model="handleMethodForm"
|
||||
:disabled="readOnly"
|
||||
:has-files="true"
|
||||
label-position="top"
|
||||
:rows="handleMethodFormRows" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -43,6 +46,7 @@ export default {
|
||||
components: { SmallTitle, DialogForm, Editor },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
orderForm: {
|
||||
id: null,
|
||||
equipment: null,
|
||||
@ -50,13 +54,15 @@ export default {
|
||||
alarmContent: null,
|
||||
alarmValue: null,
|
||||
// 缺少报警编号字段, 用 alarmValue 代替
|
||||
alarmCode: null,
|
||||
equipmentCode: null
|
||||
},
|
||||
orderFormRows: [
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '设备编码',
|
||||
prop: 'equipment',
|
||||
prop: 'equipmentCode',
|
||||
},
|
||||
{
|
||||
datetime: true,
|
||||
@ -66,7 +72,7 @@ export default {
|
||||
{
|
||||
input: true,
|
||||
label: '报警编号',
|
||||
prop: 'alarmValue',
|
||||
prop: 'alarmCode',
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
@ -82,6 +88,9 @@ export default {
|
||||
label: '处理人',
|
||||
prop: 'hander',
|
||||
url: '/base/core-worker/listAll',
|
||||
bind: {
|
||||
multiple: true,
|
||||
},
|
||||
rules: [
|
||||
{ required: true, message: '类型名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
@ -122,9 +131,14 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getDict().then(() => {
|
||||
this.init();
|
||||
});
|
||||
this.loading = true;
|
||||
this.getDict()
|
||||
.then(() => {
|
||||
this.init();
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
@ -139,8 +153,9 @@ export default {
|
||||
* 初始化
|
||||
*/
|
||||
async init() {
|
||||
this.initTop();
|
||||
this.initDown();
|
||||
await this.initTop();
|
||||
await this.initDown();
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -172,16 +187,19 @@ export default {
|
||||
this.$msgError('缺少报警日志id');
|
||||
this.$emit('close');
|
||||
}
|
||||
const url = '/base/equipment-alarm-hand/get';
|
||||
const url = '/base/equipment-alarm-hand/page'; // 经沟通,此处采用page接口的第一个返回值
|
||||
const { data, code } = await this.$axios({
|
||||
url: url,
|
||||
method: 'get',
|
||||
params: {
|
||||
id: this.logId,
|
||||
logId: this.logId,
|
||||
},
|
||||
});
|
||||
if (code == 0) {
|
||||
this.handleMethodForm = data;
|
||||
this.handleMethodForm = {
|
||||
...data.list[0],
|
||||
hander: data.list[0]?.hander?.split(',') || '',
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
@ -213,7 +231,11 @@ export default {
|
||||
const { code, data } = await this.$axios({
|
||||
url: url + (this.handleMethodForm.id ? '/update' : '/create'),
|
||||
method: this.handleMethodForm.id ? 'put' : 'post',
|
||||
data: { ...this.handleMethodForm, logId: this.logId },
|
||||
data: {
|
||||
...this.handleMethodForm,
|
||||
hander: this.handleMethodForm.hander?.join(',') || '',
|
||||
logId: this.logId,
|
||||
},
|
||||
});
|
||||
if (code == 0) {
|
||||
return true;
|
||||
|
@ -151,7 +151,7 @@ export default {
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期',
|
||||
defaultTime: ['00:00:00', '23:59:59'],
|
||||
param: 'recordTime',
|
||||
param: 'createTime',
|
||||
// defaultSelect: [
|
||||
// new Date(y, m, d)
|
||||
// .toLocaleString()
|
||||
@ -206,7 +206,7 @@ export default {
|
||||
pageSize: 10,
|
||||
lineId: null,
|
||||
equipmentId: null,
|
||||
recordTime: []
|
||||
recordTime: [],
|
||||
},
|
||||
basePath: '/base/equipment-alarm-log',
|
||||
list: [],
|
||||
|
@ -42,7 +42,8 @@
|
||||
:dataForm="form"
|
||||
:rows="formRows" /> -->
|
||||
|
||||
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
|
||||
<!-- <el-row v-if="mode.includes('detail')" style="margin-bottom: 24px"> -->
|
||||
<el-row style="margin-bottom: 24px">
|
||||
<el-col :span="8">
|
||||
<div
|
||||
class="title"
|
||||
@ -62,7 +63,7 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-else style="margin-bottom: 24px" :gutter="20">
|
||||
<!-- <el-row v-else style="margin-bottom: 24px" :gutter="20">
|
||||
<el-form ref="form" :model="form">
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
@ -85,7 +86,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</el-row> -->
|
||||
</div>
|
||||
|
||||
<div
|
||||
@ -132,8 +133,8 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="!mode.includes('detail')"
|
||||
@click="handleSave">
|
||||
保存
|
||||
@click="handleCancel">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -304,7 +304,7 @@ export default {
|
||||
filter: publicFormatter('unit_dict'),
|
||||
},
|
||||
{
|
||||
prop: 'equipment_param_type',
|
||||
prop: 'equipmentParamType',
|
||||
label: '设备参数类型',
|
||||
filter: (val) =>
|
||||
val != null
|
||||
@ -312,7 +312,7 @@ export default {
|
||||
: '-',
|
||||
},
|
||||
{
|
||||
prop: 'production_param_type',
|
||||
prop: 'productionParamType',
|
||||
label: '生产参数类型',
|
||||
filter: (val) =>
|
||||
val != null
|
||||
|
@ -61,7 +61,7 @@
|
||||
关联表名
|
||||
</div>
|
||||
<div class="value" style="font-size: 14px">
|
||||
{{ form.plcTableName }}
|
||||
{{ form.plcName }}
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -73,9 +73,17 @@
|
||||
class="title"
|
||||
label="设备名"
|
||||
style="font-size: 16px; margin: 8px 0">
|
||||
<el-input
|
||||
v-model="form.equipmentName"
|
||||
placeholder="请输入设备名"></el-input>
|
||||
<el-select
|
||||
v-model="form.equipmentId"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择设备">
|
||||
<el-option
|
||||
v-for="eq in eqList"
|
||||
:key="eq.id"
|
||||
:label="eq.name"
|
||||
:value="eq.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@ -83,9 +91,17 @@
|
||||
class="title"
|
||||
label="设备关联表名"
|
||||
style="font-size: 16px; margin: 8px 0">
|
||||
<el-input
|
||||
v-model="form.plcTableName"
|
||||
placeholder="请输入关联表名"></el-input>
|
||||
<el-select
|
||||
v-model="form.plcId"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择关联表">
|
||||
<el-option
|
||||
v-for="plc in plcList"
|
||||
:key="plc.id"
|
||||
:label="plc.name"
|
||||
:value="plc.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
@ -202,6 +218,8 @@ export default {
|
||||
total: 0,
|
||||
form: {},
|
||||
list: [],
|
||||
eqList: [],
|
||||
plcList: [],
|
||||
attrTitle: '',
|
||||
attrForm: {
|
||||
id: null,
|
||||
@ -257,7 +275,7 @@ export default {
|
||||
{
|
||||
select: true,
|
||||
label: '设备参数类型',
|
||||
prop: 'equipment_param_type',
|
||||
prop: 'equipmentParamType',
|
||||
options: [
|
||||
{ label: '一般参数', value: 1 },
|
||||
{ label: '工艺参数', value: 2 },
|
||||
@ -274,7 +292,7 @@ export default {
|
||||
{
|
||||
select: true,
|
||||
label: '生产参数类型',
|
||||
prop: 'production_param_type',
|
||||
prop: 'productionParamType',
|
||||
options: [
|
||||
// { label: '进片数量', value: 1 },
|
||||
// { label: '出片数量', value: 2 },
|
||||
@ -380,6 +398,17 @@ export default {
|
||||
mounted() {
|
||||
this.shouldRefreshPageView = false;
|
||||
this.mode = this.defaultMode || 'detail';
|
||||
|
||||
if (this.mode != 'detail') {
|
||||
this.$axios('/base/core-equipment/listAll').then(({ code, data }) => {
|
||||
this.eqList = data;
|
||||
});
|
||||
this.$axios({
|
||||
url: '/base/equipment-plc/page',
|
||||
}).then(({ code, data }) => {
|
||||
this.plcList = data.list;
|
||||
});
|
||||
}
|
||||
for (const section of this.sections) {
|
||||
// 请求具体信息
|
||||
if ('url' in section) {
|
||||
@ -479,6 +508,8 @@ export default {
|
||||
defaultValue: '',
|
||||
description: '',
|
||||
remark: '',
|
||||
equipmentParamType: '',
|
||||
productionParamType: '',
|
||||
alarmContent: '',
|
||||
};
|
||||
this.attrTitle = '添加参数绑定信息';
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-24 18:38:22
|
||||
* @LastEditTime: 2023-11-27 10:48:55
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -176,11 +176,7 @@ export default {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${
|
||||
raw.data.attrName
|
||||
? '[名称=' + raw.data.attrName + ']'
|
||||
: '[序号=' + raw.data._pageIndex + ']'
|
||||
}进行删除操作?`,
|
||||
`是否确认删除巡检项目名称为"${raw.data.program}"的数据项?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
|
@ -17,6 +17,8 @@
|
||||
<el-select
|
||||
size="small"
|
||||
placeholder="请选择产线"
|
||||
clearable
|
||||
filterable
|
||||
@change="getEquipmentByLineId"
|
||||
v-model="form.productionLineId">
|
||||
<el-option
|
||||
@ -30,6 +32,8 @@
|
||||
<el-select
|
||||
size="small"
|
||||
placeholder="请选择设备"
|
||||
clearable
|
||||
filterable
|
||||
v-model="form.equipmentId">
|
||||
<el-option
|
||||
v-for="item in listEq"
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-22 16:50:55
|
||||
* @LastEditTime: 2023-11-28 10:03:20
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -53,7 +53,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="drawer-body__footer">
|
||||
<div v-if="!isdetail" class="drawer-body__footer">
|
||||
<el-button style="" @click="goback()">取消</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
|
@ -1,8 +1,13 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
<<<<<<< HEAD
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-23 09:20:12
|
||||
* @LastEditTime: 2023-11-28 10:09:20
|
||||
=======
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-27 16:37:17
|
||||
>>>>>>> projects/mes-test
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -53,7 +58,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div v-if="isdetail" class="drawer-body__footer">
|
||||
<div v-if="!isdetail" class="drawer-body__footer">
|
||||
<el-button style="" @click="goback()">取消</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
@ -140,7 +145,7 @@ const tableProps = [
|
||||
label: '最小值(工艺)',
|
||||
},
|
||||
{
|
||||
prop: 'manValue',
|
||||
prop: 'maxValue',
|
||||
label: '最大值(工艺)',
|
||||
},
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-08 15:30:27
|
||||
* @LastEditTime: 2023-11-23 14:26:54
|
||||
* @LastEditTime: 2023-11-28 10:11:40
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@ -84,7 +84,7 @@ export default {
|
||||
},
|
||||
equipmentId:null,
|
||||
dataRule: {
|
||||
attrName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
paramId: [{ required: true, message: '参数名称不能为空', trigger: 'change' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
|
@ -279,7 +279,7 @@ export default {
|
||||
.then(async () => {
|
||||
const { code } = await this.http(
|
||||
'/extend/process-flow/copy',
|
||||
'post',
|
||||
'get',
|
||||
{
|
||||
id,
|
||||
}
|
||||
@ -333,10 +333,11 @@ export default {
|
||||
|
||||
async getList() {
|
||||
this.loading = true;
|
||||
const { code, data } = await this.recv(this.queryParams);
|
||||
// const { code, data } = await this.recv(this.queryParams);
|
||||
const { code, data } = await this.http('/extend/process-flow/listAll', 'get');
|
||||
if (code == 0) {
|
||||
this.list = data.list;
|
||||
this.total = data.total;
|
||||
this.list = data;
|
||||
// this.total = data.total;
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export default {
|
||||
// },
|
||||
props: {
|
||||
currentSelect: {
|
||||
type: String,
|
||||
type: String | Number,
|
||||
default: null,
|
||||
},
|
||||
list: {
|
||||
@ -59,8 +59,16 @@ export default {
|
||||
},
|
||||
currentSelect: {
|
||||
handler(val) {
|
||||
// val: string
|
||||
this.selected = val;
|
||||
this.randomKey = Math.random();
|
||||
// 更新选中状态
|
||||
if (val) {
|
||||
this.list__inner.forEach((item) => {
|
||||
if (item.id == val) item.disabled = false;
|
||||
else item.disabled = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
|
@ -19,7 +19,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row style="border: 1px solid #ccc; display: flex">
|
||||
<el-row v-if="filteredBomList.length" style="border: 1px solid #ccc; display: flex">
|
||||
<el-col :span="8">
|
||||
<div class="select-list">
|
||||
<div class="sl__header" style="background: #f3f4fb; padding: 12px">
|
||||
@ -78,6 +78,7 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="no-data-bg" v-else></div>
|
||||
</div>
|
||||
</template>
|
||||
;
|
||||
|
@ -77,6 +77,17 @@
|
||||
:bom-list="bomList"
|
||||
:value="selectedBoms"
|
||||
@update="selectedBoms = $event" />
|
||||
|
||||
<el-row slot="footer">
|
||||
<el-button size="small" @click="cancel">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="submitForm"
|
||||
:loading="btnLoading">
|
||||
确定
|
||||
</el-button>
|
||||
</el-row>
|
||||
</base-dialog>
|
||||
</section>
|
||||
</template>
|
||||
@ -95,6 +106,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
btnLoading: false,
|
||||
open: false,
|
||||
eqList: [],
|
||||
bomList: [],
|
||||
@ -170,6 +182,7 @@ export default {
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.btnLoading = true;
|
||||
// 现将子组件的修改提交更新至本组件
|
||||
this.$refs.bomSelector.commit();
|
||||
// 再提交至后端
|
||||
@ -187,11 +200,14 @@ export default {
|
||||
if (code == 0) {
|
||||
this.$message.success('操作成功');
|
||||
this.getList(this.currentDet);
|
||||
this.btnLoading = false;
|
||||
this.cancel();
|
||||
} else {
|
||||
this.btnLoading = false;
|
||||
this.$message.error('操作失败');
|
||||
}
|
||||
} else {
|
||||
this.btnLoading = false;
|
||||
this.$message.info('请选择设备');
|
||||
}
|
||||
});
|
||||
@ -218,34 +234,45 @@ export default {
|
||||
this.total = 0;
|
||||
}
|
||||
|
||||
this.selectedBoms = [];
|
||||
// 获取设备及bom列表
|
||||
this.http('/extend/process-flow-det/getEquipmentDetBySectionId', 'post', {
|
||||
sectionId,
|
||||
flowDetId: detId,
|
||||
}).then(({ code, data }) => {
|
||||
if (code == 0) {
|
||||
this.bomList = data.map((eq) => {
|
||||
eq.materialsBom = eq.materialsBom || [];
|
||||
eq.valuesBom = eq.valuesBom || [];
|
||||
// 设置选中状态
|
||||
eq.materialsBom.chosen = eq.materialsBomChoseId ?? null;
|
||||
eq.valuesBom.chosen = eq.valuesBomChoseId ?? null;
|
||||
if (eq.equChose || eq.materialsBom.chosen || eq.valuesBom.chosen) {
|
||||
this.selectedBoms.push({
|
||||
equipmentId: eq.id,
|
||||
equMaterialBomId: eq.materialsBom.chosen,
|
||||
equValueBomId: eq.valuesBom.chosen,
|
||||
});
|
||||
}
|
||||
// 设置设备id
|
||||
eq.materialsBom.equipmentId = eq.id;
|
||||
eq.valuesBom.equipmentId = eq.id;
|
||||
return eq;
|
||||
});
|
||||
} else {
|
||||
})
|
||||
.then(({ code, data }) => {
|
||||
if (code == 0) {
|
||||
this.bomList = data.map((eq) => {
|
||||
eq.materialsBom = eq.materialsBom || [];
|
||||
eq.valuesBom = eq.valuesBom || [];
|
||||
// 设置选中状态
|
||||
eq.materialsBom.chosen = eq.materialsBomChoseId ?? null;
|
||||
eq.valuesBom.chosen = eq.valuesBomChoseId ?? null;
|
||||
if (
|
||||
eq.equChose ||
|
||||
eq.materialsBom.chosen ||
|
||||
eq.valuesBom.chosen
|
||||
) {
|
||||
this.selectedBoms.push({
|
||||
equipmentId: eq.id,
|
||||
equMaterialBomId: eq.materialsBom.chosen,
|
||||
equValueBomId: eq.valuesBom.chosen,
|
||||
});
|
||||
}
|
||||
// 设置设备id
|
||||
eq.materialsBom.equipmentId = eq.id;
|
||||
eq.valuesBom.equipmentId = eq.id;
|
||||
return eq;
|
||||
});
|
||||
} else {
|
||||
this.bomList.splice(0);
|
||||
this.selectedBoms = [];
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.bomList.splice(0);
|
||||
}
|
||||
});
|
||||
this.selectedBoms = [];
|
||||
});
|
||||
},
|
||||
async handleAddEquipment() {
|
||||
this.open = true;
|
||||
|
@ -34,7 +34,7 @@
|
||||
class="btn-refresh"
|
||||
@click="handleUpdateLayout"
|
||||
icon="el-icon-refresh">
|
||||
刷新布局
|
||||
保存布局
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@ -62,6 +62,16 @@
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
|
||||
<el-row slot="footer">
|
||||
<el-button size="small" @click="cancel">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="submitForm"
|
||||
:loading="btnLoading">
|
||||
确定
|
||||
</el-button>
|
||||
</el-row>
|
||||
</base-dialog>
|
||||
</section>
|
||||
</template>
|
||||
@ -102,7 +112,9 @@ export default {
|
||||
input: true,
|
||||
label: '工序名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '工序名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '工序名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@ -111,7 +123,9 @@ export default {
|
||||
label: '工段',
|
||||
prop: 'sectionId',
|
||||
url: '/base/core-workshop-section/listAll',
|
||||
rules: [{ required: true, message: '工段不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '工段不能为空', trigger: 'blur' },
|
||||
],
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
@ -139,6 +153,7 @@ export default {
|
||||
},
|
||||
currentDet: null,
|
||||
currentNode: null,
|
||||
btnLoading: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -221,7 +236,7 @@ export default {
|
||||
node.attr('container/stroke', '#0b58ff');
|
||||
const { detId, detName, detDesc, processId, sectionId, sectionName } =
|
||||
node.attrs;
|
||||
console.log('node clicked!', node)
|
||||
console.log('node clicked!', node);
|
||||
this.currentDet = {};
|
||||
this.$set(this.currentDet, 'detId', detId?.text);
|
||||
this.$set(this.currentDet, 'sectionId', sectionId?.text);
|
||||
@ -354,6 +369,7 @@ export default {
|
||||
},
|
||||
|
||||
handleEdit() {
|
||||
console.log('edit: ', this.currentDet);
|
||||
this.form.name = this.currentDet.detName;
|
||||
this.form.sectionId = this.currentDet.sectionId;
|
||||
this.form.remark = this.currentDet.detDesc;
|
||||
@ -379,6 +395,7 @@ export default {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.btnLoading = true;
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
this.updateProcess()
|
||||
@ -392,9 +409,20 @@ export default {
|
||||
sectionName: { text: sectionName },
|
||||
detDesc: { text: remark },
|
||||
});
|
||||
// 修改currentDet
|
||||
this.currentDet = {
|
||||
...this.currentDet,
|
||||
detName: name,
|
||||
sectionId: sectionId,
|
||||
sectionName: sectionName,
|
||||
detDesc: remark,
|
||||
};
|
||||
this.btnLoading = false;
|
||||
});
|
||||
})
|
||||
.catch((err) => {});
|
||||
.catch((err) => {
|
||||
this.btnLoading = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -412,11 +440,14 @@ export default {
|
||||
.then((node) => {
|
||||
if (!node) {
|
||||
this.$modal.msgError('创建节点失败');
|
||||
this.btnLoading = false;
|
||||
return;
|
||||
}
|
||||
this.btnLoading = false;
|
||||
this.graph.addNode(node);
|
||||
})
|
||||
.catch((err) => {
|
||||
this.btnLoading = false;
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
@ -21,12 +21,12 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20" style="margin-top: 12px;">
|
||||
<el-row :gutter="20" style="margin-top: 12px">
|
||||
<el-col :span="6">
|
||||
<!-- <InfoItem label="创建人" value="xxse" /> -->
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<InfoItem label="创建时间" :value="form.createTime" />
|
||||
<InfoItem label="创建时间" :value="form.createTime" :time-format="true" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<!-- <InfoItem label="更新人" value="xxse" /> -->
|
||||
@ -39,11 +39,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment';
|
||||
|
||||
const InfoItem = {
|
||||
name: 'InfoItem',
|
||||
components: {},
|
||||
props: ['label', 'value'],
|
||||
props: ['label', 'value', 'timeFormat'],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
@ -52,9 +53,13 @@ const InfoItem = {
|
||||
render: function (h) {
|
||||
return (
|
||||
<div style="display: flex; align-items: center; font-size: 14px; line-height: 1.5">
|
||||
<span style="width: 100px; text-align: left; font-weight: 700">{this.label}:</span>
|
||||
<span style="width: 100px; text-align: left; font-weight: 700">
|
||||
{this.label}:
|
||||
</span>
|
||||
<span style="width: 200px; text-align: left; text-overflow: ellipse; white-space: nowrap">
|
||||
{this.value}
|
||||
{this.timeFormat
|
||||
? moment(this.value).format('YYYY-MM-DD HH:mm:ss')
|
||||
: this.value}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
@ -77,12 +82,12 @@ export default {
|
||||
createTime: null,
|
||||
remark: null,
|
||||
enable: null,
|
||||
code: null
|
||||
code: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
this.getInfo()
|
||||
this.getInfo();
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
@ -93,7 +98,7 @@ export default {
|
||||
method,
|
||||
params: method === 'get' ? payload : null,
|
||||
data: method !== 'get' ? payload : null,
|
||||
})
|
||||
});
|
||||
},
|
||||
put(payload) {
|
||||
return this.http(this.updateUrl, 'put', payload);
|
||||
@ -114,12 +119,12 @@ export default {
|
||||
// debugger;
|
||||
if (code == 0) {
|
||||
this.form = {
|
||||
...data
|
||||
...data,
|
||||
};
|
||||
} else {
|
||||
this.$modal.msgError('工艺信息获取失败')
|
||||
this.$modal.msgError('工艺信息获取失败');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-01 14:55:51
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-22 14:23:40
|
||||
* @LastEditTime: 2023-11-28 10:34:24
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -26,9 +26,10 @@ import { parseTime } from '../../core/mixins/code-filter';
|
||||
import {
|
||||
getProcessTraceabilityPage,
|
||||
getWorkOrderList,
|
||||
getCoreProduct
|
||||
// exportEnergyPlcExcel
|
||||
} from '@/api/quality/processTraceability';
|
||||
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
@ -44,7 +45,8 @@ const tableProps = [
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态'
|
||||
label: '状态',
|
||||
filter: (val) => val == 1 ? '等待' : val == 2 ? '激活' : val == 3 ? '暂停' : val == 4 ? '完成' : '作废',
|
||||
},
|
||||
{
|
||||
prop: 'startProduceTime',
|
||||
@ -61,8 +63,9 @@ const tableProps = [
|
||||
label: '生产数量'
|
||||
},
|
||||
{
|
||||
prop: 'unit',
|
||||
label: '单位'
|
||||
prop: 'planProductUnit',
|
||||
label: '单位',
|
||||
filter: publicFormatter('unit_dict')
|
||||
},
|
||||
{
|
||||
prop: 'processFlowName',
|
||||
@ -113,7 +116,8 @@ export default {
|
||||
selectOptions: [],
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
param: 'orderName'
|
||||
param: 'orderName',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
@ -182,17 +186,25 @@ export default {
|
||||
handleClick(val) {
|
||||
if (val.type === "processDetail") {
|
||||
console.log(val);
|
||||
this.$router.push({
|
||||
name: 'process-traceability-detail',
|
||||
params: {
|
||||
id: '1715180991838887938',
|
||||
orderId: val.data.id,
|
||||
name: val.data.name,
|
||||
productName: val.data.planProductName,
|
||||
processFlowName: val.data.processFlowName
|
||||
// equipmentName,
|
||||
},
|
||||
});
|
||||
let specificationsData =''
|
||||
getCoreProduct(val.data.planProductId).then((res) => {
|
||||
console.log(res)
|
||||
|
||||
this.$router.push({
|
||||
path: 'process-traceability-detail',
|
||||
query: {
|
||||
id: val.data.processFlowId,
|
||||
orderId: val.data.id,
|
||||
name: val.data.name,
|
||||
specifications: res.data.specifications,
|
||||
productName: val.data.planProductName,
|
||||
processFlowName: val.data.processFlowName,
|
||||
// planProductId: val.data.planProductId
|
||||
// equipmentName,
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
// this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
|
||||
}
|
||||
},
|
||||
|
@ -117,11 +117,11 @@ export default {
|
||||
// },
|
||||
{ prop: 'name', label: '参数名' },
|
||||
{
|
||||
prop: 'name', label: '设定范围最小- 最大 / 标准',
|
||||
prop: 'status', label: '设定范围最小- 最大 / 标准',
|
||||
subcomponent: StatusBtn
|
||||
},
|
||||
{
|
||||
prop: 'code', label: '最小值',
|
||||
prop: '', label: '最小值',
|
||||
children: [
|
||||
{
|
||||
prop: 'minValueSet',
|
||||
@ -134,7 +134,7 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: 'code', label: '最大值',
|
||||
prop: '', label: '最大值',
|
||||
children: [
|
||||
{
|
||||
prop: 'maxValueSet',
|
||||
@ -184,9 +184,9 @@ export default {
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
orderId: this.$route.query.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
// orderId: this.$route.query.orderId,
|
||||
|
||||
},).then((res) => {
|
||||
console.log(res);
|
||||
@ -231,25 +231,29 @@ export default {
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
orderId: this.$route.query.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
// orderId: this.$route.query.orderId,
|
||||
|
||||
},).then((res) => {
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
if (res.data.length != []) {
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
}
|
||||
})
|
||||
} else {
|
||||
getDetValue({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
orderId: this.$route.query.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
// orderId: this.$route.query.orderId,
|
||||
|
||||
}).then((res) => {
|
||||
this.valueList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
if (res.data.length != []) {
|
||||
this.valueList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -258,12 +262,14 @@ export default {
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
orderId: this.$route.query.orderId,
|
||||
flowDetId: [this.detId],
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
if (res.data.length != []) {
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
}
|
||||
})
|
||||
},
|
||||
clearList() {
|
||||
|
@ -123,7 +123,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.$route.params.id)
|
||||
console.log(this.$route.query.id)
|
||||
this.loadLayout().then(json => {
|
||||
this.initGraph(json)
|
||||
})
|
||||
@ -260,7 +260,7 @@ export default {
|
||||
},
|
||||
|
||||
async loadLayout() {
|
||||
const flowId = this.$route.params.id;
|
||||
const flowId = this.$route.query.id;
|
||||
console.log(flowId)
|
||||
if (!flowId) return { cells: [] }
|
||||
const { code, data } = await this.info({ id: flowId });
|
||||
@ -288,12 +288,12 @@ export default {
|
||||
async handleUpdateLayout() {
|
||||
this.layout.content = JSON.stringify(this.graph.toJSON());
|
||||
let code, data;
|
||||
console.table([this.layout, this.$route.params.id])
|
||||
console.table([this.layout, this.$route.query.id])
|
||||
// 手动刷新布局
|
||||
if (this.layout.id) {
|
||||
({ code, data } = await this.http('/extend/process-flow-view/update', 'put', this.layout));
|
||||
} else {
|
||||
this.layout.flowId = this.$route.params.id;
|
||||
this.layout.flowId = this.$route.query.id;
|
||||
({ code, data } = await this.http('/extend/process-flow-view/create', 'post', this.layout));
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ export default {
|
||||
},
|
||||
|
||||
createProcess() {
|
||||
// const flowId = this.$route.params.id;
|
||||
// const flowId = this.$route.query.id;
|
||||
const flowId = this.getFlowId(); // it also works
|
||||
if (!flowId) {
|
||||
this.$modal.msgError('工艺ID不能为空');
|
||||
|
@ -20,14 +20,13 @@
|
||||
<InfoItem label="产品名称" :value="form.productName" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<InfoItem label="产品规格" />
|
||||
<InfoItem label="产品规格" :value="form.specifications" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
const InfoItem = {
|
||||
name: 'InfoItem',
|
||||
components: {},
|
||||
@ -62,6 +61,7 @@ export default {
|
||||
id: null,
|
||||
name: null,
|
||||
productName: null,
|
||||
specifications:null,
|
||||
processFlowName: null,
|
||||
// remark: null,
|
||||
// enable: null,
|
||||
@ -70,7 +70,8 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getInfo()
|
||||
this.getInfo()
|
||||
console.log(this.$route.query)
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
@ -95,12 +96,14 @@ export default {
|
||||
// info(payload) {
|
||||
// return this.http(this.infoUrl, 'get', payload);
|
||||
// },
|
||||
async getInfo() {
|
||||
this.form.name = this.$route.params.name
|
||||
this.form.productName = this.$route.params.productName
|
||||
this.form.processFlowName = this.$route.params.processFlowName
|
||||
// this.form.name = this.$route.params.name
|
||||
// const flowId = this.$route.params.id;
|
||||
getInfo() {
|
||||
// console.log(this.$route.query.planProductId);
|
||||
this.form.name = this.$route.query.name
|
||||
this.form.specifications = this.$route.query.specifications
|
||||
this.form.productName = this.$route.query.productName
|
||||
this.form.processFlowName = this.$route.query.processFlowName
|
||||
// this.form.name = this.$route.query.name
|
||||
// const flowId = this.$route.query.id;
|
||||
// console.log(flowId);
|
||||
// if (!flowId) this.$router.go(-1);
|
||||
// const { code, data } = await this.info({ id: flowId });
|
||||
|
@ -26,7 +26,7 @@ export default {
|
||||
color: ['#288AFF'],
|
||||
grid: {
|
||||
top: 64,
|
||||
left: 56,
|
||||
left: '8%',
|
||||
right: 64,
|
||||
bottom: 56,
|
||||
},
|
||||
|
@ -67,15 +67,20 @@
|
||||
class="app-container equipment-process-amount"
|
||||
style="flex: 1; border-radius: 8px; background: #fff">
|
||||
<!-- main area -->
|
||||
<div class="main-content" style="display: flex; flex-direction: column">
|
||||
<div
|
||||
class="main-content"
|
||||
style="height: 100%; display: flex; flex-direction: column">
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<el-row>
|
||||
<el-col class="custom-tabs">
|
||||
<el-tabs v-model="activeName" @tab-click="handleTabClick">
|
||||
<el-row style="flex: 1">
|
||||
<el-col class="custom-tabs" style="height: 100%">
|
||||
<el-tabs
|
||||
v-model="activeName"
|
||||
@tab-click="handleTabClick"
|
||||
style="height: 100%">
|
||||
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
|
||||
<base-table
|
||||
v-if="mode == 'table'"
|
||||
@ -93,7 +98,9 @@
|
||||
</base-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000柱状图\u3000'" name="graph">
|
||||
<div class="graph" style="height: 56vh">
|
||||
<div
|
||||
class="graph"
|
||||
style="height: 100%;">
|
||||
<!-- graph -->
|
||||
<Graph
|
||||
v-if="list.length"
|
||||
@ -546,6 +553,13 @@ li {
|
||||
.el-tree-node__content {
|
||||
padding: 8px 24px !important;
|
||||
}
|
||||
|
||||
.custom-tabs >>> .el-tabs__content {
|
||||
height: calc(100% - 42px);
|
||||
}
|
||||
.custom-tabs >>> .el-tab-pane {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
@ -1,81 +1,53 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-data="list"
|
||||
@emitFun="handleEmitFun">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:width="120"
|
||||
fixed="right"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
<!-- 列表 -->
|
||||
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
||||
@emitFun="handleEmitFun">
|
||||
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right" :method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
width="40%"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm
|
||||
v-if="open"
|
||||
ref="form"
|
||||
v-model="form"
|
||||
:rows="[
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '检测类型',
|
||||
prop: 'typeId',
|
||||
url: '/base/quality-inspection-type/listAll',
|
||||
rules: [{ required: true, message: '检测类型不能为空', trigger: 'blur' }],
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '检测内容',
|
||||
prop: 'content',
|
||||
rules: [{ required: true, message: '检测内容不能为空', trigger: 'blur' }],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '内容编码',
|
||||
prop: 'code',
|
||||
url: '/base/quality-inspection-det/getCode',
|
||||
},
|
||||
],
|
||||
[{ input: true, label: '备注', prop: 'remark' }],
|
||||
]" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog :dialogTitle="title" :dialogVisible="open" width="40%" @close="cancel" @cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm v-if="open" ref="form" v-model="form" :rows="[
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '检测类型',
|
||||
prop: 'typeId',
|
||||
url: '/base/quality-inspection-type/listAll',
|
||||
rules: [{ required: true, message: '检测类型不能为空', trigger: 'blur' }],
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '检测内容',
|
||||
prop: 'content',
|
||||
rules: [{ required: true, message: '检测内容不能为空', trigger: 'blur' }],
|
||||
},
|
||||
],
|
||||
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '内容编码',
|
||||
prop: 'code',
|
||||
url: '/base/quality-inspection-det/getCode',
|
||||
},
|
||||
{ input: true, label: '备注', prop: 'remark' }],
|
||||
]" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -1,76 +1,52 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-data="list"
|
||||
@emitFun="handleEmitFun">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:width="120"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
<!-- 列表 -->
|
||||
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
||||
@emitFun="handleEmitFun">
|
||||
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" :method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm
|
||||
v-if="open"
|
||||
ref="form"
|
||||
v-model="form"
|
||||
:rows="[
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '检测类型名称',
|
||||
prop: 'name',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '检测类型名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
// bind: {
|
||||
// disabled: true, // some condition, like detail mode...
|
||||
// }
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '检测类型编码',
|
||||
prop: 'code',
|
||||
url: '/base/quality-inspection-type/getCode',
|
||||
},
|
||||
],
|
||||
[{ input: true, label: '备注', prop: 'remark' }],
|
||||
]" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog :dialogTitle="title" :dialogVisible="open" @close="cancel" width="30%" @cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm v-if="open" ref="form" v-model="form" :rows="[
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '检测类型名称',
|
||||
prop: 'name',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '检测类型名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
// bind: {
|
||||
// disabled: true, // some condition, like detail mode...
|
||||
// }
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '检测类型编码',
|
||||
prop: 'code',
|
||||
url: '/base/quality-inspection-type/getCode',
|
||||
},
|
||||
],
|
||||
[{ input: true, label: '备注', prop: 'remark' }],
|
||||
]" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -1,13 +1,13 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-06 15:15:30
|
||||
* @LastEditTime: 2023-11-06 15:36:31
|
||||
* @LastEditTime: 2023-11-24 08:42:18
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="auto">
|
||||
<el-row :gutter="20">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="报废类型编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="请输入报废类型编码" />
|
||||
@ -19,7 +19,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="描述类型" prop="description">
|
||||
<el-input v-model="dataForm.description" clearable placeholder="描述类型" />
|
||||
|
@ -315,7 +315,11 @@ export default {
|
||||
data: arrYAxis,
|
||||
type: 'bar',
|
||||
showBackground: true,
|
||||
barWidth:'20',
|
||||
barWidth: '20',
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
},
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-01 14:55:51
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-10 16:25:02
|
||||
* @LastEditTime: 2023-11-24 10:55:54
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -132,6 +132,9 @@ export default {
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
// {
|
||||
// type: 'separate',
|
||||
// },
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-01 14:55:51
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-10 16:32:28
|
||||
* @LastEditTime: 2023-11-28 10:51:44
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@ -26,10 +26,10 @@ import { parseTime } from '../mixins/code-filter';
|
||||
import {
|
||||
getProcessTraceabilityPage,
|
||||
getWorkOrderList,
|
||||
getCoreProduct
|
||||
// exportEnergyPlcExcel
|
||||
} from '@/api/quality/processTraceability';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
@ -46,7 +46,7 @@ const tableProps = [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
filter:publicFormatter('work_order_status')
|
||||
filter: (val) => val == 1 ? '等待' : val == 2 ? '激活' : val == 3 ? '暂停' : val == 4 ? '完成' : '作废',
|
||||
},
|
||||
{
|
||||
prop: 'startProduceTime',
|
||||
@ -63,7 +63,7 @@ const tableProps = [
|
||||
label: '生产数量'
|
||||
},
|
||||
{
|
||||
prop: 'unit',
|
||||
prop: 'planProductUnit',
|
||||
label: '单位',
|
||||
filter: publicFormatter('unit_dict')
|
||||
},
|
||||
@ -73,7 +73,7 @@ const tableProps = [
|
||||
},
|
||||
{
|
||||
prop: 'yield',
|
||||
label: '成品率'
|
||||
label: '合格率'
|
||||
}
|
||||
];
|
||||
|
||||
@ -116,21 +116,22 @@ export default {
|
||||
selectOptions: [],
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
param: 'orderName'
|
||||
param: 'orderName',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '工单开始时间',
|
||||
dateType: 'daterange',
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: "yyyy-MM-dd",
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'timeVal',
|
||||
defaultSelect: [],
|
||||
width: 250
|
||||
},
|
||||
// {
|
||||
// type: 'datePicker',
|
||||
// label: '时间段',
|
||||
// dateType: 'daterange',
|
||||
// format: 'yyyy-MM-dd',
|
||||
// valueFormat: "yyyy-MM-dd",
|
||||
// rangeSeparator: '-',
|
||||
// startPlaceholder: '开始时间',
|
||||
// endPlaceholder: '结束时间',
|
||||
// param: 'timeVal',
|
||||
// defaultSelect: [],
|
||||
// width: 250
|
||||
// },
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '搜索',
|
||||
@ -185,17 +186,25 @@ export default {
|
||||
handleClick(val) {
|
||||
if (val.type === "processDetail") {
|
||||
console.log(val);
|
||||
this.$router.push({
|
||||
name: 'process-traceability-detail',
|
||||
params: {
|
||||
id: '1715180991838887938',
|
||||
orderId: val.data.id,
|
||||
name: val.data.name,
|
||||
productName: val.data.planProductName,
|
||||
processFlowName: val.data.processFlowName
|
||||
// equipmentName,
|
||||
},
|
||||
});
|
||||
let specificationsData =''
|
||||
getCoreProduct(val.data.planProductId).then((res) => {
|
||||
console.log(res)
|
||||
|
||||
this.$router.push({
|
||||
path: 'process-traceability-detail',
|
||||
query: {
|
||||
id: val.data.processFlowId,
|
||||
orderId: val.data.id,
|
||||
name: val.data.name,
|
||||
specifications: res.data.specifications,
|
||||
productName: val.data.planProductName,
|
||||
processFlowName: val.data.processFlowName,
|
||||
// planProductId: val.data.planProductId
|
||||
// equipmentName,
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
// this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
|
||||
}
|
||||
},
|
||||
@ -241,13 +250,13 @@ export default {
|
||||
if (val.btnName === 'search') {
|
||||
this.listQuery.orderName = val.orderName ? val.orderName :undefined
|
||||
// this.queryParams.status = val.status
|
||||
// if (val.timeVal && val.timeVal.length != 0 ) {
|
||||
// this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
|
||||
// this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
|
||||
// } else {
|
||||
// this.listQuery.startTime = undefined
|
||||
// this.listQuery.endTime = undefined
|
||||
// }
|
||||
if (val.timeVal && val.timeVal.length != 0 ) {
|
||||
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
|
||||
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
|
||||
} else {
|
||||
this.listQuery.startTime = undefined
|
||||
this.listQuery.endTime = undefined
|
||||
}
|
||||
this.getList()
|
||||
} else {
|
||||
// this.handleExport()
|
||||
|
@ -117,11 +117,11 @@ export default {
|
||||
// },
|
||||
{ prop: 'name', label: '参数名' },
|
||||
{
|
||||
prop: 'name', label: '设定范围最小- 最大 / 标准',
|
||||
prop: 'status', label: '设定范围最小- 最大 / 标准',
|
||||
subcomponent: StatusBtn
|
||||
},
|
||||
{
|
||||
prop: 'code', label: '最小值',
|
||||
prop: '', label: '最小值',
|
||||
children: [
|
||||
{
|
||||
prop: 'minValueSet',
|
||||
@ -134,7 +134,7 @@ export default {
|
||||
]
|
||||
},
|
||||
{
|
||||
prop: 'code', label: '最大值',
|
||||
prop: '', label: '最大值',
|
||||
children: [
|
||||
{
|
||||
prop: 'maxValueSet',
|
||||
@ -184,9 +184,9 @@ export default {
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
orderId: this.$route.query.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
// orderId: this.$route.query.orderId,
|
||||
|
||||
},).then((res) => {
|
||||
console.log(res);
|
||||
@ -231,25 +231,29 @@ export default {
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
orderId: this.$route.query.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
// orderId: this.$route.query.orderId,
|
||||
|
||||
},).then((res) => {
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
if (res.data.length != []) {
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
}
|
||||
})
|
||||
} else {
|
||||
getDetValue({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
orderId: this.$route.query.orderId,
|
||||
flowDetId: [this.detId],
|
||||
// orderId: this.$route.params.orderId,
|
||||
// orderId: this.$route.query.orderId,
|
||||
|
||||
}).then((res) => {
|
||||
this.valueList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
if (res.data.length != []) {
|
||||
this.valueList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -258,12 +262,14 @@ export default {
|
||||
getDetMaterial({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orderId: this.$route.params.orderId,
|
||||
orderId: this.$route.query.orderId,
|
||||
flowDetId: [this.detId],
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
if (res.data.length != []) {
|
||||
this.materialList = res.data[0].data
|
||||
this.name = res.data[0].name
|
||||
}
|
||||
})
|
||||
},
|
||||
clearList() {
|
||||
|
@ -123,7 +123,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.$route.params.id)
|
||||
console.log(this.$route.query.id)
|
||||
this.loadLayout().then(json => {
|
||||
this.initGraph(json)
|
||||
})
|
||||
@ -260,7 +260,7 @@ export default {
|
||||
},
|
||||
|
||||
async loadLayout() {
|
||||
const flowId = this.$route.params.id;
|
||||
const flowId = this.$route.query.id;
|
||||
console.log(flowId)
|
||||
if (!flowId) return { cells: [] }
|
||||
const { code, data } = await this.info({ id: flowId });
|
||||
@ -288,12 +288,12 @@ export default {
|
||||
async handleUpdateLayout() {
|
||||
this.layout.content = JSON.stringify(this.graph.toJSON());
|
||||
let code, data;
|
||||
console.table([this.layout, this.$route.params.id])
|
||||
console.table([this.layout, this.$route.query.id])
|
||||
// 手动刷新布局
|
||||
if (this.layout.id) {
|
||||
({ code, data } = await this.http('/extend/process-flow-view/update', 'put', this.layout));
|
||||
} else {
|
||||
this.layout.flowId = this.$route.params.id;
|
||||
this.layout.flowId = this.$route.query.id;
|
||||
({ code, data } = await this.http('/extend/process-flow-view/create', 'post', this.layout));
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ export default {
|
||||
},
|
||||
|
||||
createProcess() {
|
||||
// const flowId = this.$route.params.id;
|
||||
// const flowId = this.$route.query.id;
|
||||
const flowId = this.getFlowId(); // it also works
|
||||
if (!flowId) {
|
||||
this.$modal.msgError('工艺ID不能为空');
|
||||
|
@ -20,14 +20,13 @@
|
||||
<InfoItem label="产品名称" :value="form.productName" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<InfoItem label="产品规格" />
|
||||
<InfoItem label="产品规格" :value="form.specifications" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
const InfoItem = {
|
||||
name: 'InfoItem',
|
||||
components: {},
|
||||
@ -62,6 +61,7 @@ export default {
|
||||
id: null,
|
||||
name: null,
|
||||
productName: null,
|
||||
specifications:null,
|
||||
processFlowName: null,
|
||||
// remark: null,
|
||||
// enable: null,
|
||||
@ -70,7 +70,8 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getInfo()
|
||||
this.getInfo()
|
||||
console.log(this.$route.query)
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
@ -95,12 +96,14 @@ export default {
|
||||
// info(payload) {
|
||||
// return this.http(this.infoUrl, 'get', payload);
|
||||
// },
|
||||
async getInfo() {
|
||||
this.form.name = this.$route.params.name
|
||||
this.form.productName = this.$route.params.productName
|
||||
this.form.processFlowName = this.$route.params.processFlowName
|
||||
// this.form.name = this.$route.params.name
|
||||
// const flowId = this.$route.params.id;
|
||||
getInfo() {
|
||||
// console.log(this.$route.query.planProductId);
|
||||
this.form.name = this.$route.query.name
|
||||
this.form.specifications = this.$route.query.specifications
|
||||
this.form.productName = this.$route.query.productName
|
||||
this.form.processFlowName = this.$route.query.processFlowName
|
||||
// this.form.name = this.$route.query.name
|
||||
// const flowId = this.$route.query.id;
|
||||
// console.log(flowId);
|
||||
// if (!flowId) this.$router.go(-1);
|
||||
// const { code, data } = await this.info({ id: flowId });
|
||||
|
@ -1,3 +1,10 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-28 10:41:50
|
||||
* @LastEditTime: 2023-11-28 10:49:43
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<!--
|
||||
filename: index.vue
|
||||
author: liubin
|
||||
@ -37,8 +44,8 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
console.log('activated...', this.$route.params);
|
||||
this.flowId = this.$route.params.id;
|
||||
console.log('activated...', this.$route.query);
|
||||
this.flowId = this.$route.query.id;
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
|
@ -9,8 +9,8 @@
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:page="1"
|
||||
:limit="10"
|
||||
:table-data="list">
|
||||
<!-- <method-btn
|
||||
v-if="tableBtn.length"
|
||||
@ -109,9 +109,6 @@ export default {
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi(
|
||||
// 'base:quality-inspection-record:create'
|
||||
|
Ładowanie…
Reference in New Issue
Block a user