Merge pull request 'projects/line-new-zhp' (#461) from projects/line-new-zhp into projects/line-new
Reviewed-on: #461
This commit is contained in:
4
.env.dev
4
.env.dev
@@ -13,8 +13,8 @@ VUE_APP_TITLE = 智能监控分析系统
|
||||
|
||||
# 芋道管理系统/开发环境
|
||||
# VUE_APP_BASE_API = 'http://172.16.33.187:48082'
|
||||
# VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
|
||||
VUE_APP_BASE_API = 'http://172.16.32.79:48082'
|
||||
VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
|
||||
# VUE_APP_BASE_API = 'http://172.16.32.79:48082'
|
||||
|
||||
|
||||
# 路由懒加载
|
||||
|
||||
@@ -62,10 +62,10 @@ export function getEquipmentAll() {
|
||||
|
||||
export function getTree(query) {
|
||||
return request({
|
||||
url: '/base/factory/getTree',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
url: '/base/factory/getTreeSimple',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
export function getEquipmentOverall(data) {
|
||||
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.currentMenu = this.menus[0];
|
||||
// this.currentMenu = this.menus[0];
|
||||
},
|
||||
watch: {
|
||||
currentMenu(val) {
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
style="width: 75%"
|
||||
v-model="dataForm.price"
|
||||
clearable
|
||||
placeholder="请输入允许留存时间" />
|
||||
placeholder="请输入单价" />
|
||||
{{ unit }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -140,13 +140,15 @@ export default {
|
||||
setTimeout(this.setCode(), 1000);
|
||||
}
|
||||
},
|
||||
setCode() {
|
||||
setCode() {
|
||||
console.log('this.MaterialList', this.urlOptions.dictArr.dict0);
|
||||
|
||||
this.MaterialList.forEach((item) => {
|
||||
if (item.id === this.dataForm.materialId) {
|
||||
this.dataForm.code = item.code;
|
||||
this.unit =
|
||||
'元/' +
|
||||
this.urlOptions.dictArr.dict0.find((d) => d.value === item.unit)
|
||||
this.urlOptions.dictArr.dict0.find((d) => d.value == item.unit)
|
||||
.label;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -90,6 +90,7 @@ export default {
|
||||
param: 'lineIds',
|
||||
defaultSelect: [],
|
||||
multiple: true,
|
||||
collapseTags: true,
|
||||
filterable: true,
|
||||
width: 300,
|
||||
},
|
||||
|
||||
@@ -80,6 +80,16 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label=" 基板类型" prop="typeDictValue">
|
||||
<el-select :disabled="isdetail" v-model="dataForm.typeDictValue" clearable
|
||||
style="width: 100%" placeholder="请选择基板类型">
|
||||
<el-option v-for="dict in typeList" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
||||
@@ -131,160 +141,184 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
deleteProductAttr,
|
||||
getProductAttrPage,
|
||||
deleteProductAttr,
|
||||
getProductAttrPage,
|
||||
} from '@/api/core/base/productAttr';
|
||||
|
||||
import {
|
||||
createProduct,
|
||||
updateProduct,
|
||||
getProduct,
|
||||
getCode,
|
||||
createProduct,
|
||||
updateProduct,
|
||||
getProduct,
|
||||
getCode,
|
||||
} from '@/api/core/base/product';
|
||||
import productAttrAdd from './attr-add';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import SmallTitle from './SmallTitle';
|
||||
|
||||
import { listData } from "@/api/system/dict/data"; //数据字典接口
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
},
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
},
|
||||
];
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
filter: parseTime,
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '属性名',
|
||||
},
|
||||
{
|
||||
prop: 'value',
|
||||
label: '属性值',
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
filter: parseTime,
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '属性名',
|
||||
},
|
||||
{
|
||||
prop: 'value',
|
||||
label: '属性值',
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
components: { productAttrAdd, SmallTitle },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
tableProps,
|
||||
productAttributeList: [],
|
||||
dataForm: {
|
||||
id: null,
|
||||
name: '', // 产品名称
|
||||
code: '', // 产品编码
|
||||
area: 0, // 深加工单位平方数(float only)
|
||||
typeDictValue: null, // 产品类型id
|
||||
processTime: null, // 单位产品用时 (s)
|
||||
specifications: '', // 深加工规格
|
||||
unitDictValue: '', // 单位id
|
||||
originalSpecifications: '', // 原片规格
|
||||
components: { productAttrAdd, SmallTitle },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
tableProps,
|
||||
productAttributeList: [],
|
||||
dataForm: {
|
||||
id: null,
|
||||
name: '', // 产品名称
|
||||
code: '', // 产品编码
|
||||
area: 0, // 深加工单位平方数(float only)
|
||||
typeDictValue: null, // 产品类型id
|
||||
processTime: null, // 单位产品用时 (s)
|
||||
specifications: '', // 深加工规格
|
||||
unitDictValue: '', // 单位id
|
||||
originalSpecifications: '', // 原片规格
|
||||
originalArea: 0, // 原片单位平方数
|
||||
processTypes: [],
|
||||
},
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 0,
|
||||
typeDictValue: null,
|
||||
},
|
||||
typeList:[],
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 0,
|
||||
},
|
||||
processTypeList: [
|
||||
{
|
||||
value: '1',
|
||||
label:'压花丝印'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '无印打孔'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '单层镀膜'
|
||||
}, {
|
||||
value: '4',
|
||||
label: '双层镀膜'
|
||||
}
|
||||
// {
|
||||
// value: '1',
|
||||
// label: '压花丝印'
|
||||
// },
|
||||
// {
|
||||
// value: '2',
|
||||
// label: '无印打孔'
|
||||
// },
|
||||
// {
|
||||
// value: '3',
|
||||
// label: '单层镀膜'
|
||||
// }, {
|
||||
// value: '4',
|
||||
// label: '双层镀膜'
|
||||
// }
|
||||
],
|
||||
dataRule: {
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品编码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
// {
|
||||
// type: 'number',
|
||||
// message: '产品编码为数字类型',
|
||||
// trigger: 'blur',
|
||||
// transfom: 'val => Number(val)',
|
||||
// },
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
typeDictValue: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品类型不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
area: [
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入正确的数值',
|
||||
trigger: 'change',
|
||||
transform: (val) => Number(val),
|
||||
},
|
||||
],
|
||||
processTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '完成单位产品用时不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入正确的数值',
|
||||
trigger: 'blur',
|
||||
transform: (val) => Number(val),
|
||||
},
|
||||
],
|
||||
},
|
||||
isdetail: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
this.productAttributeList.splice(0);
|
||||
this.listQuery.total = 0;
|
||||
},
|
||||
init(id, isdetail) {
|
||||
this.initData();
|
||||
this.isdetail = isdetail || false;
|
||||
dataRule: {
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品编码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
// {
|
||||
// type: 'number',
|
||||
// message: '产品编码为数字类型',
|
||||
// trigger: 'blur',
|
||||
// transfom: 'val => Number(val)',
|
||||
// },
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
typeDictValue: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品类型不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
area: [
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入正确的数值',
|
||||
trigger: 'change',
|
||||
transform: (val) => Number(val),
|
||||
},
|
||||
],
|
||||
processTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '完成单位产品用时不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入正确的数值',
|
||||
trigger: 'blur',
|
||||
transform: (val) => Number(val),
|
||||
},
|
||||
],
|
||||
},
|
||||
isdetail: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async initData() {
|
||||
this.productAttributeList.splice(0);
|
||||
this.listQuery.total = 0;
|
||||
const typeRes = await listData({
|
||||
pageNo:
|
||||
1,
|
||||
pageSize
|
||||
: 10,
|
||||
dictType
|
||||
: 'product_type'
|
||||
})
|
||||
|
||||
this.typeList = typeRes.data.list
|
||||
console.log('typeRes', this.typeList);
|
||||
const processTypeRes = await listData({
|
||||
pageNo:
|
||||
1,
|
||||
pageSize
|
||||
: 10,
|
||||
dictType
|
||||
: 'process_type'
|
||||
})
|
||||
|
||||
this.processTypeList = processTypeRes.data.list
|
||||
console.log('typeRes', this.typeList);
|
||||
},
|
||||
init(id, isdetail) {
|
||||
this.initData();
|
||||
this.isdetail = isdetail || false;
|
||||
this.dataForm.id = id || null;
|
||||
// this.dataForm.processTypes = [] // 清空工艺选择
|
||||
this.visible = true;
|
||||
this.visible = true;
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
|
||||
if (this.dataForm.id) {
|
||||
// 获取产品详情
|
||||
if (this.dataForm.id) {
|
||||
// 获取产品详情
|
||||
getProduct(id).then((res) => {
|
||||
const resData = res.data || {};
|
||||
// 逐个字段赋值(保留响应式)
|
||||
@@ -305,161 +339,163 @@ export default {
|
||||
|
||||
console.log('工艺列表(编辑时):', this.dataForm.processTypes); // 验证是否为 ["1","2"] 格式
|
||||
});
|
||||
// 获取产品的属性列表
|
||||
this.getList();
|
||||
} else {
|
||||
getCode().then((res) => {
|
||||
this.dataForm.code = res.data;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取产品的属性列表
|
||||
this.getList();
|
||||
} else {
|
||||
getCode().then((res) => {
|
||||
this.dataForm.code = res.data;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getList() {
|
||||
// 获取产品的属性列表
|
||||
getProductAttrPage({
|
||||
...this.listQuery,
|
||||
productId: this.dataForm.id,
|
||||
}).then((response) => {
|
||||
this.productAttributeList = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
});
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${
|
||||
raw.data.name
|
||||
? '[名称=' + raw.data.name + ']'
|
||||
: '[序号=' + raw.data._pageIndex + ']'
|
||||
}进行删除操作?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
deleteProductAttr(raw.data.id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
} else {
|
||||
this.addNew(raw.data.id);
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
getList() {
|
||||
// 获取产品的属性列表
|
||||
getProductAttrPage({
|
||||
...this.listQuery,
|
||||
productId: this.dataForm.id,
|
||||
}).then((response) => {
|
||||
this.productAttributeList = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
});
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${raw.data.name
|
||||
? '[名称=' + raw.data.name + ']'
|
||||
: '[序号=' + raw.data._pageIndex + ']'
|
||||
}进行删除操作?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
deleteProductAttr(raw.data.id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
} else {
|
||||
this.addNew(raw.data.id);
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
updateProduct(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createProduct(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.$confirm(`是否新增产品属性?`, '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
updateProduct(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createProduct(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.$confirm(`是否新增产品属性?`, '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
this.dataForm.id = response.data
|
||||
this.addNew();
|
||||
})
|
||||
.catch(() => {
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false;
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
if (this.dataForm.id) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
});
|
||||
} else {
|
||||
this.$message('请先创建产品!');
|
||||
}
|
||||
},
|
||||
goback() {
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
this.initData();
|
||||
},
|
||||
},
|
||||
this.addNew();
|
||||
})
|
||||
.catch(() => {
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false;
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
if (this.dataForm.id) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
});
|
||||
} else {
|
||||
this.$message('请先创建产品!');
|
||||
}
|
||||
},
|
||||
goback() {
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
this.initData();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer >>> .el-drawer {
|
||||
border-radius: 8px 0 0 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.drawer>>>.el-drawer {
|
||||
border-radius: 8px 0 0 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.drawer >>> .el-form-item__label {
|
||||
padding: 0;
|
||||
.drawer>>>.el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.drawer >>> .el-drawer__header {
|
||||
margin: 0;
|
||||
padding: 32px 32px 24px;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
}
|
||||
.drawer >>> .el-drawer__body {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.drawer>>>.el-drawer__header {
|
||||
margin: 0;
|
||||
padding: 32px 32px 24px;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
}
|
||||
|
||||
.drawer >>> .content {
|
||||
padding: 30px 24px;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* height: 100%; */
|
||||
.drawer>>>.el-drawer__body {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.drawer >>> .visual-part {
|
||||
flex: 1 auto;
|
||||
max-height: 76vh;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
padding-right: 10px; /* 调整滚动条样式 */
|
||||
.drawer>>>.content {
|
||||
padding: 30px 24px;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* height: 100%; */
|
||||
}
|
||||
|
||||
.drawer >>> .el-form,
|
||||
.drawer >>> .attr-list {
|
||||
padding: 0 16px;
|
||||
.drawer>>>.visual-part {
|
||||
flex: 1 auto;
|
||||
max-height: 76vh;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
padding-right: 10px;
|
||||
/* 调整滚动条样式 */
|
||||
}
|
||||
|
||||
.drawer>>>.el-form,
|
||||
.drawer>>>.attr-list {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.drawer-body__footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 18px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -104,7 +104,11 @@ export default {
|
||||
getDataListURL: getProductionLinePage,
|
||||
deleteURL: deleteProductionLine,
|
||||
exportURL: exportProductionLineExcel,
|
||||
},
|
||||
},
|
||||
listQuery: {
|
||||
pageSize: 20,
|
||||
pageNo:1
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:production-line:update`)
|
||||
@@ -212,7 +216,7 @@ export default {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.pageSize = 20;
|
||||
this.listQuery.factoryId = val.factoryId || undefined;
|
||||
this.listQuery.name = val.name;
|
||||
this.getDataList();
|
||||
@@ -220,7 +224,7 @@ export default {
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.listQuery = {
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
};
|
||||
|
||||
@@ -519,6 +519,12 @@ export default {
|
||||
btnName: '重置',
|
||||
name: 'reset',
|
||||
},
|
||||
// {
|
||||
// type: 'label', // 初始隐藏
|
||||
// label: '刷新时间', // 自定义标识
|
||||
// // slot: 'currentTimeSlot', // 自定义插槽名
|
||||
// // width: 200, // 宽度适配
|
||||
// },
|
||||
]
|
||||
};
|
||||
},
|
||||
@@ -541,7 +547,7 @@ export default {
|
||||
{
|
||||
prop: 'processType',
|
||||
label: '产品类型',
|
||||
filter: (val) => (val != 1 ? '面板' : '背板'),
|
||||
filter: (val) => (val === 1 ? '面板' : '背板'),
|
||||
fixed: true,
|
||||
sortable: true,
|
||||
},
|
||||
@@ -588,12 +594,12 @@ export default {
|
||||
// end.getTime()
|
||||
// ];
|
||||
|
||||
this.$refs.searchBarForm.formInline.timeType = 1
|
||||
|
||||
this.$refs.searchBarForm.formInline.timeType = 3
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.getDayDataList();
|
||||
// this.getLastDayDataList();
|
||||
this.getPdLineList();
|
||||
const queryParams = {
|
||||
pageNo: 1,
|
||||
@@ -642,6 +648,12 @@ export default {
|
||||
this.formConfig[1].type = ''; // 隐藏查询类型
|
||||
this.formConfig[6].type = ''; // 隐藏报表类型
|
||||
this.formConfig[7].type = ''; // 隐藏时间范围
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1);
|
||||
}
|
||||
};
|
||||
|
||||
// 3. 执行公共重置
|
||||
@@ -656,14 +668,43 @@ export default {
|
||||
this.formConfig[3].type = 'select'; // 显示产线
|
||||
this.formConfig[4].type = ''; // 隐藏产品工艺
|
||||
this.formConfig[5].type = ''; // 隐藏产品类型
|
||||
this.getDayDataList();
|
||||
|
||||
this.listQuery.timeType = 3;
|
||||
if (this.$refs.searchBarForm) {
|
||||
this.$refs.searchBarForm.formInline.timeType = 3;
|
||||
}
|
||||
// 主动调用上一班数据接口
|
||||
this.getLastDayDataList();
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
const timeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
} else {
|
||||
|
||||
// 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班
|
||||
this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班
|
||||
this.formConfig[3].type = ''; // 隐藏产线
|
||||
this.formConfig[4].type = 'select'; // 显示产品工艺
|
||||
this.formConfig[5].type = 'select'; // 显示产品类型
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
const timeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
this.getProductList();
|
||||
|
||||
}
|
||||
@@ -995,6 +1036,26 @@ export default {
|
||||
}
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
|
||||
// 仅当时间维度为【当天】时,添加/更新刷新时间
|
||||
if (this.listQuery.timeType === 1 || this.listQuery.timeType === 3) {
|
||||
const timeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
} else if (timeItemIndex > -1) {
|
||||
// 非当天时,移除刷新时间
|
||||
this.formConfig.splice(timeItemIndex, 1);
|
||||
}
|
||||
|
||||
if (this.activeName === 'productLine') {
|
||||
if (this.listQuery.timeType === 1) {
|
||||
this.getDayDataList();
|
||||
@@ -1012,7 +1073,7 @@ export default {
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.$refs.searchBarForm.formInline.timeType = 1;
|
||||
this.$refs.searchBarForm.formInline.timeType = 3;
|
||||
this.formConfig[0].selectOptions = this.activeName === 'productLine'
|
||||
? this.timeTypeOptions.productLine
|
||||
: this.timeTypeOptions.product;
|
||||
@@ -1020,10 +1081,23 @@ export default {
|
||||
pageSize: 100,
|
||||
pageNo: 1,
|
||||
total: 0,
|
||||
timeType: 1,
|
||||
timeType: this.activeName === 'productLine' ? 3 : 1,
|
||||
};
|
||||
// 重置后默认是当天,添加刷新时间
|
||||
const resetTimeIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
const resetTimeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (resetTimeIndex > -1) {
|
||||
this.formConfig.splice(resetTimeIndex, 1, resetTimeLabel);
|
||||
} else {
|
||||
this.formConfig.push(resetTimeLabel);
|
||||
}
|
||||
if (this.activeName === 'productLine') {
|
||||
this.getDayDataList();
|
||||
this.getLastDayDataList();
|
||||
} else {
|
||||
this.getProductList();
|
||||
}
|
||||
@@ -1350,29 +1424,48 @@ export default {
|
||||
this.listQuery.pageNo = val;
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
formatCurrentTime() {
|
||||
const date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${hours}:${minutes}:${seconds} ${year}.${month}.${day}`;
|
||||
},
|
||||
// 搜索栏下拉选择变化
|
||||
handleSearchBarChanged({ param, value }) {
|
||||
if (param === 'timeType') {
|
||||
console.log(value);
|
||||
|
||||
this.listQuery.timeType = value;
|
||||
if (value === 2) {
|
||||
// 切换为“自定义”:显示查询类型和时间范围
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
|
||||
// 仅移除,不添加(查询时才添加)
|
||||
if (value !== 1 && value !== 3 && timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1);
|
||||
}
|
||||
|
||||
this.$refs.searchBarForm.formInline.timeType = value;
|
||||
this.$refs.searchBarForm.formInline.searchType = undefined;
|
||||
this.$refs.searchBarForm.formInline.reportType = undefined;
|
||||
this.$refs.searchBarForm.formInline.timeVal = undefined;
|
||||
|
||||
if (value === 1) {
|
||||
this.formConfig[1].type = '';
|
||||
this.formConfig[6].type = '';
|
||||
this.formConfig[7].type = '';
|
||||
} else if (value === 2) {
|
||||
this.formConfig[1].type = 'select';
|
||||
this.$refs.searchBarForm.formInline.timeType = value;
|
||||
this.listQuery.timeType = value;
|
||||
this.$refs.searchBarForm.formInline.searchType = 1;
|
||||
this.formConfig[7].type = 'datePicker';
|
||||
} else {
|
||||
this.formConfig[1].type = '';
|
||||
this.formConfig[6].type = '';
|
||||
this.formConfig[7].type = '';
|
||||
this.$refs.searchBarForm.formInline.timeType = value;
|
||||
this.listQuery.timeType = value;
|
||||
this.$refs.searchBarForm.formInline.searchType = undefined;
|
||||
this.$refs.searchBarForm.formInline.reportType = undefined;
|
||||
this.$refs.searchBarForm.formInline.timeVal = undefined;
|
||||
}
|
||||
|
||||
} else if (param === 'searchType') {
|
||||
if (value === 1) {
|
||||
// 统计数据:显示时间范围,隐藏报表类型
|
||||
@@ -1422,7 +1515,10 @@ export default {
|
||||
label: '时间范围',
|
||||
dateType: 'week',
|
||||
placeholder: '选择日期',
|
||||
format: 'yyyy-MM-dd',
|
||||
format: 'yyyy 第 WW 周',
|
||||
pickerOptions: {
|
||||
firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推)
|
||||
},
|
||||
valueFormat: 'yyyy-MM-dd',
|
||||
param: 'timeValWeek',
|
||||
width: 250,
|
||||
|
||||
@@ -204,94 +204,88 @@ export default {
|
||||
);
|
||||
});
|
||||
},
|
||||
test() {
|
||||
var target = document.getElementsByClassName("right-aside")[0]
|
||||
target.style.background = '#FFFFFF'
|
||||
var that = this
|
||||
setTimeout(() => {
|
||||
html2canvas(target).then(function(canvas) {
|
||||
var contentWidth = canvas.width
|
||||
var contentHeight = canvas.height
|
||||
|
||||
// 一页pdf显示html页面生成的canvas高度
|
||||
var pageHeight = contentHeight / 592.28 * 841.89
|
||||
// 未生成pdf的html页面高度
|
||||
var leftHeight = contentHeight
|
||||
// 页面偏移
|
||||
var position = 0
|
||||
// a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的高度
|
||||
var imgWidth = 595.28
|
||||
var imgHeight = 592.28 / contentWidth * contentHeight
|
||||
|
||||
var pageData = canvas.toDataURL('image/jpeg', 1.0)
|
||||
|
||||
console.log('nihc URL', leftHeight, pageHeight)
|
||||
|
||||
var pdf = new jsPDF('', 'pt', 'a4')
|
||||
|
||||
if (leftHeight < pageHeight) {
|
||||
pdf.addImage(pageData, 'JPEG', 0, 20, imgWidth, imgHeight)
|
||||
} else {
|
||||
while(leftHeight > 0) {
|
||||
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
|
||||
leftHeight -= pageHeight
|
||||
position -= 841.89
|
||||
// 避免空白页
|
||||
if (leftHeight > 0) {
|
||||
pdf.addPage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pdf.save(that.fileName + '工段统计.pdf')
|
||||
})
|
||||
}, 300)
|
||||
},
|
||||
exportECL() {
|
||||
let tables = document.querySelector('.el-table').cloneNode(true)
|
||||
const fix = tables.querySelector('.el-table__fixed')
|
||||
const fixRight = tables.querySelector('.el-table__fixed-right')
|
||||
if (fix) {
|
||||
tables.removeChild(tables.querySelector('.el-table__fixed'))
|
||||
}
|
||||
if (fixRight) {
|
||||
tables.removeChild(tables.querySelector('.el-table__fixed-right'))
|
||||
}
|
||||
let exportTable = XLSX.utils.table_to_book(tables)
|
||||
|
||||
var exportTableOut = XLSX.write(exportTable, {
|
||||
bookType: 'xlsx', bookSST: true, type: 'array'
|
||||
})
|
||||
// sheetjs.xlsx为导出表格的标题名称
|
||||
try {
|
||||
FileSaver.saveAs(new Blob([exportTableOut], {
|
||||
type: 'application/octet-stream'
|
||||
}), this.fileName + '工段统计.xlsx')
|
||||
} catch (e) {
|
||||
if (typeof console !== 'undefined') console.log(e, exportTableOut)
|
||||
exportXlsx() {
|
||||
if (!this.showData.length) {
|
||||
this.$message.warning('暂无数据可导出');
|
||||
return;
|
||||
}
|
||||
return exportTableOut
|
||||
},
|
||||
exportPdf() {
|
||||
this.test()
|
||||
setTimeout(() =>{
|
||||
this.dialogVisible = false
|
||||
this.showData = this.tableData
|
||||
}, 600)
|
||||
|
||||
},
|
||||
exportXlsx() {
|
||||
this.exportECL()
|
||||
this.dialogVisible = false
|
||||
this.showData = this.tableData
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done();
|
||||
})
|
||||
.catch(_ => {});
|
||||
},
|
||||
this.exportLoading = true;
|
||||
|
||||
try {
|
||||
// 1. 处理导出数据(格式化时间字段)
|
||||
const exportData = this.showData.map(item => {
|
||||
const formatItem = { ...item };
|
||||
// 格式化时间字段
|
||||
if (formatItem.startTime) formatItem.startTime = parseTime(formatItem.startTime);
|
||||
if (formatItem.endTime) formatItem.endTime = parseTime(formatItem.endTime);
|
||||
return formatItem;
|
||||
});
|
||||
|
||||
// 2. 构建表头映射:{ prop: label },只保留表格配置中存在的列
|
||||
const headerMap = {};
|
||||
this.tableProps.forEach(col => {
|
||||
if (col.prop && col.label) {
|
||||
headerMap[col.prop] = col.label;
|
||||
}
|
||||
});
|
||||
|
||||
// 3. 转换数据:将prop键名替换为label,按tableProps顺序排列列
|
||||
const formattedData = exportData.map(item => {
|
||||
const newItem = {};
|
||||
// 按表格配置顺序遍历列,确保Excel列顺序与表格一致
|
||||
this.tableProps.forEach(col => {
|
||||
const prop = col.prop;
|
||||
const label = col.label;
|
||||
if (prop && label) {
|
||||
// 处理可能的undefined值,避免导出为空字符串
|
||||
newItem[label] = item[prop] ?? '';
|
||||
}
|
||||
});
|
||||
return newItem;
|
||||
});
|
||||
|
||||
// 4. 创建工作表(使用处理后的带label表头的数据)
|
||||
const worksheet = XLSX.utils.json_to_sheet(formattedData);
|
||||
|
||||
// 5. 创建工作簿并添加工作表
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, '下片日志数据');
|
||||
|
||||
// 6. 生成Excel文件
|
||||
const excelBuffer = XLSX.write(workbook, {
|
||||
bookType: 'xlsx',
|
||||
type: 'array'
|
||||
});
|
||||
|
||||
// 7. 保存文件
|
||||
const blob = new Blob([excelBuffer], {
|
||||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
||||
});
|
||||
|
||||
// 8. 生成文件名(包含查询条件信息)
|
||||
let fileName = '下片历史';
|
||||
if (this.listQuery.productionLineId) {
|
||||
const lineItem = this.formConfig[0].selectOptions.find(
|
||||
item => item.id === this.listQuery.productionLineId
|
||||
);
|
||||
if (lineItem) fileName += lineItem.name + '_';
|
||||
}
|
||||
if (this.listQuery.thick) {
|
||||
fileName += this.listQuery.thick + '_';
|
||||
}
|
||||
// 添加时间戳避免文件名重复
|
||||
fileName += + '.xlsx';
|
||||
|
||||
FileSaver.saveAs(blob, fileName);
|
||||
this.$message.success('导出成功');
|
||||
} catch (error) {
|
||||
console.error('导出失败:', error);
|
||||
this.$message.error('导出失败,请重试');
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
getPdLineList() {
|
||||
getPdList().then((res) => {
|
||||
this.formConfig[0].selectOptions = res.data || []
|
||||
@@ -323,7 +317,7 @@ export default {
|
||||
this.getDataList();
|
||||
break;
|
||||
case 'export':
|
||||
this.handleExport();
|
||||
this.exportXlsx();
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
@@ -351,12 +345,6 @@ export default {
|
||||
this.listQuery.pageNo = val;
|
||||
this.getDataList();
|
||||
},
|
||||
handleExport() {
|
||||
if (this.selectedList.length > 0) {
|
||||
this.showData = this.selectedList
|
||||
}
|
||||
this.dialogVisible = true
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -570,22 +570,35 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
// 1. 强制设置当前激活标签为 按产品监控
|
||||
this.activeName = 'product';
|
||||
if (this.$refs.buttonNav) {
|
||||
this.$refs.buttonNav.currentMenu = '按产品监控';
|
||||
// 时间维度选项只显示 当天/自定义(无 上一班)
|
||||
this.formConfig[0].selectOptions = this.timeTypeOptions.product;
|
||||
}
|
||||
if (this.$refs.searchBarForm) {
|
||||
// this.$refs.searchBarForm.formInline.timeVal = [
|
||||
// yesterday.getTime(),
|
||||
// end.getTime()
|
||||
// ];
|
||||
|
||||
this.$refs.searchBarForm.formInline.timeType = 1
|
||||
|
||||
// 2. 强制设置搜索表单的 timeType 为 1(当天)
|
||||
this.$refs.searchBarForm.formInline.timeType = 1;
|
||||
// 同步查询参数的 timeType
|
||||
this.listQuery.timeType = 1;
|
||||
}
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
const timeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
});
|
||||
|
||||
this.getDayDataList();
|
||||
// 3. 初始化直接调用 按产品监控 的接口
|
||||
this.getProductList();
|
||||
this.getPdLineList();
|
||||
const queryParams = {
|
||||
pageNo: 1,
|
||||
@@ -597,11 +610,22 @@ export default {
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
formatCurrentTime() {
|
||||
const date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${hours}:${minutes}:${seconds} ${year}.${month}.${day}`;
|
||||
},
|
||||
// 切换按产线/按产品监控
|
||||
currentMenu(val) {
|
||||
// 1. 确定当前激活的类型(产线/产品)
|
||||
const isProductLine = val === '按产线监控';
|
||||
this.activeName = isProductLine ? 'productLine' : 'product';
|
||||
console.log('isProductLine', isProductLine);
|
||||
|
||||
// 2. 提取公共重置逻辑(无论切换到哪个标签,都需要执行的操作)
|
||||
const resetCommon = () => {
|
||||
@@ -634,11 +658,19 @@ export default {
|
||||
this.formConfig[1].type = ''; // 隐藏查询类型
|
||||
this.formConfig[6].type = ''; // 隐藏报表类型
|
||||
this.formConfig[7].type = ''; // 隐藏时间范围
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1);
|
||||
}
|
||||
};
|
||||
|
||||
// 3. 执行公共重置
|
||||
resetCommon();
|
||||
|
||||
// if (this.activeName === 'productLine') {
|
||||
// } else {
|
||||
// }
|
||||
// 4. 根据类型设置差异化的表单配置(仅处理不同的部分)
|
||||
if (isProductLine) {
|
||||
// 按产线监控:显示产线,隐藏产品工艺和类型,时间维度包含上一班
|
||||
@@ -646,16 +678,44 @@ export default {
|
||||
this.formConfig[3].type = 'select'; // 显示产线
|
||||
this.formConfig[4].type = ''; // 隐藏产品工艺
|
||||
this.formConfig[5].type = ''; // 隐藏产品类型
|
||||
this.getDayDataList();
|
||||
this.listQuery.timeType = 3;
|
||||
if (this.$refs.searchBarForm) {
|
||||
this.$refs.searchBarForm.formInline.timeType = 3;
|
||||
}
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
const timeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
// 主动调用上一班数据接口
|
||||
this.getLastDayDataList();
|
||||
|
||||
} else {
|
||||
this.getProductList();
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
const timeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
// 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班
|
||||
this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班
|
||||
this.formConfig[3].type = ''; // 隐藏产线
|
||||
this.formConfig[4].type = 'select'; // 显示产品工艺
|
||||
this.formConfig[5].type = 'select'; // 显示产品类型
|
||||
this.getProductList();
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -947,6 +1007,25 @@ export default {
|
||||
}
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
|
||||
// 仅当时间维度为【当天】时,添加/更新刷新时间
|
||||
if (this.listQuery.timeType === 1 || this.listQuery.timeType === 3) {
|
||||
const timeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
} else if (timeItemIndex > -1) {
|
||||
// 非当天时,移除刷新时间
|
||||
this.formConfig.splice(timeItemIndex, 1);
|
||||
}
|
||||
if (this.activeName === 'productLine') {
|
||||
if (this.listQuery.timeType === 1) {
|
||||
this.getDayDataList();
|
||||
@@ -965,15 +1044,27 @@ export default {
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.$refs.searchBarForm.formInline.timeType = 1;
|
||||
this.formConfig[0].selectOptions = this.activeName === 'productLine'
|
||||
this.formConfig[0].selectOptions = this.activeName === 'product'
|
||||
? this.timeTypeOptions.productLine
|
||||
: this.timeTypeOptions.product;
|
||||
this.listQuery = {
|
||||
pageSize: 100,
|
||||
pageNo: 1,
|
||||
total: 0,
|
||||
timeType: 1,
|
||||
timeType: this.activeName === 'productLine' ? 3 : 1,
|
||||
};
|
||||
const resetTimeIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
const resetTimeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (resetTimeIndex > -1) {
|
||||
this.formConfig.splice(resetTimeIndex, 1, resetTimeLabel);
|
||||
} else {
|
||||
this.formConfig.push(resetTimeLabel);
|
||||
}
|
||||
if (this.activeName === 'productLine') {
|
||||
this.getDayDataList();
|
||||
} else {
|
||||
@@ -1307,24 +1398,33 @@ export default {
|
||||
handleSearchBarChanged({ param, value }) {
|
||||
console.log(value, param);
|
||||
if (param === 'timeType') {
|
||||
console.log(value);
|
||||
|
||||
this.listQuery.timeType = value;
|
||||
if (value === 2) {
|
||||
// 切换为“自定义”:显示查询类型和时间范围
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
|
||||
// 仅移除,不添加(查询时才添加)
|
||||
if (value !== 1 && value !== 3 && timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1);
|
||||
}
|
||||
|
||||
this.$refs.searchBarForm.formInline.timeType = value;
|
||||
this.$refs.searchBarForm.formInline.searchType = undefined;
|
||||
this.$refs.searchBarForm.formInline.reportType = undefined;
|
||||
this.$refs.searchBarForm.formInline.timeVal = undefined;
|
||||
|
||||
if (value === 1) {
|
||||
this.formConfig[1].type = '';
|
||||
this.formConfig[6].type = '';
|
||||
this.formConfig[7].type = '';
|
||||
} else if (value === 2) {
|
||||
this.formConfig[1].type = 'select';
|
||||
this.$refs.searchBarForm.formInline.timeType = value;
|
||||
this.listQuery.timeType = value;
|
||||
this.$refs.searchBarForm.formInline.searchType = 1;
|
||||
this.formConfig[7].type = 'datePicker';
|
||||
} else {
|
||||
this.formConfig[1].type = '';
|
||||
this.formConfig[6].type = '';
|
||||
this.formConfig[7].type = '';
|
||||
this.$refs.searchBarForm.formInline.timeType = value;
|
||||
this.listQuery.timeType = value;
|
||||
this.$refs.searchBarForm.formInline.searchType = undefined;
|
||||
this.$refs.searchBarForm.formInline.reportType = undefined;
|
||||
this.$refs.searchBarForm.formInline.timeVal = undefined;
|
||||
}
|
||||
} else if (param === 'searchType') {
|
||||
if (value === 1) {
|
||||
@@ -1375,7 +1475,10 @@ export default {
|
||||
label: '时间范围',
|
||||
dateType: 'week',
|
||||
placeholder: '选择日期',
|
||||
format: 'yyyy-MM-dd',
|
||||
format: 'yyyy 第 WW 周',
|
||||
pickerOptions: {
|
||||
firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推)
|
||||
},
|
||||
valueFormat: 'yyyy-MM-dd',
|
||||
param: 'timeValWeek',
|
||||
width: 250,
|
||||
|
||||
@@ -244,7 +244,10 @@ export default {
|
||||
label: '统计时间',
|
||||
dateType: 'week',
|
||||
placeholder: '选择日期',
|
||||
format: 'yyyy-MM-dd',
|
||||
format: 'yyyy 第 WW 周',
|
||||
pickerOptions: {
|
||||
firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推)
|
||||
},
|
||||
valueFormat: 'yyyy-MM-dd',
|
||||
param: 'timeValWeek',
|
||||
width: 250,
|
||||
@@ -453,11 +456,10 @@ export default {
|
||||
item.statisticType = this.listQuery.statisticType;
|
||||
|
||||
// 匹配产线名称
|
||||
const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
|
||||
item.bindObjectName = targetLine ? targetLine.name : '';
|
||||
|
||||
// const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
|
||||
// item.bindObjectName = targetLine ? targetLine.name : ''
|
||||
return item;
|
||||
});
|
||||
})
|
||||
this.listQuery.total = response.data?.total || 0;
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
Reference in New Issue
Block a user