stockOutOrder.vue 54KB

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