物料新增路线

master
leo 3 years ago
parent 3c9872155b
commit fd28ef80a6

@ -0,0 +1,28 @@
import http from '../http';
//新增物料
export async function createMaterial(dataInfo, controller) {
let result = 0;
await http.post('/api/' + controller + '/CreateMaterial', dataInfo).then((data) => {
result = data.Data;
});
return result;
}
//根据物料路线ID获取物料视图
export async function getMaterialViewsByTeamId(params, controller) {
let result = {};
await http.post('/api/' + controller + '/GetMaterialViewsByTeamId', params).then((data) => {
result = data.Data;
});
return result;
}
//更新物料
export async function updateMaterial(params, controller) {
let result = {};
await http.post('/api/' + controller + '/UpdateMaterial', params).then((data) => {
result = data
});
return result;
}

@ -9,15 +9,6 @@ export async function getListByTeamId(params) {
return result;
}
//根据物料路线ID获取物料视图
export async function getMaterialViewsByTeamId(params) {
let result = {};
await http.post('/api/View/GetMaterialViewsByTeamId', params).then((data) => {
result = data.Data;
});
return result;
}
//保存视图编辑的内容
export async function updateBatchById(params) {
let result = {};
@ -35,7 +26,8 @@ export async function updateBatchById2(params) {
});
return result;
}
//获取物理视图
//获取物料视图
export async function GetMaterialInfoListByTeamId(params) {
let result = {};
await http.post('/api/View/GetMaterialInfoListByTeamId', params).then((data) => {
@ -43,3 +35,12 @@ export async function GetMaterialInfoListByTeamId(params) {
});
return result;
}
//保存视图编辑的内容
export async function updateMaterialViewById(params) {
let result = {};
await http.post('/api/View/UpdateMaterialViewById', params).then((data) => {
result = data;
});
return result;
}

@ -257,7 +257,9 @@ export default {
_data.rows.forEach((item, i) => {
columnsList = _data.columns.map(function (items) {
let str = _data.infos[i][items.key + "Type"];
let info = _data.infos[i]
if (info) {
let str = info[items.key + "Type"];
if (typeof (str) != "undefined") {
switch (str) {
case "1":
@ -270,6 +272,7 @@ export default {
return items.cellClass = items.cellClass + " four";
}
}
}
return items["cellClass"]="";
})

@ -39,8 +39,8 @@
<lay-button size="sm" type="primary" @click="showEditMaterial(2)"></lay-button>
</template>
<template v-slot:FTeamworkType="{ data }">
<span v-if="data.FTeamworkType==1" style="color:#5FB878"></span>
<span v-else style="color:#1E9FFF"></span>
<span v-if="data.FTeamworkType==1"></span>
<span v-else></span>
</template>
<template v-slot:FState="{ data }">
<span v-if="data.FState==1" style="color:#5FB878"></span>
@ -129,7 +129,7 @@
},
{
title: "发起人",
key: "FUserName",
key: "FAddUserName",
width: "160px",
align: 'center'
},

@ -105,6 +105,9 @@ import {
updateDataInfo,
getDataModel
} from "/src/api/api/common";
import {
createMaterial
} from "/src/api/api/materialEdit"
import {
getFactoryList
} from "/src/api/api/factory";
@ -318,7 +321,7 @@ export default {
if (postData.FID && postData.FID > 0) {
result = await updateDataInfo(postData, "MaterialTeamwork") || 0;
} else {
result = await insertDataInfo(postData, "MaterialTeamwork") || 0;
result = await createMaterial(postData, "MaterialTeamwork") || 0;
}
console.log('result', result);
if (result.TaskId > 0) {

@ -9,12 +9,6 @@
<template v-slot:toolbar v-if="dataInfoObj.FCanEdit != 2">
<lay-button size="sm" @click="saveBatch" type="primary" :disabled="editColumn.length === 0">保存
</lay-button>
<lay-input :class="this.isShow ? 'isShow' : 'isHidden'" v-model="inputCodeValue" :readonly="true">
<template #prepend>半成品编号</template>
</lay-input>
<lay-input :class="this.isShow ? 'isShow' : 'isHidden'" v-model="inputDescValue" :readonly="true">
<template #prepend>描述</template>
</lay-input>
<lay-button size="sm" type="primary" style="float:right;" :disabled="editColumn.length === 0"
@click="_clickFreezingColumnSetting()">固定项
</lay-button>
@ -92,10 +86,12 @@ import {
ref
} from 'vue';
import {
getMaterialViewsByTeamId,
getListByTeamId,
updateBatchById2
updateMaterialViewById
} from "/src/api/api/view";
import {
getMaterialViewsByTeamId,
updateMaterial
} from "/src/api/api/materialEdit"
import {
getBasicRoleList,
GetFreezingColumns
@ -106,8 +102,7 @@ import {
} from "/src/api/api/common";
import {
getInfoData,
changeInfoData
getInfoData
} from "/src/api/api/materialType";
import OperateLog from "./OperateLog.vue";
import FormulaView from "./FormulaView.vue";
@ -187,7 +182,7 @@ export default {
async getUserPower() {
if (this.dataInfoObj.FCanEdit != 2) {
this.userPower[0] = (await getBasicRoleList({
FRoleType: 84,
FRoleType: 40,
FViewType: this.dataInfoObj.FViewType
}) || []).map(it => parseInt(it.F2))
this.userPower[1] = (await getBasicRoleList({
@ -200,19 +195,8 @@ export default {
async initPage(idx) {
let _data = await getMaterialViewsByTeamId({
teamId: this.dataInfoObj.FTeamID,
viewType: 10,
teamType: 1
});
console.log('_data', _data);
if (this.dataInfoObj.FViewType == 1 || this.dataInfoObj.FViewType == 10) {
this.inputCodeValue = _data.rows[0].HalfCode;
this.inputDescValue = _data.rows[0].HalfDesc;
this.isShow = true;
} else if (this.dataInfoObj.FViewType == 2 || this.dataInfoObj.FViewType == 3 || this.dataInfoObj.FViewType == 4) {
this.isBomShow = true;
}
}, "MaterialTeamwork");
this.typeList[0] = _data.types.filter(s => s.FDepth == 1) || [];
this.typeList[1] = _data.types.filter(s => s.FDepth != 1) || [];
@ -246,20 +230,15 @@ export default {
});
}
}
// //
// if (this.dataInfoObj.FCanEdit != 2) {
// let tempColumn1 = dataColumn.filter(s => s.customSlot) || [];
// let tempColumn2 = dataColumn.filter(s => s.customSlot == undefined) || [];
// dataColumn = [...tempColumn1, ...tempColumn2];
// }
}
let columnsList = [];
let col7 = dataColumn.filter(s => s.fieldType == 7) || [];
_data.rows.forEach((item, i) => {
columnsList = _data.columns.map(function (items) {
let str = _data.infos[i][items.key + "Type"];
let info = _data.infos[i]
if (info) {
let str = info[items.key + "Type"];
if (typeof (str) != "undefined") {
switch (str) {
case "1":
@ -272,6 +251,7 @@ export default {
return items.cellClass = items.cellClass + " four";
}
}
}
return items["cellClass"]="";
})
@ -296,7 +276,21 @@ export default {
}
item.FTypeID1 = (item.FTypeID1 == 0 || item.FTypeID1 == -1) ? "" : item.FTypeID1;
item.FTypeID2 = (item.FTypeID2 == 0 || item.FTypeID2 == -1) ? "" : item.FTypeID2;
if (this.dataInfoObj.FCanEdit == 2) {
let fType1 = this.typeList[0].find((t) => {
return t.FID === item.FTypeID1
});
let fType2 = this.typeList[1].find((t) => {
return t.FID === item.FTypeID2
})
item.FTypeID1 = fType1.FName;
item.FTypeID2 = fType2.FName;
}
});
let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID;
localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows));
@ -305,7 +299,11 @@ export default {
this.dataColumn = dataColumn;
this.originalColumns = this.deepCopy(dataColumn);
this.getFreezingColumns();
if (this.dataInfoObj.FCanEdit != 2) {
this._changeType(_data.rows[0],2);
}
setTimeout(function () {
layer.close(idx);
}, 500);
@ -457,7 +455,7 @@ export default {
if (updateLog != "") {
delete updateObj.LogList
//
let _result = await updateBatchById2(updateObj);
let _result = await updateMaterial(updateObj, "MaterialTeamwork");
if (_result.Code === 200) {
await commonSave({
teamId: updateObj.FTeamID,
@ -470,7 +468,7 @@ export default {
setTimeout(function () {
layer.close(idx);
layer.msg('保存成功');
$this.$emit('cancelClick', true, true);
$this.$emit('cancelClick', true, false);
$this.$refs.OperateLog._getPageList();
}, 500);
}

@ -50,13 +50,7 @@
</lay-card>
</lay-col>
</lay-row>
<lay-layer :area="modelArea[1]" v-model="showEditBox[1]" :title="新增物料">
<AddMateria v-if="showEditBox[1]" :dataInfoObj="objInfoObj" @cancelClick="cancelClick"></AddMateria>
</lay-layer>
<lay-layer :area="modelArea[2]" v-model="showEditBox[2]" :title="编辑物料">
<EditMateria v-if="showEditBox[2]" :dataInfoObj="objInfoObj" @cancelClick="cancelClick"></EditMateria>
</lay-layer>
<lay-layer :area="modelArea[3]" v-model="showEditBox[3]" :title="编辑物料">
<lay-layer :area="modelArea[3]" v-model="showEditBox[3]" title="编辑物料">
<EditView v-if="showEditBox[3]" :dataInfoObj="objInfoObj" @cancelClick="cancelClick"></EditView>
</lay-layer>
</lay-container>
@ -132,7 +126,7 @@
},
{
title: "发起人",
key: "FUserName",
key: "FAddUserName",
width: "160px",
align: 'center'
},
@ -256,7 +250,7 @@
this.postData.FPageIndex = this.pageInfo.current;
this.postData.FPageSize = this.pageInfo.limit;
let result = await getPageList(this.postData, "MaterialTask");
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);
@ -288,17 +282,10 @@
this.showEditBox[i] = true;
},
_clickSetInfo(data, type) {
console.log('data', data);
for (let i = 0; i < this.showEditBox.length; i++) {
this.showEditBox[i] = false;
}
if ((data.FType >= 3 && data.FType <= 7) || data.FType == 11) {
data.FBoxType = 3; //
} else if (data.FType == 15) {
data.FBoxType = 9; //
} else {
return layer.msg("未知事项类型");
}
data.FTeamID = data.FMaterialTeamID;
this.objInfoObj = data;
this.editType = type;

Loading…
Cancel
Save