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

stockInOrder.vue 50KB

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