stockOutOrder.vue 44KB

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