|
@@ -0,0 +1,694 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="formReadOnly"
|
|
|
+ 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="collectNo">
|
|
|
+ <el-input placeholder="自动生成" v-model="inputForm.collectNo" :disabled="true"></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-input v-model="inputForm.handledByOffice" :disabled="true"></el-input>-->
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="领用时间" prop="collectDate" :rules="[{required: true, message:'请选择领用时间', trigger:'blur'}]">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="inputForm.collectDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="选择日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </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" :disabled="method==='view' || this.formReadOnly" size="mini" @click="insertEvent('detail')" plain>
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ </el-divider>
|
|
|
+ <el-row :gutter="15" >
|
|
|
+ <vxe-table
|
|
|
+ border
|
|
|
+ show-footer
|
|
|
+ show-overflow
|
|
|
+ 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: '-'}"
|
|
|
+ :edit-rules="validRules"
|
|
|
+ >
|
|
|
+ <vxe-table-column field="recipientAgent" title="领用人" :edit-render="{}" :rules="[{required: true, message:'请选择领用人', trigger:'blur'}]">
|
|
|
+ <template v-slot:edit="scope">
|
|
|
+ <el-input v-model="scope.row.recipientAgent" @focus="userPullListForm(scope.$rowIndex)"></el-input>
|
|
|
+ </template>
|
|
|
+ </vxe-table-column>
|
|
|
+ <vxe-table-column field="recipientOffice" title="领用人部门" :edit-render="{}">
|
|
|
+ <template v-slot:edit="scope">
|
|
|
+ <el-input :disabled='true' v-model="scope.row.recipientOffice" ></el-input>
|
|
|
+ </template>
|
|
|
+ </vxe-table-column>
|
|
|
+ <vxe-table-column field="collectType" title="领用类型" :edit-render="{}" :rules="[{required: true, message:'请选择领用类型', trigger:'blur'}]">
|
|
|
+ <template v-slot:edit="scope">
|
|
|
+ <el-input v-model="scope.row.collectType" @focus="typePullForm(scope.$rowIndex)"></el-input>
|
|
|
+ </template>
|
|
|
+ </vxe-table-column>
|
|
|
+ <vxe-table-column field="goodsName" title="物品名称" :edit-render="{}" :rules="[{required: true, message:'请填写物品名称', trigger:'blur'}]">
|
|
|
+ <template v-slot:edit="scope">
|
|
|
+ <el-input v-model="scope.row.goodsName" @focus="openPurchasePageForm(scope.$rowIndex, scope.row)"></el-input>
|
|
|
+ </template>
|
|
|
+ </vxe-table-column>
|
|
|
+ <vxe-table-column field="surplusNumber" 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" @blur="scope.row.tradeNumber = twoDecimalPlaces2(scope.row.tradeNumber)" maxlength="10"></el-input>-->
|
|
|
+ <el-input :disabled="true" v-model="scope.row.surplusNumber" maxlength="10"></el-input>
|
|
|
+ </template>
|
|
|
+ </vxe-table-column>
|
|
|
+ <vxe-table-column field="collectNumber" 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" @blur="scope.row.tradeNumber = twoDecimalPlaces2(scope.row.tradeNumber)" maxlength="10"></el-input>-->
|
|
|
+ <el-input @change="changeValue" v-model="scope.row.collectNumber" @blur="scope.row.collectNumber = twoDecimalPlaces2(scope.row.collectNumber)" maxlength="10"></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="formReadOnly" :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>
|
|
|
+ <PurchasePageForm ref="purchasePageForm" @getProject="getContract"></PurchasePageForm>
|
|
|
+ <!-- 附件 -->
|
|
|
+ <MaterialManagementDialog ref="materialManagementDialog" @getUpload="getUpload"></MaterialManagementDialog>
|
|
|
+ <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
|
|
|
+ <CwProgramPageForm ref="cwProgramPageForm" @getProgram="getProgram"></CwProgramPageForm>
|
|
|
+ <MaterialTypePullForm ref="materialTypePullForm" @getProgramForType="getProgramForType"></MaterialTypePullForm>
|
|
|
+ <UserPullForm ref="userPullForm" @getProgramForUser="getProgramForUser"></UserPullForm>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import UserSelect from '@/components/userSelect'
|
|
|
+ import MaterialManagementDialog from '../file/MaterialManagementDialog'
|
|
|
+ import CollectService from '@/api/materialManagement/CollectService'
|
|
|
+ import UpLoadComponent from '@/views/common/UpLoadComponent'
|
|
|
+ import SelectUserTree from '@/views/modules/utils/treeUserSelect'
|
|
|
+ import SelectTree from '@/components/treeSelect/treeSelect.vue'
|
|
|
+ import UserService from '@/api/sys/UserService'
|
|
|
+ import CwProgramPageForm from '@/views/modules/cw/reimbursementApproval/info/CwProgramPageForm'
|
|
|
+ import MaterialTypePullForm from '../info/MaterialTypePullForm'
|
|
|
+ import UserPullForm from '@/views/modules/finance/invoice/UserPullForm'
|
|
|
+ import PurchasePageForm from './PurchasePageForm'
|
|
|
+ export default {
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ validRules: {
|
|
|
+ recipientAgent: [
|
|
|
+ {required: true, message: '领用人不能为空'}
|
|
|
+ ],
|
|
|
+ recipientOffice: [
|
|
|
+ {required: true, message: '领用人部门不能为空'}
|
|
|
+ ],
|
|
|
+ collectType: [
|
|
|
+ {required: true, message: '领用类型不能为空'}
|
|
|
+ ],
|
|
|
+ goodsName: [
|
|
|
+ {required: true, message: '物品名称不能为空'}
|
|
|
+ ],
|
|
|
+ collectNumber: [
|
|
|
+ {required: true, message: '领用数量不能为空'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ title: '',
|
|
|
+ method: '',
|
|
|
+ visible: false,
|
|
|
+ loading: false,
|
|
|
+ indexRow: '',
|
|
|
+ inputForm: {
|
|
|
+ fileInfoLost: [],
|
|
|
+ handledByOffice: '',
|
|
|
+ handledBy: '',
|
|
|
+ handledById: '',
|
|
|
+ collectNo: '', // 领用编号
|
|
|
+ userId: '',
|
|
|
+ collectDate: '',
|
|
|
+ remarks: '',
|
|
|
+ detailInfos: [],
|
|
|
+ // amountInfos: [],
|
|
|
+ files: [] // 附件信息
|
|
|
+ },
|
|
|
+ keyWatch: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ CollectService: null,
|
|
|
+ userService: null,
|
|
|
+ created () {
|
|
|
+ this.collectService = new CollectService()
|
|
|
+ this.userService = new UserService()
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ businessId: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ formReadOnly: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ status: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ UserSelect,
|
|
|
+ MaterialManagementDialog,
|
|
|
+ UpLoadComponent,
|
|
|
+ SelectUserTree,
|
|
|
+ SelectTree,
|
|
|
+ CwProgramPageForm,
|
|
|
+ MaterialTypePullForm,
|
|
|
+ UserPullForm,
|
|
|
+ PurchasePageForm
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ bus: {
|
|
|
+ get () {
|
|
|
+ return this.businessId
|
|
|
+ },
|
|
|
+ set (val) {
|
|
|
+ this.businessId = val
|
|
|
+ }
|
|
|
+ },
|
|
|
+ name () {
|
|
|
+ return JSON.parse(localStorage.getItem('user')).name
|
|
|
+ },
|
|
|
+ officeName () {
|
|
|
+ return JSON.parse(localStorage.getItem('user')).officeDTO.name
|
|
|
+ },
|
|
|
+ userId () {
|
|
|
+ return JSON.parse(localStorage.getItem('user')).id
|
|
|
+ },
|
|
|
+ recipientAgentId () {
|
|
|
+ return JSON.parse(localStorage.getItem('user')).id
|
|
|
+ },
|
|
|
+ collectTypeId () {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'keyWatch': {
|
|
|
+ handler (newVal) {
|
|
|
+ if (this.commonJS.isNotEmpty(this.bus)) {
|
|
|
+ this.init('', this.bus)
|
|
|
+ } else {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getKeyWatch (keyWatch) {
|
|
|
+ this.keyWatch = keyWatch
|
|
|
+ },
|
|
|
+ init (method, id) {
|
|
|
+ this.method = method
|
|
|
+ this.inputForm = {
|
|
|
+ fileInfoLost: [],
|
|
|
+ handledByOffice: '',
|
|
|
+ handledBy: JSON.parse(localStorage.getItem('user')).name,
|
|
|
+ handledById: JSON.parse(localStorage.getItem('user')).id,
|
|
|
+ collectNo: '', // 领用编号
|
|
|
+ userId: JSON.parse(localStorage.getItem('user')).id,
|
|
|
+ collectDate: new Date(),
|
|
|
+ remarks: '',
|
|
|
+ detailInfos: [],
|
|
|
+ // amountInfos: [],
|
|
|
+ files: [] // 附件信息
|
|
|
+ }
|
|
|
+ if (method === 'add') {
|
|
|
+ this.title = `新建领用类型`
|
|
|
+ } else if (method === 'edit') {
|
|
|
+ this.title = '修改领用类型'
|
|
|
+ }
|
|
|
+ this.inputForm.id = id
|
|
|
+ this.visible = true
|
|
|
+ this.loading = false
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
|
|
|
+ this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
|
|
|
+ }
|
|
|
+ if (this.status === 'audit' || this.status === 'taskFormDetail') {
|
|
|
+ method = 'view'
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ this.collectService.findById(this.inputForm.id).then(({data}) => {
|
|
|
+ if (this.inputForm.id !== 'false') {
|
|
|
+ this.inputForm = this.recover(this.inputForm, data)
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
|
|
|
+ this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
|
|
|
+ }
|
|
|
+ if (this.commonJS.isNotEmpty(data.recipientAgentId)) {
|
|
|
+ this.recipientAgentId = data.recipientAgentId
|
|
|
+ }
|
|
|
+ if (this.commonJS.isNotEmpty(data.collectTypeId)) {
|
|
|
+ this.collectTypeId = data.collectTypeId
|
|
|
+ }
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.detailInfos)) {
|
|
|
+ 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
|
|
|
+ } else {
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
|
|
|
+ this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.handledBy)) {
|
|
|
+ this.inputForm.handledBy = JSON.parse(localStorage.getItem('user')).name
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.handledById)) {
|
|
|
+ this.inputForm.handledById = JSON.parse(localStorage.getItem('user')).id
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.collectDate)) {
|
|
|
+ this.inputForm.collectDate = new Date()
|
|
|
+ }
|
|
|
+ this.inputForm.detailInfos = []
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (method !== 'edit' && method !== 'view') {
|
|
|
+ this.$refs.uploadComponent.newUpload(method, [], 'reimbursement')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getUpload (p, index) {
|
|
|
+ p.then((list) => {
|
|
|
+ // list为返回数据
|
|
|
+ this.inputForm.detailInfos[index].fileInfoLost = list
|
|
|
+ this.inputForm.detailInfos[index].fileNumber = list.length
|
|
|
+ this.tableKeyClient = Math.random()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ seeFileInfo (index) {
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[index].fileInfoLost)) {
|
|
|
+ this.inputForm.detailInfos[index].fileInfoLost = []
|
|
|
+ }
|
|
|
+ this.$refs.materialManagementDialog.newUpload('view', this.inputForm.detailInfos[index].fileInfoLost, null, null, null, null, null, false, index)
|
|
|
+ },
|
|
|
+ sss (index) {
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[index].fileInfoLost)) {
|
|
|
+ this.inputForm.detailInfos[index].fileInfoLost = []
|
|
|
+ }
|
|
|
+ this.$refs.materialManagementDialog.newUpload(null, this.inputForm.detailInfos[index].fileInfoLost, null, null, null, null, null, false, index)
|
|
|
+ },
|
|
|
+ // 表单提交
|
|
|
+ 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.inputForm.files = []
|
|
|
+ }
|
|
|
+ this.inputForm.id = this.businessId
|
|
|
+ this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
|
+ this.collectService.save(this.inputForm).then(({data}) => {
|
|
|
+ this.close()
|
|
|
+ this.$message.success(data)
|
|
|
+ this.$emit('refreshDataList')
|
|
|
+ this.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ close () {
|
|
|
+ this.inputForm.detailInfos = []
|
|
|
+ // this.inputForm.amountInfos = []
|
|
|
+ this.$refs.uploadComponent.clearUpload()
|
|
|
+
|
|
|
+ this.visible = false
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ removeEvent (row, rowIndex, type) {
|
|
|
+ if (type === 'detail') {
|
|
|
+ this.$refs.detailTable.remove(row)
|
|
|
+ this.inputForm.detailInfos.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.recipientAgent = JSON.parse(localStorage.getItem('user')).name
|
|
|
+ data.recipientAgentId = this.recipientAgentId
|
|
|
+ data.recipientOffice = this.officeName
|
|
|
+ this.inputForm.detailInfos.push(data)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (type === 'amount') {
|
|
|
+ await this.$refs.amountTable.insert().then((data) => {
|
|
|
+ // this.inputForm.amountInfos.push(data)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 暂存
|
|
|
+ async saveForm (callback) {
|
|
|
+ this.loading = true
|
|
|
+ if (this.$refs.uploadComponent.checkProgress()) {
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.files)) {
|
|
|
+ this.inputForm.files = []
|
|
|
+ }
|
|
|
+ this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
|
+ this.inputForm.status = '1'
|
|
|
+ this.collectService.save(this.inputForm).then(({data}) => {
|
|
|
+ callback()
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ this.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 送审
|
|
|
+ async startForm (callback) {
|
|
|
+ this.$refs['inputForm'].validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true
|
|
|
+ if (this.$refs.uploadComponent.checkProgress()) {
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.files)) {
|
|
|
+ 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].recipientAgent)) {
|
|
|
+ this.$message.error('领用详情第' + k + '行请选择领用人')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].collectType)) {
|
|
|
+ this.$message.error('领用详情第' + k + '行请选择领用类型')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].goodsName)) {
|
|
|
+ this.$message.error('领用详情第' + k + '行请选择物品名称')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].collectNumber)) {
|
|
|
+ this.$message.error('领用详情第' + k + '行请输入领用数量')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
|
+ this.inputForm.status = '2'
|
|
|
+ this.collectService.save(this.inputForm).then(({data}) => {
|
|
|
+ callback(data.businessTable, data.businessId, this.inputForm)
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ this.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 通过
|
|
|
+ async agreeForm (callback) {
|
|
|
+ this.$refs['inputForm'].validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true
|
|
|
+ if (this.$refs.uploadComponent.checkProgress()) {
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.files)) {
|
|
|
+ this.inputForm.files = []
|
|
|
+ }
|
|
|
+ this.inputForm.files = this.$refs.uploadComponent.getDataList()
|
|
|
+ this.inputForm.status = '5'
|
|
|
+ // await this.userService.is().then(({data}) => {
|
|
|
+ // if (data) {
|
|
|
+ // this.inputForm.status = '5'
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ this.collectService.save(this.inputForm).then(({data}) => {
|
|
|
+ callback(data.businessTable, data.businessId, this.inputForm)
|
|
|
+ this.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 修改状态
|
|
|
+ updateStatusById (type) {
|
|
|
+ if (type === 'reject') {
|
|
|
+ this.inputForm.status = '4'
|
|
|
+ this.collectService.updateStatusById(this.inputForm)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 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
|
|
|
+ // },
|
|
|
+ // twoDecimalPlaces (num, index) {
|
|
|
+ // 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
|
|
|
+ // this.inputForm.detailInfos[index].priceSum = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
|
|
|
+ // },
|
|
|
+ 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
|
|
|
+ },
|
|
|
+ countAmount (row) {
|
|
|
+ let amount
|
|
|
+ let taxAmount
|
|
|
+ let count = 0
|
|
|
+ if (!this.commonJS.isEmpty(row.amount)) {
|
|
|
+ amount = parseFloat(row.amount)
|
|
|
+ count = count + amount
|
|
|
+ }
|
|
|
+ if (!this.commonJS.isEmpty(row.taxAmount)) {
|
|
|
+ taxAmount = parseFloat(row.taxAmount)
|
|
|
+ count = count + taxAmount
|
|
|
+ }
|
|
|
+ row.count = parseFloat(count).toFixed(2)
|
|
|
+ },
|
|
|
+ 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()
|
|
|
+ },
|
|
|
+ // 领用类型下拉弹窗
|
|
|
+ typePullForm (rowIndex) {
|
|
|
+ this.indexRow = rowIndex
|
|
|
+ this.$refs.materialTypePullForm.init()
|
|
|
+ },
|
|
|
+ getProgramForType (rows) {
|
|
|
+ this.inputForm.detailInfos[this.indexRow].collectTypeId = rows.id
|
|
|
+ this.inputForm.detailInfos[this.indexRow].collectType = rows.name
|
|
|
+ this.indexRow = ''
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
+ // 领用人下拉弹窗
|
|
|
+ userPullListForm (rowIndex) {
|
|
|
+ this.indexRow = rowIndex
|
|
|
+ this.$refs.userPullForm.init()
|
|
|
+ },
|
|
|
+ getProgramForUser (rows) {
|
|
|
+ this.inputForm.detailInfos[this.indexRow].recipientAgentId = rows[0].id
|
|
|
+ this.inputForm.detailInfos[this.indexRow].recipientAgent = rows[0].name
|
|
|
+ this.inputForm.detailInfos[this.indexRow].deptId = rows[0].parentId
|
|
|
+ this.inputForm.detailInfos[this.indexRow].recipientOffice = rows[0].officeName
|
|
|
+ this.indexRow = ''
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
+ getUserInfo (rows) {
|
|
|
+ },
|
|
|
+ openPurchasePageForm (rowIndex, row) {
|
|
|
+ if (this.commonJS.isEmpty(row.collectType)) {
|
|
|
+ this.$message.error('请选择领用类型')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.indexRow = rowIndex
|
|
|
+ this.$refs.purchasePageForm.init(row.collectTypeId)
|
|
|
+ },
|
|
|
+ getContract (row) {
|
|
|
+ this.inputForm.detailInfos[this.indexRow].surplusNumber = row.tradeNumber
|
|
|
+ this.inputForm.detailInfos[this.indexRow].goodsName = row.tradeName
|
|
|
+ this.indexRow = ''
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
+ // 值改变事件
|
|
|
+ changeValue () {
|
|
|
+ let i = this.inputForm.detailInfos.length
|
|
|
+ for (let j = 0; j < i; j++) {
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].surplusNumber)) {
|
|
|
+ this.$message.error('请选择领用物品名称')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.detailInfos[j].collectNumber)) {
|
|
|
+ if (this.inputForm.detailInfos[j].surplusNumber < this.inputForm.detailInfos[j].collectNumber) {
|
|
|
+ this.$message.error('领用数量不能大于剩余数量')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|