add.vue 78 KB

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