stockOutOrder.vue 52KB

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