plm前端
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.
 
 
 
 

828 lines
29 KiB

<template>
<div class="mod-config">
<!-- 工具申请界面-->
<el-form label-position="top" :model="searchData">
<el-row :gutter="18">
<el-col :span="2">
<el-form-item label="项目编号">
<el-input v-model="searchData.projectId" clearable />
</el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label="项目类型">
<dict-data-select dict-type="project_info_type_db" filterable clearable :use-default-value="false" v-model="searchData.projectType"></dict-data-select>
</el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label="项目负责人">
<el-input v-model="searchData.projectOwnerName" clearable/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="项目名称">
<el-input v-model="searchData.projectName" clearable/>
</el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label="项目优先级">
<dict-data-select dict-type="project_info_priority" clearable v-model="searchData.priority"></dict-data-select>
</el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label="项目来源">
<dict-data-select dict-type="project_info_source" clearable v-model="searchData.projectSource"></dict-data-select>
</el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label="客户代码">
<el-input v-model="searchData.customerId" clearable/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label=" ">
<el-button plain type="primary" @click="initDataBtn" > </el-button>
<el-button type="primary" @click="applyModel">刀模申请</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:data="dataList"
:height="height"
border
@selection-change="selectionChangeHandle"
v-loading="dataListLoading"
style="width: 100%; ">
<el-table-column
type="selection"
align="center"
width="30">
</el-table-column>
<el-table-column
v-for="(item,index) in columnList1" :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-column-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- width="150"-->
<!-- fixed="right"-->
<!-- label="操作">-->
<!-- <template slot-scope="scope">-->
<!-- <a type="text" size="small" @click="updateModel(scope.row)">修改</a>-->
<!-- <a type="text" size="small" @click="deleteData(scope.row)">删除</a>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 1000]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<el-dialog
width="800px" v-drag
:title="'刀模申请'"
: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.applyNo" style="width: 130px" disabled></el-input>
</el-form-item>
<el-form-item :label="'申请总数'">
<el-input v-model="dataForm.applySumQty" style="width: 130px" disabled></el-input>
</el-form-item>
<el-form-item :label="'总成本'">
<el-input v-if="accessField('10601001')" v-model="dataForm.totalCost" style="width: 130px" disabled></el-input>
<el-input v-if="!accessField('10601001')" v-model="valueNull" style="width: 130px" disabled></el-input>
</el-form-item>
<el-form-item :label="'申请人'" required="required">
<el-input v-model="dataForm.applyBy" style="width: 130px" ></el-input>
</el-form-item>
<el-form-item :label="'申请日期'" required="required">
<el-date-picker
value-format="yyyy-MM-dd"
style="width: 100%"
v-model="dataForm.applyDate"
type="date"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="部门" required="required">
<dict-data-select :site="$store.state.user.site" v-model="dataForm.department" dict-type="tool_application_department" style="width: 130px"></dict-data-select>
</el-form-item>
<el-form-item required="required">
<span slot="label" style="" @click="getBaseList(2002,1)"><a herf="#">报价专员</a></span>
<el-input v-model="dataForm.quoterName" ref="quoterName" placeholder="请选择人员" readonly style="width: 130px" ></el-input>
</el-form-item>
<el-form-item required="required">
<span slot="label" style="" @click="getBaseList(2042,2)"><a herf="#">TP</a></span>
<el-input v-model="dataForm.tpName" ref="tpName" placeholder="请选择人员" readonly style="width: 130px" ></el-input>
</el-form-item>
<el-form-item required="required">
<span slot="label" style="" @click="getBaseList(2000,3)"><a herf="#">采购专员</a></span>
<el-input v-model="dataForm.purchaserName" ref="purchaserName" placeholder="请选择人员" readonly style="width: 130px" ></el-input>
</el-form-item>
<el-form-item label=" " >
<el-checkbox v-model="jumpFlag">跳转至申请记录</el-checkbox>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" label-width="100px" >
<el-form-item :label="'申请原因'">
<!-- <el-input v-model="dataForm.applyReason" style="width: 770px" ></el-input>-->
<el-input type="textarea" style="width: 770px" resize="none" :autosize="{minRows: 3, maxRows: 3}"
v-model="dataForm.applyReason"/>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 60px">
<el-form-item :label="'备注'">
<!-- <el-input v-model="dataForm.remark" style="width: 770px" ></el-input>-->
<el-input type="textarea" style="width: 770px" resize="none" :autosize="{minRows: 3, maxRows: 3}"
v-model="dataForm.remark"/>
</el-form-item>
</el-form>
<div class="rq" style="margin-top: 60px">
<el-table
height="250"
:data="toolData"
border
ref="toolTable"
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column label="项目号" width="90" prop="projectId" show-overflow-tooltip/>
<el-table-column label="工具编码" width="100" prop="toolId" show-overflow-tooltip/>
<el-table-column label="工具描述" width="120" prop="toolDescription" show-overflow-tooltip/>
<el-table-column label="工具数量" width="60" prop="toolQty" show-overflow-tooltip/>
<el-table-column label="申请数量" width="70" prop="applyQty" show-overflow-tooltip>
<template slot-scope="scope">
<el-input v-model="scope.row.applyQty" type="number" @change="changeSum(scope.row)" placeholder="请输入数量" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
style="width:98%"></el-input>
</template>
</el-table-column>
<el-table-column label="工具成本" width="70" prop="standardCost" show-overflow-tooltip>
<template slot-scope="scope">
<el-input v-if="accessField('10601001')" v-model="scope.row.standardCost" type="number" @change="changeSum(scope.row)" placeholder="请输入成本"
style="width:98%"></el-input>
</template>
</el-table-column>
<el-table-column label="物料编码" width="100" prop="partNo" show-overflow-tooltip/>
<el-table-column label="物料名称" width="160" prop="partName" show-overflow-tooltip/>
<el-table-column label="IFS料号" width="100" prop="finalPartNo" show-overflow-tooltip/>
<el-table-column label="客户料号" width="100" prop="customerPartNo" show-overflow-tooltip/>
<el-table-column label="工艺版本" width="80" prop="routingRevision" show-overflow-tooltip/>
<el-table-column label="工艺类型" width="80" prop="routingType" show-overflow-tooltip/>
<el-table-column label="替代编码" width="80" prop="alternativeNo" show-overflow-tooltip/>
<el-table-column label="替代名称" width="80" prop="alternativeDescription" show-overflow-tooltip/>
<el-table-column label="工序号" width="60" prop="operationNo" show-overflow-tooltip/>
<el-table-column label="工序名称" width="80" prop="operationName" show-overflow-tooltip/>
<!-- <el-table-column label="工具成本" width="60" prop="standardCost" show-overflow-tooltip/>-->
<!-- <el-table-column label="单位报价成本" width="90" prop="quotationUnitCost" show-overflow-tooltip/>-->
<!-- <el-table-column label="预计使用寿命" width="90" prop="expectedServiceLife" show-overflow-tooltip/>-->
</el-table>
</div>
<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>
<ChooseUser ref="userList" @getBaseData="getUserData"></ChooseUser>
</div>
</template>
<script>
import {projectInfoForToolApply,
getProjectPartToolForApply,
saveProjectToolApply,
} from "@/api/tool/toolApply.js"
import Chooselist from '@/views/modules/common/Chooselist'
import DictDataSelect from "../sys/dict-data-select.vue"
import ChooseUser from '@/views/modules/common/ChooseUser'
export default {
components: {
Chooselist, DictDataSelect,ChooseUser,
},
data() {
return {
height: 200,
dataList: [],
searchFlag:false,
// 搜索条件对象
searchData:{
page: 1,
limit: 100,
site:this.$store.state.user.site,
projectId:'',
projectType:'',
projectOwnerName:'',
projectName:'',
priority:'',
projectSource:'',
customerId:'',
userName:this.$store.state.user.name,
},
exportList:[],
pageIndex: 1,
pageSize: 100,
totalPage: 0,
visible:false,
dataListLoading: false,
currentRow:'',
columnList1: [
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1ProjectId',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "projectId",
headerAlign: "center",
align: "center",
columnLabel: "项目号",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1ProjectType',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "projectType",
headerAlign: "center",
align: "left",
columnLabel: "项目类型",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1ProjectName',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "projectName",
headerAlign: "center",
align: "left",
columnLabel: "项目名称",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 200
},
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1Priority',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "priorityDesc",
headerAlign: "center",
align: "left",
columnLabel: "优先级",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1ProjectOwnerName',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "projectOwnerName",
headerAlign: "center",
align: "left",
columnLabel: "项目负责人",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1ProjectSource',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "projectSourceDesc",
headerAlign: "center",
align: "left",
columnLabel: "项目来源",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1CustomerId',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "customerId",
headerAlign: "center",
align: "left",
columnLabel: "客户代码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1CustomerName',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "customerName",
headerAlign: "center",
align: "left",
columnLabel: "客户名称",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
{
userId: this.$store.state.user.name,
functionId: 106001001,
serialNumber: '106001001Table1CreateDate',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "createDate",
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: 106001001,
serialNumber: '106001001Table1CreateBy',
tableId: "106001001Table1",
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: 106001001,
serialNumber: '106001001Table1UpdateDate',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "updateDate",
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: 106001001,
serialNumber: '106001001Table1UpdateBy',
tableId: "106001001Table1",
tableName: "项目信息主表",
columnProp: "updateBy",
headerAlign: "center",
align: "left",
columnLabel: "修改人",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
],
jumpFlag:true,
valueNull:'******',
dataForm:{
site: '',
applyNo: '',
applyBy:'',
applyDate:'',
applySumQty:'',
applyReason:'',
remark:'',
createBy:'',
department:'',
quoter: '',
quoterName: '',
tp: '',
tpName: '',
purchaser: '',
totalCost:'',
purchaserName: '',
detailList:[],
},
toolData:[],
dataListSelections:[],
dataRole: {
partTypeDesc: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
partName: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
},
// 导出 start
exportData: [],
exportName: '项目物料'+this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: ["项目物料"],
exportFooter: [],
// 导出 end
}
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 190;
})
},
methods: {
getUserList (type) {
if(this.ifDisableFlag){
return false
}
this.tagNo1 = type
this.$nextTick(() => {
let strVal = ''
let conSql = " and b.site = '" + this.$store.state.user.site + "'";
if(type==1) {
strVal = this.dataForm.quoter
}
if(type==2) {
strVal = this.dataForm.tp
}
if(type==3) {
strVal = this.dataForm.purchaser
}
this.$refs.userList.init(this.searchData.site,'%%', strVal,conSql)
})
},
/* 列表方法的回调 */
getUserData (val) {
if(this.tagNo1==1) {
this.dataForm.quoter = val.username
this.dataForm.quoterName = val.userDisplay
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.quoterName);
});
}
if(this.tagNo1==2) {
this.dataForm.tp = val.username
this.dataForm.tpName = val.userDisplay
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.tpName);
});
}
if(this.tagNo1==3) {
this.dataForm.purchaser = val.username
this.dataForm.purchaserName = val.userDisplay
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.purchaserName);
});
}
},
// 获取基础数据列表S
getBaseList (val, type) {
this.tagNo = val
this.tagNo1 = type
this.$nextTick(() => {
let strVal = ''
if(val==2002) {
strVal = this.dataForm.quoter
}
if(val==2042) {
strVal = this.dataForm.tp
}
if(val==2000) {
strVal = this.dataForm.purchaser
}
this.$refs.baseList.init(val, strVal)
})
},
/* 列表方法的回调 */
getBaseData (val) {
debugger;
if(this.tagNo == 2002) {
this.dataForm.quoter = val.username
this.dataForm.quoterName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.quoterName);
});
}
if(this.tagNo == 2042) {
this.dataForm.tp = val.username
this.dataForm.tpName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.tpName);
});
}
if(this.tagNo ==2000) {
this.dataForm.purchaser = val.username
this.dataForm.purchaserName = val.user_display
this.$nextTick(() => {
this.$triggerInputEvent(this.$refs.purchaserName);
});
}
},
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.search()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.search()
},
initDataBtn(){
this.initData();
},
// 初始化数据
initData(){
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
projectInfoForToolApply(this.searchData).then(({data}) => {
if (data.code == 0) {
this.dataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
}
this.dataListLoading = false
})
},
applyModel() {
if(this.dataListSelections.length===0){
this.$alert('请选择项目!', '错误', {
confirmButtonText: '确定'
})
return false;
}
getProjectPartToolForApply(this.dataListSelections).then(({data}) => {
if (data.code == 0) {
this.toolData=data.rows
}
})
this.dataForm={
site: this.$store.state.user.site,
applyNo: '',
applyBy:this.$store.state.user.name,
applyDate:new Date(),
applySumQty:0,
applyReason:'',
remark:'',
createBy:this.$store.state.user.name,
department: '',
quoter: '',
quoterName: '',
tp: '',
tpName: '',
purchaser: '',
totalCost: '',
purchaserName: '',
detailList:[],
};
this.visible=true;
this.jumpFlag=true;
},
changeSum(row){
if(row.standardCost<0||row.standardCost==null||row.standardCost==''){
row.standardCost=0
// this.$alert('成本不能为负数或者不填', '错误', {
// confirmButtonText: '确定'
// })
}
this.dataForm.applySumQty =0
this.dataForm.totalCost =0
for (const item of this.toolData) {
// 累加之前先确保值存在并将 null undefined 转换为0
this.dataForm.applySumQty += Number(item.applyQty != null && item.applyQty !== '' ? item.applyQty : 0);
this.dataForm.totalCost += Number(item.applyQty != null && item.applyQty !== '' ? item.applyQty*item.standardCost : 0);
}
},
saveData(){
// for (let i = 0; i < this.toolData.length; i++) {
// if(this.toolData[i].toolQuantity<this.toolData[i].applyQty){
// this.$alert( '工具'+this.toolData[i].toolNo +' 实际申请数量大于表单工具数量', '错误', {
// confirmButtonText: '确定'
// })
// return false;
// }
// }
if(this.dataForm.applySumQty===0){
this.$alert('未填写申请数量', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.dataForm.applyBy===''||this.dataForm.applyBy==null){
this.$alert('未选择申请人', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.dataForm.applyDate===''||this.dataForm.applyDate==null){
this.$alert('未选择申请日期', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.dataForm.department===''||this.dataForm.department==null){
this.$alert('未选择部门', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.dataForm.quoter===''||this.dataForm.quoter==null){
this.$alert('未选择报价员', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.dataForm.tp===''||this.dataForm.tp==null){
this.$alert('未选择TP', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.dataForm.purchaser===''||this.dataForm.purchaser==null){
this.$alert('未选择采购专员', '错误', {
confirmButtonText: '确定'
})
return false;
}
this.$confirm('确定要保存?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
for (let i = 0; i < this.toolData.length; i++) {
if (this.toolData[i].applyQty===''||this.toolData[i].applyQty==null){
this.toolData[i].applyQty=0
}
}
this.dataForm.detailList=this.toolData.filter(item => item.applyQty > 0).filter(item => item.standardCost >= 0)
saveProjectToolApply(this.dataForm).then(({data}) => {
if (data && data.code == 0) {
this.visible=false;
this.initDataBtn();
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
}
})
if(this.jumpFlag){
this.$nextTick(function () {
setTimeout(() => {
let inData = {
site: this.$store.state.user.site,
applyNo: data.applyNo,
username: this.$store.state.user.name
};
localStorage.setItem('ToolApplyData', JSON.stringify(inData))
this.$router.push('tooling-searchToolApply')
},500)
})
}
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
//导出excel
//导出excel
async createExportData() {
// this.searchData.limit = -1
// this.searchData.page = 1
// await projectInfoSearch(this.searchData).then(({data}) => {
// this.exportList= data.page.list;
// })
//
// return this.exportList;
},
startDownload() {
// this.exportData = this.dataList
},
finishDownload() {
},
fields() {
let json = "{"
this.columnList1.forEach((item, index) => {
if (index == this.columnList1.length - 1) {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
} else {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
}
})
json += "}"
let s = eval("(" + json + ")")
return s
},
fieldColumn(){
if(!this.accessField('10601001')){
this.columnList2=this.columnList2.filter(item => item.columnProp !== 'standardCost');
}
},
},
}
</script>
<style scoped>
</style>