|
@@ -0,0 +1,648 @@
|
|
|
|
+<template>
|
|
|
|
+ <div>
|
|
|
|
+ <el-dialog
|
|
|
|
+ :title="title"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ v-dialogDrag
|
|
|
|
+ width="1200px"
|
|
|
|
+ @close="close"
|
|
|
|
+ @keyup.enter.native="doSubmit"
|
|
|
|
+ :visible.sync="visible">
|
|
|
|
+ <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="method==='view'"
|
|
|
|
+ label-width="100px" @submit.native.prevent>
|
|
|
|
+
|
|
|
|
+ <el-divider content-position="left"><i class="el-icon-document"></i> 基础信息</el-divider>
|
|
|
|
+ <el-row :gutter="26">
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="入库编号" prop="wareHouseNumber">
|
|
|
|
+ <el-input placeholder="自动生成" v-model="inputForm.wareHouseNumber" :disabled="true"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="入库名称" prop="wareHouseName"
|
|
|
|
+ :rules="[{required: true, message: '入库名称不能为空', trigger: 'blur'}
|
|
|
|
+ ]">
|
|
|
|
+ <el-input v-model="inputForm.wareHouseName" placeholder="请填写入库名称"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="经办人" prop="handledBy">
|
|
|
|
+ <el-input v-model="inputForm.handledBy" :disabled="true"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="经办人部门" prop="handledByOffice">
|
|
|
|
+ <SelectTree
|
|
|
|
+ :disabled="true"
|
|
|
|
+ ref="officeTree"
|
|
|
|
+ :props="{
|
|
|
|
+ value: 'id', // ID字段名
|
|
|
|
+ label: 'name', // 显示名称
|
|
|
|
+ children: 'children' // 子级字段名
|
|
|
|
+ }"
|
|
|
|
+
|
|
|
|
+ :url="`/sys/office/treeData?type=2`"
|
|
|
|
+ :value="inputForm.handledByOffice"
|
|
|
|
+ :accordion="true"
|
|
|
|
+ size="medium"
|
|
|
|
+ @getValue="(value) => {inputForm.handledByOffice=value}"/>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="入库时间" prop="wareHouseDare" :rules="[{required: true, message:'请选择入库时间', trigger:'blur'}]">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="inputForm.wareHouseDare"
|
|
|
|
+ type="date"
|
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ placeholder="选择日期">
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="采购编号" prop="purchaseNo"
|
|
|
|
+ :rules="[{required: true, message:'采购编号不能为空', trigger:'blur'},
|
|
|
|
+ {required: true, message:'采购编号不能为空', trigger:'change'}]">
|
|
|
|
+ <el-input size="medium" :readonly="true" @focus="openContractForm()" v-model="inputForm.purchaseNo" placeholder="请选择采购编号">
|
|
|
|
+ <el-button slot="append" icon="el-icon-search" @click="openContractForm()"></el-button>
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="备注" prop="remarks">
|
|
|
|
+ <el-input v-model="inputForm.remarks"
|
|
|
|
+ type="textarea"
|
|
|
|
+ :rows="5"
|
|
|
|
+ maxlength="500"
|
|
|
|
+ placeholder="请输入简介"
|
|
|
|
+ show-word-limit>
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+
|
|
|
|
+ <el-divider content-position="left"><i class="el-icon-document"></i>
|
|
|
|
+ 采购详情
|
|
|
|
+<!-- <el-button style="margin-left: 20px" type="primary" @click="insertEvent('detail')" plain>-->
|
|
|
|
+<!-- 新增-->
|
|
|
|
+<!-- </el-button>-->
|
|
|
|
+ </el-divider>
|
|
|
|
+ <el-row :gutter="15" >
|
|
|
|
+ <vxe-table
|
|
|
|
+ border
|
|
|
|
+ show-footer
|
|
|
|
+ show-overflow
|
|
|
|
+ :footer-method="footerMethod"
|
|
|
|
+ ref="detailTable"
|
|
|
|
+ class="vxe-table-element"
|
|
|
|
+ :data="inputForm.detailInfos"
|
|
|
|
+ style="margin-left: 5em"
|
|
|
|
+ @cell-click=""
|
|
|
|
+ @edit-closed=""
|
|
|
|
+ highlight-current-row
|
|
|
|
+ :edit-config="{trigger: 'click', mode: 'row', showStatus: false, autoClear: true, icon: '-'}"
|
|
|
|
+ >
|
|
|
|
+ <vxe-table-column field="purchaser" title="采购人" :edit-render="{}" :rules="[{required: true, message:'请选择采购人', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.purchaser"></el-input>
|
|
|
|
+<!-- <el-input v-model="scope.row.purchaser" @focus="userPullListForm(scope.$rowIndex)"></el-input>-->
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="procurementOffice" title="采购部门" :edit-render="{}">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input :disabled='true' v-model="scope.row.procurementOffice" ></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="procurementType" title="采购类型" :edit-render="{}" :rules="[{required: true, message:'请选择采购类型', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.procurementType"></el-input>
|
|
|
|
+<!-- <el-input v-model="scope.row.procurementType" @focus="typePullForm(scope.$rowIndex)"></el-input>-->
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="tradeName" title="商品名称" :edit-render="{}" :rules="[{required: true, message:'请填写商品名称', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.tradeName"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="tradePrice" title="商品单价(元)" :edit-render="{}" :rules="[{required: true, message:'请输入商品单价', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <!-- <el-input @change="changeValue" maxlength="15" v-model="scope.row.tradePrice" @keyup.native="scope.row.tradePrice = twoDecimalPlaces(scope.row.tradePrice)"></el-input>-->
|
|
|
|
+ <el-input @change="changeValue" maxlength="15" v-model="scope.row.tradePrice"></el-input>
|
|
|
|
+<!-- <el-input @change="changeValue" maxlength="15" v-model="scope.row.tradePrice" @blur="scope.row.tradePrice = twoDecimalPlaces(scope.row.tradePrice)"></el-input>-->
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="tradeNumber" title="商品数量" :edit-render="{}">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <!-- <el-input @change="changeValue" v-model="scope.row.tradeNumber" oninput ="value=value.replace(/\D|^0/g,'')" maxlength="10"></el-input>-->
|
|
|
|
+ <el-input @change="changeValue" v-model="scope.row.tradeNumber" maxlength="10"></el-input>
|
|
|
|
+<!-- <el-input @change="changeValue" v-model="scope.row.tradeNumber" @blur="scope.row.tradeNumber = twoDecimalPlaces2(scope.row.tradeNumber)" maxlength="10"></el-input>-->
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="priceSum" title="商品总价" :edit-render="{}">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.priceSum" maxlength="15"></el-input>
|
|
|
|
+<!-- <el-input v-model="scope.row.priceSum" @blur="scope.row.priceSum = twoDecimalPlaces(scope.row.priceSum)" maxlength="15"></el-input>-->
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="company" title="单位" :edit-render="{}" :rules="[{required: true, message:'请填写单位', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.company"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="remarks" title="备注" :edit-render="{}">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.remarks" ></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column title="操作">
|
|
|
|
+ <template v-slot="scope">
|
|
|
|
+ <el-button size="mini" type="primary" :disabled="false" @click="seeFileInfo(scope.$rowIndex)">查看文件详情</el-button>
|
|
|
|
+ <!-- <el-button size="mini" v-if="formReadOnly" :disabled="false" type="primary" @click="seeFileInfo(scope.$rowIndex)">查看文件详情</el-button>-->
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ </vxe-table>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-divider content-position="left"><i class="el-icon-document"></i>
|
|
|
|
+ 入库详情
|
|
|
|
+ <el-button style="margin-left: 20px" type="primary" @click="insertEvent('detail')" plain>
|
|
|
|
+ 新增
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-divider>
|
|
|
|
+ <el-row :gutter="15" >
|
|
|
|
+ <vxe-table
|
|
|
|
+ border
|
|
|
|
+ show-footer
|
|
|
|
+ show-overflow
|
|
|
|
+ :footer-method="footerMethod2"
|
|
|
|
+ ref="detailTable"
|
|
|
|
+ class="vxe-table-element"
|
|
|
|
+ :data="inputForm.wareHouse"
|
|
|
|
+ style="margin-left: 5em"
|
|
|
|
+ @cell-click=""
|
|
|
|
+ @edit-closed=""
|
|
|
|
+ highlight-current-row
|
|
|
|
+ :edit-config="{trigger: 'click', mode: 'row', showStatus: false, autoClear: true, icon: '-'}"
|
|
|
|
+ >
|
|
|
|
+ <vxe-table-column field="wareHouseMan" title="入库人" :edit-render="{}" :rules="[{required: true, message:'请选择采购人', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.wareHouseMan" @focus="userPullListForm(scope.$rowIndex)"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="wareHouseManOffice" title="入库部门" :edit-render="{}">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input :disabled='true' v-model="scope.row.wareHouseManOffice" ></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="wareHouseType" title="入库类型" :edit-render="{}" :rules="[{required: true, message:'请选择采购类型', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.wareHouseType" @focus="typePullForm(scope.$rowIndex)"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="tradeName" title="商品名称" :edit-render="{}" :rules="[{required: true, message:'请填写商品名称', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.tradeName"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="tradePrice" title="商品单价(元)" :edit-render="{}" :rules="[{required: true, message:'请输入商品单价', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input @change="changeValue2" maxlength="15" v-model="scope.row.tradePrice" @blur="scope.row.tradePrice = twoDecimalPlaces2(scope.row.tradePrice)"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="tradeNumber" title="商品数量" :edit-render="{}">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input @change="changeValue2" v-model="scope.row.tradeNumber" @blur="scope.row.tradeNumber = twoDecimalPlaces2(scope.row.tradeNumber)" maxlength="10"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="priceSum" title="商品总价" :edit-render="{}">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.priceSum" @blur="scope.row.priceSum = twoDecimalPlaces(scope.row.priceSum)" maxlength="15"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="company" title="单位" :edit-render="{}" :rules="[{required: true, message:'请填写单位', trigger:'blur'}]">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.company"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column field="remarks" title="备注" :edit-render="{}">
|
|
|
|
+ <template v-slot:edit="scope">
|
|
|
|
+ <el-input v-model="scope.row.remarks" ></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ <vxe-table-column title="操作" width="300">
|
|
|
|
+ <template v-slot="scope">
|
|
|
|
+ <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'detail')">删除</el-button>
|
|
|
|
+ <el-button size="mini" type="primary" @click="sss(scope.$rowIndex)">上传附件</el-button>
|
|
|
|
+ <el-button size="mini" type="primary" v-if="method==='view'" :disabled="false" @click="seeFileInfo(scope.$rowIndex)">查看文件详情</el-button>
|
|
|
|
+ <!-- <el-button size="mini" v-if="formReadOnly" :disabled="false" type="primary" @click="seeFileInfo(scope.$rowIndex)">查看文件详情</el-button>-->
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ </vxe-table>
|
|
|
|
+ </el-row>
|
|
|
|
+
|
|
|
|
+ </el-form>
|
|
|
|
+ <!-- 附件 -->
|
|
|
|
+ <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
|
|
|
|
+ <MaterialManagementDialog ref="materialManagementDialog" @getUpload="getUpload"></MaterialManagementDialog>
|
|
|
|
+ <CwProgramPageForm ref="cwProgramPageForm" @getProgram="getProgram"></CwProgramPageForm>
|
|
|
|
+ <MaterialTypePullForm ref="materialTypePullForm" @getProgramForType="getProgramForType"></MaterialTypePullForm>
|
|
|
|
+ <UserPullForm ref="userPullForm" @getProgramForUser="getProgramForUser"></UserPullForm>
|
|
|
|
+ <PurchaseChooseForm ref="purchaseChooseForm" @getProject="getContract"></PurchaseChooseForm>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
|
|
|
|
+ <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ import SelectTree from '@/components/treeSelect/treeSelect.vue'
|
|
|
|
+ import MaterialManagementDialog from '../file/MaterialManagementDialog'
|
|
|
|
+ import CwProgramPageForm from '@/views/modules/cw/reimbursementApproval/info/CwProgramPageForm'
|
|
|
|
+ import MaterialTypePullForm from '../info/MaterialTypePullForm'
|
|
|
|
+ import MaterialManagementService from '@/api/materialManagement/MaterialManagementService'
|
|
|
|
+ import UpLoadComponent from '@/views/common/UpLoadComponent'
|
|
|
|
+ import UserPullForm from '@/views/modules/finance/invoice/UserPullForm'
|
|
|
|
+ import PurchaseChooseForm from './PurchaseChooseForm'
|
|
|
|
+ import XEUtils from 'xe-utils'
|
|
|
|
+ export default {
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ title: '',
|
|
|
|
+ method: '',
|
|
|
|
+ visible: false,
|
|
|
|
+ loading: false,
|
|
|
|
+ inputForm: {
|
|
|
|
+ wareHouseTotalPrice: '', // 入库商品总价
|
|
|
|
+ tradeTotalPrice: '', // 商品总价
|
|
|
|
+ fileInfoLost: [],
|
|
|
|
+ purchaseNo: '',
|
|
|
|
+ handledBy: '',
|
|
|
|
+ handledByOffice: '',
|
|
|
|
+ wareHouseName: '',
|
|
|
|
+ wareHouseNumber: '', // 入库编号
|
|
|
|
+ userId: '',
|
|
|
|
+ wareHouseDare: '',
|
|
|
|
+ remarks: '',
|
|
|
|
+ detailInfos: [],
|
|
|
|
+ wareHouse: [],
|
|
|
|
+ // amountInfos: [],
|
|
|
|
+ files: [] // 附件信息
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ MaterialManagementService: null,
|
|
|
|
+ created () {
|
|
|
|
+ this.materialManagementService = new MaterialManagementService()
|
|
|
|
+ },
|
|
|
|
+ components: {
|
|
|
|
+ SelectTree,
|
|
|
|
+ MaterialTypePullForm,
|
|
|
|
+ CwProgramPageForm,
|
|
|
|
+ MaterialManagementDialog,
|
|
|
|
+ UpLoadComponent,
|
|
|
|
+ UserPullForm,
|
|
|
|
+ PurchaseChooseForm
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ name () {
|
|
|
|
+ return JSON.parse(localStorage.getItem('user')).name
|
|
|
|
+ },
|
|
|
|
+ officeName () {
|
|
|
|
+ return JSON.parse(localStorage.getItem('user')).officeDTO.name
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ init (method, id) {
|
|
|
|
+ this.method = method
|
|
|
|
+ this.inputForm = {
|
|
|
|
+ wareHouseTotalPrice: '', // 入库商品总价
|
|
|
|
+ tradeTotalPrice: '', // 商品总价
|
|
|
|
+ fileInfoLost: [],
|
|
|
|
+ purchaseNo: '',
|
|
|
|
+ handledBy: JSON.parse(localStorage.getItem('user')).name,
|
|
|
|
+ handledByOffice: '',
|
|
|
|
+ wareHouseName: '',
|
|
|
|
+ wareHouseNumber: '', // 入库编号
|
|
|
|
+ userId: JSON.parse(localStorage.getItem('user')).id,
|
|
|
|
+ wareHouseDare: new Date(),
|
|
|
|
+ remarks: '',
|
|
|
|
+ detailInfos: [],
|
|
|
|
+ wareHouse: [],
|
|
|
|
+ // amountInfos: [],
|
|
|
|
+ files: [] // 附件信息
|
|
|
|
+ }
|
|
|
|
+ if (method === 'add') {
|
|
|
|
+ this.title = `新建采购类型`
|
|
|
|
+ } else if (method === 'edit') {
|
|
|
|
+ this.inputForm.id = id
|
|
|
|
+ this.title = '修改采购类型'
|
|
|
|
+ } else if (method === 'view') {
|
|
|
|
+ this.inputForm.id = id
|
|
|
|
+ this.title = '查看采购类型'
|
|
|
|
+ } else if (method === 'addChild') {
|
|
|
|
+ this.title = '添加下级结构'
|
|
|
|
+ this.inputForm.parentId = id
|
|
|
|
+ }
|
|
|
|
+ this.visible = true
|
|
|
|
+ this.loading = false
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ if (method === 'edit' || method === 'view') { // 修改或者查看
|
|
|
|
+ this.loading = true
|
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
|
+ this.materialManagementService.findById(this.inputForm.id).then(({data}) => {
|
|
|
|
+ this.inputForm = this.recover(this.inputForm, data)
|
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
|
|
|
|
+ this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
|
|
|
|
+ }
|
|
|
|
+ let i = this.inputForm.detailInfos.length
|
|
|
|
+ for (let j = 0; j < i; j++) {
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradePrice)) {
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradeNumber)) {
|
|
|
|
+ this.inputForm.detailInfos[j].priceSum = this.inputForm.detailInfos[j].tradePrice * this.inputForm.detailInfos[j].tradeNumber
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'reimbursement')
|
|
|
|
+ this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ getContract (row) {
|
|
|
|
+ this.materialManagementService.findById(row.id).then(({data}) => {
|
|
|
|
+ this.inputForm.detailInfos = data.detailInfos
|
|
|
|
+ this.inputForm.purchaseNo = data.purchaseNo
|
|
|
|
+ let i = this.inputForm.detailInfos.length
|
|
|
|
+ for (let j = 0; j < i; j++) {
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradePrice)) {
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradeNumber)) {
|
|
|
|
+ this.inputForm.detailInfos[j].priceSum = this.inputForm.detailInfos[j].tradePrice * this.inputForm.detailInfos[j].tradeNumber
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
+ },
|
|
|
|
+ openContractForm () {
|
|
|
|
+ this.$refs.purchaseChooseForm.init()
|
|
|
|
+ },
|
|
|
|
+ // 值改变事件
|
|
|
|
+ changeValue () {
|
|
|
|
+ let i = this.inputForm.detailInfos.length
|
|
|
|
+ for (let j = 0; j < i; j++) {
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradePrice)) {
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].tradeNumber)) {
|
|
|
|
+ // parseFloat(item.account).toFixed(2)
|
|
|
|
+ this.inputForm.detailInfos[j].priceSum = parseFloat(parseFloat(this.inputForm.detailInfos[j].tradePrice) * parseFloat(this.inputForm.detailInfos[j].tradeNumber)).toFixed(2)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 值改变事件
|
|
|
|
+ changeValue2 () {
|
|
|
|
+ let i = this.inputForm.wareHouse.length
|
|
|
|
+ for (let j = 0; j < i; j++) {
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.wareHouse[j].tradePrice)) {
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.wareHouse[j].tradeNumber)) {
|
|
|
|
+ // parseFloat(item.account).toFixed(2)
|
|
|
|
+ this.inputForm.wareHouse[j].priceSum = parseFloat(parseFloat(this.inputForm.wareHouse[j].tradePrice) * parseFloat(this.inputForm.wareHouse[j].tradeNumber)).toFixed(2)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ getProgramForUser (rows) {
|
|
|
|
+ // this.inputForm.detailInfos[this.indexRow].userId = rows[0].id
|
|
|
|
+ // this.inputForm.detailInfos[this.indexRow].purchaser = rows[0].name
|
|
|
|
+ // this.inputForm.detailInfos[this.indexRow].deptId = rows[0].parentId
|
|
|
|
+ // this.inputForm.detailInfos[this.indexRow].procurementOffice = rows[0].officeName
|
|
|
|
+ this.inputForm.wareHouse[this.indexRow].userId = rows[0].id
|
|
|
|
+ this.inputForm.wareHouse[this.indexRow].wareHouseMan = rows[0].name
|
|
|
|
+ this.inputForm.wareHouse[this.indexRow].deptId = rows[0].parentId
|
|
|
|
+ this.inputForm.wareHouse[this.indexRow].wareHouseManOffice = rows[0].officeName
|
|
|
|
+ this.indexRow = ''
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
+ },
|
|
|
|
+ getProgramForType (rows) {
|
|
|
|
+ this.inputForm.wareHouse[this.indexRow].typeId = rows.id
|
|
|
|
+ this.inputForm.wareHouse[this.indexRow].wareHouseType = rows.name
|
|
|
|
+ // this.inputForm.detailInfos[this.indexRow].procurementType = rows.name
|
|
|
|
+ this.indexRow = ''
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
+ },
|
|
|
|
+ getProgram (rows) {
|
|
|
|
+ this.inputForm.detailInfos[this.indexRow].projectId = rows[0].id
|
|
|
|
+ this.inputForm.detailInfos[this.indexRow].projectName = rows[0].name
|
|
|
|
+ this.inputForm.detailInfos[this.indexRow].reportNumber = rows[0].reportNo
|
|
|
|
+ this.indexRow = ''
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
+ },
|
|
|
|
+ getUpload (p, index) {
|
|
|
|
+ p.then((list) => {
|
|
|
|
+ // list为返回数据
|
|
|
|
+ this.inputForm.wareHouse[index].fileInfoLost = list
|
|
|
|
+ this.inputForm.wareHouse[index].fileNumber = list.length
|
|
|
|
+ this.tableKeyClient = Math.random()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ twoDecimalPlaces (num) {
|
|
|
|
+ let str = num.toString()
|
|
|
|
+ var len1 = str.substr(0, 1)
|
|
|
|
+ var len2 = str.substr(1, 1)
|
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
|
+ if (str.length > 1 && len1 == 0 && len2 != '.') {
|
|
|
|
+ str = str.substr(1, 1)
|
|
|
|
+ }
|
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
|
+ if (len1 == '.') {
|
|
|
|
+ str = ''
|
|
|
|
+ }
|
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
|
+ if (str.indexOf('.') != -1) {
|
|
|
|
+ var str_ = str.substr(str.indexOf('.') + 1)
|
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
|
+ if (str_.indexOf('.') != -1) {
|
|
|
|
+ str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
|
|
|
|
+ }
|
|
|
|
+ if (str_.length > 2) {
|
|
|
|
+ this.$message.warning(`金额小数点后只能输入两位,请正确输入!`)
|
|
|
|
+ return (str = '')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // eslint-disable-next-line no-useless-escape
|
|
|
|
+ str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
|
|
|
|
+ return str
|
|
|
|
+ },
|
|
|
|
+ twoDecimalPlaces2 (num) {
|
|
|
|
+ let str = num.toString()
|
|
|
|
+ var len1 = str.substr(0, 1)
|
|
|
|
+ var len2 = str.substr(1, 1)
|
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
|
+ if (str.length > 1 && len1 == 0 && len2 != '.') {
|
|
|
|
+ str = str.substr(1, 1)
|
|
|
|
+ }
|
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
|
+ if (len1 == '.') {
|
|
|
|
+ str = ''
|
|
|
|
+ }
|
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
|
+ if (str.indexOf('.') != -1) {
|
|
|
|
+ var str_ = str.substr(str.indexOf('.') + 1)
|
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
|
+ if (str_.indexOf('.') != -1) {
|
|
|
|
+ str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
|
|
|
|
+ }
|
|
|
|
+ if (str_.length > 2) {
|
|
|
|
+ this.$message.warning(`商品数量小数点后只能输入两位,请正确输入!`)
|
|
|
|
+ return (str = '')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // eslint-disable-next-line no-useless-escape
|
|
|
|
+ str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
|
|
|
|
+ return str
|
|
|
|
+ },
|
|
|
|
+ // 采购人下拉弹窗
|
|
|
|
+ userPullListForm (rowIndex) {
|
|
|
|
+ this.indexRow = rowIndex
|
|
|
|
+ this.$refs.userPullForm.init()
|
|
|
|
+ },
|
|
|
|
+ footerMethod ({ columns, data }) {
|
|
|
|
+ const footerData = [
|
|
|
|
+ columns.map((column, columnIndex) => {
|
|
|
|
+ if (columnIndex === 0) {
|
|
|
|
+ return '商品总价'
|
|
|
|
+ }
|
|
|
|
+ if (['priceSum'].includes(column.property)) {
|
|
|
|
+ // eslint-disable-next-line no-undef
|
|
|
|
+ this.inputForm.tradeTotalPrice = XEUtils.sum(data, column.property)
|
|
|
|
+ return XEUtils.sum(data, column.property)
|
|
|
|
+ }
|
|
|
|
+ return null
|
|
|
|
+ })
|
|
|
|
+ ]
|
|
|
|
+ return footerData
|
|
|
|
+ },
|
|
|
|
+ footerMethod2 ({ columns, data }) {
|
|
|
|
+ const footerData = [
|
|
|
|
+ columns.map((column, columnIndex) => {
|
|
|
|
+ if (columnIndex === 0) {
|
|
|
|
+ return '商品总价'
|
|
|
|
+ }
|
|
|
|
+ if (['priceSum'].includes(column.property)) {
|
|
|
|
+ // eslint-disable-next-line no-undef
|
|
|
|
+ this.inputForm.wareHouseTotalPrice = XEUtils.sum(data, column.property)
|
|
|
|
+ return XEUtils.sum(data, column.property)
|
|
|
|
+ }
|
|
|
|
+ return null
|
|
|
|
+ })
|
|
|
|
+ ]
|
|
|
|
+ return footerData
|
|
|
|
+ },
|
|
|
|
+ seeFileInfo (index) {
|
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.wareHouse[index].fileInfoLost)) {
|
|
|
|
+ this.inputForm.wareHouse[index].fileInfoLost = []
|
|
|
|
+ }
|
|
|
|
+ this.$refs.materialManagementDialog.newUpload('view', this.inputForm.wareHouse[index].fileInfoLost, null, null, null, null, null, false, index)
|
|
|
|
+ },
|
|
|
|
+ sss (index) {
|
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.wareHouse[index].fileInfoLost)) {
|
|
|
|
+ this.inputForm.wareHouse[index].fileInfoLost = []
|
|
|
|
+ }
|
|
|
|
+ this.$refs.materialManagementDialog.newUpload(null, this.inputForm.wareHouse[index].fileInfoLost, null, null, null, null, null, false, index)
|
|
|
|
+ },
|
|
|
|
+ // 采购类型下拉弹窗
|
|
|
|
+ typePullForm (rowIndex) {
|
|
|
|
+ this.indexRow = rowIndex
|
|
|
|
+ this.$refs.materialTypePullForm.init()
|
|
|
|
+ },
|
|
|
|
+ // 表单提交
|
|
|
|
+ doSubmit () {
|
|
|
|
+ this.$refs['inputForm'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.loading = true
|
|
|
|
+ if (this.$refs.uploadComponent.checkProgress()) {
|
|
|
|
+ this.loading = false
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.files)) {
|
|
|
|
+ this.loading = false
|
|
|
|
+ this.inputForm.files = []
|
|
|
|
+ }
|
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos)) {
|
|
|
|
+ this.$message.error('至少填写一条采购详情信息')
|
|
|
|
+ this.loading = false
|
|
|
|
+ return
|
|
|
|
+ } else {
|
|
|
|
+ let i = this.inputForm.detailInfos.length
|
|
|
|
+ for (let j = 0; j < i; j++) {
|
|
|
|
+ let k = j + 1
|
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].purchaser)) {
|
|
|
|
+ this.$message.error('采购详情第' + k + '行请选择采购人')
|
|
|
|
+ this.loading = false
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].procurementType)) {
|
|
|
|
+ this.$message.error('采购详情第' + k + '行请选择采购类型')
|
|
|
|
+ this.loading = false
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].tradePrice)) {
|
|
|
|
+ this.$message.error('采购详情第' + k + '行请输入商品单价')
|
|
|
|
+ this.loading = false
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
|
|
+ this.materialManagementService.save(this.inputForm).then(({data}) => {
|
|
|
|
+ // eslint-disable-next-line no-undef
|
|
|
|
+ callback(data.businessTable, data.businessId, this.inputForm)
|
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
|
+ this.loading = false
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ close () {
|
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
|
+ this.inputForm.detailInfos = []
|
|
|
|
+ this.inputForm.wareHouse = []
|
|
|
|
+ this.inputForm.amountInfos = []
|
|
|
|
+ this.$refs.uploadComponent.clearUpload()
|
|
|
|
+ this.visible = false
|
|
|
|
+ },
|
|
|
|
+ // 删除
|
|
|
|
+ removeEvent (row, rowIndex, type) {
|
|
|
|
+ if (type === 'detail') {
|
|
|
|
+ this.$refs.detailTable.remove(row)
|
|
|
|
+ // this.inputForm.detailInfos.splice(rowIndex, 1)
|
|
|
|
+ this.inputForm.wareHouse.splice(rowIndex, 1)
|
|
|
|
+ }
|
|
|
|
+ if (type === 'amount') {
|
|
|
|
+ this.$refs.amountTable.remove(row)
|
|
|
|
+ this.inputForm.amountInfos.splice(rowIndex, 1)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 新增
|
|
|
|
+ async insertEvent (type) {
|
|
|
|
+ if (type === 'detail') {
|
|
|
|
+ await this.$refs.detailTable.insert().then((data) => {
|
|
|
|
+ data.wareHouseMan = this.name
|
|
|
|
+ data.wareHouseManOffice = this.officeName
|
|
|
|
+ // this.inputForm.detailInfos.push(data)
|
|
|
|
+ this.inputForm.wareHouse.push(data)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (type === 'amount') {
|
|
|
|
+ await this.$refs.amountTable.insert().then((data) => {
|
|
|
|
+ this.inputForm.amountInfos.push(data)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</script>
|