<template>
|
<!-- 产品属性 -->
|
<div style="position: relative" class="productAttBox">
|
<div class="product_select" style="margin-top: 10px; margin-left: 10px; margin-bottom: 10px">
|
<label style="font-size: 15px">{{ t("detailPage.partNo.TR") }}:</label>
|
<div class="selectBox">
|
<button class="btn_style" type="button" :disabled="!state.isSelectPartSelectCombAble"
|
@click="state.isShowPartSelectComb = !state.isShowPartSelectComb"
|
style="width: 240px; background-color: #f2f2f2; color: black">
|
<span class="part_no_style" :title="state.m_currentPartNO">{{
|
state.m_currentPartNO
|
}}</span><i class="iconfont iconDown" :style="state.isShowPartSelectComb
|
? 'transition: 0.2s;transform: rotate(0deg);'
|
: 'transform: rotate(-90deg);transition: 0.2s;'
|
"></i>
|
</button>
|
</div>
|
</div>
|
<el-card :body-style="state.cardBodyStyle" shadow="always" v-show="state.isShowPartSelectComb" class="partCard">
|
<el-table ref="partCombListTableRef" :data="state.m_partCombListTableData" border stripe :fit="true" flexible
|
table-layout="fixed" highlight-current-row row-key="PartID" size="small" max-height="400px"
|
@row-click="clickChangePartInfo">
|
<el-table-column v-for="item in state.partCombListTableHead" show-overflow-tooltip
|
:min-width="item.Tag == 'Default' ? '160px' : ''" :fixed="item.Tag == 'Default' ? true : false"
|
:prop="item.Tag" :label="item.Text" align="center">
|
</el-table-column>
|
</el-table>
|
</el-card>
|
<div class="kuaiDiv" v-for="(propGrpItem, propIndex) in state.propList4Disp" :key="propIndex">
|
<h4 class="chanPinTitle">{{ propGrpItem.grpName }}</h4>
|
<template v-for="(propItem, propItemIndex) in propGrpItem.propList">
|
<div class="chanPinDiv" v-if="propItem.VisibilityStatus == 1" :key="propItemIndex">
|
<div class="chanPinContent" style="text-align: right; width: 49.33333%; font-size: 14px">
|
{{ propItem.PropName }}:
|
</div>
|
<div v-if="propItem.PropValueList == null" class="chanPinContent" style="text-align: left; width: 51.66667%">
|
<input class="input_box props_item_input" v-model="propItem.PropValue"
|
@change="changPropValueInput(propItem)" :title="propItem.PropValue" />
|
</div>
|
<div v-if="propItem.PropValueList != null" class="chanPinContent" style="text-align: left; width: 51.66667%">
|
<el-select v-model="propItem.PropValue" size="small" style="width: 173px" allow-create filterable
|
default-first-option @change="changPropValueSelect(propItem)">
|
<el-option v-for="item in propItem.PropValueList" :key="item" :label="item" :value="item">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</template>
|
</div>
|
</div>
|
</template>
|
|
<script setup name="PartProp">
|
import utils from "@/utils/utils.js";
|
import MotorPropHelper from "@/utils/motorProp.js";
|
import axiosHelper from "@/utils/axiosHelper.js";
|
import { onMounted, ref, reactive, watch, nextTick } from "vue";
|
import { ElSelect, ElOption, ElCard, ElCol, ElMessage } from "element-plus";
|
import { useI18n } from "vue-i18n";
|
const { t } = useI18n();
|
const emit = defineEmits([
|
"handleselectno",
|
"updateSelectMainPoint",
|
"cbOpenErrorTips",
|
"cbCloseErrorTips",
|
]);
|
const partCombListTableRef = ref(null);
|
let state = reactive({
|
isShowPartSelectComb: false, //是否显示产品下拉选择
|
isSelectPartSelectCombAble: false, //是否可以点击产品下拉
|
scrollHeight: 0,
|
partCombListTableHead: [], //产品列表头部
|
partCombListTableContent: [], //产品列表内容
|
m_partCombListTableData: [], //产品列表数据
|
cardBodyStyle: {
|
padding: "10px 0",
|
width: "100%",
|
"overflow-x": "auto",
|
},
|
|
cbChangeImage: null, //修改了图片文件的回调
|
cbRefreshPropList: null, //修改了产品属性的回调
|
cbRefreshPropValue: null, //修改了某个属性的值
|
cbChangeSelectedPart: null, //修改了所选产品的回调
|
propList4Disp: [], //显示用
|
|
m_currentLanguage: 0,
|
|
m_seriesID: 0,
|
m_pumpID: 0,
|
m_pumpName: "",
|
m_pumpName4File: "",
|
m_currentPartEntity: null, //大全产品实例
|
m_currentPartProp: null, //当前产品属性
|
m_currentPartID: 0, //产品编号
|
m_currentPartNO: "", //产品编号
|
m_currentPartCode: "", //产品图号
|
m_currentPartName: "", //产品名称
|
|
m_calcMotorPowerPtPosi: 5, //电机功率匹配方式 5 设计点功率乘以一个系数(固定) 7 产品编号和切割型号名简单匹配
|
m_isAutoCalcMotorPower: false,
|
m_isChangeSpeedByMotorSpeedProp: false,
|
m_partPropIsQueryMotorDsPara: false,
|
m_motorPowerInSelectDataSource: 0,
|
m_isMotorPowerComboxInSelectGrid: false,
|
|
m_partNOLaw: null,
|
m_partNameLaw: null,
|
m_allPartInfo: null,
|
m_allStructList: null,
|
m_partPropMapEntitys: null,
|
|
//文件规律列表
|
m_fileLaw4AssPart: null,
|
m_fileLaw4AssSys: null,
|
m_fileLaw4Struct: null,
|
m_fileLaw4Dimen: null,
|
|
m_assemPictureNamePart: null, //单泵安装图
|
m_assemPictureNameSys: null, //机组安装图
|
m_structPictureName: null, //结构图
|
m_productPictureName: null, //尺寸图
|
m_electricPictureName: null, //电气图
|
});
|
onMounted(() => {
|
initWindowSize();
|
});
|
const initWindowSize = () => {
|
nextTick(function () {
|
let headerHeight = 0;
|
let footerHeight = 0;
|
if (document.querySelector("#app header")) {
|
headerHeight = document.querySelector("#app header").clientHeight;
|
}
|
if (document.querySelector("#app footer")) {
|
footerHeight = document.querySelector("#app footer").clientHeight;
|
}
|
state.scrollHeight =
|
document.body.clientHeight - headerHeight - footerHeight - 160; //
|
});
|
window.addEventListener(
|
"resize",
|
() => {
|
return (() => {
|
let headerHeight = 0;
|
let footerHeight = 0;
|
if (document.querySelector("#app header")) {
|
headerHeight = document.querySelector("#app header").clientHeight;
|
}
|
if (document.querySelector("#app footer")) {
|
footerHeight = document.querySelector("#app footer").clientHeight;
|
}
|
state.scrollHeight =
|
document.body.clientHeight - headerHeight - footerHeight - 160; //
|
})();
|
},
|
false
|
);
|
};
|
|
const initialData = (current_language, base_data, part_data, setting_data) => {
|
state.m_currentLanguage = current_language;
|
|
state.m_pumpName = base_data.PumpName;
|
state.m_seriesID = base_data.SeriesID;
|
state.m_pumpID = base_data.PumpID;
|
|
if (setting_data != null) {
|
state.m_calcMotorPowerPtPosi = setting_data.CalcMotorPowerPtPosi;
|
state.m_isAutoCalcMotorPower = setting_data.IsAutoCalcMotorPower;
|
state.m_isChangeSpeedByMotorSpeedProp =
|
setting_data.IsChangeSpeedByMotorSpeedProp;
|
state.m_partPropIsQueryMotorDsPara =
|
setting_data.PartPropIsQueryMotorDsPara;
|
state.m_motorPowerInSelectDataSource =
|
setting_data.MotorPowerInSelectDataSource;
|
state.m_isMotorPowerComboxInSelectGrid =
|
setting_data.IsMotorPowerComboxInSelectGrid;
|
}
|
|
if (base_data.PumpName4File != null && base_data.PumpName4File != "")
|
state.m_pumpName4File = base_data.PumpName4File;
|
else if (base_data.PumpName != null && base_data.PumpName != "")
|
state.m_pumpName4File = base_data.PumpName4File;
|
|
state.m_fileLaw4AssPart = part_data.FileLaw4AssPart;
|
state.m_fileLaw4AssSys = part_data.FileLaw4AssSys;
|
state.m_fileLaw4Struct = part_data.FileLaw4Struct;
|
state.m_fileLaw4Dimen = part_data.FileLaw4Dimen;
|
|
state.m_allPartInfo = part_data.PartList;
|
state.m_allStructList = part_data.StructList;
|
state.m_partPropMapEntitys = part_data.PartPropMap;
|
|
state.m_partNOLaw = part_data.PartNOLaw;
|
state.m_partNameLaw = part_data.PartNameLaw;
|
//
|
if (part_data.PartCombTitles != null && part_data.PartCombRows != null) {
|
state.isSelectPartSelectCombAble = true;
|
state.partCombListTableHead = part_data.PartCombTitles;
|
state.partCombListTableContent = part_data.PartCombRows;
|
// #region 界面表格数据处理,根据state.partCombListTableHead与state.partCombListTableContent构造成el-table的表格数据格式
|
const defaultClone = (value) => {
|
return JSON.parse(JSON.stringify(value));
|
};
|
let tableData = [];
|
let TableHead = state.partCombListTableHead;
|
let TableContent = defaultClone(state.partCombListTableContent);
|
TableContent.forEach((item) => {
|
let tableNode = {};
|
let default_index = 1;
|
TableHead.forEach((head, index) => {
|
// 如果Tag值为null,表格会出现异常,则默认值为Default,
|
if (head.Tag == null) {
|
head.Tag = `Default_${default_index}`;
|
default_index++;
|
}
|
head.Tag = head.Tag.replace(/:/g, "_");
|
|
tableNode[head.Tag] = item.Contents[index];
|
});
|
tableData.push({ ...tableNode, ...item });
|
});
|
|
state.m_partCombListTableData = tableData;
|
// #endregion
|
}
|
|
|
var allPartList = part_data.PartList;
|
if (allPartList != null && allPartList.length > 0) {
|
var defaultPart = allPartList[0];
|
if (allPartList.length > 1 && part_data.SelPartID > 0) {
|
for (var i = 0; i < allPartList.length; i++) {
|
if (allPartList[i].PartID == part_data.SelPartID) {
|
defaultPart = allPartList[i];
|
break;
|
}
|
}
|
}
|
|
setCurrentPartInfo(defaultPart);
|
} else {
|
BuildAllPictureFile();
|
}
|
|
if (state.m_calcMotorPowerPtPosi == 7) {
|
if (base_data.IsMainModel) setCurrentPartByPartNO(base_data.PumpName);
|
else setCurrentPartByPartNO(base_data.SubPumpName);
|
}
|
};
|
//获取点击的产品列表项的数据
|
const clickChangePartInfo = (item) => {
|
state.isShowPartSelectComb = false;
|
|
var part_id = parseInt(item.PartID);
|
state.m_currentPartID = part_id;
|
state.m_currentPartNO = item.PartNO;
|
|
let sel_part = null;
|
for (var i = 0; i < state.m_allPartInfo.length; i++) {
|
if (part_id == state.m_allPartInfo[i].PartID) {
|
setCurrentPartInfo(state.m_allPartInfo[i]);
|
sel_part = state.m_allPartInfo[i];
|
|
if (state.cbChangeSelectedPart != null) {
|
state.cbChangeSelectedPart(sel_part);
|
}
|
|
break;
|
}
|
}
|
// 判断是否有产品
|
if (sel_part == null) {
|
return false;
|
}
|
// 判断配置中是否需要将当前选中的产品的电机转速赋值给选型参数中的转速
|
if (state.m_isChangeSpeedByMotorSpeedProp) {
|
for (var i = 0; i < sel_part.PartPropList.length; i++) {
|
var item = sel_part.PartPropList[i];
|
if (MotorPropHelper.IsMotorSpeedProp(item)) {
|
emit("updateSelectMainPoint", {
|
name: "WorkSpeed",
|
value: item.PropValue,
|
});
|
break;
|
}
|
}
|
}
|
//通知外部 电机功率已改变
|
if (state.m_isMotorPowerComboxInSelectGrid) {
|
for (var i = 0; i < sel_part.PartPropList.length; i++) {
|
var item = sel_part.PartPropList[i];
|
if (MotorPropHelper.IsMotorPowerProp(item)) {
|
emit("updateSelectMainPoint", {
|
name: "MotorPower",
|
value: item.PropValue,
|
});
|
break;
|
}
|
}
|
}
|
return false;
|
};
|
//设置当前Part
|
const setCurrentPartInfo = (selPart) => {
|
if (selPart.RealFileName) {
|
if (state.cbChangeImage != null) {
|
state.cbChangeImage(
|
"RealImagePart",
|
BuildImageFullPath(selPart.RealFileName)
|
);
|
}
|
}
|
if (selPart.AssemFileName) {
|
if (state.cbChangeImage != null) {
|
state.m_assemPictureNamePart = selPart.AssemFileName;
|
state.cbChangeImage(
|
"AssemImagePart",
|
BuildImageFullPath(selPart.AssemFileName)
|
);
|
}
|
}
|
|
if (selPart.AssemSysFileName) {
|
if (state.cbChangeImage != null) {
|
state.m_assemPictureNameSys = selPart.AssemSysFileName;
|
state.cbChangeImage(
|
"AssemImageSys",
|
BuildImageFullPath(selPart.AssemSysFileName)
|
);
|
}
|
}
|
if (selPart.StructFileName) {
|
if (state.cbChangeImage != null) {
|
state.m_structPictureName = selPart.StructFileName;
|
state.cbChangeImage(
|
"StructImagePart",
|
BuildImageFullPath(selPart.StructFileName)
|
);
|
}
|
}
|
|
if (selPart.ProductFileName) {
|
if (state.cbChangeImage != null) {
|
state.m_productPictureName = selPart.ProductFileName;
|
state.cbChangeImage(
|
"ProductImagePart",
|
BuildImageFullPath(selPart.ProductFileName)
|
);
|
}
|
}
|
|
if (selPart.ElectricFileName) {
|
if (state.cbChangeImage != null) {
|
state.m_electricPictureName = selPart.ElectricFileName;
|
state.cbChangeImage(
|
"ElectricImagePart",
|
BuildImageFullPath(selPart.ElectricFileName)
|
);
|
}
|
}
|
|
buildPropTableData(selPart.PartPropList);
|
|
state.m_currentPartEntity = selPart;
|
state.m_currentPartID = selPart.PartID;
|
state.m_currentPartNO = selPart.PartNO;
|
state.m_currentPartCode = selPart.PartCode;
|
|
setPartCombListTableRowClick();
|
// 如果有提示显示提示
|
if (selPart.PartNote && selPart.PartNote !== "") {
|
emit("cbOpenErrorTips", [selPart.PartNote]);
|
} else {
|
emit("cbCloseErrorTips");
|
}
|
|
BuildAllPictureFile();
|
|
buildStructInfoByProp();
|
|
//通知外部修改了产品属性
|
if (state.cbRefreshPropList != null)
|
state.cbRefreshPropList(state.m_currentPartProp);
|
};
|
//单电机匹配方式=7时, 子型号名称和产品编号匹配法 ,传入子型号名,从而改变默认选中的产品
|
const setCurrentPartByPartNO = (partNo) => {
|
if (partNo == null || partNo == "") return;
|
if (state.m_allPartInfo == null || state.m_allPartInfo.length == 0) return;
|
|
for (var i = 0; i < state.m_allPartInfo.length; i++) {
|
var part = state.m_allPartInfo[i];
|
if (part.PartNO == partNo) {
|
setCurrentPartInfo(part);
|
return true;
|
}
|
}
|
return false;
|
};
|
//设置电机功率的值
|
const setMotorPowerValue = (val) => {
|
if (state.m_isAutoCalcMotorPower == false) return;
|
|
if (state.m_motorPowerInSelectDataSource == 1) {
|
//eifel这种 eMotorPowerInSelectDataSource.FromStdList
|
for (let i = 0; i < state.m_currentPartProp.length; i++) {
|
var prop = state.m_currentPartProp[i];
|
if (MotorPropHelper.IsMotorPowerProp(prop)) {
|
//
|
prop.PropValue = MotorPropHelper.BuildMotorPowerDispValue(val);
|
|
BuildAllPictureFile();
|
|
if (state.cbRefreshPropValue != null) state.cbRefreshPropValue(prop, 0);
|
break;
|
}
|
}
|
} else if (state.m_motorPowerInSelectDataSource == 0) {//eMotorPowerInSelectDataSource.FromProp
|
var find_part = findPartByMotorPower(val);
|
if (find_part == null) return;
|
setCurrentPartInfo(find_part);
|
}
|
if (state.m_currentPartProp == null || state.m_currentPartProp.length == 0)
|
return "";
|
//通知外部修改了产品属性
|
if (state.cbRefreshPropList != null)
|
state.cbRefreshPropList(state.m_currentPartProp);
|
|
if (state.m_partPropIsQueryMotorDsPara) {
|
//从后台获取电机参数
|
var prop_value_kv = GetPartProp4Store();
|
var requestData = {
|
SeriesID: state.m_seriesID,
|
PumpID: state.m_pumpID,
|
PartID: state.m_currentPartID,
|
PartProp: prop_value_kv,
|
};
|
axiosHelper
|
.get({
|
version: 3,
|
controller: "MotorInfo",
|
action: "GetParaFromPartProp",
|
data: requestData,
|
apiUrlType: "main",
|
})
|
.then((res) => {
|
let resdata = res.data;
|
if (resdata.Code != 0) {
|
ElMessage.error(resdata.Message);
|
return;
|
}
|
//把数据库中电机参数放在产品属性中
|
state.m_currentPartProp = MotorPropHelper.SetPartPropByDsMotorInfo(
|
resdata.Data,
|
state.m_currentPartProp
|
);
|
});
|
}
|
};
|
const findPartByMotorPower = (power) => {
|
var allPartList = state.m_allPartInfo;
|
if (allPartList == null || allPartList.length == 0) {
|
return null;
|
}
|
var v_power = power;
|
if (typeof power === "number") {
|
v_power = power.toString();
|
} else {
|
v_power = power.replace("kW", "").replace("kw", "").replace("KW", "");
|
}
|
for (var k = 0; k < allPartList.length; k++) {
|
var current_part_propList = allPartList[k].PartPropList;
|
if (current_part_propList == null) continue;
|
for (let i = 0; i < current_part_propList.length; i++) {
|
var prop = current_part_propList[i];
|
if (!MotorPropHelper.IsMotorPowerProp(prop)) continue;
|
if (prop.PropValue == "") continue;
|
var c_power = prop.PropValue.replace("kW", "")
|
.replace("kw", "")
|
.replace("KW", "");
|
if (c_power == v_power) return allPartList[k];
|
}
|
}
|
return null;
|
};
|
//修改输入属性值
|
const changPropValueInput = (edited_prop) => {
|
var propIng = findPropEntityByPropID(edited_prop.ID);
|
if (state.cbRefreshPropValue != null) state.cbRefreshPropValue(propIng, 1);
|
};
|
//修改下拉属性值
|
const changPropValueSelect = (edited_prop) => {
|
//var allPropList = state.m_currentPartProp;
|
var propIng = findPropEntityByPropID(edited_prop.ID);
|
if (propIng == null) return;
|
|
propIng.PropValue = edited_prop.PropValue;
|
|
if (state.cbRefreshPropValue != null) state.cbRefreshPropValue(propIng, 2);
|
|
//属性映射
|
if (state.m_partPropMapEntitys != null) {
|
for (let i = 0; i < state.m_partPropMapEntitys.length; i++) {
|
var mapInfo = state.m_partPropMapEntitys[i];
|
if (
|
mapInfo.BasePropID != edited_prop.ID ||
|
mapInfo.BasePropValue != edited_prop.PropValue
|
) {
|
continue;
|
}
|
|
for (let k = 0; k < mapInfo.MapPropInfo.length; k++) {
|
var propMap = findPropEntityByPropID(mapInfo.MapPropInfo[k].MapPropID);
|
if (propMap == null) continue;
|
//暂时不修改下拉表
|
propMap.PropValue = mapInfo.MapPropInfo[k].MapPropValues[0];
|
}
|
}
|
}
|
|
//
|
BuildAllPictureFile();
|
|
buildStructInfoByProp();
|
|
//通知外部修改了产品属性
|
if (state.cbRefreshPropList != null)
|
state.cbRefreshPropList(state.m_currentPartProp);
|
|
return null;
|
};
|
//
|
const findPropEntityByPropID = (prop_id) => {
|
var allPropList = state.m_currentPartProp;
|
for (let i = 0; i < allPropList.length; i++) {
|
var prop = allPropList[i];
|
if (prop.ID == prop_id) {
|
return prop;
|
}
|
}
|
return null;
|
};
|
//根据ID获取属性
|
const getPropByPropID = (id) => {
|
for (let i = 0; i < state.m_currentPartProp.length; i++) {
|
var prop = state.m_currentPartProp[i];
|
if (prop.ID == id) return prop;
|
}
|
return null;
|
};
|
//修改了属性, 是否影响到了Struct
|
const buildStructInfoByProp = () => {
|
if (state.cbChangeImage == null) return;
|
if (
|
state.m_allStructList == null ||
|
state.m_allStructList.length < 2 ||
|
state.m_currentPartProp == null ||
|
state.m_currentPartProp.length < 2
|
)
|
return;
|
var allStructList = state.m_allStructList;
|
var currentPartPropList = state.m_currentPartProp;
|
|
for (let s = 0; s < allStructList.length; s++) {
|
var structInfo = allStructList[s];
|
for (let i = 0; i < currentPartPropList.length; i++) {
|
var prop = currentPartPropList[i];
|
if (structInfo.PartPropID == prop.ID) {
|
if (prop.PropValue == structInfo.Name) {
|
if (structInfo.RealFileName) {
|
//this.structPictureName = structInfo.RealFileName;
|
state.cbChangeImage(
|
"RealImagePart",
|
BuildImageFullPath(structInfo.RealFileName)
|
);
|
}
|
if (structInfo.StructFileName) {
|
state.m_structPictureName = structInfo.StructFileName;
|
state.cbChangeImage(
|
"StructImagePart",
|
BuildImageFullPath(structInfo.StructFileName)
|
);
|
}
|
if (structInfo.ElectricFileName) {
|
state.m_electricPictureName = structInfo.ElectricFileName;
|
state.cbChangeImage(
|
"ElectricImagePart",
|
BuildImageFullPath(structInfo.ElectricFileName)
|
);
|
}
|
return;
|
}
|
break;
|
}
|
}
|
}
|
};
|
|
//构建属性表
|
const buildPropTableData = (list) => {
|
let grpNameArr = list.map((prp) => {
|
return prp.GroupName;
|
});
|
grpNameArr = utils.uniqueInArray(grpNameArr);
|
//
|
let arrList = [];
|
grpNameArr.forEach((grp_name, grp_index) => {
|
let prop_grp = {};
|
prop_grp.grpName = grp_name;
|
prop_grp.propList = [];
|
for (let i = 0; i < list.length; i++) {
|
let node = list[i];
|
if (node.GroupName == grp_name) {
|
prop_grp.propList.push(node);
|
}
|
}
|
arrList.push(prop_grp);
|
});
|
state.propList4Disp = arrList;
|
state.m_currentPartProp = list;
|
};
|
//获取当前产品
|
const GetCurrentPartEntity = () => {
|
return state.m_currentPartEntity;
|
};
|
//获取功率计算系数
|
const getMotorPowerCalcCoeff = () => {
|
//var part = state.m_currentPartEntity;
|
if (state.m_currentPartProp == null) return 0;
|
for (let i = 0; i < state.m_currentPartProp.length; i++) {
|
var prop = state.m_currentPartProp[i];
|
if (MotorPropHelper.IsCalcCoeffProp(prop)) {
|
if (prop.PropValue == "") return 0;
|
return parseFloat(prop.PropValue);
|
}
|
}
|
return 0;
|
};
|
//获取属性值,用于存储或者API传递: 格式 ID:Value | ID:Value
|
const GetPartProp4Store = () => {
|
if (state.m_currentPartProp == null || state.m_currentPartProp.length == 0)
|
return "";
|
return GetPartProp4Store2(state.m_currentPartProp);
|
};
|
const GetPartProp4Store2 = (partPropList) => {
|
if (partPropList == null || partPropList.length == 0) return "";
|
var reg_mh = new RegExp(":", "g");
|
|
var selProp = "";
|
var propValueAssemFile = "";
|
var propValueDimFile = "";
|
var propValueStructFile = "";
|
for (let i = 0; i < partPropList.length; i++) {
|
var prop = partPropList[i];
|
|
if (prop.ID > 0) {
|
var propValueApi = "";
|
if (prop.PropValue != null) {
|
propValueApi = prop.PropValue.toString();
|
if (propValueApi.includes(":"))
|
propValueApi = propValueApi.replace(reg_mh, ":");
|
if (propValueApi.includes("|"))
|
propValueApi = propValueApi.replace("|", "");
|
}
|
selProp += prop.ID + ":" + propValueApi + "|";
|
}
|
if (prop.ID == -101) {
|
propValueDimFile = propValue;
|
}
|
if (prop.ID == -102) {
|
propValueStructFile = propValue;
|
}
|
if (prop.ID == -103) {
|
propValueAssemFile = propValue;
|
}
|
}
|
//获取根据定义设置安装图
|
if (
|
state.m_assemPictureNameSys != null &&
|
state.m_assemPictureNameSys.length > 2
|
) {
|
selProp += "-121:" + state.m_assemPictureNameSys + "|";
|
}
|
|
if (
|
state.m_electricPictureName != null &&
|
state.m_electricPictureName.length > 2
|
) {
|
selProp += "-123:" + state.m_electricPictureName + "|";
|
}
|
|
if (propValueAssemFile == "") {
|
if (
|
state.m_assemPictureNamePart != null &&
|
state.m_assemPictureNamePart.length > 2
|
) {
|
selProp += "-103:" + state.m_assemPictureNamePart + "|";
|
}
|
}
|
if (propValueStructFile == "") {
|
if (
|
state.m_structPictureName != null &&
|
state.m_structPictureName.length > 2
|
) {
|
selProp += "-102:" + state.m_structPictureName + "|";
|
}
|
}
|
if (propValueDimFile == "") {
|
if (
|
state.m_productPictureName != null &&
|
state.m_productPictureName.length > 2
|
) {
|
selProp += "-101:" + state.m_productPictureName + "|";
|
}
|
}
|
|
selProp = selProp.substring(0, selProp.length - 1);
|
return selProp;
|
};
|
|
//
|
const BuildImageFullPath = (path) => {
|
if (path == null || path == "") return null;
|
|
path = path.replace("\\", "/");
|
if (path.startsWith("Series")) {
|
return window.globalConfig.WebApiUrl.FileUrl + "Data/" + path;
|
} else {
|
return (
|
window.globalConfig.WebApiUrl.FileUrl +
|
"Data/" +
|
"Series" +
|
state.m_seriesID +
|
"/" +
|
path
|
);
|
}
|
};
|
|
//构建产品文件
|
const BuildAllPictureFile = () => {
|
if (state.m_fileLaw4AssPart != null) {
|
var fileName_law = BuildPictureFilePath(state.m_fileLaw4AssPart);
|
if (fileName_law != null && fileName_law.length > 2) {
|
var fileName_law = "Ass/" + fileName_law;
|
state.m_assemPictureNamePart = fileName_law + ".png";
|
} else {
|
state.m_assemPictureNamePart = "";
|
}
|
if (state.cbChangeImage != null) {
|
state.cbChangeImage(
|
"AssemImagePart",
|
BuildImageFullPath(state.m_assemPictureNamePart)
|
);
|
}
|
}
|
|
if (state.m_fileLaw4Dimen != null) {
|
var fileName_law = BuildPictureFilePath(state.m_fileLaw4Dimen);
|
if (fileName_law != null && fileName_law.length > 2) {
|
var fileName_law = "Prc/" + fileName_law;
|
state.m_productPictureName = fileName_law + ".png";
|
} else {
|
state.m_productPictureName = "";
|
}
|
if (state.cbChangeImage != null) {
|
state.cbChangeImage(
|
"ProductImagePart",
|
BuildImageFullPath(state.m_productPictureName)
|
);
|
}
|
}
|
|
//
|
if (state.m_fileLaw4AssSys != null) {
|
var fileName_law = BuildPictureFilePath(state.m_fileLaw4AssSys);
|
if (fileName_law != null && fileName_law.length > 2) {
|
var fileName_law = "AssSys/" + fileName_law;
|
state.m_assemPictureNameSys = fileName_law + ".png";
|
} else {
|
state.m_assemPictureNameSys = "";
|
}
|
if (state.cbChangeImage != null) {
|
state.cbChangeImage(
|
"AssemImageSys",
|
BuildImageFullPath(state.m_assemPictureNameSys)
|
);
|
}
|
}
|
|
if (state.m_fileLaw4Struct != null) {
|
var fileName_law = BuildPictureFilePath(state.m_fileLaw4Struct);
|
if (fileName_law != null && fileName_law.length > 2) {
|
var fileName_law = "Str/" + fileName_law;
|
state.m_structPictureName = fileName_law + ".png";
|
} else {
|
state.m_structPictureName = "";
|
}
|
|
if (state.cbChangeImage != null) {
|
state.cbChangeImage(
|
"StructImagePart",
|
BuildImageFullPath(state.m_structPictureName)
|
);
|
}
|
}
|
|
/*if (PartNOLaw != null) {
|
var txt = BuildPartCode(PartNOLaw);
|
|
}
|
if (PartNameLaw != null) {
|
var txt = BuildPartCode(PartNameLaw);
|
}*/
|
};
|
|
//构建图片路径
|
const BuildPictureFilePath = (fileLawList) => {
|
if (fileLawList == null) return null;
|
if (state.m_currentPartProp == null) return null;
|
|
var fileName_law = "";
|
for (var i in fileLawList) {
|
var law = fileLawList[i];
|
if (law.ItemType == 0 && law.PropID != null) {
|
//产品属性
|
var prop = getPropByPropID(law.PropID);
|
if (prop == null) {
|
continue;
|
}
|
var propValue = prop.PropValue;
|
if (propValue == null || propValue == "") continue;
|
|
if (law.PropID == 12) {
|
// 电机功率都用KW(服务器上文件已处理)
|
propValue = MotorPropHelper.BuildMotorPowerDispValue(propValue);
|
}
|
|
if (law.CodeMapType == 0) {
|
//0 : 没有映射关系
|
if (propValue != null && propValue != "") {
|
fileName_law += propValue;
|
fileName_law += GetFilePrefix(law);
|
}
|
} else {
|
for (var j in law.CodeLawList) {
|
if (law.CodeLawList[j].Key == propValue) {
|
if (
|
law.CodeLawList[j].StringValue != null &&
|
law.CodeLawList[j].StringValue != ""
|
) {
|
fileName_law += law.CodeLawList[j].StringValue;
|
fileName_law += GetFilePrefix(law);
|
break;
|
}
|
}
|
}
|
}
|
}
|
if (law.ItemType == 1 && state.m_pumpName4File) {
|
//产品型号
|
var pumpName = state.m_pumpName4File
|
.replace("/", "-")
|
.replace("\\", "-")
|
.replace("*", "-");
|
|
fileName_law += pumpName;
|
if (fileLawList.length > 1) {
|
fileName_law += GetFilePrefix(law);
|
}
|
}
|
if (law.ItemType == 2) {
|
//产品编号
|
fileName_law += state.m_currentPartNO;
|
setPartCombListTableRowClick();
|
if (fileLawList.length > 1) {
|
fileName_law += GetFilePrefix(law);
|
}
|
}
|
if (law.ItemType == 3) {
|
//产品图号
|
fileName_law += state.m_currentPartCode;
|
if (fileLawList.length > 1) {
|
fileName_law += GetFilePrefix(law);
|
}
|
}
|
if (law.ItemType == 4) {
|
//固定
|
if (law.CodeLawList != null && law.CodeLawList.length > 0)
|
fileName_law += law.CodeLawList[0].Key;
|
}
|
}
|
|
var lastStr = fileName_law[fileName_law.length - 1];
|
if (lastStr == "\\" || lastStr == "/" || lastStr == "_" || lastStr == "-") {
|
fileName_law = fileName_law.substring(0, fileName_law.length - 1);
|
}
|
return fileName_law;
|
};
|
//
|
const GetFilePrefix = (law) => {
|
var FilePrefix = law.FilePrefix;
|
if (FilePrefix == "\\") return "/";
|
else return FilePrefix;
|
};
|
|
//构建产品名称或编号
|
const BuildPartCode = (PartLawList) => {
|
var partCodeString = "";
|
for (var i in PartLawList) {
|
var law = PartLawList[i];
|
if (law.LawType == 1) {
|
//产品属性
|
var propValue = state.m_currentPartProp[law.PartPropID];
|
if (propValue == null || propValue == "") continue;
|
if (law.CodeLawList != null && law.CodeLawList.length > 0) {
|
for (var j in law.CodeLawList) {
|
if (law.CodeLawList[j].Key.toUpperCase() == propValue.toUpperCase()) {
|
partCodeString += law.CodeLawList[j].StringValue;
|
}
|
}
|
} else {
|
//0 : 没有映射关系
|
partCodeString += propValue;
|
}
|
}
|
if (law.LawType == 2) {
|
//产品型号
|
partCodeString += state.m_pumpName;
|
}
|
if (law.LawType == 0) {
|
//固定值
|
partCodeString += law.FixCode;
|
}
|
//if (law.ItemType == 3)//叶轮直径
|
//{
|
//}
|
}
|
return partCodeString;
|
};
|
// 设置基本信息,用于初始化的时候加载图片等
|
const setBaseInfo = (baseInfo, setting_data) => {
|
state.m_pumpName4File = baseInfo.PumpName4File;
|
if (state.m_pumpName4File == null || state.m_pumpName4File == "")
|
state.m_pumpName4File = baseInfo.PumpName;
|
state.m_pumpName = baseInfo.PumpName;
|
state.m_seriesID = baseInfo.SeriesID;
|
state.m_pumpID = baseInfo.PumpID;
|
state.m_calcMotorPowerPtPosi = setting_data?.CalcMotorPowerPtPosi;
|
};
|
const setLaw4 = (part_data) => {
|
state.m_fileLaw4AssPart = part_data.FileLaw4AssPart;
|
state.m_fileLaw4AssSys = part_data.FileLaw4AssSys;
|
state.m_fileLaw4Struct = part_data.FileLaw4Struct;
|
state.m_fileLaw4Dimen = part_data.FileLaw4Dimen;
|
};
|
// 设置当前点击行的样式
|
const setPartCombListTableRowClick = () => {
|
let curClickRow = state.m_partCombListTableData.filter((item) => {
|
return item.PartNO == state.m_currentPartNO;
|
});
|
partCombListTableRef.value.setCurrentRow(curClickRow[0]);
|
};
|
//设置图片修改回调函数
|
const setImageFilePathCb = (cb) => {
|
state.cbChangeImage = cb;
|
};
|
//设置修改了产品属性的回调
|
const setRefreshPropListCb = (cb) => {
|
state.cbRefreshPropList = cb;
|
};
|
//设置修改了产品属性的回调
|
const setRefreshPropValueCb = (cb) => {
|
state.cbRefreshPropValue = cb;
|
};
|
//设置修改了产品属性的回调
|
const setChangeSelectPartCb = (cb) => {
|
state.cbChangeSelectedPart = cb;
|
};
|
// 更新材料组
|
const updateMaterial = (materialName) => {
|
let isHasMaterial = false;
|
let curPart = null;
|
if (
|
state.partCombListTableContent &&
|
state.partCombListTableContent.length > 0
|
) {
|
//先判断产品下边是否有对应的材料组
|
state.partCombListTableContent.forEach((item) => {
|
if (item.Contents.includes(materialName)) {
|
isHasMaterial = true;
|
curPart = item;
|
}
|
});
|
}
|
// 判断是否又符合的材料
|
if (isHasMaterial) {
|
const part_id = parseInt(curPart.PartID);
|
state.m_currentPartID = part_id;
|
state.m_currentPartNO = curPart.PartNO;
|
setPartCombListTableRowClick();
|
let hasPart = false;
|
let curNode = null;
|
|
for (var i = 0; i < state.m_allPartInfo.length; i++) {
|
if (part_id == state.m_allPartInfo[i].PartID) {
|
setCurrentPartInfo(state.m_allPartInfo[i]);
|
curNode = state.m_allPartInfo[i];
|
hasPart = true;
|
break;
|
}
|
}
|
|
// 判断是否有产品
|
if (hasPart) {
|
let list = JSON.parse(JSON.stringify(curNode.PartPropList));
|
let updateData = list.filter((item) => {
|
if (item.Tag == "MotorSpeed") {
|
return item;
|
}
|
});
|
emit("updateSelectMainPoint", updateData);
|
}
|
return;
|
}
|
|
// 判断
|
state.m_currentPartProp.forEach((prop) => {
|
if (prop.Tag == "MaterialGroupName") {
|
prop.PropValue = materialName;
|
}
|
});
|
buildPropTableData(state.m_currentPartProp);
|
BuildAllPictureFile();
|
};
|
|
//获取产品中的订单型号
|
const getOrderModel = () => {
|
let orderModel = null;
|
let curPartID = state.m_currentPartID;
|
state.m_allPartInfo.forEach((item) => {
|
if (curPartID == item.PartID) {
|
if (item.PartPropList) {
|
item.PartPropList.forEach((part) => {
|
if (part.PropName == "订单型号" || part.Tag == "订单型号") {
|
orderModel = part.PropValue;
|
}
|
});
|
}
|
}
|
});
|
return orderModel;
|
};
|
defineExpose({
|
initialData,
|
setCurrentPartByPartNO,
|
GetCurrentPartEntity,
|
GetPartProp4Store,
|
GetPartProp4Store2,
|
setMotorPowerValue,
|
setRefreshPropListCb,
|
setRefreshPropValueCb,
|
setChangeSelectPartCb,
|
setImageFilePathCb,
|
setCurrentPartInfo,
|
BuildAllPictureFile,
|
getMotorPowerCalcCoeff,
|
updateMaterial,
|
getOrderModel,
|
});
|
</script>
|
<style lang="scss">
|
.productAttBox {
|
height: calc(100% - 0px);
|
overflow: auto;
|
|
.el-scrollbar__wrap {
|
overflow-x: hidden;
|
}
|
|
.btn_style {
|
display: inline-block;
|
margin-bottom: 0;
|
font-weight: 400;
|
text-align: center;
|
vertical-align: middle;
|
cursor: pointer;
|
border: 1px solid transparent;
|
white-space: nowrap;
|
line-height: 1.42857143;
|
border-radius: 4px;
|
-webkit-user-select: none;
|
-moz-user-select: none;
|
-ms-user-select: none;
|
user-select: none;
|
border-width: 0;
|
padding: 7px 14px;
|
font-size: 14px;
|
outline: none !important;
|
background-image: none !important;
|
filter: none;
|
-webkit-box-shadow: none;
|
-moz-box-shadow: none;
|
box-shadow: none;
|
text-shadow: none;
|
}
|
|
.product_select {
|
display: flex;
|
justify-content: flex-start;
|
align-items: center;
|
}
|
|
.selectBox {
|
&>button {
|
font-size: 14px;
|
display: flex;
|
justify-content: flex-end;
|
align-items: center;
|
|
&>text {
|
font-size: 14px;
|
}
|
}
|
}
|
|
.kuaiDiv {
|
position: relative;
|
width: 100%;
|
border-top: 1px solid #ccc;
|
padding: 0px;
|
margin-bottom: 10px;
|
padding-top: 20px;
|
}
|
|
.chanPinTitle {
|
margin-bottom: 0px;
|
margin-top: 0px;
|
padding: 4px;
|
position: absolute;
|
border-top: 1px dotted #ccc;
|
padding-left: 10px;
|
font-family: "Open Sans", sans-serif;
|
font-weight: 600;
|
top: 0;
|
}
|
|
.chanPinDiv {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
width: 100%;
|
margin: 0px 0px;
|
padding: 0px;
|
font-weight: 500;
|
}
|
|
.chanPinContent {
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
font-weight: 500;
|
font-size: 13px;
|
padding-left: 20px;
|
|
.el-input__inner {
|
line-height: 24px;
|
height: 24px;
|
text-align: left;
|
padding-left: unset;
|
}
|
|
.input_box .el-input__inner {
|
border: none;
|
border-bottom: 1px dotted #efeeee;
|
}
|
|
.el-input__icon {
|
line-height: 24px;
|
}
|
}
|
|
.part_no_style {
|
margin: 0 auto;
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
}
|
|
.partCard {
|
position: absolute;
|
width: 99.6%;
|
z-index: 1000;
|
right: 0px;
|
top: 50px;
|
border-radius: unset;
|
}
|
|
.part_list_head {
|
min-width: 100%;
|
border-bottom: 1px solid #f1f2f3;
|
border-top: 1px solid #f1f2f3;
|
display: inline-flex;
|
}
|
|
.part_list_head_content {
|
font-size: 12px;
|
height: 30px;
|
line-height: 30px;
|
min-width: 150px;
|
background: #3b3b3b;
|
border-right: 1px solid #ffffff;
|
color: #fff;
|
box-sizing: border-box;
|
}
|
|
.part_list_body_content {
|
font-size: 12px;
|
min-width: 150px;
|
height: 30px;
|
line-height: 30px;
|
border-right: 1px solid #f1f2f3;
|
box-sizing: border-box;
|
}
|
|
.part_list_row {
|
min-width: 100%;
|
cursor: pointer;
|
border-bottom: 1px solid #f1f2f3;
|
display: inline-flex;
|
|
&:hover {
|
background: #ddd;
|
}
|
}
|
|
.el-row::after,
|
.el-row::before {
|
display: table;
|
content: none;
|
}
|
|
.isPartColActive {
|
background: #aaaaaa;
|
}
|
|
.props_item_input {
|
cursor: pointer;
|
border: none;
|
border-bottom: 1px dotted #efeeee;
|
}
|
|
.el-select__wrapper {
|
// padding: 0 12px;
|
// min-height: 24px;
|
width: 173px;
|
}
|
|
[type="text"] {
|
box-shadow: none !important;
|
}
|
}
|
</style>
|