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

stockOutOrder.vue 57KB

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