Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

stockOutOrder.vue 53KB

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