物料新增路线

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; 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) { export async function updateBatchById(params) {
let result = {}; let result = {};
@ -35,11 +26,21 @@ export async function updateBatchById2(params) {
}); });
return result; return result;
} }
//获取物理视图
//获取物料视图
export async function GetMaterialInfoListByTeamId(params) { export async function GetMaterialInfoListByTeamId(params) {
let result = {}; let result = {};
await http.post('/api/View/GetMaterialInfoListByTeamId', params).then((data) => { await http.post('/api/View/GetMaterialInfoListByTeamId', params).then((data) => {
result = data; result = data;
}); });
return result; return result;
} }
//保存视图编辑的内容
export async function updateMaterialViewById(params) {
let result = {};
await http.post('/api/View/UpdateMaterialViewById', params).then((data) => {
result = data;
});
return result;
}

@ -257,8 +257,10 @@ export default {
_data.rows.forEach((item, i) => { _data.rows.forEach((item, i) => {
columnsList = _data.columns.map(function (items) { columnsList = _data.columns.map(function (items) {
let str = _data.infos[i][items.key + "Type"]; let info = _data.infos[i]
if (typeof (str) != "undefined") { if (info) {
let str = info[items.key + "Type"];
if (typeof (str) != "undefined") {
switch (str) { switch (str) {
case "1": case "1":
return items.cellClass = items.cellClass + " one"; return items.cellClass = items.cellClass + " one";
@ -269,8 +271,9 @@ export default {
case "4": case "4":
return items.cellClass = items.cellClass + " four"; return items.cellClass = items.cellClass + " four";
} }
}
} }
return items["cellClass"]=""; return items["cellClass"]="";
}) })
let k3Code = item.FBaseMaterialDesc; let k3Code = item.FBaseMaterialDesc;

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

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

@ -9,12 +9,6 @@
<template v-slot:toolbar v-if="dataInfoObj.FCanEdit != 2"> <template v-slot:toolbar v-if="dataInfoObj.FCanEdit != 2">
<lay-button size="sm" @click="saveBatch" type="primary" :disabled="editColumn.length === 0">保存 <lay-button size="sm" @click="saveBatch" type="primary" :disabled="editColumn.length === 0">保存
</lay-button> </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" <lay-button size="sm" type="primary" style="float:right;" :disabled="editColumn.length === 0"
@click="_clickFreezingColumnSetting()">固定项 @click="_clickFreezingColumnSetting()">固定项
</lay-button> </lay-button>
@ -92,10 +86,12 @@ import {
ref ref
} from 'vue'; } from 'vue';
import { import {
getMaterialViewsByTeamId, updateMaterialViewById
getListByTeamId,
updateBatchById2
} from "/src/api/api/view"; } from "/src/api/api/view";
import {
getMaterialViewsByTeamId,
updateMaterial
} from "/src/api/api/materialEdit"
import { import {
getBasicRoleList, getBasicRoleList,
GetFreezingColumns GetFreezingColumns
@ -106,8 +102,7 @@ import {
} from "/src/api/api/common"; } from "/src/api/api/common";
import { import {
getInfoData, getInfoData
changeInfoData
} from "/src/api/api/materialType"; } from "/src/api/api/materialType";
import OperateLog from "./OperateLog.vue"; import OperateLog from "./OperateLog.vue";
import FormulaView from "./FormulaView.vue"; import FormulaView from "./FormulaView.vue";
@ -187,7 +182,7 @@ export default {
async getUserPower() { async getUserPower() {
if (this.dataInfoObj.FCanEdit != 2) { if (this.dataInfoObj.FCanEdit != 2) {
this.userPower[0] = (await getBasicRoleList({ this.userPower[0] = (await getBasicRoleList({
FRoleType: 84, FRoleType: 40,
FViewType: this.dataInfoObj.FViewType FViewType: this.dataInfoObj.FViewType
}) || []).map(it => parseInt(it.F2)) }) || []).map(it => parseInt(it.F2))
this.userPower[1] = (await getBasicRoleList({ this.userPower[1] = (await getBasicRoleList({
@ -200,19 +195,8 @@ export default {
async initPage(idx) { async initPage(idx) {
let _data = await getMaterialViewsByTeamId({ let _data = await getMaterialViewsByTeamId({
teamId: this.dataInfoObj.FTeamID, teamId: this.dataInfoObj.FTeamID,
viewType: 10,
teamType: 1 teamType: 1
}); }, "MaterialTeamwork");
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;
}
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) || [];
@ -246,32 +230,28 @@ 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 columnsList = [];
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 str = _data.infos[i][items.key + "Type"]; let info = _data.infos[i]
if (typeof (str) != "undefined") { if (info) {
switch (str) { let str = info[items.key + "Type"];
case "1": if (typeof (str) != "undefined") {
return items.cellClass = items.cellClass + " one"; switch (str) {
case "2": case "1":
return items.cellClass = items.cellClass + " twe"; return items.cellClass = items.cellClass + " one";
case "3": case "2":
return items.cellClass = items.cellClass + " three"; return items.cellClass = items.cellClass + " twe";
case "4": case "3":
return items.cellClass = items.cellClass + " four"; return items.cellClass = items.cellClass + " three";
case "4":
return items.cellClass = items.cellClass + " four";
}
} }
} }
return items["cellClass"]=""; return items["cellClass"]="";
}) })
@ -296,7 +276,21 @@ export default {
} }
item.FTypeID1 = (item.FTypeID1 == 0 || item.FTypeID1 == -1) ? "" : item.FTypeID1; item.FTypeID1 = (item.FTypeID1 == 0 || item.FTypeID1 == -1) ? "" : item.FTypeID1;
item.FTypeID2 = (item.FTypeID2 == 0 || item.FTypeID2 == -1) ? "" : item.FTypeID2; 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; let saveId = this.dataInfoObj.FViewType + "_" + this.dataInfoObj.FID;
localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows)); localStorage.setItem('EditView' + saveId, JSON.stringify(_data.rows));
@ -305,7 +299,11 @@ export default {
this.dataColumn = dataColumn; this.dataColumn = dataColumn;
this.originalColumns = this.deepCopy(dataColumn); this.originalColumns = this.deepCopy(dataColumn);
this.getFreezingColumns(); this.getFreezingColumns();
this._changeType(_data.rows[0],2);
if (this.dataInfoObj.FCanEdit != 2) {
this._changeType(_data.rows[0],2);
}
setTimeout(function () { setTimeout(function () {
layer.close(idx); layer.close(idx);
}, 500); }, 500);
@ -447,7 +445,7 @@ export default {
updateObj.LogList.push(col.title + "" + (valTemp == "" ? "删除" : valTemp)); updateObj.LogList.push(col.title + "" + (valTemp == "" ? "删除" : valTemp));
} }
} }
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]);
@ -457,7 +455,7 @@ export default {
if (updateLog != "") { if (updateLog != "") {
delete updateObj.LogList delete updateObj.LogList
// //
let _result = await updateBatchById2(updateObj); let _result = await updateMaterial(updateObj, "MaterialTeamwork");
if (_result.Code === 200) { if (_result.Code === 200) {
await commonSave({ await commonSave({
teamId: updateObj.FTeamID, teamId: updateObj.FTeamID,
@ -470,7 +468,7 @@ export default {
setTimeout(function () { setTimeout(function () {
layer.close(idx); layer.close(idx);
layer.msg('保存成功'); layer.msg('保存成功');
$this.$emit('cancelClick', true, true); $this.$emit('cancelClick', true, false);
$this.$refs.OperateLog._getPageList(); $this.$refs.OperateLog._getPageList();
}, 500); }, 500);
} }

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

Loading…
Cancel
Save