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

stockInOrder.vue 51KB

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