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://172.16.33.187:48082'
|
||||||
# VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
|
VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
|
||||||
VUE_APP_BASE_API = 'http://172.16.32.79:48082'
|
# VUE_APP_BASE_API = 'http://172.16.32.79:48082'
|
||||||
|
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ export function getEquipmentAll() {
|
|||||||
|
|
||||||
export function getTree(query) {
|
export function getTree(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/base/factory/getTree',
|
url: '/base/factory/getTreeSimple',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getEquipmentOverall(data) {
|
export function getEquipmentOverall(data) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.currentMenu = this.menus[0];
|
// this.currentMenu = this.menus[0];
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentMenu(val) {
|
currentMenu(val) {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
style="width: 75%"
|
style="width: 75%"
|
||||||
v-model="dataForm.price"
|
v-model="dataForm.price"
|
||||||
clearable
|
clearable
|
||||||
placeholder="请输入允许留存时间" />
|
placeholder="请输入单价" />
|
||||||
{{ unit }}
|
{{ unit }}
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -140,13 +140,15 @@ export default {
|
|||||||
setTimeout(this.setCode(), 1000);
|
setTimeout(this.setCode(), 1000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setCode() {
|
setCode() {
|
||||||
|
console.log('this.MaterialList', this.urlOptions.dictArr.dict0);
|
||||||
|
|
||||||
this.MaterialList.forEach((item) => {
|
this.MaterialList.forEach((item) => {
|
||||||
if (item.id === this.dataForm.materialId) {
|
if (item.id === this.dataForm.materialId) {
|
||||||
this.dataForm.code = item.code;
|
this.dataForm.code = item.code;
|
||||||
this.unit =
|
this.unit =
|
||||||
'元/' +
|
'元/' +
|
||||||
this.urlOptions.dictArr.dict0.find((d) => d.value === item.unit)
|
this.urlOptions.dictArr.dict0.find((d) => d.value == item.unit)
|
||||||
.label;
|
.label;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ export default {
|
|||||||
param: 'lineIds',
|
param: 'lineIds',
|
||||||
defaultSelect: [],
|
defaultSelect: [],
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
collapseTags: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
width: 300,
|
width: 300,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -80,6 +80,16 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</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>
|
</el-form>
|
||||||
|
|
||||||
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
||||||
@@ -131,160 +141,184 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
deleteProductAttr,
|
deleteProductAttr,
|
||||||
getProductAttrPage,
|
getProductAttrPage,
|
||||||
} from '@/api/core/base/productAttr';
|
} from '@/api/core/base/productAttr';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createProduct,
|
createProduct,
|
||||||
updateProduct,
|
updateProduct,
|
||||||
getProduct,
|
getProduct,
|
||||||
getCode,
|
getCode,
|
||||||
} from '@/api/core/base/product';
|
} from '@/api/core/base/product';
|
||||||
import productAttrAdd from './attr-add';
|
import productAttrAdd from './attr-add';
|
||||||
import { parseTime } from '../../mixins/code-filter';
|
import { parseTime } from '../../mixins/code-filter';
|
||||||
import SmallTitle from './SmallTitle';
|
import SmallTitle from './SmallTitle';
|
||||||
|
import { listData } from "@/api/system/dict/data"; //数据字典接口
|
||||||
const tableBtn = [
|
const tableBtn = [
|
||||||
{
|
{
|
||||||
type: 'edit',
|
type: 'edit',
|
||||||
btnName: '编辑',
|
btnName: '编辑',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
btnName: '删除',
|
btnName: '删除',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
prop: 'createTime',
|
prop: 'createTime',
|
||||||
label: '添加时间',
|
label: '添加时间',
|
||||||
filter: parseTime,
|
filter: parseTime,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '属性名',
|
label: '属性名',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'value',
|
prop: 'value',
|
||||||
label: '属性值',
|
label: '属性值',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { productAttrAdd, SmallTitle },
|
components: { productAttrAdd, SmallTitle },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
addOrUpdateVisible: false,
|
addOrUpdateVisible: false,
|
||||||
tableBtn,
|
tableBtn,
|
||||||
tableProps,
|
tableProps,
|
||||||
productAttributeList: [],
|
productAttributeList: [],
|
||||||
dataForm: {
|
dataForm: {
|
||||||
id: null,
|
id: null,
|
||||||
name: '', // 产品名称
|
name: '', // 产品名称
|
||||||
code: '', // 产品编码
|
code: '', // 产品编码
|
||||||
area: 0, // 深加工单位平方数(float only)
|
area: 0, // 深加工单位平方数(float only)
|
||||||
typeDictValue: null, // 产品类型id
|
typeDictValue: null, // 产品类型id
|
||||||
processTime: null, // 单位产品用时 (s)
|
processTime: null, // 单位产品用时 (s)
|
||||||
specifications: '', // 深加工规格
|
specifications: '', // 深加工规格
|
||||||
unitDictValue: '', // 单位id
|
unitDictValue: '', // 单位id
|
||||||
originalSpecifications: '', // 原片规格
|
originalSpecifications: '', // 原片规格
|
||||||
originalArea: 0, // 原片单位平方数
|
originalArea: 0, // 原片单位平方数
|
||||||
processTypes: [],
|
processTypes: [],
|
||||||
},
|
typeDictValue: null,
|
||||||
listQuery: {
|
},
|
||||||
pageSize: 10,
|
typeList:[],
|
||||||
pageNo: 1,
|
listQuery: {
|
||||||
total: 0,
|
pageSize: 10,
|
||||||
|
pageNo: 1,
|
||||||
|
total: 0,
|
||||||
},
|
},
|
||||||
processTypeList: [
|
processTypeList: [
|
||||||
{
|
// {
|
||||||
value: '1',
|
// value: '1',
|
||||||
label:'压花丝印'
|
// label: '压花丝印'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
value: '2',
|
// value: '2',
|
||||||
label: '无印打孔'
|
// label: '无印打孔'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
value: '3',
|
// value: '3',
|
||||||
label: '单层镀膜'
|
// label: '单层镀膜'
|
||||||
}, {
|
// }, {
|
||||||
value: '4',
|
// value: '4',
|
||||||
label: '双层镀膜'
|
// label: '双层镀膜'
|
||||||
}
|
// }
|
||||||
],
|
],
|
||||||
dataRule: {
|
dataRule: {
|
||||||
code: [
|
code: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '产品编码不能为空',
|
message: '产品编码不能为空',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// type: 'number',
|
// type: 'number',
|
||||||
// message: '产品编码为数字类型',
|
// message: '产品编码为数字类型',
|
||||||
// trigger: 'blur',
|
// trigger: 'blur',
|
||||||
// transfom: 'val => Number(val)',
|
// transfom: 'val => Number(val)',
|
||||||
// },
|
// },
|
||||||
],
|
],
|
||||||
name: [
|
name: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '产品名称不能为空',
|
message: '产品名称不能为空',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
typeDictValue: [
|
typeDictValue: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '产品类型不能为空',
|
message: '产品类型不能为空',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
area: [
|
area: [
|
||||||
{
|
{
|
||||||
type: 'number',
|
type: 'number',
|
||||||
message: '请输入正确的数值',
|
message: '请输入正确的数值',
|
||||||
trigger: 'change',
|
trigger: 'change',
|
||||||
transform: (val) => Number(val),
|
transform: (val) => Number(val),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
processTime: [
|
processTime: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '完成单位产品用时不能为空',
|
message: '完成单位产品用时不能为空',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'number',
|
type: 'number',
|
||||||
message: '请输入正确的数值',
|
message: '请输入正确的数值',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
transform: (val) => Number(val),
|
transform: (val) => Number(val),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
isdetail: false,
|
isdetail: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initData() {
|
async initData() {
|
||||||
this.productAttributeList.splice(0);
|
this.productAttributeList.splice(0);
|
||||||
this.listQuery.total = 0;
|
this.listQuery.total = 0;
|
||||||
},
|
const typeRes = await listData({
|
||||||
init(id, isdetail) {
|
pageNo:
|
||||||
this.initData();
|
1,
|
||||||
this.isdetail = isdetail || false;
|
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.id = id || null;
|
||||||
// this.dataForm.processTypes = [] // 清空工艺选择
|
// this.dataForm.processTypes = [] // 清空工艺选择
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs['dataForm'].resetFields();
|
this.$refs['dataForm'].resetFields();
|
||||||
|
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
// 获取产品详情
|
// 获取产品详情
|
||||||
getProduct(id).then((res) => {
|
getProduct(id).then((res) => {
|
||||||
const resData = res.data || {};
|
const resData = res.data || {};
|
||||||
// 逐个字段赋值(保留响应式)
|
// 逐个字段赋值(保留响应式)
|
||||||
@@ -305,161 +339,163 @@ export default {
|
|||||||
|
|
||||||
console.log('工艺列表(编辑时):', this.dataForm.processTypes); // 验证是否为 ["1","2"] 格式
|
console.log('工艺列表(编辑时):', this.dataForm.processTypes); // 验证是否为 ["1","2"] 格式
|
||||||
});
|
});
|
||||||
// 获取产品的属性列表
|
// 获取产品的属性列表
|
||||||
this.getList();
|
this.getList();
|
||||||
} else {
|
} else {
|
||||||
getCode().then((res) => {
|
getCode().then((res) => {
|
||||||
this.dataForm.code = res.data;
|
this.dataForm.code = res.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getList() {
|
getList() {
|
||||||
// 获取产品的属性列表
|
// 获取产品的属性列表
|
||||||
getProductAttrPage({
|
getProductAttrPage({
|
||||||
...this.listQuery,
|
...this.listQuery,
|
||||||
productId: this.dataForm.id,
|
productId: this.dataForm.id,
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
this.productAttributeList = response.data.list;
|
this.productAttributeList = response.data.list;
|
||||||
this.listQuery.total = response.data.total;
|
this.listQuery.total = response.data.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleClick(raw) {
|
handleClick(raw) {
|
||||||
if (raw.type === 'delete') {
|
if (raw.type === 'delete') {
|
||||||
this.$confirm(
|
this.$confirm(
|
||||||
`确定对${
|
`确定对${raw.data.name
|
||||||
raw.data.name
|
? '[名称=' + raw.data.name + ']'
|
||||||
? '[名称=' + raw.data.name + ']'
|
: '[序号=' + raw.data._pageIndex + ']'
|
||||||
: '[序号=' + raw.data._pageIndex + ']'
|
}进行删除操作?`,
|
||||||
}进行删除操作?`,
|
'提示',
|
||||||
'提示',
|
{
|
||||||
{
|
confirmButtonText: '确定',
|
||||||
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
||||||
cancelButtonText: '取消',
|
type: 'warning',
|
||||||
type: 'warning',
|
}
|
||||||
}
|
)
|
||||||
)
|
.then(() => {
|
||||||
.then(() => {
|
deleteProductAttr(raw.data.id).then(({ data }) => {
|
||||||
deleteProductAttr(raw.data.id).then(({ data }) => {
|
this.$message({
|
||||||
this.$message({
|
message: '操作成功',
|
||||||
message: '操作成功',
|
type: 'success',
|
||||||
type: 'success',
|
duration: 1500,
|
||||||
duration: 1500,
|
onClose: () => {
|
||||||
onClose: () => {
|
this.getList();
|
||||||
this.getList();
|
},
|
||||||
},
|
});
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
})
|
.catch(() => { });
|
||||||
.catch(() => {});
|
} else {
|
||||||
} else {
|
this.addNew(raw.data.id);
|
||||||
this.addNew(raw.data.id);
|
}
|
||||||
}
|
},
|
||||||
},
|
// 表单提交
|
||||||
// 表单提交
|
dataFormSubmit() {
|
||||||
dataFormSubmit() {
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
this.$refs['dataForm'].validate((valid) => {
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// 修改的提交
|
|
||||||
if (this.dataForm.id) {
|
// 修改的提交
|
||||||
updateProduct(this.dataForm).then((response) => {
|
if (this.dataForm.id) {
|
||||||
this.$modal.msgSuccess('修改成功');
|
updateProduct(this.dataForm).then((response) => {
|
||||||
this.visible = false;
|
this.$modal.msgSuccess('修改成功');
|
||||||
this.$emit('refreshDataList');
|
this.visible = false;
|
||||||
});
|
this.$emit('refreshDataList');
|
||||||
return;
|
});
|
||||||
}
|
return;
|
||||||
// 添加的提交
|
}
|
||||||
createProduct(this.dataForm).then((response) => {
|
// 添加的提交
|
||||||
this.$modal.msgSuccess('新增成功');
|
createProduct(this.dataForm).then((response) => {
|
||||||
this.$confirm(`是否新增产品属性?`, '系统提示', {
|
this.$modal.msgSuccess('新增成功');
|
||||||
confirmButtonText: '确定',
|
this.$confirm(`是否新增产品属性?`, '系统提示', {
|
||||||
cancelButtonText: '取消',
|
confirmButtonText: '确定',
|
||||||
type: 'warning',
|
cancelButtonText: '取消',
|
||||||
})
|
type: 'warning',
|
||||||
.then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.dataForm.id = response.data
|
this.dataForm.id = response.data
|
||||||
this.addNew();
|
this.addNew();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$emit('refreshDataList');
|
this.$emit('refreshDataList');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goEdit() {
|
goEdit() {
|
||||||
this.isdetail = false;
|
this.isdetail = false;
|
||||||
},
|
},
|
||||||
// 新增 / 修改
|
// 新增 / 修改
|
||||||
addNew(id) {
|
addNew(id) {
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
this.addOrUpdateVisible = true;
|
this.addOrUpdateVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.addOrUpdate.init(id);
|
this.$refs.addOrUpdate.init(id);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message('请先创建产品!');
|
this.$message('请先创建产品!');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goback() {
|
goback() {
|
||||||
this.$emit('refreshDataList');
|
this.$emit('refreshDataList');
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.initData();
|
this.initData();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.drawer >>> .el-drawer {
|
.drawer>>>.el-drawer {
|
||||||
border-radius: 8px 0 0 8px;
|
border-radius: 8px 0 0 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .el-form-item__label {
|
.drawer>>>.el-form-item__label {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .el-drawer__header {
|
.drawer>>>.el-drawer__header {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 32px 32px 24px;
|
padding: 32px 32px 24px;
|
||||||
border-bottom: 1px solid #dcdfe6;
|
border-bottom: 1px solid #dcdfe6;
|
||||||
}
|
|
||||||
.drawer >>> .el-drawer__body {
|
|
||||||
flex: 1;
|
|
||||||
height: 1px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .content {
|
.drawer>>>.el-drawer__body {
|
||||||
padding: 30px 24px;
|
flex: 1;
|
||||||
flex: 1;
|
height: 1px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
/* height: 100%; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .visual-part {
|
.drawer>>>.content {
|
||||||
flex: 1 auto;
|
padding: 30px 24px;
|
||||||
max-height: 76vh;
|
flex: 1;
|
||||||
overflow: hidden;
|
display: flex;
|
||||||
overflow-y: scroll;
|
flex-direction: column;
|
||||||
padding-right: 10px; /* 调整滚动条样式 */
|
/* height: 100%; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer >>> .el-form,
|
.drawer>>>.visual-part {
|
||||||
.drawer >>> .attr-list {
|
flex: 1 auto;
|
||||||
padding: 0 16px;
|
max-height: 76vh;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-y: scroll;
|
||||||
|
padding-right: 10px;
|
||||||
|
/* 调整滚动条样式 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer>>>.el-form,
|
||||||
|
.drawer>>>.attr-list {
|
||||||
|
padding: 0 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-body__footer {
|
.drawer-body__footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
padding: 18px;
|
padding: 18px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -104,7 +104,11 @@ export default {
|
|||||||
getDataListURL: getProductionLinePage,
|
getDataListURL: getProductionLinePage,
|
||||||
deleteURL: deleteProductionLine,
|
deleteURL: deleteProductionLine,
|
||||||
exportURL: exportProductionLineExcel,
|
exportURL: exportProductionLineExcel,
|
||||||
},
|
},
|
||||||
|
listQuery: {
|
||||||
|
pageSize: 20,
|
||||||
|
pageNo:1
|
||||||
|
},
|
||||||
tableProps,
|
tableProps,
|
||||||
tableBtn: [
|
tableBtn: [
|
||||||
this.$auth.hasPermi(`base:production-line:update`)
|
this.$auth.hasPermi(`base:production-line:update`)
|
||||||
@@ -212,7 +216,7 @@ export default {
|
|||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
this.listQuery.pageNo = 1;
|
this.listQuery.pageNo = 1;
|
||||||
this.listQuery.pageSize = 10;
|
this.listQuery.pageSize = 20;
|
||||||
this.listQuery.factoryId = val.factoryId || undefined;
|
this.listQuery.factoryId = val.factoryId || undefined;
|
||||||
this.listQuery.name = val.name;
|
this.listQuery.name = val.name;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
@@ -220,7 +224,7 @@ export default {
|
|||||||
case 'reset':
|
case 'reset':
|
||||||
this.$refs.searchBarForm.resetForm();
|
this.$refs.searchBarForm.resetForm();
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
total: 1,
|
total: 1,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -519,6 +519,12 @@ export default {
|
|||||||
btnName: '重置',
|
btnName: '重置',
|
||||||
name: 'reset',
|
name: 'reset',
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// type: 'label', // 初始隐藏
|
||||||
|
// label: '刷新时间', // 自定义标识
|
||||||
|
// // slot: 'currentTimeSlot', // 自定义插槽名
|
||||||
|
// // width: 200, // 宽度适配
|
||||||
|
// },
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -541,7 +547,7 @@ export default {
|
|||||||
{
|
{
|
||||||
prop: 'processType',
|
prop: 'processType',
|
||||||
label: '产品类型',
|
label: '产品类型',
|
||||||
filter: (val) => (val != 1 ? '面板' : '背板'),
|
filter: (val) => (val === 1 ? '面板' : '背板'),
|
||||||
fixed: true,
|
fixed: true,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
@@ -588,12 +594,12 @@ export default {
|
|||||||
// end.getTime()
|
// end.getTime()
|
||||||
// ];
|
// ];
|
||||||
|
|
||||||
this.$refs.searchBarForm.formInline.timeType = 1
|
this.$refs.searchBarForm.formInline.timeType = 3
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getDayDataList();
|
// this.getLastDayDataList();
|
||||||
this.getPdLineList();
|
this.getPdLineList();
|
||||||
const queryParams = {
|
const queryParams = {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
@@ -642,6 +648,12 @@ export default {
|
|||||||
this.formConfig[1].type = ''; // 隐藏查询类型
|
this.formConfig[1].type = ''; // 隐藏查询类型
|
||||||
this.formConfig[6].type = ''; // 隐藏报表类型
|
this.formConfig[6].type = ''; // 隐藏报表类型
|
||||||
this.formConfig[7].type = ''; // 隐藏时间范围
|
this.formConfig[7].type = ''; // 隐藏时间范围
|
||||||
|
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||||
|
item.label?.includes('刷新时间')
|
||||||
|
);
|
||||||
|
if (timeItemIndex > -1) {
|
||||||
|
this.formConfig.splice(timeItemIndex, 1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 3. 执行公共重置
|
// 3. 执行公共重置
|
||||||
@@ -656,14 +668,43 @@ export default {
|
|||||||
this.formConfig[3].type = 'select'; // 显示产线
|
this.formConfig[3].type = 'select'; // 显示产线
|
||||||
this.formConfig[4].type = ''; // 隐藏产品工艺
|
this.formConfig[4].type = ''; // 隐藏产品工艺
|
||||||
this.formConfig[5].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 {
|
} else {
|
||||||
|
|
||||||
// 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班
|
// 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班
|
||||||
this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班
|
this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班
|
||||||
this.formConfig[3].type = ''; // 隐藏产线
|
this.formConfig[3].type = ''; // 隐藏产线
|
||||||
this.formConfig[4].type = 'select'; // 显示产品工艺
|
this.formConfig[4].type = 'select'; // 显示产品工艺
|
||||||
this.formConfig[5].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();
|
this.getProductList();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -995,6 +1036,26 @@ export default {
|
|||||||
}
|
}
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
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.activeName === 'productLine') {
|
||||||
if (this.listQuery.timeType === 1) {
|
if (this.listQuery.timeType === 1) {
|
||||||
this.getDayDataList();
|
this.getDayDataList();
|
||||||
@@ -1012,7 +1073,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
case 'reset':
|
case 'reset':
|
||||||
this.$refs.searchBarForm.resetForm();
|
this.$refs.searchBarForm.resetForm();
|
||||||
this.$refs.searchBarForm.formInline.timeType = 1;
|
this.$refs.searchBarForm.formInline.timeType = 3;
|
||||||
this.formConfig[0].selectOptions = this.activeName === 'productLine'
|
this.formConfig[0].selectOptions = this.activeName === 'productLine'
|
||||||
? this.timeTypeOptions.productLine
|
? this.timeTypeOptions.productLine
|
||||||
: this.timeTypeOptions.product;
|
: this.timeTypeOptions.product;
|
||||||
@@ -1020,10 +1081,23 @@ export default {
|
|||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
total: 0,
|
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') {
|
if (this.activeName === 'productLine') {
|
||||||
this.getDayDataList();
|
this.getLastDayDataList();
|
||||||
} else {
|
} else {
|
||||||
this.getProductList();
|
this.getProductList();
|
||||||
}
|
}
|
||||||
@@ -1350,29 +1424,48 @@ export default {
|
|||||||
this.listQuery.pageNo = val;
|
this.listQuery.pageNo = val;
|
||||||
this.getDataList();
|
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 }) {
|
handleSearchBarChanged({ param, value }) {
|
||||||
if (param === 'timeType') {
|
if (param === 'timeType') {
|
||||||
console.log(value);
|
|
||||||
|
|
||||||
this.listQuery.timeType = 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.formConfig[1].type = 'select';
|
||||||
this.$refs.searchBarForm.formInline.timeType = value;
|
this.$refs.searchBarForm.formInline.searchType = 1;
|
||||||
this.listQuery.timeType = value;
|
|
||||||
this.formConfig[7].type = 'datePicker';
|
this.formConfig[7].type = 'datePicker';
|
||||||
} else {
|
} else {
|
||||||
this.formConfig[1].type = '';
|
this.formConfig[1].type = '';
|
||||||
this.formConfig[6].type = '';
|
this.formConfig[6].type = '';
|
||||||
this.formConfig[7].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') {
|
} else if (param === 'searchType') {
|
||||||
if (value === 1) {
|
if (value === 1) {
|
||||||
// 统计数据:显示时间范围,隐藏报表类型
|
// 统计数据:显示时间范围,隐藏报表类型
|
||||||
@@ -1422,7 +1515,10 @@ export default {
|
|||||||
label: '时间范围',
|
label: '时间范围',
|
||||||
dateType: 'week',
|
dateType: 'week',
|
||||||
placeholder: '选择日期',
|
placeholder: '选择日期',
|
||||||
format: 'yyyy-MM-dd',
|
format: 'yyyy 第 WW 周',
|
||||||
|
pickerOptions: {
|
||||||
|
firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推)
|
||||||
|
},
|
||||||
valueFormat: 'yyyy-MM-dd',
|
valueFormat: 'yyyy-MM-dd',
|
||||||
param: 'timeValWeek',
|
param: 'timeValWeek',
|
||||||
width: 250,
|
width: 250,
|
||||||
|
|||||||
@@ -204,94 +204,88 @@ export default {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
test() {
|
exportXlsx() {
|
||||||
var target = document.getElementsByClassName("right-aside")[0]
|
if (!this.showData.length) {
|
||||||
target.style.background = '#FFFFFF'
|
this.$message.warning('暂无数据可导出');
|
||||||
var that = this
|
return;
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
return exportTableOut
|
|
||||||
},
|
|
||||||
exportPdf() {
|
|
||||||
this.test()
|
|
||||||
setTimeout(() =>{
|
|
||||||
this.dialogVisible = false
|
|
||||||
this.showData = this.tableData
|
|
||||||
}, 600)
|
|
||||||
|
|
||||||
},
|
this.exportLoading = true;
|
||||||
exportXlsx() {
|
|
||||||
this.exportECL()
|
try {
|
||||||
this.dialogVisible = false
|
// 1. 处理导出数据(格式化时间字段)
|
||||||
this.showData = this.tableData
|
const exportData = this.showData.map(item => {
|
||||||
},
|
const formatItem = { ...item };
|
||||||
handleClose(done) {
|
// 格式化时间字段
|
||||||
this.$confirm('确认关闭?')
|
if (formatItem.startTime) formatItem.startTime = parseTime(formatItem.startTime);
|
||||||
.then(_ => {
|
if (formatItem.endTime) formatItem.endTime = parseTime(formatItem.endTime);
|
||||||
done();
|
return formatItem;
|
||||||
})
|
});
|
||||||
.catch(_ => {});
|
|
||||||
},
|
// 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() {
|
getPdLineList() {
|
||||||
getPdList().then((res) => {
|
getPdList().then((res) => {
|
||||||
this.formConfig[0].selectOptions = res.data || []
|
this.formConfig[0].selectOptions = res.data || []
|
||||||
@@ -323,7 +317,7 @@ export default {
|
|||||||
this.getDataList();
|
this.getDataList();
|
||||||
break;
|
break;
|
||||||
case 'export':
|
case 'export':
|
||||||
this.handleExport();
|
this.exportXlsx();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log(val);
|
console.log(val);
|
||||||
@@ -351,12 +345,6 @@ export default {
|
|||||||
this.listQuery.pageNo = val;
|
this.listQuery.pageNo = val;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
handleExport() {
|
|
||||||
if (this.selectedList.length > 0) {
|
|
||||||
this.showData = this.selectedList
|
|
||||||
}
|
|
||||||
this.dialogVisible = true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -570,22 +570,35 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
// 1. 强制设置当前激活标签为 按产品监控
|
||||||
|
this.activeName = 'product';
|
||||||
if (this.$refs.buttonNav) {
|
if (this.$refs.buttonNav) {
|
||||||
this.$refs.buttonNav.currentMenu = '按产品监控';
|
this.$refs.buttonNav.currentMenu = '按产品监控';
|
||||||
|
// 时间维度选项只显示 当天/自定义(无 上一班)
|
||||||
this.formConfig[0].selectOptions = this.timeTypeOptions.product;
|
this.formConfig[0].selectOptions = this.timeTypeOptions.product;
|
||||||
}
|
}
|
||||||
if (this.$refs.searchBarForm) {
|
if (this.$refs.searchBarForm) {
|
||||||
// this.$refs.searchBarForm.formInline.timeVal = [
|
// 2. 强制设置搜索表单的 timeType 为 1(当天)
|
||||||
// yesterday.getTime(),
|
this.$refs.searchBarForm.formInline.timeType = 1;
|
||||||
// end.getTime()
|
// 同步查询参数的 timeType
|
||||||
// ];
|
this.listQuery.timeType = 1;
|
||||||
|
}
|
||||||
this.$refs.searchBarForm.formInline.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();
|
this.getPdLineList();
|
||||||
const queryParams = {
|
const queryParams = {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
@@ -597,11 +610,22 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
currentMenu(val) {
|
||||||
// 1. 确定当前激活的类型(产线/产品)
|
// 1. 确定当前激活的类型(产线/产品)
|
||||||
const isProductLine = val === '按产线监控';
|
const isProductLine = val === '按产线监控';
|
||||||
this.activeName = isProductLine ? 'productLine' : 'product';
|
this.activeName = isProductLine ? 'productLine' : 'product';
|
||||||
|
console.log('isProductLine', isProductLine);
|
||||||
|
|
||||||
// 2. 提取公共重置逻辑(无论切换到哪个标签,都需要执行的操作)
|
// 2. 提取公共重置逻辑(无论切换到哪个标签,都需要执行的操作)
|
||||||
const resetCommon = () => {
|
const resetCommon = () => {
|
||||||
@@ -634,11 +658,19 @@ export default {
|
|||||||
this.formConfig[1].type = ''; // 隐藏查询类型
|
this.formConfig[1].type = ''; // 隐藏查询类型
|
||||||
this.formConfig[6].type = ''; // 隐藏报表类型
|
this.formConfig[6].type = ''; // 隐藏报表类型
|
||||||
this.formConfig[7].type = ''; // 隐藏时间范围
|
this.formConfig[7].type = ''; // 隐藏时间范围
|
||||||
|
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||||
|
item.label?.includes('刷新时间')
|
||||||
|
);
|
||||||
|
if (timeItemIndex > -1) {
|
||||||
|
this.formConfig.splice(timeItemIndex, 1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 3. 执行公共重置
|
// 3. 执行公共重置
|
||||||
resetCommon();
|
resetCommon();
|
||||||
|
// if (this.activeName === 'productLine') {
|
||||||
|
// } else {
|
||||||
|
// }
|
||||||
// 4. 根据类型设置差异化的表单配置(仅处理不同的部分)
|
// 4. 根据类型设置差异化的表单配置(仅处理不同的部分)
|
||||||
if (isProductLine) {
|
if (isProductLine) {
|
||||||
// 按产线监控:显示产线,隐藏产品工艺和类型,时间维度包含上一班
|
// 按产线监控:显示产线,隐藏产品工艺和类型,时间维度包含上一班
|
||||||
@@ -646,16 +678,44 @@ export default {
|
|||||||
this.formConfig[3].type = 'select'; // 显示产线
|
this.formConfig[3].type = 'select'; // 显示产线
|
||||||
this.formConfig[4].type = ''; // 隐藏产品工艺
|
this.formConfig[4].type = ''; // 隐藏产品工艺
|
||||||
this.formConfig[5].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 {
|
} 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[0].selectOptions = this.timeTypeOptions.product; // 不含上一班
|
||||||
this.formConfig[3].type = ''; // 隐藏产线
|
this.formConfig[3].type = ''; // 隐藏产线
|
||||||
this.formConfig[4].type = 'select'; // 显示产品工艺
|
this.formConfig[4].type = 'select'; // 显示产品工艺
|
||||||
this.formConfig[5].type = 'select'; // 显示产品类型
|
this.formConfig[5].type = 'select'; // 显示产品类型
|
||||||
this.getProductList();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -947,6 +1007,25 @@ export default {
|
|||||||
}
|
}
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
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.activeName === 'productLine') {
|
||||||
if (this.listQuery.timeType === 1) {
|
if (this.listQuery.timeType === 1) {
|
||||||
this.getDayDataList();
|
this.getDayDataList();
|
||||||
@@ -965,15 +1044,27 @@ export default {
|
|||||||
case 'reset':
|
case 'reset':
|
||||||
this.$refs.searchBarForm.resetForm();
|
this.$refs.searchBarForm.resetForm();
|
||||||
this.$refs.searchBarForm.formInline.timeType = 1;
|
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.productLine
|
||||||
: this.timeTypeOptions.product;
|
: this.timeTypeOptions.product;
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
total: 0,
|
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') {
|
if (this.activeName === 'productLine') {
|
||||||
this.getDayDataList();
|
this.getDayDataList();
|
||||||
} else {
|
} else {
|
||||||
@@ -1307,24 +1398,33 @@ export default {
|
|||||||
handleSearchBarChanged({ param, value }) {
|
handleSearchBarChanged({ param, value }) {
|
||||||
console.log(value, param);
|
console.log(value, param);
|
||||||
if (param === 'timeType') {
|
if (param === 'timeType') {
|
||||||
console.log(value);
|
|
||||||
|
|
||||||
this.listQuery.timeType = 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.formConfig[1].type = 'select';
|
||||||
this.$refs.searchBarForm.formInline.timeType = value;
|
this.$refs.searchBarForm.formInline.searchType = 1;
|
||||||
this.listQuery.timeType = value;
|
|
||||||
this.formConfig[7].type = 'datePicker';
|
this.formConfig[7].type = 'datePicker';
|
||||||
} else {
|
} else {
|
||||||
this.formConfig[1].type = '';
|
this.formConfig[1].type = '';
|
||||||
this.formConfig[6].type = '';
|
this.formConfig[6].type = '';
|
||||||
this.formConfig[7].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') {
|
} else if (param === 'searchType') {
|
||||||
if (value === 1) {
|
if (value === 1) {
|
||||||
@@ -1375,7 +1475,10 @@ export default {
|
|||||||
label: '时间范围',
|
label: '时间范围',
|
||||||
dateType: 'week',
|
dateType: 'week',
|
||||||
placeholder: '选择日期',
|
placeholder: '选择日期',
|
||||||
format: 'yyyy-MM-dd',
|
format: 'yyyy 第 WW 周',
|
||||||
|
pickerOptions: {
|
||||||
|
firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推)
|
||||||
|
},
|
||||||
valueFormat: 'yyyy-MM-dd',
|
valueFormat: 'yyyy-MM-dd',
|
||||||
param: 'timeValWeek',
|
param: 'timeValWeek',
|
||||||
width: 250,
|
width: 250,
|
||||||
|
|||||||
@@ -244,7 +244,10 @@ export default {
|
|||||||
label: '统计时间',
|
label: '统计时间',
|
||||||
dateType: 'week',
|
dateType: 'week',
|
||||||
placeholder: '选择日期',
|
placeholder: '选择日期',
|
||||||
format: 'yyyy-MM-dd',
|
format: 'yyyy 第 WW 周',
|
||||||
|
pickerOptions: {
|
||||||
|
firstDayOfWeek: 1 // 数字1表示周一作为周的第一天(0=周日,1=周一,依此类推)
|
||||||
|
},
|
||||||
valueFormat: 'yyyy-MM-dd',
|
valueFormat: 'yyyy-MM-dd',
|
||||||
param: 'timeValWeek',
|
param: 'timeValWeek',
|
||||||
width: 250,
|
width: 250,
|
||||||
@@ -453,11 +456,10 @@ export default {
|
|||||||
item.statisticType = this.listQuery.statisticType;
|
item.statisticType = this.listQuery.statisticType;
|
||||||
|
|
||||||
// 匹配产线名称
|
// 匹配产线名称
|
||||||
const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
|
// const targetLine = this.pdLineList.find(line => line.id === item.bindObjectId);
|
||||||
item.bindObjectName = targetLine ? targetLine.name : '';
|
// item.bindObjectName = targetLine ? targetLine.name : ''
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
});
|
})
|
||||||
this.listQuery.total = response.data?.total || 0;
|
this.listQuery.total = response.data?.total || 0;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|||||||
Reference in New Issue
Block a user