You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
337 lines
7.1 KiB
337 lines
7.1 KiB
<template>
|
|
<lay-container style="height:700px;overflow: auto;" fluid="true" class="content-box">
|
|
<MaterialList :teamId="dataInfoObj.FTeamID" :halfId="dataInfoObj.FMaterialHalfIDs"></MaterialList>
|
|
|
|
<lay-table id="dataTable" v-if="dataColumn.length > 0" height="320px" :columns="dataColumn" :data-source="dataList"
|
|
:cellStyle="cellStyle" :cellClassName="cellClassName">
|
|
<template v-slot:toolbar v-if="dataInfoObj.FCanEdit != 2">
|
|
<!-- <lay-button size="sm" type="primary" :class="this.isBomShow ? 'isBomShow' : 'isBomHidden'" @click="changeVisible2">查看BOM配方</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>
|
|
</template>
|
|
<template v-if="dataList == undefined || !dataList.FID" v-slot:operator="{ data }">
|
|
<lay-button size="sm" type="primary" v-if="data.FSuccedaneumID == 0 || data.FSuccedaneumID == ''"
|
|
@click="changeVisible2(data)">选择</lay-button>
|
|
</template>
|
|
</lay-table>
|
|
<OperateLog v-if="dataInfoObj.FTeamID" ref="OperateLog" :dataInfoObj="dataInfoObj"></OperateLog>
|
|
</lay-container>
|
|
<template>
|
|
<lay-button type="primary" @click="openConfirm2">询问框</lay-button>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
.content-box {
|
|
margin: 30px 10px;
|
|
display: block;
|
|
position: relative;
|
|
clear: both;
|
|
float: none;
|
|
min-height: 740px;
|
|
}
|
|
|
|
|
|
.row-select td {
|
|
overflow: inherit;
|
|
}
|
|
|
|
.layui-select {
|
|
width: 100%;
|
|
}
|
|
|
|
.edit {
|
|
color: green;
|
|
}
|
|
|
|
:deep(.edit-item .layui-input) {
|
|
border-color: #5FB878 !important;
|
|
}
|
|
|
|
:deep(.edit-item .layui-input:hover) {
|
|
border-color: #009688 !important;
|
|
color: #009688;
|
|
}
|
|
|
|
.isShow {
|
|
width: 370px;
|
|
height: 30px;
|
|
border: none;
|
|
}
|
|
|
|
.isHidden {
|
|
display: none;
|
|
}
|
|
|
|
.isBomHidden {
|
|
display: none;
|
|
}
|
|
</style>
|
|
<script>
|
|
import {
|
|
ref
|
|
} from 'vue';
|
|
import {
|
|
GetMaterialInfoListByTeamId
|
|
} from "/src/api/api/view";
|
|
import {
|
|
getBasicRoleList
|
|
} from "/src/api/api/user";
|
|
import {
|
|
commonSave
|
|
} from "/src/api/api/common";
|
|
import{
|
|
UpdateDataModel
|
|
} from "/src/api/api/material"
|
|
import {
|
|
getInfoData,
|
|
changeInfoData
|
|
} from "/src/api/api/materialType";
|
|
|
|
import { EditTypeList } from "/src/api/api/teamwork";
|
|
|
|
import OperateLog from "./OperateLog.vue";
|
|
import MaterialList from "./MaterialList.vue";
|
|
|
|
export default {
|
|
components: {
|
|
OperateLog,
|
|
MaterialList,
|
|
},
|
|
setup() {
|
|
let dataColumn = [{
|
|
title: "ID",
|
|
key: "FID",
|
|
width: "160px",
|
|
align: 'center',
|
|
hide: false
|
|
},
|
|
{
|
|
title: "试验号",
|
|
key: "FTestCode",
|
|
width: "160px",
|
|
align: 'center',
|
|
hide: false
|
|
},
|
|
{
|
|
title: "物料编号",
|
|
key: "FCode",
|
|
width: "400px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "物料描述",
|
|
key: "FDesc",
|
|
width: "360px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "替代料编号",
|
|
key: "FSuccedaneumCode",
|
|
width: "178px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "替代品描述",
|
|
key: "FSuccedaneumInfo",
|
|
width: "360px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "负责人",
|
|
key: "FUserName",
|
|
width: "160px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "是否需要替代料",
|
|
key: "selected",
|
|
width: "160px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "操作",
|
|
key: "operator",
|
|
width: "100px",
|
|
fixed: "right",
|
|
customSlot: 'operator',
|
|
align: 'center'
|
|
}
|
|
];
|
|
|
|
|
|
//const dataColumn = ref([]);
|
|
const dataList = ref([]);
|
|
const editColumn = ref([]);
|
|
const selectDataMap = ref(null);
|
|
const typeList = ref([
|
|
[],
|
|
[]
|
|
]);
|
|
const userPower = ref([
|
|
[],
|
|
[]
|
|
]);
|
|
const cellStyle = function (row, column, rowIndex, columnIndex) {
|
|
let back = column.table == "TFS_ViewMaterial" ? "background:rgb(246, 246, 246) !important;" : ""
|
|
return back;
|
|
}
|
|
const cellClassName = function (row, column, rowIndex, columnIndex) {
|
|
return column.cellClass || "";
|
|
}
|
|
const inputCodeValue = ref("");
|
|
const inputDescValue = ref("");
|
|
const visible2 = ref(false);
|
|
|
|
|
|
|
|
return {
|
|
dataColumn,
|
|
dataList,
|
|
editColumn,
|
|
selectDataMap,
|
|
typeList,
|
|
userPower,
|
|
cellStyle,
|
|
cellClassName,
|
|
inputCodeValue,
|
|
inputDescValue,
|
|
isShow: false,
|
|
isBomShow: false,
|
|
visible2
|
|
|
|
};
|
|
},
|
|
props: {
|
|
dataInfoObj: {
|
|
type: Object,
|
|
default: () => { },
|
|
},
|
|
viewDataList: {
|
|
type: Object,
|
|
default: () => [],
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getUserPower();
|
|
},
|
|
methods: {
|
|
async getUserPower() {
|
|
if (this.dataInfoObj.FCanEdit != 2) {
|
|
this.userPower[0] = (await getBasicRoleList({
|
|
FRoleType: 40,
|
|
FViewType: this.dataInfoObj.FViewType
|
|
}) || []).map(it => parseInt(it.F2))
|
|
this.userPower[1] = (await getBasicRoleList({
|
|
FRoleType: 44,
|
|
FViewType: this.dataInfoObj.FViewType
|
|
}) || []).map(it => parseInt(it.F2))
|
|
}
|
|
this.initPage(layer.load(2));
|
|
},
|
|
async initPage(idx) {
|
|
debugger
|
|
let _data = await GetMaterialInfoListByTeamId({
|
|
tempId: this.dataInfoObj.FTeamID
|
|
});
|
|
this.dataList = _data.Data.map(function (item) {
|
|
if (item.FSuccedaneumID == -1) {
|
|
item["selected"] = "不需要";
|
|
}
|
|
else if (item.FSuccedaneumID > 0) {
|
|
item["selected"] = "需要";
|
|
}
|
|
|
|
return item;
|
|
});
|
|
setTimeout(function () {
|
|
layer.close(idx);
|
|
}, 500);
|
|
},
|
|
changeVisible2(data) {
|
|
let $this = this;
|
|
layer.confirm("是否需要替代料", {
|
|
btn: [{
|
|
text: '需要',
|
|
callback: function (id) {
|
|
layer.close(id);
|
|
$this.$emit('cancelClick', true, false);
|
|
$this.$emit("getData", data);
|
|
}
|
|
},
|
|
{
|
|
text: '不需要',
|
|
callback: function (id) {
|
|
layer.close(id);
|
|
data.FSuccedaneumID = -1;
|
|
$this.saveBatch(data);
|
|
}
|
|
}]
|
|
})
|
|
|
|
|
|
},
|
|
cancelClick(isRefresh) {
|
|
isRefresh = isRefresh == undefined ? false : isRefresh;
|
|
this.$emit('cancelClick', isRefresh);
|
|
},
|
|
async _changeType(data, type) {
|
|
if (type == 1) {
|
|
data.FTypeID2 = -1;
|
|
} else {
|
|
if (data.FTypeID2) {
|
|
let result = await getInfoData({
|
|
"FDataID": data.FTypeID2,
|
|
"FType": 1
|
|
}) || null;
|
|
if (result != null && result.FID) {
|
|
let col7 = this.dataColumn.filter(s => s.fieldType == 7) || [];
|
|
col7.forEach((item) => {
|
|
if (item.table == "TFS_MaterialInfo") {
|
|
data[item.key] = result[item.key] || data[item.key] || "";
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
},
|
|
async saveBatch(data) {
|
|
let updateInfo = {
|
|
FID: data.FID,
|
|
tempId:this.dataInfoObj.FTeamID,
|
|
taskId:this.dataInfoObj.FID
|
|
};
|
|
updateInfo.FSuccedaneumID = -1;
|
|
updateInfo.FSuccedaneumInfo = "";
|
|
updateInfo.FSuccedaneumType = "";
|
|
updateInfo.FSuccedaneumCode = "";
|
|
let result = await UpdateDataModel(updateInfo) || 0;
|
|
debugger
|
|
// 发送保存请求
|
|
if (result.Code==200) {
|
|
await commonSave({
|
|
teamId: this.dataInfoObj.FTeamID,
|
|
type: this.dataInfoObj.FType,
|
|
desc: data.FTestCode + "确认不使用替代料"
|
|
}, "OperateLog");
|
|
let $this = this;
|
|
this.initPage();
|
|
setTimeout(function () {
|
|
layer.close(idx);
|
|
layer.msg('保存成功');
|
|
//$this.$emit('cancelClick', true, true);
|
|
this.$refs.OperateLog._getPageList();
|
|
}, 500);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|