add.vue 77 KB

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