stockOutOrder.vue 52KB

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