1269 lines
38 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="fullHeight whiteBlock">
<div style="padding: 15px 15px 0">
<p class="pageTitle">用料出库</p>
<el-form
:inline="true"
ref="searchForm"
:model="searchForm"
size="medium"
>
<el-form-item label="单号">
<el-input v-model="searchForm.number" placeholder="请输入"></el-input>
</el-form-item>
<!-- <el-form-item label="货号">
<el-input v-model="searchForm.stuffNumber" placeholder="请输入"></el-input>
</el-form-item> -->
<el-form-item label="仓库">
<el-input
v-model="searchForm.warehouse"
placeholder="请输入"
></el-input>
</el-form-item>
<!-- <el-form-item label="部门">
<el-input
v-model="searchForm.department"
placeholder="请输入"
></el-input>
</el-form-item> -->
<el-form-item label="类型">
<el-input
v-model="searchForm.category"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="经手人">
<el-input
v-model="searchForm.handler"
placeholder="请输入"
></el-input>
</el-form-item>
<!-- <el-form-item label="助查码">
<el-input v-model="searchForm.lookupCode" placeholder="请输入"></el-input>
</el-form-item> -->
<el-form-item label="日期">
<el-date-picker
v-model="timeValue"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
@change="getTime"
>
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="客户">
<el-input
v-model="searchForm.customer"
placeholder="请输入"
></el-input>
</el-form-item> -->
<el-form-item>
<el-button type="primary" plain @click="getList">{{
$t('message.energyManage.waybill.query')
}}</el-button>
<el-button type="warning" plain @click="refresh">{{
$t('message.deviceManage.refresh')
}}</el-button>
<el-button type="primary" size="medium" @click="add">新增</el-button>
</el-form-item>
</el-form>
</div>
<div class="table_wrap whiteBlock">
<el-table class="tables" :data="List" @row-click="showDetailFn">
<el-table-column
prop="serialNumber"
label="编号"
align="center"
></el-table-column>
<el-table-column
prop="number"
align="center"
label="单号"
></el-table-column>
<el-table-column
prop="date"
align="center"
label="日期"
></el-table-column>
<el-table-column
prop="warehouse"
align="center"
label="仓库"
></el-table-column>
<el-table-column
prop="direction"
align="center"
label="方向"
></el-table-column>
<el-table-column
prop="category"
align="center"
label="类型"
></el-table-column>
<!-- <el-table-column
prop="department"
align="center"
label="部门"
></el-table-column> -->
<!-- <el-table-column
prop="customer"
align="center"
label="客户"
></el-table-column> -->
<el-table-column
prop="handler"
align="center"
label="经手人"
></el-table-column>
<el-table-column
prop="lotNumber"
align="center"
label="批号"
></el-table-column>
<!-- <el-table-column
prop="singleHanded"
align="center"
label="制单人"
></el-table-column> -->
<el-table-column
width="110"
prop="createTime"
align="center"
label="制单时间"
></el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<div class="tableBtns" style="margin-left: -14px !important">
<div
@click.stop="edit(scope.row)"
class="operationText"
style="
margin-right: 10px !important;
margin-left: 20px !important;
"
>
<img
src="@/assets/images/icon-edit.png"
width="15px"
height="15px"
/>
<span>编辑</span>
</div>
<div @click.stop="deleteDev(scope.row)" class="operationText">
<img
src="@/assets/images/icon-delete.png"
width="15px"
height="15px"
/>
<span>删除</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
class="pagerBox"
@size-change="SizeChange"
@current-change="CurrentChange"
:current-page="pagInfo.pageNo"
:page-sizes="$store.state.PAGESIZRS"
:page-size="pagInfo.pageSize"
layout="total, sizes, prev, pager, next"
:total="Number(pagInfo.total)"
background
></el-pagination>
</div>
<!--新增入库单信息弹框-->
<el-dialog
:modal-append-to-body="false"
:title="title"
:visible.sync="dialogShow"
width="1230px"
>
<p>出库单信息</p>
<div class="dialog_content">
<el-form
style="margin: 0 28px"
size="medium"
:model="addForm"
ref="addForm"
:rules="addFormules"
:inline="true"
>
<el-form-item label="日期" prop="createTime">
<el-date-picker
v-model="addForm.date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-form-item label="仓库" prop="warehouse">
<el-input
v-model="addForm.warehouse"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="类型" prop="category" style="margin-left: 12px">
<el-input
v-model="addForm.category"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="方向" prop="direction" style="margin-left: 28px">
<el-input
v-model="addForm.direction"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item
label="编号"
prop="serialNumber"
style="margin-left: 35px"
>
<el-input
v-model="addForm.serialNumber"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="单号" prop="number">
<el-input v-model="addForm.number" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="批号" prop="lotNumber">
<el-input
v-model="addForm.lotNumber"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="经手人" prop="handler">
<el-input v-model="addForm.handler" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="作业单位" prop="category">
<el-select
v-model="addForm.gtMaterialOperatingUnitId"
placeholder="请选择"
@change="changeGetDepartmentList"
>
<el-option
:label="item.enterpriseName"
:value="item.id"
v-for="(item, index) in enterpriseListData"
:key="index"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="部门/班组" prop="department">
<el-select
v-model="addForm.gtMaterialDepartmentTeamId"
placeholder="请选择"
>
<el-option
:label="item.departmentTeamName"
:value="item.gtMaterialDepartmentTeamId"
v-for="(item, index) in teamListData"
:key="index"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input
style="width: 1055px"
type="textarea"
:rows="1"
v-model="addForm.remark"
placeholder="请输入"
></el-input>
</el-form-item>
<div
style="
position: absolute;
font-size: 15px;
top: 33.8%;
color: red;
left: 3%;
"
>
*
</div>
<el-form-item label="出库审批单" prop="outboundApprovalForm">
<el-upload
class="upload-demo"
name="files"
:action="$store.state.UPLOADURL"
:on-remove="(file, fileList) => handleRemove(file, fileList)"
:multiple="false"
:on-success="(res, file) => handleSuccess(res, file)"
:file-list="surveySchemeList"
accept=".doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf"
>
<el-button size="mini" type="primary" plain> 上传附件 </el-button>
</el-upload>
</el-form-item>
</el-form>
<div class="importMaterialBox">
<el-button
style="margin-bottom: 15px; margin-left: 1050px"
type="primary"
size="medium"
@click="importMaterial"
>
增加明细
</el-button>
<el-table
class="tables"
:data="materialData"
height="360"
style="min-height: auto"
>
<el-table-column
prop="name"
label="品名"
align="center"
class="styleSel"
>
<template slot-scope="scope">
<el-select
style="width: 122px"
size="mini"
v-model="scope.row.name"
placeholder="请选择品名"
@focus="inputGetLIst(1)"
>
<el-option
v-for="(item, index) in allProjectData"
:key="index"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column
prop="specification"
label="规格"
align="center"
class="styleSel"
>
<template slot-scope="scope">
<el-select
style="width: 122px"
size="mini"
v-model="scope.row.specification"
placeholder="请选择规格"
@focus="inputGetLIst(2)"
>
<el-option
v-for="(item, index) in allProjectData"
:key="index"
:label="item.specification"
:value="item.specification"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column
prop="unit"
label="单位"
align="center"
class="styleSel"
>
<template slot-scope="scope">
<el-select
style="width: 122px"
size="mini"
v-model="scope.row.unit"
placeholder="请选择单位"
@focus="inputGetLIst(3)"
>
<el-option
v-for="(item, index) in allProjectData"
:key="index"
:label="item.unit"
:value="item.unit"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="quantity" label="数量" align="center">
<template slot-scope="scope">
<el-input
style="width: 122px"
type="number"
size="mini"
placeholder="请输入数字类型"
v-model="scope.row.quantity"
></el-input>
</template>
</el-table-column>
<el-table-column
prop="unitPrice"
label="单价"
align="center"
class="styleSel"
>
<template slot-scope="scope">
<el-select
@change="checkValue(1)"
style="width: 122px"
size="mini"
v-model="scope.row.unitPrice"
placeholder="请选择单价"
@focus="inputGetLIst(4)"
>
<el-option
v-for="(item, index) in allProjectData"
:key="index"
:label="item.unitPrice"
:value="item.unitPrice"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="amount" label="金额" align="center">
<template slot-scope="scope">
<el-input
@change="checkValue(2)"
placeholder="请输入数字类型"
type="number"
style="width: 122px"
size="mini"
v-model="scope.row.amount"
></el-input>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center">
<template slot-scope="scope">
<el-input
style="width: 122px"
size="mini"
v-model="scope.row.remark"
></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<div class="tableBtns" style="margin-left: 35px !important">
<div
@click="deleteTable(scope.row, scope.index)"
class="operationText"
>
<img
src="@/assets/images/icon-delete.png"
width="15px"
height="15px"
/>
<span>删除</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="dialog-footer" style="text-align: center">
<el-button
class="cancleBtn"
@click="dialogShow = false"
icon="el-icon-circle-close"
size="medium"
>取消
</el-button>
<el-button
type="primary"
icon="el-icon-circle-check"
@click="saveContractInfoFn"
size="medium"
>
保存
</el-button>
</div>
</div>
</el-dialog>
<!--详情弹框-->
<el-dialog
:modal-append-to-body="false"
title="详情"
:visible.sync="isShow"
width="1215px"
>
<div class="dialog_content">
<el-form
style="margin: 0 28px"
size="medium"
:model="addForm"
ref="addForm"
:inline="true"
>
<el-form-item label="日期" prop="createTime">
<el-date-picker
v-model="detailData.date"
disabled
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-form-item label="仓库" prop="warehouse">
<el-input
disabled
v-model="detailData.warehouse"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="类型" prop="category" style="margin-left: 12px">
<el-input
disabled
v-model="detailData.category"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="方向" prop="direction" style="margin-left: 28px">
<el-input
disabled
v-model="detailData.direction"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item
label="编号"
prop="serialNumber"
style="margin-left: 35px"
>
<el-input
disabled
v-model="detailData.serialNumber"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="单号" prop="number">
<el-input
disabled
v-model="detailData.number"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="批号" prop="lotNumber">
<el-input
disabled
v-model="detailData.lotNumber"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="经手人" prop="handler">
<el-input
disabled
v-model="detailData.handler"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="作业单位" prop="category">
<el-input
disabled
v-model="detailData.unitName"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="部门/班组" prop="department">
<el-input
disabled
v-model="detailData.departmentTeamName"
placeholder="请输入"
></el-input>
</el-form-item>
<!-- <el-form-item label="制单人" prop="singleHanded">
<el-input
disabled
v-model="detailData.singleHanded"
placeholder="请输入"
></el-input>
</el-form-item> -->
<!-- <el-form-item label="客户" prop="customer">
<el-input
disabled
v-model="detailData.customer"
placeholder="请输入"
></el-input>
</el-form-item> -->
<el-form-item label="备注" prop="remarks">
<el-input
disabled
style="width: 1075px"
type="textarea"
:rows="1"
v-model="detailData.remark"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="出库审批单">
<!-- 下载附件 -->
<el-button
@click.stop="download(detailData.outboundApprovalForm)"
type="primary"
plain
size="small"
>下载附件</el-button
>
</el-form-item>
</el-form>
<div class="importMaterialBox">
<el-table
class="tables"
:data="materialData"
height="360"
style="min-height: auto"
>
<el-table-column prop="name" label="品名" align="center">
<template slot-scope="scope">
<el-input
disabled
style="width: 122px"
size="mini"
v-model="scope.row.name"
></el-input>
</template>
</el-table-column>
<el-table-column prop="specification" label="规格" align="center">
<template slot-scope="scope">
<el-input
disabled
style="width: 122px"
size="mini"
v-model="scope.row.specification"
></el-input>
</template>
</el-table-column>
<el-table-column prop="unit" label="单位" align="center">
<template slot-scope="scope">
<el-input
disabled
style="width: 122px"
size="mini"
v-model="scope.row.unit"
></el-input>
</template>
</el-table-column>
<el-table-column prop="quantity" label="数量" align="center">
<template slot-scope="scope">
<el-input
disabled
style="width: 122px"
size="mini"
v-model="scope.row.quantity"
></el-input>
</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价" align="center">
<template slot-scope="scope">
<el-input
disabled
style="width: 122px"
size="mini"
v-model="scope.row.unitPrice"
></el-input>
</template>
</el-table-column>
<el-table-column prop="amount" label="金额" align="center">
<template slot-scope="scope">
<el-input
disabled
style="width: 122px"
size="mini"
v-model="scope.row.amount"
></el-input>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center">
<template slot-scope="scope">
<el-input
disabled
style="width: 122px"
size="mini"
v-model="scope.row.remark"
></el-input>
</template>
</el-table-column>
</el-table>
</div>
<div class="dialog-footer" style="text-align: center">
<el-button
type="primary"
icon="el-icon-circle-check"
size="medium"
@click="isShow = false"
>
确认
</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getEnterpriseInfoList,
} from "@/assets/js/api/laborPerson";
import {
addGtMaterialInOutWarehouseApi,
deletGtMaterialInOutWarehouseApi,
editGtMaterialInOutWarehouseApi,
gettGMaterialInOutWarehousePageApi,//查询表单数据
gettGMaterialInOutWarehouseListApi,//根据id查询物料
getGtMaterialWarehouseDetailPageApi,//查询库存物料
getGtMaterialOperatingUnitPageApi,//查询作业单位
getGtMaterialDepartmentTeamPageApi,//查询部门/班组
getQueryDepartmentListApi,//查询班组最新
} from '@/assets/js/api/materialManagement.js'
export default {
mounted() {
this.getList()
},
data() {
return {
teamListData: [],
enterpriseListData: [],
timeValue: [],
isShow: false,
deliteShow: false,
detailData: {},
searchForm: {
number: "",
// stuffNumber:"",//货号
warehouse: "",
department: "",
category: "",
handler: "",
// lookupCode: "",//助查码
customer: "",
startTime: '',//开始时间
endTime: '',//结束时间
},//查询
addForm: {
date: "",
warehouse: "",
category: "",
direction: "",
serialNumber: "",
number: "",
lotNumber: "",
department: "",
handler: "",
singleHanded: "",
customer: "",
remark: "",
materialList: [],
gtMaterialInOutWarehouseId: '',
type: "",
outboundApprovalForm: '',//出库审批单
gtMaterialDepartmentTeamId: '',
enterpriseId: '',
gtMaterialDepartmentTeamType: '',
gtMaterialOperatingUnitId: '',
},//表单
materialData: [
{
name: "",
specification: "",
unit: "",
quantity: "",
unitPrice: "",
amount: "",
remark: "",
}
],
deliteMaterialList: [],//详情
addFormules: {
serialNumber:
[
{ required: true, message: '必填', trigger: 'change' }
],
number:
[
{ required: true, message: '必填', trigger: 'change' }
],
},
title: "",
dialogShow: false,
pagInfo: {
pageNo: 1, //页数
pageSize: 10, //条数
total: 0 //总条数
},
List: [],
gtMaterialInOutWarehouseId: '',//编辑查询
surveySchemeList: [],
showProject1: false,
showProject2: false,
showProject3: false,
showProject4: false,
valType: '',
allProjectData: [],
searchName: '',
searchSpecification: '',
searchUnit: '',
searchUnitPricr: '',
options1: [],
options2: [],
}
},
methods: {
checkValue(type) {
if (type == 1) {
this.materialData.forEach((item) => {
if (item.unitPrice != "") {
var value = '' + item.unitPrice.toString();
value = value
.replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符
.replace(/\.{2,}/g, '.') // 只保留第一个. 清除多余的
.replace(/^\./g, '') //保证第一个为数字而不是.
.replace('.', '$#$')
.replace(/\./g, '')
.replace('$#$', '.')
.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); // 只能输入两个小数
if (value.indexOf('.') < 0 && value != '') {
// 以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
value = parseFloat(value);
}
value = Number(value).toFixed(2); //不足补位
item.unitPrice = value;
}
})
} else {
this.materialData.forEach((item) => {
if (item.amount != "") {
var value = '' + item.amount.toString();
value = value
.replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符
.replace(/\.{2,}/g, '.') // 只保留第一个. 清除多余的
.replace(/^\./g, '') //保证第一个为数字而不是.
.replace('.', '$#$')
.replace(/\./g, '')
.replace('$#$', '.')
.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); // 只能输入两个小数
if (value.indexOf('.') < 0 && value != '') {
// 以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
value = parseFloat(value);
}
value = Number(value).toFixed(2); //不足补位
item.amount = value;
}
})
}
},
//获取作业单位
getProjectList() {
let data = {
projectSn: this.$store.state.projectSn,
};
getEnterpriseInfoList(data).then((res) => {
console.log('res--------', res);
this.enterpriseListData = res.result;
console.log('this.enterpriseListData========', this.enterpriseListData);
this.enterpriseListData.forEach(item => {
console.log("this.detailData.gtMaterialOperatingUnitId ::: " + this.detailData.gtMaterialOperatingUnitId + " :::: item.id :::" + item.id);
if (this.detailData.gtMaterialOperatingUnitId == item.id) {
this.detailData.unitName = item.enterpriseName;
}
})
});
},
//获取所有物料
inputGetLIst(type) {
console.log('type----', type);
if (type == 1) {
this.valType = 'name'
} else if (type == 2) {
this.valType = 'specification'
} else if (type == 3) {
this.valType = 'unit'
} else {
this.valType = 'unitPrice'
}
let data = {
projectSn: this.$store.state.projectSn,
groupBy: this.valType,
name: this.searchName,
specification: this.searchSpecification,
unit: this.searchUnit,
unitPrice: this.searchUnitPricr,
pageNo: 1,
pageSize: -1,
};
getGtMaterialWarehouseDetailPageApi(data).then((res) => {
if (res.code == 200) {
this.allProjectData = res.result.records;
}
});
},
changeGetDepartmentList() {
console.log("changeGetDepartmentList");
this.addForm.gtMaterialDepartmentTeamId = ''
this.getDepartmentList(this.addForm.gtMaterialOperatingUnitId)
},
//获取班组数据
getDepartmentList(gtMaterialOperatingUnitId) {
getQueryDepartmentListApi({
projectSn: this.$store.state.projectSn,
enterpriseId: gtMaterialOperatingUnitId,
gtMaterialDepartmentTeamType: this.addForm.gtMaterialDepartmentTeamType
}).then((result) => {
if (result.success) {
console.log('获取班组数据', this.detailData.gtMaterialDepartmentTeamId);
console.log('获取班组数据', result.result);
this.teamListData = result.result;
this.teamListData.forEach(item => {
if (this.detailData.gtMaterialDepartmentTeamId == item.gtMaterialDepartmentTeamId) {
this.detailData.departmentTeamName = item.departmentTeamName;
}
})
}
})
},
//下载附件
download(item) {
console.log('下载的item', item);
if (item == '[]') {
this.$message.error('未查询到附件')
} else {
let arr = []
arr = JSON.parse(item)
arr.forEach(element => {
let url = this.$http.defaults.baseURL + 'xmgl/upload/getRenameFile?fileUrl=' + element.url + '&fileName=' + element.name
window.location.href = url;
});
}
},
// 删除文件
handleRemove(file, fileList) {
this.surveySchemeList = fileList
},
handleSuccess(res, file) {
if (res.status == 'SUCCESS') {
this.surveySchemeList.push({
name: file.name,
url: this.$store.state.FILEURL + file.response.data[0].imageUrl
})
}
},
//选择时间时
getTime() {
if (this.timeValue) {
this.searchForm.startTime = this.timeValue[0]
this.searchForm.endTime = this.timeValue[1]
} else {
this.searchForm.startTime = ''
this.searchForm.endTime = ''
}
},
//查询仓库数据
getList() {
gettGMaterialInOutWarehousePageApi({
pageNo: this.pagInfo.pageNo,
pageSize: this.pagInfo.pageSize,
projectSn: this.$store.state.projectSn,
number: this.searchForm.number,
warehouse: this.searchForm.warehouse,
department: this.searchForm.department,
category: this.searchForm.category,
handler: this.searchForm.handler,
customer: this.searchForm.customer,
endTime: this.searchForm.endTime,
startTime: this.searchForm.startTime,
type: 20,
}).then((result) => {
if (result.success) {
this.List = result.result.records
this.pagInfo.total = result.result.total
}
})
},
//查询物料信息
getMaterialData() {
gettGMaterialInOutWarehouseListApi({
projectSn: this.$store.state.projectSn,
gtMaterialInOutWarehouseId: this.gtMaterialInOutWarehouseId
}).then((result) => {
this.materialData = result.result
})
},
//显示检查详细弹框
showDetailFn(row) {
console.log('row------', row);
this.detailData = JSON.parse(JSON.stringify(row))
this.isShow = true
this.gtMaterialInOutWarehouseId = this.detailData.id
this.getMaterialData()
this.getProjectList()
this.getDepartmentList(this.detailData.gtMaterialOperatingUnitId)
this.addForm.enterpriseId = this.addForm.id
},
//表格动态添加
importMaterial() {
let statusType = true;
this.materialData.forEach((item) => {
if (item.name == "") {
this.$message({
message: "品名不能为空",
type: "warning",
});
statusType = false;
}
else if (item.quantity == "") {
this.$message({
message: "数量不能为空",
type: "warning",
});
statusType = false;
}
else if (item.unitPrice == "") {
this.$message({
message: "单价不能为空",
type: "warning",
});
statusType = false;
}
})
if (statusType) {
this.materialData.push({
name: "",
specification: "",
unit: "",
quantity: "",
unitPrice: "",
amount: "",
remark: "",
});
}
},
//删除表格动态操作
deleteTable(item) {
let index = this.materialData.indexOf(item)
if (index !== -1) {
this.materialData.splice(index, 1)
}
},
add() {
this.title = '新增出库'
this.dialogShow = true
this.materialData = []
this.surveySchemeList = []
this.addForm = {
date: "",
warehouse: "",
category: "",
direction: "",
serialNumber: "",
number: "",
lotNumber: "",
department: "",
handler: "",
singleHanded: "",
customer: "",
remark: "",
materialList: [],
gtMaterialInOutWarehouseId: '',
type: "",
outboundApprovalForm: '',//出库审批单
gtMaterialDepartmentTeamId: '',
enterpriseId: '',
gtMaterialDepartmentTeamType: '',
gtMaterialOperatingUnitId: '',
}
this.$nextTick(() => {
this.$refs.addForm.clearValidate()
})
this.getProjectList()
// this.getDepartmentList()
},
edit(obj) {
this.title = '编辑出库'
this.dialogShow = true
this.addForm = JSON.parse(JSON.stringify(obj))
this.gtMaterialInOutWarehouseId = obj.id
this.surveySchemeList = obj.outboundApprovalForm == '' ? obj.outboundApprovalForm : []
if (typeof obj.outboundApprovalForm === 'string') {
this.addForm.outboundApprovalForm = JSON.parse(obj.outboundApprovalForm)
this.surveySchemeList = this.addForm.outboundApprovalForm
}
console.log("编辑出库 this.addForm ", this.addForm);
console.log("编辑出库 enterpriseListData ", this.enterpriseListData);
this.addForm.enterpriseId = this.addForm.id
this.getMaterialData()
this.getProjectList()
this.getDepartmentList(this.addForm.gtMaterialOperatingUnitId)
},
saveContractInfoFn() {
let isInvalid = false;
this.materialData.forEach((item) => {
if (item.name == "") {
isInvalid = true;
}
else if (item.quantity == "") {
isInvalid = true;
}
else if (item.unitPrice == "") {
isInvalid = true;
}
})
if (isInvalid == true) {
this.$message({
message: "请将表格明细填写完整",
type: "warning",
});
} else {
let params = JSON.parse(JSON.stringify(this.addForm))
params.materialList = this.materialData
params.projectSn = this.$store.state.projectSn
params.type = 20
params.outboundApprovalForm = JSON.stringify(this.surveySchemeList)
if (this.surveySchemeList.length == 0) {
this.$message.error("请上传附件")
return false;
}
this.$refs.addForm.validate((valid) => {
if (valid) {
if (this.title == '新增出库') {
addGtMaterialInOutWarehouseApi(params).then((result) => {
if (result.success) {
this.$message.success(result.message)
this.getList()
}
})
} else if (this.title === '编辑出库') {
editGtMaterialInOutWarehouseApi(params).then((result) => {
if (result.success) {
this.$message.success(result.message)
this.getList()
}
})
}
this.dialogShow = false
} else {
return false
}
})
}
},
deleteDev(obj) {
this.$confirm("此操作将永久删除, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deletGtMaterialInOutWarehouseApi({ id: obj.id }).then((res) => {
if (res.success) {
this.getList()
this.$message({
type: "success",
message: "删除成功!",
});
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
SizeChange(val) {
this.pagInfo.pageSize = val
this.getList()
},
CurrentChange(val) {
this.pagInfo.pageNo = val
this.getList()
},
refresh() {
this.timeValue = []
this.searchForm = {}
this.pagInfo.pageNo = 1 //页数
this.pagInfo.pageSize = 10 //条数
this.getList()
},
}
}
</script>
<style lang="less" scoped>
.tables2 {
min-height: auto;
}
.dialog_content {
padding: 25px 0 !important;
}
::v-deep .el-select {
width: 160px;
}
::v-deep .el-date-editor {
width: 260px;
}
::v-deep .el-input {
width: 160px;
}
::v-deep .el-dialog__body {
padding: 30px 15px !important;
}
::v-deep .el-upload-list--text {
position: absolute !important;
}
::v-deep .tables.el-table td {
padding: 0 !important;
}
::v-deep .el-input--suffix {
width: 135px;
}
</style>