|
|
|
|
@ -17,7 +17,7 @@
|
|
|
|
|
</lay-table>
|
|
|
|
|
</lay-form-item>
|
|
|
|
|
</lay-form>
|
|
|
|
|
<div v-if="showButton" style="text-align: center;">
|
|
|
|
|
<div style="text-align: center;">
|
|
|
|
|
<lay-form-item>
|
|
|
|
|
<lay-button type="normal" @click="submitClick(true)">确认</lay-button>
|
|
|
|
|
<lay-button @click="cancelClick">取消</lay-button>
|
|
|
|
|
@ -81,6 +81,10 @@ import {
|
|
|
|
|
ref,
|
|
|
|
|
watch
|
|
|
|
|
} from 'vue';
|
|
|
|
|
import {
|
|
|
|
|
searchMaterialsByFactory,
|
|
|
|
|
modifyMaterial
|
|
|
|
|
} from "/src/api/api/materialEdit"
|
|
|
|
|
import {
|
|
|
|
|
getDataCode,
|
|
|
|
|
getPageList,
|
|
|
|
|
@ -92,6 +96,7 @@ import {
|
|
|
|
|
import {
|
|
|
|
|
getFactoryList
|
|
|
|
|
} from "/src/api/api/factory";
|
|
|
|
|
import { layer } from '@layui/layer-vue';
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
setup() {
|
|
|
|
|
@ -110,20 +115,23 @@ export default {
|
|
|
|
|
type: "radio"
|
|
|
|
|
}, {
|
|
|
|
|
title: "物料号",
|
|
|
|
|
key: "FName"
|
|
|
|
|
key: "FCode",
|
|
|
|
|
width: "120px"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "试验号",
|
|
|
|
|
key: "FTestCode"
|
|
|
|
|
key: "FTestCode",
|
|
|
|
|
width: "120px"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "物料描述",
|
|
|
|
|
key: "FTypeName",
|
|
|
|
|
width: "110px"
|
|
|
|
|
key: "FName",
|
|
|
|
|
width: "280px"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "产品分类",
|
|
|
|
|
key: "FVersionCode"
|
|
|
|
|
key: "FTypeName",
|
|
|
|
|
width: "200px"
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
dataColumn.forEach((item) => {
|
|
|
|
|
@ -139,10 +147,7 @@ export default {
|
|
|
|
|
watch(selectedKey, function () {
|
|
|
|
|
const chose = dataList.value.find(s => s.FID == selectedKey.value) || null;
|
|
|
|
|
if (chose != null) {
|
|
|
|
|
dataInfo.value.FFormulaName = chose.FName + "+" + chose.FTestCode + "+" + chose.FVersionCode;
|
|
|
|
|
dataInfo.value.FFormulaID = chose.FID;
|
|
|
|
|
dataInfo.value.FVersionCode = chose.FVersionCode;
|
|
|
|
|
dataInfo.value.FFormulaTestCode = chose.FTestCode;
|
|
|
|
|
dataInfo.value.FID = chose.FID;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -235,83 +240,44 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
let postData = {
|
|
|
|
|
FPageIndex: this.pageInfo.current,
|
|
|
|
|
FPageSize: this.pageInfo.limit
|
|
|
|
|
}
|
|
|
|
|
let search = this.dataInfo.FSearchName;
|
|
|
|
|
if (search && search != "") {
|
|
|
|
|
postData.Or_FPlmCode = postData.Or_FTestCode = postData.Or_FName = postData.Or_FVersionCode =
|
|
|
|
|
search;
|
|
|
|
|
FPageSize: this.pageInfo.limit,
|
|
|
|
|
FSearchName: this.dataInfo.FSearchName ? this.dataInfo.FSearchName : ""
|
|
|
|
|
}
|
|
|
|
|
let result = await getPageList(postData, "Formula");
|
|
|
|
|
|
|
|
|
|
let result = await searchMaterialsByFactory(postData, "MaterialTeamwork");
|
|
|
|
|
console.log('result', result);
|
|
|
|
|
result.Data.List = result.Data.List || [];
|
|
|
|
|
result.Data.List.forEach((item) => {
|
|
|
|
|
let type = this.typeList.find(s => s.FValue == item.FType);
|
|
|
|
|
item.FTypeName = type == null ? item.FType : type.FName;
|
|
|
|
|
if (this.dataInfo.FFormulaID == item.FID) this.selectedKey = item.FID
|
|
|
|
|
});
|
|
|
|
|
this.pageInfo.total = result.Data.Total || 0;
|
|
|
|
|
this.dataList = result.Data.List;
|
|
|
|
|
},
|
|
|
|
|
//数据-验证
|
|
|
|
|
async submitClick(isCreate) {
|
|
|
|
|
let postData = this.dataInfo;
|
|
|
|
|
postData.FSaleCode = (postData.FSaleCode || "").trim();
|
|
|
|
|
postData.FTestCode = (postData.FTestCode || "").trim();
|
|
|
|
|
postData.FMaterialGroup = (postData.FMaterialGroup || "").trim();
|
|
|
|
|
postData.FWeightUnit = (postData.FWeightUnit || "").trim();
|
|
|
|
|
postData.FFormulaName = (postData.FFormulaName || "").trim();
|
|
|
|
|
postData.FCreateFactoryID=(postData.FCreateFactoryID==-1?"":postData.FCreateFactoryID);
|
|
|
|
|
for (let key in postData) {
|
|
|
|
|
if (postData[key] == "") return false;
|
|
|
|
|
}
|
|
|
|
|
// let indexs = [postData.FSaleCode.indexOf("-"), postData.FSaleCode.indexOf("@")];
|
|
|
|
|
// if (indexs[0] == -1 || indexs[1] == -1 || indexs[1] - indexs[0] < 2) {
|
|
|
|
|
// layer.msg('必须要输入包材代码')
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
postData.FState = isCreate ? 1 : 0;
|
|
|
|
|
postData = JSON.parse(JSON.stringify(postData));
|
|
|
|
|
if (postData.FTestCode != postData.FFormulaTestCode) {
|
|
|
|
|
this.sureTextCode(postData);
|
|
|
|
|
return false;
|
|
|
|
|
let postData = {
|
|
|
|
|
FMaterialId: this.dataInfo.FID,
|
|
|
|
|
FCreateFactoryID: this.dataInfo.FCreateFactoryID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (postData.FCreateFactoryID && postData.FMaterialId) {
|
|
|
|
|
this._postTermData(postData);
|
|
|
|
|
} else if(!postData.FCreateFactoryID) {
|
|
|
|
|
layer.msg("选择模式不能为空", { icon : 2, time: 1000})
|
|
|
|
|
} else {
|
|
|
|
|
layer.msg("必须选择物料", { icon : 2, time: 1000})
|
|
|
|
|
}
|
|
|
|
|
this._postTermData(postData);
|
|
|
|
|
},
|
|
|
|
|
//数据-确认
|
|
|
|
|
sureTextCode(postData) {
|
|
|
|
|
let $this = this;
|
|
|
|
|
layer.confirm("选择的配方和订单试验号不一致,请确认使用选择的配方嘛?", {
|
|
|
|
|
title: "提示",
|
|
|
|
|
btn: [{
|
|
|
|
|
text: '暂时保存',
|
|
|
|
|
callback: function (id) {
|
|
|
|
|
layer.close(id);
|
|
|
|
|
postData["FState"] = 0;
|
|
|
|
|
$this._postTermData(postData);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '确认提交',
|
|
|
|
|
callback: function (id) {
|
|
|
|
|
layer.close(id);
|
|
|
|
|
postData["FState"] = 1;
|
|
|
|
|
$this._postTermData(postData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
//数据-提交
|
|
|
|
|
async _postTermData(postData) {
|
|
|
|
|
delete postData["FSearchName"];
|
|
|
|
|
let result = 0;
|
|
|
|
|
let idx = layer.load(2);
|
|
|
|
|
if (postData.FID && postData.FID > 0) {
|
|
|
|
|
result = await updateDataInfo(postData, "Teamwork") || 0;
|
|
|
|
|
} else {
|
|
|
|
|
result = await insertDataInfo(postData, "Teamwork") || 0;
|
|
|
|
|
}
|
|
|
|
|
if (result > 0) {
|
|
|
|
|
result = await modifyMaterial(postData, "MaterialTeamwork") || 0;
|
|
|
|
|
|
|
|
|
|
console.log('result', result);
|
|
|
|
|
if (result.Data.TaskId > 0) {
|
|
|
|
|
this.cancelClick(true);
|
|
|
|
|
}
|
|
|
|
|
layer.close(idx);
|
|
|
|
|
|