stockInOrder.vue 48KB

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