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.
375 lines
10 KiB
375 lines
10 KiB
<template>
|
|
<lay-container fluid="true" :style="'padding:10px;height:'+(dataInfoObj!=undefined?(dataInfoObj.FHeight+'px'):'auto')">
|
|
<lay-row space="10">
|
|
<lay-col span="24">
|
|
<lay-card>
|
|
<lay-form :model="searchObj" class="search-box">
|
|
<lay-row class="search-items">
|
|
<lay-form-item label="物料号" prop="FMaterialCode">
|
|
<lay-input v-model="searchObj.FMaterialCode"></lay-input>
|
|
</lay-form-item>
|
|
<lay-form-item label="类型" prop="FTeamworkType">
|
|
<lay-select v-model="searchObj.FTeamworkType">
|
|
<lay-select-option v-for="(tIdv,tIdx) in typeList" :key="tIdx" :value="tIdv.id"
|
|
:label="tIdv.name"></lay-select-option>
|
|
</lay-select>
|
|
</lay-form-item>
|
|
<lay-form-item v-if="postData.FState!=99" label="事项状态" prop="FState">
|
|
<lay-select v-model="searchObj.FState">
|
|
<lay-select-option v-for="(tv,tx) in stateList" :key="tx" :value="tv.id"
|
|
:label="tv.name"></lay-select-option>
|
|
</lay-select>
|
|
</lay-form-item>
|
|
<lay-form-item label="发起日期" prop="FDateRange">
|
|
<lay-date-picker v-model="searchObj.FDateRange" range placeholder="type : date">
|
|
</lay-date-picker>
|
|
</lay-form-item>
|
|
</lay-row>
|
|
<lay-form-item class="search-btn">
|
|
<lay-button size="sm" type="primary" @click="_clickSearch">搜索</lay-button>
|
|
<lay-button size="sm" @click="_clickReset">重置</lay-button>
|
|
</lay-form-item>
|
|
</lay-form>
|
|
<lay-table v-if="hasLoaded" :columns="dataColumn" id="id" :dataSource="dataList"
|
|
v-model:selectedKeys="selectedKeys" :checkbox="checkbox" :default-toolbar="defaultToolbar"
|
|
:page="dataList.length>0?pageInfo:null" @change="changePage">
|
|
<template v-slot:toolbar>
|
|
<lay-button size="sm" @click="_getPageList(false,true)">刷新</lay-button>
|
|
<lay-button size="sm" type="normal" @click="showEditMaterial(1)">新增</lay-button>
|
|
<lay-button size="sm" type="primary" @click="showEditMaterial(2)">修改</lay-button>
|
|
</template>
|
|
<template v-slot:FTeamworkType="{ data }">
|
|
<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>
|
|
<span v-else style="color:#1E9FFF">已完成</span>
|
|
</template>
|
|
<template v-if="dataInfoObj == undefined|| !dataInfoObj.FID" v-slot:operator="{ data }">
|
|
<lay-button size="xs" type="primary" @click="showEditMaterial(3, data)">视图</lay-button>
|
|
</template>
|
|
</lay-table>
|
|
</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="物料视图">
|
|
<EditView v-if="showEditBox[3]" :dataInfoObj="objInfoObj" @cancelClick="cancelClick"></EditView>
|
|
</lay-layer>
|
|
</lay-container>
|
|
</template>
|
|
<script>
|
|
import {
|
|
ref,
|
|
watch
|
|
} from "vue";
|
|
import {
|
|
getBasicList,
|
|
getPageList
|
|
} from "/src/api/api/common";
|
|
import AddMateria from '../materia/components/AddMateria.vue';
|
|
import EditMateria from '../materia/components/EditMateria.vue';
|
|
import EditView from '../materia/components/EditView.vue';
|
|
import '@layui/layui-vue/es/checkbox/index.css';
|
|
import '@layui/layui-vue/es/radio/index.css';
|
|
|
|
export default {
|
|
components: {
|
|
AddMateria,
|
|
EditMateria,
|
|
EditView
|
|
},
|
|
setup() {
|
|
let dataColumn = [
|
|
{
|
|
title: "ID",
|
|
key: "FID",
|
|
width: "80px",
|
|
align: 'center',
|
|
hide: false
|
|
},
|
|
{
|
|
title: "物料描述",
|
|
key: "FMaterialName",
|
|
width: "300px",
|
|
align: 'center',
|
|
hide: false
|
|
},
|
|
{
|
|
title: "物料号",
|
|
key: "FMaterialCode",
|
|
width: "160px",
|
|
align: 'center',
|
|
hide: false
|
|
},
|
|
{
|
|
title: "试验号",
|
|
key: "FTestCode",
|
|
width: "160px",
|
|
align: 'center',
|
|
hide: false
|
|
},
|
|
{
|
|
title: "产品分类",
|
|
key: "FMaterialTypeName",
|
|
width: "200px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "发起时间",
|
|
key: "FAddDate",
|
|
width: "200px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "发起人",
|
|
key: "FAddUserName",
|
|
width: "160px",
|
|
align: 'center'
|
|
},
|
|
{
|
|
title: "类型",
|
|
key: "FTeamworkType",
|
|
width: "100px",
|
|
align: 'center',
|
|
customSlot: 'FTeamworkType',
|
|
},
|
|
{
|
|
title: "状态",
|
|
key: "FState",
|
|
width: "100px",
|
|
align: 'center',
|
|
customSlot: 'FState',
|
|
},
|
|
{
|
|
title: "操作",
|
|
key: "operator",
|
|
width: "130px",
|
|
fixed: "right",
|
|
customSlot: 'operator',
|
|
align: 'center'
|
|
}
|
|
];
|
|
const selectedKeys = ref(["1"]);
|
|
const checkbox = ref(false);
|
|
const defaultToolbar = ref(true);
|
|
const pageInfo = ref({
|
|
total: 0,
|
|
limit: 10,
|
|
current: 1
|
|
});
|
|
const dataList = ref([]);
|
|
const searchObj = ref({});
|
|
const postData = ref({});
|
|
const MaterialModel= ref({});
|
|
const showEditBox = ref([false, false, false, false, false, false, false, false, false, false, false, false,false]);
|
|
const modelArea = ref(["70%", "70%", "70%", "86%", "70%", "70%", "70%", "70%", "700px", "70%", "70%","70%","70%"]);
|
|
const objInfoObj = ref({});
|
|
const editType = ref(1);
|
|
const stateList = ref([{
|
|
id: 1,
|
|
name: "进行中"
|
|
}, {
|
|
id: 2,
|
|
name: "已完成"
|
|
}]);
|
|
const typeList = ref([{
|
|
id: 1,
|
|
name: "新增"
|
|
}, {
|
|
id: 2,
|
|
name: "修改"
|
|
}]);
|
|
const hasLoaded = ref(false);
|
|
const dataItem=ref([]);
|
|
return {
|
|
selectedKeys,
|
|
checkbox,
|
|
defaultToolbar,
|
|
dataColumn,
|
|
dataList,
|
|
pageInfo,
|
|
searchObj,
|
|
postData,
|
|
typeList,
|
|
showEditBox,
|
|
modelArea,
|
|
objInfoObj,
|
|
editType,
|
|
stateList,
|
|
hasLoaded,
|
|
MaterialModel,
|
|
dataItem
|
|
};
|
|
},
|
|
props: {
|
|
dataInfoObj: {
|
|
type: Object,
|
|
default: () => {},
|
|
},
|
|
|
|
pageTypeObj: {
|
|
type: Number,
|
|
default: () => 1,
|
|
}
|
|
},
|
|
mounted() {
|
|
if (this.dataInfoObj) {
|
|
this.dataColumn.pop();
|
|
this.dataColumn[0].hide = true;
|
|
this.dataColumn[1].hide = true;
|
|
this.dataColumn[2].hide = true;
|
|
this.dataColumn[7].hide = false;
|
|
}
|
|
this._getPageList(true);
|
|
},
|
|
methods: {
|
|
changePage(obj) {
|
|
this.pageInfo.current = obj.current;
|
|
this.pageInfo.limit = obj.limit;
|
|
this._getPageList();
|
|
},
|
|
cancelClick(isRefresh, onlyRefresh) {
|
|
if (isRefresh) {
|
|
this._getPageList(true);
|
|
}
|
|
if (onlyRefresh) return false;
|
|
for (let i = 0; i < this.showEditBox.length; i++) {
|
|
this.showEditBox[i] = false;
|
|
}
|
|
},
|
|
//分页列表
|
|
async _getPageList(isFirst, showOk) {
|
|
this.pageInfo.total = 0;
|
|
if (isFirst) {
|
|
this.pageInfo.current = 1;
|
|
this.pageInfo.total = 0;
|
|
}
|
|
|
|
// 物料号
|
|
if (this.searchObj && this.searchObj.FMaterialCode) {
|
|
this.postData.FMaterialCode = this.searchObj.FMaterialCode
|
|
}
|
|
|
|
// 类型
|
|
if (this.searchObj && this.searchObj.FTeamworkType) {
|
|
this.postData.FTeamworkType = this.searchObj.FTeamworkType
|
|
}
|
|
|
|
// 事项状态
|
|
if (this.searchObj && this.searchObj.FState) {
|
|
this.postData.FState = this.searchObj.FState
|
|
}
|
|
|
|
// 发起日期
|
|
if (this.searchObj && this.searchObj.FDateRange) {
|
|
this.postData.FDateRange = this.searchObj.FDateRange
|
|
}
|
|
|
|
this.postData.FPageIndex = this.pageInfo.current;
|
|
this.postData.FPageSize = this.pageInfo.limit;
|
|
let result = await getPageList(this.postData, "MaterialTeamwork");
|
|
|
|
result.Data.List = result.Data.List || [];
|
|
this.pageInfo.total = result.Data.Total || 0;
|
|
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;
|
|
},
|
|
//日期处理
|
|
dateFormat(dataStr) {
|
|
return dataStr.replace('T', ' ').split('.')[0];
|
|
},
|
|
getData(data){
|
|
this.MaterialModel = data;
|
|
for (let i = 0; i < this.showEditBox.length; i++) {
|
|
this.showEditBox[i] = false;
|
|
}
|
|
this.showEditBox[11] = true;
|
|
this.editType = 1;
|
|
|
|
},
|
|
showEditMaterial(i, data){
|
|
for (let i = 0; i < this.showEditBox.length; i++) {
|
|
this.showEditBox[i] = false;
|
|
}
|
|
|
|
if (i == 3) {
|
|
data.FTeamID = data.FID;
|
|
data.FCanEdit = 2;
|
|
this.objInfoObj = data;
|
|
}
|
|
|
|
this.showEditBox[i] = true;
|
|
},
|
|
_clickSetInfo(data, type) {
|
|
|
|
for (let i = 0; i < this.showEditBox.length; i++) {
|
|
this.showEditBox[i] = false;
|
|
}
|
|
if (data.FType == 1) {
|
|
data.FBoxType = 1; //配方选择
|
|
} else if (data.FType == 2) {
|
|
data.FBoxType = 2; //BOM下载
|
|
} else if (data.FType == 9 || data.FType == 10) {
|
|
data.FBoxType = 4; //新包材新增、新子项包材申请
|
|
} else if ((data.FType >= 3 && data.FType <= 7) || data.FType == 11) {
|
|
data.FBoxType = 3; //视图编辑
|
|
} else if (data.FType == 8) {
|
|
data.FBoxType = 5; //组编号申请
|
|
} else if (data.FType == 12) {
|
|
data.FBoxType = 6; //成品视图物料组复核
|
|
} else if (data.FType == 13) {
|
|
data.FBoxType = 7; //流程确认完成
|
|
} else if (data.FType == 14) {
|
|
data.FBoxType = 8; //补充包材规格
|
|
} else if (data.FType == 15) {
|
|
data.FBoxType = 9; //物料选择类型
|
|
}else if(data.FType==16){
|
|
this.dataItem=data;
|
|
data.FBoxType = 10; //替代料确认
|
|
}else {
|
|
return layer.msg("未知事项类型");
|
|
}
|
|
this.objInfoObj = data;
|
|
this.editType = type;
|
|
this.showEditBox[data.FBoxType] = true;
|
|
},
|
|
|
|
|
|
//检索-检索
|
|
_clickSearch() {
|
|
this.postData = {};
|
|
for (let key in this.searchObj) {
|
|
let val = this.searchObj[key];
|
|
if (val != null && val !== "") this.postData[key] = val;
|
|
}
|
|
this._getPageList(true);
|
|
},
|
|
//检索-重置
|
|
_clickReset() {
|
|
this.searchObj = {};
|
|
this._clickSearch();
|
|
}
|
|
}
|
|
}
|
|
</script>
|