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

stockOutOrder.vue 55KB

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