add.vue 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785
  1. <template>
  2. <div id="addDemandList">
  3. <el-card style="position: relative;">
  4. <span>基本信息</span>
  5. <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto" :show-message="false">
  6. <el-row :gutter="10">
  7. <el-col :span="1.5">
  8. <el-form-item label="业务类型" prop="billType" :rules="{ required: true, message: '请选择业务类型', trigger: 'blur' }">
  9. <el-select clearable v-model="basicForm.billType" @change="changeBillType" :disabled="sonDisable" size="mini" style="width: 200px">
  10. <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="1.5">
  16. <el-form-item label="需求客户">
  17. <el-select clearable size="mini" v-model="basicForm.customer" :disabled="sonDisable" @clear="cleanCustomer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
  18. <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
  19. </el-select>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="1.5">
  23. <el-form-item label="需求人员">
  24. <el-select clearable size="mini" v-model="basicForm.demandPersonal" :disabled="sonDisable" @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')" style="width: 200px">
  25. <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
  26. </el-select>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="1.5">
  30. <el-form-item label="需求部门">
  31. <el-select clearable v-model="basicForm.demandDept" size="mini" :disabled="sonDisable" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
  32. <el-option
  33. v-for="item in deptOptions"
  34. :key="item.id"
  35. :label="item.name"
  36. :value="item.id">
  37. </el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="1.5">
  42. <el-form-item label="需求计划">
  43. <el-select v-model="basicForm.planType" size="mini" style="width: 200px">
  44. <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
  45. </el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-form-item label="需求日期" prop="demandDate" :rules="{ required: true, message: '请选择需求日期', trigger: 'blur' }">
  51. <el-date-picker
  52. v-model="basicForm.demandDate"
  53. :disabled="sonDisable"
  54. clearable
  55. type="date"
  56. value-format="yyyy-MM-dd"
  57. @change="changeDemandDate"
  58. size="mini"
  59. style="width: 200px"
  60. >
  61. </el-date-picker>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="1.5">
  65. <el-form-item label="制单日期" prop="createTime">
  66. <el-date-picker
  67. v-model="basicForm.createTime"
  68. :disabled="sonDisable"
  69. clearable
  70. type="date"
  71. value-format="yyyy-MM-dd"
  72. size="mini"
  73. style="width: 200px"
  74. >
  75. </el-date-picker>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="1.5">
  79. <el-form-item label="是否客户指定">
  80. <el-select clearable v-model="basicForm.isSpeical" :disabled="sonDisable" size="mini" style="width: 200px">
  81. <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
  82. </el-option>
  83. </el-select>
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="1.5">
  87. <el-form-item label="备注">
  88. <el-input
  89. v-model.trim="basicForm.remark"
  90. size="mini"
  91. :disabled="sonDisable"
  92. clearable
  93. style="width: 200px"
  94. />
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="1.5">
  98. <el-form-item label="需求客户名称">
  99. <el-input disabled v-model="basicForm.customerName" size="mini" style="width: 200px"></el-input>
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="1.5">
  103. <el-form-item label="编码">
  104. <el-input
  105. v-model="basicForm.code"
  106. size="mini"
  107. disabled
  108. style="width: 200px"
  109. />
  110. </el-form-item>
  111. </el-col>
  112. <!-- <el-col :span="1.5">
  113. <el-form-item label="组织" prop="org" :rules="{ required: true, message: '请选择组织', trigger: 'blur' }">
  114. <el-select clearable size="mini" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
  115. <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
  116. </el-select>
  117. </el-form-item>
  118. </el-col> -->
  119. <el-col :span="1.5">
  120. <el-form-item label="单据状态">
  121. <el-select disabled v-model="basicForm.status" size="mini" style="width: 200px">
  122. <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
  123. </el-option>
  124. </el-select>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="1.5">
  128. <el-form-item label="客户负责人">
  129. <el-select disabled size="mini" v-model="basicForm.customerPrincipal" style="width: 200px">
  130. <el-option v-for="item in manOptions" :key="item.id" :label="item.name" :value="item.code"/>
  131. </el-select>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="1.5">
  135. <el-form-item label="单据来源">
  136. <el-select v-model="basicForm.source" disabled size="mini" style="width: 200px">
  137. <el-option v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
  138. </el-option>
  139. </el-select>
  140. </el-form-item>
  141. </el-col>
  142. </el-row>
  143. <div class="btn_grooup">
  144. <span>明细信息</span>
  145. <div>
  146. <el-button type="primary" size="mini" @click="addLine" v-if="!sonDisable">增行</el-button>
  147. <el-button type="primary" size="mini" v-if="!sonDisable" @click="adjustPl">批量调整</el-button>
  148. <el-button type="primary" size="mini" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
  149. </div>
  150. </div>
  151. <el-table
  152. :data="basicForm.puDemandItemList"
  153. fit
  154. border
  155. :cell-style="{ borderColor: '#c0c0c0' }"
  156. :header-cell-style="{ borderColor: '#c0c0c0' }"
  157. class="exporttable"
  158. height="410"
  159. max-height="410"
  160. style="font-size: 12px;"
  161. @selection-change="handleSelectionChange"
  162. :cell-class-name="cellClassName"
  163. >
  164. <el-table-column show-overflow-tooltip type="selection" fixed="left"/>
  165. <el-table-column show-overflow-tooltip label="序号" type="index" align="center" width="50px" fixed="left"/>
  166. <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo">
  167. <template slot-scope="scope">
  168. {{ scope.$index + 1 + '0' }}
  169. </template>
  170. </el-table-column>
  171. <el-table-column show-overflow-tooltip label="默认采购组织" align="center" prop="purOrgName" width="200px"/>
  172. <el-table-column show-overflow-tooltip label="需求客户" align="center" prop="demandCustomerName" width="180px"/>
  173. <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" :formatter="hangStatus" width="100px"/>
  174. <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="220px" :render-header="addRedStar">
  175. <template slot-scope="scope">
  176. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'materialCode'" :show-message="false" :rules="{ required: true, message: '请选择物料编码', trigger: 'blur' }">
  177. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.materialCode" @paste.native="pasteMe($event, scope, scope.$index)">
  178. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
  179. </el-input>
  180. </el-form-item>
  181. </template>
  182. </el-table-column>
  183. <el-table-column show-overflow-tooltip label="物料名称" align="center" prop="materialName" width="200px" />
  184. <el-table-column show-overflow-tooltip label="规格" align="center" prop="specification" />
  185. <el-table-column show-overflow-tooltip label="型号" align="center" prop="model"/>
  186. <el-table-column show-overflow-tooltip label="单位" align="center" prop="unitName"/>
  187. <el-table-column show-overflow-tooltip label="生产厂家/代理人" align="center" prop="manufacturerName" width="230px"/>
  188. <el-table-column show-overflow-tooltip label="最小包装" align="center" prop="minPackage" width="100px"/>
  189. <el-table-column show-overflow-tooltip label="实际(业务)需求量" align="center" prop="qty" width="150px" :render-header="addRedStar">
  190. <template slot-scope="scope">
  191. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'qty'" :show-message="false" :rules="{ required: true, message: '请填写实际(业务)需求量', trigger: 'blur' }">
  192. <el-input type="number" min="0" clearable :disabled="sonDisable" size="mini" v-model="scope.row.qty" @input="getYLSL(scope)"/>
  193. </el-form-item>
  194. </template>
  195. </el-table-column>
  196. <el-table-column show-overflow-tooltip label="紧急标识" align="center" prop="isUrgency" width="100px">
  197. <template slot-scope="scope">
  198. <el-form-item class="hang">
  199. <el-switch
  200. v-model="scope.row.isUrgency"
  201. :disabled="sonDisable"
  202. active-value="Y"
  203. inactive-value="N"
  204. active-color="#13ce66"
  205. inactive-color="#a1a3a9">
  206. </el-switch>
  207. </el-form-item>
  208. </template>
  209. </el-table-column>
  210. <el-table-column show-overflow-tooltip label="收货仓库" align="center" prop="deliveryWarehouseName" width="200px">
  211. <template slot-scope="scope">
  212. <el-form-item class="hang">
  213. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryWarehouseName" @clear="clearHang(scope.$index, '选择收货仓库')" @focus="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')">
  214. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')"></el-button>
  215. </el-input>
  216. </el-form-item>
  217. </template>
  218. </el-table-column>
  219. <el-table-column show-overflow-tooltip label="收货货位" align="center" prop="deliveryAllocationName" width="200px">
  220. <template slot-scope="scope">
  221. <el-form-item class="hang">
  222. <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)">
  223. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)"></el-button>
  224. </el-input>
  225. </el-form-item>
  226. </template>
  227. </el-table-column>
  228. <el-table-column show-overflow-tooltip label="月均销量" align="center" prop="averageQtyMonth" width="100px"/>
  229. <el-table-column show-overflow-tooltip label="需求可用周期" align="center" prop="demandPeriod" width="120px"/>
  230. <el-table-column show-overflow-tooltip label="业务备注" align="center" prop="remark" width="150px">
  231. <template slot-scope="scope">
  232. <el-form-item class="hang">
  233. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.remark"/>
  234. </el-form-item>
  235. </template>
  236. </el-table-column>
  237. <el-table-column show-overflow-tooltip label="物料一级分类" align="center" prop="materialClassifyOneName" width="150px"/>
  238. <el-table-column show-overflow-tooltip label="物料二级分类" align="center" prop="materialClassifyTwoName" width="150px"/>
  239. <el-table-column show-overflow-tooltip label="物料三级分类" align="center" prop="materialClassifyThreeName" width="150px"/>
  240. <el-table-column show-overflow-tooltip label="物料四级分类" align="center" prop="materialClassifyFourName" width="150px"/>
  241. <el-table-column show-overflow-tooltip label="最小批量" align="center" prop="minBatch" width="100px"/>
  242. <el-table-column show-overflow-tooltip label="最小订货量" align="center" prop="minOrderQty" width="120px"/>
  243. <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyerName" width="100px"/>
  244. <!-- <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyer"/> -->
  245. <el-table-column show-overflow-tooltip label="采购周期" align="center" prop="puPeriod" width="120px"/>
  246. <el-table-column show-overflow-tooltip label="交货日期" align="center" prop="deliveryDate" width="230px">
  247. <template slot-scope="scope">
  248. <el-form-item class="hang">
  249. <el-date-picker
  250. v-model="scope.row.deliveryDate"
  251. :disabled="sonDisable"
  252. clearable
  253. type="date"
  254. size="mini"
  255. value-format="yyyy-MM-dd"
  256. :picker-options="pickerOptionsEnd"
  257. placeholder="选择日期">
  258. </el-date-picker>
  259. </el-form-item>
  260. </template>
  261. </el-table-column>
  262. <el-table-column show-overflow-tooltip label="有效期" align="center" prop="expiry" width="100px"/>
  263. <el-table-column show-overflow-tooltip label="有效期单位" align="center" prop="expiryUnit" width="100px"/>
  264. <el-table-column show-overflow-tooltip label="安全库存" align="center" prop="safeStock" width="100px"/>
  265. <el-table-column show-overflow-tooltip label="注册人" align="center" prop="registrant" width="100px"/>
  266. <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="120px">
  267. <template slot-scope="scope">
  268. <el-form-item class="hang">
  269. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @change="getYLSL(scope)" @clear="cleanYLSL(scope)">
  270. <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
  271. </el-option>
  272. </el-select>
  273. </el-form-item>
  274. </template>
  275. </el-table-column>
  276. <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="120px">
  277. <template slot-scope="scope">
  278. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'reservedPeriod'" :rules="{ required: scope.row.reservedProportion && scope.row.reservedProportion !== '' , message: '请填写预留周期', trigger: 'blur' }">
  279. <el-input type="number" min="0" clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedPeriod"></el-input>
  280. </el-form-item>
  281. </template>
  282. </el-table-column>
  283. <el-table-column show-overflow-tooltip label="预留数量" align="center" prop="reservedQty" width="120px"/>
  284. <el-table-column show-overflow-tooltip label="集团预测分类" align="center" prop="forecastClassify" width="120px"/>
  285. <el-table-column show-overflow-tooltip label="近一月需求" align="center" prop="onemonthAvgVolume" width="100px"/>
  286. <el-table-column show-overflow-tooltip label="近三月需求" align="center" prop="threemonthAvgVolume" width="100px"/>
  287. <el-table-column show-overflow-tooltip label="采购在途" align="center" prop="puFreight" width="100px"/>
  288. <el-table-column show-overflow-tooltip label="补单标识" align="center" prop="isReplenishment" width="100px">
  289. <template slot-scope="scope">
  290. <el-form-item class="hang">
  291. <el-switch
  292. v-model="scope.row.isReplenishment"
  293. disabled
  294. active-value="Y"
  295. inactive-value="N"
  296. active-color="#13ce66"
  297. inactive-color="#a1a3a9">
  298. </el-switch>
  299. </el-form-item>
  300. </template>
  301. </el-table-column>
  302. <el-table-column show-overflow-tooltip label="补单供应商" align="center" prop="additionalSupplierName" width="200px" :render-header="anotherRedStar">
  303. <template slot-scope="scope">
  304. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'additionalSupplierName'" :rules="{ required: isBDXQ, message: '请选择补单供应商', trigger: 'blur' }">
  305. <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.$index, '选择补单供应商')" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
  306. <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
  307. </el-input>
  308. </el-form-item>
  309. </template>
  310. </el-table-column>
  311. <el-table-column show-overflow-tooltip label="末级供应库存组织" align="center" prop="lastStockOrgName" width="180px"></el-table-column>
  312. <el-table-column show-overflow-tooltip label="末级供应仓库" align="center" prop="lastWarehouseName" width="150px"/>
  313. <el-table-column show-overflow-tooltip label="末级供应货位" align="center" prop="lastAllocationName" width="150px"/>
  314. <el-table-column show-overflow-tooltip label="中心仓可用量" align="center" prop="centralWarehouseQty" width="120px"/>
  315. <el-table-column show-overflow-tooltip label="调拨状态" align="center" prop="statusAllot" width="100px">
  316. <template slot-scope="scope">
  317. <el-form-item class="hang">
  318. <el-switch
  319. v-model="scope.row.statusAllot"
  320. :disabled="sonDisable"
  321. active-value="Y"
  322. inactive-value="N"
  323. active-color="#13ce66"
  324. inactive-color="#a1a3a9">
  325. </el-switch>
  326. </el-form-item>
  327. </template>
  328. </el-table-column>
  329. <el-table-column show-overflow-tooltip label="调拨单号" align="center" prop="allotCode"></el-table-column>
  330. <el-table-column show-overflow-tooltip label="调拨占有量" align="center" prop="allotQty" width="100px"/>
  331. <el-table-column show-overflow-tooltip label="最终净需求量" align="center" prop="resDemandQty" width="120px"/>
  332. <el-table-column show-overflow-tooltip label="最终采购执行数量" align="center" prop="executeQty" width="150px">
  333. <template slot-scope="scope">
  334. {{ scope.row.executeQty ? scope.row.executeQty : 0 }}
  335. </template>
  336. </el-table-column>
  337. <el-table-column show-overflow-tooltip label="收货地址" align="center" prop="deliveryAddressName" width="200px">
  338. <template slot-scope="scope">
  339. <el-form-item class="hang">
  340. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAddressName" @clear="clearHang(scope.$index, '选择收货地址')" @focus="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')">
  341. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
  342. </el-input>
  343. </el-form-item>
  344. </template>
  345. </el-table-column>
  346. <el-table-column show-overflow-tooltip label="联系人" align="center" prop="contacts"/>
  347. <el-table-column show-overflow-tooltip label="联系人电话" align="center" prop="contactsPhone" width="150px"/>
  348. <el-table-column show-overflow-tooltip label="详细地址" align="center" prop="address" width="200px"/>
  349. <el-table-column show-overflow-tooltip label="价格类型" align="center" prop="priceType" width="120px">
  350. <template slot-scope="scope">
  351. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'priceType'" :show-message="false" :rules="{ required: true, message: '请选择价格类型', trigger: 'blur' }">
  352. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.priceType">
  353. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  354. </el-option>
  355. </el-select>
  356. </el-form-item>
  357. </template>
  358. </el-table-column>
  359. <el-table-column show-overflow-tooltip label="是否客户指定" align="center" prop="isSpeical" width="120px">
  360. <template slot-scope="scope">
  361. <el-form-item class="hang">
  362. <el-switch
  363. v-model="scope.row.isSpeical"
  364. disabled
  365. active-value="Y"
  366. inactive-value="N"
  367. active-color="#13ce66"
  368. inactive-color="#a1a3a9">
  369. </el-switch>
  370. </el-form-item>
  371. </template>
  372. </el-table-column>
  373. <!-- <el-table-column show-overflow-tooltip label="批号锁定标识" align="center" prop="isBatchLock" width="100px">
  374. <template slot-scope="scope">
  375. <el-form-item class="hang">
  376. <el-switch
  377. v-model="scope.row.isBatchLock"
  378. :disabled="sonDisable"
  379. active-value="Y"
  380. inactive-value="N"
  381. active-color="#13ce66"
  382. inactive-color="#a1a3a9">
  383. </el-switch>
  384. </el-form-item>
  385. </template>
  386. </el-table-column> -->
  387. <el-table-column show-overflow-tooltip label="采购备注" align="center" prop="updateCause" width="150px"/>
  388. <el-table-column show-overflow-tooltip label="可用量" align="center" prop="availableQty"/>
  389. <el-table-column
  390. fixed="right"
  391. label="操作"
  392. align="center"
  393. >
  394. <template slot-scope="scope">
  395. <el-button type="text" size="mini" :disabled="sonDisable" @click="delLine(scope.$index, scope.row)">删除</el-button>
  396. </template>
  397. </el-table-column>
  398. </el-table>
  399. </el-form>
  400. <div class="btn_group">
  401. <el-col :span="1.5">
  402. <el-button type="primary" size="mini" @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
  403. </el-col>
  404. <el-col :span="1.5">
  405. <el-button type="primary" size="mini" @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
  406. </el-col>
  407. <el-col :span="1.5" style="margin: 0 10px;">
  408. <el-button type="primary" size="mini" @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
  409. </el-col>
  410. <el-col :span="1.5">
  411. <el-button size="mini" plain @click="back">返回</el-button>
  412. </el-col>
  413. </div>
  414. </el-card>
  415. <Reserved v-if="dialog.config" :isVisible="dialog.config" :info="row" @updateReserved="updateReserved"/>
  416. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  417. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="false" />
  418. <!-- 批量调整参数 -->
  419. <el-dialog title="批量调整" :visible.sync="adjust.open" @close="closeEvent" width="38%">
  420. <el-row style="margin-bottom: 10px;">
  421. <el-col :span="6" class="pltzTxt">价格类型</el-col>
  422. <el-col :span="14">
  423. <el-select class="pltzIpt" clearable size="mini" v-model="adjust.priceType">
  424. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  425. </el-option>
  426. </el-select>
  427. </el-col>
  428. </el-row>
  429. <el-row style="margin-bottom: 10px;">
  430. <el-col :span="6" class="pltzTxt">采购员</el-col>
  431. <el-col :span="14">
  432. <el-select class="pltzIpt" clearable size="mini" v-model="adjust.purchaseMan" @focus="chooseOrg('CONTACTS_PARAM', true, '采购员')">
  433. <el-option v-for="item in purchaseManOptions" :key="item.id" :label="item.name" :value="item.code" />
  434. </el-select>
  435. </el-col>
  436. </el-row>
  437. <el-row style="margin-bottom: 10px;">
  438. <el-col :span="6" class="pltzTxt">收货仓库</el-col>
  439. <el-col :span="14">
  440. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.warehouseName" @focus="chooseOrg('WAREHOUSE_PARAM', true, '收货仓库')">
  441. <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('WAREHOUSE_PARAM', true, '收货仓库')"></el-button>
  442. </el-input>
  443. </el-col>
  444. </el-row>
  445. <el-row style="margin-bottom: 10px;">
  446. <el-col :span="6" class="pltzTxt">收货货位</el-col>
  447. <el-col :span="14">
  448. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.allocationName" @focus="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)">
  449. <el-button size="mini" slot="append" icon="el-icon-more" @click="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)"></el-button>
  450. </el-input>
  451. </el-col>
  452. </el-row>
  453. <el-row style="margin-bottom: 10px;">
  454. <el-col :span="6" class="pltzTxt">业务备注</el-col>
  455. <el-col :span="14">
  456. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.remark"/>
  457. </el-col>
  458. </el-row>
  459. <el-row style="margin-bottom: 10px;">
  460. <el-col :span="6" class="pltzTxt">收货地址</el-col>
  461. <el-col :span="14">
  462. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.deliveryAddressName" @focus="chooseOrg('ADDRESS_PARAM', true, '收货地址')">
  463. <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ADDRESS_PARAM', true, '收货地址')"></el-button>
  464. </el-input>
  465. </el-col>
  466. </el-row>
  467. <el-row style="margin-bottom: 10px;">
  468. <el-col :span="6" class="pltzTxt">收货地址编码</el-col>
  469. <el-col :span="14">
  470. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.deliveryAddress"/>
  471. </el-col>
  472. </el-row>
  473. <el-row style="margin-bottom: 10px;">
  474. <el-col :span="6" class="pltzTxt">联系人</el-col>
  475. <el-col :span="14">
  476. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.contacts"/>
  477. </el-col>
  478. </el-row>
  479. <el-row style="margin-bottom: 10px;">
  480. <el-col :span="6" class="pltzTxt">联系人电话</el-col>
  481. <el-col :span="14">
  482. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.contactsPhone"/>
  483. </el-col>
  484. </el-row>
  485. <el-row style="margin-bottom: 10px;">
  486. <el-col :span="6" class="pltzTxt">详细地址</el-col>
  487. <el-col :span="14">
  488. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.address"/>
  489. </el-col>
  490. </el-row>
  491. <div slot="footer">
  492. <el-button size="mini" type="primary" @click="confirmAdjust">确 认</el-button>
  493. <el-button size="mini" @click="adjust.open = false">取 消</el-button>
  494. </div>
  495. </el-dialog>
  496. </div>
  497. </template>
  498. <script>
  499. import Reserved from './reserved.vue'
  500. import Refers from '@/components/Refers/refers.vue'
  501. import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan } from '@/api/purchase/purchaseDemand.js'
  502. // 用于回显参照框数据
  503. import {getRefer} from '@/api/purchase/basic.js'
  504. // 明细行选择物料参照
  505. import popDialog from '@/components/PopDialog/index.vue'
  506. export default {
  507. name: 'addDemandList',
  508. props: ['pageStu','row', 'disable'],
  509. dicts: ['sys_processing_mode', 'sys_plan_type', 'sys_status', 'sys_bill_source', 'sys_business','sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
  510. components: {
  511. Reserved,
  512. Refers,
  513. popDialog
  514. },
  515. model: {
  516. prop: 'isList',
  517. event: 'jugislist'
  518. },
  519. data() {
  520. return {
  521. // 不能直接改变props传来的值
  522. sonPageStu: this.pageStu,
  523. sonDisable: this.disable,
  524. // BDZT是补单供应商是否可以编辑条件
  525. BDZT: true,
  526. dialog: {
  527. config: false
  528. },
  529. basicForm: {
  530. code: '',
  531. org: '',
  532. orgName: '',
  533. demandBusinessType: '1',
  534. status: '0',
  535. customer: '',
  536. customerName: '',
  537. customerCode: '',
  538. customerPrincipal: '',
  539. demandPersonal: this.$store.state.user.name,
  540. demandDept: this.$store.state.user.deptId,
  541. planType: '1',
  542. demandDate: '',
  543. createTime: '',
  544. source: '4',
  545. billType: 'ZQBH',
  546. isSpeical: 'N',
  547. isProcess: '',
  548. isMonthleyCalculate: '',
  549. createTime: this.parseTime(new Date().getTime()),
  550. remark: '',
  551. puDemandItemList: []
  552. },
  553. delDemandItemList: [],
  554. options: [{
  555. value: 'Y', label: '是',
  556. }, {
  557. value: 'N', label: '否'
  558. }],
  559. basicRules: {},
  560. tableList: [],
  561. referCondition: {
  562. type: '',
  563. isPage: true,
  564. title: '',
  565. },
  566. // referCondition: {
  567. // type: '',
  568. // isPage: true,
  569. // title: '',
  570. // },
  571. tableIndex: null,
  572. ids: [],
  573. orgOptions: [],
  574. manOptions: [],
  575. personOptions: [],
  576. deptOptions: [],
  577. customerOptions: [],
  578. pickerOptionsEnd: {
  579. disabledDate: (time) => {
  580. return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000
  581. }
  582. },
  583. isBDXQ: false,
  584. isYl: false,
  585. // 批量调整参数
  586. adjust: {
  587. open: false,
  588. priceType: '',
  589. purchaseMan: '',
  590. purchaseManName: '',
  591. warehouse: '',
  592. warehouseName: '',
  593. allocation: '',
  594. allocationName: '',
  595. remark:'',
  596. deliveryAddress: '',
  597. deliveryAddressName: '',
  598. contacts: '',
  599. contactsPhone: '',
  600. address: ''
  601. },
  602. purchaseManOptions: []
  603. }
  604. },
  605. created() {
  606. if(this.pageStu == 'check') {
  607. console.log('数据', this.row)
  608. this.getDetails(this.row)
  609. } else if(this.pageStu == 'edit') {
  610. this.getDetails(this.row)
  611. } else if (this.pageStu == 'add') {
  612. if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  613. if (this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  614. }
  615. },
  616. methods: {
  617. // 改变单据日期时清空子表的调拨日期
  618. changeDemandDate() {
  619. this.basicForm.puDemandItemList.forEach(item => {
  620. item.deliveryDate = null
  621. })
  622. },
  623. // 更改业务类型调整明细行内补单或紧急标识
  624. changeBillType() {
  625. if (this.basicForm.billType == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
  626. this.isBDXQ = true
  627. this.BDZT = false
  628. this.basicForm.puDemandItemList.forEach(item => {item.isReplenishment = 'Y'})
  629. } else {
  630. this.isBDXQ = false
  631. this.BDZT = true
  632. this.basicForm.puDemandItemList.forEach(item => {
  633. item.isReplenishment = 'N'
  634. item.additionalSupplier = null
  635. item.additionalSupplierName = null
  636. })
  637. }
  638. if (this.basicForm.billType == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
  639. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
  640. } else {
  641. this.basicForm.puDemandItemList.forEach(item => { item.isUrgency = 'N' })
  642. }
  643. },
  644. hangStatus(row) {
  645. switch (row.status) {
  646. case '0':
  647. return '需补货'
  648. case '1':
  649. return '待计划确认'
  650. case '2':
  651. return '计划已确认'
  652. case '3':
  653. return '计划已审核'
  654. case '4':
  655. return '行关闭'
  656. case '5':
  657. return '总供应可满足'
  658. }
  659. },
  660. // 获取预留数量
  661. getYLSL(scope) {
  662. if (scope.row.reservedProportion) {
  663. scope.row.reservedQty = Math.ceil(scope.row.reservedProportion.replace('%', '') / 100 * scope.row.qty)
  664. }
  665. // 如果选择预留比例,预留周期必填
  666. // if(scope.row.reservedQty && scope.row.reservedQty !== 0) {
  667. // this.isYl = true
  668. // } else {
  669. // this.isYl = false
  670. // }
  671. },
  672. // 清空
  673. cleanYLSL(scope) {
  674. scope.row.reservedQty = ''
  675. scope.row.reservedPeriod = ''
  676. },
  677. copy() {
  678. this.$modal.notifySuccess("复制成功");
  679. this.sonPageStu = 'add'
  680. this.sonDisable = false
  681. // this.getDetails(this.row)
  682. this.basicForm.id = ''
  683. this.basicForm.code = ''
  684. this.basicForm.createBy = ''
  685. this.basicForm.source = '4'
  686. this.basicForm.isSpeical = 'N'
  687. this.basicForm.demandPersonal = this.$store.state.user.name
  688. this.basicForm.demandDept = this.$store.state.user.deptId
  689. if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  690. if (this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  691. this.basicForm.puDemandItemList.forEach(item => {
  692. item.status = ''
  693. item.buyerName = ''
  694. item.buyer = ''
  695. item.reservedProportion = ''
  696. item.reservedPeriod = ''
  697. item.reservedQty = ''
  698. item.averageQtyMonth = ''
  699. item.demandPeriod = ''
  700. item.forecastClassify = ''
  701. item.onemonthAvgVolume = ''
  702. item.threemonthAvgVolume = ''
  703. item.puFreight = ''
  704. item.superiorAllotQty = ''
  705. item.resDemandQty = ''
  706. item.executeQty = ''
  707. item.deliveryWarehouseName = ''
  708. item.deliveryWarehouse = ''
  709. item.deliveryAllocationName = ''
  710. item.deliveryAllocation = ''
  711. item.lastWarehouseName = ''
  712. item.lastAllocationName = ''
  713. item.availableQty = ''
  714. item.lastStockOrgName = ''
  715. item.centralWarehouseQty = ''
  716. item.allotCode = ''
  717. item.allotQty = ''
  718. item.deliveryAddress = ''
  719. item.deliveryAddressName = ''
  720. item.contacts = ''
  721. item.contactsPhone = ''
  722. item.address = ''
  723. item.statusAllot = 'N'
  724. })
  725. },
  726. handleData() {
  727. console.log('222')
  728. // 复制新增把id,编码,创建人置为空,子表去掉id
  729. this.basicForm.id = ''
  730. this.basicForm.code = ''
  731. this.basicForm.createBy = ''
  732. this.basicForm.source = '4'
  733. if (this.basicForm.puDemandItemList.length !== 0) {
  734. this.basicForm.puDemandItemList.forEach(item => {
  735. if (item.id) {
  736. delete item.id
  737. }
  738. if (item.demandId) {
  739. delete item.demandId
  740. }
  741. if (item.allotCode) {
  742. delete item.allotCode
  743. }
  744. })
  745. }
  746. },
  747. async save() {
  748. if(this.basicForm.puDemandItemList.length !== 0) {
  749. this.$refs['basic'].validate((valid, obj) => {
  750. if(valid) {
  751. this.$modal.loading("保存中...");
  752. if(this.sonPageStu == 'add') {
  753. this.handleData()
  754. addDemand(this.basicForm).then(res => {
  755. console.log(333)
  756. if (res.code === 200) {
  757. this.$modal.notifySuccess("保存成功");
  758. this.$modal.closeLoading();
  759. this.back()
  760. }
  761. }).catch(err => {
  762. this.$modal.closeLoading();
  763. })
  764. } else if (this.sonPageStu == 'edit') {
  765. let list = []
  766. list.push(...this.basicForm.puDemandItemList, ...this.delDemandItemList)
  767. // 深拷贝一下参数对象
  768. let param = JSON.parse(JSON.stringify(this.basicForm))
  769. console.log('深拷贝对象',param);
  770. param.puDemandItemList = list
  771. // this.basicForm.puDemandItemList.push(...this.delDemandItemList)
  772. editDemand(param).then(res => {
  773. if (res.code === 200) {
  774. this.$modal.notifySuccess("编辑成功");
  775. this.$modal.closeLoading();
  776. this.back()
  777. }
  778. }).catch(err => {
  779. this.$modal.closeLoading();
  780. })
  781. }
  782. } else {
  783. // 校验加弹窗
  784. const jiaoyan = []
  785. for(let key in obj) {
  786. jiaoyan.push(obj[key][0].message);
  787. }
  788. this.$modal.notifyWarning(jiaoyan[0]);
  789. return false
  790. }
  791. })
  792. } else {
  793. this.$modal.notifyWarning("明细信息不能为空!");
  794. }
  795. },
  796. submit() {
  797. this.$modal.loading("提交中...");
  798. submitDemand(this.basicForm).then(res => {
  799. if (res.code === 200) {
  800. this.$modal.notifySuccess("提交成功");
  801. this.$modal.closeLoading();
  802. this.back()
  803. }
  804. }).catch(err => {
  805. this.$modal.closeLoading();
  806. })
  807. },
  808. // 增行
  809. addLine() {
  810. const newLine = {
  811. contacts: null,
  812. id: null,
  813. demandId: null,
  814. status: null,
  815. businessDept: null,
  816. businessDeptName: null,
  817. materialCategory: null,
  818. buyer: null,
  819. buyerName: null,
  820. mateiralClassifyOne: null,
  821. materialClassifyOneName: null,
  822. materialClassifyTwo: null,
  823. materialClassifyTwoName: null,
  824. materialClassifyThree: null,
  825. materialClassifyThreeName: null,
  826. materialClassifyFour: null,
  827. materialClassifyFourName: null,
  828. materialCode: null,
  829. material: null,
  830. materialName: null,
  831. classifyId: null,
  832. specification: null,
  833. unit: null,
  834. unitName: null,
  835. manufacturerName: null,
  836. registrant: null,
  837. puPeriod: null,
  838. expiryUnit: null,
  839. expiry: null,
  840. minPackage: null,
  841. minOrderQty: null,
  842. minBatch: null,
  843. safeStock: null,
  844. averageQtyMonth: null,
  845. qty: null,
  846. adjustmentPersonal: null,
  847. adjustmentTime: null,
  848. manualRegulation: null,
  849. updateCause: null,
  850. reservedProportion: null,
  851. reservedPeriod: null,
  852. reservedQty: null,
  853. demandPeriod: null,
  854. forecastClassify: null,
  855. onemonthAvgVolume: null,
  856. threemonthAvgVolume: null,
  857. puFreight: null,
  858. deliveryDate: null,
  859. isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
  860. isReplenishment: this.basicForm.billType == 'BDXQ'? 'Y': 'N',
  861. isBatchLock: 'N',
  862. isCustomerSpecified: '',
  863. remark: null,
  864. puRemark: null,
  865. lastWarehouseQty: null,
  866. resDemandQty: null,
  867. lastWarehouse: null,
  868. lastWarehouseName: null,
  869. deliveryWarehouse: null,
  870. deliveryWarehouseName: null,
  871. lastAllocation: null,
  872. lastAllocationName: null,
  873. deliveryAllocation: null,
  874. deliveryAllocationName: null,
  875. passageOn: null,
  876. puOrg: null,
  877. purOrgName: null,
  878. lastStockQty: null,
  879. superiorCenterQty: null,
  880. superiorAllotQty: null,
  881. availableQty: null,
  882. statusAllot: 'N',
  883. additionalSupplier: null,
  884. additionalSupplierName: null,
  885. periodUnit: null,
  886. demandCustomer: this.basicForm.customer,
  887. demandCustomerName: this.basicForm.customerName,
  888. businessDept: this.basicForm.demandDept,
  889. businessDeptName: null,
  890. lastStockOrg: null,
  891. lastStockOrgName: null,
  892. superiorStockOrg: null,
  893. superiorStockOrgName: null,
  894. allotCode: null,
  895. deliveryAddress: null,
  896. deliveryAddressName: null,
  897. contacts: null,
  898. contactsPhone: null,
  899. address: null,
  900. source: null,
  901. priceType: 'order',
  902. puManagerApprover: null,
  903. puManagerApproverName: null,
  904. processTime: null,
  905. affirmer: null,
  906. tenantId: null,
  907. revision: null,
  908. createBy: null,
  909. createByName: null,
  910. createTime: null,
  911. updateBy: null,
  912. updateByName: null,
  913. updateTime: null,
  914. delFlag: 0,
  915. // 新增字段
  916. model: null,
  917. storageCondition: null,
  918. transportationCondition: null,
  919. }
  920. this.basicForm.puDemandItemList.push(newLine)
  921. // 补单需求状态改变
  922. if (this.basicForm.billType == 'BDXQ') {
  923. this.BDZT = false
  924. } else {
  925. this.BDZT = true
  926. }
  927. },
  928. delLine(index, row) {
  929. console.log('删除行:', index)
  930. console.log('改变行:', row)
  931. row.delFlag = '2'
  932. let delList = []
  933. delList = this.basicForm.puDemandItemList.filter(item => {
  934. return item.delFlag == '2'
  935. })
  936. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  937. return item.delFlag == '0'
  938. })
  939. this.delDemandItemList.push(...delList)
  940. console.log('删除的数组',this.delDemandItemList)
  941. },
  942. back() {
  943. console.log('打印人员信息看看', this.$store.state)
  944. this.$emit('jugislist', true)
  945. this.$emit('refresh')
  946. },
  947. // 如果需要回显则调用详情接口
  948. getDetails(row) {
  949. getDemandDetail(row.id).then(res => {
  950. if (res.code === 200) {
  951. // this.basicForm = res.data
  952. let reciveForm = res.data
  953. let params = {...{id: row.id}, ...{pageNum:1, pageSize: 10}}
  954. getDemandSonDetail(params).then(res => {
  955. if (res.code === 200) {
  956. reciveForm.puDemandItemList = res.data
  957. console.log('reciveForm',reciveForm)
  958. this.basicForm = reciveForm
  959. if(this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
  960. if(this.basicForm.customer) { this.reBackRefer('CUSTOMER_PARAM', this.basicForm.customer) }
  961. if(this.basicForm.customerPrincipal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.customerPrincipal, '客户负责人') }
  962. if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  963. if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  964. // 详情时将收货仓库id赋值给stordocId
  965. // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
  966. if(this.basicForm.billType == 'BDXQ') {
  967. this.BDZT = false
  968. this.isBDXQ = true
  969. } else {
  970. this.BDZT = true
  971. this.isBDXQ = false
  972. }
  973. }
  974. })
  975. }
  976. })
  977. },
  978. // 单元格标红
  979. cellClassName({row, column, rowIndex, columnIndex}) {
  980. if(this.basicForm.isSpeical == 'N' && column.label == '需求可用周期' && Number(row.demandPeriod) > 1.5 && Number(row.demandPeriod) > Number(row.minOrderQty)) {
  981. return 'success-row';
  982. }
  983. },
  984. handleSelectionChange(selection) {
  985. this.ids = selection.map(item =>{
  986. return item.id
  987. })
  988. console.log('选中数组', this.ids)
  989. },
  990. // 点击预留单展示
  991. showReserved() {
  992. this.dialog.config = true
  993. },
  994. // 修改是否让页面显示与隐藏的事件
  995. updateReserved (val) {
  996. this.dialog.config = val
  997. },
  998. // 回显参照框
  999. reBackRefer(type, id, title) {
  1000. getRefer({type: type, id: id}).then(res => {
  1001. if(type == 'ORG_PARAM') {
  1002. this.orgOptions = res.rows
  1003. }
  1004. if (type == 'CUSTOMER_PARAM') {
  1005. this.customerOptions = res.rows
  1006. }
  1007. if (type == 'CONTACTS_PARAM' && title == '需求人员') {
  1008. this.personOptions = res.rows
  1009. }
  1010. if (type == 'CONTACTS_PARAM' && title == '客户负责人') {
  1011. this.manOptions = res.rows
  1012. }
  1013. if (type == 'DEPT_PARAM') {
  1014. this.deptOptions = res.rows
  1015. }
  1016. })
  1017. },
  1018. chooseOrg(type, isPage, title) {
  1019. this.referCondition.type = type
  1020. this.referCondition.isPage = isPage
  1021. this.referCondition.title = title
  1022. this.$refs.refer.init(this.referCondition)
  1023. },
  1024. selectionsToInput(selection) {
  1025. if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '选择组织') {
  1026. this.orgOptions = selection
  1027. this.basicForm.org = selection[0].id
  1028. this.basicForm.orgName = selection[0].name
  1029. }
  1030. if(this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
  1031. this.customerOptions = selection
  1032. this.basicForm.customer = selection[0].id
  1033. this.basicForm.customerName = selection[0].name
  1034. this.basicForm.customerCode = selection[0].code
  1035. if(this.basicForm.puDemandItemList.length !== 0) {
  1036. this.basicForm.puDemandItemList.forEach(item => {
  1037. item.demandCustomerName = this.basicForm.customerName
  1038. item.demandCustomer = this.basicForm.customer
  1039. item.status = ''
  1040. item.buyerName = ''
  1041. item.buyer = ''
  1042. item.reservedProportion = ''
  1043. item.reservedPeriod = ''
  1044. item.reservedQty = ''
  1045. item.averageQtyMonth = ''
  1046. item.demandPeriod = ''
  1047. item.forecastClassify = ''
  1048. item.onemonthAvgVolume = ''
  1049. item.threemonthAvgVolume = ''
  1050. item.puFreight = ''
  1051. item.superiorAllotQty = ''
  1052. item.resDemandQty = ''
  1053. item.executeQty = ''
  1054. item.deliveryWarehouseName = ''
  1055. item.deliveryWarehouse = ''
  1056. item.deliveryAllocationName = ''
  1057. item.deliveryAllocation = ''
  1058. item.lastWarehouseName = ''
  1059. item.lastAllocationName = ''
  1060. item.availableQty = ''
  1061. item.lastStockOrgName = ''
  1062. item.centralWarehouseQty = ''
  1063. item.allotCode = ''
  1064. item.deliveryAddress = ''
  1065. item.deliveryAddressName = ''
  1066. item.contacts = ''
  1067. item.contactsPhone = ''
  1068. item.address = ''
  1069. })
  1070. }
  1071. }
  1072. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '需求人员') {
  1073. this.personOptions = selection
  1074. this.basicForm.demandPersonal = selection[0].code
  1075. }
  1076. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '采购员') {
  1077. this.purchaseManOptions = selection
  1078. this.adjust.purchaseMan = selection[0].code
  1079. this.adjust.purchaseManName = selection[0].name
  1080. }
  1081. if(this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '收货仓库') {
  1082. this.adjust.warehouse = selection[0].id
  1083. this.adjust.warehouseName = selection[0].name
  1084. this.adjust.allocation = ''
  1085. this.adjust.allocationName = ''
  1086. }
  1087. if(this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '收货货位') {
  1088. this.adjust.allocation = selection[0].id
  1089. this.adjust.allocationName = selection[0].name
  1090. }
  1091. if(this.referCondition.type == 'ADDRESS_PARAM' && this.referCondition.title == '收货地址') {
  1092. this.adjust.deliveryAddressName = selection[0].name
  1093. this.adjust.deliveryAddress = selection[0].id
  1094. this.adjust.contacts = selection[0].contactsName
  1095. this.adjust.contactsPhone = selection[0].contactsPhone
  1096. this.adjust.address = selection[0].address
  1097. }
  1098. if(this.referCondition.type == 'DEPT_PARAM') {
  1099. this.deptOptions = selection
  1100. this.basicForm.demandDept = selection[0].id
  1101. }
  1102. if(this.referCondition.title == '选择收货仓库') {
  1103. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
  1104. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
  1105. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1106. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1107. }
  1108. if(this.referCondition.title == '选择收货货位') {
  1109. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
  1110. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
  1111. }
  1112. if(this.referCondition.title == '选择补单供应商') {
  1113. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].id
  1114. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
  1115. }
  1116. if(this.referCondition.title == '选择收货地址') {
  1117. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
  1118. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].id
  1119. this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
  1120. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
  1121. this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
  1122. }
  1123. },
  1124. // 粘贴来的数据
  1125. async pasteMe(e, scope, index) {
  1126. this.$modal.loading("正在处理数据...");
  1127. e.preventDefault() //阻止默认粘贴事件
  1128. let source = e.clipboardData.getData("Text");
  1129. console.log('scope', scope.column.property)
  1130. console.log('eee:', source)
  1131. // 首先对源头进行解析
  1132. let rows = source.split("\r\n"); // 拆成一个数组
  1133. // 数组去除空字符串
  1134. rows = rows.filter(item => {
  1135. return item && item.trim()
  1136. })
  1137. console.log('复制的数组',rows);
  1138. console.log('列表的数组',this.basicForm.puDemandItemList)
  1139. if (rows.length < 1000) {
  1140. await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
  1141. if (res.code === 200) {
  1142. let rowList = res.rows
  1143. for (let i = 0; i<rowList.length; i++) {
  1144. let line = {
  1145. contacts: null,
  1146. id: null,
  1147. demandId: null,
  1148. status: null,
  1149. businessDept: null,
  1150. businessDeptName: null,
  1151. materialCategory: null,
  1152. buyer: null,
  1153. buyerName: null,
  1154. mateiralClassifyOne: null,
  1155. materialClassifyOneName: null,
  1156. materialClassifyTwo: null,
  1157. materialClassifyTwoName: null,
  1158. materialClassifyThree: null,
  1159. materialClassifyThreeName: null,
  1160. materialClassifyFour: null,
  1161. materialClassifyFourName: null,
  1162. materialCode: null,
  1163. material: null,
  1164. materialName: null,
  1165. classifyId: null,
  1166. specification: null,
  1167. unit: null,
  1168. unitName: null,
  1169. manufacturerName: null,
  1170. registrant: null,
  1171. puPeriod: null,
  1172. expiryUnit: null,
  1173. expiry: null,
  1174. minPackage: null,
  1175. minOrderQty: null,
  1176. minBatch: null,
  1177. safeStock: null,
  1178. averageQtyMonth: null,
  1179. qty: null,
  1180. adjustmentPersonal: null,
  1181. adjustmentTime: null,
  1182. manualRegulation: null,
  1183. updateCause: null,
  1184. reservedProportion: null,
  1185. reservedPeriod: null,
  1186. reservedQty: null,
  1187. demandPeriod: null,
  1188. forecastClassify: null,
  1189. onemonthAvgVolume: null,
  1190. threemonthAvgVolume: null,
  1191. puFreight: null,
  1192. deliveryDate: null,
  1193. isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
  1194. isReplenishment: this.basicForm.billType == 'BDXQ' ? 'Y' : 'N',
  1195. isBatchLock: 'N',
  1196. isCustomerSpecified: '',
  1197. remark: null,
  1198. puRemark: null,
  1199. lastWarehouseQty: null,
  1200. resDemandQty: null,
  1201. lastWarehouse: null,
  1202. lastWarehouseName: null,
  1203. deliveryWarehouse: null,
  1204. deliveryWarehouseName: null,
  1205. lastAllocation: null,
  1206. lastAllocationName: null,
  1207. deliveryAllocation: null,
  1208. deliveryAllocationName: null,
  1209. passageOn: null,
  1210. puOrg: null,
  1211. purOrgName: null,
  1212. lastStockQty: null,
  1213. superiorCenterQty: null,
  1214. superiorAllotQty: null,
  1215. availableQty: null,
  1216. statusAllot: 'N',
  1217. additionalSupplier: null,
  1218. additionalSupplierName: null,
  1219. periodUnit: null,
  1220. demandCustomer: this.basicForm.customer,
  1221. demandCustomerName: this.basicForm.customerName,
  1222. businessDept: this.basicForm.demandDept,
  1223. businessDeptName: null,
  1224. lastStockOrg: null,
  1225. lastStockOrgName: null,
  1226. superiorStockOrg: null,
  1227. superiorStockOrgName: null,
  1228. allotCode: null,
  1229. deliveryAddress: null,
  1230. deliveryAddressName: null,
  1231. contacts: null,
  1232. contactsPhone: null,
  1233. address: null,
  1234. source: null,
  1235. priceType: 'order',
  1236. puManagerApprover: null,
  1237. puManagerApproverName: null,
  1238. processTime: null,
  1239. affirmer: null,
  1240. tenantId: null,
  1241. revision: null,
  1242. createBy: null,
  1243. createByName: null,
  1244. createTime: null,
  1245. updateBy: null,
  1246. updateByName: null,
  1247. updateTime: null,
  1248. delFlag: 0,
  1249. // 新增字段
  1250. model: null,
  1251. storageCondition: null,
  1252. transportationCondition: null,
  1253. }
  1254. line.businessDept = rowList[i].businessDepartment
  1255. line.businessDeptName = rowList[i].businessDepartmentName
  1256. line.materialCode = rowList[i].code
  1257. line.material = rowList[i].id
  1258. line.materialName = rowList[i].name
  1259. line.classifyId = rowList[i].classifyId
  1260. line.materialClassifyOneName = rowList[i].oneClass
  1261. line.materialClassifyTwoName = rowList[i].twoClass
  1262. line.materialClassifyThreeName = rowList[i].threeClass
  1263. line.materialClassifyFourName = rowList[i].fourClass
  1264. line.specification = rowList[i].specification
  1265. line.model = rowList[i].model
  1266. line.unit = rowList[i].unitId
  1267. line.unitName = rowList[i].unitIdName
  1268. line.registrant = rowList[i].registrant
  1269. line.manufacturerName = rowList[i].manufacturerIdName
  1270. line.puPeriod = rowList[i].deliveryPeriod
  1271. line.expiry = rowList[i].usefulLife
  1272. line.expiryUnit = rowList[i].expiryUnitIdName
  1273. // line.minPackage = rowList[i].usefulLife
  1274. line.minPackage = rowList[i].minPackQty
  1275. line.minOrderQty = rowList[i].minOrderQty
  1276. line.minBatch = rowList[i].minBatchQty
  1277. line.safeStock = rowList[i].safeStock
  1278. line.purOrgName = rowList[i].purchasingOrganizationName
  1279. line.puOrg = rowList[i].purchasingOrganization
  1280. // 物料存储条件和运输条件
  1281. line.transportationCondition = rowList[i].transportationCondition
  1282. line.storageCondition = rowList[i].storageCondition
  1283. this.basicForm.puDemandItemList.push(line)
  1284. // console.log('临时数组', line)
  1285. }
  1286. this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
  1287. }
  1288. }).catch(err => {
  1289. this.$modal.closeLoading();
  1290. })
  1291. this.$modal.closeLoading();
  1292. console.log('列表', this.basicForm.puDemandItemList)
  1293. } else {
  1294. this.$modal.notifyWarning("复制长度不能超过1000!");
  1295. }
  1296. },
  1297. // 明细行选择物料编码带出数据
  1298. chooseMaterial(index) {
  1299. console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
  1300. this.tableIndex = index
  1301. // 传0只展示同步NC了的物料
  1302. this.$refs.materialRefer.init(0)
  1303. },
  1304. selectMaterial(selection) {
  1305. console.log('选中的物料', selection)
  1306. if (selection.length <= 1) {
  1307. // 选择新物料时先清空行内其他信息
  1308. this.basicForm.puDemandItemList[this.tableIndex].reservedProportion = null
  1309. this.basicForm.puDemandItemList[this.tableIndex].reservedPeriod = null
  1310. this.basicForm.puDemandItemList[this.tableIndex].reservedQty = null
  1311. this.basicForm.puDemandItemList[this.tableIndex].qty = null
  1312. this.basicForm.puDemandItemList[this.tableIndex].deliveryDate = null
  1313. this.basicForm.puDemandItemList[this.tableIndex].remark = null
  1314. this.basicForm.puDemandItemList[this.tableIndex].resDemandQty = null
  1315. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = null
  1316. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = null
  1317. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1318. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1319. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = null
  1320. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = null
  1321. this.basicForm.puDemandItemList[this.tableIndex].periodUnit = null
  1322. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
  1323. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
  1324. this.basicForm.puDemandItemList[this.tableIndex].contacts = null
  1325. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
  1326. this.basicForm.puDemandItemList[this.tableIndex].address = null
  1327. this.basicForm.puDemandItemList[this.tableIndex].priceType = 'order'
  1328. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = null
  1329. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null
  1330. this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null
  1331. this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = null
  1332. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOne = null
  1333. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwo = null
  1334. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThree = null
  1335. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFour = null
  1336. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrg = null
  1337. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrgName = null
  1338. this.basicForm.puDemandItemList[this.tableIndex].buyer = null
  1339. this.basicForm.puDemandItemList[this.tableIndex].buyerName = null
  1340. // 通过选择物料查询采购员
  1341. queryMan(selection[0].id).then(res => {
  1342. if(res.code === 200 && res.rows.length !== 0) {
  1343. this.basicForm.puDemandItemList[this.tableIndex].buyer = res.rows[0].buyer
  1344. this.basicForm.puDemandItemList[this.tableIndex].buyerName = res.rows[0].buyerName
  1345. }
  1346. })
  1347. this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].businessDepartment
  1348. this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].businessDepartmentName
  1349. this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
  1350. this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
  1351. this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
  1352. this.basicForm.puDemandItemList[this.tableIndex].classifyId = selection[0].classifyId
  1353. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
  1354. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
  1355. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass
  1356. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
  1357. this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
  1358. this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
  1359. this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
  1360. this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
  1361. this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
  1362. this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
  1363. this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod
  1364. this.basicForm.puDemandItemList[this.tableIndex].expiry = selection[0].usefulLife
  1365. this.basicForm.puDemandItemList[this.tableIndex].expiryUnit = selection[0].expiryUnitIdName
  1366. // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
  1367. this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].minPackQty
  1368. this.basicForm.puDemandItemList[this.tableIndex].minOrderQty = selection[0].minOrderQty
  1369. this.basicForm.puDemandItemList[this.tableIndex].minBatch = selection[0].minBatchQty
  1370. this.basicForm.puDemandItemList[this.tableIndex].safeStock = selection[0].safeStock
  1371. this.basicForm.puDemandItemList[this.tableIndex].purOrgName = selection[0].purchasingOrganizationName
  1372. this.basicForm.puDemandItemList[this.tableIndex].puOrg = selection[0].purchasingOrganization
  1373. // 物料存储条件和运输条件
  1374. this.basicForm.puDemandItemList[this.tableIndex].transportationCondition = selection[0].transportationCondition
  1375. this.basicForm.puDemandItemList[this.tableIndex].storageCondition = selection[0].storageCondition
  1376. // 选中骨科耗材时候的物料,需求客户不必填
  1377. } else {
  1378. console.log('xxxxx', selection)
  1379. for (let i = 0;i<selection.length;i++) {
  1380. let line = {
  1381. contacts: null,
  1382. id: null,
  1383. demandId: null,
  1384. status: null,
  1385. businessDept: null,
  1386. businessDeptName: null,
  1387. materialCategory: null,
  1388. buyer: null,
  1389. buyerName: null,
  1390. mateiralClassifyOne: null,
  1391. materialClassifyOneName: null,
  1392. materialClassifyTwo: null,
  1393. materialClassifyTwoName: null,
  1394. materialClassifyThree: null,
  1395. materialClassifyThreeName: null,
  1396. materialClassifyFour: null,
  1397. materialClassifyFourName: null,
  1398. materialCode: null,
  1399. material: null,
  1400. materialName: null,
  1401. classifyId: null,
  1402. specification: null,
  1403. unit: null,
  1404. unitName: null,
  1405. manufacturerName: null,
  1406. registrant: null,
  1407. puPeriod: null,
  1408. expiryUnit: null,
  1409. expiry: null,
  1410. minPackage: null,
  1411. minOrderQty: null,
  1412. minBatch: null,
  1413. safeStock: null,
  1414. averageQtyMonth: null,
  1415. qty: null,
  1416. adjustmentPersonal: null,
  1417. adjustmentTime: null,
  1418. manualRegulation: null,
  1419. updateCause: null,
  1420. reservedProportion: null,
  1421. reservedPeriod: null,
  1422. reservedQty: null,
  1423. demandPeriod: null,
  1424. forecastClassify: null,
  1425. onemonthAvgVolume: null,
  1426. threemonthAvgVolume: null,
  1427. puFreight: null,
  1428. deliveryDate: null,
  1429. isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
  1430. isReplenishment: this.basicForm.billType == 'BDXQ' ? 'Y' : 'N',
  1431. isBatchLock: 'N',
  1432. isCustomerSpecified: '',
  1433. remark: null,
  1434. puRemark: null,
  1435. lastWarehouseQty: null,
  1436. resDemandQty: null,
  1437. lastWarehouse: null,
  1438. lastWarehouseName: null,
  1439. deliveryWarehouse: null,
  1440. deliveryWarehouseName: null,
  1441. lastAllocation: null,
  1442. lastAllocationName: null,
  1443. deliveryAllocation: null,
  1444. deliveryAllocationName: null,
  1445. passageOn: null,
  1446. puOrg: null,
  1447. purOrgName: null,
  1448. lastStockQty: null,
  1449. superiorCenterQty: null,
  1450. superiorAllotQty: null,
  1451. availableQty: null,
  1452. statusAllot: 'N',
  1453. additionalSupplier: null,
  1454. additionalSupplierName: null,
  1455. periodUnit: null,
  1456. demandCustomer: this.basicForm.customer,
  1457. demandCustomerName: this.basicForm.customerName,
  1458. businessDept: this.basicForm.demandDept,
  1459. businessDeptName: null,
  1460. lastStockOrg: null,
  1461. lastStockOrgName: null,
  1462. superiorStockOrg: null,
  1463. superiorStockOrgName: null,
  1464. allotCode: null,
  1465. deliveryAddress: null,
  1466. deliveryAddressName: null,
  1467. contacts: null,
  1468. contactsPhone: null,
  1469. address: null,
  1470. source: null,
  1471. priceType: 'order',
  1472. puManagerApprover: null,
  1473. puManagerApproverName: null,
  1474. processTime: null,
  1475. affirmer: null,
  1476. tenantId: null,
  1477. revision: null,
  1478. createBy: null,
  1479. createByName: null,
  1480. createTime: null,
  1481. updateBy: null,
  1482. updateByName: null,
  1483. updateTime: null,
  1484. delFlag: 0,
  1485. // 新增字段
  1486. model: null,
  1487. storageCondition: null,
  1488. transportationCondition: null,
  1489. }
  1490. // 通过选择物料查询采购员
  1491. queryMan(selection[i].id).then(res => {
  1492. if (res.code === 200 && res.rows.length !== 0) {
  1493. line.buyer = res.rows[0].buyer
  1494. line.buyerName = res.rows[0].buyerName
  1495. }
  1496. })
  1497. line.businessDept = selection[i].businessDepartment
  1498. line.businessDeptName = selection[i].businessDepartmentName
  1499. line.materialCode = selection[i].code
  1500. line.material = selection[i].id
  1501. line.materialName = selection[i].name
  1502. line.classifyId = selection[i].classifyId
  1503. line.materialClassifyOneName = selection[i].oneClass
  1504. line.materialClassifyTwoName = selection[i].twoClass
  1505. line.materialClassifyThreeName = selection[i].threeClass
  1506. line.materialClassifyFourName = selection[i].fourClass
  1507. line.specification = selection[i].specification
  1508. line.model = selection[i].model
  1509. line.unit = selection[i].unitId
  1510. line.unitName = selection[i].unitIdName
  1511. line.registrant = selection[i].registrant
  1512. line.manufacturerName = selection[i].manufacturerIdName
  1513. line.puPeriod = selection[i].deliveryPeriod
  1514. line.expiry = selection[i].usefulLife
  1515. line.expiryUnit = selection[i].expiryUnitIdName
  1516. // line.minPackage = selection[i].usefulLife
  1517. line.minPackage = selection[i].minPackQty
  1518. line.minOrderQty = selection[i].minOrderQty
  1519. line.minBatch = selection[i].minBatchQty
  1520. line.safeStock = selection[i].safeStock
  1521. line.purOrgName = selection[i].purchasingOrganizationName
  1522. line.puOrg = selection[i].purchasingOrganization
  1523. // 物料存储条件和运输条件
  1524. line.transportationCondition = selection[i].transportationCondition
  1525. line.storageCondition = selection[i].storageCondition
  1526. this.basicForm.puDemandItemList.push(line)
  1527. }
  1528. // 删除指定下标
  1529. this.basicForm.puDemandItemList.splice(this.tableIndex,1)
  1530. }
  1531. },
  1532. // 明细行选择业务部门参照带出业务部门数据
  1533. chooseDept(index, type, isPage, title) {
  1534. this.tableIndex = index
  1535. this.referCondition.type = type
  1536. this.referCondition.isPage = isPage
  1537. this.referCondition.title = title
  1538. this.$refs.refer.init(this.referCondition)
  1539. },
  1540. // 明细行选择业务部门参照带出业务部门数据
  1541. choosehuoWei(index, type, isPage, title, stordocId) {
  1542. this.tableIndex = index
  1543. this.referCondition.type = type
  1544. this.referCondition.isPage = isPage
  1545. this.referCondition.title = title
  1546. // 选择收货货位前先选择收货仓库
  1547. if(stordocId) {
  1548. this.referCondition.stordocId = stordocId
  1549. this.$refs.refer.init(this.referCondition)
  1550. } else {
  1551. this.$modal.notifyWarning("请先选择收货仓库");
  1552. }
  1553. },
  1554. // 明细行清空收货仓库,货位,收货地址档案等
  1555. clearHang(index, title) {
  1556. if (title == '选择收货仓库') {
  1557. this.basicForm.puDemandItemList[index].deliveryWarehouseName = null
  1558. this.basicForm.puDemandItemList[index].deliveryWarehouse = null
  1559. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1560. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1561. }
  1562. if (title == '选择收货货位') {
  1563. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1564. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1565. }
  1566. if (title == '选择收货地址') {
  1567. this.basicForm.puDemandItemList[index].deliveryAddressName = null
  1568. this.basicForm.puDemandItemList[index].deliveryAddress = null
  1569. this.basicForm.puDemandItemList[index].contacts = null
  1570. this.basicForm.puDemandItemList[index].contactsPhone = null
  1571. this.basicForm.puDemandItemList[index].address = null
  1572. }
  1573. if (title == '选择补单供应商') {
  1574. this.basicForm.puDemandItemList[index].additionalSupplierName = null
  1575. this.basicForm.puDemandItemList[index].additionalSupplier = null
  1576. }
  1577. },
  1578. // 清除需求客户将明细行内也清空
  1579. cleanCustomer() {
  1580. this.basicForm.customer = ''
  1581. this.basicForm.customerName = ''
  1582. this.basicForm.customerCode = ''
  1583. if (this.basicForm.puDemandItemList.length !== 0) {
  1584. this.basicForm.puDemandItemList.forEach(item => {
  1585. item.demandCustomerName = ''
  1586. item.demandCustomer = ''
  1587. item.status = ''
  1588. item.buyerName = ''
  1589. item.buyer = ''
  1590. item.reservedProportion = ''
  1591. item.reservedPeriod = ''
  1592. item.reservedQty = ''
  1593. item.averageQtyMonth = ''
  1594. item.demandPeriod = ''
  1595. item.forecastClassify = ''
  1596. item.onemonthAvgVolume = ''
  1597. item.threemonthAvgVolume = ''
  1598. item.puFreight = ''
  1599. item.superiorAllotQty = ''
  1600. item.resDemandQty = ''
  1601. item.executeQty = ''
  1602. item.deliveryWarehouseName = ''
  1603. item.deliveryWarehouse = ''
  1604. item.deliveryAllocationName = ''
  1605. item.deliveryAllocation = ''
  1606. item.lastWarehouseName = ''
  1607. item.lastAllocationName = ''
  1608. item.availableQty = ''
  1609. item.lastStockOrgName = ''
  1610. item.centralWarehouseQty = ''
  1611. item.allotCode = ''
  1612. item.deliveryAddress = ''
  1613. item.deliveryAddressName = ''
  1614. item.contacts = ''
  1615. item.contactsPhone = ''
  1616. item.address = ''
  1617. })
  1618. }
  1619. },
  1620. // 批量调整
  1621. adjustPl() {
  1622. if(this.ids.length == 0) {
  1623. this.$modal.notifyWarning('请至少选择一项数据进行操作!')
  1624. } else {
  1625. this.adjust.open = true
  1626. }
  1627. },
  1628. // 批量调整确认
  1629. confirmAdjust() {
  1630. console.log('data', this.adjust)
  1631. this.basicForm.puDemandItemList.forEach(item => {
  1632. this.ids.some(val => {
  1633. if(val == item.id) {
  1634. if(this.adjust.purchaseMan) {
  1635. item.buyer = this.adjust.purchaseMan
  1636. item.buyerName = this.adjust.purchaseManName
  1637. }
  1638. if(this.adjust.priceType) {
  1639. item.priceType = this.adjust.priceType
  1640. }
  1641. if(this.adjust.warehouseName) {
  1642. item.deliveryWarehouse = this.adjust.warehouse
  1643. item.deliveryWarehouseName = this.adjust.warehouseName
  1644. item.deliveryAllocation = this.adjust.allocation
  1645. item.deliveryAllocationName = this.adjust.allocationName
  1646. }
  1647. // if(this.adjust.allocationName) {
  1648. // item.deliveryAllocation = this.adjust.allocation
  1649. // item.deliveryAllocationName = this.adjust.allocationName
  1650. // }
  1651. if(this.adjust.remark) {
  1652. item.remark = this.adjust.remark
  1653. }
  1654. if(this.adjust.deliveryAddressName) {
  1655. item.deliveryAddressName = this.adjust.deliveryAddressName
  1656. item.deliveryAddress = this.adjust.deliveryAddress
  1657. item.contacts = this.adjust.contacts
  1658. item.contactsPhone = this.adjust.contactsPhone
  1659. item.address = this.adjust.address
  1660. }
  1661. }
  1662. this.adjust.open = false
  1663. })
  1664. })
  1665. },
  1666. // 批量调整选择货位
  1667. adjustHuoWei(type, isPage, title, stordocId) {
  1668. this.referCondition.type = type
  1669. this.referCondition.isPage = isPage
  1670. this.referCondition.title = title
  1671. // 选择收货货位前先选择收货仓库
  1672. if (stordocId) {
  1673. this.referCondition.stordocId = stordocId
  1674. this.$refs.refer.init(this.referCondition)
  1675. } else {
  1676. this.$modal.notifyWarning("请先选择收货仓库");
  1677. }
  1678. },
  1679. // 关闭清空批量调整数据
  1680. closeEvent() {
  1681. this.adjust = {
  1682. open: false,
  1683. priceType: '',
  1684. purchaseMan: '',
  1685. purchaseManName: '',
  1686. warehouse: '',
  1687. warehouseName: '',
  1688. allocation: '',
  1689. allocationName: '',
  1690. remark: '',
  1691. deliveryAddress: '',
  1692. deliveryAddressName: '',
  1693. contacts: '',
  1694. contactsPhone: '',
  1695. address: ''
  1696. }
  1697. },
  1698. // 必选标识
  1699. addRedStar(h, { column }) {
  1700. return [
  1701. h('span', { style: 'color: #F56C6C' }, '*'),
  1702. h('span', ' ' + column.label)
  1703. ];
  1704. },
  1705. anotherRedStar(h, { column }) {
  1706. if(this.isBDXQ) {
  1707. return [
  1708. h('span', { style: 'color: #F56C6C' }, '*'),
  1709. h('span', ' ' + column.label)
  1710. ];
  1711. } else {
  1712. return [
  1713. h('span', ' ' + column.label)
  1714. ];
  1715. }
  1716. },
  1717. }
  1718. }
  1719. </script>
  1720. <style lang="scss" scoped>
  1721. .btn_group {
  1722. // width: 100%;
  1723. // margin: 20px 0;
  1724. display: flex;
  1725. // justify-content: center;
  1726. position: absolute;
  1727. top: 10px;right: 20px;
  1728. }
  1729. .btn_grooup {
  1730. margin-bottom: 10px;
  1731. display: flex;
  1732. justify-content: space-between;
  1733. }
  1734. .hang {
  1735. margin: auto;
  1736. }
  1737. .hang ::v-deep .el-form-item__content{
  1738. margin-left: 0px !important;
  1739. }
  1740. // .el-table ::v-deep .el-form-item__error{
  1741. // padding-top: 0;
  1742. // top: 70%
  1743. // }
  1744. .el-table ::v-deep .success-row {
  1745. background: #f11616;
  1746. }
  1747. ::v-deep .el-table__row > td {
  1748. border: none;
  1749. }
  1750. .pltzTxt{
  1751. text-align: right;
  1752. font-size: medium;
  1753. padding-right: 2%;
  1754. }
  1755. .pltzIpt{
  1756. width: 90%;
  1757. }
  1758. </style>