Yang 3 years ago
commit 65ddc7e12b

@ -25,4 +25,22 @@ export async function updateMaterial(params, controller) {
result = data result = data
}); });
return result; return result;
}
// 根据模式和物料名查找物料
export async function searchMaterialsByFactory(params, controller) {
let result = {};
await http.post('/api/' + controller + '/SearchMaterialsByFactory', params).then((data) => {
result = data
});
return result;
}
// 创建物料修改路线
export async function modifyMaterial(params, controller) {
let result = {};
await http.post('/api/' + controller + '/ModifyMaterial', params).then((data) => {
result = data
});
return result;
} }

@ -302,7 +302,6 @@
this.pageInfo.total = result.Data.Total || 0; this.pageInfo.total = result.Data.Total || 0;
this.dataList = result.Data.List; this.dataList = result.Data.List;
this.hasLoaded = true; this.hasLoaded = true;
debugger
}, },
// //
dateFormat(dataStr) { dateFormat(dataStr) {

@ -202,8 +202,9 @@ export default {
teamId: this.dataInfoObj.FTeamID, teamId: this.dataInfoObj.FTeamID,
viewType: this.dataInfoObj.FViewType viewType: this.dataInfoObj.FViewType
}); });
console.log('_data', _data);
debugger let freezingCols = await GetFreezingColumns();
if (this.dataInfoObj.FViewType == 1 || this.dataInfoObj.FViewType == 10) { if (this.dataInfoObj.FViewType == 1 || this.dataInfoObj.FViewType == 10) {
this.inputCodeValue = _data.rows[0]?_data.rows[0].HalfCode:""; this.inputCodeValue = _data.rows[0]?_data.rows[0].HalfCode:"";
this.inputDescValue = _data.rows[0]?_data.rows[0].HalfDesc:""; this.inputDescValue = _data.rows[0]?_data.rows[0].HalfDesc:"";
@ -255,7 +256,6 @@ export default {
let col7 = dataColumn.filter(s => s.fieldType == 7) || []; let col7 = dataColumn.filter(s => s.fieldType == 7) || [];
_data.rows.forEach((item, i) => { _data.rows.forEach((item, i) => {
columnsList = _data.columns.map(function (items) { columnsList = _data.columns.map(function (items) {
let info = _data.infos[i] let info = _data.infos[i]
if (info) { if (info) {
@ -270,7 +270,7 @@ export default {
return items.cellClass = items.cellClass + " three"; return items.cellClass = items.cellClass + " three";
case "4": case "4":
return items.cellClass = items.cellClass + " four"; return items.cellClass = items.cellClass + " four";
} }
} }
} }
@ -301,21 +301,35 @@ export default {
let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID;
localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows)); localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows));
console.log('editColumn', editColumn);
this.editColumn = editColumn; this.editColumn = editColumn;
this.dataList = _data.rows; this.dataList = _data.rows;
this.dataColumn = dataColumn; this.dataColumn = dataColumn;
this.originalColumns = this.deepCopy(dataColumn); this.originalColumns = this.deepCopy(dataColumn);
this.getFreezingColumns();
debugger let freezingColumns = freezingCols.FFreezingColumns
if (freezingColumns) {
let c_list = freezingColumns.split(",")
c_list.forEach(c => {
if(c && c.length > 0) {
this.freezingColumnSetting.push(c)
}
})
}
if (this.freezingColumnSetting && this.freezingColumnSetting.length > 0) {
this.dataColumn = ref([]);
this.setFreezingColumns();
}
this._changeType(_data.rows[0],2); this._changeType(_data.rows[0],2);
setTimeout(function () { setTimeout(function () {
layer.close(idx); layer.close(idx);
}, 500); }, 500);
}, },
async getFreezingColumns() { async getFreezingColumns() {
let result = await GetFreezingColumns(); let result = await GetFreezingColumns();
let freezingColumns = result.FFreezingColumns let freezingColumns = result.FFreezingColumns
if (freezingColumns) { if (freezingColumns) {
@ -348,13 +362,11 @@ export default {
if (result != null && result.FID) { if (result != null && result.FID) {
let col7 = this.dataColumn.filter(s => s.fieldType == 7) || []; let col7 = this.dataColumn.filter(s => s.fieldType == 7) || [];
console.log('this.typeList[0]', this.typeList[0].filter(t => t.FValue == data.FTypeID1)[0]);
col7.forEach((item) => { col7.forEach((item) => {
if (item.table == "TFS_MaterialInfo") { if (item.table == "TFS_MaterialInfo") {
data[item.key] = result[item.key] || data[item.key] || ""; data[item.key] = result[item.key] || data[item.key] || "";
} }
}); });
console.log('data.FTypeID1', data.FTypeID1);
let type1 = this.typeList[0].filter(t => t.FValue == data.FTypeID1)[0]; let type1 = this.typeList[0].filter(t => t.FValue == data.FTypeID1)[0];
let typeName = type1.FName; let typeName = type1.FName;
@ -422,11 +434,9 @@ export default {
}; };
let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID;
let cacheDataList = JSON.parse(localStorage.getItem('EditView' + saveId)); let cacheDataList = JSON.parse(localStorage.getItem('EditView' + saveId));
console.log('cacheDataList', cacheDataList);
this.dataList.forEach((row, index) => { this.dataList.forEach((row, index) => {
let cache = cacheDataList[index]; let cache = cacheDataList[index];
let dataObj = {}; let dataObj = {};
console.log('this.editColumn', this.editColumn);
for (let col of this.editColumn) { for (let col of this.editColumn) {
let valTemp = row[col.key]; let valTemp = row[col.key];
if (this.dataInfoObj.FViewType == 10) { if (this.dataInfoObj.FViewType == 10) {
@ -456,8 +466,6 @@ export default {
} }
} }
console.log('dataObj', dataObj);
for (let key in dataObj) { for (let key in dataObj) {
if (!updateObj[key]) updateObj[key] = []; if (!updateObj[key]) updateObj[key] = [];
updateObj[key].push(dataObj[key]); updateObj[key].push(dataObj[key]);
@ -467,8 +475,6 @@ export default {
if (updateLog != "") { if (updateLog != "") {
delete updateObj.LogList delete updateObj.LogList
// //
debugger
console.log('updateObj', updateObj);
let _result = await updateBatchById2(updateObj); let _result = await updateBatchById2(updateObj);
if (_result.Code === 200) { if (_result.Code === 200) {
await commonSave({ await commonSave({
@ -515,7 +521,6 @@ export default {
} else { } else {
this.dataColumn = this.tmpDataColumn; this.dataColumn = this.tmpDataColumn;
} }
this.$nextTick();
}, },
setFreezingColumnsSetting(fcs) { setFreezingColumnsSetting(fcs) {
this.freezingColumnSetting = fcs; this.freezingColumnSetting = fcs;

@ -117,7 +117,7 @@
}, },
{ {
title: "产品分类", title: "产品分类",
key: "FMaterialType", key: "FMaterialTypeName",
width: "200px", width: "200px",
align: 'center' align: 'center'
}, },
@ -281,7 +281,19 @@
result.Data.List = result.Data.List || []; result.Data.List = result.Data.List || [];
this.pageInfo.total = result.Data.Total || 0; this.pageInfo.total = result.Data.Total || 0;
this.dataList = result.Data.List; this.dataList = result.Data.List;
console.log('this.dataList', this.dataList);
this.dataList.forEach(item => {
if (item.FMaterialType == 10) {
item.FMaterialTypeName = "产成品"
} else if(item.FMaterialType == 20) {
item.FMaterialTypeName = "半成品"
} else if(item.FMaterialType == 30) {
item.FMaterialTypeName = "中间品/香基"
} else if(item.FMaterialType == 40) {
item.FMaterialTypeName = "原/辅料"
}
});
this.hasLoaded = true; this.hasLoaded = true;
}, },
// //

@ -33,7 +33,7 @@
<lay-input v-model="dataInfo.FTestCode"></lay-input> <lay-input v-model="dataInfo.FTestCode"></lay-input>
</lay-form-item> </lay-form-item>
</lay-form> </lay-form>
<div v-if="showButton" style="text-align: center;"> <div style="text-align: center;">
<lay-form-item> <lay-form-item>
<lay-button type="normal" @click="submitClick(true)"></lay-button> <lay-button type="normal" @click="submitClick(true)"></lay-button>
<lay-button @click="cancelClick"></lay-button> <lay-button @click="cancelClick"></lay-button>
@ -323,7 +323,7 @@ export default {
} else { } else {
result = await createMaterial(postData, "MaterialTeamwork") || 0; result = await createMaterial(postData, "MaterialTeamwork") || 0;
} }
console.log('result', result);
if (result.TaskId > 0) { if (result.TaskId > 0) {
this.cancelClick(true); this.cancelClick(true);
} }

@ -17,7 +17,7 @@
</lay-table> </lay-table>
</lay-form-item> </lay-form-item>
</lay-form> </lay-form>
<div v-if="showButton" style="text-align: center;"> <div style="text-align: center;">
<lay-form-item> <lay-form-item>
<lay-button type="normal" @click="submitClick(true)"></lay-button> <lay-button type="normal" @click="submitClick(true)"></lay-button>
<lay-button @click="cancelClick"></lay-button> <lay-button @click="cancelClick"></lay-button>
@ -81,6 +81,10 @@ import {
ref, ref,
watch watch
} from 'vue'; } from 'vue';
import {
searchMaterialsByFactory,
modifyMaterial
} from "/src/api/api/materialEdit"
import { import {
getDataCode, getDataCode,
getPageList, getPageList,
@ -92,6 +96,7 @@ import {
import { import {
getFactoryList getFactoryList
} from "/src/api/api/factory"; } from "/src/api/api/factory";
import { layer } from '@layui/layer-vue';
export default { export default {
setup() { setup() {
@ -110,20 +115,23 @@ export default {
type: "radio" type: "radio"
}, { }, {
title: "物料号", title: "物料号",
key: "FName" key: "FCode",
width: "120px"
}, },
{ {
title: "试验号", title: "试验号",
key: "FTestCode" key: "FTestCode",
width: "120px"
}, },
{ {
title: "物料描述", title: "物料描述",
key: "FTypeName", key: "FName",
width: "110px" width: "280px"
}, },
{ {
title: "产品分类", title: "产品分类",
key: "FVersionCode" key: "FTypeName",
width: "200px"
} }
]; ];
dataColumn.forEach((item) => { dataColumn.forEach((item) => {
@ -139,10 +147,7 @@ export default {
watch(selectedKey, function () { watch(selectedKey, function () {
const chose = dataList.value.find(s => s.FID == selectedKey.value) || null; const chose = dataList.value.find(s => s.FID == selectedKey.value) || null;
if (chose != null) { if (chose != null) {
dataInfo.value.FFormulaName = chose.FName + "+" + chose.FTestCode + "+" + chose.FVersionCode; dataInfo.value.FID = chose.FID;
dataInfo.value.FFormulaID = chose.FID;
dataInfo.value.FVersionCode = chose.FVersionCode;
dataInfo.value.FFormulaTestCode = chose.FTestCode;
} }
}); });
@ -235,83 +240,44 @@ export default {
} }
let postData = { let postData = {
FPageIndex: this.pageInfo.current, FPageIndex: this.pageInfo.current,
FPageSize: this.pageInfo.limit FPageSize: this.pageInfo.limit,
} FSearchName: this.dataInfo.FSearchName ? this.dataInfo.FSearchName : ""
let search = this.dataInfo.FSearchName;
if (search && search != "") {
postData.Or_FPlmCode = postData.Or_FTestCode = postData.Or_FName = postData.Or_FVersionCode =
search;
} }
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 = result.Data.List || [];
result.Data.List.forEach((item) => { result.Data.List.forEach((item) => {
let type = this.typeList.find(s => s.FValue == item.FType); let type = this.typeList.find(s => s.FValue == item.FType);
item.FTypeName = type == null ? item.FType : type.FName; 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.pageInfo.total = result.Data.Total || 0;
this.dataList = result.Data.List; this.dataList = result.Data.List;
}, },
//- //-
async submitClick(isCreate) { async submitClick(isCreate) {
let postData = this.dataInfo; let postData = {
postData.FSaleCode = (postData.FSaleCode || "").trim(); FMaterialId: this.dataInfo.FID,
postData.FTestCode = (postData.FTestCode || "").trim(); FCreateFactoryID: this.dataInfo.FCreateFactoryID
postData.FMaterialGroup = (postData.FMaterialGroup || "").trim(); };
postData.FWeightUnit = (postData.FWeightUnit || "").trim();
postData.FFormulaName = (postData.FFormulaName || "").trim(); if (postData.FCreateFactoryID && postData.FMaterialId) {
postData.FCreateFactoryID=(postData.FCreateFactoryID==-1?"":postData.FCreateFactoryID); this._postTermData(postData);
for (let key in postData) { } else if(!postData.FCreateFactoryID) {
if (postData[key] == "") return false; layer.msg("选择模式不能为空", { icon : 2, time: 1000})
} } else {
// let indexs = [postData.FSaleCode.indexOf("-"), postData.FSaleCode.indexOf("@")]; layer.msg("必须选择物料", { icon : 2, time: 1000})
// 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;
} }
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) { async _postTermData(postData) {
delete postData["FSearchName"];
let result = 0; let result = 0;
let idx = layer.load(2); let idx = layer.load(2);
if (postData.FID && postData.FID > 0) { result = await modifyMaterial(postData, "MaterialTeamwork") || 0;
result = await updateDataInfo(postData, "Teamwork") || 0;
} else { console.log('result', result);
result = await insertDataInfo(postData, "Teamwork") || 0; if (result.Data.TaskId > 0) {
}
if (result > 0) {
this.cancelClick(true); this.cancelClick(true);
} }
layer.close(idx); layer.close(idx);

@ -195,9 +195,12 @@ export default {
async initPage(idx) { async initPage(idx) {
let _data = await getMaterialViewsByTeamId({ let _data = await getMaterialViewsByTeamId({
teamId: this.dataInfoObj.FTeamID, teamId: this.dataInfoObj.FTeamID,
teamWorkType: this.dataInfoObj.FTeamworkType,
teamType: 1 teamType: 1
}, "MaterialTeamwork"); }, "MaterialTeamwork");
let freezingCols = await GetFreezingColumns();
this.typeList[0] = _data.types.filter(s => s.FDepth == 1) || []; this.typeList[0] = _data.types.filter(s => s.FDepth == 1) || [];
this.typeList[1] = _data.types.filter(s => s.FDepth != 1) || []; this.typeList[1] = _data.types.filter(s => s.FDepth != 1) || [];
let dataColumn = _data.columns || []; let dataColumn = _data.columns || [];
@ -305,7 +308,22 @@ export default {
this.dataList = _data.rows; this.dataList = _data.rows;
this.dataColumn = dataColumn; this.dataColumn = dataColumn;
this.originalColumns = this.deepCopy(dataColumn); this.originalColumns = this.deepCopy(dataColumn);
this.getFreezingColumns();
let freezingColumns = freezingCols.FFreezingColumns
if (freezingColumns) {
let c_list = freezingColumns.split(",")
c_list.forEach(c => {
if(c && c.length > 0) {
this.freezingColumnSetting.push(c)
}
})
}
if (this.freezingColumnSetting && this.freezingColumnSetting.length > 0) {
this.dataColumn = ref([]);
this.setFreezingColumns();
}
if (this.dataInfoObj.FCanEdit != 2) { if (this.dataInfoObj.FCanEdit != 2) {
this._changeType(_data.rows[0],2); this._changeType(_data.rows[0],2);
@ -416,8 +434,9 @@ export default {
let idx = layer.load(2); let idx = layer.load(2);
let updateObj = { let updateObj = {
LogList: [], LogList: [],
FTeamID: this.dataInfoObj['FTeamID'], FTeamID: this.dataInfoObj.FTeamID,
FViewType: this.dataInfoObj.FViewType FViewType: this.dataInfoObj.FViewType,
FTeamworkType: this.dataInfoObj.FTeamworkType,
}; };
let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID; let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID;
let cacheDataList = JSON.parse(localStorage.getItem('EditView' + saveId)); let cacheDataList = JSON.parse(localStorage.getItem('EditView' + saveId));
@ -459,8 +478,6 @@ export default {
} }
}); });
let updateLog = updateObj.LogList.join("、"); let updateLog = updateObj.LogList.join("、");
console.log('this.dataInfoObj.step', this.dataInfoObj.step);
if (updateLog != "") { if (updateLog != "") {
delete updateObj.LogList delete updateObj.LogList

@ -114,7 +114,7 @@
}, },
{ {
title: "产品分类", title: "产品分类",
key: "FMaterialType", key: "FMaterialTypeName",
width: "200px", width: "200px",
align: 'center' align: 'center'
}, },
@ -211,6 +211,7 @@
this.dataColumn[2].hide = true; this.dataColumn[2].hide = true;
this.dataColumn[7].hide = false; this.dataColumn[7].hide = false;
} }
this._getTypeList(); this._getTypeList();
this._getPageList(true); this._getPageList(true);
}, },
@ -263,7 +264,19 @@
}); });
this.pageInfo.total = result.Data.Total || 0; this.pageInfo.total = result.Data.Total || 0;
this.dataList = result.Data.List; this.dataList = result.Data.List;
this.dataList.forEach(item => {
if (item.FMaterialType == 10) {
item.FMaterialTypeName = "产成品"
} else if(item.FMaterialType == 20) {
item.FMaterialTypeName = "半成品"
} else if(item.FMaterialType == 30) {
item.FMaterialTypeName = "中间品/香基"
} else if(item.FMaterialType == 40) {
item.FMaterialTypeName = "原/辅料"
}
});
this.hasLoaded = true; this.hasLoaded = true;
console.log('this.dataList', this.dataList);
}, },
// //
dateFormat(dataStr) { dateFormat(dataStr) {
@ -287,6 +300,7 @@
} }
data.FTeamID = data.FMaterialTeamID; data.FTeamID = data.FMaterialTeamID;
data.FMdfMaterialTeamId = data.FMaterialTeamID;
this.objInfoObj = data; this.objInfoObj = data;
this.editType = type; this.editType = type;
this.showEditBox[3] = true; this.showEditBox[3] = true;

Loading…
Cancel
Save