add.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995
  1. <template>
  2. <div id="addDemandList">
  3. <span>基本信息</span>
  4. <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto">
  5. <el-row :gutter="10">
  6. <el-col :span="1.5">
  7. <el-form-item label="编码">
  8. <el-input
  9. v-model="basicForm.code"
  10. size="small"
  11. disabled
  12. style="width: 200px"
  13. />
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="1.5">
  17. <el-form-item label="组织">
  18. <el-select size="small" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
  19. <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
  20. </el-select>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="1.5">
  24. <el-form-item label="需求处理方式">
  25. <el-select disabled v-model="basicForm.demandBusinessType" size="small" style="width: 200px">
  26. <el-option v-for="dict in dict.type.sys_processing_mode" :key="dict.value" :label="dict.label" :value="dict.value">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="1.5">
  32. <el-form-item label="单据状态">
  33. <el-select disabled v-model="basicForm.status" size="small" style="width: 200px">
  34. <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="1.5">
  40. <el-form-item label="需求客户">
  41. <el-select size="small" v-model="basicForm.customer" :disabled="sonDisable" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
  42. <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
  43. </el-select>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-form-item label="需求客户名称">
  48. <el-input disabled v-model="basicForm.customerName" size="small" style="width: 200px"></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="1.5">
  52. <el-form-item label="客户负责人">
  53. <el-input disabled v-model="basicForm.customerPrincipal" size="small" style="width: 200px"></el-input>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-form-item label="需求人员">
  58. <el-select size="small" v-model="basicForm.demandPersonal" :disabled="sonDisable" @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')" style="width: 200px">
  59. <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.id" />
  60. </el-select>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-form-item label="需求部门">
  65. <el-select v-model="basicForm.demandDept" size="small" :disabled="sonDisable" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
  66. <el-option
  67. v-for="item in deptOptions"
  68. :key="item.id"
  69. :label="item.name"
  70. :value="item.id">
  71. </el-option>
  72. </el-select>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="1.5">
  76. <el-form-item label="需求日期">
  77. <el-date-picker
  78. v-model="basicForm.demandDate"
  79. disabled
  80. type="date"
  81. value-format="yyyy-MM-dd"
  82. size="small"
  83. style="width: 200px"
  84. >
  85. </el-date-picker>
  86. </el-form-item>
  87. </el-col>
  88. <el-col :span="1.5">
  89. <el-form-item label="单据来源">
  90. <el-select v-model="basicForm.source" disabled size="small" style="width: 200px">
  91. <el-option v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
  92. </el-option>
  93. </el-select>
  94. </el-form-item>
  95. </el-col>
  96. <el-col :span="1.5">
  97. <el-form-item label="供应仓库">
  98. <el-select size="small" v-model="basicForm.warehouse" :disabled="sonDisable" @focus="chooseOrg('WAREHOUSE_PARAM', true, '供应仓库')" style="width: 200px">
  99. <el-option v-for="item in houseOptions" :key="item.id" :label="item.name" :value="item.id" />
  100. </el-select>
  101. </el-form-item>
  102. </el-col>
  103. <el-col :span="1.5">
  104. <el-form-item label="供应货位">
  105. <el-select size="small" v-model="basicForm.goodsAllocation" :disabled="sonDisable" @focus="chooseOrg('ALLOCATION_PARAM', true, '供应货位')" style="width: 200px">
  106. <el-option v-for="item in goodsOptions" :key="item.id" :label="item.name" :value="item.id" />
  107. </el-select>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="1.5">
  111. <el-form-item label="业务类型">
  112. <el-select v-model="basicForm.billType" :disabled="sonDisable" size="small" style="width: 200px">
  113. <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
  114. </el-option>
  115. </el-select>
  116. </el-form-item>
  117. </el-col>
  118. <el-col :span="1.5">
  119. <el-form-item label="是否客户指定">
  120. <el-select v-model="basicForm.isSpeical" :disabled="sonDisable" size="small" style="width: 200px">
  121. <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
  122. </el-option>
  123. </el-select>
  124. </el-form-item>
  125. </el-col>
  126. <!-- <el-col :span="1.5">
  127. <el-form-item label="是否处理需求">
  128. <el-input
  129. v-model="basicForm.isProcess"
  130. size="small"
  131. placeholder=""
  132. clearable
  133. style="width: 200px"
  134. />
  135. </el-form-item>
  136. </el-col> -->
  137. <el-col :span="1.5">
  138. <el-form-item label="是否月销量计算">
  139. <el-input
  140. v-model="basicForm.isMonthleyCalculate"
  141. size="small"
  142. disabled
  143. style="width: 200px"
  144. />
  145. </el-form-item>
  146. </el-col>
  147. <el-col :span="1.5">
  148. <el-form-item label="备注">
  149. <el-input
  150. v-model="basicForm.remark"
  151. size="small"
  152. :disabled="sonDisable"
  153. clearable
  154. style="width: 200px"
  155. />
  156. </el-form-item>
  157. </el-col>
  158. </el-row>
  159. <span>明细信息</span>
  160. <el-card>
  161. <div class="btn_grooup">
  162. <el-button type="primary" size="small" @click="addLine" v-if="!sonDisable">增行</el-button>
  163. <el-button type="primary" size="small" v-if="!sonDisable">批量调整</el-button>
  164. <el-button type="primary" size="small" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
  165. </div>
  166. <el-table
  167. :data="basicForm.puDemandItemList"
  168. fit
  169. max-height="300"
  170. @selection-change="handleSelectionChange"
  171. >
  172. <el-table-column type="selection"/>
  173. <el-table-column label="序号" type="index" align="center"/>
  174. <el-table-column label="行状态" align="center" prop="status" />
  175. <el-table-column label="行号" align="center" prop="rowNo" />
  176. <el-table-column label="业务部门名称" align="center" width="180px">
  177. <template slot-scope="scope">
  178. <el-form-item class="hang">
  179. <el-input readonly size="small" v-model="scope.row.businessDeptName"/>
  180. </el-form-item>
  181. </template>
  182. </el-table-column>
  183. <el-table-column label="业务部门" align="center" width="180px">
  184. <template slot-scope="scope">
  185. <el-form-item class="hang">
  186. <el-input readonly size="small" v-model="scope.row.businessDept">
  187. <!-- <el-button :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'DEPT_PARAM', true, '选择部门')"></el-button> -->
  188. </el-input>
  189. </el-form-item>
  190. </template>
  191. </el-table-column>
  192. <el-table-column label="一级品类" align="center" prop="materialClassifyOneName" width="180px">
  193. <template slot-scope="scope">
  194. <el-form-item class="hang">
  195. <el-input readonly size="small" v-model="scope.row.materialClassifyOneName"/>
  196. </el-form-item>
  197. </template>
  198. </el-table-column>
  199. <el-table-column label="二级品类" align="center" prop="materialClassifyTwoName" width="180px">
  200. <template slot-scope="scope">
  201. <el-form-item class="hang">
  202. <el-input readonly size="small" v-model="scope.row.materialClassifyTwoName"/>
  203. </el-form-item>
  204. </template>
  205. </el-table-column>
  206. <el-table-column label="三级品类" align="center" prop="materialClassifyThreeName" width="180px">
  207. <template slot-scope="scope">
  208. <el-form-item class="hang">
  209. <el-input readonly size="small" v-model="scope.row.materialClassifyThreeName"/>
  210. </el-form-item>
  211. </template>
  212. </el-table-column>
  213. <el-table-column label="四级品类" align="center" prop="materialClassifyFourName" width="180px">
  214. <template slot-scope="scope">
  215. <el-form-item class="hang">
  216. <el-input readonly size="small" v-model="scope.row.materialClassifyFourName"/>
  217. </el-form-item>
  218. </template>
  219. </el-table-column>
  220. <el-table-column label="预留比例" align="center" prop="reservedProportion" width="150px">
  221. <template slot-scope="scope">
  222. <el-form-item class="hang">
  223. <el-select :disabled="sonDisable" size="small" v-model="scope.row.reservedProportion">
  224. <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
  225. </el-option>
  226. </el-select>
  227. <!-- <el-input v-model="scope.row.reservedProportion"/> -->
  228. </el-form-item>
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="预留周期" align="center" prop="reservedPeriod" width="150px">
  232. <template slot-scope="scope">
  233. <el-form-item class="hang">
  234. <el-input :readonly="sonDisable" size="small" v-model="scope.row.reservedPeriod"/>
  235. </el-form-item>
  236. </template>
  237. </el-table-column>
  238. <el-table-column label="预留数量" align="center" prop="reservedQty" width="150px">
  239. <template slot-scope="scope">
  240. <el-form-item class="hang">
  241. <el-input :readonly="sonDisable" size="small" v-model="scope.row.reservedQty"/>
  242. </el-form-item>
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="采购员名称" align="center" prop="buyerName" width="120px"/>
  246. <el-table-column label="采购员" align="center" prop="buyer"/>
  247. <el-table-column label="物料编码" align="center" prop="materialCode" width="230px">
  248. <template slot-scope="scope">
  249. <el-form-item class="hang">
  250. <el-input readonly size="small" v-model="scope.row.materialCode">
  251. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
  252. </el-input>
  253. </el-form-item>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="物料名称" align="center" prop="materialName" width="230px" />
  257. <el-table-column label="规格" align="center" prop="specification" />
  258. <el-table-column label="型号" align="center" prop="model" />
  259. <el-table-column label="单位" align="center" prop="unit" />
  260. <el-table-column label="生产厂家/代理人" align="center" prop="manufacturerName" width="230px"/>
  261. <el-table-column label="注册人" align="center" prop="registrant" width="150px"/>
  262. <el-table-column label="采购周期" align="center" prop="puPeriod" width="150px">
  263. <template slot-scope="scope">
  264. <el-form-item class="hang">
  265. <el-input :readonly="sonDisable" size="small" v-model="scope.row.puPeriod"/>
  266. </el-form-item>
  267. </template>
  268. </el-table-column>
  269. <el-table-column label="有效期单位" align="center" prop="expiryUnit" width="120px"/>
  270. <el-table-column label="有效期" align="center" prop="expiry" width="120px"/>
  271. <el-table-column label="最小包装" align="center" prop="minPackage" width="120px"/>
  272. <el-table-column label="最小订货量" align="center" prop="minOrderQty" width="120px"/>
  273. <el-table-column label="最小批量" align="center" prop="minBatch" width="120px"/>
  274. <el-table-column label="安全库存" align="center" prop="safeStock" width="120px">
  275. <template slot-scope="scope">
  276. <el-form-item class="hang">
  277. <el-input :readonly="sonDisable" size="small" v-model="scope.row.safeStock"/>
  278. </el-form-item>
  279. </template>
  280. </el-table-column>
  281. <el-table-column label="月均销量" align="center" prop="averageQtyMonth" width="120px"/>
  282. <el-table-column label="实际(业务)需求量" align="center" prop="qty" width="120px">
  283. <template slot-scope="scope">
  284. <el-form-item class="hang">
  285. <el-input :readonly="sonDisable" size="small" v-model="scope.row.qty"/>
  286. </el-form-item>
  287. </template>
  288. </el-table-column>
  289. <el-table-column label="需求可用周期" align="center" prop="demandPeriod" width="120px"/>
  290. <el-table-column label="集团预测分类" align="center" prop="forecastClassify" width="120px"/>
  291. <el-table-column label="交货日期" align="center" prop="deliveryDate" width="230px">
  292. <template slot-scope="scope">
  293. <el-form-item class="hang">
  294. <el-date-picker
  295. v-model="scope.row.deliveryDate"
  296. :readonly="sonDisable"
  297. type="datetime"
  298. size="small"
  299. value-format="yyyy-MM-dd HH:mm:ss"
  300. placeholder="选择日期">
  301. </el-date-picker>
  302. </el-form-item>
  303. </template>
  304. </el-table-column>
  305. <el-table-column label="补单标识" align="center" prop="isReplenishment" width="100px">
  306. <template slot-scope="scope">
  307. <el-form-item class="hang">
  308. <el-switch
  309. v-model="scope.row.isReplenishment"
  310. :disabled="sonDisable"
  311. active-value="Y"
  312. inactive-value="N"
  313. active-color="#13ce66"
  314. inactive-color="#a1a3a9">
  315. </el-switch>
  316. </el-form-item>
  317. </template>
  318. </el-table-column>
  319. <el-table-column label="批号锁定标识" align="center" prop="isBatchLock" width="100px">
  320. <template slot-scope="scope">
  321. <el-form-item class="hang">
  322. <el-switch
  323. v-model="scope.row.isBatchLock"
  324. :disabled="sonDisable"
  325. active-value="Y"
  326. inactive-value="N"
  327. active-color="#13ce66"
  328. inactive-color="#a1a3a9">
  329. </el-switch>
  330. </el-form-item>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="业务备注" align="center" prop="remark" width="150px">
  334. <template slot-scope="scope">
  335. <el-form-item class="hang">
  336. <el-input :readonly="sonDisable" size="small" v-model="scope.row.remark"/>
  337. </el-form-item>
  338. </template>
  339. </el-table-column>
  340. <el-table-column label="采购备注" align="center" prop="puRemark" width="150px"/>
  341. <!-- <el-table-column label="末级供应仓库存量" align="center" prop="lastWarehouseQty" /> -->
  342. <!-- <el-table-column label="调拨占有量" align="center" prop="superiorAllotQty"></el-table-column> -->
  343. <el-table-column label="最终净需求量" align="center" prop="resDemandQty" width="150px">
  344. <template slot-scope="scope">
  345. <el-form-item class="hang">
  346. <el-input :readonly="sonDisable" size="small" v-model="scope.row.resDemandQty"/>
  347. </el-form-item>
  348. </template>
  349. </el-table-column>
  350. <el-table-column label="末级供应仓库" align="center" prop="lastWarehouseName" width="200px">
  351. <template slot-scope="scope">
  352. <el-form-item class="hang">
  353. <el-input readonly size="small" v-model="scope.row.lastWarehouseName">
  354. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择末级供应仓库')"></el-button>
  355. </el-input>
  356. </el-form-item>
  357. </template>
  358. </el-table-column>
  359. <el-table-column label="收货仓库" align="center" prop="deliveryWarehouseName" width="200px">
  360. <template slot-scope="scope">
  361. <el-form-item class="hang">
  362. <el-input readonly size="small" v-model="scope.row.deliveryWarehouseName">
  363. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')"></el-button>
  364. </el-input>
  365. </el-form-item>
  366. </template>
  367. </el-table-column>
  368. <el-table-column label="末级供应货位" align="center" prop="lastAllocationName" width="200px">
  369. <template slot-scope="scope">
  370. <el-form-item class="hang">
  371. <el-input readonly size="small" v-model="scope.row.lastAllocationName">
  372. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ALLOCATION_PARAM', true, '选择末级供应货位')"></el-button>
  373. </el-input>
  374. </el-form-item>
  375. </template>
  376. </el-table-column>
  377. <el-table-column label="收货货位编码" align="center" prop="deliveryAllocation" width="200px"/>
  378. <el-table-column label="收货货位" align="center" prop="deliveryAllocationName" width="200px">
  379. <template slot-scope="scope">
  380. <el-form-item class="hang">
  381. <el-input readonly size="small" v-model="scope.row.deliveryAllocationName">
  382. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位')"></el-button>
  383. </el-input>
  384. </el-form-item>
  385. </template>
  386. </el-table-column>
  387. <el-table-column label="紧急标识" align="center" prop="isUrgency" width="100px">
  388. <template slot-scope="scope">
  389. <el-form-item class="hang">
  390. <el-switch
  391. v-model="scope.row.isUrgency"
  392. :disabled="sonDisable"
  393. active-value="Y"
  394. inactive-value="N"
  395. active-color="#13ce66"
  396. inactive-color="#a1a3a9">
  397. </el-switch>
  398. </el-form-item>
  399. </template>
  400. </el-table-column>
  401. <el-table-column label="默认采购组织" align="center" prop="purOrgName" width="200px"/>
  402. <el-table-column label="默认采购组织编码" align="center" prop="puOrg" width="200px"/>
  403. <el-table-column label="末级供应调拨待入量" align="center" prop="lastStockQty" width="150px">
  404. <template slot-scope="scope">
  405. <el-form-item class="hang">
  406. <el-input :readonly="sonDisable" size="small" v-model="scope.row.lastStockQty"/>
  407. </el-form-item>
  408. </template>
  409. </el-table-column>
  410. <el-table-column label="上级供应中心现存量" align="center" prop="superiorCenterQty" width="200px"/>
  411. <el-table-column label="上级库存被调拨占用量" align="center" prop="superiorAllotQty" width="200px"/>
  412. <el-table-column label="可用量" align="center" prop="availableQty"/>
  413. <el-table-column label="调拨状态" align="center" prop="statusAllot" width="100px">
  414. <template slot-scope="scope">
  415. <el-form-item class="hang">
  416. <el-switch
  417. v-model="scope.row.statusAllot"
  418. :disabled="sonDisable"
  419. active-value="Y"
  420. inactive-value="N"
  421. active-color="#13ce66"
  422. inactive-color="#a1a3a9">
  423. </el-switch>
  424. </el-form-item>
  425. </template>
  426. </el-table-column>
  427. <el-table-column label="补单供应商编码" align="center" prop="additionalSupplier" width="200px">
  428. <template slot-scope="scope">
  429. <el-form-item class="hang">
  430. <el-input readonly size="small" v-model="scope.row.additionalSupplier">
  431. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
  432. </el-input>
  433. </el-form-item>
  434. </template>
  435. </el-table-column>
  436. <el-table-column label="补单供应商名称" align="center" prop="additionalSupplierCode" width="200px">
  437. <template slot-scope="scope">
  438. <el-form-item class="hang">
  439. <el-input readonly size="small" v-model="scope.row.additionalSupplierCode"/>
  440. </el-form-item>
  441. </template>
  442. </el-table-column>
  443. <el-table-column label="周期单位" align="center" prop="periodUnit" width="150px">
  444. <template slot-scope="scope">
  445. <el-form-item class="hang">
  446. <el-select :disabled="sonDisable" size="small" v-model="scope.row.periodUnit">
  447. <el-option v-for=" dict in dict.type.sys_period_unit" :key="dict.value" :label="dict.label" :value="dict.value">
  448. </el-option>
  449. </el-select>
  450. <!-- <el-input v-model="scope.row.periodUnit"/> -->
  451. </el-form-item>
  452. </template>
  453. </el-table-column>
  454. <!-- <el-table-column label="需求客户" align="center" prop="customer">
  455. <template slot-scope="scope">
  456. <el-form-item class="hang">
  457. <el-input v-model="scope.row.customer"/>
  458. </el-form-item>
  459. </template>
  460. </el-table-column> -->
  461. <el-table-column label="末级供应库存组织" align="center" prop="superiorStockOrgName" width="200px"></el-table-column>
  462. <el-table-column label="中心仓可用量" align="center" prop="updateTime" width="200px"></el-table-column>
  463. <el-table-column label="调拨单号" align="center" prop="allotCode"></el-table-column>
  464. <el-table-column label="收货地址" align="center" prop="deliveryAddressName" width="200px">
  465. <template slot-scope="scope">
  466. <el-form-item class="hang">
  467. <el-input readonly size="small" v-model="scope.row.deliveryAddressName">
  468. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
  469. </el-input>
  470. </el-form-item>
  471. </template>
  472. </el-table-column>
  473. <el-table-column label="收货地址编码" align="center" prop="deliveryAddress" width="200px"></el-table-column>
  474. <el-table-column label="联系人" align="center" prop="contacts"/>
  475. <el-table-column label="联系人电话" align="center" prop="contactsPhone" width="200px"/>
  476. <el-table-column label="详细地址" align="center" prop="address" width="200px"/>
  477. <el-table-column label="价格类型" align="center" prop="priceType" width="150px">
  478. <template slot-scope="scope">
  479. <el-form-item class="hang">
  480. <el-select :disabled="sonDisable" size="small" v-model="scope.row.priceType">
  481. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  482. </el-option>
  483. </el-select>
  484. <!-- <el-input v-model="scope.row.periodUnit"/> -->
  485. </el-form-item>
  486. </template>
  487. </el-table-column>
  488. <el-table-column
  489. fixed="right"
  490. label="操作"
  491. align="center"
  492. >
  493. <template slot-scope="scope">
  494. <el-button type="text" size="small" :disabled="sonDisable" @click="delLine(scope.$index, scope.row)">删除</el-button>
  495. </template>
  496. </el-table-column>
  497. </el-table>
  498. </el-card>
  499. </el-form>
  500. <div class="btn_group">
  501. <el-col :span="1.5">
  502. <el-button type="primary" size="small" plain @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
  503. </el-col>
  504. <el-col :span="1.5">
  505. <el-button type="primary" size="small" plain @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
  506. </el-col>
  507. <el-col :span="1.5" style="margin: 0 10px;">
  508. <el-button type="primary" size="small" plain @click="submit" v-if="sonPageStu == 'check'">提交</el-button>
  509. </el-col>
  510. <el-col :span="1.5">
  511. <el-button size="small" plain @click="back">返回</el-button>
  512. </el-col>
  513. <Reserved v-if="dialog.config" :isVisible="dialog.config" :info="row" @updateReserved="updateReserved"/>
  514. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  515. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="true" />
  516. </div>
  517. </div>
  518. </template>
  519. <script>
  520. import Reserved from './reserved.vue'
  521. import Refers from '@/components/Refers/refers.vue'
  522. import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan } from '@/api/purchase/purchaseDemand.js'
  523. // 用于回显参照框数据
  524. import {getRefer} from '@/api/purchase/basic.js'
  525. // 明细行选择物料参照
  526. import popDialog from '@/components/PopDialog/index.vue'
  527. export default {
  528. name: 'addDemandList',
  529. props: ['pageStu','row', 'disable'],
  530. dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business','sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
  531. components: {
  532. Reserved,
  533. Refers,
  534. popDialog
  535. },
  536. model: {
  537. prop: 'isList',
  538. event: 'jugislist'
  539. },
  540. data() {
  541. return {
  542. // 不能直接改变props传来的值
  543. sonPageStu: this.pageStu,
  544. sonDisable: this.disable,
  545. dialog: {
  546. config: false
  547. },
  548. basicForm: {
  549. code: '',
  550. org: '',
  551. orgName: '',
  552. demandBusinessType: '1',
  553. status: '0',
  554. customer: '',
  555. customerName: '',
  556. customerCode: '',
  557. customerPrincipal: '',
  558. demandPersonal: '',
  559. demandDept: '',
  560. demandDate: '',
  561. source: '1',
  562. warehouse: '',
  563. goodsAllocation: '',
  564. billType: '',
  565. isSpeical: '',
  566. isProcess: '',
  567. isMonthleyCalculate: '',
  568. remark: '',
  569. puDemandItemList: []
  570. },
  571. options: [{
  572. value: '0', label: '是',
  573. }, {
  574. value: '2', label: '否'
  575. }],
  576. basicRules: {},
  577. tableList: [],
  578. referCondition: {
  579. type: 'ORG_PARAM',
  580. isPage: true,
  581. title: '选择组织',
  582. pkOrg: '',
  583. },
  584. referConditionMx: {
  585. type: 'DEPT_PARAM',
  586. isPage: true,
  587. title: '选择部门'
  588. },
  589. tableIndex: null,
  590. orgOptions: [],
  591. personOptions: [],
  592. deptOptions: [],
  593. customerOptions: [],
  594. houseOptions: [],
  595. goodsOptions: []
  596. }
  597. },
  598. created() {
  599. if(this.pageStu == 'check') {
  600. console.log('数据', this.row)
  601. this.getDetails(this.row)
  602. } else if(this.pageStu == 'edit') {
  603. this.getDetails(this.row)
  604. }
  605. },
  606. methods: {
  607. copy() {
  608. this.$modal.msgSuccess("复制成功");
  609. this.sonPageStu = 'add'
  610. this.sonDisable = false
  611. this.getDetails(this.row)
  612. this.basicForm.id = ''
  613. this.basicForm.code = ''
  614. },
  615. handleData() {
  616. console.log('222')
  617. // 复制新增把id,编码置为空,子表去掉id
  618. this.basicForm.id = ''
  619. this.basicForm.code = ''
  620. if (this.basicForm.puDemandItemList.length !== 0) {
  621. this.basicForm.puDemandItemList.forEach(item => {
  622. if (item.id) {
  623. delete item.id
  624. }
  625. if (item.demandId) {
  626. delete item.demandId
  627. }
  628. })
  629. }
  630. },
  631. async save() {
  632. if(this.sonPageStu == 'add') {
  633. await this.handleData()
  634. await addDemand(this.basicForm).then(res => {
  635. console.log(333)
  636. if (res.code === 200) {
  637. this.$modal.msgSuccess("保存成功");
  638. this.back()
  639. }
  640. })
  641. } else if (this.sonPageStu == 'edit') {
  642. editDemand(this.basicForm).then(res => {
  643. if (res.code === 200) {
  644. this.$modal.msgSuccess("编辑成功");
  645. this.back()
  646. }
  647. })
  648. }
  649. },
  650. submit() {
  651. submitDemand(this.basicForm).then(res => {
  652. if (res.code === 200) {
  653. this.$modal.msgSuccess("提交成功");
  654. this.back()
  655. }
  656. })
  657. },
  658. // 增行
  659. addLine() {
  660. const newLine = {
  661. contacts: null,
  662. id: null,
  663. demandId: null,
  664. status: null,
  665. businessDept: null,
  666. businessDeptName: null,
  667. materialCategory: null,
  668. buyer: null,
  669. buyerName: null,
  670. mateiralClassifyOne: null,
  671. materialClassifyOneName: null,
  672. materialClassifyTwo: null,
  673. materialClassifyTwoName: null,
  674. materialClassifyThree: null,
  675. materialClassifyThreeName: null,
  676. materialClassifyFour: null,
  677. materialClassifyFourName: null,
  678. materialCode: null,
  679. material: null,
  680. materialName: null,
  681. specification: null,
  682. unit: null,
  683. unitName: null,
  684. manufacturerName: null,
  685. registrant: null,
  686. puPeriod: null,
  687. expiryUnit: null,
  688. expiry: null,
  689. minPackage: null,
  690. minOrderQty: null,
  691. minBatch: null,
  692. safeStock: null,
  693. averageQtyMonth: null,
  694. qty: null,
  695. adjustmentPersonal: null,
  696. adjustmentTime: null,
  697. manualRegulation: null,
  698. updateCause: null,
  699. reservedProportion: null,
  700. reservedPeriod: null,
  701. reservedQty: null,
  702. demandPeriod: null,
  703. forecastClassify: null,
  704. deliveryDate: null,
  705. isUrgency: 'N',
  706. isReplenishment: 'N',
  707. isBatchLock: 'N',
  708. remark: null,
  709. puRemark: null,
  710. lastWarehouseQty: null,
  711. resDemandQty: null,
  712. lastWarehouse: null,
  713. lastWarehouseName: null,
  714. deliveryWarehouse: null,
  715. deliveryWarehouseName: null,
  716. lastAllocation: null,
  717. lastAllocationName: null,
  718. deliveryAllocation: null,
  719. deliveryAllocationName: null,
  720. passageOn: null,
  721. puOrg: null,
  722. purOrgName: null,
  723. lastStockQty: null,
  724. superiorCenterQty: null,
  725. superiorAllotQty: null,
  726. availableQty: null,
  727. statusAllot: 'N',
  728. additionalSupplier: null,
  729. additionalSupplierCode: null,
  730. periodUnit: null,
  731. demandCustomer: null,
  732. demandCustomerName: null,
  733. lastStockOrg: null,
  734. lastStockOrgName: null,
  735. superiorStockOrg: null,
  736. superiorStockOrgName: null,
  737. allotCode: null,
  738. deliveryAddress: null,
  739. deliveryAddressName: null,
  740. contacts: null,
  741. contactsPhone: null,
  742. address: null,
  743. source: null,
  744. priceType: null,
  745. puManagerApprover: null,
  746. puManagerApproverName: null,
  747. processTime: null,
  748. affirmer: null,
  749. tenantId: null,
  750. revision: null,
  751. createBy: null,
  752. createByName: null,
  753. createTime: null,
  754. updateBy: null,
  755. updateByName: null,
  756. updateTime: null,
  757. delFlag: null,
  758. // 新增字段
  759. model: null,
  760. }
  761. this.basicForm.puDemandItemList.push(newLine)
  762. },
  763. delLine(index) {
  764. console.log('删除行:', index)
  765. // this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  766. // return item.id !== row.id
  767. // })
  768. this.basicForm.puDemandItemList.splice(index,1)
  769. },
  770. back() {
  771. this.$emit('jugislist', true)
  772. let queryParams = {
  773. pageNum: 1,
  774. pageSize: 10
  775. }
  776. this.$emit('refresh', queryParams)
  777. },
  778. // 如果需要回显则调用详情接口
  779. getDetails(row) {
  780. getDemandDetail(row.id).then(res => {
  781. if (res.code === 200) {
  782. // this.basicForm = res.data
  783. let reciveForm = res.data
  784. let params = {...{id: row.id}, ...{pageNum:1, pageSize: 10}}
  785. getDemandSonDetail(params).then(res => {
  786. if (res.code === 200) {
  787. reciveForm.puDemandItemList = res.rows
  788. console.log('reciveForm',reciveForm)
  789. this.basicForm = reciveForm
  790. if(this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
  791. if(this.basicForm.customer) { this.reBackRefer('CUSTOMER_PARAM', this.basicForm.customer) }
  792. if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal) }
  793. if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  794. if(this.basicForm.warehouse) { this.reBackRefer('WAREHOUSE_PARAM', this.basicForm.warehouse) }
  795. if(this.basicForm.goodsAllocation) { this.reBackRefer('ALLOCATION_PARAM', this.basicForm.goodsAllocation) }
  796. }
  797. console.log('111')
  798. })
  799. }
  800. })
  801. },
  802. handleSelectionChange() {},
  803. // 点击预留单展示
  804. showReserved() {
  805. this.dialog.config = true
  806. },
  807. // 修改是否让页面显示与隐藏的事件
  808. updateReserved (val) {
  809. this.dialog.config = val
  810. },
  811. // 回显参照框
  812. reBackRefer(type, id) {
  813. getRefer({type: type, id: id}).then(res => {
  814. if(type == 'ORG_PARAM') {
  815. this.orgOptions = res.rows
  816. }
  817. if (type == 'CUSTOMER_PARAM') {
  818. this.customerOptions = res.rows
  819. }
  820. if (type == 'CONTACTS_PARAM') {
  821. this.personOptions = res.rows
  822. }
  823. if (type == 'DEPT_PARAM') {
  824. this.deptOptions = res.rows
  825. }
  826. if (type == 'WAREHOUSE_PARAM') {
  827. this.houseOptions = res.rows
  828. }
  829. if (type == 'ALLOCATION_PARAM') {
  830. this.goodsOptions = res.rows
  831. }
  832. })
  833. },
  834. chooseOrg(type, isPage, title) {
  835. this.referCondition.type = type
  836. this.referCondition.isPage = isPage
  837. this.referCondition.title = title
  838. // 选择货位时要传入组织id
  839. this.referCondition.pkOrg = this.basicForm.org
  840. this.$refs.refer.init(this.referCondition)
  841. },
  842. selectionsToInput(selection) {
  843. if(this.referCondition.type == 'ORG_PARAM') {
  844. this.orgOptions = selection
  845. this.basicForm.org = selection[0].id
  846. this.basicForm.orgName = selection[0].name
  847. }
  848. if(this.referCondition.type == 'CUSTOMER_PARAM') {
  849. this.customerOptions = selection
  850. this.basicForm.customer = selection[0].id
  851. this.basicForm.customerName = selection[0].name
  852. this.basicForm.customerCode = selection[0].code
  853. }
  854. if(this.referCondition.type == 'CONTACTS_PARAM') {
  855. this.personOptions = selection
  856. this.basicForm.demandPersonal = selection[0].id
  857. }
  858. if(this.referCondition.type == 'DEPT_PARAM') {
  859. this.deptOptions = selection
  860. this.basicForm.demandDept = selection[0].id
  861. }
  862. if(this.referCondition.type == 'WAREHOUSE_PARAM') {
  863. this.houseOptions = selection
  864. this.basicForm.warehouse = selection[0].id
  865. }
  866. if(this.referCondition.type == 'ALLOCATION_PARAM') {
  867. this.goodsOptions = selection
  868. this.basicForm.goodsAllocation = selection[0].id
  869. }
  870. // if(this.referConditionMx.type == 'DEPT_PARAM') {
  871. // this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].code
  872. // this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].name
  873. // }
  874. if(this.referConditionMx.title == '选择末级供应仓库') {
  875. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = selection[0].name
  876. }
  877. if(this.referConditionMx.title == '选择收货仓库') {
  878. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
  879. }
  880. if(this.referConditionMx.title == '选择末级供应货位') {
  881. this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = selection[0].name
  882. }
  883. if(this.referConditionMx.title == '选择收货货位') {
  884. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].code
  885. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
  886. }
  887. if(this.referConditionMx.title == '选择补单供应商') {
  888. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].code
  889. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierCode = selection[0].name
  890. }
  891. if(this.referConditionMx.title == '选择收货地址') {
  892. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
  893. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
  894. this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
  895. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
  896. this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
  897. }
  898. },
  899. // 明细行选择物料编码带出数据
  900. chooseMaterial(index) {
  901. console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
  902. this.tableIndex = index
  903. this.$refs.materialRefer.init()
  904. },
  905. selectMaterial(selection) {
  906. console.log('选中的物料', selection)
  907. // 通过选择物料查询采购员
  908. queryMan(selection[0].id).then(res => {
  909. if(res.code === 200 && res.rows.length !== 0) {
  910. this.basicForm.puDemandItemList[this.tableIndex].buyer = res.rows[0].buyer
  911. this.basicForm.puDemandItemList[this.tableIndex].buyerName = res.rows[0].buyerName
  912. }
  913. })
  914. this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].businessDepartment
  915. this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].businessDepartmentName
  916. this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
  917. this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
  918. this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
  919. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
  920. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
  921. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass
  922. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
  923. this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
  924. this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
  925. this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
  926. this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
  927. this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
  928. this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
  929. this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod
  930. this.basicForm.puDemandItemList[this.tableIndex].expiryUnit = selection[0].expiryUnitIdName
  931. // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
  932. this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].minPackQty
  933. this.basicForm.puDemandItemList[this.tableIndex].minOrderQty = selection[0].minOrderQty
  934. this.basicForm.puDemandItemList[this.tableIndex].minBatch = selection[0].minBatchQty
  935. this.basicForm.puDemandItemList[this.tableIndex].safeStock = selection[0].safeStock
  936. this.basicForm.puDemandItemList[this.tableIndex].purOrgName = selection[0].purchasingOrganizationName
  937. this.basicForm.puDemandItemList[this.tableIndex].puOrg = selection[0].purchasingOrganization
  938. },
  939. // 明细行选择业务部门参照带出业务部门数据
  940. chooseDept(index, type, isPage, title) {
  941. this.tableIndex = index
  942. this.referConditionMx.type = type
  943. this.referConditionMx.isPage = isPage
  944. this.referConditionMx.title = title
  945. this.$refs.refer.init(this.referConditionMx)
  946. }
  947. }
  948. }
  949. </script>
  950. <style lang="scss" scoped>
  951. .btn_group {
  952. width: 100%;
  953. margin: 20px 0;
  954. display: flex;
  955. justify-content: center;
  956. }
  957. .btn_grooup {
  958. margin-bottom: 10px;
  959. display: flex;
  960. justify-content: flex-end;
  961. }
  962. .hang {
  963. margin: auto;
  964. }
  965. .hang ::v-deep .el-form-item__content{
  966. margin-left: 0px !important;
  967. }
  968. </style>