|
|
<template> <div class="mod-config"> <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;"> <el-form :inline="true" label-position="top" style="margin-top: 0px"> <el-button type="primary" @click="addModal()">新增</el-button> </el-form> </el-form> <el-table :data="dataList" height="240" border v-loading="dataListLoading" style="width: 100%; "> <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> </el-table> <el-dialog width="600px" :title="!dataForm.id ? '添加' :'编辑'" :close-on-click-modal="false" :visible.sync="visible"> <el-form :inline="true" label-position="top" label-width="100px" > <el-form-item :label="'项目料号'"> <el-input v-model="dataForm.testPartNo" style="width: 130px" disabled></el-input> </el-form-item>
<el-form-item > <span slot="label" style="" @click="getBaseList(1013,1)"><a herf="#">物料类型</a></span> <el-input v-model="dataForm.partTypeDesc" style="width: 130px" readonly @focus="getBaseList(1013,1)"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" label-width="100px" > <el-form-item :label="'物料名称'"> <el-input v-model="dataForm.partName" style="width: 562px" ></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" label-width="100px" > <el-form-item :label="'物料描述'"> <el-input v-model="dataForm.partDesc" style="width: 562px" ></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" label-width="100px" > <el-form-item :label="'物料描述'"> <el-input v-model="dataForm.partSpec" style="width: 562px" ></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" label-width="100px" > <el-form-item :label="'物料图号'"> <el-input v-model="dataForm.materialNumber" style="width: 562px" ></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" label-width="100px" > <el-form-item :label="'备注'"> <el-input v-model="dataForm.remark" style="width: 562px" ></el-input> </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> <el-button type="primary" @click="saveData()">{{'确定'}}</el-button> <el-button type="primary" @click="visible = false">{{'关闭'}}</el-button> </span> </el-dialog> <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> </div></template>
<script> import { getProjectInfoPartList, saveProjectPart, } from "@/api/project/project.js" import Chooselist from '@/views/modules/common/Chooselist' export default { components: { Chooselist }, data() { return { dataList: [], searchData: { site: '', username: this.$store.state.user.name, projectId: '', }, visible:false, dataListLoading: false, currentRow:'', columnList:[ { userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3TestPartNo', tableId: "101002003Table3", tableName: "项目物料", columnProp: "testPartNo", headerAlign: "center", align: "left", columnLabel: "物料编码", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3PartType', tableId: "101002003Table3", tableName: "项目物料", columnProp: "partType", headerAlign: "center", align: "left", columnLabel: "物料分类", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 60 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3PartTypeDesc', tableId: "101002003Table3", tableName: "项目物料", columnProp: "partTypeDesc", headerAlign: "center", align: "left", columnLabel: "物料分类名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3PartName', tableId: "101002003Table3", tableName: "项目物料", columnProp: "partName", headerAlign: "center", align: "left", columnLabel: "物料名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3PartDesc', tableId: "101002003Table3", tableName: "项目物料", columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "物料描述", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3PartSpec', tableId: "101002003Table3", tableName: "项目物料", columnProp: "partSpec", headerAlign: "center", align: "left", columnLabel: "规格型号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3MaterialNumber', tableId: "101002003Table3", tableName: "项目物料", columnProp: "materialNumber", headerAlign: "center", align: "left", columnLabel: "物料图号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3Remark', tableId: "101002003Table3", tableName: "项目物料", columnProp: "remark", headerAlign: "center", align: "left", columnLabel: "备注", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3CreateDate', tableId: "101002003Table3", tableName: "项目物料", columnProp: "createDate", headerAlign: "center", align: "left", columnLabel: "创建时间", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 160 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3CreateBy', tableId: "101002003Table3", tableName: "项目物料", columnProp: "createBy", headerAlign: "center", align: "left", columnLabel: "创建人", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3UpdateDate', tableId: "101002003Table3", tableName: "项目物料", columnProp: "updateDate", headerAlign: "center", align: "left", columnLabel: "上次修改日期", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 160 },{ userId: this.$store.state.user.name, functionId: 101002003, serialNumber: '101002003Table3UpdateBy', tableId: "101002003Table3", tableName: "项目物料", columnProp: "updateBy", headerAlign: "center", align: "left", columnLabel: "修改人", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, ], dataForm:{ id:'', site: '', projectId: '', testPartNo:'', partType:'', partTypeDesc:'', partName:'', partDesc:'', partSpec:'', remark:'', materialNumber:'', username:'', }, } }, methods: { // 获取基础数据列表S
getBaseList (val, type) { this.tagNo = val this.tagNo1 = type this.$nextTick(() => { let strVal = '' if (val === 1013) { if(type==1) { strVal = this.dataForm.partType } } this.$refs.baseList.init(val, strVal) }) }, /* 列表方法的回调 */ getBaseData (val) { if (this.tagNo === 1013) { if(this.tagNo1==1) { this.dataForm.partType = val.Base_id this.dataForm.partTypeDesc = val.Base_desc } } }, //初始化组件的参数
init(inData) { //初始化参数
this.searchData = JSON.parse(JSON.stringify(inData)); //刷新表格
this.searchTable();
}, searchTable(){ getProjectInfoPartList(this.searchData).then(({data}) => { //区分请求成功和失败的状况
if (data && data.code == 0) { this.dataList = data.rows; } else { this.dataList = []; } }); }, /*关闭modal*/ closeDialog(){ //刷新报工的页面
this.$emit('refreshPageTables'); //关闭当前的页面
this.visible = false; }, addModal(){ this.dataForm={ id:0, site: this.searchData.site, projectId: this.searchData.projectId, testPartNo:'', partType:'', partTypeDesc:'', partName:'', partDesc:'', partSpec:'', remark:'', materialNumber:'', username:this.$store.state.user.name, } this.visible=true; }, saveData(){ if(this.dataForm.partType==''||this.dataForm.partType==null){ this.$alert('请选择物料类别!', '错误', { confirmButtonText: '确定' }) return false; } if(this.dataForm.partName==''||this.dataForm.partName==null){ this.$alert('请输入物料名称!', '错误', { confirmButtonText: '确定' }) return false; } saveProjectPart(this.dataForm).then(({data}) => { if (data && data.code === 0) { this.$message.success( '操作成功') this.visible = false this.searchTable(); } else { this.$message.error(data.msg) } }) },
}, }</script>
<style scoped>
</style>
|