add.vue 72 KB

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