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

stockOutOrder.vue 56KB

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