12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484 |
- <template>
- <div id="addDemandList">
- <el-card>
- <span>基本信息</span>
- <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto">
- <el-row :gutter="10">
- <el-col :span="1.5">
- <el-form-item label="编码">
- <el-input
- v-model="basicForm.code"
- size="mini"
- disabled
- style="width: 200px"
- />
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="组织" prop="org" :rules="{ required: true, message: '请选择组织', trigger: 'blur' }">
- <el-select clearable size="mini" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
- <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求处理方式">
- <el-select disabled v-model="basicForm.demandBusinessType" size="mini" style="width: 200px">
- <el-option v-for="dict in dict.type.sys_processing_mode" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="单据状态">
- <el-select disabled v-model="basicForm.status" size="mini" style="width: 200px">
- <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求客户">
- <el-select clearable size="mini" v-model="basicForm.customer" :disabled="sonDisable" @clear="cleanCustomer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
- <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求客户名称">
- <el-input disabled v-model="basicForm.customerName" size="mini" style="width: 200px"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="客户负责人">
- <el-select disabled size="mini" v-model="basicForm.customerPrincipal" style="width: 200px">
- <el-option v-for="item in manOptions" :key="item.id" :label="item.name" :value="item.code"/>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求人员">
- <el-select clearable size="mini" v-model="basicForm.demandPersonal" :disabled="sonDisable" @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')" style="width: 200px">
- <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求部门">
- <el-select clearable v-model="basicForm.demandDept" size="mini" :disabled="sonDisable" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
- <el-option
- v-for="item in deptOptions"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求日期" prop="demandDate" :rules="{ required: true, message: '请选择需求日期', trigger: 'blur' }">
- <el-date-picker
- v-model="basicForm.demandDate"
- :disabled="sonDisable"
- clearable
- type="date"
- value-format="yyyy-MM-dd"
- @change="changeDemandDate"
- size="mini"
- style="width: 200px"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="单据来源">
- <el-select v-model="basicForm.source" disabled size="mini" style="width: 200px">
- <el-option v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="业务类型" prop="billType" :rules="{ required: true, message: '请选择业务类型', trigger: 'blur' }">
- <el-select clearable v-model="basicForm.billType" @change="changeBillType" :disabled="sonDisable" size="mini" style="width: 200px">
- <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="是否客户指定">
- <el-select clearable v-model="basicForm.isSpeical" :disabled="sonDisable" size="mini" style="width: 200px">
- <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <!-- <el-col :span="1.5">
- <el-form-item label="是否处理需求">
- <el-input
- v-model="basicForm.isProcess"
- size="mini"
- placeholder=""
- clearable
- style="width: 200px"
- />
- </el-form-item>
- </el-col> -->
- <el-col :span="1.5">
- <el-form-item label="备注">
- <el-input
- v-model.trim="basicForm.remark"
- size="mini"
- :disabled="sonDisable"
- clearable
- style="width: 200px"
- />
- </el-form-item>
- </el-col>
- </el-row>
-
- <span>明细信息</span>
- <div class="btn_grooup">
- <el-button type="primary" size="mini" @click="addLine" v-if="!sonDisable">增行</el-button>
- <el-button type="primary" size="mini" v-if="!sonDisable" @click="adjustPl">批量调整</el-button>
- <el-button type="primary" size="mini" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
- </div>
- <el-table
- :data="basicForm.puDemandItemList"
- fit
- max-height="300"
- style="font-size: 12px;"
- @selection-change="handleSelectionChange"
- :cell-class-name="cellClassName"
- >
- <el-table-column show-overflow-tooltip type="selection"/>
- <el-table-column show-overflow-tooltip label="序号" type="index" align="center"/>
- <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" :formatter="hangStatus" width="150px"/>
- <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo">
- <template slot-scope="scope">
- {{scope.$index + 1 + '0'}}
- </template>
- </el-table-column>
- <!-- <el-table-column show-overflow-tooltip label="业务部门名称" align="center" width="180px"/> -->
- <!-- <el-table-column show-overflow-tooltip label="业务部门" align="center" width="180px"/> -->
- <el-table-column show-overflow-tooltip label="需求客户" align="center" prop="demandCustomerName" width="200px"/>
- <el-table-column show-overflow-tooltip label="一级品类" align="center" prop="materialClassifyOneName" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="mini" v-model="scope.row.materialClassifyOneName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="二级品类" align="center" prop="materialClassifyTwoName" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="mini" v-model="scope.row.materialClassifyTwoName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="三级品类" align="center" prop="materialClassifyThreeName" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="mini" v-model="scope.row.materialClassifyThreeName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="四级品类" align="center" prop="materialClassifyFourName" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="mini" v-model="scope.row.materialClassifyFourName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="采购员名称" align="center" prop="buyerName" width="120px"/>
- <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyer"/>
- <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="230px">
- <template slot-scope="scope">
- <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'materialCode'" :rules="{ required: true, message: '请选择物料编码', trigger: 'blur' }">
- <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.materialCode" @paste.native="pasteMe($event, scope, scope.$index)">
- <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="物料名称" align="center" prop="materialName" width="230px" />
- <el-table-column show-overflow-tooltip label="规格" align="center" prop="specification" />
- <el-table-column show-overflow-tooltip label="型号" align="center" prop="model"/>
- <el-table-column show-overflow-tooltip label="单位" align="center" prop="unitName"/>
- <el-table-column show-overflow-tooltip label="生产厂家/代理人" align="center" prop="manufacturerName" width="230px"/>
- <el-table-column show-overflow-tooltip label="注册人" align="center" prop="registrant" width="150px"/>
- <el-table-column show-overflow-tooltip label="采购周期" align="center" prop="puPeriod" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.puPeriod"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="有效期" align="center" prop="expiry" width="120px"/>
- <el-table-column show-overflow-tooltip label="有效期单位" align="center" prop="expiryUnit" width="120px"/>
- <el-table-column show-overflow-tooltip label="最小包装" align="center" prop="minPackage" width="120px"/>
- <el-table-column show-overflow-tooltip label="最小订货量" align="center" prop="minOrderQty" width="120px"/>
- <el-table-column show-overflow-tooltip label="最小批量" align="center" prop="minBatch" width="120px"/>
- <el-table-column show-overflow-tooltip label="安全库存" align="center" prop="safeStock" width="120px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.safeStock"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @change="getYLSL(scope)" @clear="scope.row.reservedQty = ''">
- <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- <!-- <el-input v-model="scope.row.reservedProportion"/> -->
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'reservedPeriod'" :rules="{ required: scope.row.reservedProportion && scope.row.reservedProportion !== '' , message: '请填写预留周期', trigger: 'blur' }">
- <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.reservedPeriod"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="预留数量" align="center" prop="reservedQty" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input type="number" min="0" readonly size="mini" v-model="scope.row.reservedQty"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="月均销量" align="center" prop="averageQtyMonth" width="120px"/>
- <el-table-column show-overflow-tooltip label="实际(业务)需求量" align="center" prop="qty" width="120px">
- <template slot-scope="scope">
- <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'qty'" :rules="{ required: true, message: '请填写实际(业务)需求量', trigger: 'blur' }">
- <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.qty" @input="getYLSL(scope)"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="需求可用周期" align="center" prop="demandPeriod" width="120px"/>
- <el-table-column show-overflow-tooltip label="集团预测分类" align="center" prop="forecastClassify" width="120px"/>
- <el-table-column show-overflow-tooltip label="近一月需求" align="center" prop="onemonthAvgVolume" width="120px"/>
- <el-table-column show-overflow-tooltip label="近三月需求" align="center" prop="threemonthAvgVolume" width="120px"/>
- <el-table-column show-overflow-tooltip label="交货日期" align="center" prop="deliveryDate" width="230px">
- <template slot-scope="scope">
- <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'deliveryDate'" :rules="{ required: true, message: '请填写交货日期', trigger: 'blur' }">
- <el-date-picker
- v-model="scope.row.deliveryDate"
- :readonly="sonDisable"
- clearable
- type="date"
- size="mini"
- value-format="yyyy-MM-dd"
- :picker-options="pickerOptionsEnd"
- placeholder="选择日期">
- </el-date-picker>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="补单标识" align="center" prop="isReplenishment" width="100px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-switch
- v-model="scope.row.isReplenishment"
- disabled
- active-value="Y"
- inactive-value="N"
- active-color="#13ce66"
- inactive-color="#a1a3a9">
- </el-switch>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="批号锁定标识" align="center" prop="isBatchLock" width="100px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-switch
- v-model="scope.row.isBatchLock"
- :disabled="sonDisable"
- active-value="Y"
- inactive-value="N"
- active-color="#13ce66"
- inactive-color="#a1a3a9">
- </el-switch>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="业务备注" align="center" prop="remark" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.remark"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="采购备注" align="center" prop="puRemark" width="150px"/>
- <!-- <el-table-column show-overflow-tooltip label="末级供应仓库存量" align="center" prop="lastWarehouseQty" /> -->
- <el-table-column show-overflow-tooltip label="调拨占有量" align="center" prop="superiorAllotQty" width="150px"/>
- <el-table-column show-overflow-tooltip label="最终净需求量" align="center" prop="resDemandQty" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.resDemandQty"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="最终采购执行数量" align="center" prop="executeQty" width="150px">
- <template slot-scope="scope">
- {{scope.row.executeQty ? scope.row.executeQty : 0 }}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="收货仓库" align="center" prop="deliveryWarehouseName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryWarehouseName" @clear="clearHang(scope.$index, '选择收货仓库')" @focus="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')">
- <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')"></el-button>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="收货货位" align="center" prop="deliveryAllocationName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clearHang(scope.$index, '选择收货货位')" @focus="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)">
- <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)"></el-button>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <!-- <el-table-column show-overflow-tooltip label="收货货位编码" align="center" prop="deliveryAllocation" width="200px"/> -->
- <el-table-column show-overflow-tooltip label="末级供应仓库" align="center" prop="lastWarehouseName" width="200px"/>
- <el-table-column show-overflow-tooltip label="末级供应货位" align="center" prop="lastAllocationName" width="200px"/>
- <el-table-column show-overflow-tooltip label="紧急标识" align="center" prop="isUrgency" width="100px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-switch
- v-model="scope.row.isUrgency"
- disabled
- active-value="Y"
- inactive-value="N"
- active-color="#13ce66"
- inactive-color="#a1a3a9">
- </el-switch>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="默认采购组织" align="center" prop="purOrgName" width="200px"/>yu
- <el-table-column show-overflow-tooltip label="默认采购组织编码" align="center" prop="puOrg" width="200px"/>
- <!-- <el-table-column show-overflow-tooltip label="末级供应调拨待入量" align="center" prop="lastStockQty" width="150px"/> -->
- <!-- <el-table-column show-overflow-tooltip label="上级供应中心现存量" align="center" prop="superiorCenterQty" width="200px"/> -->
- <!-- <el-table-column show-overflow-tooltip label="上级库存被调拨占用量" align="center" prop="superiorAllotQty" width="200px"/> -->
- <el-table-column show-overflow-tooltip label="可用量" align="center" prop="availableQty"/>
- <el-table-column show-overflow-tooltip label="调拨状态" align="center" prop="statusAllot" width="100px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-switch
- v-model="scope.row.statusAllot"
- :disabled="sonDisable"
- active-value="Y"
- inactive-value="N"
- active-color="#13ce66"
- inactive-color="#a1a3a9">
- </el-switch>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip label="补单供应商" align="center" prop="additionalSupplierName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'additionalSupplierName'" :rules="{ required: isBDXQ, message: '请选择补单供应商', trigger: 'blur' }">
- <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.$index, '选择补单供应商')" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
- <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <!-- <el-table-column show-overflow-tooltip label="补单供应商名称" align="center" prop="additionalSupplierName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="mini" v-model="scope.row.additionalSupplierName"/>
- </el-form-item>
- </template>
- </el-table-column> -->
- <!-- <el-table-column show-overflow-tooltip label="周期单位" align="center" prop="periodUnit" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.periodUnit">
- <el-option v-for=" dict in dict.type.sys_period_unit" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-form-item>
- </template>
- </el-table-column> -->
- <el-table-column show-overflow-tooltip label="末级供应库存组织" align="center" prop="lastStockOrgName" width="200px"></el-table-column>
- <el-table-column show-overflow-tooltip label="中心仓可用量" align="center" prop="centralWarehouseQty" width="200px"/>
- <el-table-column show-overflow-tooltip label="调拨单号" align="center" prop="allotCode"></el-table-column>
- <el-table-column show-overflow-tooltip label="收货地址" align="center" prop="deliveryAddressName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAddressName" @clear="clearHang(scope.$index, '选择收货地址')" @focus="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')">
- <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <!-- <el-table-column show-overflow-tooltip label="收货地址编码" align="center" prop="deliveryAddress" width="200px"></el-table-column> -->
- <el-table-column show-overflow-tooltip label="联系人" align="center" prop="contacts"/>
- <el-table-column show-overflow-tooltip label="联系人电话" align="center" prop="contactsPhone" width="200px"/>
- <el-table-column show-overflow-tooltip label="详细地址" align="center" prop="address" width="200px"/>
- <el-table-column show-overflow-tooltip label="价格类型" align="center" prop="priceType" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'priceType'" :rules="{ required: true, message: '请选择价格类型', trigger: 'blur' }">
- <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.priceType">
- <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- <!-- <el-input v-model="scope.row.periodUnit"/> -->
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- fixed="right"
- label="操作"
- align="center"
- >
- <template slot-scope="scope">
- <el-button type="text" size="mini" :disabled="sonDisable" @click="delLine(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-form>
- </el-card>
- <div class="btn_group">
- <el-col :span="1.5">
- <el-button type="primary" size="mini" plain @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="primary" size="mini" plain @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
- </el-col>
- <el-col :span="1.5" style="margin: 0 10px;">
- <el-button type="primary" size="mini" plain @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button size="mini" plain @click="back">返回</el-button>
- </el-col>
- <Reserved v-if="dialog.config" :isVisible="dialog.config" :info="row" @updateReserved="updateReserved"/>
- <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
- <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="true" />
- </div>
- <!-- 批量调整参数 -->
- <el-dialog title="批量调整" :visible.sync="adjust.open" @close="closeEvent" width="400px">
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">价格类型</el-col>
- <el-col :span="14">
- <el-select clearable size="mini" v-model="adjust.priceType">
- <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">采购员</el-col>
- <el-col :span="14">
- <el-select clearable size="mini" v-model="adjust.purchaseMan" @focus="chooseOrg('CONTACTS_PARAM', true, '采购员')">
- <el-option v-for="item in purchaseManOptions" :key="item.id" :label="item.name" :value="item.code" />
- </el-select>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">收货仓库</el-col>
- <el-col :span="14">
- <el-input clearable size="mini" v-model="adjust.warehouseName" @focus="chooseOrg('WAREHOUSE_PARAM', true, '收货仓库')">
- <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('WAREHOUSE_PARAM', true, '收货仓库')"></el-button>
- </el-input>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">收货货位</el-col>
- <el-col :span="14">
- <el-input clearable size="mini" v-model="adjust.allocationName" @focus="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)">
- <el-button size="mini" slot="append" icon="el-icon-more" @click="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)"></el-button>
- </el-input>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">业务备注</el-col>
- <el-col :span="14">
- <el-input clearable size="mini" v-model="adjust.remark"/>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">收货地址</el-col>
- <el-col :span="14">
- <el-input clearable size="mini" v-model="adjust.deliveryAddressName" @focus="chooseOrg('ADDRESS_PARAM', true, '收货地址')">
- <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ADDRESS_PARAM', true, '收货地址')"></el-button>
- </el-input>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">收货地址编码</el-col>
- <el-col :span="14">
- <el-input disabled clearable size="mini" v-model="adjust.deliveryAddress"/>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">联系人</el-col>
- <el-col :span="14">
- <el-input disabled clearable size="mini" v-model="adjust.contacts"/>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">联系人电话</el-col>
- <el-col :span="14">
- <el-input disabled clearable size="mini" v-model="adjust.contactsPhone"/>
- </el-col>
- </el-row>
- <el-row style="margin-bottom: 10px;">
- <el-col :span="6">详细地址</el-col>
- <el-col :span="14">
- <el-input disabled clearable size="mini" v-model="adjust.address"/>
- </el-col>
- </el-row>
- <div slot="footer" class="dialog-footer">
- <el-button size="mini" type="primary" @click="confirmAdjust">确 认</el-button>
- <el-button size="mini" @click="adjust.open = false">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import Reserved from './reserved.vue'
- import Refers from '@/components/Refers/refers.vue'
- import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan } from '@/api/purchase/purchaseDemand.js'
- // 用于回显参照框数据
- import {getRefer} from '@/api/purchase/basic.js'
- // 明细行选择物料参照
- import popDialog from '@/components/PopDialog/index.vue'
- export default {
- name: 'addDemandList',
- props: ['pageStu','row', 'disable'],
- dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business','sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
- components: {
- Reserved,
- Refers,
- popDialog
- },
- model: {
- prop: 'isList',
- event: 'jugislist'
- },
- data() {
- return {
- // 不能直接改变props传来的值
- sonPageStu: this.pageStu,
- sonDisable: this.disable,
- // BDZT是补单供应商是否可以编辑条件
- BDZT: true,
- dialog: {
- config: false
- },
- basicForm: {
- code: '',
- org: '',
- orgName: '',
- demandBusinessType: '1',
- status: '0',
- customer: '',
- customerName: '',
- customerCode: '',
- customerPrincipal: '',
- demandPersonal: '',
- demandDept: '',
- demandDate: '',
- source: '4',
- billType: 'ZQBH',
- isSpeical: '',
- isProcess: '',
- isMonthleyCalculate: '',
- remark: '',
- puDemandItemList: []
- },
- delDemandItemList: [],
- options: [{
- value: 'Y', label: '是',
- }, {
- value: 'N', label: '否'
- }],
- basicRules: {},
- tableList: [],
- referCondition: {
- type: '',
- isPage: true,
- title: '',
- },
- // referCondition: {
- // type: '',
- // isPage: true,
- // title: '',
- // },
- tableIndex: null,
- ids: [],
- orgOptions: [],
- manOptions: [],
- personOptions: [],
- deptOptions: [],
- customerOptions: [],
- pickerOptionsEnd: {
- disabledDate: (time) => {
- let beginDateVal = this.basicForm.demandDate;
- if (beginDateVal) {
- return (
- time.getTime() <
- new Date(beginDateVal).getTime() - 8.64e7
- );
- }
- }
- },
- isBDXQ: false,
- isYl: false,
- // 批量调整参数
- adjust: {
- open: false,
- priceType: '',
- purchaseMan: '',
- purchaseManName: '',
- warehouse: '',
- warehouseName: '',
- allocation: '',
- allocationName: '',
- remark:'',
- deliveryAddress: '',
- deliveryAddressName: '',
- contacts: '',
- contactsPhone: '',
- address: ''
- },
- purchaseManOptions: []
- }
- },
- created() {
- if(this.pageStu == 'check') {
- console.log('数据', this.row)
- this.getDetails(this.row)
- } else if(this.pageStu == 'edit') {
- this.getDetails(this.row)
- }
- },
- methods: {
- // 改变单据日期时清空子表的调拨日期
- changeDemandDate() {
- this.basicForm.puDemandItemList.forEach(item => {
- item.deliveryDate = null
- })
- },
- // 更改业务类型调整明细行内补单或紧急标识
- changeBillType() {
- if (this.basicForm.billType == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
- this.isBDXQ = true
- this.BDZT = false
- this.basicForm.puDemandItemList.forEach(item => {item.isReplenishment = 'Y'})
- } else {
- this.isBDXQ = false
- this.BDZT = true
- this.basicForm.puDemandItemList.forEach(item => {
- item.isReplenishment = 'N'
- item.additionalSupplier = null
- item.additionalSupplierName = null
- })
- }
- if (this.basicForm.billType == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
- this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
- } else {
- this.basicForm.puDemandItemList.forEach(item => { item.isUrgency = 'N' })
- }
- },
- hangStatus(row) {
- switch (row.status) {
- case '0':
- return '需补货'
- case '1':
- return '待计划确认'
- case '2':
- return '计划已确认'
- case '3':
- return '计划已审核'
- case '4':
- return '行关闭'
- case '5':
- return '总供应可满足'
- }
- },
- // 获取预留数量
- getYLSL(scope) {
- if (scope.row.reservedProportion) {
- scope.row.reservedQty = Math.ceil(scope.row.reservedProportion.replace('%', '') / 100 * scope.row.qty)
- }
- // 如果选择预留比例,预留周期必填
- // if(scope.row.reservedQty && scope.row.reservedQty !== 0) {
- // this.isYl = true
- // } else {
- // this.isYl = false
- // }
- },
- copy() {
- this.$modal.msgSuccess("复制成功");
- this.sonPageStu = 'add'
- this.sonDisable = false
- // this.getDetails(this.row)
- this.basicForm.id = ''
- this.basicForm.code = ''
- this.basicForm.createBy = ''
- this.basicForm.source = '4'
- this.basicForm.puDemandItemList.forEach(item => {
- item.status = ''
- item.buyerName = ''
- item.buyer = ''
- item.reservedProportion = ''
- item.reservedPeriod = ''
- item.reservedQty = ''
- item.averageQtyMonth = ''
- item.demandPeriod = ''
- item.forecastClassify = ''
- item.onemonthAvgVolume = ''
- item.threemonthAvgVolume = ''
- item.superiorAllotQty = ''
- item.resDemandQty = ''
- item.executeQty = ''
- item.deliveryWarehouseName = ''
- item.deliveryWarehouse = ''
- item.deliveryAllocationName = ''
- item.deliveryAllocation = ''
- item.lastWarehouseName = ''
- item.lastAllocationName = ''
- item.availableQty = ''
- item.lastStockOrgName = ''
- item.centralWarehouseQty = ''
- item.allotCode = ''
- item.deliveryAddress = ''
- item.deliveryAddressName = ''
- item.contacts = ''
- item.contactsPhone = ''
- item.address = ''
- })
- },
- handleData() {
- console.log('222')
- // 复制新增把id,编码,创建人置为空,子表去掉id
- this.basicForm.id = ''
- this.basicForm.code = ''
- this.basicForm.createBy = ''
- this.basicForm.source = '4'
- if (this.basicForm.puDemandItemList.length !== 0) {
- this.basicForm.puDemandItemList.forEach(item => {
- if (item.id) {
- delete item.id
- }
- if (item.demandId) {
- delete item.demandId
- }
- if (item.allotCode) {
- delete item.allotCode
- }
- })
- }
- },
- async save() {
- if(this.basicForm.puDemandItemList.length !== 0) {
- this.$refs['basic'].validate((valid) => {
- if(valid) {
- this.$modal.loading("保存中...");
- if(this.sonPageStu == 'add') {
- this.handleData()
- addDemand(this.basicForm).then(res => {
- console.log(333)
- if (res.code === 200) {
- this.$modal.msgSuccess("保存成功");
- this.$modal.closeLoading();
- this.back()
- }
- }).catch(err => {
- this.$modal.closeLoading();
- })
- } else if (this.sonPageStu == 'edit') {
- let list = []
- list.push(...this.basicForm.puDemandItemList, ...this.delDemandItemList)
- // 深拷贝一下参数对象
- let param = JSON.parse(JSON.stringify(this.basicForm))
- console.log('深拷贝对象',param);
- param.puDemandItemList = list
- // this.basicForm.puDemandItemList.push(...this.delDemandItemList)
- editDemand(param).then(res => {
- if (res.code === 200) {
- this.$modal.msgSuccess("编辑成功");
- this.$modal.closeLoading();
- this.back()
- }
- }).catch(err => {
- this.$modal.closeLoading();
- })
- }
- }
- })
- } else {
- this.$modal.msgWarning("明细信息不能为空!");
- }
- },
- submit() {
- this.$modal.loading("提交中...");
- submitDemand(this.basicForm).then(res => {
- if (res.code === 200) {
- this.$modal.msgSuccess("提交成功");
- this.$modal.closeLoading();
- this.back()
- }
- }).catch(err => {
- this.$modal.closeLoading();
- })
- },
- // 增行
- addLine() {
- const newLine = {
- contacts: null,
- id: null,
- demandId: null,
- status: null,
- businessDept: null,
- businessDeptName: null,
- materialCategory: null,
- buyer: null,
- buyerName: null,
- mateiralClassifyOne: null,
- materialClassifyOneName: null,
- materialClassifyTwo: null,
- materialClassifyTwoName: null,
- materialClassifyThree: null,
- materialClassifyThreeName: null,
- materialClassifyFour: null,
- materialClassifyFourName: null,
- materialCode: null,
- material: null,
- materialName: null,
- classifyId: null,
- specification: null,
- unit: null,
- unitName: null,
- manufacturerName: null,
- registrant: null,
- puPeriod: null,
- expiryUnit: null,
- expiry: null,
- minPackage: null,
- minOrderQty: null,
- minBatch: null,
- safeStock: null,
- averageQtyMonth: null,
- qty: null,
- adjustmentPersonal: null,
- adjustmentTime: null,
- manualRegulation: null,
- updateCause: null,
- reservedProportion: null,
- reservedPeriod: null,
- reservedQty: null,
- demandPeriod: null,
- forecastClassify: null,
- onemonthAvgVolume: null,
- threemonthAvgVolume: null,
- deliveryDate: null,
- isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
- isReplenishment: this.basicForm.billType == 'BDXQ'? 'Y': 'N',
- isBatchLock: 'N',
- remark: null,
- puRemark: null,
- lastWarehouseQty: null,
- resDemandQty: null,
- lastWarehouse: null,
- lastWarehouseName: null,
- deliveryWarehouse: null,
- deliveryWarehouseName: null,
- lastAllocation: null,
- lastAllocationName: null,
- deliveryAllocation: null,
- deliveryAllocationName: null,
- passageOn: null,
- puOrg: null,
- purOrgName: null,
- lastStockQty: null,
- superiorCenterQty: null,
- superiorAllotQty: null,
- availableQty: null,
- statusAllot: 'N',
- additionalSupplier: null,
- additionalSupplierName: null,
- periodUnit: null,
- demandCustomer: this.basicForm.customer,
- demandCustomerName: this.basicForm.customerName,
- businessDept: this.basicForm.demandDept,
- businessDeptName: null,
- lastStockOrg: null,
- lastStockOrgName: null,
- superiorStockOrg: null,
- superiorStockOrgName: null,
- allotCode: null,
- deliveryAddress: null,
- deliveryAddressName: null,
- contacts: null,
- contactsPhone: null,
- address: null,
- source: null,
- priceType: 'order',
- puManagerApprover: null,
- puManagerApproverName: null,
- processTime: null,
- affirmer: null,
- tenantId: null,
- revision: null,
- createBy: null,
- createByName: null,
- createTime: null,
- updateBy: null,
- updateByName: null,
- updateTime: null,
- delFlag: 0,
- // 新增字段
- model: null,
- storageCondition: null,
- transportationCondition: null,
- }
- this.basicForm.puDemandItemList.push(newLine)
- // 补单需求状态改变
- if (this.basicForm.billType == 'BDXQ') {
- this.BDZT = false
- } else {
- this.BDZT = true
- }
- },
- delLine(index, row) {
- console.log('删除行:', index)
- console.log('改变行:', row)
- // this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
- // return item.id !== row.id
- // })
- row.delFlag = '2'
- // this.basicForm.puDemandItemList.splice(index,1)
- let delList = []
- delList = this.basicForm.puDemandItemList.filter(item => {
- return item.delFlag == '2'
- })
- this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
- return item.delFlag == '0'
- })
- this.delDemandItemList.push(...delList)
- console.log('删除的数组',this.delDemandItemList)
- },
- back() {
- this.$emit('jugislist', true)
- // let queryParams = {
- // pageNum: 1,
- // pageSize: 10
- // }
- this.$emit('refresh')
- },
- // 如果需要回显则调用详情接口
- getDetails(row) {
- getDemandDetail(row.id).then(res => {
- if (res.code === 200) {
- // this.basicForm = res.data
- let reciveForm = res.data
- let params = {...{id: row.id}, ...{pageNum:1, pageSize: 10}}
- getDemandSonDetail(params).then(res => {
- if (res.code === 200) {
- reciveForm.puDemandItemList = res.data
- console.log('reciveForm',reciveForm)
- this.basicForm = reciveForm
- if(this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
- if(this.basicForm.customer) { this.reBackRefer('CUSTOMER_PARAM', this.basicForm.customer) }
- if(this.basicForm.customerPrincipal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.customerPrincipal, '客户负责人') }
- if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
- if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
- // 详情时将收货仓库id赋值给stordocId
- // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
- if(this.basicForm.billType == 'BDXQ') {
- this.BDZT = false
- this.isBDXQ = true
- } else {
- this.BDZT = true
- this.isBDXQ = false
- }
- }
- })
- }
- })
- },
- // 单元格标红
- cellClassName({row, column, rowIndex, columnIndex}) {
- if(this.basicForm.isSpeical == 'N' && column.label == '需求可用周期' && Number(row.demandPeriod) > 1.5 && Number(row.demandPeriod) > Number(row.minOrderQty)) {
- return 'success-row';
- }
- },
- handleSelectionChange(selection) {
- this.ids = selection.map(item =>{
- return item.id
- })
- console.log('选中数组', this.ids)
- },
- // 点击预留单展示
- showReserved() {
- this.dialog.config = true
- },
- // 修改是否让页面显示与隐藏的事件
- updateReserved (val) {
- this.dialog.config = val
- },
- // 回显参照框
- reBackRefer(type, id, title) {
- getRefer({type: type, id: id}).then(res => {
- if(type == 'ORG_PARAM') {
- this.orgOptions = res.rows
- }
- if (type == 'CUSTOMER_PARAM') {
- this.customerOptions = res.rows
- }
- if (type == 'CONTACTS_PARAM' && title == '需求人员') {
- this.personOptions = res.rows
- }
- if (type == 'CONTACTS_PARAM' && title == '客户负责人') {
- this.manOptions = res.rows
- }
- if (type == 'DEPT_PARAM') {
- this.deptOptions = res.rows
- }
- })
- },
- chooseOrg(type, isPage, title) {
- this.referCondition.type = type
- this.referCondition.isPage = isPage
- this.referCondition.title = title
- this.$refs.refer.init(this.referCondition)
- },
- selectionsToInput(selection) {
- if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '选择组织') {
- this.orgOptions = selection
- this.basicForm.org = selection[0].id
- this.basicForm.orgName = selection[0].name
- }
- if(this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
- this.customerOptions = selection
- this.basicForm.customer = selection[0].id
- this.basicForm.customerName = selection[0].name
- this.basicForm.customerCode = selection[0].code
- if(this.basicForm.puDemandItemList.length !== 0) {
- this.basicForm.puDemandItemList.forEach(item => {
- item.demandCustomerName = this.basicForm.customerName
- item.demandCustomer = this.basicForm.customer
- item.status = ''
- item.buyerName = ''
- item.buyer = ''
- item.reservedProportion = ''
- item.reservedPeriod = ''
- item.reservedQty = ''
- item.averageQtyMonth = ''
- item.demandPeriod = ''
- item.forecastClassify = ''
- item.onemonthAvgVolume = ''
- item.threemonthAvgVolume = ''
- item.superiorAllotQty = ''
- item.resDemandQty = ''
- item.executeQty = ''
- item.deliveryWarehouseName = ''
- item.deliveryWarehouse = ''
- item.deliveryAllocationName = ''
- item.deliveryAllocation = ''
- item.lastWarehouseName = ''
- item.lastAllocationName = ''
- item.availableQty = ''
- item.lastStockOrgName = ''
- item.centralWarehouseQty = ''
- item.allotCode = ''
- item.deliveryAddress = ''
- item.deliveryAddressName = ''
- item.contacts = ''
- item.contactsPhone = ''
- item.address = ''
- })
- }
- }
- if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '需求人员') {
- this.personOptions = selection
- this.basicForm.demandPersonal = selection[0].code
- }
- if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '采购员') {
- this.purchaseManOptions = selection
- this.adjust.purchaseMan = selection[0].code
- this.adjust.purchaseManName = selection[0].name
- }
- if(this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '收货仓库') {
- this.adjust.warehouse = selection[0].id
- this.adjust.warehouseName = selection[0].name
- this.adjust.allocation = ''
- this.adjust.allocationName = ''
- }
- if(this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '收货货位') {
- this.adjust.allocation = selection[0].id
- this.adjust.allocationName = selection[0].name
- }
- if(this.referCondition.type == 'ADDRESS_PARAM' && this.referCondition.title == '收货地址') {
- this.adjust.deliveryAddressName = selection[0].name
- this.adjust.deliveryAddress = selection[0].code
- this.adjust.contacts = selection[0].contactsName
- this.adjust.contactsPhone = selection[0].contactsPhone
- this.adjust.address = selection[0].address
- }
- if(this.referCondition.type == 'DEPT_PARAM') {
- this.deptOptions = selection
- this.basicForm.demandDept = selection[0].id
- }
- // if(this.referCondition.type == 'DEPT_PARAM') {
- // this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].code
- // this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].name
- // }
- if(this.referCondition.title == '选择收货仓库') {
- this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
- this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
- }
- if(this.referCondition.title == '选择收货货位') {
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
- }
- if(this.referCondition.title == '选择补单供应商') {
- this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].id
- this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
- }
- if(this.referCondition.title == '选择收货地址') {
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
- this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
- this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
- this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
- }
- },
- // 粘贴来的数据
- pasteMe(e, scope, index) {
- e.preventDefault() //阻止默认粘贴事件
- let source = e.clipboardData.getData("Text");
- console.log('scope', scope.column.property)
- console.log('eee:', source)
- // 首先对源头进行解析
- let rows = source.split("\r\n"); // 拆成一个数组
- // rows.pop()
- console.log('复制的数组',rows);
- console.log('列表的数组',this.basicForm.puDemandItemList)
- rows.forEach(item => {
- console.log('items',item)
- // getRefer({ type: 'MATERIAL_PARAM', code: item }).then(res => {
- // })
- this.basicForm.puDemandItemList.push(this.basicForm.puDemandItemList[scope.$index])
- })
- console.log('列表', this.basicForm.puDemandItemList)
- // this.basicForm.puDemandItemList.forEach(e => {
- // rows.forEach(d => {
- // e.materialCode = d
- // })
- // })
- },
- // 明细行选择物料编码带出数据
- chooseMaterial(index) {
- console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
- this.tableIndex = index
- // 传0只展示同步NC了的物料
- this.$refs.materialRefer.init(0)
- },
- selectMaterial(selection) {
- console.log('选中的物料', selection)
- // 选择新物料时先清空行内其他信息
- this.basicForm.puDemandItemList[this.tableIndex].reservedProportion = null
- this.basicForm.puDemandItemList[this.tableIndex].reservedPeriod = null
- this.basicForm.puDemandItemList[this.tableIndex].reservedQty = null
- this.basicForm.puDemandItemList[this.tableIndex].qty = null
- this.basicForm.puDemandItemList[this.tableIndex].deliveryDate = null
- this.basicForm.puDemandItemList[this.tableIndex].remark = null
- this.basicForm.puDemandItemList[this.tableIndex].resDemandQty = null
- this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = null
- this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = null
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
- this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = null
- this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = null
- this.basicForm.puDemandItemList[this.tableIndex].periodUnit = null
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
- this.basicForm.puDemandItemList[this.tableIndex].contacts = null
- this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
- this.basicForm.puDemandItemList[this.tableIndex].address = null
- this.basicForm.puDemandItemList[this.tableIndex].priceType = 'order'
- this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = null
- this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null
- this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null
- this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = null
- this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOne = null
- this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwo = null
- this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThree = null
- this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFour = null
- this.basicForm.puDemandItemList[this.tableIndex].lastStockOrg = null
- this.basicForm.puDemandItemList[this.tableIndex].lastStockOrgName = null
- // 通过选择物料查询采购员
- queryMan(selection[0].id).then(res => {
- if(res.code === 200 && res.rows.length !== 0) {
- this.basicForm.puDemandItemList[this.tableIndex].buyer = res.rows[0].buyer
- this.basicForm.puDemandItemList[this.tableIndex].buyerName = res.rows[0].buyerName
- }
- })
- this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].businessDepartment
- this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].businessDepartmentName
- this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
- this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
- this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
- this.basicForm.puDemandItemList[this.tableIndex].classifyId = selection[0].classifyId
- this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
- this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
- this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass
- this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
- this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
- this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
- this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
- this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
- this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
- this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
- this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod
- this.basicForm.puDemandItemList[this.tableIndex].expiry = selection[0].usefulLife
- this.basicForm.puDemandItemList[this.tableIndex].expiryUnit = selection[0].expiryUnitIdName
- // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
- this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].minPackQty
- this.basicForm.puDemandItemList[this.tableIndex].minOrderQty = selection[0].minOrderQty
- this.basicForm.puDemandItemList[this.tableIndex].minBatch = selection[0].minBatchQty
- this.basicForm.puDemandItemList[this.tableIndex].safeStock = selection[0].safeStock
- this.basicForm.puDemandItemList[this.tableIndex].purOrgName = selection[0].purchasingOrganizationName
- this.basicForm.puDemandItemList[this.tableIndex].puOrg = selection[0].purchasingOrganization
- // 物料存储条件和运输条件
- this.basicForm.puDemandItemList[this.tableIndex].transportationCondition = selection[0].transportationCondition
- this.basicForm.puDemandItemList[this.tableIndex].storageCondition = selection[0].storageCondition
- // 选中骨科耗材时候的物料,需求客户不必填
-
- },
- // 明细行选择业务部门参照带出业务部门数据
- chooseDept(index, type, isPage, title) {
- this.tableIndex = index
- this.referCondition.type = type
- this.referCondition.isPage = isPage
- this.referCondition.title = title
- this.$refs.refer.init(this.referCondition)
- },
- // 明细行选择业务部门参照带出业务部门数据
- choosehuoWei(index, type, isPage, title, stordocId) {
- this.tableIndex = index
- this.referCondition.type = type
- this.referCondition.isPage = isPage
- this.referCondition.title = title
- // 选择收货货位前先选择收货仓库
- if(stordocId) {
- this.referCondition.stordocId = stordocId
- this.$refs.refer.init(this.referCondition)
- } else {
- this.$modal.msgWarning("请先选择收货仓库");
- }
- },
- // 明细行清空收货仓库,货位,收货地址档案等
- clearHang(index, title) {
- if (title == '选择收货仓库') {
- this.basicForm.puDemandItemList[index].deliveryWarehouseName = null
- this.basicForm.puDemandItemList[index].deliveryWarehouse = null
- this.basicForm.puDemandItemList[index].deliveryAllocationName = null
- this.basicForm.puDemandItemList[index].deliveryAllocation = null
- }
- if (title == '选择收货货位') {
- this.basicForm.puDemandItemList[index].deliveryAllocationName = null
- this.basicForm.puDemandItemList[index].deliveryAllocation = null
- }
- if (title == '选择收货地址') {
- this.basicForm.puDemandItemList[index].deliveryAddressName = null
- this.basicForm.puDemandItemList[index].deliveryAddress = null
- this.basicForm.puDemandItemList[index].contacts = null
- this.basicForm.puDemandItemList[index].contactsPhone = null
- this.basicForm.puDemandItemList[index].address = null
- }
- if (title == '选择补单供应商') {
- this.basicForm.puDemandItemList[index].additionalSupplierName = null
- this.basicForm.puDemandItemList[index].additionalSupplier = null
- }
- },
- // 清除需求客户将明细行内也清空
- cleanCustomer() {
- this.basicForm.customer = ''
- this.basicForm.customerName = ''
- this.basicForm.customerCode = ''
- if (this.basicForm.puDemandItemList.length !== 0) {
- this.basicForm.puDemandItemList.forEach(item => {
- item.demandCustomerName = ''
- item.demandCustomer = ''
- item.status = ''
- item.buyerName = ''
- item.buyer = ''
- item.reservedProportion = ''
- item.reservedPeriod = ''
- item.reservedQty = ''
- item.averageQtyMonth = ''
- item.demandPeriod = ''
- item.forecastClassify = ''
- item.onemonthAvgVolume = ''
- item.threemonthAvgVolume = ''
- item.superiorAllotQty = ''
- item.resDemandQty = ''
- item.executeQty = ''
- item.deliveryWarehouseName = ''
- item.deliveryWarehouse = ''
- item.deliveryAllocationName = ''
- item.deliveryAllocation = ''
- item.lastWarehouseName = ''
- item.lastAllocationName = ''
- item.availableQty = ''
- item.lastStockOrgName = ''
- item.centralWarehouseQty = ''
- item.allotCode = ''
- item.deliveryAddress = ''
- item.deliveryAddressName = ''
- item.contacts = ''
- item.contactsPhone = ''
- item.address = ''
- })
- }
- },
- // 批量调整
- adjustPl() {
- if(this.ids.length == 0) {
- this.$modal.msgWarning('请至少选择一项数据进行操作!')
- } else {
- this.adjust.open = true
- }
- },
- // 批量调整确认
- confirmAdjust() {
- console.log('data', this.adjust)
- this.basicForm.puDemandItemList.forEach(item => {
- this.ids.some(val => {
- if(val == item.id) {
- if(this.adjust.purchaseMan) {
- item.buyer = this.adjust.purchaseMan
- item.buyerName = this.adjust.purchaseManName
- }
- if(this.adjust.priceType) {
- item.priceType = this.adjust.priceType
- }
- if(this.adjust.warehouseName) {
- item.deliveryWarehouse = this.adjust.warehouse
- item.deliveryWarehouseName = this.adjust.warehouseName
- item.deliveryAllocation = this.adjust.allocation
- item.deliveryAllocationName = this.adjust.allocationName
- }
- // if(this.adjust.allocationName) {
- // item.deliveryAllocation = this.adjust.allocation
- // item.deliveryAllocationName = this.adjust.allocationName
- // }
- if(this.adjust.remark) {
- item.remark = this.adjust.remark
- }
- if(this.adjust.deliveryAddressName) {
- item.deliveryAddressName = this.adjust.deliveryAddressName
- item.deliveryAddress = this.adjust.deliveryAddress
- item.contacts = this.adjust.contacts
- item.contactsPhone = this.adjust.contactsPhone
- item.address = this.adjust.address
- }
- }
- this.adjust.open = false
- })
- })
- },
- // 批量调整选择货位
- adjustHuoWei(type, isPage, title, stordocId) {
- this.referCondition.type = type
- this.referCondition.isPage = isPage
- this.referCondition.title = title
- // 选择收货货位前先选择收货仓库
- if (stordocId) {
- this.referCondition.stordocId = stordocId
- this.$refs.refer.init(this.referCondition)
- } else {
- this.$modal.msgWarning("请先选择收货仓库");
- }
- },
- // 关闭清空批量调整数据
- closeEvent() {
- this.adjust = {
- open: false,
- priceType: '',
- purchaseMan: '',
- purchaseManName: '',
- warehouse: '',
- warehouseName: '',
- allocation: '',
- allocationName: '',
- remark: '',
- deliveryAddress: '',
- deliveryAddressName: '',
- contacts: '',
- contactsPhone: '',
- address: ''
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .btn_group {
- width: 100%;
- margin: 20px 0;
- display: flex;
- justify-content: center;
- }
- .btn_grooup {
- margin-bottom: 10px;
- display: flex;
- justify-content: flex-end;
- }
- .hang {
- margin: auto;
- }
- .hang ::v-deep .el-form-item__content{
- margin-left: 0px !important;
- }
- .el-table ::v-deep .el-form-item__error{
- padding-top: 0;
- top: 70%
- }
- .el-table ::v-deep .success-row {
- background: #f11616;
- }
- </style>
|