stockOutOrder.vue 81KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button
  6. size="small"
  7. @click="AddNewOrder"
  8. class="filter-item"
  9. style="float: right"
  10. type="primary"
  11. icon="el-icon-circle-plus-outline"
  12. >新增</el-button
  13. >
  14. </div>
  15. <div class="app-container">
  16. <div class="cell clearfix">
  17. <label class="title"><span class="name">仓库</span> :</label>
  18. <el-select
  19. size="small"
  20. v-model="storehouse_id"
  21. filterable
  22. placeholder="请选择仓库"
  23. style="width: 200px"
  24. @change="changeStoreHouse"
  25. >
  26. <el-option
  27. v-for="(option, index) in houselist"
  28. :key="index"
  29. :label="option.storehouse_name"
  30. :value="option.id"
  31. >
  32. </el-option>
  33. </el-select>
  34. <el-input
  35. size="small"
  36. style="width: 200px"
  37. class="filter-item"
  38. v-model.trim="searchKey"
  39. placeholder="单据编码/制单人/耗材名称"
  40. />
  41. <el-button
  42. size="small"
  43. class="filter-item"
  44. type="primary"
  45. icon="el-icon-search"
  46. @click="search"
  47. >搜索</el-button
  48. >
  49. <div style="margin-left: 10px">
  50. <label class="title"><span class="name">出库时间</span> : </label>
  51. <el-date-picker
  52. size="small"
  53. v-model="start_time"
  54. prefix-icon="el-icon-date"
  55. :editable="false"
  56. style="width: 196px"
  57. type="date"
  58. placeholder="选择日期时间"
  59. align="right"
  60. format="yyyy-MM-dd"
  61. value-format="yyyy-MM-dd"
  62. @change="startTimeChange"
  63. ></el-date-picker>
  64. <span class="cellLine"> - </span>
  65. <el-date-picker
  66. size="small"
  67. v-model="end_time"
  68. prefix-icon="el-icon-date"
  69. :editable="false"
  70. style="width: 196px"
  71. type="date"
  72. placeholder="选择日期时间"
  73. align="right"
  74. format="yyyy-MM-dd"
  75. value-format="yyyy-MM-dd"
  76. @change="endTimeChange"
  77. ></el-date-picker>
  78. </div>
  79. <!-- <div style="margin-left: 10px">
  80. <span>审核状态:</span>
  81. <el-select
  82. v-model="check_id"
  83. style="width: 140px; margin-right: 10px"
  84. placeholder="请选择"
  85. @change="changeTypeName"
  86. >
  87. <el-option
  88. v-for="item in checkList"
  89. :key="item.id"
  90. :label="item.name"
  91. :value="item.id"
  92. >
  93. </el-option>
  94. </el-select>
  95. </div> -->
  96. </div>
  97. <div class="cell clearfix">
  98. <el-checkbox
  99. style="width: 70px"
  100. v-model="checked"
  101. @change="changeAllSelected"
  102. >全选</el-checkbox
  103. >
  104. <el-button size="small" icon="el-icon-delete" @click="batchDelete"
  105. >删除</el-button
  106. >
  107. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  108. <el-button size="small" type="primary" @click="toExport" :disabled="exportLoding">导出</el-button>
  109. <span>&nbsp;&nbsp;</span>
  110. <label class="title"><span class="name">出库方式</span> :</label>
  111. <el-select size="small" v-model="way_type" filterable placeholder="请选择仓库" style="width:200px" @change="changeWay">
  112. <el-option
  113. v-for="(option, index) in wayList"
  114. :key="index"
  115. :label="option.name"
  116. :value="option.id">
  117. </el-option>
  118. </el-select>
  119. <span>&nbsp;&nbsp;</span>
  120. <label class="title"><span class="name">审核状态</span> :</label>
  121. <el-select size="small" v-model="check_type" filterable placeholder="请选择仓库" style="width:200px" @change="changeCheckType">
  122. <el-option
  123. v-for="(option, index) in checkList"
  124. :key="index"
  125. :label="option.name"
  126. :value="option.id">
  127. </el-option>
  128. </el-select>
  129. </div>
  130. <el-table
  131. :data="warehouseOutDate"
  132. :class="signAndWeighBoxPatients"
  133. style="width: 100%"
  134. border
  135. highlight-current-row
  136. ref="multipleTable"
  137. @selection-change="select"
  138. :row-style="{ color: '#303133' }"
  139. :header-cell-style="{
  140. backgroundColor: 'rgb(245, 247, 250)',
  141. color: '#606266',
  142. }"
  143. @current-change="handleSearch"
  144. >
  145. <el-table-column type="selection" width="55" align="center">
  146. </el-table-column>
  147. <el-table-column label="单据日期" align="center">
  148. <template slot-scope="scope">
  149. {{ scope.row.warehouse_out_time | parseTime("{y}-{m}-{d}") }}
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="单据编号" align="center">
  153. <template slot-scope="scope">
  154. {{ scope.row.warehouse_out_order_number }}
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="仓库名称" align="center">
  158. <template slot-scope="scope">
  159. {{ getHouseName(scope.row.storehouse_id) }}
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="制单人" align="center">
  163. <template slot-scope="scope">
  164. {{ getXuserName(scope.row.creater) }}
  165. </template>
  166. </el-table-column>
  167. <el-table-column label="出库方式" align="center">
  168. <template slot-scope="scope">
  169. <span v-if="scope.row.is_sys == 1">自动出库</span>
  170. <span v-if="scope.row.is_sys == 0">手动出库</span>
  171. <span v-if="scope.row.is_sys == 12">调拨出库</span>
  172. <span v-if="scope.row.is_sys == 5">结算出库</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="审核状态" align="center">
  176. <template slot-scope="scope">
  177. <span v-if="scope.row.is_check == 1">已审核</span>
  178. <span v-if="scope.row.is_check == 2">未审核</span>
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="操作" align="center" width="300px">
  182. <template slot-scope="scope">
  183. <el-tooltip
  184. class="item"
  185. effect="dark"
  186. content="编辑"
  187. placement="top"
  188. >
  189. <el-button
  190. size="mini"
  191. type="primary"
  192. icon="el-icon-edit-outline"
  193. @click="handleEdit(scope.$index, scope.row)"
  194. >
  195. </el-button>
  196. </el-tooltip>
  197. <el-tooltip
  198. class="item"
  199. effect="dark"
  200. content="删除"
  201. placement="top"
  202. >
  203. <el-button
  204. size="mini"
  205. type="danger"
  206. :disabled="scope.row.is_sys == 1"
  207. icon="el-icon-delete"
  208. @click="handleDelete(scope.$index, scope.row)"
  209. >
  210. </el-button>
  211. </el-tooltip>
  212. </template>
  213. </el-table-column>
  214. </el-table>
  215. <el-pagination
  216. @size-change="handleSizeChange"
  217. @current-change="handleCurrentChange"
  218. :page-sizes="[5, 10, 50, 100]"
  219. :page-size="5"
  220. background
  221. style="margin-top: 20px; text-align: right"
  222. layout="total, sizes, prev, pager, next, jumper"
  223. :total="total"
  224. >
  225. </el-pagination>
  226. <!-- 详情 -->
  227. <div v-show="tableShow" style="margin-top: 10px">
  228. <el-table
  229. :data="tableList"
  230. :class="signAndWeighBoxPatients"
  231. style="width: 100%"
  232. border
  233. highlight-current-row
  234. ref="multipleTableOne"
  235. @selection-change="select"
  236. :row-style="{ color: '#303133' }"
  237. :header-cell-style="{
  238. backgroundColor: 'rgb(245, 247, 250)',
  239. color: '#606266',
  240. }"
  241. :cell-class-name="cellStyle"
  242. >
  243. <el-table-column label="耗材名称" align="center">
  244. <template slot-scope="scope">
  245. {{ scope.row.good_name }}
  246. </template>
  247. </el-table-column>
  248. <el-table-column label="规格&单位" align="center">
  249. <template slot-scope="scope">
  250. {{ scope.row.specification_name }} / {{ scope.row.packing_unit }}
  251. </template>
  252. </el-table-column>
  253. <el-table-column label="国家编码" align="center">
  254. <template slot-scope="scope">
  255. {{ scope.row.social_security_directory_code }}
  256. </template>
  257. </el-table-column>
  258. <!-- <el-table-column label="仓库名称" align="center">
  259. <template slot-scope="scope">
  260. {{ getHouseName(scope.row.storehouse_id) }}
  261. </template>
  262. </el-table-column> -->
  263. <!-- <el-table-column label="剩余库存" align="center" v-if="is_sys== 0">
  264. <template slot-scope="scope">
  265. <span>{{scope.row.stock_count}}</span>
  266. </template>
  267. </el-table-column> -->
  268. <el-table-column label="仓库名称" align="center">
  269. <template slot-scope="scope">
  270. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  271. <td style="border-right: none; border-inline-end: none;text-align: center">
  272. {{ getHouseName(item.storehouse_id) }}
  273. </td>
  274. </tr>
  275. </template>
  276. </el-table-column>
  277. <el-table-column label="出库数量" align="center">
  278. <template slot-scope="scope">
  279. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  280. <td style="border-right: none; border-inline-end: none;text-align: center">
  281. {{getAllStockCount(scope.row.child,item.warehousing_id) - getCancelInfo(item.warehousing_id,item.good_id)}}
  282. </td>
  283. </tr>
  284. </template>
  285. </el-table-column>
  286. <el-table-column label="批次" align="center">
  287. <template slot-scope="scope">
  288. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  289. <td style="border-right: none; border-inline-end: none;text-align: center">
  290. {{getNumber(scope.row.child,item.warehousing_id)}}
  291. </td>
  292. </tr>
  293. </template>
  294. </el-table-column>
  295. <el-table-column label="出库对象" align="center" v-if="is_sys == 0">
  296. <template slot-scope="scope">
  297. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  298. <td style="border-right: none; border-inline-end: none;text-align: center">
  299. {{ getXuserName(scope.row.admin_user_id) }}
  300. </td>
  301. </tr>
  302. </template>
  303. </el-table-column>
  304. <el-table-column label="使用患者" align="center" v-if="is_sys == 0">
  305. <template slot-scope="scope">
  306. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  307. <td style="border-right: none; border-inline-end: none;text-align: center">
  308. {{getPatientName(item.patient_id ) }}
  309. </td>
  310. </tr>
  311. </template>
  312. </el-table-column>
  313. <el-table-column label="出货价" align="center">
  314. <template slot-scope="scope">
  315. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  316. <td style="border-right: none; border-inline-end: none;text-align: center">
  317. {{getAllStockCountPrice(scope.row.child,item.warehousing_id)}}
  318. </td>
  319. </tr>
  320. </template>
  321. </el-table-column>
  322. <el-table-column label="总价" align="center">
  323. <template slot-scope="scope">
  324. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  325. <td style="border-right: none; border-inline-end: none;text-align: center">
  326. <!-- {{(getAllStockCount(scope.row.child,item.warehousing_id) * getAllStockCountPrice(scope.row.child,item.warehousing_id)).toFixed(2)}} -->
  327. {{((getAllStockCount(scope.row.child,item.warehousing_id) - getCancelInfo(item.warehousing_id,item.good_id)) * getAllStockCountPrice(scope.row.child,item.warehousing_id)).toFixed(2)}}
  328. </td>
  329. </tr>
  330. </template>
  331. </el-table-column>
  332. <el-table-column label="生产厂家" align="center">
  333. <template slot-scope="scope">
  334. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  335. <td style="border-right: none; border-inline-end: none;text-align: center">
  336. {{getManufactuerNameSix(scope.row.child,item.warehousing_id)}}
  337. </td>
  338. </tr>
  339. </template>
  340. </el-table-column>
  341. <el-table-column label="经销商" align="center">
  342. <template slot-scope="scope">
  343. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  344. <td style="border-right: none; border-inline-end: none;text-align: center">
  345. {{getDealerNameSix(scope.row.child,item.warehousing_id)}}
  346. </td>
  347. </tr>
  348. </template>
  349. </el-table-column>
  350. <el-table-column label="生产日期" align="center">
  351. <template slot-scope="scope">
  352. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  353. <td style="border-right: none; border-inline-end: none;text-align: center">
  354. {{getProductDate(scope.row.child,item.warehousing_id)}}
  355. </td>
  356. </tr>
  357. </template>
  358. </el-table-column>
  359. <el-table-column label="有效期" align="center">
  360. <template slot-scope="scope">
  361. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  362. <td style="border-right: none; border-inline-end: none;text-align: center">
  363. {{getExpiryDate(scope.row.child,item.warehousing_id)}}
  364. </td>
  365. </tr>
  366. </template>
  367. </el-table-column>
  368. <el-table-column label="注册编码" align="center" v-if="is_sys == 1">
  369. <template slot-scope="scope">
  370. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  371. <td style="border-right: none; border-inline-end: none;text-align: center">
  372. <span>{{getRegisterNumber(scope.row.child,item.warehousing_id)}}</span>
  373. </td>
  374. </tr>
  375. </template>
  376. </el-table-column>
  377. <el-table-column label="注册编码" align="center" v-if="is_sys == 0">
  378. <template slot-scope="scope">
  379. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  380. <td style="border-right: none; border-inline-end: none;text-align: center">
  381. <span>{{scope.row.register_number}}</span>
  382. </td>
  383. </tr>
  384. </template>
  385. </el-table-column>
  386. <el-table-column label="备注" align="center" v-if="is_sys == 1">
  387. <template slot-scope="scope">
  388. <tr style="background: none" v-for="(item,index) in scope.row.childOne" :key="index">
  389. <td style="border-right: none; border-inline-end: none;text-align: center">
  390. {{getRemark(scope.row.child,item.warehousing_id)}}
  391. </td>
  392. </tr>
  393. </template>
  394. </el-table-column>
  395. <el-table-column label="备注" align="center" v-if="is_sys == 0">
  396. <template slot-scope="scope">
  397. {{scope.row.remark}}
  398. </template>
  399. </el-table-column>
  400. <el-table-column label="操作" align="center">
  401. <template slot-scope="scope">
  402. <span
  403. style="color: #589ff8"
  404. @click="GetOrderDetailById(scope.row)"
  405. >使用明细</span
  406. >
  407. </template>
  408. </el-table-column>
  409. </el-table>
  410. </div>
  411. </div>
  412. <!-- 新增弹窗 -->
  413. <el-dialog title="提示" :visible.sync="dialogVisible" width="80%">
  414. <span>
  415. <div class="filter-container">
  416. <span style="font-size: 18px; color: #606266">出库单详情</span>
  417. <el-row style="float: right">
  418. <span style="color: #606266">{{
  419. warehousingOutInfo.info.warehouse_out_order_number
  420. }}</span>
  421. </el-row>
  422. </div>
  423. <div class="cell clearfix">
  424. <span style="width: 300px; color: #606266"
  425. >单据日期:
  426. {{
  427. warehousingOutInfo.info.warehouse_out_time
  428. | parseTime("{y}-{m}-{d}")
  429. }}
  430. </span>
  431. <span style="width: 300px; color: #606266"
  432. >厂商
  433. {{ getManufactuerName(warehousingOutInfo.info.manufacturer) }}</span
  434. >
  435. <span style="width: 300px; color: #606266"
  436. >经销商 {{ getDealerName(warehousingOutInfo.info.dealer) }}</span
  437. >
  438. </div>
  439. <div class="filter-container" style="margin-top: 10px">
  440. <el-button
  441. size="small"
  442. icon="el-icon-edit"
  443. @click="editRecord(warehousingOutInfo.info.id)"
  444. v-if="warehousingOutInfo.info.is_sys != 1"
  445. >编辑</el-button
  446. >
  447. <el-button
  448. size="small"
  449. icon="el-icon-delete"
  450. @click="deleteRecord"
  451. v-if="warehousingOutInfo.info.is_sys != 1"
  452. >删除</el-button
  453. >
  454. </div>
  455. <el-row :gutter="12" style="margin-top: 10px">
  456. <el-table
  457. :data="warehousingOutInfo.warehousingOutData"
  458. :class="signAndWeighBoxPatients"
  459. style="width: 100%"
  460. border
  461. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  462. >
  463. <el-table-column min-width="35" align="center">
  464. <template slot="header" slot-scope="scope">
  465. <span>耗材类型</span>
  466. </template>
  467. <template slot-scope="scope">
  468. <span v-if="scope.row.good_type_id != 0">{{
  469. getTypeName(scope.row.good_type_id)
  470. }}</span>
  471. </template>
  472. </el-table-column>
  473. <el-table-column min-width="35" align="center">
  474. <template slot="header" slot-scope="scope">
  475. <span>耗材名称</span>
  476. </template>
  477. <template slot-scope="scope">
  478. <span v-if="scope.row.good_id != 0">{{
  479. getTypeNameOne(scope.row.good_id)
  480. }}</span>
  481. </template>
  482. </el-table-column>
  483. <el-table-column min-width="35" align="center">
  484. <template slot="header" slot-scope="scope">
  485. <span>规格型号</span>
  486. </template>
  487. <template slot-scope="scope">
  488. <span v-if="scope.row.good_id != 0">{{
  489. getSpecificationName(scope.row.good_id)
  490. }}</span>
  491. </template>
  492. </el-table-column>
  493. <el-table-column min-width="23" align="center">
  494. <template slot="header" slot-scope="scope">
  495. <span>出货价</span>
  496. </template>
  497. <template slot-scope="scope">
  498. <span>{{ scope.row.price }}</span>
  499. </template>
  500. </el-table-column>
  501. <el-table-column min-width="23" align="center">
  502. <template slot="header" slot-scope="scope">
  503. <span>出库数量</span>
  504. </template>
  505. <template slot-scope="scope">
  506. <span v-if="scope.row.is_sys == 0">{{ scope.row.count }}</span>
  507. <span v-if="scope.row.is_sys == 1">{{
  508. getOutStockCount(scope.row.good_id)
  509. }}</span>
  510. </template>
  511. </el-table-column>
  512. <el-table-column label="总价" min-width="20" align="center">
  513. <template slot-scope="scope">
  514. {{ calculate(scope.row.price * scope.row.count) }}
  515. </template>
  516. </el-table-column>
  517. <el-table-column label="备注" min-width="20" align="center">
  518. <template slot-scope="scope">
  519. <el-popover placement="top-start" width="250" trigger="hover">
  520. <div>{{ scope.row.remark }}</div>
  521. <span slot="reference" v-if="scope.row.remark.length > 20">{{
  522. scope.row.remark.substr(0, 20) + "..."
  523. }}</span>
  524. <span slot="reference" v-else>{{ scope.row.remark }}</span>
  525. </el-popover>
  526. </template>
  527. </el-table-column>
  528. <el-table-column label="" align="center">
  529. <template slot-scope="scope" v-if="scope.row.is_sys == 1">
  530. <div
  531. style="color: #589ff8"
  532. @click="GetOrderDetailThree(scope.row.id)"
  533. >
  534. 使用明细
  535. </div>
  536. </template>
  537. </el-table-column>
  538. </el-table>
  539. </el-row>
  540. </span>
  541. <span slot="footer" class="dialog-footer">
  542. <el-button @click="dialogVisible = false">取 消</el-button>
  543. <el-button type="primary" @click="dialogVisible = false"
  544. >确 定</el-button
  545. >
  546. </span>
  547. </el-dialog>
  548. <!-- 使用明细查询 -->
  549. <el-dialog
  550. title="出库单详情"
  551. :visible.sync="editdialogVisibleTwo"
  552. width="80%"
  553. >
  554. <span>
  555. <div class="filter-container">
  556. <span style="font-size: 18px; color: #606266">耗材使用明细</span>
  557. </div>
  558. <el-row :gutter="12" style="margin-top: 10px">
  559. <el-table
  560. :data="infoList"
  561. :class="signAndWeighBoxPatients"
  562. style="width: 80%"
  563. border
  564. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  565. >
  566. <el-table-column min-width="35" align="center">
  567. <template slot="header" slot-scope="scope">
  568. <span>序号</span>
  569. </template>
  570. <template slot-scope="scope">
  571. {{ scope.$index + 1 }}
  572. </template>
  573. </el-table-column>
  574. <el-table-column min-width="35" align="center">
  575. <template slot="header" slot-scope="scope">
  576. <span>使用人</span>
  577. </template>
  578. <template slot-scope="scope">
  579. <span v-if="scope.row.is_sys == 0">系统 </span>
  580. <span v-if="scope.row.is_sys == 5"> {{getRow(scope.row)}} </span>
  581. </template>
  582. </el-table-column>
  583. <el-table-column min-width="35" align="center">
  584. <template slot="header" slot-scope="scope">
  585. <span>使用数量</span>
  586. </template>
  587. <template slot-scope="scope">
  588. {{ scope.row.count }}
  589. </template>
  590. </el-table-column>
  591. <el-table-column min-width="35" align="center">
  592. <template slot="header" slot-scope="scope">
  593. <span>使用时间</span>
  594. </template>
  595. <template slot-scope="scope">
  596. <span
  597. >{{ scope.row.ctime | parseTime("{y}-{m}-{d}") }}
  598. </span>
  599. </template>
  600. </el-table-column>
  601. </el-table>
  602. </el-row>
  603. </span>
  604. <span slot="footer" class="dialog-footer">
  605. <el-button @click="editdialogVisibleTwo = false">取 消</el-button>
  606. <el-button type="primary" @click="editdialogVisibleTwo = false"
  607. >确 定</el-button
  608. >
  609. </span>
  610. </el-dialog>
  611. <!-- 编辑 -->
  612. <el-dialog title="编辑出库单" :visible.sync="editDialogVisible" width="80%">
  613. <span>
  614. <div style="margin-bottom: 10px">
  615. <label class="title"><span class="name">出库时间</span> : </label>
  616. <el-date-picker
  617. size="small"
  618. v-model="warehouse_out_time"
  619. prefix-icon="el-icon-date"
  620. :editable="false"
  621. style="width: 196px"
  622. type="date"
  623. placeholder="选择日期时间"
  624. align="right"
  625. format="yyyy-MM-dd"
  626. value-format="yyyy-MM-dd"
  627. ></el-date-picker>
  628. <label class="title" style="margin-left: 10px"
  629. ><span class="name">经 销 商</span> :
  630. </label>
  631. <el-select
  632. size="small"
  633. v-model="form.dealer"
  634. clearable
  635. placeholder="请选择经销商"
  636. @change="changeDealer"
  637. >
  638. <el-option
  639. v-for="(option, index) in dealer"
  640. :key="index"
  641. :label="option.dealer_name"
  642. :value="option.id"
  643. >
  644. </el-option>
  645. </el-select>
  646. <label class="title" style="margin-left: 10px"
  647. ><span class="name">厂商</span> :
  648. </label>
  649. <el-select
  650. size="small"
  651. v-model="form.manufacturer"
  652. clearable
  653. placeholder="请选择厂商"
  654. @change="changeManufacturer"
  655. >
  656. <el-option
  657. v-for="(option, index) in manufacturer"
  658. :key="index"
  659. :label="option.manufacturer_name"
  660. :value="option.id"
  661. >
  662. </el-option>
  663. </el-select>
  664. </div>
  665. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  666. <el-table
  667. :data="recordInfo.recordData"
  668. :class="signAndWeighBoxPatients"
  669. style="width: 100%"
  670. border
  671. max-height="450"
  672. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  673. >
  674. <el-table-column min-width="35" align="center">
  675. <template slot="header" slot-scope="scope">
  676. <span>耗材类型<span style="color: red">*</span></span>
  677. </template>
  678. <template slot-scope="scope">
  679. <el-form-item style="padding-top: 15px">
  680. <el-input
  681. placeholder="请输入商品类型"
  682. v-model="scope.row.good_type_id"
  683. :value="typeName(scope.row.good_type_id)"
  684. @focus="showDialog(scope.$index, scope.row)"
  685. ></el-input>
  686. </el-form-item>
  687. </template>
  688. </el-table-column>
  689. <el-table-column min-width="35" align="center">
  690. <template slot="header" slot-scope="scope">
  691. <span>规格名称<span style="color: red">*</span></span>
  692. </template>
  693. <template slot-scope="scope">
  694. <el-form-item style="padding-top: 15px">
  695. <el-input
  696. placeholder="请输入规格名称"
  697. v-model="scope.row.good_id"
  698. :value="specificationName(scope.row.good_id)"
  699. @focus="showDialog(scope.$index, scope.row)"
  700. ></el-input>
  701. </el-form-item>
  702. </template>
  703. </el-table-column>
  704. <el-table-column min-width="23" align="center">
  705. <template slot="header" slot-scope="scope">
  706. <span>单价<span style="color: red">*</span></span>
  707. </template>
  708. <template slot-scope="scope">
  709. <el-form-item
  710. :prop="'recordData.' + scope.$index + '.price'"
  711. :rules="tableRules.price"
  712. style="padding-top: 17px"
  713. >
  714. <el-input type="number" v-model="scope.row.price"></el-input>
  715. </el-form-item>
  716. </template>
  717. </el-table-column>
  718. <el-table-column min-width="23" align="center">
  719. <template slot="header" slot-scope="scope">
  720. <span>出库数量<span style="color: red">*</span></span>
  721. </template>
  722. <template slot-scope="scope">
  723. <el-form-item
  724. :prop="'recordData.' + scope.$index + '.count'"
  725. :rules="tableRules.count"
  726. style="padding-top: 17px"
  727. >
  728. <el-input type="number" v-model="scope.row.count"></el-input>
  729. </el-form-item>
  730. </template>
  731. </el-table-column>
  732. <el-table-column label="总价" min-width="20" align="center">
  733. <template slot-scope="scope">
  734. {{ calculate(scope.row.price * scope.row.count) }}
  735. </template>
  736. </el-table-column>
  737. <el-table-column label="备注" min-width="20" align="center">
  738. <template slot-scope="scope">
  739. <el-input v-model="scope.row.remark"></el-input>
  740. </template>
  741. </el-table-column>
  742. <el-table-column label="操作" align="center" min-width="30">
  743. <template slot-scope="scope">
  744. <el-tooltip
  745. class="item"
  746. effect="dark"
  747. content="新增"
  748. placement="top"
  749. >
  750. <el-button
  751. size="mini"
  752. type="primary"
  753. icon="el-icon-circle-plus-outline"
  754. @click="handleEditOne(scope.$index, scope.row)"
  755. >
  756. </el-button>
  757. </el-tooltip>
  758. <el-tooltip
  759. class="item"
  760. effect="dark"
  761. content="删除"
  762. placement="top"
  763. >
  764. <el-button
  765. size="mini"
  766. type="danger"
  767. icon="el-icon-delete"
  768. @click="handleDeleteOne(scope.$index, scope.row)"
  769. >
  770. </el-button>
  771. </el-tooltip>
  772. </template>
  773. </el-table-column>
  774. </el-table>
  775. </el-form>
  776. </span>
  777. <span slot="footer" class="dialog-footer">
  778. <el-button @click="editDialogVisible = false">取 消</el-button>
  779. <el-button type="primary" @click="submit">确 定</el-button>
  780. </span>
  781. </el-dialog>
  782. <el-dialog
  783. title="出库明细"
  784. :visible.sync="editdialogVisibleThree"
  785. width="70%"
  786. >
  787. <span>
  788. <div class="app-container">
  789. <div class="filter-container">
  790. <span style="font-size: 18px; color: #606266">商品使用明细</span>
  791. </div>
  792. <el-row :gutter="12" style="margin-top: 10px">
  793. <el-table
  794. :data="userList"
  795. :class="signAndWeighBoxPatients"
  796. style="width: 50%"
  797. border
  798. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  799. >
  800. <el-table-column min-width="35" align="center">
  801. <template slot="header" slot-scope="scope">
  802. <span>序号</span>
  803. </template>
  804. <template slot-scope="scope">
  805. <span v-if="scope.row.is_total == 0">{{
  806. scope.$index + 1
  807. }}</span>
  808. <span v-if="scope.row.is_total == 1">{{ "合计" }}</span>
  809. </template>
  810. </el-table-column>
  811. <el-table-column min-width="35" align="center">
  812. <template slot="header" slot-scope="scope">
  813. <span>使用人</span>
  814. </template>
  815. <template slot-scope="scope">
  816. <span v-if="scope.row.is_total == 0">{{
  817. scope.row.name
  818. }}</span>
  819. <span v-if="scope.row.is_total == 1"></span>
  820. </template>
  821. </el-table-column>
  822. <el-table-column min-width="35" align="center">
  823. <template slot="header" slot-scope="scope">
  824. <span>使用数量</span>
  825. </template>
  826. <template slot-scope="scope">
  827. <span v-if="scope.row.is_total == 0">{{ scope.row.count - scope.row.cancel_count}}{{ scope.row.packing_unit }}</span>
  828. <span v-if="scope.row.is_total == 1">{{ scope.row.total}}</span>
  829. </template>
  830. </el-table-column>
  831. <el-table-column min-width="60" align="center">
  832. <template slot="header" slot-scope="scope">
  833. <span>使用时间</span>
  834. </template>
  835. <template slot-scope="scope">
  836. <span
  837. >{{ scope.row.ctime | parseTime("{y}-{m}-{d}") }}
  838. </span>
  839. </template>
  840. </el-table-column>
  841. </el-table>
  842. </el-row>
  843. </div>
  844. </span>
  845. <span slot="footer" class="dialog-footer">
  846. <el-button @click="editdialogVisibleThree = false">取 消</el-button>
  847. <el-button type="primary" @click="editdialogVisibleThree = false"
  848. >确 定</el-button
  849. >
  850. </span>
  851. </el-dialog>
  852. <stock-in-dialog
  853. ref="dialog"
  854. :propForm="propForm"
  855. :visibility="isVisibility"
  856. v-on:dialog-comfirm="comfirm"
  857. v-on:dialog-cancle="cancle"
  858. >
  859. </stock-in-dialog>
  860. </div>
  861. </template>
  862. <script>
  863. import { uParseTime } from "@/utils/tools";
  864. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  865. import {
  866. deleteWarehouseOut,
  867. GetAllConfig,
  868. getWarehouseOutList,
  869. getWarehouseOutInfo,
  870. getWarehouseOutUser,
  871. GetOutStockTotalCount,
  872. deleteWarehouseOutInfo,
  873. GetAllGoodInfoByID,
  874. editWarehouseoutInfo,
  875. getOrderDetailByOrderId,
  876. getOrderDetailById,
  877. getOutExportList,
  878. } from "@/api/stock";
  879. import BreadCrumb from "../components/bread-crumb";
  880. import StockInDialog from "./Dialog/stockInDialog";
  881. export default {
  882. name: "salesReturnOrder",
  883. components: { StockInDialog, BreadCrumb },
  884. created() {
  885. var nowDate = new Date();
  886. var nowYear = nowDate.getFullYear();
  887. var nowMonth = nowDate.getMonth() + 1;
  888. var nowDay = nowDate.getDate();
  889. this.end_time =
  890. nowYear +
  891. "-" +
  892. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  893. "-" +
  894. (nowDay < 10 ? "0" + nowDay : nowDay);
  895. nowDate.setMonth(nowDate.getMonth() - 1);
  896. nowYear = nowDate.getFullYear();
  897. nowMonth = nowDate.getMonth() + 1;
  898. nowDay = nowDate.getDate();
  899. this.start_time =
  900. nowYear +
  901. "-" +
  902. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  903. "-" +
  904. (nowDay < 10 ? "0" + nowDay : nowDay);
  905. this.GetConfigInfo();
  906. this.GetWarehouseOut();
  907. this.fetchAllAdminUsers();
  908. },
  909. data() {
  910. var checkGoodId = (rule, value, callback) => {
  911. setTimeout(() => {
  912. if (value == "" || value == 0) {
  913. return callback(new Error("规格名称不能为空"));
  914. }
  915. }, 2000);
  916. };
  917. return {
  918. searchKey: "",
  919. crumbs: [
  920. { path: false, name: "库存管理" },
  921. { path: false, name: "出库单" },
  922. ],
  923. page: 1,
  924. limit: 5,
  925. checked: false,
  926. total: 0,
  927. pageTotal: 0,
  928. pageSelect: 0,
  929. check_id: 0,
  930. adminUserOptions: [],
  931. multipleSelection: [],
  932. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  933. start_time: "",
  934. warehouseOutDate: [],
  935. end_time: "",
  936. goodType: [],
  937. goodInfo: [],
  938. manufacturer: [],
  939. selectedTableData: [],
  940. dealer: [],
  941. type: 1,
  942. drug_id: 0,
  943. dialogVisible: false,
  944. editdialogVisible: false,
  945. warehousingOutInfo: {
  946. loading: false,
  947. warehousingOutData: [],
  948. info: {},
  949. },
  950. userList: [],
  951. type_name: "",
  952. specification_name: "",
  953. stockCount: [],
  954. editDialogVisible: false,
  955. warehouse_out_time: "",
  956. form: {
  957. manufacturer: 0,
  958. dealer: 0,
  959. },
  960. warehouseInfoList: [],
  961. tableRules: {
  962. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  963. warehousing_count: [
  964. { required: true, message: "数量不能为空", trigge: "blur" },
  965. ],
  966. good_id: [{ validator: checkGoodId, trigger: "blur" }],
  967. },
  968. recordInfo: {
  969. recordData: [],
  970. stock_in_code: "",
  971. current_index: "",
  972. },
  973. propForm: {
  974. goods: [],
  975. goodType: [],
  976. goodInfo: [],
  977. goodUnit: [],
  978. title: "入库",
  979. manufacturer: 0,
  980. dealer: 0,
  981. },
  982. isVisibility: false,
  983. good_type_id: "",
  984. tableShow: false,
  985. tableList: [],
  986. dialogVisibleTwo: false,
  987. userList: [],
  988. editdialogVisibleTwo: false,
  989. editdialogVisibleThree: false,
  990. order_id: "",
  991. warehouse_out_time: "",
  992. exportList: [],
  993. is_sys: 0,
  994. infoList: [],
  995. stockFlowList: [],
  996. list: [],
  997. houselist: [],
  998. storehouse_id: 0,
  999. is_sys: 0,
  1000. way_type: 0,
  1001. wayList: [
  1002. { id: 0, name: "全部" },
  1003. { id: 1, name: "手动出库" },
  1004. { id: 2, name: "自动出库" },
  1005. { id: 3, name: "调拨出库" },
  1006. { id: 5, name:"结算出库" }
  1007. ],
  1008. check_type:0,
  1009. checkList:[
  1010. {id:0,name:"全部"},
  1011. {id:1,name:"已审核"},
  1012. {id:2,name:"未审核"},
  1013. ],
  1014. check_id: 0,
  1015. flowList:[],
  1016. cancelInfoList:[],
  1017. exportLoding:false,
  1018. patients:[]
  1019. };
  1020. },
  1021. methods: {
  1022. changeTypeName() {
  1023. this.getlist();
  1024. },
  1025. // getlist() {
  1026. // var params = {
  1027. // check_id: this.check_id,
  1028. // start_time: this.start_time,
  1029. // end_time: this.end_time,
  1030. // keyword: this.keywords,
  1031. // page: this.page,
  1032. // limit: this.limit,
  1033. // };
  1034. // getAllSecondOrderList(params).then((response) => {
  1035. // if (response.data.state == 1) {
  1036. // var list = response.data.data.list;
  1037. // this.tableList = list;
  1038. // var total = response.data.data.total;
  1039. // this.total = total;
  1040. // this.houseList = response.data.data.houseList;
  1041. // this.doctorList = response.data.data.doctorList;
  1042. // }
  1043. // });
  1044. // },
  1045. search: function () {
  1046. const Params = {
  1047. page: this.page,
  1048. limit: this.limit,
  1049. start_time: this.start_time,
  1050. end_time: this.end_time,
  1051. type: this.type,
  1052. keywords: this.searchKey,
  1053. storehouse_id: this.storehouse_id,
  1054. way_type: this.way_type,
  1055. check_type:this.check_type,
  1056. };
  1057. this.warehouseOutDate = [];
  1058. getWarehouseOutList(Params).then((response) => {
  1059. if (response.data.state == 0) {
  1060. this.$message.error(response.data.msg);
  1061. return false;
  1062. } else {
  1063. this.total = response.data.data.total;
  1064. for (let i = 0; i < response.data.data.list.length; i++) {
  1065. this.warehouseOutDate.push(response.data.data.list[i]);
  1066. }
  1067. }
  1068. });
  1069. },
  1070. AddNewOrder: function () {
  1071. this.$router.push({
  1072. name: "stockOutOrderAdd",
  1073. query: { type: this.type },
  1074. });
  1075. },
  1076. GetWarehouseOut: function () {
  1077. const Params = {
  1078. page: this.page,
  1079. limit: this.limit,
  1080. start_time: this.start_time,
  1081. end_time: this.end_time,
  1082. type: this.type,
  1083. storehouse_id: this.storehouse_id,
  1084. way_type: this.way_type,
  1085. check_type:this.check_type,
  1086. };
  1087. this.warehouseOutDate = [];
  1088. getWarehouseOutList(Params).then((response) => {
  1089. if (response.data.state == 0) {
  1090. this.$message.error(response.data.msg);
  1091. return false;
  1092. } else {
  1093. this.total = response.data.data.total;
  1094. for (let i = 0; i < response.data.data.list.length; i++) {
  1095. this.warehouseOutDate.push(response.data.data.list[i]);
  1096. }
  1097. var obj = { id: 0, storehouse_name: "全部" };
  1098. this.houselist = [];
  1099. this.houselist.push(obj);
  1100. for (let i = 0; i < response.data.data.houselist.length; i++) {
  1101. this.houselist.push(response.data.data.houselist[i]);
  1102. }
  1103. var objOne = {id:0,name:"系统"}
  1104. this.patients.push(objOne)
  1105. for(let i=0;i<response.data.data.patients.length;i++){
  1106. this.patients.push(response.data.data.patients[i])
  1107. }
  1108. }
  1109. });
  1110. },
  1111. getXuserName(id) {
  1112. if (id <= 0) {
  1113. return "";
  1114. }
  1115. var name = "";
  1116. if (
  1117. this.adminUserOptions == null ||
  1118. typeof this.adminUserOptions.length === "undefined"
  1119. ) {
  1120. return name;
  1121. }
  1122. var leng = this.adminUserOptions.length;
  1123. if (leng == 0) {
  1124. return name;
  1125. }
  1126. for (let index = 0; index < leng; index++) {
  1127. if (this.adminUserOptions[index].id == id) {
  1128. name = this.adminUserOptions[index].name;
  1129. break;
  1130. }
  1131. }
  1132. return name;
  1133. },
  1134. fetchAllAdminUsers() {
  1135. fetchAllAdminUsers().then((response) => {
  1136. if (response.data.state == 1) {
  1137. this.adminUserOptions = response.data.data.users;
  1138. var alen = this.adminUserOptions.length;
  1139. for (let index = 0; index < alen; index++) {
  1140. if (this.adminUserOptions[index].user_type == 2) {
  1141. // this.doctorOptions.push(this.adminUserOptions[index]);
  1142. }
  1143. }
  1144. }
  1145. });
  1146. },
  1147. handleSelectionChange: function (val) {
  1148. this.multipleSelection = val;
  1149. },
  1150. handleSizeChange(val) {
  1151. this.limit = val;
  1152. this.GetWarehouseOut();
  1153. },
  1154. handleCurrentChange(val) {
  1155. this.page = val;
  1156. this.GetWarehouseOut();
  1157. },
  1158. startTimeChange(val) {
  1159. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  1160. if (time > 0) {
  1161. this.$message.error("结束时间不能小于开始时间");
  1162. this.start_time = "";
  1163. } else {
  1164. this.GetWarehouseOut();
  1165. this.getlist();
  1166. }
  1167. },
  1168. endTimeChange(val) {
  1169. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  1170. if (time < 0) {
  1171. this.$message.error("结束时间不能小于开始时间");
  1172. this.end_time = "";
  1173. } else {
  1174. this.GetWarehouseOut();
  1175. this.getlist();
  1176. }
  1177. },
  1178. getTimestamp(time) {
  1179. // 把时间日期转成时间戳
  1180. return new Date(time).getTime() / 1000;
  1181. },
  1182. calculate: function (val) {
  1183. return Math.round(parseFloat(val) * 100) / 100;
  1184. },
  1185. GetConfigInfo: function () {
  1186. GetAllConfig().then((response) => {
  1187. if (response.data.state == 0) {
  1188. this.$message.error(response.data.msg);
  1189. return false;
  1190. } else {
  1191. this.manufacturer = response.data.data.manufacturer;
  1192. this.dealer = response.data.data.dealer;
  1193. this.goodInfo = response.data.data.goodInfo;
  1194. this.goodType = response.data.data.goodType;
  1195. this.list = response.data.data.list;
  1196. // this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: "全部" });
  1197. // this.dealer.splice(0, 0, { id: 0, dealer_name: "全部" });
  1198. this.getlist();
  1199. }
  1200. });
  1201. },
  1202. getManufactuerName: function (manufacturer_id) {
  1203. for (let i = 0; i < this.manufacturer.length; i++) {
  1204. if (this.manufacturer[i].id == manufacturer_id) {
  1205. return this.manufacturer[i].manufacturer_name;
  1206. }
  1207. }
  1208. },
  1209. getDealerName: function (dealer_id) {
  1210. for (let i = 0; i < this.dealer.length; i++) {
  1211. if (this.dealer[i].id == dealer_id) {
  1212. return this.dealer[i].dealer_name;
  1213. }
  1214. }
  1215. },
  1216. handleEdit: function (index, row) {
  1217. this.$router.push({
  1218. path:
  1219. "/stock/stockoutorderedit?id=" +
  1220. row.id +
  1221. "&is_sys=" +
  1222. row.is_sys +
  1223. "&supply_cancel_out_id=" +
  1224. row.supply_cancel_out_id+
  1225. "&type="+row.type+"&is_check="+row.is_check,
  1226. });
  1227. },
  1228. handleDelete: function (index, row) {
  1229. if (row.is_sys == 12) {
  1230. this.$message.error("调拨出库数据不能删除!");
  1231. return false;
  1232. }
  1233. if (row.is_sys == 5) {
  1234. this.$message.error("结算出库数据不能删除!");
  1235. return false;
  1236. }
  1237. if (row.supply_cancel_out_id > 0) {
  1238. this.$message.error("采购出库数据不能删除!");
  1239. return false;
  1240. }
  1241. if(row.is_check == 1){
  1242. this.$message.error("已审核的单据不能删除!")
  1243. return false
  1244. }
  1245. const ids = [];
  1246. ids.push(row.id);
  1247. const idStr = ids.join(",");
  1248. const params = {
  1249. ids: idStr,
  1250. };
  1251. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  1252. confirmButtonText: "确定",
  1253. cancelButtonText: "取消",
  1254. type: "warning",
  1255. })
  1256. .then(() => {
  1257. deleteWarehouseOut(params).then((response) => {
  1258. if (response.data.state == 0) {
  1259. this.$message.error(response.data.msg);
  1260. return false;
  1261. } else {
  1262. this.$notify({
  1263. title: "成功",
  1264. message: "删除成功",
  1265. type: "success",
  1266. duration: 2000,
  1267. });
  1268. for (let i = 0; i < ids.length; i++) {
  1269. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  1270. if (ids[i] == this.warehouseOutDate[y].id) {
  1271. this.warehouseOutDate.splice(y, 1);
  1272. }
  1273. }
  1274. }
  1275. }
  1276. });
  1277. })
  1278. .catch(() => {});
  1279. },
  1280. changeAllSelected: function (val) {
  1281. if (val) {
  1282. this.$refs.multipleTable.toggleAllSelection();
  1283. } else {
  1284. this.$refs.multipleTable.clearSelection();
  1285. }
  1286. },
  1287. select(selection) {
  1288. var ids = [];
  1289. for (let i = 0; i < selection.length; i++) {
  1290. ids.push(selection[i].id);
  1291. }
  1292. this.exportList = [];
  1293. this.order_id = ids.join(",");
  1294. if(selection.length >0){
  1295. this.warehouse_out_time = selection[0].warehouse_out_time;
  1296. }
  1297. this.selectedTableData = selection;
  1298. this.getlist();
  1299. },
  1300. batchDelete() {
  1301. if (this.selectedTableData.length <= 0) {
  1302. this.$message.error("请选择要删除的记录");
  1303. return;
  1304. }
  1305. const ids = [];
  1306. const idOne = [];
  1307. for (let i = 0; i < this.selectedTableData.length; i++) {
  1308. if(this.selectedTableData[i].is_check == 1){
  1309. this.$message.error("已审核单据不能删除!")
  1310. return false
  1311. }
  1312. if (this.selectedTableData[i].is_sys == 1) {
  1313. this.$message.error("自动出库数据不能删除!");
  1314. return false;
  1315. }
  1316. if (this.selectedTableData[i].is_sys == 5) {
  1317. this.$message.error("结算出库数据不能删除!");
  1318. return false;
  1319. }
  1320. if (this.selectedTableData[i].is_sys == 12) {
  1321. this.$message.error("调拨出库数据不能删除!");
  1322. return false;
  1323. }
  1324. if (this.selectedTableData[i].is_sys == 0) {
  1325. ids.push(this.selectedTableData[i].id);
  1326. if(this.selectedTableData[i].supply_cancel_out_id >0){
  1327. idOne.push(this.selectedTableData[i].supply_cancel_out_id);
  1328. }
  1329. }
  1330. }
  1331. if (idOne.length > 0) {
  1332. this.$message.error("采购出库数据不能删除!");
  1333. return false;
  1334. }
  1335. const idStr = ids.join(",");
  1336. const params = {
  1337. ids: idStr,
  1338. };
  1339. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  1340. confirmButtonText: "确定",
  1341. cancelButtonText: "取消",
  1342. type: "warning",
  1343. })
  1344. .then(() => {
  1345. deleteWarehouseOut(params).then((response) => {
  1346. if (response.data.state == 0) {
  1347. this.$message.error(response.data.msg);
  1348. return false;
  1349. } else {
  1350. this.$notify({
  1351. title: "成功",
  1352. message: "删除成功",
  1353. type: "success",
  1354. duration: 2000,
  1355. });
  1356. for (let i = 0; i < ids.length; i++) {
  1357. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  1358. if (ids[i] == this.warehouseOutDate[y].id) {
  1359. this.warehouseOutDate.splice(y, 1);
  1360. }
  1361. }
  1362. }
  1363. }
  1364. });
  1365. })
  1366. .catch(() => {});
  1367. },
  1368. handleSearch(val) {
  1369. this.is_sys = val.is_sys;
  1370. this.tableList = [];
  1371. this.editdialogVisibleThree = false;
  1372. this.GetOrderDetailOne(val.id,val.warehouse_out_time);
  1373. this.GetTotalCount(val.warehouse_out_time);
  1374. },
  1375. GetOrderDetailOne(id,warehouse_out_time) {
  1376. const params = {
  1377. id: id,
  1378. warehouse_out_time:warehouse_out_time,
  1379. };
  1380. getOrderDetailByOrderId(params).then((response) => {
  1381. if (response.data.state == 1) {
  1382. this.tableShow = true;
  1383. var list = response.data.data.list;
  1384. this.flowList = response.data.data.stockFlowList
  1385. console.log("出库数据233223232323wo",this.flowList)
  1386. this.stockFlowListGroup = response.data.data.stockFlowListGroup
  1387. console.log("分组2332223233wode",this.stockFlowListGroup)
  1388. var cancelInfolist = response.data.data.cancelInfolist
  1389. this.cancelInfoList = cancelInfolist
  1390. this.tableList = [];
  1391. var tableArr = []
  1392. for (let i = 0; i < list.length; i++) {
  1393. list[i].child= []
  1394. list[i].childOne = []
  1395. list[i].childTwo= []
  1396. for(let z=0;z<this.stockFlowListGroup.length;z++){
  1397. if(list[i].good_id == this.stockFlowListGroup[z].good_id){
  1398. list[i].childTwo.push(this.stockFlowListGroup[z])
  1399. }
  1400. }
  1401. for(let j=0;j<this.flowList.length;j++){
  1402. if(list[i].good_id == this.flowList[j].good_id){
  1403. list[i].child.push(this.flowList[j])
  1404. }
  1405. }
  1406. tableArr.push(list[i]);
  1407. }
  1408. if(tableArr!=null && tableArr.length>0){
  1409. for(let i=0;i<tableArr.length;i++){
  1410. for(let j=0;j<tableArr[i].childTwo.length;j++){
  1411. tableArr[i].childTwo[j].over_count_total = this.getAllStockCount(tableArr[i].child,tableArr[i].childTwo[j].warehousing_id) - this.getCancelInfo(tableArr[i].childTwo[j].warehousing_id,tableArr[i].childTwo[j].good_id)
  1412. }
  1413. }
  1414. }
  1415. for(let i=0;i<tableArr.length;i++){
  1416. for(let j=0;j<tableArr[i].childTwo.length;j++){
  1417. if(tableArr[i].childTwo[j].over_count_total >0){
  1418. tableArr[i].childOne.push(tableArr[i].childTwo[j])
  1419. }
  1420. }
  1421. }
  1422. console.log("tableARR",tableArr)
  1423. console.log("tablielist2332323", this.tableList)
  1424. this.tableList = tableArr
  1425. }
  1426. });
  1427. },
  1428. getTypeName: function (id) {
  1429. let name = "";
  1430. for (let i = 0; i < this.goodType.length; i++) {
  1431. if (this.goodType[i].id == id) {
  1432. name = this.goodType[i].type_name;
  1433. }
  1434. }
  1435. return name;
  1436. },
  1437. getTypeNameOne: function (id) {
  1438. let name = "";
  1439. for (let i = 0; i < this.goodInfo.length; i++) {
  1440. if (this.goodInfo[i].id == id) {
  1441. name = this.goodInfo[i].good_name;
  1442. }
  1443. }
  1444. return name;
  1445. },
  1446. getSpecificationName: function (id) {
  1447. let name = "";
  1448. for (let i = 0; i < this.goodInfo.length; i++) {
  1449. if (this.goodInfo[i].id == id) {
  1450. name = this.goodInfo[i].specification_name;
  1451. }
  1452. }
  1453. return name;
  1454. },
  1455. getManufactuerName: function (manufacturer_id) {
  1456. for (let i = 0; i < this.manufacturer.length; i++) {
  1457. if (this.manufacturer[i].id == manufacturer_id) {
  1458. return this.manufacturer[i].manufacturer_name;
  1459. }
  1460. }
  1461. },
  1462. jump(id) {
  1463. this.userList = [];
  1464. this.GetOrderDetail(id);
  1465. },
  1466. GetOrderDetail: function (order_id) {
  1467. this.userList = [];
  1468. const params = {
  1469. id: order_id,
  1470. };
  1471. getWarehouseOutUser(params).then((response) => {
  1472. if (response.data.state == 0) {
  1473. this.$message.error(response.data.msg);
  1474. return false;
  1475. } else {
  1476. var total = 0;
  1477. var list = response.data.data.list;
  1478. var arrList = this.unique(list);
  1479. for (let i = 0; i < arrList.length; i++) {
  1480. var obj = arrList[i];
  1481. obj["is_total"] = 0;
  1482. this.userList.push(obj);
  1483. total = total + arrList[i].count;
  1484. }
  1485. this.userList.push({
  1486. is_total: 1,
  1487. total: total,
  1488. });
  1489. this.editdialogVisibleThree = true;
  1490. }
  1491. });
  1492. },
  1493. deleteRecord: function () {
  1494. const ids = [];
  1495. ids.push(this.warehousingOutInfo.info.id);
  1496. const idStr = ids.join(",");
  1497. const params = {
  1498. ids: idStr,
  1499. };
  1500. this.$confirm("确认删除出库单?", "删除出库单记录", {
  1501. confirmButtonText: "确定",
  1502. cancelButtonText: "取消",
  1503. type: "warning",
  1504. })
  1505. .then(() => {
  1506. deleteWarehouseOut(params).then((response) => {
  1507. if (response.data.state == 0) {
  1508. this.$message.error(response.data.msg);
  1509. return false;
  1510. } else {
  1511. this.$notify({
  1512. title: "成功",
  1513. message: "删除成功",
  1514. type: "success",
  1515. duration: 2000,
  1516. });
  1517. this.$router.back(-1);
  1518. }
  1519. });
  1520. })
  1521. .catch(() => {});
  1522. },
  1523. GetTotalCount(time) {
  1524. var params = {
  1525. warehouse_out_time: time,
  1526. };
  1527. GetOutStockTotalCount(params).then((response) => {
  1528. if (response.data.state == 1) {
  1529. var stockCount = response.data.data.stockCount;
  1530. this.stockCount = stockCount;
  1531. }
  1532. });
  1533. },
  1534. getOutStockCount(id) {
  1535. var count = 0;
  1536. for (let i = 0; i < this.stockCount.length; i++) {
  1537. if (id == this.stockCount[i].good_id) {
  1538. count = this.stockCount[i].count;
  1539. }
  1540. }
  1541. return count;
  1542. },
  1543. unique(arr) {
  1544. const res = new Map();
  1545. return arr.filter(
  1546. (arr) => !res.has(arr.patient_id) && res.set(arr.patient_id, 1)
  1547. );
  1548. },
  1549. editRecord(id) {
  1550. this.warehouseOut = [];
  1551. this.recordInfo.recordData = [];
  1552. this.GetConfigInfo();
  1553. this.GetOrderDetailTwo(id);
  1554. this.good_type_id = id;
  1555. },
  1556. GetOrderDetailTwo(order_id) {
  1557. const params = {
  1558. id: order_id,
  1559. };
  1560. getWarehouseOutInfo(params).then((response) => {
  1561. if (response.data.state == 0) {
  1562. this.$message.error(response.data.msg);
  1563. return false;
  1564. } else {
  1565. for (let i = 0; i < response.data.data.list.length; i++) {
  1566. response.data.data.list[i].price =
  1567. response.data.data.list[i].price.toString();
  1568. response.data.data.list[i].count =
  1569. response.data.data.list[i].count.toString();
  1570. this.recordInfo.recordData.push(response.data.data.list[i]);
  1571. }
  1572. this.warehouseOut = response.data.data.info;
  1573. this.warehouse_out_time = this.getTime(
  1574. this.warehouseOut.warehouse_out_time,
  1575. "{y}-{m}-{d}"
  1576. );
  1577. // this.form.manufacturer = this.warehouseOut.manufacturer
  1578. // this.form.dealer = this.warehouseOut.dealer
  1579. this.editDialogVisible = true;
  1580. }
  1581. if (this.recordInfo.recordData.length == 0) {
  1582. const tempObj = {};
  1583. tempObj["id"] = 0;
  1584. tempObj["good_type_id"] = 0;
  1585. tempObj["good_id"] = 0;
  1586. tempObj["count"] = "";
  1587. tempObj["price"] = "";
  1588. tempObj["remark"] = "";
  1589. this.recordInfo.recordData.push(tempObj);
  1590. this.editDialogVisible = true;
  1591. }
  1592. });
  1593. },
  1594. getTime(val, temp) {
  1595. if (val > 0) {
  1596. return uParseTime(val, temp);
  1597. } else {
  1598. return "";
  1599. }
  1600. },
  1601. changeManufacturer(val) {
  1602. this.propForm.manufacturer = val;
  1603. },
  1604. changeDealer(val) {
  1605. this.propForm.dealer = val;
  1606. },
  1607. typeName: function (good_type_id) {
  1608. let name = "";
  1609. for (let i = 0; i < this.goodType.length; i++) {
  1610. if (this.goodType[i].id == good_type_id) {
  1611. name = this.goodType[i].type_name;
  1612. }
  1613. }
  1614. return name;
  1615. },
  1616. specificationName: function (good_info_id) {
  1617. let name = "";
  1618. for (let i = 0; i < this.goodInfo.length; i++) {
  1619. if (this.goodInfo[i].id == good_info_id) {
  1620. name = this.goodInfo[i].specification_name;
  1621. }
  1622. }
  1623. return name;
  1624. },
  1625. handleEditOne() {
  1626. const tempObj = {};
  1627. tempObj["id"] = 0;
  1628. tempObj["good_type_id"] = 0;
  1629. tempObj["good_id"] = 0;
  1630. tempObj["count"] = "";
  1631. tempObj["price"] = "";
  1632. tempObj["remark"] = "";
  1633. this.recordInfo.recordData.push(tempObj);
  1634. },
  1635. handleDeleteOne: function (index, row) {
  1636. if (row.id == 0) {
  1637. this.recordInfo.recordData.splice(index, 1);
  1638. } else {
  1639. const params = {
  1640. id: row.id,
  1641. };
  1642. this.$confirm("确认删除该出库耗材信息记录?", "删除出库耗材信息记录", {
  1643. confirmButtonText: "确定",
  1644. cancelButtonText: "取消",
  1645. type: "warning",
  1646. })
  1647. .then(() => {
  1648. deleteWarehouseOutInfo(params).then((response) => {
  1649. if (response.data.state == 0) {
  1650. this.$message.error(response.data.msg);
  1651. return false;
  1652. } else {
  1653. this.$message.success("删除成功");
  1654. this.recordInfo.recordData.splice(index, 1);
  1655. }
  1656. });
  1657. })
  1658. .catch(() => {});
  1659. }
  1660. },
  1661. showDialog(index, row) {
  1662. this.currentIndex = index;
  1663. const loading = this.$loading({
  1664. lock: true,
  1665. text: "Loading",
  1666. spinner: "el-icon-loading",
  1667. background: "rgba(0, 0, 0, 0.7)",
  1668. });
  1669. const params = {
  1670. manufacturer_id: this.form.manufacturer,
  1671. dealer_id: this.form.dealer,
  1672. };
  1673. this.propForm.goods = [];
  1674. GetAllGoodInfoByID(params).then((response) => {
  1675. if (response.data.state == 0) {
  1676. this.$message.error(response.data.msg);
  1677. return false;
  1678. } else {
  1679. if (response.data.data.goodInfo.length <= 0) {
  1680. this.$message.error("该厂商或经销商没有物品信息");
  1681. return;
  1682. }
  1683. this.$refs.dialog.show();
  1684. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  1685. this.propForm.goodType.push(response.data.data.goodInfo[i].type);
  1686. }
  1687. const obj = {};
  1688. this.propForm.goodType = this.propForm.goodType.reduce(
  1689. (cur, next) => {
  1690. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  1691. return cur;
  1692. },
  1693. []
  1694. ); // 设置cur默认类型为数组,并且初始值为空的数组
  1695. }
  1696. for (let i = 0; i < this.propForm.goodType.length; i++) {
  1697. let goodInfo = [];
  1698. let goodObj = {};
  1699. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  1700. var respObj = response.data.data.goodInfo[a];
  1701. respObj["isSelected"] = false;
  1702. if (respObj.type.id == this.propForm.goodType[i].id) {
  1703. goodInfo.push(respObj);
  1704. }
  1705. }
  1706. const obj = {};
  1707. goodInfo = goodInfo.reduce((cur, next) => {
  1708. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  1709. return cur;
  1710. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  1711. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo);
  1712. this.propForm.goods.push(goodObj);
  1713. }
  1714. loading.close();
  1715. });
  1716. },
  1717. comfirm: function (val) {
  1718. this.$refs.dialog.hide();
  1719. this.propForm.goodType = [];
  1720. this.propForm.goods = [];
  1721. if (val.selectedGoodInfo.length > 0) {
  1722. for (let i = val.selectedGoodInfo.length - 1; ; i--) {
  1723. if (i == 0) {
  1724. this.recordInfo.recordData[this.currentIndex].good_type_id =
  1725. val.selectedGoodInfo[i].good_type_id;
  1726. this.recordInfo.recordData[this.currentIndex].good_id =
  1727. val.selectedGoodInfo[i].id;
  1728. this.recordInfo.recordData[this.currentIndex].price =
  1729. val.selectedGoodInfo[i].buy_price.toString();
  1730. } else {
  1731. const tempForm = {};
  1732. tempForm["id"] = 0;
  1733. tempForm["good_type_id"] = val.selectedGoodInfo[i].good_type_id;
  1734. tempForm["good_id"] = val.selectedGoodInfo[i].id;
  1735. tempForm["count"] = "";
  1736. tempForm["price"] = val.selectedGoodInfo[i].buy_price.toString();
  1737. tempForm["remark"] = "";
  1738. this.recordInfo.recordData.splice(
  1739. this.currentIndex + 1,
  1740. 0,
  1741. tempForm
  1742. );
  1743. }
  1744. }
  1745. }
  1746. this.currentIndex = -1;
  1747. },
  1748. cancle: function () {
  1749. this.$refs.dialog.hide();
  1750. this.propForm.goods = [];
  1751. this.propForm.goodType = [];
  1752. },
  1753. submit() {
  1754. this.$refs["tableForm"].validate((valid) => {
  1755. if (valid) {
  1756. const array = this.recordInfo.recordData;
  1757. for (let i = 0; i < array.length; i++) {
  1758. if (array[i].good_type_id == 0) {
  1759. this.$message.error("商品类型不能为空");
  1760. return;
  1761. }
  1762. if (array[i].good_id == 0) {
  1763. this.$message.error("规格名称不能为空");
  1764. return;
  1765. }
  1766. }
  1767. const params = {
  1768. stockOut: this.recordInfo.recordData,
  1769. };
  1770. editWarehouseoutInfo(
  1771. params,
  1772. this.warehouse_out_time,
  1773. this.good_type_id,
  1774. 1,
  1775. this.form.manufacturer,
  1776. this.form.dealer
  1777. ).then((response) => {
  1778. if (response.data.state == 0) {
  1779. this.$message.error(response.data.msg);
  1780. return false;
  1781. } else {
  1782. this.$message.success("保存成功");
  1783. this.editDialogVisible = false;
  1784. this.warehousingOutInfo.info = [];
  1785. this.warehousingOutInfo.warehousingOutData = [];
  1786. this.GetOrderDetailOne(this.good_type_id);
  1787. }
  1788. });
  1789. } else {
  1790. return false;
  1791. }
  1792. });
  1793. },
  1794. GetOrderDetailById(val) {
  1795. this.userList = [];
  1796. var params = {
  1797. id: val.warehouse_out_id,
  1798. good_id: val.good_id,
  1799. record_time: val.sys_record_time,
  1800. };
  1801. getOrderDetailById(params).then((response) => {
  1802. if (response.data.state == 1) {
  1803. var total = 0;
  1804. var list = response.data.data.list;
  1805. var arrList = this.unique(list);
  1806. var info = response.data.data.info;
  1807. this.infoList = info;
  1808. var stockflowlist = response.data.data.stockFlowList;
  1809. this.stockFlowList = stockflowlist;
  1810. var cancelInfo = response.data.data.cancelInfo
  1811. console.log("哈哈哈哈哈",this.stockFlowList)
  1812. let dataInfo = {}
  1813. if(this.stockFlowList.length > 0){
  1814. this.stockFlowList.forEach((item, index) => {
  1815. let { patient_id } = item
  1816. if (!dataInfo[patient_id]) {
  1817. dataInfo[patient_id] = {
  1818. patient_id,
  1819. child: [],
  1820. name:item.name,
  1821. ctime:item.ctime,
  1822. count:0,
  1823. cancel_count:0,
  1824. is_sys:item.is_sys,
  1825. }
  1826. }
  1827. })
  1828. let arr = Object.values(dataInfo)
  1829. console.log("arr2332323232wode",arr)
  1830. if(arr!=null && arr.length > 0){
  1831. for(let i=0;i<arr.length;i++){
  1832. for(let j=0;j<this.stockFlowList.length;j++){
  1833. if(arr[i].patient_id == this.stockFlowList[j].patient_id){
  1834. arr[i].child.push(this.stockFlowList[j])
  1835. }
  1836. }
  1837. }
  1838. }
  1839. for(let i=0;i<arr.length;i++){
  1840. for(let j=0;j<arr[i].child.length;j++){
  1841. arr[i].count += arr[i].child[j].count
  1842. }
  1843. }
  1844. var newArrOne = []
  1845. if(cancelInfo!=null && cancelInfo.length > 0){
  1846. let dataInfoOne = {}
  1847. if(this.stockFlowList.length > 0){
  1848. this.stockFlowList.forEach((item, index) => {
  1849. let { patient_id } = item
  1850. if (!dataInfoOne[patient_id]) {
  1851. dataInfoOne[patient_id] = {
  1852. patient_id,
  1853. child: [],
  1854. name:item.name,
  1855. ctime:item.ctime,
  1856. count:0,
  1857. is_sys:item.is_sys,
  1858. }
  1859. }
  1860. })
  1861. }
  1862. let newArr = Object.values(dataInfoOne)
  1863. if(newArr!=null && newArr.length > 0){
  1864. for(let i=0;i<newArr.length;i++){
  1865. for(let j=0;j<cancelInfo.length;j++){
  1866. if(cancelInfo[j].patient_id > 0){
  1867. if(newArr[i].patient_id == cancelInfo[j].patient_id){
  1868. newArr[i].child.push(cancelInfo[j])
  1869. }
  1870. }
  1871. }
  1872. }
  1873. }
  1874. for(let i=0;i<newArr.length;i++){
  1875. for(let j=0;j<newArr[i].child.length;j++){
  1876. newArr[i].count+=newArr[i].child[j].count
  1877. }
  1878. }
  1879. newArrOne = newArr
  1880. }
  1881. for(let i=0;i<arr.length;i++){
  1882. for(let j=0;j<newArrOne.length;j++){
  1883. if(arr[i].patient_id == newArrOne[j].patient_id){
  1884. arr[i].cancel_count = newArrOne[j].count
  1885. }
  1886. }
  1887. }
  1888. console.log("2o32o3o3232j32oo23o2332oj2wo",arr)
  1889. var arrTwo= []
  1890. for(let i=0;i<arr.length;i++){
  1891. if((arr[i].count - arr[i].cancel_count) >0){
  1892. arrTwo.push(arr[i])
  1893. }
  1894. }
  1895. console.log("arrTwo8888888",arrTwo)
  1896. for (let i = 0; i <arrTwo.length; i++) {
  1897. var obj = arrTwo[i];
  1898. obj["is_total"] = 0;
  1899. this.userList.push(obj);
  1900. if(arrTwo[i].is_sys == 1){
  1901. total = total + arrTwo[i].count - arrTwo[i].cancel_count;
  1902. }else{
  1903. total = total + arrTwo[i].count;
  1904. }
  1905. }
  1906. this.userList.push({
  1907. is_total: 1,
  1908. total: total,
  1909. });
  1910. if (val.is_sys == 1) {
  1911. this.editdialogVisibleThree = true;
  1912. }
  1913. if (val.is_sys == 0 || val.is_sys == 5) {
  1914. this.editdialogVisibleTwo = true;
  1915. }
  1916. console.log("我的世界332323223我",this.userList)
  1917. }
  1918. }
  1919. });
  1920. },
  1921. getNumber(id) {
  1922. var str = "";
  1923. var arr = [];
  1924. var ids = [];
  1925. for (let i = 0; i < this.userList.length; i++) {
  1926. if (id == this.userList[i].id) {
  1927. arr.push(...this.userList[i].warehouseOutInfo);
  1928. }
  1929. }
  1930. if (arr.length > 0) {
  1931. for (let i = 0; i < arr.length; i++) {
  1932. ids.push(arr[i].number);
  1933. }
  1934. }
  1935. str = ids.join(",");
  1936. return str;
  1937. },
  1938. toPrint() {
  1939. if (this.order_id == "") {
  1940. this.$message.error("请选择出库单");
  1941. } else {
  1942. this.$router.push({
  1943. path:
  1944. "/stock/out/detail/print?id=" +
  1945. this.order_id +
  1946. "&warehouse_out_time=" +
  1947. this.warehouse_out_time +
  1948. "&keyword=" +
  1949. this.searchKey +
  1950. "&start_time=" +
  1951. this.start_time +
  1952. "&end_time=" +
  1953. this.end_time,
  1954. });
  1955. }
  1956. },
  1957. getlist() {
  1958. this.exportLoding = true
  1959. var params = {
  1960. id: this.order_id,
  1961. start_time: this.start_time,
  1962. end_time: this.end_time,
  1963. };
  1964. getOutExportList(params).then((response) => {
  1965. if (response.data.state == 1) {
  1966. var list = response.data.data.list;
  1967. var outCount = response.data.data.outCount;
  1968. for (let i = 0; i < list.length; i++) {
  1969. list[i].unit = list[i].specification_name + "/" + list[i].packing_unit;
  1970. list[i].total_price = (list[i].total_count * list[i].price).toFixed(2);
  1971. list[i].expiry_date = this.getTime(list[i].expiry_date,"{y}-{m}-{d}");
  1972. list[i].product_date = this.getTime(list[i].product_date,"{y}-{m}-{d}");
  1973. for (let j = 0; j < this.manufacturer.length; j++) {
  1974. if (list[i].manufacturer == this.manufacturer[j].id) {
  1975. list[i].manufacturer = this.manufacturer[j].manufacturer_name;
  1976. }
  1977. }
  1978. for (let z = 0; z < this.dealer.length; z++) {
  1979. if (list[i].dealer == this.dealer[z].id) {
  1980. list[i].dealer = this.dealer[z].dealer_name;
  1981. }
  1982. }
  1983. for (let a = 0; a < this.goodType.length; a++) {
  1984. if (list[i].good_type_id == this.goodType[a].id) {
  1985. list[i].good_type_id = this.goodType[a].type_name;
  1986. }
  1987. }
  1988. }
  1989. console.log("list232332232332323223",list)
  1990. this.exportList = list;
  1991. this.exportLoding = false
  1992. }
  1993. });
  1994. },
  1995. toExport() {
  1996. if (this.order_id == "") {
  1997. this.$message.error("请勾选出库单");
  1998. return;
  1999. }
  2000. console.log("时间",this.exportList)
  2001. import("@/vendor/Export2Excel").then((excel) => {
  2002. for (let i = 0; i < this.exportList.length; i++) {
  2003. this.exportList[i].total_price =
  2004. this.exportList[i].count * this.exportList[i].price;
  2005. for (let j = 0; j < this.goodType.length; j++) {
  2006. if (this.exportList[i].good_type_id == this.goodType[j].id) {
  2007. this.exportList[i].good_type_id = this.goodType[j].type_name;
  2008. }
  2009. }
  2010. if (this.exportList[i].dealer == 0) {
  2011. this.exportList[i].dealer = "";
  2012. }
  2013. if (this.exportList[i].manufacturer == 0) {
  2014. this.exportList[i].manufacturer = "";
  2015. }
  2016. if (this.exportList[i].good_type_id == 0) {
  2017. this.exportList[i].good_type_id = "";
  2018. }
  2019. this.exportList[i].ctime = this.getTime(this.exportList[i].ctime, "{y}-{m}-{d}")
  2020. this.exportList[i].warehouse_out_time = this.getTime(this.exportList[i].warehouse_out_time,"{y}-{m}-{d}")
  2021. }
  2022. const tHeader = [
  2023. "单据日期",
  2024. "耗材名称",
  2025. "耗材类型",
  2026. "规格&单位",
  2027. "出库数量",
  2028. "出货价",
  2029. "总价",
  2030. "生产厂商",
  2031. "经销商",
  2032. "生产日期",
  2033. "有效期",
  2034. "备注",
  2035. "出库时间"
  2036. ];
  2037. const filterVal = [
  2038. "warehouse_out_time",
  2039. "good_name",
  2040. "good_type_id",
  2041. "unit",
  2042. "count",
  2043. "price",
  2044. "total_price",
  2045. "manufacturer",
  2046. "dealer",
  2047. "product_date",
  2048. "expiry_date",
  2049. "remark",
  2050. "ctime",
  2051. ];
  2052. const data = this.formatJson(filterVal, this.exportList);
  2053. excel.export_json_to_excel({
  2054. header: tHeader,
  2055. data,
  2056. filename: "耗材出库单详情",
  2057. });
  2058. this.downloadLoading = false;
  2059. });
  2060. },
  2061. formatJson(filterVal, jsonData) {
  2062. return jsonData.map((v) => filterVal.map((j) => v[j]));
  2063. },
  2064. unique(arr) {
  2065. let newArr = [arr[0]];
  2066. for (let i = 1; i < arr.length; i++) {
  2067. let repeat = false;
  2068. for (let j = 0; j < newArr.length; j++) {
  2069. if (arr[i] === newArr[j]) {
  2070. repeat = true;
  2071. break;
  2072. } else {
  2073. }
  2074. }
  2075. if (!repeat) {
  2076. newArr.push(arr[i]);
  2077. }
  2078. }
  2079. return newArr;
  2080. },
  2081. getBatchNumber(patient_id, good_id) {
  2082. var arr = [];
  2083. for (let i = 0; i < this.stockFlowList.length; i++) {
  2084. if (
  2085. patient_id == this.stockFlowList[i].patient_id &&
  2086. good_id == this.stockFlowList[i].good_id
  2087. ) {
  2088. arr.push(this.stockFlowList[i].number);
  2089. }
  2090. }
  2091. arr = this.unique(arr);
  2092. return arr.join(",");
  2093. },
  2094. getHouseName(id) {
  2095. var storehouse_name = "";
  2096. for (let i = 0; i < this.houselist.length; i++) {
  2097. if (id == this.houselist[i].id) {
  2098. storehouse_name = this.houselist[i].storehouse_name;
  2099. }
  2100. }
  2101. if (storehouse_name == "全部") {
  2102. return "";
  2103. } else {
  2104. return storehouse_name;
  2105. }
  2106. },
  2107. changeStoreHouse() {
  2108. this.GetWarehouseOut();
  2109. },
  2110. changeWay() {
  2111. this.GetWarehouseOut();
  2112. },
  2113. changeCheckType(){
  2114. this.GetWarehouseOut()
  2115. },
  2116. getAllStockCount(val,warehousing_id){
  2117. var arr=[]
  2118. var total_count = 0
  2119. if(val!=null&&val.length > 0){
  2120. for(let i=0;i<val.length;i++){
  2121. if(val[i].warehousing_id == warehousing_id){
  2122. arr.push(val[i])
  2123. }
  2124. }
  2125. }
  2126. if(arr.length > 0) {
  2127. for(let j=0;j<arr.length;j++){
  2128. total_count +=arr[j].count
  2129. }
  2130. }
  2131. if(total_count > 0){
  2132. return total_count
  2133. }else{
  2134. return total_count
  2135. }
  2136. },
  2137. getAllStockCountPrice(val,warehousing_id){
  2138. var price = 0
  2139. var arr = []
  2140. if(val!=null&&val.length > 0){
  2141. for(let i=0;i<val.length;i++){
  2142. if(val[i].warehousing_id == warehousing_id){
  2143. arr.push(val[i])
  2144. }
  2145. }
  2146. }
  2147. if(arr.length > 0){
  2148. return arr[0].price
  2149. }else{
  2150. return 0
  2151. }
  2152. },
  2153. getManufactuerNameSix(val,warehousing_id){
  2154. var manufacturer_name = ""
  2155. var arr= []
  2156. if(val!=null&&val.length > 0){
  2157. for(let i=0;i<val.length;i++){
  2158. if(val[i].warehousing_id == warehousing_id){
  2159. arr.push(val[i])
  2160. }
  2161. }
  2162. }
  2163. if(arr.length > 0){
  2164. manufacturer_name = this.getManufactuerName(arr[0].manufacturer)
  2165. }
  2166. return manufacturer_name
  2167. },
  2168. getDealerNameSix(val,warehousing_id){
  2169. var dealer_name = ""
  2170. var arr= []
  2171. if(val!=null&&val.length > 0){
  2172. for(let i=0;i<val.length;i++){
  2173. if(val[i].warehousing_id == warehousing_id){
  2174. arr.push(val[i])
  2175. }
  2176. }
  2177. }
  2178. if(arr.length > 0){
  2179. dealer_name = this.getDealerName(arr[0].xt_warehouse_info.dealer)
  2180. }
  2181. return dealer_name
  2182. },
  2183. getProductDate(val,warehousing_id){
  2184. var product_date = ""
  2185. var arr= []
  2186. if(val!=null&&val.length > 0){
  2187. for(let i=0;i<val.length;i++){
  2188. if(val[i].warehousing_id == warehousing_id){
  2189. arr.push(val[i])
  2190. }
  2191. }
  2192. }
  2193. if(arr.length > 0){
  2194. product_date = this.getTime(arr[0].product_date, "{y}-{m}-{d}")
  2195. }
  2196. return product_date
  2197. },
  2198. getExpiryDate(val,warehousing_id){
  2199. var expiry_date = ""
  2200. var arr= []
  2201. if(val!=null&&val.length > 0){
  2202. for(let i=0;i<val.length;i++){
  2203. if(val[i].warehousing_id == warehousing_id){
  2204. arr.push(val[i])
  2205. }
  2206. }
  2207. }
  2208. if(arr.length > 0){
  2209. expiry_date = this.getTime(arr[0].xt_warehouse_info.expiry_date, "{y}-{m}-{d}")
  2210. }
  2211. return expiry_date
  2212. },
  2213. getRegisterNumber(val,warehousing_id){
  2214. var register_number = ""
  2215. var arr= []
  2216. if(val!=null&&val.length > 0){
  2217. for(let i=0;i<val.length;i++){
  2218. if(val[i].warehousing_id == warehousing_id){
  2219. arr.push(val[i])
  2220. }
  2221. }
  2222. }
  2223. if(arr.length > 0){
  2224. register_number = arr[0].xt_warehouse_info.register_number
  2225. }
  2226. return register_number
  2227. },
  2228. getRemark(val,warehousing_id){
  2229. var remark = ""
  2230. var arr= []
  2231. if(val!=null&&val.length > 0){
  2232. for(let i=0;i<val.length;i++){
  2233. if(val[i].warehousing_id == warehousing_id){
  2234. arr.push(val[i])
  2235. }
  2236. }
  2237. }
  2238. if(arr.length > 0){
  2239. remark = arr[0].xt_warehouse_info.remark
  2240. }
  2241. return remark
  2242. },
  2243. getNumber(val,warehousing_id){
  2244. var number = ""
  2245. var arr= []
  2246. if(val!=null&&val.length > 0){
  2247. for(let i=0;i<val.length;i++){
  2248. if(val[i].warehousing_id == warehousing_id){
  2249. arr.push(val[i])
  2250. }
  2251. }
  2252. }
  2253. if(arr.length > 0){
  2254. number = arr[0].number
  2255. }
  2256. return number
  2257. },
  2258. // 合并单元格样式
  2259. cellStyle({ row, column, rowIndex, columnIndex }) {
  2260. let arr = [3,4,5,6,7,8,9,10,11,12,13];
  2261. if (arr.indexOf(columnIndex) > -1) {
  2262. return "spanClass";
  2263. }
  2264. },
  2265. getCancelInfo(warehousing_id,good_id){
  2266. var count =0
  2267. var arr = []
  2268. for(let i=0;i<this.cancelInfoList.length;i++){
  2269. if(this.cancelInfoList[i].patient_id >0 && warehousing_id == this.cancelInfoList[i].warehousing_id && good_id == this.cancelInfoList[i].good_id){
  2270. arr.push(this.cancelInfoList[i])
  2271. }
  2272. }
  2273. if(arr.length > 0){
  2274. for(let i=0;i<arr.length;i++){
  2275. count += arr[i].count
  2276. }
  2277. }
  2278. if(count > 0){
  2279. return count
  2280. }else{
  2281. return 0
  2282. }
  2283. },
  2284. getRow(row){
  2285. console.log("row233323232",row)
  2286. var name = ""
  2287. if(this.stockFlowList!=null && this.stockFlowList.length > 0){
  2288. for(let i=0;i<this.stockFlowList.length;i++){
  2289. if(row.patient_id == this.stockFlowList[i].patient_id){
  2290. name = this.stockFlowList[i].name
  2291. }
  2292. }
  2293. }
  2294. return name
  2295. },
  2296. getPatientName(patient_id){
  2297. var name = ""
  2298. for(let i=0;i<this.patients.length;i++){
  2299. if(patient_id == this.patients[i].id){
  2300. name = this.patients[i].name
  2301. }
  2302. }
  2303. return name
  2304. }
  2305. },
  2306. };
  2307. </script>
  2308. <style rel="stylesheet/scss" lang="scss">
  2309. .app-container {
  2310. // margin: 20px;
  2311. font-size: 15px;
  2312. .filter-container {
  2313. padding-bottom: 5px;
  2314. }
  2315. .search-component {
  2316. width: 500px;
  2317. .searchBox {
  2318. width: 300px;
  2319. height: 36px;
  2320. line-height: 36px;
  2321. padding-left: 15px;
  2322. border: 1px #dcdfe6 solid;
  2323. border-right: none;
  2324. outline: none;
  2325. float: left;
  2326. border-radius: 6px 0 0 6px;
  2327. font-size: 14px;
  2328. color: #333;
  2329. background: #fff;
  2330. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  2331. }
  2332. .searchBtn {
  2333. background-color: #409eff;
  2334. color: #fff;
  2335. font-size: 15px;
  2336. text-align: center;
  2337. height: 36px;
  2338. line-height: 36px;
  2339. float: left;
  2340. outline: none;
  2341. width: 70px;
  2342. border: none;
  2343. border-radius: 0 6px 6px 0;
  2344. font-family: "Microsoft Yahei";
  2345. cursor: pointer;
  2346. }
  2347. }
  2348. .amount {
  2349. font-weight: normal;
  2350. padding: 10px 0 0 0;
  2351. color: #606266;
  2352. font-size: 14px;
  2353. span {
  2354. color: #ef2525;
  2355. font-family: "Arial";
  2356. padding: 0 2px;
  2357. }
  2358. }
  2359. }
  2360. .el-table td,
  2361. .el-table th.is-leaf,
  2362. .el-table--border,
  2363. .el-table--group {
  2364. border-color: #d0d3da;
  2365. }
  2366. .el-table--border::after,
  2367. .el-table--group::after,
  2368. .el-table::before {
  2369. background-color: #d0d3da;
  2370. }
  2371. </style>
  2372. <style>
  2373. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  2374. font-size: 12px;
  2375. }
  2376. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  2377. background: #6fb5fa;
  2378. }
  2379. .count {
  2380. color: #bd2c00;
  2381. }
  2382. .el-table td,
  2383. .el-table th.is-leaf,
  2384. .el-table--border,
  2385. .el-table--group {
  2386. border-color: #d0d3da;
  2387. }
  2388. .el-table--border::after,
  2389. .el-table--group::after,
  2390. .el-table::before {
  2391. background-color: #d0d3da;
  2392. }
  2393. /* 合并表格线样式 */
  2394. .spanClass .cell {
  2395. padding: 0 !important;
  2396. }
  2397. .spanClass .cell tr {
  2398. display: inline-block;
  2399. width: 100%;
  2400. }
  2401. .spanClass .cell tr td {
  2402. padding: 10px 0;
  2403. border-bottom: 1px solid #ebeef5;
  2404. display: block;
  2405. width: 100%;
  2406. }
  2407. .spanClass .cell tr:last-of-type td {
  2408. border-bottom: none;
  2409. }
  2410. </style>