diff --git a/src/api/api/materialEdit.ts b/src/api/api/materialEdit.ts
new file mode 100644
index 0000000..c16eabf
--- /dev/null
+++ b/src/api/api/materialEdit.ts
@@ -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;
+}
\ No newline at end of file
diff --git a/src/api/api/view.ts b/src/api/api/view.ts
index e4d3f98..b461468 100644
--- a/src/api/api/view.ts
+++ b/src/api/api/view.ts
@@ -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,11 +26,21 @@ export async function updateBatchById2(params) {
});
return result;
}
-//获取物理视图
+
+//获取物料视图
export async function GetMaterialInfoListByTeamId(params) {
let result = {};
await http.post('/api/View/GetMaterialInfoListByTeamId', params).then((data) => {
result = data;
});
return result;
-}
\ No newline at end of file
+}
+
+//保存视图编辑的内容
+export async function updateMaterialViewById(params) {
+ let result = {};
+ await http.post('/api/View/UpdateMaterialViewById', params).then((data) => {
+ result = data;
+ });
+ return result;
+}
\ No newline at end of file
diff --git a/src/views/Need/components/EditView.vue b/src/views/Need/components/EditView.vue
index 715d6d5..1a2268f 100644
--- a/src/views/Need/components/EditView.vue
+++ b/src/views/Need/components/EditView.vue
@@ -257,8 +257,10 @@ export default {
_data.rows.forEach((item, i) => {
columnsList = _data.columns.map(function (items) {
- let str = _data.infos[i][items.key + "Type"];
- if (typeof (str) != "undefined") {
+ let info = _data.infos[i]
+ if (info) {
+ let str = info[items.key + "Type"];
+ if (typeof (str) != "undefined") {
switch (str) {
case "1":
return items.cellClass = items.cellClass + " one";
@@ -269,8 +271,9 @@ export default {
case "4":
return items.cellClass = items.cellClass + " four";
}
+ }
}
-
+
return items["cellClass"]="";
})
let k3Code = item.FBaseMaterialDesc;
diff --git a/src/views/materia/all.vue b/src/views/materia/all.vue
index c8cf726..f34ea82 100644
--- a/src/views/materia/all.vue
+++ b/src/views/materia/all.vue
@@ -39,8 +39,8 @@
修改
- 新增
- 修改
+ 新增
+ 修改
进行中
@@ -129,7 +129,7 @@
},
{
title: "发起人",
- key: "FUserName",
+ key: "FAddUserName",
width: "160px",
align: 'center'
},
diff --git a/src/views/materia/components/AddMateria.vue b/src/views/materia/components/AddMateria.vue
index 7a89014..2a6840d 100644
--- a/src/views/materia/components/AddMateria.vue
+++ b/src/views/materia/components/AddMateria.vue
@@ -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) {
diff --git a/src/views/materia/components/EditView.vue b/src/views/materia/components/EditView.vue
index f2c69c1..1630d02 100644
--- a/src/views/materia/components/EditView.vue
+++ b/src/views/materia/components/EditView.vue
@@ -9,12 +9,6 @@
保存
-
- 半成品编号:
-
-
- 描述:
-
固定项
@@ -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,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 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"];
- if (typeof (str) != "undefined") {
- switch (str) {
- case "1":
- return items.cellClass = items.cellClass + " one";
- case "2":
- return items.cellClass = items.cellClass + " twe";
- case "3":
- return items.cellClass = items.cellClass + " three";
- case "4":
- return items.cellClass = items.cellClass + " four";
+ let info = _data.infos[i]
+ if (info) {
+ let str = info[items.key + "Type"];
+ if (typeof (str) != "undefined") {
+ switch (str) {
+ case "1":
+ return items.cellClass = items.cellClass + " one";
+ case "2":
+ return items.cellClass = items.cellClass + " twe";
+ case "3":
+ return items.cellClass = items.cellClass + " three";
+ case "4":
+ 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();
- this._changeType(_data.rows[0],2);
+
+ if (this.dataInfoObj.FCanEdit != 2) {
+ this._changeType(_data.rows[0],2);
+ }
+
setTimeout(function () {
layer.close(idx);
}, 500);
@@ -447,7 +445,7 @@ export default {
updateObj.LogList.push(col.title + ":" + (valTemp == "" ? "删除" : valTemp));
}
}
-
+
for (let key in dataObj) {
if (!updateObj[key]) updateObj[key] = [];
updateObj[key].push(dataObj[key]);
@@ -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);
}
diff --git a/src/views/materia/route.vue b/src/views/materia/route.vue
index 4ae8b38..693fd89 100644
--- a/src/views/materia/route.vue
+++ b/src/views/materia/route.vue
@@ -50,13 +50,7 @@
-
-
-
-
-
-
-
+
@@ -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;