123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995 |
- <template>
- <div id="addDemandList">
- <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="small"
- disabled
- style="width: 200px"
- />
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="组织">
- <el-select size="small" 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="small" 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="small" 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 size="small" v-model="basicForm.customer" :disabled="sonDisable" @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="small" style="width: 200px"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="客户负责人">
- <el-input disabled v-model="basicForm.customerPrincipal" size="small" style="width: 200px"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求人员">
- <el-select size="small" 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.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求部门">
- <el-select v-model="basicForm.demandDept" size="small" :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="需求日期">
- <el-date-picker
- v-model="basicForm.demandDate"
- disabled
- type="date"
- value-format="yyyy-MM-dd"
- size="small"
- 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="small" 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="供应仓库">
- <el-select size="small" v-model="basicForm.warehouse" :disabled="sonDisable" @focus="chooseOrg('WAREHOUSE_PARAM', true, '供应仓库')" style="width: 200px">
- <el-option v-for="item in houseOptions" :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 size="small" v-model="basicForm.goodsAllocation" :disabled="sonDisable" @focus="chooseOrg('ALLOCATION_PARAM', true, '供应货位')" style="width: 200px">
- <el-option v-for="item in goodsOptions" :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 v-model="basicForm.billType" :disabled="sonDisable" size="small" 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 v-model="basicForm.isSpeical" :disabled="sonDisable" size="small" 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="small"
- placeholder=""
- clearable
- style="width: 200px"
- />
- </el-form-item>
- </el-col> -->
- <el-col :span="1.5">
- <el-form-item label="是否月销量计算">
- <el-input
- v-model="basicForm.isMonthleyCalculate"
- size="small"
- disabled
- style="width: 200px"
- />
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="备注">
- <el-input
- v-model="basicForm.remark"
- size="small"
- :disabled="sonDisable"
- clearable
- style="width: 200px"
- />
- </el-form-item>
- </el-col>
- </el-row>
-
- <span>明细信息</span>
- <el-card>
- <div class="btn_grooup">
- <el-button type="primary" size="small" @click="addLine" v-if="!sonDisable">增行</el-button>
- <el-button type="primary" size="small" v-if="!sonDisable">批量调整</el-button>
- <el-button type="primary" size="small" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
- </div>
- <el-table
- :data="basicForm.puDemandItemList"
- fit
- max-height="300"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection"/>
- <el-table-column label="序号" type="index" align="center"/>
- <el-table-column label="行状态" align="center" prop="status" />
- <el-table-column label="行号" align="center" prop="rowNo" />
- <el-table-column label="业务部门名称" align="center" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.businessDeptName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="业务部门" align="center" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.businessDept">
- <!-- <el-button :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'DEPT_PARAM', true, '选择部门')"></el-button> -->
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="一级品类" align="center" prop="materialClassifyOneName" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.materialClassifyOneName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="二级品类" align="center" prop="materialClassifyTwoName" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.materialClassifyTwoName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="三级品类" align="center" prop="materialClassifyThreeName" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.materialClassifyThreeName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="四级品类" align="center" prop="materialClassifyFourName" width="180px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.materialClassifyFourName"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="预留比例" align="center" prop="reservedProportion" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-select :disabled="sonDisable" size="small" v-model="scope.row.reservedProportion">
- <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 label="预留周期" align="center" prop="reservedPeriod" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input :readonly="sonDisable" size="small" v-model="scope.row.reservedPeriod"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="预留数量" align="center" prop="reservedQty" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input :readonly="sonDisable" size="small" v-model="scope.row.reservedQty"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="采购员名称" align="center" prop="buyerName" width="120px"/>
- <el-table-column label="采购员" align="center" prop="buyer"/>
- <el-table-column label="物料编码" align="center" prop="materialCode" width="230px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.materialCode">
- <el-button size="small" :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 label="物料名称" align="center" prop="materialName" width="230px" />
- <el-table-column label="规格" align="center" prop="specification" />
- <el-table-column label="型号" align="center" prop="model" />
- <el-table-column label="单位" align="center" prop="unit" />
- <el-table-column label="生产厂家/代理人" align="center" prop="manufacturerName" width="230px"/>
- <el-table-column label="注册人" align="center" prop="registrant" width="150px"/>
- <el-table-column label="采购周期" align="center" prop="puPeriod" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input :readonly="sonDisable" size="small" v-model="scope.row.puPeriod"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="有效期单位" align="center" prop="expiryUnit" width="120px"/>
- <el-table-column label="有效期" align="center" prop="expiry" width="120px"/>
- <el-table-column label="最小包装" align="center" prop="minPackage" width="120px"/>
- <el-table-column label="最小订货量" align="center" prop="minOrderQty" width="120px"/>
- <el-table-column label="最小批量" align="center" prop="minBatch" width="120px"/>
- <el-table-column label="安全库存" align="center" prop="safeStock" width="120px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input :readonly="sonDisable" size="small" v-model="scope.row.safeStock"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="月均销量" align="center" prop="averageQtyMonth" width="120px"/>
- <el-table-column label="实际(业务)需求量" align="center" prop="qty" width="120px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input :readonly="sonDisable" size="small" v-model="scope.row.qty"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="需求可用周期" align="center" prop="demandPeriod" width="120px"/>
- <el-table-column label="集团预测分类" align="center" prop="forecastClassify" width="120px"/>
- <el-table-column label="交货日期" align="center" prop="deliveryDate" width="230px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-date-picker
- v-model="scope.row.deliveryDate"
- :readonly="sonDisable"
- type="datetime"
- size="small"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期">
- </el-date-picker>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="补单标识" align="center" prop="isReplenishment" width="100px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-switch
- v-model="scope.row.isReplenishment"
- :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 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 label="业务备注" align="center" prop="remark" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input :readonly="sonDisable" size="small" v-model="scope.row.remark"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="采购备注" align="center" prop="puRemark" width="150px"/>
- <!-- <el-table-column label="末级供应仓库存量" align="center" prop="lastWarehouseQty" /> -->
- <!-- <el-table-column label="调拨占有量" align="center" prop="superiorAllotQty"></el-table-column> -->
- <el-table-column label="最终净需求量" align="center" prop="resDemandQty" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input :readonly="sonDisable" size="small" v-model="scope.row.resDemandQty"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="末级供应仓库" align="center" prop="lastWarehouseName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.lastWarehouseName">
- <el-button size="small" :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 label="收货仓库" align="center" prop="deliveryWarehouseName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.deliveryWarehouseName">
- <el-button size="small" :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 label="末级供应货位" align="center" prop="lastAllocationName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.lastAllocationName">
- <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ALLOCATION_PARAM', true, '选择末级供应货位')"></el-button>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="收货货位编码" align="center" prop="deliveryAllocation" width="200px"/>
- <el-table-column label="收货货位" align="center" prop="deliveryAllocationName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.deliveryAllocationName">
- <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位')"></el-button>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="紧急标识" align="center" prop="isUrgency" width="100px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-switch
- v-model="scope.row.isUrgency"
- :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 label="默认采购组织" align="center" prop="purOrgName" width="200px"/>
- <el-table-column label="默认采购组织编码" align="center" prop="puOrg" width="200px"/>
- <el-table-column label="末级供应调拨待入量" align="center" prop="lastStockQty" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input :readonly="sonDisable" size="small" v-model="scope.row.lastStockQty"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="上级供应中心现存量" align="center" prop="superiorCenterQty" width="200px"/>
- <el-table-column label="上级库存被调拨占用量" align="center" prop="superiorAllotQty" width="200px"/>
- <el-table-column label="可用量" align="center" prop="availableQty"/>
- <el-table-column 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 label="补单供应商编码" align="center" prop="additionalSupplier" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.additionalSupplier">
- <el-button size="small" :disabled="sonDisable" 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 label="补单供应商名称" align="center" prop="additionalSupplierCode" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.additionalSupplierCode"/>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="周期单位" align="center" prop="periodUnit" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-select :disabled="sonDisable" size="small" 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-input v-model="scope.row.periodUnit"/> -->
- </el-form-item>
- </template>
- </el-table-column>
- <!-- <el-table-column label="需求客户" align="center" prop="customer">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input v-model="scope.row.customer"/>
- </el-form-item>
- </template>
- </el-table-column> -->
- <el-table-column label="末级供应库存组织" align="center" prop="superiorStockOrgName" width="200px"></el-table-column>
- <el-table-column label="中心仓可用量" align="center" prop="updateTime" width="200px"></el-table-column>
- <el-table-column label="调拨单号" align="center" prop="allotCode"></el-table-column>
- <el-table-column label="收货地址" align="center" prop="deliveryAddressName" width="200px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-input readonly size="small" v-model="scope.row.deliveryAddressName">
- <el-button size="small" :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 label="收货地址编码" align="center" prop="deliveryAddress" width="200px"></el-table-column>
- <el-table-column label="联系人" align="center" prop="contacts"/>
- <el-table-column label="联系人电话" align="center" prop="contactsPhone" width="200px"/>
- <el-table-column label="详细地址" align="center" prop="address" width="200px"/>
- <el-table-column label="价格类型" align="center" prop="priceType" width="150px">
- <template slot-scope="scope">
- <el-form-item class="hang">
- <el-select :disabled="sonDisable" size="small" 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="small" :disabled="sonDisable" @click="delLine(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- </el-form>
- <div class="btn_group">
- <el-col :span="1.5">
- <el-button type="primary" size="small" plain @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="primary" size="small" 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="small" plain @click="submit" v-if="sonPageStu == 'check'">提交</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button size="small" 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>
- </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,
- dialog: {
- config: false
- },
- basicForm: {
- code: '',
- org: '',
- orgName: '',
- demandBusinessType: '1',
- status: '0',
- customer: '',
- customerName: '',
- customerCode: '',
- customerPrincipal: '',
- demandPersonal: '',
- demandDept: '',
- demandDate: '',
- source: '1',
- warehouse: '',
- goodsAllocation: '',
- billType: '',
- isSpeical: '',
- isProcess: '',
- isMonthleyCalculate: '',
- remark: '',
- puDemandItemList: []
- },
- options: [{
- value: '0', label: '是',
- }, {
- value: '2', label: '否'
- }],
- basicRules: {},
- tableList: [],
- referCondition: {
- type: 'ORG_PARAM',
- isPage: true,
- title: '选择组织',
- pkOrg: '',
- },
- referConditionMx: {
- type: 'DEPT_PARAM',
- isPage: true,
- title: '选择部门'
- },
- tableIndex: null,
- orgOptions: [],
- personOptions: [],
- deptOptions: [],
- customerOptions: [],
- houseOptions: [],
- goodsOptions: []
- }
- },
- created() {
- if(this.pageStu == 'check') {
- console.log('数据', this.row)
- this.getDetails(this.row)
- } else if(this.pageStu == 'edit') {
- this.getDetails(this.row)
- }
- },
- methods: {
- copy() {
- this.$modal.msgSuccess("复制成功");
- this.sonPageStu = 'add'
- this.sonDisable = false
- this.getDetails(this.row)
- this.basicForm.id = ''
- this.basicForm.code = ''
- },
- handleData() {
- console.log('222')
- // 复制新增把id,编码置为空,子表去掉id
- this.basicForm.id = ''
- this.basicForm.code = ''
- if (this.basicForm.puDemandItemList.length !== 0) {
- this.basicForm.puDemandItemList.forEach(item => {
- if (item.id) {
- delete item.id
- }
- if (item.demandId) {
- delete item.demandId
- }
- })
- }
- },
- async save() {
- if(this.sonPageStu == 'add') {
- await this.handleData()
- await addDemand(this.basicForm).then(res => {
- console.log(333)
- if (res.code === 200) {
- this.$modal.msgSuccess("保存成功");
- this.back()
- }
- })
- } else if (this.sonPageStu == 'edit') {
- editDemand(this.basicForm).then(res => {
- if (res.code === 200) {
- this.$modal.msgSuccess("编辑成功");
- this.back()
- }
- })
- }
- },
- submit() {
- submitDemand(this.basicForm).then(res => {
- if (res.code === 200) {
- this.$modal.msgSuccess("提交成功");
- this.back()
- }
- })
- },
- // 增行
- 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,
- 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,
- deliveryDate: null,
- isUrgency: 'N',
- isReplenishment: '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,
- additionalSupplierCode: null,
- periodUnit: null,
- demandCustomer: null,
- demandCustomerName: null,
- lastStockOrg: null,
- lastStockOrgName: null,
- superiorStockOrg: null,
- superiorStockOrgName: null,
- allotCode: null,
- deliveryAddress: null,
- deliveryAddressName: null,
- contacts: null,
- contactsPhone: null,
- address: null,
- source: null,
- priceType: null,
- 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: null,
- // 新增字段
- model: null,
- }
- this.basicForm.puDemandItemList.push(newLine)
- },
- delLine(index) {
- console.log('删除行:', index)
- // this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
- // return item.id !== row.id
- // })
- this.basicForm.puDemandItemList.splice(index,1)
- },
- back() {
- this.$emit('jugislist', true)
- let queryParams = {
- pageNum: 1,
- pageSize: 10
- }
- this.$emit('refresh', queryParams)
- },
- // 如果需要回显则调用详情接口
- 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.rows
- 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.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal) }
- if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
- if(this.basicForm.warehouse) { this.reBackRefer('WAREHOUSE_PARAM', this.basicForm.warehouse) }
- if(this.basicForm.goodsAllocation) { this.reBackRefer('ALLOCATION_PARAM', this.basicForm.goodsAllocation) }
- }
- console.log('111')
- })
- }
- })
- },
- handleSelectionChange() {},
- // 点击预留单展示
- showReserved() {
- this.dialog.config = true
- },
- // 修改是否让页面显示与隐藏的事件
- updateReserved (val) {
- this.dialog.config = val
- },
- // 回显参照框
- reBackRefer(type, id) {
- 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') {
- this.personOptions = res.rows
- }
- if (type == 'DEPT_PARAM') {
- this.deptOptions = res.rows
- }
- if (type == 'WAREHOUSE_PARAM') {
- this.houseOptions = res.rows
- }
- if (type == 'ALLOCATION_PARAM') {
- this.goodsOptions = res.rows
- }
- })
- },
- chooseOrg(type, isPage, title) {
- this.referCondition.type = type
- this.referCondition.isPage = isPage
- this.referCondition.title = title
- // 选择货位时要传入组织id
- this.referCondition.pkOrg = this.basicForm.org
- this.$refs.refer.init(this.referCondition)
- },
- selectionsToInput(selection) {
- if(this.referCondition.type == 'ORG_PARAM') {
- this.orgOptions = selection
- this.basicForm.org = selection[0].id
- this.basicForm.orgName = selection[0].name
- }
- if(this.referCondition.type == 'CUSTOMER_PARAM') {
- this.customerOptions = selection
- this.basicForm.customer = selection[0].id
- this.basicForm.customerName = selection[0].name
- this.basicForm.customerCode = selection[0].code
- }
- if(this.referCondition.type == 'CONTACTS_PARAM') {
- this.personOptions = selection
- this.basicForm.demandPersonal = selection[0].id
- }
- if(this.referCondition.type == 'DEPT_PARAM') {
- this.deptOptions = selection
- this.basicForm.demandDept = selection[0].id
- }
- if(this.referCondition.type == 'WAREHOUSE_PARAM') {
- this.houseOptions = selection
- this.basicForm.warehouse = selection[0].id
- }
- if(this.referCondition.type == 'ALLOCATION_PARAM') {
- this.goodsOptions = selection
- this.basicForm.goodsAllocation = selection[0].id
- }
- // if(this.referConditionMx.type == 'DEPT_PARAM') {
- // this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].code
- // this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].name
- // }
- if(this.referConditionMx.title == '选择末级供应仓库') {
- this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = selection[0].name
- }
- if(this.referConditionMx.title == '选择收货仓库') {
- this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
- }
- if(this.referConditionMx.title == '选择末级供应货位') {
- this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = selection[0].name
- }
- if(this.referConditionMx.title == '选择收货货位') {
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].code
- this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
- }
- if(this.referConditionMx.title == '选择补单供应商') {
- this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].code
- this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierCode = selection[0].name
- }
- if(this.referConditionMx.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
- }
- },
- // 明细行选择物料编码带出数据
- chooseMaterial(index) {
- console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
- this.tableIndex = index
- this.$refs.materialRefer.init()
- },
- selectMaterial(selection) {
- console.log('选中的物料', selection)
- // 通过选择物料查询采购员
- 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].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].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
- },
- // 明细行选择业务部门参照带出业务部门数据
- chooseDept(index, type, isPage, title) {
- this.tableIndex = index
- this.referConditionMx.type = type
- this.referConditionMx.isPage = isPage
- this.referConditionMx.title = title
- this.$refs.refer.init(this.referConditionMx)
- }
- }
- }
- </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;
- }
- </style>
|