stockOutOrder.vue 56KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723
  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 == 0){
  927. ids.push(this.selectedTableData[i].id);
  928. }
  929. }
  930. const idStr = ids.join(",");
  931. const params = {
  932. ids: idStr
  933. };
  934. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  935. confirmButtonText: "确定",
  936. cancelButtonText: "取消",
  937. type: "warning"
  938. })
  939. .then(() => {
  940. deleteWarehouseOut(params).then(response => {
  941. if (response.data.state == 0) {
  942. this.$message.error(response.data.msg);
  943. return false;
  944. } else {
  945. this.$notify({
  946. title: "成功",
  947. message: "删除成功",
  948. type: "success",
  949. duration: 2000
  950. });
  951. for (let i = 0; i < ids.length; i++) {
  952. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  953. if (ids[i] == this.warehouseOutDate[y].id) {
  954. this.warehouseOutDate.splice(y, 1);
  955. }
  956. }
  957. }
  958. }
  959. });
  960. })
  961. .catch(() => {});
  962. },
  963. handleSearch(val){
  964. this.tableList = []
  965. this.editdialogVisibleThree = false
  966. this.GetOrderDetailOne(val.id)
  967. this.GetTotalCount(val.warehouse_out_time)
  968. },
  969. GetOrderDetailOne(id){
  970. const params = {
  971. 'id': id
  972. }
  973. getOrderDetailByOrderId(params).then(response=>{
  974. if(response.data.state == 1){
  975. this.tableShow = true
  976. var list = response.data.data.list
  977. console.log("info2232323",list)
  978. this.tableList = []
  979. for(let i=0;i<list.length;i++){
  980. // if(list[i].dealer == 0){
  981. // list[i].dealer = ""
  982. // }
  983. // if(list[i].manufacturer == 0){
  984. // list[i].manufacturer = ""
  985. // }
  986. // list[i].good_name = list[i].info.good_name
  987. // list[i].specification_name = list[i].info.specification_name
  988. // list[i].packing_unit = list[i].info.packing_unit
  989. this.tableList.push(list[i])
  990. }
  991. }
  992. })
  993. },
  994. getTypeName: function(id) {
  995. let name = ''
  996. for (let i = 0; i < this.goodType.length; i++) {
  997. if (this.goodType[i].id == id) {
  998. name = this.goodType[i].type_name
  999. }
  1000. }
  1001. return name
  1002. },
  1003. getTypeNameOne: function(id) {
  1004. let name = ''
  1005. for (let i = 0; i < this.goodInfo.length; i++) {
  1006. if (this.goodInfo[i].id == id) {
  1007. name = this.goodInfo[i].good_name
  1008. }
  1009. }
  1010. return name
  1011. },
  1012. getSpecificationName: function(id) {
  1013. let name = ''
  1014. for (let i = 0; i < this.goodInfo.length; i++) {
  1015. if (this.goodInfo[i].id == id) {
  1016. name = this.goodInfo[i].specification_name
  1017. }
  1018. }
  1019. return name
  1020. },
  1021. getManufactuerName: function(manufacturer_id) {
  1022. for (let i = 0; i < this.manufacturer.length; i++) {
  1023. if (this.manufacturer[i].id == manufacturer_id) {
  1024. return this.manufacturer[i].manufacturer_name
  1025. }
  1026. }
  1027. },
  1028. jump(id){
  1029. this.userList = []
  1030. this.GetOrderDetail(id)
  1031. },
  1032. GetOrderDetail: function(order_id) {
  1033. this.userList = []
  1034. const params = {
  1035. 'id': order_id
  1036. }
  1037. getWarehouseOutUser(params).then(response => {
  1038. if (response.data.state == 0) {
  1039. this.$message.error(response.data.msg)
  1040. return false
  1041. } else {
  1042. var total = 0
  1043. var list = response.data.data.list
  1044. var arrList = this.unique(list)
  1045. for (let i = 0; i < arrList.length; i++) {
  1046. var obj = arrList[i]
  1047. obj['is_total'] = 0
  1048. this.userList.push(obj)
  1049. total = total + arrList[i].count
  1050. }
  1051. this.userList.push({
  1052. is_total: 1,
  1053. total: total,
  1054. })
  1055. // this.type_name = this.userList[0].type.type_name
  1056. // this.specification_name = this.userList[0].info.specification_name
  1057. console.log("详情数据区",this.userList)
  1058. this.editdialogVisibleThree = true
  1059. }
  1060. })
  1061. },
  1062. deleteRecord: function() {
  1063. const ids = []
  1064. ids.push(this.warehousingOutInfo.info.id)
  1065. const idStr = ids.join(',')
  1066. const params = {
  1067. ids: idStr
  1068. }
  1069. this.$confirm('确认删除出库单?', '删除出库单记录', {
  1070. confirmButtonText: '确定',
  1071. cancelButtonText: '取消',
  1072. type: 'warning'
  1073. }).then(() => {
  1074. deleteWarehouseOut(params).then(response => {
  1075. if (response.data.state == 0) {
  1076. this.$message.error(response.data.msg)
  1077. return false
  1078. } else {
  1079. this.$notify({
  1080. title: '成功',
  1081. message: '删除成功',
  1082. type: 'success',
  1083. duration: 2000
  1084. })
  1085. this.$router.back(-1)
  1086. }
  1087. })
  1088. }).catch(() => {
  1089. })
  1090. },
  1091. GetTotalCount(time){
  1092. var params = {
  1093. warehouse_out_time:time
  1094. }
  1095. GetOutStockTotalCount(params).then(response=>{
  1096. if(response.data.state == 1){
  1097. var stockCount = response.data.data.stockCount
  1098. console.log("出库数量2323",stockCount)
  1099. this.stockCount = stockCount
  1100. // this.dialogVisible = true
  1101. }
  1102. })
  1103. },
  1104. getOutStockCount(id){
  1105. var count = 0
  1106. for(let i=0;i<this.stockCount.length;i++){
  1107. if(id == this.stockCount[i].good_id){
  1108. count = this.stockCount[i].count
  1109. }
  1110. }
  1111. return count
  1112. },
  1113. unique(arr) {
  1114. const res = new Map();
  1115. return arr.filter((arr) => !res.has(arr.patient_id) && res.set(arr.patient_id, 1));
  1116. },
  1117. editRecord(id){
  1118. this.warehouseOut= []
  1119. this.recordInfo.recordData = []
  1120. this.GetConfigInfo()
  1121. this.GetOrderDetailTwo(id)
  1122. this.good_type_id = id
  1123. },
  1124. GetOrderDetailTwo(order_id) {
  1125. const params = {
  1126. 'id': order_id
  1127. }
  1128. console.log("触发了222222",order_id)
  1129. getWarehouseOutInfo(params).then(response => {
  1130. if (response.data.state == 0) {
  1131. this.$message.error(response.data.msg)
  1132. return false
  1133. } else {
  1134. for (let i = 0; i < response.data.data.list.length; i++) {
  1135. response.data.data.list[i].price = response.data.data.list[i].price.toString()
  1136. response.data.data.list[i].count = response.data.data.list[i].count.toString()
  1137. this.recordInfo.recordData.push(response.data.data.list[i])
  1138. }
  1139. this.warehouseOut = response.data.data.info
  1140. this.warehouse_out_time = this.getTime(this.warehouseOut.warehouse_out_time, '{y}-{m}-{d}')
  1141. // this.form.manufacturer = this.warehouseOut.manufacturer
  1142. // this.form.dealer = this.warehouseOut.dealer
  1143. this.editDialogVisible = true
  1144. }
  1145. if (this.recordInfo.recordData.length == 0) {
  1146. const tempObj = {}
  1147. tempObj['id'] = 0
  1148. tempObj['good_type_id'] = 0
  1149. tempObj['good_id'] = 0
  1150. tempObj['count'] = ''
  1151. tempObj['price'] = ''
  1152. tempObj['remark'] = ''
  1153. this.recordInfo.recordData.push(tempObj)
  1154. this.editDialogVisible = true
  1155. }
  1156. })
  1157. },
  1158. getTime(val, temp) {
  1159. if (val != 0) {
  1160. return uParseTime(val, temp)
  1161. } else {
  1162. return ''
  1163. }
  1164. },
  1165. changeManufacturer(val) {
  1166. this.propForm.manufacturer = val
  1167. },
  1168. changeDealer(val) {
  1169. this.propForm.dealer = val
  1170. },
  1171. typeName: function(good_type_id) {
  1172. let name = "";
  1173. for (let i = 0; i < this.goodType.length; i++) {
  1174. if (this.goodType[i].id == good_type_id) {
  1175. name = this.goodType[i].type_name;
  1176. }
  1177. }
  1178. return name;
  1179. },
  1180. specificationName: function(good_info_id) {
  1181. let name = "";
  1182. for (let i = 0; i < this.goodInfo.length; i++) {
  1183. if (this.goodInfo[i].id == good_info_id) {
  1184. name = this.goodInfo[i].specification_name;
  1185. }
  1186. }
  1187. return name;
  1188. },
  1189. handleEditOne(){
  1190. const tempObj = {}
  1191. tempObj['id'] = 0
  1192. tempObj['good_type_id'] = 0
  1193. tempObj['good_id'] = 0
  1194. tempObj['count'] = ''
  1195. tempObj['price'] = ''
  1196. tempObj['remark'] = ''
  1197. this.recordInfo.recordData.push(tempObj)
  1198. },
  1199. handleDeleteOne: function(index, row) {
  1200. if (row.id == 0) {
  1201. this.recordInfo.recordData.splice(index, 1)
  1202. } else {
  1203. const params = {
  1204. id: row.id
  1205. }
  1206. this.$confirm('确认删除该出库耗材信息记录?', '删除出库耗材信息记录', {
  1207. confirmButtonText: '确定',
  1208. cancelButtonText: '取消',
  1209. type: 'warning'
  1210. }).then(() => {
  1211. deleteWarehouseOutInfo(params).then(response => {
  1212. if (response.data.state == 0) {
  1213. this.$message.error(response.data.msg)
  1214. return false
  1215. } else {
  1216. this.$message.success('删除成功')
  1217. this.recordInfo.recordData.splice(index, 1)
  1218. }
  1219. })
  1220. }).catch(() => {
  1221. })
  1222. }
  1223. },
  1224. showDialog(index, row) {
  1225. this.currentIndex = index;
  1226. const loading = this.$loading({
  1227. lock: true,
  1228. text: "Loading",
  1229. spinner: "el-icon-loading",
  1230. background: "rgba(0, 0, 0, 0.7)"
  1231. });
  1232. const params = {
  1233. manufacturer_id: this.form.manufacturer,
  1234. dealer_id: this.form.dealer
  1235. };
  1236. this.propForm.goods = []
  1237. GetAllGoodInfoByID(params).then(response => {
  1238. if (response.data.state == 0) {
  1239. this.$message.error(response.data.msg);
  1240. return false;
  1241. } else {
  1242. if (response.data.data.goodInfo.length <= 0) {
  1243. this.$message.error("该厂商或经销商没有物品信息");
  1244. return;
  1245. }
  1246. this.$refs.dialog.show();
  1247. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  1248. this.propForm.goodType.push(
  1249. response.data.data.goodInfo[i].type
  1250. );
  1251. }
  1252. const obj = {};
  1253. this.propForm.goodType = this.propForm.goodType.reduce(
  1254. (cur, next) => {
  1255. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  1256. return cur;
  1257. },
  1258. []
  1259. ); // 设置cur默认类型为数组,并且初始值为空的数组
  1260. }
  1261. for (let i = 0; i < this.propForm.goodType.length; i++) {
  1262. let goodInfo = [];
  1263. let goodObj = {};
  1264. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  1265. var respObj = response.data.data.goodInfo[a];
  1266. respObj["isSelected"] = false;
  1267. if (respObj.type.id == this.propForm.goodType[i].id) {
  1268. goodInfo.push(respObj);
  1269. }
  1270. }
  1271. const obj = {};
  1272. goodInfo = goodInfo.reduce((cur, next) => {
  1273. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  1274. return cur;
  1275. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  1276. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo);
  1277. this.propForm.goods.push(goodObj);
  1278. }
  1279. loading.close();
  1280. });
  1281. },
  1282. comfirm: function(val) {
  1283. this.$refs.dialog.hide();
  1284. this.propForm.goodType = [];
  1285. this.propForm.goods = [];
  1286. if (val.selectedGoodInfo.length > 0) {
  1287. for (let i = val.selectedGoodInfo.length - 1; ; i--) {
  1288. if (i == 0) {
  1289. this.recordInfo.recordData[this.currentIndex].good_type_id =
  1290. val.selectedGoodInfo[i].good_type_id;
  1291. this.recordInfo.recordData[this.currentIndex].good_id =
  1292. val.selectedGoodInfo[i].id;
  1293. this.recordInfo.recordData[
  1294. this.currentIndex
  1295. ].price = val.selectedGoodInfo[i].buy_price.toString();
  1296. } else {
  1297. const tempForm = {};
  1298. tempForm["id"] = 0;
  1299. tempForm["good_type_id"] = val.selectedGoodInfo[i].good_type_id;
  1300. tempForm["good_id"] = val.selectedGoodInfo[i].id;
  1301. tempForm["count"] = "";
  1302. tempForm["price"] = val.selectedGoodInfo[i].buy_price.toString();
  1303. tempForm["remark"] = "";
  1304. this.recordInfo.recordData.splice(
  1305. this.currentIndex + 1,
  1306. 0,
  1307. tempForm
  1308. );
  1309. }
  1310. }
  1311. }
  1312. this.currentIndex = -1;
  1313. },
  1314. cancle: function() {
  1315. this.$refs.dialog.hide()
  1316. this.propForm.goods = [];
  1317. this.propForm.goodType = [];
  1318. },
  1319. submit() {
  1320. this.$refs['tableForm'].validate((valid) => {
  1321. if (valid) {
  1322. const array = this.recordInfo.recordData
  1323. console.log("$arr3333333333",array)
  1324. for (let i = 0; i < array.length; i++) {
  1325. if (array[i].good_type_id == 0) {
  1326. this.$message.error('商品类型不能为空')
  1327. return
  1328. }
  1329. if (array[i].good_id == 0) {
  1330. this.$message.error('规格名称不能为空')
  1331. return
  1332. }
  1333. }
  1334. const params = {
  1335. 'stockOut': this.recordInfo.recordData
  1336. }
  1337. editWarehouseoutInfo(params, this.warehouse_out_time,this.good_type_id, 1, this.form.manufacturer, this.form.dealer).then(response => {
  1338. if (response.data.state == 0) {
  1339. this.$message.error(response.data.msg)
  1340. return false
  1341. } else {
  1342. this.$message.success('保存成功')
  1343. this.editDialogVisible = false
  1344. this.warehousingOutInfo.info = []
  1345. this.warehousingOutInfo.warehousingOutData = []
  1346. this.GetOrderDetailOne(this.good_type_id)
  1347. }
  1348. })
  1349. } else {
  1350. return false
  1351. }
  1352. })
  1353. },
  1354. GetOrderDetailById(val){
  1355. console.log("val",val)
  1356. this.userList =[]
  1357. var params = {
  1358. id:val.warehouse_out_id,
  1359. good_id:val.good_id,
  1360. record_time:val.sys_record_time,
  1361. }
  1362. getOrderDetailById(params).then(response=>{
  1363. if(response.data.state == 1){
  1364. var total = 0
  1365. var list = response.data.data.list
  1366. var arrList = this.unique(list)
  1367. var info = response.data.data.info
  1368. this.infoList = info
  1369. console.log("info列表22222222",info)
  1370. var stockflowlist = response.data.data.stockFlowList
  1371. console.log("stockflowlist",stockflowlist)
  1372. this.stockFlowList = stockflowlist
  1373. for (let i = 0; i < this.stockFlowList.length; i++) {
  1374. var obj = this.stockFlowList[i]
  1375. obj['is_total'] = 0
  1376. this.userList.push(obj)
  1377. total = total + this.stockFlowList[i].count
  1378. }
  1379. this.userList.push({
  1380. is_total: 1,
  1381. total: total,
  1382. })
  1383. console.log("详情数据区",this.userList)
  1384. if(val.is_sys == 1){
  1385. this.editdialogVisibleThree = true
  1386. }
  1387. if(val.is_sys == 0){
  1388. this.editdialogVisibleTwo = true
  1389. }
  1390. }
  1391. })
  1392. },
  1393. getNumber(id){
  1394. var str = ""
  1395. var arr = []
  1396. var ids = []
  1397. for(let i=0;i<this.userList.length;i++){
  1398. if(id == this.userList[i].id){
  1399. arr.push(...this.userList[i].warehouseOutInfo)
  1400. }
  1401. }
  1402. console.log("arr",arr)
  1403. if(arr.length > 0){
  1404. for(let i=0;i<arr.length;i++){
  1405. ids.push(arr[i].number)
  1406. }
  1407. }
  1408. str = ids.join(",")
  1409. return str
  1410. },
  1411. toPrint(){
  1412. if(this.order_id == ""){
  1413. this.$message.error("请选择出库单")
  1414. }else{
  1415. 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})
  1416. }
  1417. },
  1418. getlist(){
  1419. var params = {
  1420. 'id': this.order_id,
  1421. "start_time":this.start_time,
  1422. "end_time":this.end_time,
  1423. }
  1424. console.log('parasm22',params)
  1425. getOutExportList(params).then(response=>{
  1426. if(response.data.state == 1){
  1427. var list = response.data.data.list
  1428. var outCount = response.data.data.outCount
  1429. console.log("outCount",outCount)
  1430. for(let i=0;i<list.length;i++){
  1431. list[i].unit = list[i].specification_name +"/" + list[i].packing_unit
  1432. list[i].total_price = (list[i].total_count * list[i].price).toFixed(2)
  1433. list[i].expiry_date = this.getTime(list[i].expiry_date,"{y}-{m}-{d}")
  1434. list[i].product_date = this.getTime(list[i].product_date,"{y}-{m}-{d}")
  1435. for(let j=0;j<this.manufacturer.length;j++){
  1436. if(list[i].manufacturer == this.manufacturer[j].id){
  1437. list[i].manufacturer = this.manufacturer[j].manufacturer_name
  1438. }
  1439. }
  1440. for(let z=0;z<this.dealer.length;z++){
  1441. if(list[i].dealer == this.dealer[z].id){
  1442. list[i].dealer = this.dealer[z].dealer_name
  1443. }
  1444. }
  1445. for(let a=0;a<this.goodType.length;a++){
  1446. if(list[i].good_type_id == this.goodType[a].id){
  1447. list[i].good_type_id = this.goodType[a].type_name
  1448. }
  1449. }
  1450. }
  1451. console.log("导出list222222",list)
  1452. this.exportList = list
  1453. }
  1454. })
  1455. },
  1456. toExport(){
  1457. if(this.order_id == ""){
  1458. this.$message.error("请勾选出库单")
  1459. return
  1460. }
  1461. import('@/vendor/Export2Excel').then(excel => {
  1462. console.log("23232323",this.exportList)
  1463. for(let i=0;i<this.exportList.length;i++){
  1464. this.exportList[i].total_price = this.exportList[i].count * this.exportList[i].price
  1465. for(let j=0;j<this.goodType.length;j++){
  1466. if(this.exportList[i].good_type_id == this.goodType[j].id){
  1467. this.exportList[i].good_type_id = this.goodType[j].type_name
  1468. }
  1469. }
  1470. if(this.exportList[i].dealer == 0){
  1471. this.exportList[i].dealer = ""
  1472. }
  1473. if(this.exportList[i].manufacturer == 0){
  1474. this.exportList[i].manufacturer = ""
  1475. }
  1476. if(this.exportList[i].good_type_id == 0){
  1477. this.exportList[i].good_type_id = ""
  1478. }
  1479. }
  1480. console.log("hhhh323223",this.goodType)
  1481. const tHeader = ['耗材名称', '耗材类型', '规格&单位','出库数量','出货价','总价','生产厂商','经销商','生产日期','有效期','备注']
  1482. const filterVal = ['good_name', 'good_type_id', 'unit','count','price','total_price','manufacturer','dealer','product_date','expiry_date','remark']
  1483. console.log("table",this.exportList)
  1484. const data = this.formatJson(filterVal, this.exportList)
  1485. excel.export_json_to_excel({
  1486. header: tHeader,
  1487. data,
  1488. filename: '耗材出库单详情'
  1489. })
  1490. this.downloadLoading = false
  1491. })
  1492. },
  1493. formatJson(filterVal, jsonData) {
  1494. return jsonData.map(v => filterVal.map(j => v[j]));
  1495. },
  1496. unique(arr) {
  1497. let newArr = [arr[0]];
  1498. for (let i = 1; i < arr.length; i++) {
  1499. let repeat = false;
  1500. for (let j = 0; j < newArr.length; j++) {
  1501. if (arr[i] === newArr[j]) {
  1502. repeat = true;
  1503. break;
  1504. }else{
  1505. }
  1506. }
  1507. if (!repeat) {
  1508. newArr.push(arr[i]);
  1509. }
  1510. }
  1511. return newArr;
  1512. },
  1513. getBatchNumber(patient_id,good_id){
  1514. var arr = []
  1515. for(let i=0;i<this.stockFlowList.length;i++){
  1516. if(patient_id == this.stockFlowList[i].patient_id && good_id == this.stockFlowList[i].good_id){
  1517. arr.push(this.stockFlowList[i].number)
  1518. }
  1519. }
  1520. arr = this.unique(arr)
  1521. return arr.join(',')
  1522. }
  1523. }
  1524. };
  1525. </script>
  1526. <style rel="stylesheet/scss" lang="scss">
  1527. .app-container {
  1528. // margin: 20px;
  1529. font-size: 15px;
  1530. .filter-container {
  1531. padding-bottom: 5px;
  1532. }
  1533. .search-component {
  1534. width: 500px;
  1535. .searchBox {
  1536. width: 300px;
  1537. height: 36px;
  1538. line-height: 36px;
  1539. padding-left: 15px;
  1540. border: 1px #dcdfe6 solid;
  1541. border-right: none;
  1542. outline: none;
  1543. float: left;
  1544. border-radius: 6px 0 0 6px;
  1545. font-size: 14px;
  1546. color: #333;
  1547. background: #fff;
  1548. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  1549. }
  1550. .searchBtn {
  1551. background-color: #409eff;
  1552. color: #fff;
  1553. font-size: 15px;
  1554. text-align: center;
  1555. height: 36px;
  1556. line-height: 36px;
  1557. float: left;
  1558. outline: none;
  1559. width: 70px;
  1560. border: none;
  1561. border-radius: 0 6px 6px 0;
  1562. font-family: "Microsoft Yahei";
  1563. cursor: pointer;
  1564. }
  1565. }
  1566. .amount {
  1567. font-weight: normal;
  1568. padding: 10px 0 0 0;
  1569. color: #606266;
  1570. font-size: 14px;
  1571. span {
  1572. color: #ef2525;
  1573. font-family: "Arial";
  1574. padding: 0 2px;
  1575. }
  1576. }
  1577. }
  1578. .el-table td,
  1579. .el-table th.is-leaf,
  1580. .el-table--border,
  1581. .el-table--group {
  1582. border-color: #d0d3da;
  1583. }
  1584. .el-table--border::after,
  1585. .el-table--group::after,
  1586. .el-table::before {
  1587. background-color: #d0d3da;
  1588. }
  1589. </style>