drugStockOutOrder.vue 80KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577
  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. <label class="title"><span class="name">仓库</span> :</label>
  18. <el-select
  19. size="small"
  20. v-model="storehouse_id"
  21. filterable
  22. placeholder="请选择仓库"
  23. style="width: 200px"
  24. @change="changeStoreHouse"
  25. >
  26. <el-option
  27. v-for="(option, index) in houseList"
  28. :key="index"
  29. :label="option.storehouse_name"
  30. :value="option.id"
  31. >
  32. </el-option>
  33. </el-select>
  34. <el-input
  35. size="small"
  36. style="width: 200px"
  37. class="filter-item"
  38. v-model.trim="searchKey"
  39. placeholder="单据编码/制单人/厂商"
  40. />
  41. <el-button
  42. size="small"
  43. class="filter-item"
  44. type="primary"
  45. icon="el-icon-search"
  46. @click="search"
  47. >搜索</el-button
  48. >
  49. <div style="margin-left: 10px">
  50. <label class="title"><span class="name">出库时间</span> : </label>
  51. <el-date-picker
  52. size="small"
  53. v-model="start_time"
  54. prefix-icon="el-icon-date"
  55. :editable="false"
  56. style="width: 196px"
  57. type="date"
  58. placeholder="选择日期时间"
  59. align="right"
  60. format="yyyy-MM-dd"
  61. value-format="yyyy-MM-dd"
  62. @change="startTimeChange"
  63. ></el-date-picker>
  64. <span class="cellLine"> - </span>
  65. <el-date-picker
  66. size="small"
  67. v-model="end_time"
  68. prefix-icon="el-icon-date"
  69. :editable="false"
  70. style="width: 196px"
  71. type="date"
  72. placeholder="选择日期时间"
  73. align="right"
  74. format="yyyy-MM-dd"
  75. value-format="yyyy-MM-dd"
  76. @change="endTimeChange"
  77. ></el-date-picker>
  78. </div>
  79. <!-- <div style="margin-left: 10px">
  80. <span>审核状态:</span>
  81. <el-select
  82. v-model="check_id"
  83. style="width: 140px; margin-right: 10px"
  84. placeholder="请选择"
  85. @change="changeTypeName"
  86. >
  87. <el-option
  88. v-for="item in checkList"
  89. :key="item.id"
  90. :label="item.name"
  91. :value="item.id"
  92. >
  93. </el-option>
  94. </el-select>
  95. </div> -->
  96. </div>
  97. <div class="cell clearfix">
  98. <el-checkbox
  99. style="width: 70px"
  100. v-model="checked"
  101. @change="changeAllSelected"
  102. >全选</el-checkbox
  103. >
  104. <el-button size="small" icon="el-icon-delete" @click="batchDelete"
  105. >删除</el-button
  106. >
  107. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  108. <el-button size="small" type="primary" @click="toExport" :disabled="exportLoding">导出</el-button>
  109. <span>&nbsp;&nbsp;</span>
  110. <label class="title"><span class="name">出库方式</span> :</label>
  111. <el-select size="small" v-model="way_type" filterable placeholder="请选择仓库" style="width:200px" @change="changeWay">
  112. <el-option
  113. v-for="(option, index) in wayList"
  114. :key="index"
  115. :label="option.name"
  116. :value="option.id">
  117. </el-option>
  118. </el-select>
  119. <span>&nbsp;&nbsp;</span>
  120. <label class="title"><span class="name">审核状态</span> :</label>
  121. <el-select size="small" v-model="check_type" filterable placeholder="请选择仓库" style="width:200px" @change="changeCheckType">
  122. <el-option
  123. v-for="(option, index) in checkList"
  124. :key="index"
  125. :label="option.name"
  126. :value="option.id">
  127. </el-option>
  128. </el-select>
  129. </div>
  130. <el-table
  131. @current-change="handleSearch"
  132. :data="warehouseOutDate"
  133. :class="signAndWeighBoxPatients"
  134. style="width: 100%"
  135. border
  136. highlight-current-row
  137. ref="multipleTable"
  138. @selection-change="select"
  139. :row-style="{ color: '#303133' }"
  140. :header-cell-style="{
  141. backgroundColor: 'rgb(245, 247, 250)',
  142. color: '#606266',
  143. }"
  144. >
  145. <el-table-column type="selection" width="55" align="center">
  146. </el-table-column>
  147. <el-table-column label="单据日期" align="center">
  148. <template slot-scope="scope">
  149. {{ scope.row.warehouse_out_time | parseTime("{y}-{m}-{d}") }}
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="单据编号" align="center">
  153. <template slot-scope="scope">
  154. {{ scope.row.warehouse_out_order_number }}
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="仓库名称" align="center">
  158. <template slot-scope="scope">
  159. {{ getHouseName(scope.row.storehouse_id) }}
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="制单人" align="center">
  163. <template slot-scope="scope">
  164. {{ getXuserName(scope.row.creater) }}
  165. </template>
  166. </el-table-column>
  167. <el-table-column min-width="40" align="center">
  168. <template slot="header" slot-scope="scope">
  169. <span>出库方式</span>
  170. </template>
  171. <template slot-scope="scope">
  172. <span v-if="scope.row.is_sys == 1">{{ "自动出库" }}</span>
  173. <span v-if="scope.row.is_sys == 0">{{ "手动出库" }}</span>
  174. <span v-if="scope.row.is_sys == 12">{{ "调拨出库" }}</span>
  175. <span v-if="scope.row.is_sys == 5">{{ "结算出库" }}</span>
  176. </template>
  177. </el-table-column>
  178. <el-table-column min-width="40" align="center">
  179. <template slot="header" slot-scope="scope">
  180. <span>审核状态</span>
  181. </template>
  182. <template slot-scope="scope">
  183. <span v-if="scope.row.is_check == 1">已审核</span>
  184. <span v-if="scope.row.is_check == 2">未审核</span>
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="操作" align="center" width="240">
  188. <template slot-scope="scope">
  189. <el-tooltip
  190. class="item"
  191. effect="dark"
  192. content="编辑"
  193. placement="top"
  194. >
  195. <el-button
  196. size="mini"
  197. type="primary"
  198. icon="el-icon-edit-outline"
  199. @click="handleEdit(scope.$index, scope.row)"
  200. >
  201. </el-button>
  202. </el-tooltip>
  203. <el-tooltip
  204. class="item"
  205. effect="dark"
  206. content="删除"
  207. placement="top"
  208. >
  209. <el-button
  210. size="mini"
  211. type="danger"
  212. :disabled="scope.row.is_sys == 1"
  213. icon="el-icon-delete"
  214. @click="handleDelete(scope.$index, scope.row)"
  215. >
  216. </el-button>
  217. </el-tooltip>
  218. </template>
  219. </el-table-column>
  220. </el-table>
  221. <el-pagination
  222. @size-change="handleSizeChange"
  223. @current-change="handleCurrentChange"
  224. :page-sizes="[5, 10, 50, 100]"
  225. :page-size="5"
  226. background
  227. style="margin-top: 20px; text-align: right"
  228. layout="total, sizes, prev, pager, next, jumper"
  229. :total="total"
  230. >
  231. </el-pagination>
  232. <!-- 使用详情 -->
  233. <div v-show="tableShow" style="margin-top: 10px">
  234. <el-table
  235. :data="tableList"
  236. :class="signAndWeighBoxPatients"
  237. style="width: 100%"
  238. border
  239. highlight-current-row
  240. ref="multipleTableOne"
  241. @selection-change="select"
  242. :row-style="{ color: '#303133' }"
  243. :header-cell-style="{
  244. backgroundColor: 'rgb(245, 247, 250)',
  245. color: '#606266',
  246. }"
  247. :cell-class-name="cellStyle"
  248. >
  249. <el-table-column label="药品名称" align="center">
  250. <template slot-scope="scope">
  251. {{ scope.row.drug_name }}
  252. </template>
  253. </el-table-column>
  254. <el-table-column label="药品类型" align="center">
  255. <template slot-scope="scope">
  256. {{ getDrugType(scope.row.drug_type) }}
  257. </template>
  258. </el-table-column>
  259. <el-table-column label="规格&单位" align="center">
  260. <template slot-scope="scope">
  261. {{ scope.row.dose }}&nbsp;{{ scope.row.dose_unit }}*{{
  262. scope.row.min_number
  263. }}{{ scope.row.min_unit }}/{{ scope.row.max_unit }}
  264. </template>
  265. </el-table-column>
  266. <el-table-column label="国家编码" align="center">
  267. <template slot-scope="scope">
  268. {{ scope.row.medical_insurance_number }}
  269. </template>
  270. </el-table-column>
  271. <!-- <el-table-column label="仓库名称" align="center">
  272. <template slot-scope="scope">
  273. {{ getHouseName(scope.row.storehouse_id) }}
  274. </template>
  275. </el-table-column> -->
  276. <el-table-column label="仓库名称" align="center">
  277. <template slot-scope="scope">
  278. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  279. <td style="border-right: none; border-inline-end:none;text-align: center">
  280. {{ getHouseName(item.storehouse_id) }}
  281. </td>
  282. </tr>
  283. </template>
  284. </el-table-column>
  285. <el-table-column label="出库数量" align="center">
  286. <template slot-scope="scope">
  287. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  288. <td style="border-right: none; border-inline-end:none;text-align: center">
  289. <span v-if="is_sys==1 || is_sys == 5">{{getOutCountSix(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,scope.row.drug_id)}}</span>
  290. <span v-if="is_sys == 12">{{getOutCountTen(item.count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  291. <span v-if="is_sys == 0"> {{getOutCountOne(item.batch_number,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,scope.row.drug_id)}} </span>
  292. </td>
  293. </tr>
  294. </template>
  295. </el-table-column>
  296. <el-table-column label="批次" align="center">
  297. <template slot-scope="scope">
  298. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  299. <td style="border-right: none; border-inline-end:none;text-align: center">
  300. <span v-if="is_sys == 1 || is_sys == 5">
  301. {{getBatchNumber(item.warehousing_detail_id)}}
  302. </span>
  303. <span v-if="is_sys == 12">{{getBatchNumber(item.warehousing_detail_id)}}</span>
  304. <span v-if="is_sys == 0">{{getBatchNumberOne(item.batch_number)}}</span>
  305. </td>
  306. </tr>
  307. </template>
  308. </el-table-column>
  309. <el-table-column label="出库对象" align="center" v-if="is_sys == 0">
  310. <template slot-scope="scope">
  311. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  312. <td style="border-right: none; border-inline-end: none;text-align: center">
  313. {{getXuserName(scope.row.admin_user_id)}}
  314. </td>
  315. </tr>
  316. </template>
  317. </el-table-column>
  318. <el-table-column label="使用患者" align="center" v-if="is_sys == 0">
  319. <template slot-scope="scope">
  320. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  321. <td style="border-right: none; border-inline-end: none;text-align: center">
  322. {{getPatientName(item.patient_id)}}
  323. </td>
  324. </tr>
  325. </template>
  326. </el-table-column>
  327. <el-table-column label="单价" align="center">
  328. <template slot-scope="scope">
  329. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  330. <td style="border-right: none; border-inline-end: none;text-align: center">
  331. <span v-if="org_id!=10480 && org_id!=10210&&org_id!=10188 && org_id!=10217">
  332. <span v-if="is_sys == 1 || is_sys == 5 || is_sys == 12">{{getPrice(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  333. <span v-if="is_sys == 0">
  334. <span v-if="scope.row.child.length == 1">
  335. {{getPriceTwo(item.warehouse_out_id,item.drug_id)}}
  336. </span>
  337. <span v-if="scope.row.child.length > 1">
  338. {{item.price}}
  339. </span>
  340. </span>
  341. </span>
  342. <span v-if="org_id ==10480 || org_id==10210 || org_id ==10188 || org_id ==10217">
  343. {{ scope.row.min_price }}
  344. </span>
  345. </td>
  346. </tr>
  347. </template>
  348. </el-table-column>
  349. <el-table-column label="总价" align="center">
  350. <template slot-scope="scope">
  351. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  352. <td style="border-right: none; border-inline-end: none;text-align: center">
  353. <span v-if="org_id!=10480 && org_id!=10210&&org_id!=10188 && org_id!=10217">
  354. <span v-if="is_sys == 1 || is_sys == 5 || is_sys == 12">{{getTotalPrice(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}} </span>
  355. <span v-if="is_sys == 0">
  356. <span v-if="scope.row.child.length == 1">{{item.count * item.retail_price}} </span>
  357. <span v-if="scope.row.child.length > 1">{{item.count * item.price}} </span>
  358. </span>
  359. </span>
  360. <span v-if="org_id ==10480 || org_id==10210 || org_id ==10188 || org_id ==10217">
  361. <!-- {{(item.count * item.price).toFixed(2)}} -->
  362. <span v-if="is_sys == 1 || is_sys == 5 || is_sys == 12">{{(getOutCountNightTen(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,scope.row.drug_id)*scope.row.min_price).toFixed(2)}}</span>
  363. <span v-if="is_sys==0"> {{(getOutCountNightTenOne(item.batch_number,scope.row.max_unit,scope.row.min_unit,scope.row.min_number,scope.row.drug_id)*item.price).toFixed(2)}}</span>
  364. </span>
  365. </td>
  366. </tr>
  367. </template>
  368. </el-table-column>
  369. <el-table-column label="生产厂家" align="center">
  370. <template slot-scope="scope">
  371. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  372. <td style="border-right: none; border-inline-end: none;text-align: center">
  373. <span v-if="is_sys == 1 || is_sys == 5 || is_sys == 12"> {{getAllManufacturerName(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  374. <span v-if="is_sys == 0"> {{getManufacturerName(scope.row.manufacturer)}}</span>
  375. </td>
  376. </tr>
  377. </template>
  378. </el-table-column>
  379. <el-table-column label="生产日期" align="center">
  380. <template slot-scope="scope">
  381. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  382. <td style="border-right: none; border-inline-end: none;text-align: center">
  383. <span v-if="is_sys == 1 || is_sys == 5 || is_sys == 12"> {{getProductDate(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  384. <span v-if="is_sys == 0"> {{getTime(scope.row.product_date)}}</span>
  385. </td>
  386. </tr>
  387. </template>
  388. </el-table-column>
  389. <el-table-column label="有效日期" align="center">
  390. <template slot-scope="scope">
  391. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  392. <td style="border-right: none; border-inline-end: none;text-align: center">
  393. <span v-if="is_sys == 1 || is_sys == 5 || is_sys == 12"> {{getExpiryDate(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  394. <span v-if="is_sys == 0"> {{getTime(scope.row.expiry_date)}}</span>
  395. </td>
  396. </tr>
  397. </template>
  398. </el-table-column>
  399. <el-table-column label="经销商" align="center">
  400. <template slot-scope="scope">
  401. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  402. <td style="border-right: none; border-inline-end: none;text-align: center">
  403. <span v-if="is_sys ==1 || is_sys ==5 || is_sys ==12">{{getDealer(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  404. <span v-if="is_sys ==0">{{getDealerName(scope.row.dealer)}}</span>
  405. </td>
  406. </tr>
  407. </template>
  408. </el-table-column>
  409. <el-table-column label="批准文号" align="center">
  410. <template slot-scope="scope">
  411. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  412. <td style="border-right: none; border-inline-end: none;text-align: center">
  413. <span v-if="is_sys == 1 || is_sys == 5 || is_sys == 12">{{getNumber(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  414. <span v-if="is_sys == 0">{{scope.row.number}}</span>
  415. </td>
  416. </tr>
  417. </template>
  418. </el-table-column>
  419. <el-table-column label="备注" align="center">
  420. <template slot-scope="scope">
  421. <tr style="background: none" v-for="(item,index) in scope.row.child" :key="index">
  422. <td style="border-right: none; border-inline-end: none;text-align: center">
  423. <span v-if="is_sys == 1 || is_sys == 5 || is_sys == 12">{{getRemark(item.warehousing_detail_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
  424. <span v-if="is_sys == 0">{{scope.row.remark}}</span>
  425. </td>
  426. </tr>
  427. </template>
  428. </el-table-column>
  429. <el-table-column label="操作" align="center">
  430. <template slot-scope="scope">
  431. <span style="color: #589ff8" @click="toDetail(scope.row)"
  432. >使用明细</span
  433. >
  434. </template>
  435. </el-table-column>
  436. <el-table-column label="自查自检" align="center">
  437. <template slot-scope="scope">
  438. <span style="color: #589ff8" @click="getDrugPatientName(scope.row)"
  439. >自查</span
  440. >
  441. </template>
  442. </el-table-column>
  443. </el-table>
  444. </div>
  445. </div>
  446. <el-dialog title="提示" :visible.sync="drugDialogVisible" width="90%">
  447. <span>
  448. <el-table
  449. :data="userList"
  450. :class="signAndWeighBoxPatients"
  451. style="width: 50%"
  452. border
  453. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  454. >
  455. <el-table-column min-width="35" align="center">
  456. <template slot="header" slot-scope="scope">
  457. <span>序号</span>
  458. </template>
  459. <template slot-scope="scope">
  460. {{ scope.$index + 1 }}
  461. </template>
  462. </el-table-column>
  463. <el-table-column min-width="35" align="center">
  464. <template slot="header" slot-scope="scope">
  465. <span>使用人</span>
  466. </template>
  467. <template slot-scope="scope">
  468. {{ scope.row.user.name }}
  469. </template>
  470. </el-table-column>
  471. <el-table-column min-width="35" align="center">
  472. <template slot="header" slot-scope="scope">
  473. <span>使用数量</span>
  474. </template>
  475. <template slot-scope="scope">
  476. <span>{{ scope.row.count }}{{ scope.row.count_unit }}</span>
  477. </template>
  478. </el-table-column>
  479. <el-table-column min-width="35" align="center">
  480. <template slot="header" slot-scope="scope">
  481. <span>使用时间</span>
  482. </template>
  483. <template slot-scope="scope">
  484. <span
  485. >{{ scope.row.ctime | parseTime("{y}-{m}-{d}") }}
  486. </span>
  487. </template>
  488. </el-table-column>
  489. </el-table>
  490. </span>
  491. <span slot="footer" class="dialog-footer">
  492. <el-button @click="drugDialogVisible = false">取 消</el-button>
  493. <el-button type="primary" @click="drugDialogVisible = false"
  494. >确 定</el-button
  495. >
  496. </span>
  497. </el-dialog>
  498. <el-dialog title="提示" :visible.sync="drugDialogVisibleTwo" width="90%">
  499. <span>
  500. <el-table
  501. :data="userListOne"
  502. :class="signAndWeighBoxPatients"
  503. style="width: 50%"
  504. border
  505. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  506. >
  507. <el-table-column min-width="35" align="center">
  508. <template slot="header" slot-scope="scope">
  509. <span>序号</span>
  510. </template>
  511. <template slot-scope="scope">
  512. {{ scope.$index + 1 }}
  513. </template>
  514. </el-table-column>
  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>系统</span>
  521. </template>
  522. </el-table-column>
  523. <el-table-column min-width="35" align="center">
  524. <template slot="header" slot-scope="scope">
  525. <span>使用数量</span>
  526. </template>
  527. <template slot-scope="scope">
  528. {{ scope.row.count }}{{ scope.row.count_unit }}
  529. </template>
  530. </el-table-column>
  531. <el-table-column min-width="35" align="center">
  532. <template slot="header" slot-scope="scope">
  533. <span>使用时间</span>
  534. </template>
  535. <template slot-scope="scope">
  536. <span
  537. >{{ scope.row.ctime | parseTime("{y}-{m}-{d}") }}
  538. </span>
  539. </template>
  540. </el-table-column>
  541. </el-table>
  542. </span>
  543. <span slot="footer" class="dialog-footer">
  544. <el-button @click="drugDialogVisibleTwo = false">取 消</el-button>
  545. <el-button type="primary" @click="drugDialogVisibleTwo = false"
  546. >确 定</el-button
  547. >
  548. </span>
  549. </el-dialog>
  550. <el-dialog
  551. title="详细"
  552. :visible.sync="AdviceDialogVisible"
  553. width="40%">
  554. <span>
  555. <el-table
  556. :data="adviceList"
  557. border
  558. style="width: 100%">
  559. <el-table-column prop="date" label="序号" width="100" align="center">
  560. <template slot-scope="scope">
  561. {{scope.$index + 1}}
  562. </template>
  563. </el-table-column>
  564. <el-table-column prop="date" label="患者姓名" width="100" align="center">
  565. <template slot-scope="scope">
  566. {{getPatientNameOne(scope.row.patient_id)}}
  567. </template>
  568. </el-table-column>
  569. <el-table-column prop="name" label="医嘱数量" width="180" align="center">
  570. <template slot-scope="scope">
  571. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  572. </template>
  573. </el-table-column>
  574. <el-table-column prop="address" label="出库数量" align="center">
  575. <template slot-scope="scope">
  576. {{getDrugOutCount(scope.row.patient_id)}}
  577. </template>
  578. </el-table-column>
  579. </el-table>
  580. </span>
  581. <span slot="footer" class="dialog-footer">
  582. <el-button @click="AdviceDialogVisible = false">取 消</el-button>
  583. <el-button type="primary" @click="AdviceDialogVisible = false">确 定</el-button>
  584. </span>
  585. </el-dialog>
  586. </div>
  587. </template>
  588. <script>
  589. import { uParseTime } from "@/utils/tools";
  590. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  591. import {
  592. deleteDrugWarehouseOut,
  593. GetAllConfig,
  594. getDrugWarehouseOutList,
  595. getDrugWarehouseOutUser,
  596. getDrugAutoMaticList,
  597. getSinleOrderDetail,
  598. getAutoDrugDetail,
  599. getDrugCountList,
  600. getExportOutOrderDrugList,
  601. getDrugPatientName
  602. } from "@/api/drug/drug_stock";
  603. import BreadCrumb from "../../components/bread-crumb";
  604. import { getInitializtion } from "@/api/stock";
  605. export default {
  606. name: "salesReturnOrder",
  607. components: { BreadCrumb },
  608. created() {
  609. if (this.$route.path == "/Pharmacy/drugs/stock/out") {
  610. this.crumbs = [
  611. { path: false, name: "药品管理" },
  612. { path: "/stock/drugs/stock/query", name: "出库单·" },
  613. ];
  614. }
  615. this.org_id = this.$store.getters.xt_user.org.id;
  616. var nowDate = new Date();
  617. var nowYear = nowDate.getFullYear();
  618. var nowMonth = nowDate.getMonth() + 1;
  619. var nowDay = nowDate.getDate();
  620. this.end_time =
  621. nowYear +
  622. "-" +
  623. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  624. "-" +
  625. (nowDay < 10 ? "0" + nowDay : nowDay);
  626. nowDate.setMonth(nowDate.getMonth() - 1);
  627. nowYear = nowDate.getFullYear();
  628. nowMonth = nowDate.getMonth() + 1;
  629. nowDay = nowDate.getDate();
  630. this.start_time =
  631. nowYear +
  632. "-" +
  633. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  634. "-" +
  635. (nowDay < 10 ? "0" + nowDay : nowDay);
  636. this.GetWarehouseOut();
  637. this.fetchAllAdminUsers();
  638. this.getDrugCountList();
  639. this.getInitializtion();
  640. },
  641. data() {
  642. return {
  643. searchKey: "",
  644. crumbs: [
  645. { path: false, name: "库存管理" },
  646. { path: false, name: "出库单" },
  647. ],
  648. page: 1,
  649. limit: 5,
  650. check_id: 0,
  651. checked: false,
  652. total: 0,
  653. pageTotal: 0,
  654. pageSelect: 0,
  655. adminUserOptions: [],
  656. multipleSelection: [],
  657. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  658. start_time: "",
  659. warehouseOutDate: [],
  660. end_time: "",
  661. goodType: [],
  662. goodInfo: [],
  663. manufacturer: [],
  664. selectedTableData: [],
  665. dealer: [],
  666. type: 1,
  667. dialogVisible: false,
  668. dialogVisibleTwo: false,
  669. warehousingOutInfo: {
  670. loading: false,
  671. warehousingOutData: [],
  672. info: {},
  673. },
  674. userList: [],
  675. list: [],
  676. drugConfig: {},
  677. drugList: [],
  678. tableList: [],
  679. drugTypeList: [],
  680. tableShow: false,
  681. manufacturerList: [],
  682. drugDialogVisible: false,
  683. drugDialogVisibleTwo: false,
  684. order_id: 0,
  685. dealerList: [],
  686. countList: [],
  687. outCountList: [],
  688. autoCountList: [],
  689. keyword: "",
  690. drug_type: 0,
  691. minCount: [],
  692. drugOutList: [],
  693. outList: [],
  694. userListOne: [],
  695. exportList: [],
  696. batchNumberList: [],
  697. drugFlowList: [],
  698. houseList: [],
  699. storehouse_id: 0,
  700. is_sys: 0,
  701. org_id: 0,
  702. way_type: 0,
  703. wayList: [
  704. { id: 0, name: "全部" },
  705. { id: 1, name: "手动出库" },
  706. { id: 2, name: "自动出库" },
  707. { id: 3, name: "调拨出库" },
  708. { id: 4, name: "结算出库" },
  709. ],
  710. check_type:0,
  711. checkList:[
  712. {id:0,name:"全部"},
  713. {id:1,name:"已审核"},
  714. {id:2,name:"未审核"},
  715. ],
  716. tabList:[],
  717. tabListOne:[],
  718. drugOutInfo:[],
  719. warehouseOutList:[],
  720. exportLoding:false,
  721. outInfoList:[],
  722. patients:[],
  723. AdviceDialogVisible:false,
  724. adviceList:[],
  725. outList:[],
  726. patientList:[],
  727. };
  728. },
  729. methods: {
  730. changeTypeName() {
  731. this.getlist();
  732. },
  733. getlist() {
  734. var params = {
  735. check_id: this.check_id,
  736. start_time: this.start_time,
  737. end_time: this.end_time,
  738. keyword: this.keywords,
  739. page: this.page,
  740. limit: this.limit,
  741. };
  742. getAllSecondOrderList(params).then((response) => {
  743. if (response.data.state == 1) {
  744. var list = response.data.data.list;
  745. this.tableList = list;
  746. var total = response.data.data.total;
  747. this.total = total;
  748. this.houseList = response.data.data.houseList;
  749. this.doctorList = response.data.data.doctorList;
  750. }
  751. });
  752. },
  753. search: function () {
  754. const Params = {
  755. page: this.page,
  756. limit: this.limit,
  757. start_time: this.start_time,
  758. end_time: this.end_time,
  759. type: this.type,
  760. keywords: this.searchKey,
  761. storehouse_id: this.storehouse_id,
  762. way_type: this.way_type,
  763. check_type:this.check_type,
  764. };
  765. this.warehouseOutDate = [];
  766. getDrugWarehouseOutList(Params).then((response) => {
  767. if (response.data.state == 0) {
  768. this.$message.error(response.data.msg);
  769. return false;
  770. } else {
  771. this.total = response.data.data.total;
  772. for (let i = 0; i < response.data.data.list.length; i++) {
  773. this.warehouseOutDate.push(response.data.data.list[i]);
  774. }
  775. var obj = { id: 0, storehouse_name: "全部" };
  776. this.houseList = [];
  777. this.houseList.push(obj);
  778. for (let i = 0; i < response.data.data.houseList.length; i++) {
  779. this.houseList.push(response.data.data.houseList[i]);
  780. }
  781. }
  782. });
  783. },
  784. AddNewOrder: function () {
  785. if (this.$route.path == "/Pharmacy/drugs/stock/out") {
  786. this.$router.push({
  787. name: "drugStockOutOrderAdd_Pharmacy",
  788. query: { type: this.type },
  789. });
  790. } else {
  791. this.$router.push({
  792. name: "drugStockOutOrderAdd",
  793. query: { type: this.type },
  794. });
  795. }
  796. },
  797. GetWarehouseOut: function () {
  798. const Params = {
  799. page: this.page,
  800. limit: this.limit,
  801. start_time: this.start_time,
  802. end_time: this.end_time,
  803. type: this.type,
  804. keywords: this.searchKey,
  805. storehouse_id: this.storehouse_id,
  806. way_type: this.way_type,
  807. check_type:this.check_type,
  808. };
  809. this.warehouseOutDate = [];
  810. getDrugWarehouseOutList(Params).then((response) => {
  811. if (response.data.state == 0) {
  812. this.$message.error(response.data.msg);
  813. return false;
  814. } else {
  815. this.total = response.data.data.total;
  816. for (let i = 0; i < response.data.data.list.length; i++) {
  817. this.warehouseOutDate.push(response.data.data.list[i]);
  818. }
  819. var obj = { id: 0, storehouse_name: "全部" };
  820. this.houseList = [];
  821. this.houseList.push(obj);
  822. for (let i = 0; i < response.data.data.houseList.length; i++) {
  823. this.houseList.push(response.data.data.houseList[i]);
  824. }
  825. var objOne = {id:0,name:"系统"}
  826. this.patients.push(objOne)
  827. for(let i=0;i<response.data.data.patients.length;i++){
  828. this.patients.push(response.data.data.patients[i])
  829. }
  830. }
  831. });
  832. },
  833. getXuserName(id) {
  834. if (id <= 0) {
  835. return "";
  836. }
  837. var name = "";
  838. if (
  839. this.adminUserOptions == null ||
  840. typeof this.adminUserOptions.length === "undefined"
  841. ) {
  842. return name;
  843. }
  844. var leng = this.adminUserOptions.length;
  845. if (leng == 0) {
  846. return name;
  847. }
  848. for (let index = 0; index < leng; index++) {
  849. if (this.adminUserOptions[index].id == id) {
  850. name = this.adminUserOptions[index].name;
  851. break;
  852. }
  853. }
  854. return name;
  855. },
  856. fetchAllAdminUsers() {
  857. fetchAllAdminUsers().then((response) => {
  858. if (response.data.state == 1) {
  859. this.adminUserOptions = response.data.data.users;
  860. var alen = this.adminUserOptions.length;
  861. for (let index = 0; index < alen; index++) {
  862. if (this.adminUserOptions[index].user_type == 2) {
  863. // this.doctorOptions.push(this.adminUserOptions[index]);
  864. }
  865. }
  866. }
  867. });
  868. },
  869. handleSelectionChange: function (val) {
  870. this.multipleSelection = val;
  871. },
  872. handleSizeChange(val) {
  873. this.limit = val;
  874. this.GetWarehouseOut();
  875. },
  876. handleCurrentChange(val) {
  877. this.page = val;
  878. this.GetWarehouseOut();
  879. },
  880. startTimeChange(val) {
  881. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  882. if (time > 0) {
  883. this.$message.error("结束时间不能小于开始时间");
  884. this.start_time = "";
  885. } else {
  886. this.GetWarehouseOut();
  887. }
  888. },
  889. endTimeChange(val) {
  890. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  891. if (time < 0) {
  892. this.$message.error("结束时间不能小于开始时间");
  893. this.end_time = "";
  894. } else {
  895. this.GetWarehouseOut();
  896. }
  897. },
  898. getTimestamp(time) {
  899. // 把时间日期转成时间戳
  900. return new Date(time).getTime() / 1000;
  901. },
  902. calculate: function (val) {
  903. return Math.round(parseFloat(val) * 100) / 100;
  904. },
  905. GetConfigInfo: function () {
  906. GetAllConfig().then((response) => {
  907. if (response.data.state == 0) {
  908. this.$message.error(response.data.msg);
  909. return false;
  910. } else {
  911. this.manufacturer = response.data.data.manufacturer;
  912. this.dealer = response.data.data.dealer;
  913. }
  914. });
  915. },
  916. handleEdit: function (index, row) {
  917. this.$router.push({
  918. path:
  919. "/drug/out/drugstockoutorderedit?id=" +
  920. row.id +
  921. "&type=" +
  922. this.type +
  923. "&is_sys=" +
  924. row.is_sys +
  925. "&supply_cancel_out_id=" +
  926. row.supply_cancel_out_id+"&is_check="+row.is_check
  927. });
  928. },
  929. handleSearch(val) {
  930. this.is_sys = val.is_sys;
  931. this.getInitializtion();
  932. this.getSinleOrderDetail(val.id, val.warehouse_out_time, val.is_sys);
  933. this.list = [];
  934. },
  935. handleDelete: function (index, row) {
  936. if (row.is_sys == 5) {
  937. this.$message.error("结算出库数据不能删除!");
  938. return;
  939. }
  940. if (row.is_sys == 12) {
  941. this.$message.error("调拨出库数据不能删除!");
  942. return;
  943. }
  944. if (row.supply_cancel_out_id > 0) {
  945. this.$message.error("采购出库数据不能删除!");
  946. return;
  947. }
  948. if(row.is_check == 1){
  949. this.$message.error("已审核的单据不能删除!")
  950. return false
  951. }
  952. const ids = [];
  953. ids.push(row.id);
  954. const idStr = ids.join(",");
  955. const params = {
  956. ids: idStr,
  957. };
  958. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  959. confirmButtonText: "确定",
  960. cancelButtonText: "取消",
  961. type: "warning",
  962. })
  963. .then(() => {
  964. deleteDrugWarehouseOut(params).then((response) => {
  965. if (response.data.state == 0) {
  966. this.$message.error(response.data.msg);
  967. return false;
  968. } else {
  969. this.$notify({
  970. title: "成功",
  971. message: "删除成功",
  972. type: "success",
  973. duration: 2000,
  974. });
  975. for (let i = 0; i < ids.length; i++) {
  976. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  977. if (ids[i] == this.warehouseOutDate[y].id) {
  978. this.warehouseOutDate.splice(y, 1);
  979. }
  980. }
  981. }
  982. }
  983. });
  984. })
  985. .catch(() => {});
  986. },
  987. changeAllSelected: function (val) {
  988. if (val) {
  989. this.$refs.multipleTable.toggleAllSelection();
  990. } else {
  991. this.$refs.multipleTable.clearSelection();
  992. }
  993. },
  994. select(selection) {
  995. var ids = [];
  996. for (let i = 0; i < selection.length; i++) {
  997. ids.push(selection[i].id);
  998. }
  999. this.order_id = ids.join(",");
  1000. this.selectedTableData = selection;
  1001. this.getExportOutOrderDrugList();
  1002. },
  1003. batchDelete() {
  1004. if (this.selectedTableData.length <= 0) {
  1005. this.$message.error("请选择要删除的记录");
  1006. return;
  1007. }
  1008. const ids = [];
  1009. const idsOne = [];
  1010. for (let i = 0; i < this.selectedTableData.length; i++) {
  1011. if(this.selectedTableData[i].is_check == 1){
  1012. this.$message.error("已审核单据不能删除!")
  1013. return false
  1014. }
  1015. if (this.selectedTableData[i].is_sys == 1) {
  1016. this.$message.error("自动出库数据不能删除!");
  1017. return false;
  1018. }
  1019. if (this.selectedTableData[i].is_sys == 12) {
  1020. this.$message.error("调拨出库数据不能删除!");
  1021. return false;
  1022. }
  1023. if (this.selectedTableData[i].is_sys == 5) {
  1024. this.$message.error("结算出库数据不能删除!");
  1025. return false;
  1026. }
  1027. if (this.selectedTableData[i].is_sys == 0) {
  1028. ids.push(this.selectedTableData[i].id);
  1029. if(this.selectedTableData[i].supply_cancel_out_id >0){
  1030. idsOne.push(this.selectedTableData[i].supply_cancel_out_id);
  1031. }
  1032. }
  1033. }
  1034. if (idsOne.length > 0) {
  1035. this.$message.error("采购出库数据不能删除!");
  1036. return;
  1037. }
  1038. const idStr = ids.join(",");
  1039. const params = {
  1040. ids: idStr,
  1041. };
  1042. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  1043. confirmButtonText: "确定",
  1044. cancelButtonText: "取消",
  1045. type: "warning",
  1046. })
  1047. .then(() => {
  1048. deleteDrugWarehouseOut(params).then((response) => {
  1049. if (response.data.state == 0) {
  1050. this.$message.error(response.data.msg);
  1051. return false;
  1052. } else {
  1053. this.$notify({
  1054. title: "成功",
  1055. message: "删除成功",
  1056. type: "success",
  1057. duration: 2000,
  1058. });
  1059. for (let i = 0; i < ids.length; i++) {
  1060. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  1061. if (ids[i] == this.warehouseOutDate[y].id) {
  1062. this.warehouseOutDate.splice(y, 1);
  1063. }
  1064. }
  1065. }
  1066. }
  1067. });
  1068. })
  1069. .catch(() => {});
  1070. },
  1071. jump(id) {
  1072. this.GetOrderDetailTwo(id);
  1073. this.userList = [];
  1074. this.dialogVisibleTwo = true;
  1075. },
  1076. GetOrderDetailTwo(order_id) {
  1077. const params = {
  1078. id: order_id,
  1079. };
  1080. getDrugWarehouseOutUser(params).then((response) => {
  1081. if (response.data.state == 0) {
  1082. this.$message.error(response.data.msg);
  1083. return false;
  1084. } else {
  1085. this.userList = [];
  1086. var total = 0;
  1087. for (let i = 0; i < response.data.data.list.length; i++) {
  1088. var obj = response.data.data.list[i];
  1089. obj["is_total"] = 0;
  1090. this.userList.push(obj);
  1091. total = total + response.data.data.list[i].count;
  1092. }
  1093. this.userList.push({
  1094. is_total: 1,
  1095. total: total,
  1096. });
  1097. }
  1098. });
  1099. },
  1100. merge({ row, column, rowIndex, columnIndex }) {
  1101. if (columnIndex === 0) {
  1102. const _row = this.tempArr[rowIndex];
  1103. const _col = _row > 0 ? 1 : 0;
  1104. return {
  1105. rowspan: _row,
  1106. colspan: _col,
  1107. };
  1108. }
  1109. },
  1110. handleSpanTempArr() {
  1111. this.tempArr = [];
  1112. for (
  1113. let i = 0;
  1114. i < this.warehousingOutInfo.warehousingOutData.length;
  1115. i++
  1116. ) {
  1117. if (i === 0) {
  1118. this.tempArr.push(1);
  1119. this.pos = 0;
  1120. } else {
  1121. // 判断当前元素与上一个元素是否相同
  1122. if (
  1123. this.warehousingOutInfo.warehousingOutData[i].drug_id ===
  1124. this.warehousingOutInfo.warehousingOutData[i - 1].drug_id
  1125. ) {
  1126. this.tempArr[this.pos] += 1;
  1127. this.tempArr.push(0);
  1128. } else {
  1129. this.tempArr.push(1);
  1130. this.pos = i;
  1131. }
  1132. }
  1133. }
  1134. let sameRowArr = [],
  1135. sIdx = 0;
  1136. this.warehousingOutInfo.warehousingOutData.forEach((item, index) => {
  1137. item.index = index;
  1138. if (index === 0) {
  1139. sameRowArr.push([index]);
  1140. } else {
  1141. if (
  1142. item.drug_id ===
  1143. this.warehousingOutInfo.warehousingOutData[index - 1].drug_id
  1144. ) {
  1145. sameRowArr[sIdx].push(index);
  1146. } else {
  1147. sIdx = sIdx + 1;
  1148. sameRowArr.push([index]);
  1149. }
  1150. }
  1151. });
  1152. this.sameRowArr = sameRowArr;
  1153. },
  1154. // getDrugAutoMaticList(id, recordTime, warehouse_out_order_number) {
  1155. // var params = {
  1156. // warehous_out_id: id,
  1157. // record_time: recordTime,
  1158. // warehouse_out_order_number: warehouse_out_order_number,
  1159. // };
  1160. // getDrugAutoMaticList(params).then((response) => {
  1161. // if (response.data.state == 1) {
  1162. // var list = response.data.data.list;
  1163. // this.list = list;
  1164. // var drugConfig = response.data.data.drugConfig;
  1165. // this.drugConfig = drugConfig;
  1166. // var drugList = response.data.data.drugList;
  1167. // this.drugList = drugList;
  1168. // var manulist = response.data.data.manufacturerList;
  1169. // this.manufacturerList = manulist;
  1170. // }
  1171. // });
  1172. // },
  1173. getDrugCount(id) {
  1174. var count = 0;
  1175. for (let i = 0; i < this.list.length; i++) {
  1176. if (this.list[i].drug_id == id) {
  1177. count = this.list[i].Total;
  1178. }
  1179. }
  1180. return count;
  1181. },
  1182. getRetailPrice(id) {
  1183. var price = 0;
  1184. for (let i = 0; i < this.drugList.length; i++) {
  1185. if (id == this.drugList[i].id) {
  1186. price = this.drugList[i].retail_price;
  1187. }
  1188. }
  1189. return price;
  1190. },
  1191. getTime(val) {
  1192. if (val < 0) {
  1193. return "";
  1194. }
  1195. if (val == "") {
  1196. return "";
  1197. } else {
  1198. return uParseTime(val, "{y}-{m}-{d}");
  1199. }
  1200. },
  1201. getInitializtion() {
  1202. getInitializtion().then((response) => {
  1203. if (response.data.state == 1) {
  1204. var drugTypeList = response.data.data.drugTypeList;
  1205. this.drugTypeList = drugTypeList;
  1206. }
  1207. });
  1208. },
  1209. getDrugType(id) {
  1210. var name = "";
  1211. for (let i = 0; i < this.drugTypeList.length; i++) {
  1212. if (id == this.drugTypeList[i].value) {
  1213. name = this.drugTypeList[i].name;
  1214. }
  1215. }
  1216. return name;
  1217. },
  1218. getManufacturerName(id) {
  1219. var name = "";
  1220. for (let i = 0; i < this.manufacturerList.length; i++) {
  1221. if (id == this.manufacturerList[i].id) {
  1222. name = this.manufacturerList[i].manufacturer_name;
  1223. }
  1224. }
  1225. return name;
  1226. },
  1227. getDealerName(id) {
  1228. var name = "";
  1229. for (let i = 0; i < this.dealerList.length; i++) {
  1230. if (id == this.dealerList[i].id) {
  1231. name = this.dealerList[i].dealer_name;
  1232. }
  1233. }
  1234. return name;
  1235. },
  1236. getSinleOrderDetail(id, start_time, is_sys) {
  1237. var params = {
  1238. id: id,
  1239. start_time: start_time,
  1240. };
  1241. getSinleOrderDetail(params).then((response) => {
  1242. if (response.data.state == 1) {
  1243. this.tableShow = true;
  1244. this.tableList = [];
  1245. //流水详情
  1246. var list = response.data.data.list;
  1247. this.warehouseOutList = list
  1248. this.manufacturerList = response.data.data.manufacturerList;
  1249. this.dealerList = response.data.data.dealerList;
  1250. //详情(xt_drug_automatic_reduce_detail)
  1251. var drugFlowList = response.data.data.drugFlowList;
  1252. //流水详情
  1253. var drugList = response.data.data.drugList
  1254. this.tabList = drugList
  1255. //按批号分组
  1256. var drugListOne = response.data.data.drugListFlow
  1257. //按批号分组
  1258. var drugListTwo= response.data.data.drugListOne
  1259. //出库详情
  1260. var drugoutlist = response.data.data.drugoutlist
  1261. this.outList = drugoutlist
  1262. this.drugOutInfo = drugoutlist
  1263. if (is_sys == 1) {
  1264. if (drugFlowList.length > 0) {
  1265. for (let i = 0; i < drugFlowList.length; i++) {
  1266. drugFlowList[i].childOne = []
  1267. drugFlowList[i].child = []
  1268. if ((drugFlowList[i].count_unit ==drugFlowList[i].XtBaseDrug.max_unit) && (drugFlowList[i].XtBaseDrug.max_unit!=drugFlowList[i].XtBaseDrug.min_unit)) {
  1269. drugFlowList[i].count =drugFlowList[i].count * drugFlowList[i].XtBaseDrug.min_number;
  1270. }
  1271. if ((drugFlowList[i].count_unit ==drugFlowList[i].XtBaseDrug.min_unit)&& (drugFlowList[i].XtBaseDrug.max_unit!=drugFlowList[i].XtBaseDrug.min_unit) ) {
  1272. drugFlowList[i].count = drugFlowList[i].count;
  1273. }
  1274. if ((drugFlowList[i].count_unit ==drugFlowList[i].XtBaseDrug.min_unit)&& (drugFlowList[i].XtBaseDrug.max_unit==drugFlowList[i].XtBaseDrug.min_unit) ) {
  1275. drugFlowList[i].count = drugFlowList[i].count;
  1276. }
  1277. for(let j=0;j<drugListOne.length;j++){
  1278. if(drugFlowList[i].drug_id == drugListOne[j].drug_id){
  1279. drugFlowList[i].childOne.push(drugListOne[j])
  1280. }
  1281. }
  1282. }
  1283. }
  1284. console.log("以色列",drugFlowList)
  1285. this.drugFlowList = drugFlowList;
  1286. }
  1287. if (is_sys == 0 || is_sys == 12 || is_sys == 5) {
  1288. //出库详情
  1289. var flowlist = response.data.data.flowlist;
  1290. this.drugFlowList = [];
  1291. for (let i = 0; i < flowlist.length; i++) {
  1292. flowlist[i].childOne = []
  1293. flowlist[i].child = []
  1294. if (flowlist[i].count_unit == flowlist[i].max_unit) {
  1295. flowlist[i].count = flowlist[i].count * flowlist[i].min_number;
  1296. flowlist[i].count_unit = flowlist[i].min_unit;
  1297. }
  1298. if (flowlist[i].count_unit == flowlist[i].min_unit) {
  1299. flowlist[i].count = flowlist[i].count;
  1300. }
  1301. }
  1302. this.drugFlowList = flowlist;
  1303. }
  1304. for (let i = 0; i < list.length; i++) {
  1305. if (list[i].batch_number == "0" || list[i].batch_number == 0) {
  1306. list[i].batch_number = "";
  1307. }
  1308. if (list[i].number == "0" || list[i].number == 0) {
  1309. list[i].number = "";
  1310. }
  1311. list[i].child = []
  1312. list[i].childOne = []
  1313. if(list[i].is_sys == 1 ){
  1314. for(let j=0;j<drugListOne.length;j++){
  1315. if(list[i].drug_id == drugListOne[j].drug_id){
  1316. list[i].childOne.push(drugListOne[j])
  1317. }
  1318. }
  1319. }
  1320. if(list[i].is_sys == 0 || list[i].is_sys == 5 || list[i].is_sys == 12){
  1321. for(let j=0;j<drugListTwo.length;j++){
  1322. if(list[i].drug_id == drugListTwo[j].drug_id){
  1323. list[i].childOne.push(drugListTwo[j])
  1324. }
  1325. }
  1326. }
  1327. }
  1328. if(is_sys == 1 || is_sys == 5){
  1329. for(let i=0;i<list.length;i++){
  1330. for(let j=0;j<list[i].childOne.length;j++){
  1331. list[i].childOne[j].over_count_total = this.getOutCountSix(list[i].childOne[j].warehousing_detail_id,list[i].max_unit,list[i].min_unit,list[i].min_number,list[i].drug_id)
  1332. }
  1333. }
  1334. for(let i=0;i<list.length;i++){
  1335. for(let j=0;j<list[i].childOne.length;j++){
  1336. if(list[i].childOne[j].over_count_total !=""){
  1337. list[i].child.push(list[i].childOne[j])
  1338. }
  1339. }
  1340. }
  1341. this.tableList = list;
  1342. }
  1343. if(is_sys == 12){
  1344. for(let i=0;i<list.length;i++){
  1345. for(let j=0;j<list[i].childOne.length;j++){
  1346. list[i].childOne[j].over_count_total = this.getOutCountSeven(list[i].childOne[j].warehousing_detail_id,list[i].max_unit,list[i].min_unit,list[i].min_number,list[i].drug_id)
  1347. }
  1348. }
  1349. for(let i=0;i<list.length;i++){
  1350. for(let j=0;j<list[i].childOne.length;j++){
  1351. if(list[i].childOne[j].over_count_total !=""){
  1352. list[i].child.push(list[i].childOne[j])
  1353. }
  1354. }
  1355. }
  1356. console.log("listowowowowo",list)
  1357. this.tableList = list;
  1358. }
  1359. if(is_sys == 0){
  1360. console.log("list999992332232323",list)
  1361. for(let i=0;i<list.length;i++){
  1362. for(let j=0;j<list[i].childOne.length;j++){
  1363. console.log("hhhahhawiiw",this.getOutCountOne(list[i].childOne[j].batch_number,list[i].max_unit,list[i].min_unit,list[i].min_number,list[i].drug_id))
  1364. list[i].childOne[j].over_count_total = this.getOutCountOne(list[i].childOne[j].batch_number,list[i].max_unit,list[i].min_unit,list[i].min_number,list[i].drug_id)
  1365. }
  1366. }
  1367. for(let i=0;i<list.length;i++){
  1368. for(let j=0;j<list[i].childOne.length;j++){
  1369. if(list[i].childOne[j].over_count_total !=""){
  1370. list[i].child.push(list[i].childOne[j])
  1371. }
  1372. }
  1373. }
  1374. this.tableList = list;
  1375. }
  1376. console.log("tableLIST==================",this.tableList)
  1377. }
  1378. });
  1379. },
  1380. toDetail(val) {
  1381. this.userList = [];
  1382. this.userListOne = [];
  1383. var params = {
  1384. warehouse_out_id: val.warehouse_out_id,
  1385. drug_id: val.drug_id,
  1386. record_time: val.sys_record_time,
  1387. };
  1388. getAutoDrugDetail(params).then((response) => {
  1389. if (response.data.state == 1) {
  1390. this.userList = response.data.data.list;
  1391. if (val.is_sys == 1) {
  1392. this.drugDialogVisible = true;
  1393. }
  1394. if (val.is_sys == 0 || val.is_sys == 12 || val.is_sys == 5) {
  1395. this.drugDialogVisibleTwo = true;
  1396. }
  1397. var userListOne = response.data.data.outList;
  1398. this.userListOne = userListOne;
  1399. var batchNumber = response.data.data.batchNumber;
  1400. this.batchNumberList = batchNumber;
  1401. }
  1402. });
  1403. },
  1404. toPrint() {
  1405. if (this.order_id == 0) {
  1406. this.$message.error("请选择出库单");
  1407. } else {
  1408. this.$router.push({
  1409. path: "/stock/drugStockOutOrderDetailPrint?id=" + this.order_id,
  1410. });
  1411. }
  1412. },
  1413. getDrugCountList() {
  1414. var params = {
  1415. keyword: this.keywords,
  1416. start_time: this.start_time,
  1417. end_time: this.end_time,
  1418. };
  1419. getDrugCountList(params).then((response) => {
  1420. if (response.data.state == 1) {
  1421. var countlist = response.data.data.countList;
  1422. this.countList = countlist;
  1423. var outcountlist = response.data.data.outCountList;
  1424. this.outCountList = outcountlist;
  1425. var aucountlist = response.data.data.auCountList;
  1426. this.autoCountList = aucountlist;
  1427. var minCount = response.data.data.minCount;
  1428. this.minCount = minCount;
  1429. var info = response.data.data.info;
  1430. for (let i = 0; i < info.length; i++) {
  1431. if (info[i].count_unit == info[i].max_unit) {
  1432. info[i].count = info[i].count * info[i].min_number;
  1433. }
  1434. }
  1435. this.drugOutList = info;
  1436. }
  1437. });
  1438. },
  1439. getCount(drug_id, min_number, max_unit, min_unit) {
  1440. var count = 0;
  1441. var str = "";
  1442. var min_str = "";
  1443. for (let i = 0; i < this.drugOutList.length; i++) {
  1444. if (drug_id == this.drugOutList[i].drug_id) {
  1445. count += parseInt(this.drugOutList[i].count);
  1446. }
  1447. }
  1448. if (parseInt(count / min_number) != 0) {
  1449. str = parseInt(count / min_number) + max_unit;
  1450. }
  1451. if (count % min_number != 0) {
  1452. min_str = (count % min_number) + min_unit;
  1453. }
  1454. return str + min_str;
  1455. },
  1456. getTotalCount(drug_id, min_number, max_unit, min_unit) {
  1457. var str = "";
  1458. var min_str = "";
  1459. var arr = [];
  1460. var total = 0;
  1461. for (let i = 0; i < this.outList.length; i++) {
  1462. if (this.outList[i].drug_id == drug_id) {
  1463. total += this.outList[i].count;
  1464. }
  1465. }
  1466. if (total >= min_number) {
  1467. if (parseInt(total / min_number) != 0) {
  1468. str = parseInt(total / min_number) + max_unit;
  1469. }
  1470. if (total % min_number != 0) {
  1471. min_str = (total % min_number) + min_unit;
  1472. }
  1473. }
  1474. if (total < min_number) {
  1475. str = "";
  1476. min_str = total + min_unit;
  1477. }
  1478. return str + min_str;
  1479. },
  1480. getTotalCountOne(id, min_number, max_unit, min_unit) {
  1481. var arr = [];
  1482. for (let i = 0; i < this.drugFlowList.length; i++) {
  1483. if (id == this.drugFlowList[i].drug_id) {
  1484. arr.push(this.drugFlowList[i]);
  1485. }
  1486. }
  1487. var str = "";
  1488. var min_str = "";
  1489. var total = 0;
  1490. if (arr.length > 0) {
  1491. for (let i = 0; i < arr.length; i++) {
  1492. total += arr[i].count;
  1493. }
  1494. if (parseInt(total / min_number) != 0) {
  1495. str = parseInt(total / min_number) + max_unit;
  1496. }
  1497. if (total % min_number != 0) {
  1498. min_str = (total % min_number) + min_unit;
  1499. }
  1500. }
  1501. return str + min_str;
  1502. },
  1503. getAllPrice(drug_id, price, min_price) {
  1504. var strprice = 0;
  1505. var minstrprice = 0;
  1506. var str = "";
  1507. var min_str = "";
  1508. var total_price = 0;
  1509. for (let i = 0; i < this.outList.length; i++) {
  1510. if (this.outList[i].drug_id == drug_id) {
  1511. if (
  1512. parseInt(this.outList[i].count / this.outList[i].min_number) != 0
  1513. ) {
  1514. str = parseInt(this.outList[i].count / this.outList[i].min_number);
  1515. }
  1516. if (this.outList[i].count % this.outList[i].min_number != 0) {
  1517. min_str = this.outList[i].count % this.outList[i].min_number;
  1518. }
  1519. }
  1520. }
  1521. strprice = str * price;
  1522. minstrprice = min_str * min_price;
  1523. total_price = strprice + minstrprice;
  1524. return total_price;
  1525. },
  1526. getDrugBatchNumber(drugid, count) {
  1527. var arr = [];
  1528. for (let i = 0; i < this.batchNumberList.length; i++) {
  1529. if (
  1530. drugid == this.batchNumberList[i].drug_id &&
  1531. count == this.batchNumberList[i].count
  1532. ) {
  1533. arr.push(this.batchNumberList[i].batch_number);
  1534. }
  1535. }
  1536. return arr.join(",");
  1537. },
  1538. getExportOutOrderDrugList() {
  1539. var params = {
  1540. order_id: this.order_id,
  1541. };
  1542. this.exportLoding = true
  1543. getExportOutOrderDrugList(params).then((response) => {
  1544. if (response.data.state == 1) {
  1545. var list = response.data.data.list;
  1546. if(list!=null){
  1547. for(let i=0;i<list.length;i++){
  1548. list[i].count_one =0
  1549. if(list[i].count_unit == list[i].max_unit && list[i].max_unit!=list[i].min_unit){
  1550. list[i].count_one = list[i].count * list[i].min_number
  1551. }
  1552. if(list[i].count_unit == list[i].min_unit && list[i].max_unit!=list[i].min_unit){
  1553. list[i].count_one = list[i].count
  1554. }
  1555. if(list[i].count_unit == list[i].max_unit && list[i].max_unit==list[i].min_unit){
  1556. list[i].count_one = list[i].count
  1557. }
  1558. }
  1559. }
  1560. this.exportList = list;
  1561. this.exportLoding = false
  1562. this.manufacturerList = response.data.data.manufacturerList;
  1563. this.dealerList = response.data.data.dealerList;
  1564. this.outInfoList = response.data.data.outInfoList
  1565. }
  1566. });
  1567. },
  1568. toExport() {
  1569. console.log("EXPORTLSOT",this.exportList)
  1570. if (this.order_id == "") {
  1571. this.$message.error("请勾选出库单");
  1572. return;
  1573. }
  1574. for (let i = 0; i < this.exportList.length; i++) {
  1575. this.exportList[i].retail_price_one = 0
  1576. if(this.outInfoList.length!=null){
  1577. for(let j=0;j<this.outInfoList.length;j++){
  1578. if(this.exportList[i].warehouse_out_id == this.outInfoList[j].warehouse_out_id && this.exportList[i].drug_id == this.outInfoList[j].drug_id){
  1579. this.exportList[i].retail_price_one = this.outInfoList[j].price
  1580. }
  1581. }
  1582. }
  1583. if (this.exportList[i].dealer == 0) {
  1584. this.exportList[i].dealer = "";
  1585. }
  1586. if (this.exportList[i].manufacturer == 0) {
  1587. this.exportList[i].manufacturer = "";
  1588. }
  1589. this.exportList[i].unit =
  1590. this.exportList[i].dose +
  1591. this.exportList[i].dose_unit +
  1592. "*" +
  1593. this.exportList[i].min_number +
  1594. this.exportList[i].min_unit +
  1595. "/" +
  1596. this.exportList[i].max_unit;
  1597. // this.exportList[i].total_price = (this.exportList[i].count * this.exportList[i].price).toFixed(2);
  1598. this.exportList[i].out_count = this.getAllOut(this.exportList[i].count,this.exportList[i].max_unit,this.exportList[i].min_unit,this.exportList[i].min_number)
  1599. this.exportList[i].expiry_date = this.getTime(
  1600. this.exportList[i].expire_date
  1601. );
  1602. this.exportList[i].product_date = this.getTime(
  1603. this.exportList[i].product_date
  1604. );
  1605. for (let j = 0; j < this.manufacturerList.length; j++) {
  1606. if (this.exportList[i].manufacturer == this.manufacturerList[j].id) {
  1607. this.exportList[i].manufacturer = this.manufacturerList[j].manufacturer_name;
  1608. }
  1609. }
  1610. for (let z = 0; z < this.dealerList.length; z++) {
  1611. if (this.exportList[i].dealer == this.dealerList[z].id) {
  1612. this.exportList[i].dealer = this.dealerList[z].dealer_name;
  1613. }
  1614. }
  1615. this.exportList[i].retail_price = (this.exportList[i].count_one * this.exportList[i].min_price).toFixed(2)
  1616. this.exportList[i].ctime = this.getTime(this.exportList[i].ctime)
  1617. }
  1618. import("@/vendor/Export2Excel").then((excel) => {
  1619. for (let i = 0; i < this.exportList.length; i++) {
  1620. for (let j = 0; j < this.drugTypeList.length; j++) {
  1621. if (this.exportList[i].drug_type == this.drugTypeList[j].value) {
  1622. this.exportList[i].drug_type = this.drugTypeList[j].name;
  1623. }
  1624. }
  1625. }
  1626. const tHeader = [
  1627. "单据日期",
  1628. "药品名称",
  1629. "药品类型",
  1630. "规格&单位",
  1631. "批号",
  1632. "出库数量",
  1633. "单价",
  1634. "拆零零售价",
  1635. "总价",
  1636. "生产厂家",
  1637. "生产日期",
  1638. "有效日期",
  1639. "经销商",
  1640. "批准文号",
  1641. "出库时间",
  1642. "备注",
  1643. ];
  1644. const filterVal = [
  1645. "ctime",
  1646. "drug_name",
  1647. "drug_type",
  1648. "unit",
  1649. "batch_number",
  1650. "out_count",
  1651. "retail_price_one",
  1652. "price",
  1653. "retail_price",
  1654. "manufacturer",
  1655. "product_date",
  1656. "expiry_date",
  1657. "dealer",
  1658. "number",
  1659. "ctime",
  1660. "remark",
  1661. ];
  1662. const data = this.formatJson(filterVal, this.exportList);
  1663. console.log("Datewoo2o2o2o",data)
  1664. excel.export_json_to_excel({
  1665. header: tHeader,
  1666. data,
  1667. filename: "药品出库单详情",
  1668. });
  1669. this.downloadLoading = false;
  1670. });
  1671. },
  1672. formatJson(filterVal, jsonData) {
  1673. return jsonData.map((v) => filterVal.map((j) => v[j]));
  1674. },
  1675. getAllPriceOne(
  1676. drug_id,
  1677. price,
  1678. min_price,
  1679. max_unit,
  1680. count_unit,
  1681. min_number,
  1682. is_sys
  1683. ) {
  1684. var total = 0;
  1685. var all_price = 0;
  1686. for (let i = 0; i < this.drugFlowList.length; i++) {
  1687. if (drug_id == this.drugFlowList[i].drug_id) {
  1688. total += this.drugFlowList[i].count;
  1689. }
  1690. }
  1691. if (max_unit == count_unit && is_sys != 0 && is_sys != 12) {
  1692. total = total * min_number;
  1693. }
  1694. all_price = (total / min_number) * price;
  1695. return all_price;
  1696. },
  1697. getHouseName(id) {
  1698. var storehouse_name = "";
  1699. for (let i = 0; i < this.houseList.length; i++) {
  1700. if (id == this.houseList[i].id) {
  1701. storehouse_name = this.houseList[i].storehouse_name;
  1702. }
  1703. }
  1704. return storehouse_name;
  1705. },
  1706. changeStoreHouse() {
  1707. this.GetWarehouseOut();
  1708. },
  1709. changeWay() {
  1710. this.GetWarehouseOut();
  1711. },
  1712. changeCheckType(){
  1713. this.GetWarehouseOut();
  1714. },
  1715. // 合并单元格样式
  1716. cellStyle({ row, column, rowIndex, columnIndex }) {
  1717. let arr = [4,5,6, 7, 8, 9,10,11,12,13,14];
  1718. if (arr.indexOf(columnIndex) > -1) {
  1719. return "spanClass";
  1720. }
  1721. },
  1722. getOutCountSix(warehouse_info_id,max_unit,min_unit,min_number,drug_id){
  1723. var arr = []
  1724. var total = 0
  1725. var max_str = ""
  1726. var min_str = ""
  1727. for(let j=0;j<this.outList.length;j++){
  1728. if(warehouse_info_id == this.outList[j].warehouse_info_id && drug_id == this.outList[j].drug_id){
  1729. arr.push(this.outList[j])
  1730. }
  1731. }
  1732. if(arr.length > 0){
  1733. for(let i=0;i<arr.length;i++){
  1734. total +=arr[i].count
  1735. }
  1736. }
  1737. if (total < min_number) {
  1738. min_str = total + min_unit;
  1739. }
  1740. if (total == 0) {
  1741. min_str = "";
  1742. max_str = "";
  1743. }
  1744. if (total >= min_number) {
  1745. if (parseInt(total / min_number) != 0) {
  1746. max_str = parseInt(total / min_number) + max_unit;
  1747. }
  1748. if (total % min_number != 0) {
  1749. min_str = (total % min_number) + min_unit;
  1750. }
  1751. }
  1752. return max_str + min_str;
  1753. },
  1754. getOutCountSeven(warehouse_info_id,max_unit,min_unit,min_number,drug_id){
  1755. var arr = []
  1756. var total = 0
  1757. var max_str = ""
  1758. var min_str = ""
  1759. for(let j=0;j<this.outList.length;j++){
  1760. if(this.outList[j].count_unit == max_unit){
  1761. this.outList[j].count = this.outList[j].count * min_number
  1762. }
  1763. if(warehouse_info_id == this.outList[j].warehouse_info_id && drug_id == this.outList[j].drug_id){
  1764. arr.push(this.outList[j])
  1765. }
  1766. }
  1767. if(arr.length > 0){
  1768. for(let i=0;i<arr.length;i++){
  1769. total +=arr[i].count
  1770. }
  1771. }
  1772. if (total < min_number) {
  1773. min_str = total + min_unit;
  1774. }
  1775. if (total == 0) {
  1776. min_str = "";
  1777. max_str = "";
  1778. }
  1779. if (total >= min_number) {
  1780. if (parseInt(total / min_number) != 0) {
  1781. max_str = parseInt(total / min_number) + max_unit;
  1782. }
  1783. if (total % min_number != 0) {
  1784. min_str = (total % min_number) + min_unit;
  1785. }
  1786. }
  1787. return max_str + min_str;
  1788. },
  1789. getOutCount(warehouse_info_id,max_unit,min_unit,min_number){
  1790. var arr = []
  1791. var total = 0
  1792. var max_str = ""
  1793. var min_str = ""
  1794. for(let j=0;j<this.tabList.length;j++){
  1795. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  1796. arr.push(this.tabList[j])
  1797. }
  1798. }
  1799. if(arr.length > 0){
  1800. for(let i=0;i<arr.length;i++){
  1801. total +=arr[i].count
  1802. }
  1803. }
  1804. if (total < min_number) {
  1805. min_str = total + min_unit;
  1806. }
  1807. if (total == 0) {
  1808. min_str = "";
  1809. max_str = "";
  1810. }
  1811. if (total >= min_number) {
  1812. if (parseInt(total / min_number) != 0) {
  1813. max_str = parseInt(total / min_number) + max_unit;
  1814. }
  1815. if (total % min_number != 0) {
  1816. min_str = (total % min_number) + min_unit;
  1817. }
  1818. }
  1819. return max_str + min_str;
  1820. },
  1821. getOutCountOne(batch_number,max_unit,min_unit,min_number,drug_id){
  1822. var arr = []
  1823. var total = 0
  1824. var max_str = ""
  1825. var min_str = ""
  1826. for(let j=0;j<this.tabList.length;j++){
  1827. if(batch_number == this.tabList[j].batch_number && drug_id == this.tabList[j].drug_id){
  1828. arr.push(this.tabList[j])
  1829. }
  1830. }
  1831. if(arr.length > 0){
  1832. for(let i=0;i<arr.length;i++){
  1833. total +=arr[i].count
  1834. }
  1835. }
  1836. if (total < min_number) {
  1837. min_str = total + min_unit;
  1838. }
  1839. if (total == 0) {
  1840. min_str = "";
  1841. max_str = "";
  1842. }
  1843. if (total >= min_number) {
  1844. if (parseInt(total / min_number) != 0) {
  1845. max_str = parseInt(total / min_number) + max_unit;
  1846. }
  1847. if (total % min_number != 0) {
  1848. min_str = (total % min_number) + min_unit;
  1849. }
  1850. }
  1851. return max_str + min_str;
  1852. },
  1853. getBatchNumber(warehouse_info_id){
  1854. var arr = []
  1855. var batch_number = 0
  1856. for(let j=0;j<this.tabList.length;j++){
  1857. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  1858. arr.push(this.tabList[j])
  1859. }
  1860. }
  1861. if(arr.length > 0){
  1862. batch_number = arr[0].batch_number
  1863. }
  1864. return batch_number
  1865. },
  1866. getBatchNumberOne(number){
  1867. var arr = []
  1868. var batch_number = 0
  1869. for(let j=0;j<this.tabList.length;j++){
  1870. if(number == this.tabList[j].batch_number){
  1871. arr.push(this.tabList[j])
  1872. }
  1873. }
  1874. if(arr.length > 0){
  1875. batch_number = arr[0].batch_number
  1876. }
  1877. return batch_number
  1878. },
  1879. getPrice(warehouse_info_id,max_unit,min_unit,min_number){
  1880. var arr = []
  1881. var price = 0
  1882. for(let j=0;j<this.tabList.length;j++){
  1883. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  1884. arr.push(this.tabList[j])
  1885. }
  1886. }
  1887. if(arr.length > 0){
  1888. price = arr[0].price
  1889. }
  1890. return price
  1891. },
  1892. getPriceOne(number,max_unit,min_unit,min_number){
  1893. var arr = []
  1894. var price = 0
  1895. for(let j=0;j<this.tabList.length;j++){
  1896. if(number == this.tabList[j].batch_number){
  1897. arr.push(this.tabList[j])
  1898. }
  1899. }
  1900. if(arr.length > 0){
  1901. price = arr[0].price
  1902. }
  1903. return price
  1904. },
  1905. getTotalPrice(warehouse_info_id,max_unit,min_unit,min_number){
  1906. var arr = []
  1907. var total = 0
  1908. var max_str = 0
  1909. var min_str = 0
  1910. var price = 0
  1911. var all_price = 0
  1912. for(let j=0;j<this.tabList.length;j++){
  1913. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  1914. arr.push(this.tabList[j])
  1915. }
  1916. }
  1917. if(arr.length > 0){
  1918. for(let i=0;i<arr.length;i++){
  1919. total +=arr[i].count
  1920. price = arr[0].price
  1921. }
  1922. }
  1923. if (total < min_number) {
  1924. min_str = total
  1925. }
  1926. if (total == 0) {
  1927. min_str = 0;
  1928. max_str = 0;
  1929. }
  1930. if (total >= min_number) {
  1931. if (parseInt(total / min_number) != 0) {
  1932. max_str = parseInt(total / min_number)
  1933. }
  1934. if (total % min_number != 0) {
  1935. min_str = (total % min_number)
  1936. }
  1937. }
  1938. if(max_unit!=min_unit){
  1939. all_price = max_str * min_number * price + min_str * price
  1940. }
  1941. if(max_unit == min_unit){
  1942. all_price = max_str * price + min_str * price
  1943. }
  1944. if(all_price > 0){
  1945. return all_price.toFixed(2)
  1946. }else{
  1947. return 0
  1948. }
  1949. },
  1950. getTotalPriceOne(number,max_unit,min_unit,min_number,retail_price){
  1951. var arr = []
  1952. var total = 0
  1953. var max_str = 0
  1954. var min_str = 0
  1955. var price = 0
  1956. var all_price = 0
  1957. for(let j=0;j<this.tabList.length;j++){
  1958. if(number == this.tabList[j].batch_number){
  1959. arr.push(this.tabList[j])
  1960. }
  1961. }
  1962. if(arr.length > 0){
  1963. for(let i=0;i<arr.length;i++){
  1964. total +=arr[i].count
  1965. }
  1966. }
  1967. price = retail_price
  1968. if (total < min_number) {
  1969. min_str = total
  1970. }
  1971. if (total == 0) {
  1972. min_str = 0;
  1973. max_str = 0;
  1974. }
  1975. if (total >= min_number) {
  1976. if (parseInt(total / min_number) != 0) {
  1977. max_str = parseInt(total / min_number)
  1978. }
  1979. if (total % min_number != 0) {
  1980. min_str = (total % min_number)
  1981. }
  1982. }
  1983. if(max_unit!=min_unit){
  1984. all_price = max_str * price + min_str * price
  1985. }
  1986. if(max_unit == min_unit){
  1987. all_price = max_str * price + min_str * price
  1988. }
  1989. if(all_price > 0){
  1990. return all_price.toFixed(2)
  1991. }else{
  1992. return 0
  1993. }
  1994. },
  1995. getAllManufacturerName(warehouse_info_id,max_unit,min_unit,min_number){
  1996. var arr = []
  1997. var manufacture_id = 0
  1998. var manufacturer_name = ""
  1999. for(let j=0;j<this.tabList.length;j++){
  2000. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  2001. arr.push(this.tabList[j])
  2002. }
  2003. }
  2004. if(arr.length >0){
  2005. manufacture_id = arr[0].manufacturer
  2006. }
  2007. manufacturer_name = this.getManufacturerName(manufacture_id)
  2008. return manufacturer_name
  2009. },
  2010. getAllManufacturerNameOne(number,max_unit,min_unit,min_number){
  2011. var arr = []
  2012. var manufacture_id = 0
  2013. var manufacturer_name = ""
  2014. for(let j=0;j<this.tabList.length;j++){
  2015. if(number == this.tabList[j].number){
  2016. arr.push(this.tabList[j])
  2017. }
  2018. }
  2019. if(arr.length >0){
  2020. manufacture_id = arr[0].manufacturer
  2021. }
  2022. manufacturer_name = this.getManufacturerName(manufacture_id)
  2023. return manufacturer_name
  2024. },
  2025. getProductDate(warehouse_info_id,max_unit,min_unit,min_number){
  2026. var arr = []
  2027. var product_date = 0
  2028. for(let j=0;j<this.tabList.length;j++){
  2029. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  2030. arr.push(this.tabList[j])
  2031. }
  2032. }
  2033. if(arr.length >0){
  2034. product_date = arr[0].product_date
  2035. }
  2036. return this.getTime(product_date)
  2037. },
  2038. getProductDateOne(number,max_unit,min_unit,min_number){
  2039. var arr = []
  2040. var product_date = 0
  2041. for(let j=0;j<this.tabList.length;j++){
  2042. if(number == this.tabList[j].number){
  2043. arr.push(this.tabList[j])
  2044. }
  2045. }
  2046. if(arr.length >0){
  2047. product_date = arr[0].product_date
  2048. }
  2049. return this.getTime(product_date)
  2050. },
  2051. getExpiryDate(warehouse_info_id,max_unit,min_unit,min_number){
  2052. var arr = []
  2053. var expiry_date = 0
  2054. for(let j=0;j<this.tabList.length;j++){
  2055. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  2056. arr.push(this.tabList[j])
  2057. }
  2058. }
  2059. if(arr.length >0){
  2060. expiry_date = arr[0].expire_date
  2061. }
  2062. return this.getTime(expiry_date)
  2063. },
  2064. getExpiryDateOne(number,max_unit,min_unit,min_number){
  2065. var arr = []
  2066. var expiry_date = 0
  2067. for(let j=0;j<this.tabList.length;j++){
  2068. if(number == this.tabList[j].number){
  2069. arr.push(this.tabList[j])
  2070. }
  2071. }
  2072. if(arr.length >0){
  2073. expiry_date = arr[0].expire_date
  2074. }
  2075. return this.getTime(expiry_date)
  2076. },
  2077. getDealer(warehouse_info_id,max_unit,min_unit,min_number){
  2078. var arr = []
  2079. var dealer = 0
  2080. for(let j=0;j<this.tabList.length;j++){
  2081. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  2082. arr.push(this.tabList[j])
  2083. }
  2084. }
  2085. if(arr.length >0){
  2086. dealer = arr[0].dealer
  2087. }
  2088. return this.getDealerName(dealer)
  2089. },
  2090. getDealerOne(number,max_unit,min_unit,min_number){
  2091. var arr = []
  2092. var dealer = 0
  2093. for(let j=0;j<this.tabList.length;j++){
  2094. if(number == this.tabList[j].number){
  2095. arr.push(this.tabList[j])
  2096. }
  2097. }
  2098. if(arr.length >0){
  2099. dealer = arr[0].dealer
  2100. }
  2101. return this.getDealerName(dealer)
  2102. },
  2103. getNumber(warehouse_info_id,max_unit,min_unit,min_number){
  2104. var arr = []
  2105. var number = ""
  2106. for(let j=0;j<this.tabList.length;j++){
  2107. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  2108. arr.push(this.tabList[j])
  2109. }
  2110. }
  2111. if(arr.length >0){
  2112. number = arr[0].number
  2113. }
  2114. return number
  2115. },
  2116. getNumberOne(number,max_unit,min_unit,min_number){
  2117. var arr = []
  2118. var number = ""
  2119. for(let j=0;j<this.tabList.length;j++){
  2120. if(number == this.tabList[j].number){
  2121. arr.push(this.tabList[j])
  2122. }
  2123. }
  2124. if(arr.length >0){
  2125. number = arr[0].number
  2126. }
  2127. return number
  2128. },
  2129. getRemark(warehouse_info_id,max_unit,min_unit,min_number){
  2130. var arr = []
  2131. var remark = ""
  2132. for(let j=0;j<this.tabList.length;j++){
  2133. if(warehouse_info_id == this.tabList[j].warehousing_detail_id){
  2134. arr.push(this.tabList[j])
  2135. }
  2136. }
  2137. if(arr.length >0){
  2138. if(arr[0].DrugWarehouseInfoOne!=null){
  2139. remark = arr[0].DrugWarehouseInfoOne.remark
  2140. }
  2141. }
  2142. return remark
  2143. },
  2144. getAllOut(count,max_unit,min_unit,min_number){
  2145. var total = 0
  2146. var max_str = ""
  2147. var min_str = ""
  2148. total = count
  2149. if (total < min_number) {
  2150. min_str = total + min_unit
  2151. }
  2152. if (total == 0) {
  2153. min_str = 0;
  2154. max_str = 0;
  2155. }
  2156. if (total >= min_number) {
  2157. if (parseInt(total / min_number) != 0) {
  2158. max_str = parseInt(total / min_number) + max_unit
  2159. }
  2160. if (total % min_number != 0) {
  2161. min_str = (total % min_number)+ min_unit
  2162. }
  2163. }
  2164. return max_str + min_str
  2165. },
  2166. getPriceTwo(warehouse_out_id,drug_id){
  2167. var price = 0
  2168. for(let i=0;i<this.warehouseOutList.length;i++){
  2169. if(drug_id == this.warehouseOutList[i].drug_id){
  2170. price = this.warehouseOutList[i].price
  2171. }
  2172. }
  2173. return price
  2174. },
  2175. getOutCountTen(total,max_unit,min_unit,min_number){
  2176. var max_str = ""
  2177. var min_str = ""
  2178. if (total < min_number) {
  2179. min_str = total + min_unit;
  2180. }
  2181. if (total == 0) {
  2182. min_str = "";
  2183. max_str = "";
  2184. }
  2185. if (total >= min_number) {
  2186. if (parseInt(total / min_number) != 0) {
  2187. max_str = parseInt(total / min_number) + max_unit;
  2188. }
  2189. if (total % min_number != 0) {
  2190. min_str = (total % min_number) + min_unit;
  2191. }
  2192. }
  2193. return max_str + min_str;
  2194. },
  2195. getOutCountNightTen(warehouse_info_id,max_unit,min_unit,min_number,drug_id){
  2196. var arr = []
  2197. var total = 0
  2198. var max_str = ""
  2199. var min_str = ""
  2200. for(let j=0;j<this.outList.length;j++){
  2201. if(warehouse_info_id == this.outList[j].warehouse_info_id && drug_id == this.outList[j].drug_id){
  2202. arr.push(this.outList[j])
  2203. }
  2204. }
  2205. if(arr.length > 0){
  2206. for(let i=0;i<arr.length;i++){
  2207. total +=arr[i].count
  2208. }
  2209. }
  2210. if (total < min_number) {
  2211. min_str = total
  2212. }
  2213. if (total == 0) {
  2214. min_str = "";
  2215. max_str = "";
  2216. }
  2217. if (total >= min_number) {
  2218. if (parseInt(total / min_number) != 0) {
  2219. max_str = parseInt(total / min_number)
  2220. }
  2221. if (total % min_number != 0) {
  2222. min_str = (total % min_number)
  2223. }
  2224. }
  2225. return max_str + min_str;
  2226. },
  2227. getOutCountNightTenOne(batch_number,max_unit,min_unit,min_number,drug_id){
  2228. var arr = []
  2229. var total = 0
  2230. var max_str = ""
  2231. var min_str = ""
  2232. for(let j=0;j<this.tabList.length;j++){
  2233. if(batch_number == this.tabList[j].batch_number && drug_id == this.tabList[j].drug_id){
  2234. arr.push(this.tabList[j])
  2235. }
  2236. }
  2237. if(arr.length > 0){
  2238. for(let i=0;i<arr.length;i++){
  2239. total +=arr[i].count
  2240. }
  2241. }
  2242. if (total < min_number) {
  2243. min_str = total
  2244. }
  2245. if (total == 0) {
  2246. min_str = "";
  2247. max_str = "";
  2248. }
  2249. if (total >= min_number) {
  2250. if (parseInt(total / min_number) != 0) {
  2251. max_str = parseInt(total / min_number)
  2252. }
  2253. if (total % min_number != 0) {
  2254. min_str = (total % min_number)
  2255. }
  2256. }
  2257. return max_str + min_str;
  2258. },
  2259. getPatientName(patient_id){
  2260. var name = ""
  2261. console.log("patinetsowowowo",this.patients)
  2262. for(let i=0;i<this.patients.length;i++){
  2263. if(patient_id == this.patients[i].id){
  2264. name = this.patients[i].name
  2265. }
  2266. }
  2267. return name
  2268. },
  2269. getDrugPatientName(row){
  2270. console.log("row",row)
  2271. var params = {
  2272. drug_id:row.drug_id,
  2273. sys_record_time:row.sys_record_time
  2274. }
  2275. getDrugPatientName(params).then(response=>{
  2276. if(response.data.state ==1){
  2277. var advicelist = response.data.data.advicelist
  2278. this.adviceList= advicelist
  2279. var outInfor = response.data.data.outInfor
  2280. this.outList = outInfor
  2281. var patients = response.data.data.patients
  2282. this.patientList= patients
  2283. this.AdviceDialogVisible= true
  2284. }
  2285. })
  2286. },
  2287. getPatientNameOne(patient_id){
  2288. var name =""
  2289. for(let i=0;i<this.patientList.length;i++){
  2290. if(patient_id == this.patientList[i].id){
  2291. name = this.patientList[i].name
  2292. }
  2293. }
  2294. return name
  2295. },
  2296. getDrugOutCount(patient_id){
  2297. var str = ""
  2298. for(let i=0;i<this.outList.length;i++){
  2299. if(patient_id == this.outList[i].patient_id){
  2300. str = this.outList[i].count + this.outList[i].count_unit
  2301. }
  2302. }
  2303. return str
  2304. }
  2305. },
  2306. };
  2307. </script>
  2308. <style rel="stylesheet/scss" lang="scss">
  2309. .app-container {
  2310. // margin: 20px;
  2311. font-size: 15px;
  2312. .filter-container {
  2313. padding-bottom: 5px;
  2314. }
  2315. .search-component {
  2316. width: 500px;
  2317. .searchBox {
  2318. width: 300px;
  2319. height: 36px;
  2320. line-height: 36px;
  2321. padding-left: 15px;
  2322. border: 1px #dcdfe6 solid;
  2323. border-right: none;
  2324. outline: none;
  2325. float: left;
  2326. border-radius: 6px 0 0 6px;
  2327. font-size: 14px;
  2328. color: #333;
  2329. background: #fff;
  2330. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  2331. }
  2332. .searchBtn {
  2333. background-color: #409eff;
  2334. color: #fff;
  2335. font-size: 15px;
  2336. text-align: center;
  2337. height: 36px;
  2338. line-height: 36px;
  2339. float: left;
  2340. outline: none;
  2341. width: 70px;
  2342. border: none;
  2343. border-radius: 0 6px 6px 0;
  2344. font-family: "Microsoft Yahei";
  2345. cursor: pointer;
  2346. }
  2347. }
  2348. .amount {
  2349. font-weight: normal;
  2350. padding: 10px 0 0 0;
  2351. color: #606266;
  2352. font-size: 14px;
  2353. span {
  2354. color: #ef2525;
  2355. font-family: "Arial";
  2356. padding: 0 2px;
  2357. }
  2358. }
  2359. }
  2360. .el-table td,
  2361. .el-table th.is-leaf,
  2362. .el-table--border,
  2363. .el-table--group {
  2364. border-color: #d0d3da;
  2365. }
  2366. .el-table--border::after,
  2367. .el-table--group::after,
  2368. .el-table::before {
  2369. background-color: #d0d3da;
  2370. }
  2371. </style>
  2372. <style>
  2373. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  2374. font-size: 12px;
  2375. }
  2376. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  2377. background: #6fb5fa;
  2378. }
  2379. .count {
  2380. color: #bd2c00;
  2381. }
  2382. .el-table td,
  2383. .el-table th.is-leaf,
  2384. .el-table--border,
  2385. .el-table--group {
  2386. border-color: #d0d3da;
  2387. }
  2388. .el-table--border::after,
  2389. .el-table--group::after,
  2390. .el-table::before {
  2391. background-color: #d0d3da;
  2392. }
  2393. /* 合并表格线样式 */
  2394. .spanClass .cell {
  2395. padding: 0 !important;
  2396. }
  2397. .spanClass .cell tr {
  2398. display: inline-block;
  2399. width: 100%;
  2400. }
  2401. .spanClass .cell tr td {
  2402. padding: 10px 0;
  2403. border-bottom: 1px solid #ebeef5;
  2404. display: block;
  2405. width: 100%;
  2406. }
  2407. .spanClass .cell tr:last-of-type td {
  2408. border-bottom: none;
  2409. }
  2410. </style>