Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

stockInOrder.vue 53KB

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