stockInOrder.vue 58KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <!--<bread-crumb :crumbs='crumbs'></bread-crumb>-->
  5. <bread-crumb :crumbs="crumbs"></bread-crumb>
  6. <el-button
  7. size="small"
  8. @click="handleWarehouse"
  9. class="filter-item"
  10. style="float:right;"
  11. type="primary"
  12. icon="el-icon-circle-plus-outline"
  13. >新增</el-button
  14. >
  15. </div>
  16. <div class="app-container">
  17. <div class="cell clearfix">
  18. <label class="title"><span class="name">仓库</span> :</label>
  19. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changeStoreHouse">
  20. <el-option
  21. v-for="(option, index) in list"
  22. :key="index"
  23. :label="option.storehouse_name"
  24. :value="option.id">
  25. </el-option>
  26. </el-select>
  27. <el-input
  28. size="small"
  29. style="width: 200px;"
  30. v-model.trim="searchKey"
  31. class="filter-item"
  32. placeholder="单据编码/制单人/耗材名称"
  33. />
  34. <el-button
  35. size="small"
  36. class="filter-item"
  37. type="primary"
  38. icon="el-icon-search"
  39. @click="search"
  40. >搜索</el-button
  41. >
  42. <div style="margin-left:10px;">
  43. <label class="title"><span class="name">入库时间</span> : </label>
  44. <el-date-picker
  45. size="small"
  46. v-model="start_time"
  47. prefix-icon="el-icon-date"
  48. :editable="false"
  49. style="width: 196px;"
  50. type="date"
  51. placeholder="选择日期时间"
  52. align="right"
  53. format="yyyy-MM-dd"
  54. value-format="yyyy-MM-dd"
  55. @change="startTimeChange"
  56. ></el-date-picker>
  57. <span class="cellLine"> - </span>
  58. <el-date-picker
  59. size="small"
  60. v-model="end_time"
  61. prefix-icon="el-icon-date"
  62. :editable="false"
  63. style="width: 196px;"
  64. type="date"
  65. placeholder="选择日期时间"
  66. align="right"
  67. format="yyyy-MM-dd"
  68. value-format="yyyy-MM-dd"
  69. @change="endTimeChange"
  70. ></el-date-picker>
  71. </div>
  72. <!-- <div style="margin-left: 10px">
  73. <span>审核状态:</span>
  74. <el-select
  75. v-model="check_id"
  76. style="width: 140px; margin-right: 10px"
  77. placeholder="请选择"
  78. @change="changeTypeName"
  79. >
  80. <el-option
  81. v-for="item in checkList"
  82. :key="item.id"
  83. :label="item.name"
  84. :value="item.id"
  85. >
  86. </el-option>
  87. </el-select>
  88. </div> -->
  89. </div>
  90. <div class="cell clearfix">
  91. <el-checkbox
  92. style="width: 70px"
  93. v-model="checkAllStatus"
  94. @change="changeCheck"
  95. >全选</el-checkbox
  96. >
  97. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  98. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  99. <el-button size="small" type="primary" @click="toExport" @disabled="exportLoding">导出</el-button>
  100. <span>&nbsp;&nbsp;</span>
  101. <label class="title"><span class="name">审核状态</span> :</label>
  102. <el-select size="small" v-model="check_type" filterable placeholder="请选择仓库" style="width:200px" @change="changeCheckType">
  103. <el-option
  104. v-for="(option, index) in checkList"
  105. :key="index"
  106. :label="option.name"
  107. :value="option.id">
  108. </el-option>
  109. </el-select>
  110. </div>
  111. <el-table
  112. ref="multipleTable"
  113. :data="Warehouse.warehouseDate"
  114. :class="signAndWeighBoxPatients"
  115. style="width: 100%"
  116. border
  117. highlight-current-row
  118. v-loading="Warehouse.loading"
  119. @selection-change="select"
  120. :row-style="{ color: '#303133' }"
  121. :header-cell-style="{
  122. backgroundColor: 'rgb(245, 247, 250)',
  123. color: '#606266'
  124. }"
  125. @current-change="handleSearch"
  126. >
  127. <el-table-column align="center" type="selection" width="55">
  128. </el-table-column>
  129. <el-table-column label="单据日期" align="center">
  130. <template slot-scope="scope">
  131. {{ scope.row.warehousing_time | parseTime("{y}-{m}-{d}") }}
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="单据编号" align="center">
  135. <template slot-scope="scope">
  136. {{ scope.row.warehousing_order }}
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="仓库名称" align="center">
  140. <template slot-scope="scope">
  141. {{getHouseName(scope.row.storehouse_id)}}
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="制单人" align="center">
  145. <template slot-scope="scope">
  146. {{ getXuserName(scope.row.creater) }}
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="审核人" align="center" v-if="org_id == 3877 || org_id == 10318">
  150. <template slot-scope="scope">
  151. {{ getXuserName(scope.row.checker) }}
  152. </template>
  153. </el-table-column>
  154. <el-table-column label="入库方式" align="center">
  155. <template slot-scope="scope">
  156. <span v-if="scope.row.is_sys == 12">调拨入库</span>
  157. <span v-if="scope.row.is_sys == 0">
  158. <span v-if="org_id !=10633"> 手动入库</span>
  159. <span v-if="org_id ==10633"> 验货入库</span>
  160. </span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="审核状态" align="center">
  164. <template slot-scope="scope">
  165. <span v-if="scope.row.is_check == 1">已审核</span>
  166. <span v-if="scope.row.is_check == 2">未审核</span>
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="操作" align="center" width="260px">
  170. <template slot-scope="scope">
  171. <el-tooltip
  172. class="item"
  173. effect="dark"
  174. content="编辑"
  175. placement="top"
  176. >
  177. <el-button
  178. size="small"
  179. type="primary"
  180. icon="el-icon-edit-outline"
  181. @click="handleEdit(scope.$index, scope.row)"
  182. >
  183. </el-button>
  184. </el-tooltip>
  185. <el-tooltip
  186. class="item"
  187. effect="dark"
  188. content="删除"
  189. placement="top"
  190. >
  191. <el-button
  192. size="small"
  193. type="danger"
  194. icon="el-icon-delete"
  195. @click="handleDelete(scope.$index, scope.row)"
  196. >
  197. </el-button>
  198. </el-tooltip>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. <el-pagination
  203. @size-change="handleSizeChange"
  204. @current-change="handleCurrentChange"
  205. :page-sizes="[5, 10, 50, 100]"
  206. :page-size="5"
  207. background
  208. style="margin-top:20px;text-align: right"
  209. layout="total, sizes, prev, pager, next, jumper"
  210. :total="total"
  211. >
  212. </el-pagination>
  213. <div v-show="tableShow" style="margin-top:10px;">
  214. <el-table
  215. :data="tableList"
  216. :class="signAndWeighBoxPatients"
  217. style="width: 100%"
  218. border
  219. highlight-current-row
  220. v-loading="Warehouse.loading"
  221. @selection-change="select"
  222. :row-style="{ color: '#303133' }"
  223. :header-cell-style="{
  224. backgroundColor: 'rgb(245, 247, 250)',
  225. color: '#606266'
  226. }"
  227. fit
  228. >
  229. <el-table-column label="耗材名称" align="center">
  230. <template slot-scope="scope">
  231. <span v-if="scope.row.is_total == 0">
  232. {{ scope.row.GoodInfo.good_name }}
  233. </span>
  234. </template>
  235. </el-table-column>
  236. <el-table-column label="耗材类型" align="center">
  237. <template slot-scope="scope">
  238. <span v-if="scope.row.is_total ==0">
  239. {{ getTypeName(scope.row.GoodInfo.good_type_id)}}
  240. </span>
  241. </template>
  242. </el-table-column>
  243. <el-table-column label="规格&单位" align="center">
  244. <template slot-scope="scope">
  245. <span v-if="scope.row.is_total == 0">
  246. {{ scope.row.GoodInfo.specification_name}} / {{scope.row.GoodInfo.packing_unit}}
  247. </span>
  248. </template>
  249. </el-table-column>
  250. <el-table-column label="国家编码" align="center">
  251. <template slot-scope="scope">
  252. <span v-if="scope.row.is_total == 0">
  253. {{ scope.row.GoodInfo.social_security_directory_code}}
  254. </span>
  255. </template>
  256. </el-table-column>
  257. <el-table-column label="批号" align="center">
  258. <template slot-scope="scope">
  259. <span v-if="scope.row.is_total== 0">
  260. {{ scope.row.number}}
  261. </span>
  262. </template>
  263. </el-table-column>
  264. <el-table-column label="仓库名称" align="center">
  265. <template slot-scope="scope">
  266. <span v-if="scope.row.is_total == 0">
  267. {{getHouseName(scope.row.storehouse_id)}}
  268. </span>
  269. </template>
  270. </el-table-column>
  271. <el-table-column label="入库数量" align="center">
  272. <template slot-scope="scope">
  273. <span v-if="scope.row.is_total == 0">{{ scope.row.warehousing_count}}{{scope.row.GoodInfo.packing_unit}} </span>
  274. </template>
  275. </el-table-column>
  276. <!-- <el-table-column label="零售价" align="center">
  277. <template slot-scope="scope">
  278. {{ scope.row.packing_price}}
  279. </template>
  280. </el-table-column> -->
  281. <el-table-column label="进货价" align="center">
  282. <template slot-scope="scope">
  283. <span v-if="scope.row.is_total == 0">
  284. {{ scope.row.price}}
  285. </span>
  286. </template>
  287. </el-table-column>
  288. <el-table-column label="总价" align="center">
  289. <template slot-scope="scope">
  290. <span v-if="scope.row.is_total==0">
  291. {{ (scope.row.warehousing_count * scope.row.price).toFixed(2)}}
  292. </span>
  293. <span v-if="scope.row.is_total== 1">
  294. {{(scope.row.total_count).toFixed(2)}}
  295. </span>
  296. </template>
  297. </el-table-column>
  298. <el-table-column label="生产厂家" align="center">
  299. <template slot-scope="scope">
  300. <span v-if="scope.row.is_total == 0">
  301. {{ getManufactuerName(scope.row.manufacturer)}}
  302. </span>
  303. </template>
  304. </el-table-column>
  305. <el-table-column label="生产日期" align="center">
  306. <template slot-scope="scope">
  307. <span v-if="scope.row.is_total == 0">
  308. {{ getTime(scope.row.product_date,"{y}-{m}-{d}")}}
  309. </span>
  310. </template>
  311. </el-table-column>
  312. <el-table-column label="有效期" align="center">
  313. <template slot-scope="scope">
  314. <span v-if="scope.row.is_total == 0">
  315. {{ getTime(scope.row.expiry_date,"{y}-{m}-{d}")}}
  316. </span>
  317. </template>
  318. </el-table-column>
  319. <el-table-column label="经销商" align="center">
  320. <template slot-scope="scope">
  321. <span v-if="scope.row.is_total == 0">
  322. {{ getDealerName(scope.row.dealer)}}
  323. </span>
  324. </template>
  325. </el-table-column>
  326. <el-table-column label="批准文号" align="center" v-if="org_id!=10653&&org_id!=0">
  327. <template slot-scope="scope">
  328. <span v-if="scope.row.is_total ==0"> {{ scope.row.license_number}}</span>
  329. </template>
  330. </el-table-column>
  331. <el-table-column label="生产许可证号" align="center" v-if="org_id ==10653 || org_id == 0">
  332. <template slot-scope="scope">
  333. <span v-if="scope.row.is_total ==0"> {{ scope.row.license_number}}</span>
  334. </template>
  335. </el-table-column>
  336. <el-table-column label="注册编码" align="center">
  337. <template slot-scope="scope">
  338. <span v-if="scope.row.is_total == 0">
  339. {{ scope.row.register_number}}
  340. </span>
  341. </template>
  342. </el-table-column>
  343. <el-table-column label="耗材追溯码" align="center">
  344. <template slot-scope="scope">
  345. <span v-if="scope.row.is_total == 0">
  346. {{ scope.row.good_code}}
  347. </span>
  348. </template>
  349. </el-table-column>
  350. <el-table-column label="耗材追溯码个数" align="center">
  351. <template slot-scope="scope">
  352. <span v-if="scope.row.is_total == 0">
  353. {{ getGoodCodeSumCount(scope.row.good_code)}}
  354. </span>
  355. </template>
  356. </el-table-column>
  357. <el-table-column label="备注" align="center">
  358. <template slot-scope="scope">
  359. <span v-if="scope.row.is_total == 0">
  360. {{ scope.row.remark }}
  361. </span>
  362. </template>
  363. </el-table-column>
  364. </el-table>
  365. </div>
  366. </div>
  367. <el-dialog
  368. title="详情"
  369. :visible.sync="dialogVisible"
  370. width="80%"
  371. >
  372. <span>
  373. <div>
  374. <el-row>
  375. <span style="font-size: 18px;color: #606266">入库单详情</span>
  376. </el-row>
  377. <el-row style="float:left;">
  378. <span style="color: #606266"
  379. >入库单号: {{ WarehouseInfo.warehouse.warehousing_order }}</span
  380. >
  381. </el-row>
  382. </div>
  383. <div class="cell clearfix">
  384. <span style="width: 300px;color: #606266;float:right">单据日期:{{ WarehouseInfo.warehouse.warehousing_time | parseTime("{y}-{m}-{d}")}} </span>
  385. <span style="width: 300px;color: #606266;float:right">厂商:{{ getManufactuerName(WarehouseInfo.warehouse.manufacturer) }}</span>
  386. <span style="width: 300px;color: #606266"
  387. >经销商:{{ getDealerName(WarehouseInfo.warehouse.dealer) }} </span>
  388. </div>
  389. <div class="cell clearfix" style="margin-top: 10px">
  390. <el-button size="small" icon="el-icon-edit" @click="editRecord"
  391. >编辑</el-button
  392. >
  393. <el-button size="small" icon="el-icon-delete" @click="deleteRecord"
  394. >删除</el-button
  395. >
  396. <el-row :gutter="12" style="margin-top: 10px">
  397. <el-table
  398. :data="WarehouseInfo.warehouseInfoDate"
  399. :class="signAndWeighBoxPatients"
  400. style="width: 100%"
  401. border
  402. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  403. >
  404. <el-table-column min-width="35" align="center">
  405. <template slot="header" slot-scope="scope">
  406. <span>耗材类型</span>
  407. </template>
  408. <template slot-scope="scope">
  409. <span v-if="scope.row.good_type_id != 0">{{
  410. getTypeName(scope.row.good_type_id)
  411. }}</span>
  412. </template>
  413. </el-table-column>
  414. <el-table-column min-width="35" align="center">
  415. <template slot="header" slot-scope="scope">
  416. <span>耗材名称</span>
  417. </template>
  418. <template slot-scope="scope">
  419. <span v-if="scope.row.good_id != 0">{{
  420. getTypeNameOne(scope.row.good_id)
  421. }}</span>
  422. </template>
  423. </el-table-column>
  424. <el-table-column min-width="35" align="center">
  425. <template slot="header" slot-scope="scope">
  426. <span>规格型号</span>
  427. </template>
  428. <template slot-scope="scope">
  429. <span v-if="scope.row.good_id != 0">{{
  430. getSpecificationName(scope.row.good_id)
  431. }}</span>
  432. </template>
  433. </el-table-column>
  434. <el-table-column min-width="23" align="center">
  435. <template slot="header" slot-scope="scope">
  436. <span>进货价</span>
  437. </template>
  438. <template slot-scope="scope">
  439. <span>{{ scope.row.price }}</span>
  440. </template>
  441. </el-table-column>
  442. <el-table-column min-width="23" align="center">
  443. <template slot="header" slot-scope="scope">
  444. <span>入库数量</span>
  445. </template>
  446. <template slot-scope="scope">
  447. <span>{{ scope.row.warehousing_count }}</span>
  448. </template>
  449. </el-table-column>
  450. <el-table-column label="总价" min-width="20" align="center">
  451. <template slot-scope="scope">
  452. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  453. </template>
  454. </el-table-column>
  455. <el-table-column align="center" min-width="25">
  456. <template slot="header" slot-scope="scope">
  457. <span>批号</span>
  458. </template>
  459. <template slot-scope="scope">
  460. <span>{{ scope.row.number }}</span>
  461. </template>
  462. </el-table-column>
  463. <el-table-column label="生产日期" min-width="40" align="center">
  464. <template v-if="scope.row.product_date != 0" slot-scope="scope">
  465. {{ scope.row.product_date }}
  466. </template>
  467. </el-table-column>
  468. <el-table-column label="有效日期" min-width="40" align="center">
  469. <template v-if="scope.row.expiry_date != 0" slot-scope="scope">
  470. {{ scope.row.expiry_date }}
  471. </template>
  472. </el-table-column>
  473. <el-table-column label="备注" min-width="20" align="center">
  474. <template slot-scope="scope">
  475. <el-popover placement="top-start" width="250" trigger="hover">
  476. <div>{{ scope.row.remark }}</div>
  477. <span slot="reference" v-if="scope.row.remark.length > 20">{{
  478. scope.row.remark.substr(0, 20) + "..."
  479. }}</span>
  480. <span slot="reference" v-else>{{ scope.row.remark }}</span>
  481. </el-popover>
  482. </template>
  483. </el-table-column>
  484. </el-table>
  485. </el-row>
  486. </div>
  487. </span>
  488. <span slot="footer" class="dialog-footer">
  489. <el-button @click="dialogVisible = false">取 消</el-button>
  490. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  491. </span>
  492. </el-dialog>
  493. <el-dialog
  494. title="新增"
  495. :visible.sync="editDialogVisible"
  496. width="80%"
  497. >
  498. <span>
  499. <div style="margin-bottom:10px">
  500. <label class="title"><span class="name">入库时间</span> : </label>
  501. <el-date-picker size="small" v-model="warehousing_time" prefix-icon="el-icon-date" :editable="false"
  502. style="width: 196px;" type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  503. value-format="yyyy-MM-dd"></el-date-picker>
  504. <label class="title" style="margin-left:10px;"><span class="name">经 销 商</span> : </label>
  505. <el-select size="small" v-model="form.dealer" clearable placeholder="请选择经销商" @change="changeDealer">
  506. <el-option
  507. v-for="(option, index) in dealer"
  508. :key="index"
  509. :label="option.dealer_name"
  510. :value="option.id">
  511. </el-option>
  512. </el-select>
  513. <label class="title" style="margin-left:10px;"><span class="name">厂商</span> : </label>
  514. <el-select size="small" v-model="form.manufacturer" clearable placeholder="请选择厂商" @change="changeManufacturer">
  515. <el-option
  516. v-for="(option, index) in manufacturer"
  517. :key="index"
  518. :label="option.manufacturer_name"
  519. :value="option.id">
  520. </el-option>
  521. </el-select>
  522. </div>
  523. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  524. <el-table
  525. id="oictable"
  526. :data="recordInfo.recordData"
  527. :class="signAndWeighBoxPatients"
  528. style="width: 100%"
  529. border
  530. max-height="450"
  531. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  532. >
  533. <el-table-column align="center" width="200">
  534. <template slot="header" slot-scope="scope">
  535. <span>商品类型<span style="color: red">*</span></span>
  536. </template>
  537. <template slot-scope="scope">
  538. <el-form-item style="padding-top: 15px">
  539. <el-input
  540. placeholder="请输入商品类型"
  541. v-model="scope.row.good_type_id"
  542. :value="typeName(scope.row.good_type_id)"
  543. @focus="showDialog(scope.$index, scope.row)"
  544. ></el-input>
  545. </el-form-item>
  546. </template>
  547. </el-table-column>
  548. <el-table-column align="center" width="200">
  549. <template slot="header" slot-scope="scope">
  550. <span>规格名称<span style="color: red">*</span></span>
  551. </template>
  552. <template slot-scope="scope">
  553. <el-form-item style="padding-top: 15px">
  554. <el-input
  555. placeholder="请输入规格名称"
  556. v-model="scope.row.good_id"
  557. :value="specificationName(scope.row.good_id)"
  558. @focus="showDialog(scope.$index, scope.row)"
  559. ></el-input>
  560. </el-form-item>
  561. </template>
  562. </el-table-column>
  563. <el-table-column align="center" width="150">
  564. <template slot="header" slot-scope="scope">
  565. <span>单价<span style="color: red">*</span></span>
  566. </template>
  567. <template slot-scope="scope">
  568. <!--<el-input type="number" v-model="scope.row.price" @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
  569. <el-form-item
  570. :prop="'recordData.' + scope.$index + '.price'"
  571. :rules="tableRules.price"
  572. style="padding-top: 17px"
  573. >
  574. <el-input
  575. placeholder="请输入单价"
  576. type="number"
  577. v-model="scope.row.price"
  578. ></el-input>
  579. </el-form-item>
  580. </template>
  581. </el-table-column>
  582. <el-table-column align="center" width="180">
  583. <template slot="header" slot-scope="scope">
  584. <span>入库数量<span style="color: red">*</span></span>
  585. </template>
  586. <template slot-scope="scope">
  587. <!--{{scope.row.warehousing_count}}-->
  588. <!--<el-input type="number" v-model="scope.row.warehousing_count" @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
  589. <el-form-item
  590. :prop="'recordData.' + scope.$index + '.warehousing_count'"
  591. :rules="tableRules.warehousing_count"
  592. style="padding-top: 17px"
  593. >
  594. <el-input
  595. placeholder="请输入入库数量"
  596. type="number"
  597. v-model="scope.row.warehousing_count"
  598. ></el-input>
  599. </el-form-item>
  600. </template>
  601. </el-table-column>
  602. <el-table-column label="总价" align="center" width="150">
  603. <template slot-scope="scope">
  604. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  605. </template>
  606. </el-table-column>
  607. <el-table-column align="center" width="150">
  608. <template slot="header" slot-scope="scope">
  609. <span>批号</span>
  610. </template>
  611. <template slot-scope="scope">
  612. <el-form-item style="padding-top: 15px">
  613. <el-input
  614. placeholder="请输入批号"
  615. v-model="scope.row.number"
  616. ></el-input>
  617. </el-form-item>
  618. </template>
  619. </el-table-column>
  620. <el-table-column label="生产日期" width="250" align="center">
  621. <template slot-scope="scope">
  622. <el-date-picker
  623. prefix-icon="el-icon-date"
  624. style="width: 145px"
  625. v-model="scope.row.product_date"
  626. type="date"
  627. placeholder="选择日期时间"
  628. format="yyyy-MM-dd"
  629. value-format="yyyy-MM-dd"
  630. ></el-date-picker>
  631. </template>
  632. </el-table-column>
  633. <el-table-column label="有效日期" width="250" align="center">
  634. <template slot-scope="scope">
  635. <el-date-picker
  636. prefix-icon="el-icon-date"
  637. style="width: 145px"
  638. v-model="scope.row.expiry_date"
  639. type="date"
  640. placeholder="选择日期时间"
  641. format="yyyy-MM-dd"
  642. value-format="yyyy-MM-dd"
  643. ></el-date-picker>
  644. </template>
  645. </el-table-column>
  646. <el-table-column label="备注" width="150" align="center">
  647. <template slot-scope="scope">
  648. <el-input v-model="scope.row.remark"></el-input>
  649. </template>
  650. </el-table-column>
  651. <el-table-column
  652. label="操作"
  653. fixed="right"
  654. align="center"
  655. width="150"
  656. >
  657. <template slot-scope="scope">
  658. <el-tooltip
  659. class="item"
  660. effect="dark"
  661. content="新增"
  662. placement="top"
  663. >
  664. <el-button
  665. size="mini"
  666. type="primary"
  667. icon="el-icon-circle-plus-outline"
  668. @click="handleEditTwo(scope.$index, scope.row)"
  669. >
  670. </el-button>
  671. </el-tooltip>
  672. <el-tooltip
  673. class="item"
  674. effect="dark"
  675. content="删除"
  676. placement="top"
  677. >
  678. <el-button
  679. size="mini"
  680. type="danger"
  681. icon="el-icon-delete"
  682. @click="DeleteWarehouseInfoItem(scope.$index, scope.row)"
  683. >
  684. </el-button>
  685. </el-tooltip>
  686. </template>
  687. </el-table-column>
  688. </el-table>
  689. </el-form>
  690. </span>
  691. <span slot="footer" class="dialog-footer">
  692. <el-button @click="editDialogVisible = false">取 消</el-button>
  693. <el-button type="primary" @click="submit()">保 存</el-button>
  694. </span>
  695. </el-dialog>
  696. <stock-in-dialog
  697. ref="dialog"
  698. :propForm="propForm"
  699. :visibility="isVisibility"
  700. v-on:dialog-comfirm="comfirm"
  701. v-on:dialog-cancle="cancle">
  702. </stock-in-dialog>
  703. </div>
  704. </template>
  705. <script>
  706. import stockInDialog from "./Dialog/stockInDialog";
  707. import { uParseTime } from "@/utils/tools";
  708. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  709. import {
  710. deleteWarehouseInfo,
  711. GetAllConfig,
  712. GetAllGoodInfo,
  713. GetAllGoodType,
  714. getWarehouseInfoList,
  715. getWarehouseList,
  716. DeleteWarehouseInfoItem,
  717. GetAllGoodInfoByID,
  718. EditWarehouse,
  719. getExportStockList
  720. } from "@/api/stock";
  721. import { GetAllDrugInfoByID,postDrugWarehouse} from "@/api/drug/drug_stock";
  722. import BreadCrumb from "../components/bread-crumb";
  723. export default {
  724. name: "stockIn",
  725. components: { BreadCrumb, stockInDialog },
  726. created() {
  727. var nowDate = new Date();
  728. var nowYear = nowDate.getFullYear();
  729. var nowMonth = nowDate.getMonth() + 1;
  730. var nowDay = nowDate.getDate();
  731. this.end_time =
  732. nowYear +
  733. "-" +
  734. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  735. "-" +
  736. (nowDay < 10 ? "0" + nowDay : nowDay);
  737. nowDate.setMonth(nowDate.getMonth() - 1);
  738. nowYear = nowDate.getFullYear();
  739. nowMonth = nowDate.getMonth() + 1;
  740. nowDay = nowDate.getDate();
  741. this.start_time =
  742. nowYear +
  743. "-" +
  744. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  745. "-" +
  746. (nowDay < 10 ? "0" + nowDay : nowDay);
  747. this.org_id = this.$store.getters.xt_user.org.id
  748. this.GetWarehouse();
  749. this.GetConfigInfo();
  750. this.fetchAllAdminUsers();
  751. this.GetAllGoodType()
  752. this.GetAllGoodInfo()
  753. },
  754. data() {
  755. var checkGoodId = (rule, value, callback) => {
  756. setTimeout(() => {
  757. if (value == "" || value == 0) {
  758. return callback(new Error("规格名称不能为空"));
  759. }
  760. }, 2000);
  761. };
  762. return {
  763. crumbs: [
  764. { path: false, name: "库存管理" },
  765. { path: false, name: "入库单" }
  766. ],
  767. searchKey: "",
  768. type: 1,
  769. page: 1,
  770. limit: 5,
  771. checked: false,
  772. total: 0,
  773. pageTotal: 0,
  774. pageSelect: 0,
  775. adminUserOptions: [],
  776. multipleSelection: [],
  777. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  778. start_time: "",
  779. end_time: "",
  780. goodType: [],
  781. goodInfo: [],
  782. manufacturer: [],
  783. selectedTableData: [],
  784. dealer: [],
  785. Warehouse: {
  786. loading: false,
  787. warehouseDate: [],
  788. tableCurrentIndex: ""
  789. },
  790. WarehouseInfo: {
  791. loading: false,
  792. warehouseInfoDate: [],
  793. warehouse: {}
  794. },
  795. startTime: "",
  796. dialogVisible:false,
  797. editDialogVisible:false,
  798. recordInfo: {
  799. recordData: [],
  800. stock_in_code: "",
  801. current_index: ""
  802. },
  803. tableRules: {
  804. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  805. warehousing_count: [
  806. { required: true, message: "数量不能为空", trigge: "blur" }
  807. ],
  808. good_id: [{ validator: checkGoodId, trigger: "blur" }]
  809. },
  810. form: {
  811. manufacturer:0,
  812. dealer:0
  813. },
  814. warehousing_time: '',
  815. warehouse:{},
  816. propForm: {
  817. goods: [],
  818. goodType: [],
  819. goodInfo: [],
  820. goodUnit: [],
  821. title: '入库',
  822. formValue: {
  823. good_type_id: '',
  824. good_id: '',
  825. number: '',
  826. product_date: '',
  827. expiry_date: '',
  828. warehousing_count: '',
  829. price: '',
  830. remark: '',
  831. dealer: '',
  832. manufacturer: ''
  833. },
  834. isCreated: 1,
  835. isVisibility: false,
  836. drug_id:1,
  837. },
  838. drug_id:1,
  839. tableShow:false,
  840. tableList:[],
  841. isVisibility:false,
  842. order_id:0,
  843. exportList:[],
  844. checkAllStatus:false,
  845. list:[],
  846. storehouse_id:0,
  847. check_type:0,
  848. checkList:[
  849. {id:0,name:"全部"},
  850. {id:1,name:"已审核"},
  851. {id:2,name:"未审核"},
  852. ],
  853. check_id: 0,
  854. exportLoding:false,
  855. org_id:0
  856. };
  857. },
  858. methods: {
  859. getGoodCodeSumCount(val){
  860. var total = []
  861. if(val!=null && val.length>0){
  862. total = val.split(",")
  863. }
  864. if(total !="" ){
  865. return total.length-1
  866. }else{
  867. return ""
  868. }
  869. },
  870. changeTypeName() {
  871. this.getlist();
  872. },
  873. getlist() {
  874. var params = {
  875. check_id: this.check_id,
  876. start_time: this.start_time,
  877. end_time: this.end_time,
  878. keyword: this.keywords,
  879. page: this.page,
  880. limit: this.limit,
  881. };
  882. getAllSecondOrderList(params).then((response) => {
  883. if (response.data.state == 1) {
  884. var list = response.data.data.list;
  885. this.tableList = list;
  886. var total = response.data.data.total;
  887. this.total = total;
  888. this.houseList = response.data.data.houseList;
  889. this.doctorList = response.data.data.doctorList;
  890. }
  891. });
  892. },
  893. changeCheckType(){
  894. this.GetWarehouse()
  895. },
  896. changeCheck() {
  897. this.$refs.multipleTable.clearSelection();
  898. if (this.checkAllStatus) {
  899. this.$refs.multipleTable.toggleAllSelection();
  900. }
  901. },
  902. search: function() {
  903. const Params = {
  904. page: this.page,
  905. limit: this.limit,
  906. start_time: this.start_time,
  907. end_time: this.end_time,
  908. type: this.type,
  909. keywords: this.searchKey,
  910. storehouse_id:this.storehouse_id,
  911. check_type:this.check_type,
  912. };
  913. this.Warehouse.warehouseDate = [];
  914. getWarehouseList(Params).then(response => {
  915. if (response.data.state == 0) {
  916. this.Warehouse.loading = false;
  917. this.$message.error(response.data.msg);
  918. return false;
  919. } else {
  920. this.Warehouse.loading = false;
  921. this.total = response.data.data.total;
  922. for (let i = 0; i < response.data.data.list.length; i++) {
  923. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  924. }
  925. }
  926. });
  927. },
  928. GetWarehouse: function() {
  929. const Params = {
  930. page: this.page,
  931. limit: this.limit,
  932. start_time: this.start_time,
  933. end_time: this.end_time,
  934. type: this.type,
  935. keywords: this.searchKey,
  936. storehouse_id:this.storehouse_id,
  937. check_type:this.check_type,
  938. };
  939. this.Warehouse.warehouseDate = [];
  940. getWarehouseList(Params).then(response => {
  941. if (response.data.state == 0) {
  942. this.Warehouse.loading = false;
  943. this.$message.error(response.data.msg);
  944. return false;
  945. } else {
  946. this.Warehouse.loading = false;
  947. this.total = response.data.data.total;
  948. for (let i = 0; i < response.data.data.list.length; i++) {
  949. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  950. }
  951. this.list = []
  952. var obj = {id:0,storehouse_name:"全部"}
  953. this.list.push(obj)
  954. for(let i=0;i<response.data.data.houselist.length;i++){
  955. this.list.push(response.data.data.houselist[i])
  956. }
  957. }
  958. });
  959. },
  960. tableRowClassName({ row, rowIndex }) {
  961. // 把每一行的索引放进row
  962. row.index = rowIndex;
  963. },
  964. onRowClick(row, event, column) {
  965. this.WarehouseInfo.warehouseInfoDate = [];
  966. this.Warehouse.tableCurrentIndex = row.index;
  967. const params = {
  968. id: row.id
  969. };
  970. this.WarehouseInfo.loading = true;
  971. getWarehouseInfoList(params).then(response => {
  972. if (response.data.state == 0) {
  973. this.WarehouseInfo.loading = false;
  974. this.$message.error(response.data.msg);
  975. return false;
  976. } else {
  977. this.WarehouseInfo.loading = false;
  978. for (let i = 0; i < response.data.data.info.length; i++) {
  979. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i]);
  980. }
  981. }
  982. });
  983. },
  984. getXuserName(id) {
  985. if (id <= 0) {
  986. return "";
  987. }
  988. var name = "";
  989. if (
  990. this.adminUserOptions == null ||
  991. typeof this.adminUserOptions.length === "undefined"
  992. ) {
  993. return name;
  994. }
  995. var leng = this.adminUserOptions.length;
  996. if (leng == 0) {
  997. return name;
  998. }
  999. for (let index = 0; index < leng; index++) {
  1000. if (this.adminUserOptions[index].id == id) {
  1001. name = this.adminUserOptions[index].name;
  1002. break;
  1003. }
  1004. }
  1005. return name;
  1006. },
  1007. fetchAllDoctorAndNurse() {
  1008. fetchAllDoctorAndNurse().then(response => {
  1009. if (response.data.state == 1) {
  1010. this.doctorOptions = response.data.data.doctors;
  1011. }
  1012. });
  1013. },
  1014. fetchAllAdminUsers() {
  1015. fetchAllAdminUsers().then(response => {
  1016. if (response.data.state == 1) {
  1017. this.adminUserOptions = response.data.data.users;
  1018. var alen = this.adminUserOptions.length;
  1019. for (let index = 0; index < alen; index++) {
  1020. if (this.adminUserOptions[index].user_type == 2) {
  1021. // this.doctorOptions.push(this.adminUserOptions[index]);
  1022. }
  1023. }
  1024. }
  1025. });
  1026. },
  1027. getSpecificationName: function(id) {
  1028. let name = "";
  1029. for (let i = 0; i < this.goodInfo.length; i++) {
  1030. if (this.goodInfo[i].id == id) {
  1031. name = this.goodInfo[i].specification_name;
  1032. }
  1033. }
  1034. return name;
  1035. },
  1036. getTypeName: function(id) {
  1037. let name = "";
  1038. for (let i = 0; i < this.goodType.length; i++) {
  1039. if (this.goodType[i].id == id) {
  1040. name = this.goodType[i].type_name;
  1041. }
  1042. }
  1043. return name;
  1044. },
  1045. getTypeNameOne:function(id){
  1046. let name = "";
  1047. for (let i = 0; i < this.goodInfo.length; i++) {
  1048. if (this.goodInfo[i].id == id) {
  1049. name = this.goodInfo[i].good_name;
  1050. }
  1051. }
  1052. return name;
  1053. },
  1054. GetAllGoodType: function() {
  1055. GetAllGoodType().then(response => {
  1056. if (response.data.state == 0) {
  1057. this.$message.error(response.data.msg);
  1058. return false;
  1059. } else {
  1060. for (let i = 0; i < response.data.data.goodType.length; i++) {
  1061. this.goodType.push(response.data.data.goodType[i]);
  1062. }
  1063. }
  1064. });
  1065. },
  1066. GetAllGoodInfo: function() {
  1067. GetAllGoodInfo().then(response => {
  1068. if (response.data.state == 0) {
  1069. this.$message.error(response.data.msg);
  1070. return false;
  1071. } else {
  1072. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  1073. this.goodInfo.push(response.data.data.goodInfo[i]);
  1074. }
  1075. }
  1076. });
  1077. },
  1078. clicks: function() {
  1079. },
  1080. handleWarehouse: function() {
  1081. this.$router.push({ path: "/stock/in/add", query: { type: this.type } });
  1082. },
  1083. handleReturnSales: function() {
  1084. // this.$router.push({path:'/patients/create'}
  1085. if (this.multipleSelection.length <= 0) {
  1086. this.$message.error("请选择退货商品");
  1087. return;
  1088. }
  1089. const ids = [];
  1090. for (let i = 0; i < this.multipleSelection.length; i++) {
  1091. ids.push(this.multipleSelection[i].id);
  1092. }
  1093. this.$router.push({ name: "salesReturn", query: { id: ids.join("&") } });
  1094. },
  1095. handleReturnSalesRecord: function() {
  1096. this.$router.push({ name: "salesReutrnRecord" });
  1097. },
  1098. handleWarehouseRecord: function() {
  1099. this.$router.push({ name: "warehouseRecord" });
  1100. },
  1101. handleSelectionChange: function(val) {
  1102. this.multipleSelection = val;
  1103. },
  1104. handleSizeChange(val) {
  1105. this.limit = val;
  1106. this.GetWarehouse();
  1107. },
  1108. handleCurrentChange(val) {
  1109. this.page = val;
  1110. this.GetWarehouse();
  1111. },
  1112. startTimeChange(val) {
  1113. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  1114. if (time > 0) {
  1115. this.$message.error("结束时间不能小于开始时间");
  1116. this.start_time = "";
  1117. } else {
  1118. this.startTime = this.getTimestamp(val);
  1119. this.GetWarehouse();
  1120. this.getlist()
  1121. }
  1122. },
  1123. endTimeChange(val) {
  1124. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  1125. if (time < 0) {
  1126. this.$message.error("结束时间不能小于开始时间");
  1127. this.end_time = "";
  1128. } else {
  1129. this.GetWarehouse();
  1130. this.getlist()
  1131. }
  1132. },
  1133. getTimestamp(time) {
  1134. // 把时间日期转成时间戳
  1135. return new Date(time).getTime() / 1000;
  1136. },
  1137. getTime(val, temp) {
  1138. if (val != 0) {
  1139. return uParseTime(val, temp);
  1140. } else {
  1141. return "";
  1142. }
  1143. },
  1144. calculate: function(val) {
  1145. return Math.round(parseFloat(val) * 100) / 100;
  1146. },
  1147. GetConfigInfo: function() {
  1148. GetAllConfig().then(response => {
  1149. if (response.data.state == 0) {
  1150. this.$message.error(response.data.msg);
  1151. return false;
  1152. } else {
  1153. this.manufacturer = response.data.data.manufacturer;
  1154. this.dealer = response.data.data.dealer;
  1155. // this.list = response.data.data.list
  1156. this.getlist()
  1157. }
  1158. });
  1159. },
  1160. getManufactuerName: function(manufacturer_id) {
  1161. for (let i = 0; i < this.manufacturer.length; i++) {
  1162. if (this.manufacturer[i].id == manufacturer_id) {
  1163. return this.manufacturer[i].manufacturer_name;
  1164. }
  1165. }
  1166. },
  1167. getDealerName: function(dealer_id) {
  1168. for (let i = 0; i < this.dealer.length; i++) {
  1169. if (this.dealer[i].id == dealer_id) {
  1170. return this.dealer[i].dealer_name;
  1171. }
  1172. }
  1173. },
  1174. handleEdit: function(index, row) {
  1175. this.$router.push({path:"/stock/in/order/edit?id="+row.id+"&supply_warehouse_id="+row.supply_warehouse_id+"&is_sys="+row.is_sys+"&is_check="+row.is_check+"&type="+row.type})
  1176. },
  1177. handleDelete: function(index, row) {
  1178. if(row.is_sys== 12){
  1179. this.$message.error("调拨入库数据不能删除!")
  1180. return false
  1181. }
  1182. if(row.supply_warehouse_id > 0){
  1183. this.$message.error("采购入库单不能删除!")
  1184. return false
  1185. }
  1186. if(row.is_check == 1){
  1187. this.$message.error("已审核的单据不能删除!")
  1188. return false
  1189. }
  1190. const ids = [];
  1191. ids.push(row.id);
  1192. const idStr = ids.join(",");
  1193. const params = {
  1194. ids: idStr
  1195. };
  1196. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  1197. confirmButtonText: "确定",
  1198. cancelButtonText: "取消",
  1199. type: "warning"
  1200. })
  1201. .then(() => {
  1202. deleteWarehouseInfo(params).then(response => {
  1203. if (response.data.state == 0) {
  1204. this.$message.error(response.data.msg);
  1205. return false;
  1206. } else {
  1207. this.$notify({
  1208. title: "成功",
  1209. message: "删除成功",
  1210. type: "success",
  1211. duration: 2000
  1212. });
  1213. for (let i = 0; i < ids.length; i++) {
  1214. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  1215. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  1216. this.Warehouse.warehouseDate.splice(y, 1);
  1217. }
  1218. }
  1219. }
  1220. }
  1221. });
  1222. })
  1223. .catch(() => {});
  1224. },
  1225. select(selection) {
  1226. var ids= []
  1227. for(let i=0;i<selection.length;i++){
  1228. ids.push(selection[i].id)
  1229. }
  1230. this.exportList = []
  1231. var str = ids.join(",")
  1232. this.order_id = str
  1233. this.selectedTableData = selection;
  1234. this.getlist()
  1235. },
  1236. batchDelete() {
  1237. if (this.selectedTableData.length <= 0) {
  1238. this.$message.error("请选择要删除的记录");
  1239. return;
  1240. }
  1241. const ids = [];
  1242. const idOne = []
  1243. for (let i = 0; i < this.selectedTableData.length; i++) {
  1244. if(this.selectedTableData[i].is_check == 1){
  1245. this.$message.error("已审核单据不能删除!")
  1246. return false
  1247. }
  1248. if(this.selectedTableData[i].is_sys ==12){
  1249. this.$message.error("调拨入库数据不能删除!")
  1250. return false
  1251. }
  1252. ids.push(this.selectedTableData[i].id);
  1253. if(this.selectedTableData[i].supply_warehouse_id >0){
  1254. idOne.push(this.selectedTableData[i].supply_warehouse_id)
  1255. }
  1256. }
  1257. for(let i=0;i<idOne.length;i++){
  1258. if(idOne[i] >0){
  1259. this.$message.error("采购入库数据不能删除!")
  1260. return false
  1261. }
  1262. }
  1263. const idStr = ids.join(",");
  1264. const params = {
  1265. ids: idStr
  1266. };
  1267. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  1268. confirmButtonText: "确定",
  1269. cancelButtonText: "取消",
  1270. type: "warning"
  1271. }).then(() => {
  1272. deleteWarehouseInfo(params).then(response => {
  1273. if (response.data.state == 0) {
  1274. this.$message.error(response.data.msg);
  1275. return false;
  1276. } else {
  1277. this.$notify({
  1278. title: "成功",
  1279. message: "删除成功",
  1280. type: "success",
  1281. duration: 2000
  1282. });
  1283. for (let i = 0; i < ids.length; i++) {
  1284. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  1285. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  1286. this.Warehouse.warehouseDate.splice(y, 1);
  1287. }
  1288. }
  1289. }
  1290. }
  1291. });
  1292. })
  1293. .catch(() => {});
  1294. },
  1295. // handleSearch(id){
  1296. // this.WarehouseInfo.warehouseInfoDate = [];
  1297. // this.GetOrderDetail(id)
  1298. // this.drug_id = id
  1299. // this.dialogVisible = true
  1300. // },
  1301. handleSearch(val){
  1302. this.tableList= []
  1303. this.GetOrderDetail(val.id)
  1304. this.drug_id = val.id
  1305. },
  1306. GetOrderDetail: function(id) {
  1307. const params = {
  1308. id: id
  1309. };
  1310. getWarehouseInfoList(params).then(response => {
  1311. if (response.data.state == 0) {
  1312. this.$message.error(response.data.msg);
  1313. return false;
  1314. } else {
  1315. this.tableShow = true
  1316. var obj = {name:"总计",total_count:0,is_total:1}
  1317. for (let i = 0; i < response.data.data.info.length; i++) {
  1318. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i]);
  1319. response.data.data.info[i].price = response.data.data.info[i].price.toString();
  1320. response.data.data.info[i].warehousing_count = response.data.data.info[i].warehousing_count.toString();
  1321. this.recordInfo.recordData.push(response.data.data.info[i]);
  1322. console.log("tablelist+++==+",this.tableList)
  1323. response.data.data.info[i].total_count = (response.data.data.info[i].warehousing_count * response.data.data.info[i].price).toFixed(2)
  1324. response.data.data.info[i].is_total = 0
  1325. obj.total_count += (response.data.data.info[i].warehousing_count * response.data.data.info[i].price)
  1326. this.tableList.push(response.data.data.info[i])
  1327. }
  1328. this.tableList.push(obj)
  1329. this.warehouse = response.data.data.warehousing;
  1330. this.warehousing_time = this.getTime(this.warehouse.warehousing_time,"{y}-{m}-{d}");
  1331. this.WarehouseInfo.warehouse = response.data.data.warehousing;
  1332. }
  1333. });
  1334. },
  1335. editRecord: function() {
  1336. this.editDialogVisible = true
  1337. },
  1338. deleteRecord: function() {
  1339. const ids = [];
  1340. ids.push(this.WarehouseInfo.warehouse.id);
  1341. const idStr = ids.join(",");
  1342. const params = {
  1343. ids: idStr
  1344. };
  1345. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  1346. confirmButtonText: "确定",
  1347. cancelButtonText: "取消",
  1348. type: "warning"
  1349. })
  1350. .then(() => {
  1351. deleteWarehouseInfo(params).then(response => {
  1352. if (response.data.state == 0) {
  1353. this.$message.error(response.data.msg);
  1354. return false;
  1355. } else {
  1356. this.$notify({
  1357. title: "成功",
  1358. message: "删除成功",
  1359. type: "success",
  1360. duration: 2000
  1361. });
  1362. this.$router.back(-1);
  1363. }
  1364. });
  1365. })
  1366. .catch(() => {});
  1367. },
  1368. typeName: function(good_type_id) {
  1369. let name = "";
  1370. for (let i = 0; i < this.goodType.length; i++) {
  1371. if (this.goodType[i].id == good_type_id) {
  1372. name = this.goodType[i].type_name;
  1373. }
  1374. }
  1375. return name;
  1376. },
  1377. showDialog(index, row) {
  1378. this.currentIndex = index;
  1379. const params = {
  1380. manufacturer_id: this.form.manufacturer,
  1381. dealer_id: this.form.dealer
  1382. };
  1383. this.propForm.goods = []
  1384. GetAllGoodInfoByID(params).then(response => {
  1385. if (response.data.state == 0) {
  1386. this.$message.error(response.data.msg);
  1387. return false;
  1388. } else {
  1389. if (response.data.data.goodInfo.length <= 0) {
  1390. this.$message.error("该厂商或经销商没有物品信息");
  1391. return;
  1392. }
  1393. this.$refs.dialog.show();
  1394. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  1395. this.propForm.goodType.push(
  1396. response.data.data.goodInfo[i].type
  1397. );
  1398. }
  1399. const obj = {};
  1400. this.propForm.goodType = this.propForm.goodType.reduce(
  1401. (cur, next) => {
  1402. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  1403. return cur;
  1404. },
  1405. []
  1406. ); // 设置cur默认类型为数组,并且初始值为空的数组
  1407. }
  1408. for (let i = 0; i < this.propForm.goodType.length; i++) {
  1409. let goodInfo = [];
  1410. let goodObj = {};
  1411. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  1412. var respObj = response.data.data.goodInfo[a];
  1413. respObj["isSelected"] = false;
  1414. if (respObj.type.id == this.propForm.goodType[i].id) {
  1415. goodInfo.push(respObj);
  1416. }
  1417. }
  1418. const obj = {};
  1419. goodInfo = goodInfo.reduce((cur, next) => {
  1420. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  1421. return cur;
  1422. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  1423. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo);
  1424. this.propForm.goods.push(goodObj);
  1425. }
  1426. });
  1427. },
  1428. specificationName: function(drug_id) {
  1429. let name = "";
  1430. for (let i = 0; i < this.goodInfo.length; i++) {
  1431. if (this.goodInfo[i].id == drug_id) {
  1432. name = this.goodInfo[i].specification_name;
  1433. }
  1434. }
  1435. return name;
  1436. },
  1437. submit() {
  1438. this.$refs["tableForm"].validate(valid => {
  1439. if (valid) {
  1440. const array = this.recordInfo.recordData;
  1441. for (let i = 0; i < array.length; i++) {
  1442. if (array[i].good_type_id == 0) {
  1443. this.$message.error("商品类型不能为空");
  1444. return;
  1445. }
  1446. if (array[i].good_id == 0) {
  1447. this.$message.error("规格名称不能为空");
  1448. return;
  1449. }
  1450. }
  1451. const params = {
  1452. stockIn: this.recordInfo.recordData
  1453. };
  1454. EditWarehouse(
  1455. params,
  1456. this.warehousing_time,
  1457. this.drug_id,
  1458. this.type,
  1459. this.form.manufacturer,
  1460. this.form.dealer
  1461. ).then(response => {
  1462. if (response.data.state == 0) {
  1463. this.$message.error(response.data.msg);
  1464. return false;
  1465. } else {
  1466. this.$message.success("保存成功");
  1467. this.dialogVisible = false
  1468. this.editDialogVisible = false
  1469. }
  1470. });
  1471. } else {
  1472. return false;
  1473. }
  1474. });
  1475. },
  1476. changeManufacturer(val) {
  1477. },
  1478. changeDealer(val) {
  1479. },
  1480. DeleteWarehouseInfoItem: function(index, row) {
  1481. if (row.id == 0) {
  1482. this.recordInfo.recordData.splice(index, 1);
  1483. } else {
  1484. const params = {
  1485. id: row.id
  1486. };
  1487. this.$confirm("确认删除该入库商品信息记录?", "删除入库商品信息记录", {
  1488. confirmButtonText: "确定",
  1489. cancelButtonText: "取消",
  1490. type: "warning"
  1491. })
  1492. .then(() => {
  1493. DeleteWarehouseInfoItem(params).then(response => {
  1494. if (response.data.state == 0) {
  1495. this.$message.error(response.data.msg);
  1496. return false;
  1497. } else {
  1498. this.$message.success("删除成功");
  1499. this.recordInfo.recordData.splice(index, 1);
  1500. }
  1501. });
  1502. })
  1503. .catch(() => {});
  1504. }
  1505. },
  1506. handleEditTwo: function(index, row) {
  1507. const tempObj = {};
  1508. tempObj["id"] = 0;
  1509. tempObj["good_type_id"] = 0;
  1510. tempObj["good_id"] = 0;
  1511. tempObj["number"] = "";
  1512. tempObj["product_date"] = "";
  1513. tempObj["expiry_date"] = "";
  1514. tempObj["warehousing_count"] = "";
  1515. tempObj["price"] = "";
  1516. tempObj["remark"] = "";
  1517. tempObj["dealer"] = "";
  1518. tempObj["manufacturer"] = "";
  1519. this.recordInfo.recordData.push(tempObj);
  1520. },
  1521. comfirm: function(val) {
  1522. this.$refs.dialog.hide();
  1523. this.propForm.goodType = [];
  1524. this.propForm.goods = [];
  1525. if (val.selectedGoodInfo.length > 0) {
  1526. for (let i = val.selectedGoodInfo.length - 1; ; i--) {
  1527. if (i == 0) {
  1528. this.recordInfo.recordData[this.currentIndex].good_type_id =
  1529. val.selectedGoodInfo[i].good_type_id;
  1530. this.recordInfo.recordData[this.currentIndex].good_id =
  1531. val.selectedGoodInfo[i].id;
  1532. this.recordInfo.recordData[
  1533. this.currentIndex
  1534. ].price = val.selectedGoodInfo[i].buy_price.toString();
  1535. } else {
  1536. const tempForm = {};
  1537. tempForm["id"] = 0;
  1538. tempForm["good_type_id"] = val.selectedGoodInfo[i].good_type_id;
  1539. tempForm["good_id"] = val.selectedGoodInfo[i].id;
  1540. tempForm["number"] = "";
  1541. tempForm["product_date"] = "";
  1542. tempForm["expiry_date"] = "";
  1543. tempForm["warehousing_count"] = "";
  1544. tempForm["price"] = val.selectedGoodInfo[i].buy_price.toString();
  1545. tempForm["remark"] = "";
  1546. tempForm["dealer"] = "";
  1547. tempForm["manufacturer"] = "";
  1548. this.recordInfo.recordData.splice(
  1549. this.currentIndex + 1,
  1550. 0,
  1551. tempForm
  1552. );
  1553. }
  1554. }
  1555. }
  1556. this.currentIndex = -1;
  1557. },
  1558. cancle: function() {
  1559. this.$refs.dialog.hide();
  1560. this.propForm.goods = [];
  1561. this.propForm.goodType = [];
  1562. },
  1563. toPrint(){
  1564. if(this.order_id == ""){
  1565. this.$message.error("请勾选入库单")
  1566. }else{
  1567. this.$router.push("/stock/in/detail/print?id="+this.order_id)
  1568. }
  1569. },
  1570. getlist(){
  1571. this.exportLoding = true
  1572. var params = {
  1573. id:this.order_id,
  1574. start_time:this.start_time,
  1575. end_time:this.end_time,
  1576. storehouse_id:this.storehouse_id,
  1577. }
  1578. getExportStockList(params).then(response=>{
  1579. if(response.data.state == 1){
  1580. var list = response.data.data.list
  1581. for(let i=0;i<this.goodType.length;i++){
  1582. for(let j=0;j<list.length;j++){
  1583. if(this.goodType[i].id == list[j].good_type_id){
  1584. list[j].good_type_name = this.goodType[i].type_name
  1585. }
  1586. }
  1587. }
  1588. for(let i=0;i<list.length;i++){
  1589. list[i].unit = list[i].specification_name +"/"+ list[i].packing_unit
  1590. list[i].total_price = (list[i].warehousing_count * list[i].price).toFixed(2)
  1591. list[i].expiry_date = this.getTime(list[i].expiry_date,"{y}-{m}-{d}")
  1592. list[i].product_date = this.getTime(list[i].product_date,"{y}-{m}-{d}")
  1593. for(let j=0;j<this.manufacturer.length;j++){
  1594. if(list[i].manufacturer == this.manufacturer[j].id){
  1595. list[i].manufacturer = this.manufacturer[j].manufacturer_name
  1596. }
  1597. }
  1598. for(let z=0;z<this.dealer.length;z++){
  1599. if(list[i].dealer == this.dealer[z].id){
  1600. list[i].dealer = this.dealer[z].dealer_name
  1601. }
  1602. }
  1603. }
  1604. this.exportLoding = false
  1605. this.exportList = list
  1606. }
  1607. })
  1608. },
  1609. toExport(){
  1610. if(this.order_id == ""){
  1611. this.$message.error("请勾选入库单")
  1612. return
  1613. }
  1614. console.log("this.wowoowow",this.exportList)
  1615. import('@/vendor/Export2Excel').then(excel => {
  1616. for(let i=0;i<this.exportList.length;i++){
  1617. for(let j=0;j<this.goodType.length;j++){
  1618. if(this.exportList[i].good_type_id == this.goodType[j].id){
  1619. this.exportList[i].good_type_id = this.goodType[j].type_name
  1620. }
  1621. }
  1622. if(this.exportList[i].dealer == 0){
  1623. this.exportList[i].dealer = ""
  1624. }
  1625. if(this.exportList[i].manufacturer == 0){
  1626. this.exportList[i].manufacturer = ""
  1627. }
  1628. if(this.exportList[i].good_type_id == 0){
  1629. this.exportList[i].good_type_id = ""
  1630. }
  1631. this.exportList[i].warehousing_time = this.getTime(this.exportList[i].warehousing_time,"{y}-{m}-{d}")
  1632. }
  1633. const tHeader = ['单据日期','耗材名称','耗材类型', '规格&单位','批号','入库数量','进货价','总价','生产厂家','生产日期','有效期','经销商','批准文号','备注']
  1634. const filterVal = ['warehousing_time','good_name', 'good_type_id', 'unit','number','warehousing_count','price','total_price','manufacturer','product_date','expiry_date','dealer','license_number','remark']
  1635. const data = this.formatJson(filterVal, this.exportList)
  1636. excel.export_json_to_excel({
  1637. header: tHeader,
  1638. data,
  1639. filename: '耗材入库单详情'
  1640. })
  1641. this.downloadLoading = false
  1642. })
  1643. },
  1644. formatJson(filterVal, jsonData) {
  1645. return jsonData.map(v => filterVal.map(j => v[j]));
  1646. },
  1647. getHouseName(id){
  1648. var storehouse_name = ""
  1649. for(let i=0;i<this.list.length;i++){
  1650. if(id == this.list[i].id){
  1651. storehouse_name = this.list[i].storehouse_name
  1652. }
  1653. }
  1654. return storehouse_name
  1655. },
  1656. changeStoreHouse(){
  1657. this.GetWarehouse();
  1658. this.getlist()
  1659. }
  1660. }
  1661. };
  1662. </script>
  1663. <style rel="stylesheet/css" lang="scss" scoped>
  1664. .information {
  1665. border: 1px #dcdfe6 solid;
  1666. padding: 30px 20px 30px 20px;
  1667. .border {
  1668. border-bottom: 1px #dcdfe6 solid;
  1669. margin: 0px 0 20px 0;
  1670. }
  1671. }
  1672. .edit_separater {
  1673. border-top: 1px solid rgb(233, 233, 233);
  1674. margin-top: 15px;
  1675. margin-bottom: 15px;
  1676. }
  1677. </style>
  1678. <style>
  1679. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1680. font-size: 12px;
  1681. }
  1682. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1683. background: #6fb5fa;
  1684. }
  1685. .count {
  1686. color: #bd2c00;
  1687. }
  1688. .el-table td,
  1689. .el-table th.is-leaf,
  1690. .el-table--border,
  1691. .el-table--group {
  1692. border-color: #d0d3da;
  1693. }
  1694. .el-table--border::after,
  1695. .el-table--group::after,
  1696. .el-table::before {
  1697. background-color: #d0d3da;
  1698. }
  1699. </style>