index.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <div class="query-box">
  11. <div class="query-box__left">
  12. <el-form-item label="" prop="keepingTime">
  13. <!-- <el-date-picker
  14. clearable
  15. size="small"
  16. v-model="queryParams.keepingTime"
  17. type="date"
  18. value-format="yyyy-MM-dd"
  19. placeholder="选择盘存时间"
  20. >
  21. </el-date-picker> -->
  22. <el-form-item prop="tiem">
  23. <el-date-picker
  24. size="small"
  25. style="width:240px"
  26. v-model="time"
  27. type="daterange"
  28. :clearable="false"
  29. range-separator="至"
  30. value-format="yyyy-MM-dd"
  31. start-placeholder="开始日期"
  32. end-placeholder="结束日期"
  33. >
  34. </el-date-picker>
  35. </el-form-item>
  36. </el-form-item>
  37. <el-form-item label="" prop="type">
  38. <el-select
  39. style="width:160px"
  40. v-model="queryParams.type"
  41. placeholder="请选择盘存单类型"
  42. >
  43. <el-option
  44. v-for="item in typeArr"
  45. :key="item.id"
  46. :label="item.name"
  47. :value="item.id"
  48. ></el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="" prop="state">
  52. <el-select placeholder="请选择盘存状态" v-model="queryParams.state" style="width:160px">
  53. <el-option
  54. v-for="item in stateArr"
  55. :key="item.id"
  56. :value="item.id"
  57. :label="item.name"
  58. ></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item>
  62. <el-button
  63. type="primary"
  64. icon="el-icon-search"
  65. size="mini"
  66. @click="handleQuery"
  67. >搜索</el-button
  68. >
  69. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  70. >重置</el-button
  71. >
  72. <el-button
  73. type="primary"
  74. plain
  75. size="mini"
  76. :loading="exportLoading"
  77. v-hasPermi="['inventory:takeInventory:export']"
  78. @click="handleOpen"
  79. >{{ stateOpen == 0 ? "开始盘存" : "结束盘存" }}</el-button
  80. >
  81. <el-button
  82. type="primary"
  83. plain
  84. icon="el-icon-plus"
  85. size="mini"
  86. @click="handleAdd"
  87. v-hasPermi="['inventory:takeInventory:add']"
  88. >新增</el-button
  89. >
  90. <el-button type="primary" plain icon="el-icon-s-check" size="mini" @click="summary"
  91. >汇总</el-button
  92. >
  93. </el-form-item>
  94. </div>
  95. </div>
  96. </el-form>
  97. <!-- <el-row :gutter="10" class="mb8">
  98. <el-col :span="1.5">
  99. <el-button
  100. type="primary"
  101. plain
  102. size="mini"
  103. :loading="exportLoading"
  104. v-hasPermi="['inventory:takeInventory:export']"
  105. >开始盘存/结束盘存</el-button
  106. >
  107. </el-col>
  108. <el-col :span="1.5">
  109. <el-button
  110. type="primary"
  111. plain
  112. icon="el-icon-plus"
  113. size="mini"
  114. @click="handleAdd"
  115. v-hasPermi="['inventory:takeInventory:add']"
  116. >新增</el-button
  117. >
  118. </el-col>
  119. <el-col :span="1.5">
  120. <el-button
  121. type="danger"
  122. plain
  123. icon="el-icon-delete"
  124. size="mini"
  125. :disabled="multiple"
  126. v-hasPermi="['inventory:takeInventory:remove']"
  127. >汇总</el-button
  128. >
  129. </el-col>
  130. </el-row> -->
  131. <el-table
  132. v-loading="loading"
  133. :data="takeInventoryList"
  134. @selection-change="handleSelectionChange"
  135. border
  136. size="mini">
  137. <el-table-column type="index" width="55" align="center" label="序号" />
  138. <el-table-column label="盘存单号" align="center" prop="code" />
  139. <el-table-column label="状态" align="center" prop="state">
  140. <template slot-scope="scope">
  141. <dict-tag :options="stateArr" :value="scope.row.state" />
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="盘存类型" align="center" prop="type">
  145. <template slot-scope="scope">
  146. <dict-tag :options="typeArr" :value="scope.row.type" />
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="盘存总数" align="center" prop="num" />
  150. <el-table-column
  151. label="盘存零售总金额"
  152. align="center"
  153. prop="amount"
  154. />
  155. <el-table-column label="制单人" align="center" prop="createBy" />
  156. <el-table-column label="制单时间" align="center" prop="createTime">
  157. <!-- <template slot-scope="scope">
  158. <span>{{ parseTime(scope.row.keepingTime, "{y}-{m}-{d}") }}</span>
  159. </template> -->
  160. </el-table-column>
  161. <el-table-column label="记账人" align="center" prop="keepingBy" />
  162. <el-table-column
  163. label="记账时间"
  164. align="center"
  165. prop="keepingTime"
  166. >
  167. <!-- <template slot-scope="scope">
  168. <span>{{ parseTime(scope.row.keepingTime, "{y}-{m}-{d}") }}</span>
  169. </template> -->
  170. </el-table-column>
  171. <el-table-column
  172. label="操作"
  173. align="center"
  174. class-name="small-padding fixed-width"
  175. width="260px"
  176. fixed="right"
  177. >
  178. <template slot-scope="scope">
  179. <el-button
  180. size="mini"
  181. type="primary"
  182. style="width: 40px"
  183. @click="handleUpdate(scope.row, 1)"
  184. v-hasPermi="['inventory:takeInventory:edit']"
  185. v-if="scope.row.state == 1"
  186. >修改</el-button
  187. >
  188. <el-button
  189. size="mini"
  190. type="primary"
  191. style="width: 40px"
  192. @click="handleUpdate(scope.row, 2)"
  193. v-hasPermi="['inventory:takeInventory:edit']"
  194. >详情</el-button
  195. >
  196. <el-button
  197. size="mini"
  198. type="primary"
  199. style="width: 40px"
  200. @click="handleSubmit(scope.row)"
  201. v-hasPermi="['inventory:takeInventory:edit']"
  202. >提交</el-button
  203. >
  204. <el-button
  205. size="mini"
  206. type="primary"
  207. style="width: 40px"
  208. @click="handleUpdate(scope.row, 3)"
  209. v-if="scope.row.state == 3"
  210. v-hasPermi="['inventory:takeInventory:edit']"
  211. >记账</el-button
  212. >
  213. <el-button
  214. size="mini"
  215. type="primary"
  216. style="width: 40px"
  217. @click="handleDelete(scope.row)"
  218. v-if="scope.row.state==1||scope.row.state==3"
  219. v-hasPermi="['inventory:takeInventory:remove']"
  220. >删除</el-button
  221. >
  222. </template>
  223. </el-table-column>
  224. </el-table>
  225. <pagination
  226. v-show="total > 0"
  227. :total="total"
  228. :page.sync="queryParams.pageNum"
  229. :limit.sync="queryParams.pageSize"
  230. @pagination="getList"
  231. />
  232. <el-input v-model="form.mac" style="display: none" disabled id="T6" />
  233. <!-- 添加或修改盘存单对话框 -->
  234. <el-dialog
  235. :title="title"
  236. :visible.sync="open"
  237. width="1180px"
  238. append-to-body>
  239. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  240. <el-row :gutter="20">
  241. <el-col :span="6">
  242. <el-form-item label="盘存单号" prop="code">
  243. <el-input
  244. v-model="form.code"
  245. placeholder="请输入盘存单号"
  246. disabled
  247. />
  248. </el-form-item>
  249. </el-col>
  250. <el-col :span="6">
  251. <el-form-item label="备注" prop="remarks">
  252. <el-input
  253. v-model="form.remarks"
  254. placeholder="请输入备注"
  255. :disabled="disableDetails"
  256. />
  257. </el-form-item>
  258. </el-col>
  259. </el-row>
  260. <el-row :gutter="20">
  261. <el-col :span="6">
  262. <el-form-item label="制单人" prop="createBy">
  263. <el-input v-if="form.createBy" v-model="form.createBy" disabled style="width: 100%"></el-input>
  264. <el-input v-else :value="createBy" disabled style="width: 100%"></el-input>
  265. </el-form-item>
  266. </el-col>
  267. <el-col :span="6">
  268. <el-form-item label="制单时间" prop="createTime">
  269. <el-input v-if="form.createTime" v-model="form.createTime" disabled style="width: 100%"></el-input>
  270. <el-input v-else v-model="createTime" disabled style="width: 100%"></el-input>
  271. </el-form-item>
  272. </el-col>
  273. <el-col :span="6">
  274. <el-form-item label="记账人" prop="keepingBy">
  275. <el-input v-if="form.keepingBy" v-model="form.keepingBy" disabled style="width: 100%"></el-input>
  276. <template v-else>
  277. <el-input v-if="num==3" :value="createBy" disabled style="width: 100%"></el-input>
  278. <el-input v-else value="" disabled style="width: 100%"></el-input>
  279. </template>
  280. </el-form-item>
  281. </el-col>
  282. <el-col :span="6">
  283. <el-form-item label="记账时间" prop="keepingTime">
  284. <el-input v-if="form.keepingTime" v-model="form.keepingTime" disabled style="width: 100%"></el-input>
  285. <template v-else>
  286. <el-input v-if="num==3" :value="createTime" disabled style="width: 100%"></el-input>
  287. <el-input v-else value="" disabled style="width: 100%"></el-input>
  288. </template>
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. <el-divider content-position="center">盘存单详情信息</el-divider>
  293. <el-row :gutter="10" class="mb8">
  294. <el-col :span="1.5">
  295. <el-button
  296. type="primary"
  297. icon="el-icon-plus"
  298. size="mini"
  299. @click="handleAddWarehouseDetail"
  300. v-if="!disableDetails"
  301. >添加</el-button
  302. >
  303. </el-col>
  304. <el-col :span="1.5">
  305. <el-button
  306. type="danger"
  307. icon="el-icon-delete"
  308. size="mini"
  309. @click="handleDeleteWarehouseDetail"
  310. v-if="!disableDetails"
  311. >删除</el-button
  312. >
  313. </el-col>
  314. </el-row>
  315. <el-table
  316. :data="takeInventoryListDetail"
  317. :row-class-name="rowTakeDetailIndex"
  318. @selection-change="handleTakeDetailSelectionChange"
  319. ref="takeInventoryDetail"
  320. border
  321. size="mini"
  322. :summary-method="getSummaries"
  323. show-summary>
  324. <el-table-column type="selection" width="80" align="center" />
  325. <el-table-column
  326. label="序号"
  327. align="center"
  328. prop="index"
  329. width="65"
  330. />
  331. <el-table-column
  332. label="药品名称"
  333. prop="drugsName"
  334. width="110"
  335. align="center"
  336. >
  337. <template slot-scope="scope">
  338. <selectOutTable v-if="open" type="deal" :pharmacyId="form.pharmacyId" :index="scope.$index" :disableDetails="disableDetails" :info="scope.row" @selectChange="selectChange"></selectOutTable>
  339. </template>
  340. </el-table-column>
  341. <el-table-column
  342. label="药品类型"
  343. prop="specsName"
  344. width="110"
  345. align="center"
  346. >
  347. <template slot-scope="scope">
  348. <span v-if="scope.row.drugsType">{{drugsTypeOptions.length&&drugsTypeOptions.find(v=>v.dictValue==scope.row.drugsType)&&drugsTypeOptions.find(v=>v.dictValue==scope.row.drugsType).dictLabel}}</span>
  349. </template>
  350. </el-table-column>
  351. <el-table-column
  352. label="药品规格"
  353. prop="specsName"
  354. width="110"
  355. align="center"
  356. >
  357. <template slot-scope="scope"><span>{{scope.row.specsName}}</span></template>
  358. </el-table-column>
  359. <el-table-column
  360. label="药品产地"
  361. prop="priceName"
  362. width="110"
  363. align="center"
  364. ></el-table-column>
  365. <el-table-column
  366. label="生产批号"
  367. prop="productionCode"
  368. align="center"
  369. width="180"
  370. ></el-table-column>
  371. <el-table-column
  372. label="药品单位"
  373. prop="packingUnit"
  374. width="110"
  375. align="center"
  376. >
  377. <template slot-scope="scope">
  378. <dict-tag v-if="scope.row.packingUnit" :options="unitArr" :value="scope.row.packingUnit" />
  379. </template>
  380. </el-table-column>
  381. <el-table-column
  382. label="库存数量"
  383. prop="stock"
  384. align="center"
  385. width="110"
  386. ></el-table-column>
  387. <el-table-column
  388. label="实际库存数"
  389. align="center"
  390. prop="takeNum"
  391. width="110"
  392. >
  393. <template slot-scope="scope">
  394. <el-input-number
  395. v-model="scope.row.takeNum"
  396. placeholder="请输入"
  397. :disabled="disableDetails"
  398. :controls="false"
  399. style="width:100%"
  400. />
  401. </template>
  402. </el-table-column>
  403. <el-table-column
  404. label="盈亏数"
  405. prop="profitLossNum"
  406. align="center"
  407. width="110"
  408. >
  409. <template slot-scope="scope">
  410. <div>{{scope.row.takeNum-scope.row.stock}}</div>
  411. </template>
  412. </el-table-column>
  413. <el-table-column
  414. label="进货单价"
  415. prop="purchasePrice"
  416. align="center"
  417. width="110"
  418. >
  419. <template slot-scope="scope"><span>{{scope.row.purchasePrice}}</span></template>
  420. </el-table-column>
  421. <el-table-column
  422. label="进货总价"
  423. prop="purchasePrice"
  424. align="center"
  425. width="110"
  426. >
  427. <template slot-scope="scope">
  428. <div>{{(scope.row.purchasePrice * scope.row.stock).toFixed(4)}}
  429. </div>
  430. </template>
  431. </el-table-column>
  432. <el-table-column
  433. label="盈亏进价金额"
  434. prop="stock"
  435. align="center"
  436. width="110"
  437. >
  438. <template slot-scope="scope">
  439. <div>{{(scope.row.purchasePrice *(scope.row.takeNum-scope.row.stock)).toFixed(4)}}</div>
  440. </template>
  441. </el-table-column>
  442. <el-table-column
  443. label="零售单价"
  444. prop="retailPrice"
  445. width="110"
  446. align="center"
  447. >
  448. <template slot-scope="scope"><span>{{scope.row.retailPrice}}</span></template>
  449. </el-table-column>
  450. <el-table-column
  451. label="零售总价"
  452. prop="retailPrice"
  453. width="110"
  454. align="center"
  455. >
  456. <template slot-scope="scope">
  457. {{(scope.row.retailPrice * scope.row.stock).toFixed(4)}}
  458. </template>
  459. </el-table-column>
  460. <el-table-column
  461. label="盈亏零售金额"
  462. prop="stock"
  463. align="center"
  464. width="110"
  465. >
  466. <template slot-scope="scope">
  467. <div>{{(scope.row.retailPrice *(scope.row.takeNum-scope.row.stock)).toFixed(4)}}</div>
  468. </template>
  469. </el-table-column>
  470. <el-table-column
  471. label="药品期效"
  472. prop="validTime"
  473. width="150"
  474. align="center"
  475. ></el-table-column>
  476. <el-table-column
  477. label="批准文号"
  478. prop="approvalCode"
  479. align="center"
  480. width="110"
  481. ></el-table-column>
  482. <el-table-column
  483. label="摆放位置"
  484. prop="site"
  485. width="110"
  486. align="center"
  487. ></el-table-column>
  488. </el-table>
  489. </el-form>
  490. <div slot="footer" class="dialog-footer">
  491. <el-button
  492. type="primary"
  493. @click="submitForm"
  494. v-if="num !== 2 && num !== 3"
  495. >确 定</el-button
  496. >
  497. <el-button @click="handleKeeping" v-if="num === 3">记账</el-button>
  498. <el-button @click="cancel">取 消</el-button>
  499. </div>n
  500. </el-dialog>
  501. <el-dialog title="汇总单" :visible.sync="summaryVisible" width="90%">
  502. <el-table :data="summaryList" size="mini">
  503. <el-table-column label="序号" align="center" type="index" width="65"></el-table-column>
  504. <el-table-column label="药品名称" prop="drugsName" width="110" align="center"></el-table-column>
  505. <el-table-column label="药品类型" prop="specsName" width="110" align="center">
  506. <template slot-scope="scope">
  507. <span v-if="scope.row.drugsType">{{drugsTypeOptions.find(v=>v.dictValue==scope.row.drugsType)&&drugsTypeOptions.find(v=>v.dictValue==scope.row.drugsType).dictLabel}}</span>
  508. </template>
  509. </el-table-column>
  510. <el-table-column label="药品规格" prop="specsName" width="110" align="center"></el-table-column>
  511. <el-table-column label="药品产地" prop="priceName" width="110" align="center"></el-table-column>
  512. <el-table-column label="生产批号" prop="productionCode" align="center" width="180"></el-table-column>
  513. <el-table-column label="药品单位" prop="packingUnit" width="110" align="center">
  514. <template slot-scope="scope">
  515. <dict-tag v-if="scope.row.packingUnit" :options="unitArr" :value="scope.row.packingUnit" />
  516. </template>
  517. </el-table-column>
  518. <el-table-column label="库存数量" prop="stock" align="center" width="110"></el-table-column>
  519. <!-- <el-table-column label="报损数量" prop="takeNum" align="cneter" width="110"></el-table-column> -->
  520. <el-table-column label="进货单价" prop="purchasePrice" align="center" width="110"></el-table-column>
  521. <el-table-column label="进货总价" align="center" width="110">
  522. <template slot-scope="scope">
  523. <div>{{ (scope.row.purchasePrice * scope.row.stock).toFixed(4) }}</div>
  524. </template>
  525. </el-table-column>
  526. <el-table-column label="零售单价" prop="retailPrice" width="110" align="center"></el-table-column>
  527. <el-table-column label="零售总价" width="110" align="center">
  528. <template slot-scope="scope">
  529. <div>
  530. {{ (scope.row.retailPrice * scope.row.stock).toFixed(4) }}
  531. </div>
  532. </template>
  533. </el-table-column>
  534. <el-table-column label="药品效期" prop="validTime" width="155" align="center"></el-table-column>
  535. <el-table-column label="批准文号" prop="approvalCode" align="center" width="110"></el-table-column>
  536. <el-table-column label="摆放位置" prop="site" width="110" align="center"></el-table-column>
  537. </el-table>
  538. </el-dialog>
  539. </div>
  540. </template>
  541. <script>
  542. import {
  543. listTakeInventory,
  544. getTakeInventory,
  545. delTakeInventory,
  546. addTakeInventory,
  547. updateTakeInventory,
  548. exportTakeInventory,
  549. submit,
  550. keeping,
  551. start,
  552. summaryMethod
  553. } from "@/api/inventory/takeInventory";
  554. import { getTime } from "@/api/inventory/forward";
  555. import { detailList } from "@/api/inventory/inventory";
  556. import { getLodop } from "@/assets/js/LodopFuncs";
  557. import selectOutTable from '@/components/selectTable/selectOutTable.vue'
  558. import { listSystemWin } from "@/api/inventory/SystemWin";
  559. export default {
  560. name: "TakeInventory",
  561. components: {
  562. selectOutTable
  563. },
  564. data() {
  565. return {
  566. summaryVisible: false,
  567. summaryList: [],
  568. time: [],
  569. BtnState: 1,
  570. num: null,
  571. specsArr: [],
  572. priceArr: [],
  573. productionCodeArr: [],
  574. drugsArr: [],
  575. stateOpen: "",
  576. typeArr: [
  577. { name: "窗口盘存单", id: "1" },
  578. { name: "汇总盘存单", id: "2" },
  579. ],
  580. stetaArr: [
  581. { name: "制单", id: "1" },
  582. { name: "提交", id: "2" },
  583. { name: "汇总", id: "3" },
  584. { name: "记账", id: "4" },
  585. ],
  586. disableDetails: false,
  587. drugsTypeOptions: [],
  588. unitOptions: [],
  589. // 遮罩层
  590. loading: true,
  591. // 导出遮罩层
  592. exportLoading: false,
  593. // 选中数组
  594. ids: [],
  595. // 非单个禁用
  596. single: true,
  597. // 非多个禁用
  598. multiple: true,
  599. // 显示搜索条件
  600. showSearch: true,
  601. // 总条数
  602. total: 0,
  603. // 盘存单表格数据
  604. takeInventoryList: [],
  605. takeInventoryListDetail: [
  606. {
  607. drugsId: "",
  608. specsId: "",
  609. riceId: "",
  610. priceId: "",
  611. stock: "",
  612. takeNum: "",
  613. purchasePrice: "",
  614. retailPrice: "",
  615. approvalCode: "",
  616. site: "",
  617. productionCode: "",
  618. validTime: "",
  619. specsArr: [],
  620. priceArr: [],
  621. productionCodeArr: [],
  622. },
  623. ],
  624. // 子表选中数据
  625. checkedWarehouseDetail: [],
  626. // 弹出层标题
  627. title: "",
  628. // 是否显示弹出层
  629. open: false,
  630. // 查询参数
  631. queryParams: {
  632. pageNum: 1,
  633. pageSize: 10,
  634. code: null,
  635. pharmacyId: null,
  636. remarks: null,
  637. keepingBy: null,
  638. keepingTime: null,
  639. state: null,
  640. del: 0,
  641. pharmacyId: window.localStorage.getItem("pharmacyId"),
  642. time: [],
  643. },
  644. // 表单参数
  645. form: {
  646. pharmacyId: window.localStorage.getItem("pharmacyId"),
  647. keepingBy: null,
  648. createBy: null,
  649. },
  650. // 表单校验
  651. rules: {
  652. pharmacyId: [
  653. { required: true, message: "药房id不能为空", trigger: "blur" },
  654. ],
  655. },
  656. stateArr: [
  657. { name: "制单", id: "1" },
  658. { name: "提交", id: "2" },
  659. { name: "汇总", id: "3" },
  660. { name: "记账", id: "4" },
  661. ],
  662. rowId: null,
  663. mac: '',
  664. unitArr: [],
  665. createBy: '',
  666. createTime: ''
  667. };
  668. },
  669. created() {
  670. this.createBy = localStorage.getItem('userName')
  671. this.createTime = this.dayjs().format("YYYY-MM-DD HH:mm:ss")
  672. this.getDicts("unit").then((response) => {
  673. this.unitArr = response.data;
  674. });
  675. this.getTimeApi();
  676. this.getDicts("drugs_type").then((response) => {
  677. // response.data.map((item) => {
  678. // this.drugsTypeOptions[item.dictValue] = item.dictLabel;
  679. // });
  680. this.drugsTypeOptions = response.data;
  681. });
  682. this.getDicts("unit").then((response) => {
  683. // response.data.map((item) => {
  684. // this.unitOptions[item.dictValue] = item.dictLabel;
  685. // });
  686. this.unitOptions = response.data;
  687. });
  688. this.getListDrugs();
  689. listSystemWin({
  690. pageNum: 1,
  691. pageSize: 1
  692. }).then((response) => {
  693. //console.log(response)
  694. if (response.rows && response.rows.length) {
  695. this.mac = response.rows[0].uuid
  696. }
  697. });
  698. },
  699. methods: {
  700. summary () {
  701. if (!this.mac) {
  702. return this.msgError('请先到窗口设置里添加网卡标注')
  703. }
  704. var startTime = ''
  705. var endTime = ''
  706. if (this.time && this.time.length) {
  707. startTime = this.formatTime(this.time[0], 'yyyy-MM-dd')
  708. endTime = this.formatTime(this.time[1], 'yyyy-MM-dd')
  709. } else {
  710. startTime = endTime = ''
  711. }
  712. summaryMethod({
  713. startTime,
  714. endTime,
  715. pharmacyId: localStorage.getItem("pharmacyId"),
  716. mac: this.mac
  717. }).then(res => {
  718. this.msgSuccess(res.msg)
  719. this.getList()
  720. this.summaryList = res.data.takeInventoryListDetail
  721. this.summaryVisible = true
  722. })
  723. },
  724. //获取最新结转时间
  725. getTimeApi() {
  726. getTime().then((res) => {
  727. res.msg
  728. ? this.time.push(new Date(res.msg))
  729. : this.time.push(
  730. new Date(
  731. this.dayjs().startOf("month").format("YYYY-MM-DD") + " 00:00:00"
  732. )
  733. ); // 回显开始时间
  734. this.time.push(
  735. new Date(this.dayjs().format("YYYY-MM-DD") + " 00:00:00")
  736. ); // 回显结束时间
  737. this.getList();
  738. });
  739. },
  740. /** 表单合计 **/
  741. getSummaries(param) {
  742. const { columns, data } = param;
  743. const sums = [];
  744. columns.forEach((column, index) => {
  745. if (index === 0) {
  746. sums[index] = "总价";
  747. return;
  748. }
  749. const values = data.map((item) => Number(item[column.property]));
  750. if (index === 8 || index === 9|| index === 10 || index === 11 || index === 14) {
  751. sums[index] = values.reduce((prev, curr) => {
  752. const value = Number(curr);
  753. if (!isNaN(value)) {
  754. return prev + curr;
  755. } else {
  756. return prev;
  757. }
  758. }, 0);
  759. sums[index] = sums[index].toFixed(4);
  760. } else {
  761. sums[index] = "/";
  762. }
  763. if (index === 10) { // 盈亏数
  764. let num = [];
  765. data.map((item) => {
  766. num.push(item.takeNum - item.stock);
  767. });
  768. let sum = num.reduce(function (prev, cur, index, array) {
  769. return prev + cur;
  770. });
  771. sums[10] = (sum-0).toFixed(4);
  772. }
  773. if (index === 12) {//进货总价
  774. let num = [];
  775. data.map((item) => {
  776. num.push(item.purchasePrice * item.stock);
  777. });
  778. let sum = num.reduce(function (prev, cur, index, array) {
  779. return prev + cur;
  780. });
  781. sums[12] = (sum-0).toFixed(4);
  782. }
  783. if (index === 13) {//盈亏进货金额
  784. let num = [];
  785. data.map((item) => {
  786. num.push(item.purchasePrice * (item.takeNum - item.stock))
  787. let sum = num.reduce(function (prev, cur, index, array) {
  788. return prev + cur;
  789. });
  790. sums[13] = (sum-0).toFixed(4);;
  791. })
  792. }
  793. if (index === 15) {//盈亏零售金额
  794. let num = [];
  795. data.map((item) => {
  796. num.push(item.retailPrice *item.stock);
  797. });
  798. let sum = num.reduce(function (prev, cur, index, array) {
  799. return prev + cur;
  800. });
  801. sums[15] = (sum-0).toFixed(4);
  802. }
  803. if (index === 16) {
  804. let num = [];
  805. data.map((item) => {
  806. num.push(
  807. item.retailPrice
  808. ? item.retailPrice * (item.takeNum - item.stock)
  809. : 0
  810. );
  811. });
  812. let sum = num.reduce(function (prev, cur, index, array) {
  813. return prev + cur;
  814. });
  815. sums[16] = (sum-0).toFixed(4);
  816. }
  817. });
  818. return sums;
  819. },
  820. getUUID() {
  821. // uUID().then((res) => {
  822. // // //console.log(res, "2323");
  823. // this.form.uuid = res.msg;
  824. // });
  825. this.getSystemInfo(
  826. "NetworkAdapter.1.PhysicalAddress",
  827. document.getElementById("T6")
  828. );
  829. },
  830. //提交
  831. handleSubmit(e) {
  832. // //console.log(e.id)
  833. const id = e.id;
  834. this.$confirm("确定要提交吗?提交后不可修改盘存单", "警告", {
  835. confirmButtonText: "确定",
  836. cancelButtonText: "取消",
  837. type: "warning",
  838. }).then(() => {
  839. //console.log(id);
  840. submit(id).then((res) => {
  841. this.getList();
  842. });
  843. });
  844. },
  845. //记账
  846. handleKeeping() {
  847. //console.log(this.rowId);
  848. keeping(this.rowId).then((res) => {
  849. this.open = false;
  850. this.msgSuccess("记账成功");
  851. this.getList()
  852. });
  853. },
  854. /** 出库单详情序号 */
  855. rowTakeDetailIndex({ row, rowIndex }) {
  856. row.index = rowIndex + 1;
  857. },
  858. //获取药品名称
  859. getListDrugs() {
  860. detailList({ pharmacyId: window.localStorage.getItem("pharmacyId") }).then(
  861. (res) => {
  862. this.drugsArr = res.data;
  863. }
  864. );
  865. },
  866. selectChange (data) {
  867. var index = data.index
  868. this.curIndex = index
  869. var r = data.data
  870. /*this.takeInventoryListDetail[index].drugsId = r.drugsId;
  871. this.takeInventoryListDetail[index].drugsType = String(r.drugsType);
  872. this.takeInventoryListDetail[index].specsId = r.specsId;
  873. this.takeInventoryListDetail[index].priceId = r.priceId;
  874. this.takeInventoryListDetail[index].placeName = r.placeName;
  875. this.takeInventoryListDetail[index].specsName = r.drugsSpecsName;
  876. //this.takeInventoryListDetail[index].purchasePrice = r.purchasePrice;
  877. this.takeInventoryListDetail[index].retailPrice = r.retailPrice;
  878. this.takeInventoryListDetail[index].approvalCode = r.approvalCode;
  879. this.takeInventoryListDetail[index].packingUnit = r.packingUnit;
  880. this.takeInventoryListDetail[index].drugsType = r.drugsType;
  881. this.takeInventoryListDetail[index].validTime = r.validTime;
  882. //this.takeInventoryListDetail[index].takeNum = r.store;
  883. this.$set(this.takeInventoryListDetail[index], "specsArr", data.result);
  884. this.takeInventoryListDetail[index].productionCode = r.productionCode;
  885. this.takeInventoryListDetail[index].purchasePrice = r.purchasePrice;
  886. this.takeInventoryListDetail[index].takeNum = r.stock;*/
  887. this.takeInventoryListDetail[index].drugsId = r.drugsId;
  888. this.takeInventoryListDetail[index].drugsType = String(r.drugsType);
  889. this.takeInventoryListDetail[index].specsId = r.specsId;
  890. this.takeInventoryListDetail[index].priceId = r.priceId;
  891. this.takeInventoryListDetail[index].dosageSizeUnit = r.dosageSizeUnit;
  892. this.takeInventoryListDetail[index].specsName = r.specsName;
  893. this.takeInventoryListDetail[index].drugsName = r.drugsName;
  894. this.takeInventoryListDetail[index].inventoryId = r.inventoryId;
  895. this.takeInventoryListDetail[index].priceName = r.priceName;
  896. this.takeInventoryListDetail[index].retailPrice = r.retailPrice;
  897. this.takeInventoryListDetail[index].approvalCode = r.approvalCode;
  898. this.takeInventoryListDetail[index].site = r.site;
  899. this.takeInventoryListDetail[index].validTime = r.validTime;
  900. this.takeInventoryListDetail[index].packingUnit = r.packingUnit;
  901. this.takeInventoryListDetail[index].drugsType = r.drugsType;
  902. this.takeInventoryListDetail[index].validTime = r.validTime;
  903. this.$set(this.takeInventoryListDetail[index], "specsArr", data.result);
  904. this.takeInventoryListDetail[index].productionCode = r.productionCode;
  905. this.takeInventoryListDetail[index].purchasePrice = r.purchasePrice;
  906. this.takeInventoryListDetail[index].stock = r.stock;
  907. },
  908. //通过药品名称获取药品类型
  909. /*handleDrugsId(e, row) {
  910. let newArr = this.drugsArr.filter((item) => {
  911. return item.drugsId === e;
  912. });
  913. this.drugsId = e;
  914. this.takeInventoryListDetail[row.$index].drugsType = String(
  915. newArr[0].drugsType
  916. );
  917. //console.log(newArr, "88887");
  918. this.getListSpecs(e, row.$index);
  919. this.takeInventoryListDetail[row.$index].specsId = "";
  920. this.takeInventoryListDetail[row.$index].priceId = "";
  921. this.takeInventoryListDetail[row.$index].purchasePrice = "";
  922. this.takeInventoryListDetail[row.$index].retailPrice = "";
  923. this.takeInventoryListDetail[row.$index].approvalCode = "";
  924. this.takeInventoryListDetail[row.$index].packingUnit = "";
  925. },
  926. //获取药品规格
  927. getListSpecs(drugsId, index) {
  928. let pharmacyId = window.localStorage.getItem("pharmacyId");
  929. oneList({ drugsId, pharmacyId }).then((res) => {
  930. if (res.code === 200) {
  931. this.$set(this.takeInventoryListDetail[index], "specsArr", res.data);
  932. }
  933. });
  934. },*/
  935. //通过药品规格获取
  936. handleSpecsId(e, row) {
  937. let newArr = this.takeInventoryListDetail[row.$index].specsArr.filter(
  938. (item) => {
  939. return item.specsId === e;
  940. }
  941. );
  942. this.specsId = e;
  943. this.takeInventoryListDetail[row.$index].packingUnit = String(
  944. newArr[0].packingUnit
  945. );
  946. this.getListPrice(e, row.$index);
  947. this.takeInventoryListDetail[row.$index].priceId = "";
  948. this.takeInventoryListDetail[row.$index].purchasePrice = "";
  949. this.takeInventoryListDetail[row.$index].retailPrice = "";
  950. this.takeInventoryListDetail[row.$index].approvalCode = "";
  951. },
  952. //获取产地
  953. getListPrice(specsId, index) {
  954. let pharmacyId = window.localStorage.getItem("pharmacyId");
  955. detailList({ specsId, pharmacyId, drugsId: this.drugsId }).then((res) => {
  956. // this.priceArr = res.rows;
  957. this.$set(
  958. this.takeInventoryListDetail[index],
  959. "productionCodeArr",
  960. res.data
  961. );
  962. this.$set(this.takeInventoryListDetail[index], "priceArr", res.data);
  963. });
  964. },
  965. //通过药品产地获取
  966. handlePriceId(e, row) {
  967. let newArr = this.takeInventoryListDetail[row.$index].priceArr.filter(
  968. (item) => {
  969. return item.priceId === e;
  970. }
  971. );
  972. this.priceId = e;
  973. this.takeInventoryListDetail[row.$index].priceId = e;
  974. // this.productionCode = newArr[0].approvalCode;
  975. // this.takeInventoryListDetail[row.$index].purchasePrice =
  976. // newArr[0].purchasePrice;
  977. // this.takeInventoryListDetail[row.$index].retailPrice =
  978. // newArr[0].retailPrice;
  979. // this.takeInventoryListDetail[row.$index].approvalCode =
  980. // newArr[0].approvalCode;
  981. // this.takeInventoryListDetail[row.$index].productionCode =
  982. // newArr[0].productionCode;
  983. // this.takeInventoryListDetail[row.$index].validTime = newArr[0].validTime;
  984. // this.takeInventoryListDetail[row.$index].site = newArr[0].site;
  985. },
  986. //通过生产批号选择
  987. handleCode(e, row) {
  988. let newArr = this.takeInventoryListDetail[
  989. row.$index
  990. ].productionCodeArr.filter((item) => {
  991. return item.productionCode === e;
  992. });
  993. this.productionCode = newArr[0].approvalCode;
  994. this.takeInventoryListDetail[row.$index].purchasePrice =
  995. newArr[0].purchasePrice;
  996. this.takeInventoryListDetail[row.$index].retailPrice =
  997. newArr[0].retailPrice;
  998. this.takeInventoryListDetail[row.$index].approvalCode =
  999. newArr[0].approvalCode;
  1000. this.takeInventoryListDetail[row.$index].validTime = newArr[0].validTime;
  1001. this.takeInventoryListDetail[row.$index].site = newArr[0].site;
  1002. this.productionCode = newArr[0].productionCode;
  1003. if (
  1004. window.localStorage.getItem("pharmacyId") &&
  1005. newArr[0].productionCode &&
  1006. this.drugsId &&
  1007. this.specsId &&
  1008. this.priceId
  1009. ) {
  1010. this.getOneList(row.$index);
  1011. }
  1012. },
  1013. //获取库存数量
  1014. getOneList(index) {
  1015. let params = {
  1016. pharmacyId: window.localStorage.getItem("pharmacyId"),
  1017. drugsId: this.drugsId,
  1018. specsId: this.specsId,
  1019. priceId: this.priceId,
  1020. productionCode: this.productionCode,
  1021. };
  1022. detailList(params).then((res) => {
  1023. //console.log(res, 99999999);
  1024. res.data.length < 0
  1025. ? this.$set(this.takeInventoryListDetail[index], "inventory", "0")
  1026. : this.$set(
  1027. this.takeInventoryListDetail[index],
  1028. "inventory",
  1029. res.data[0].stock
  1030. );
  1031. });
  1032. },
  1033. /** 查询盘存单列表 */
  1034. getList() {
  1035. if (this.time && this.time.length) {
  1036. this.queryParams.startTime = this.formatTime(this.time[0], 'yyyy-MM-dd')
  1037. this.queryParams.endTime = this.formatTime(this.time[1], 'yyyy-MM-dd')
  1038. } else {
  1039. this.queryParams.startTime = this.queryParams.endTime = ''
  1040. }
  1041. this.loading = true;
  1042. listTakeInventory(this.queryParams).then((response) => {
  1043. this.takeInventoryList = response.rows;
  1044. this.total = response.total;
  1045. this.stateOpen = response.state;
  1046. this.loading = false;
  1047. });
  1048. },
  1049. //开始、结束盘存
  1050. handleOpen() {
  1051. // if (this.ids.length <= 0) {
  1052. // this.msgError("请先选择盘存");
  1053. // } else {
  1054. var startTime = ''
  1055. var endTime = ''
  1056. if (this.time && this.time.length) {
  1057. startTime = this.formatTime(this.time[0], 'yyyy-MM-dd')
  1058. endTime = this.formatTime(this.time[1], 'yyyy-MM-dd')
  1059. }
  1060. let params = {
  1061. pharmacyId: window.localStorage.getItem("pharmacyId"),
  1062. state: 1 - this.stateOpen,
  1063. startTime,
  1064. endTime
  1065. };
  1066. start(params).then((res) => {
  1067. this.getList();
  1068. if (this.stateOpen == 0) {
  1069. this.msgSuccess('成功,开始盘存')
  1070. this.stateOpen = 0
  1071. } else {
  1072. this.msgSuccess('结束盘存成功')
  1073. this.stateOpen = 1
  1074. }
  1075. });
  1076. // }
  1077. },
  1078. // 取消按钮
  1079. cancel() {
  1080. this.open = false;
  1081. this.reset();
  1082. },
  1083. // 表单重置
  1084. reset() {
  1085. this.form = {
  1086. pharmacyId: window.localStorage.getItem("pharmacyId"),
  1087. id: null,
  1088. code: null,
  1089. remarks: null,
  1090. createTime: null,
  1091. keepingTime: null,
  1092. state: null,
  1093. del: null,
  1094. drugsType: '',
  1095. keepingBy: null,
  1096. mac: this.mac,
  1097. createBy: null,
  1098. };
  1099. this.takeInventoryListDetail = [
  1100. {
  1101. drugsId: "",
  1102. specsId: "",
  1103. riceId: "",
  1104. stock: "",
  1105. takeNum: "",
  1106. priceId: "",
  1107. purchasePrice: "",
  1108. retailPrice: "",
  1109. approvalCode: "",
  1110. site: "",
  1111. productionCode: "",
  1112. validTime: "",
  1113. specsArr: [],
  1114. priceArr: [],
  1115. productionCodeArr: [],
  1116. },
  1117. ];
  1118. this.resetForm("form");
  1119. },
  1120. /** 搜索按钮操作 */
  1121. handleQuery() {
  1122. this.queryParams.pageNum = 1;
  1123. this.getList();
  1124. },
  1125. /** 重置按钮操作 */
  1126. resetQuery() {
  1127. this.resetForm("queryForm");
  1128. this.handleQuery();
  1129. },
  1130. // 多选框选中数据
  1131. handleSelectionChange(selection) {
  1132. this.ids = selection.map((item) => item.id);
  1133. this.single = selection.length !== 1;
  1134. this.multiple = !selection.length;
  1135. },
  1136. /** 新增按钮操作 */
  1137. handleAdd() {
  1138. if (!this.mac) {
  1139. return this.msgError('请先到窗口设置里添加网卡标注')
  1140. }
  1141. this.reset();
  1142. this.form.code = this.dayjs().format("YYYYMMDDHHmmssSSS");
  1143. // this.form.createTime = new Date();
  1144. // this.form.keepingTime = new Date();
  1145. //this.getUUID();
  1146. this.num = ''
  1147. this.open = true;
  1148. this.title = "添加盘存单";
  1149. this.disableDetails = false;
  1150. },
  1151. /** 修改按钮操作 */
  1152. handleUpdate(row, num) {
  1153. this.reset();
  1154. this.num = num;
  1155. const id = row.id || this.ids;
  1156. this.rowId = id;
  1157. getTakeInventory(id).then((response) => {
  1158. response.data.takeInventoryListDetail.map((item) => {
  1159. item.drugsType = String(item.drugsType);
  1160. item.packingUnit = String(item.packingUnit);
  1161. });
  1162. this.form = response.data;
  1163. this.takeInventoryListDetail = response.data.takeInventoryListDetail;
  1164. this.takeInventoryListDetail.forEach((item, index) => {
  1165. //this.getListSpecs(item.drugsId, index);
  1166. //this.getListPrice(item.specsId, index);
  1167. // this.warehousingDetails[index].packingUnit = String(item.packingUnit)
  1168. });
  1169. this.open = true;
  1170. // this.title = "修改盘存单";
  1171. if (num === 1) {
  1172. this.title = "修改盘存单";
  1173. this.disableDetails = false;
  1174. } else if (num === 2) {
  1175. this.title = "盘存单详情";
  1176. this.disableDetails = true;
  1177. } else if (num === 3) {
  1178. this.title = "记账盘存单";
  1179. this.disableDetails = true;
  1180. }
  1181. });
  1182. },
  1183. /** 出库单详情添加按钮操作 */
  1184. handleAddWarehouseDetail() {
  1185. let obj = {};
  1186. obj.drugsId = "";
  1187. obj.specsId = "";
  1188. obj.priceId = "";
  1189. obj.stock = "";
  1190. obj.takeNum = "";
  1191. obj.purchasePrice = "";
  1192. obj.retailPrice = "";
  1193. obj.approvalCode = "";
  1194. obj.site = "";
  1195. obj.productionCode = "";
  1196. obj.validTime = "";
  1197. this.takeInventoryListDetail.push(obj);
  1198. },
  1199. /** 出库单详情删除按钮操作 */
  1200. handleDeleteWarehouseDetail() {
  1201. if (this.checkedTakeDetail.length == 0) {
  1202. this.msgError("请先选择要删除的报损详情数据");
  1203. } else {
  1204. const takeInventoryListDetail = this.takeInventoryListDetail;
  1205. const checkedTakeDetail = this.checkedTakeDetail;
  1206. this.takeInventoryListDetail = takeInventoryListDetail.filter(function (
  1207. item
  1208. ) {
  1209. return checkedTakeDetail.indexOf(item.index) == -1;
  1210. });
  1211. }
  1212. },
  1213. /** 复选框选中数据 */
  1214. handleTakeDetailSelectionChange(selection) {
  1215. this.checkedTakeDetail = selection.map((item) => item.index);
  1216. },
  1217. formatTime(date, fmt) {
  1218. var date = new Date(date);
  1219. if (/(y+)/.test(fmt)) {
  1220. fmt = fmt.replace(
  1221. RegExp.$1,
  1222. (date.getFullYear() + "").substr(4 - RegExp.$1.length)
  1223. );
  1224. }
  1225. var o = {
  1226. "M+": date.getMonth() + 1,
  1227. "d+": date.getDate(),
  1228. "h+": date.getHours(),
  1229. "m+": date.getMinutes(),
  1230. "s+": date.getSeconds(),
  1231. };
  1232. for (var k in o) {
  1233. if (new RegExp("(" + k + ")").test(fmt)) {
  1234. var str = o[k] + "";
  1235. fmt = fmt.replace(
  1236. RegExp.$1,
  1237. RegExp.$1.length === 1 ? str : ("00" + str).substr(str.length)
  1238. );
  1239. }
  1240. }
  1241. return fmt;
  1242. },
  1243. /** 提交按钮 */
  1244. submitForm() {
  1245. if (this.takeInventoryListDetail.find(v => !v.stock)) {
  1246. return this.$message.warning('请输入实际库存数')
  1247. }
  1248. this.$refs["form"].validate((valid) => {
  1249. if (valid) {
  1250. //console.log(this.form)
  1251. //this.form.mac = document.getElementById("T6").value;
  1252. ////console.log(this.form.mac, "mac");
  1253. this.form.takeInventoryListDetail = this.takeInventoryListDetail;
  1254. // this.form.createTime = this.formatTime(
  1255. // this.form.createTime,
  1256. // "yyyy-MM-dd hh:mm:ss"
  1257. // );
  1258. // this.form.keepingTime = this.formatTime(
  1259. // this.form.keepingTime,
  1260. // "yyyy-MM-dd hh:mm:ss"
  1261. // );
  1262. if (this.form.id != null) {
  1263. updateTakeInventory(this.form).then((response) => {
  1264. this.msgSuccess("修改成功");
  1265. this.open = false;
  1266. this.getList();
  1267. });
  1268. } else {
  1269. addTakeInventory(this.form).then((response) => {
  1270. this.msgSuccess("新增成功");
  1271. this.open = false;
  1272. this.getList();
  1273. });
  1274. }
  1275. }
  1276. });
  1277. },
  1278. /** 删除按钮操作 */
  1279. handleDelete(row) {
  1280. const ids = row.id || this.ids;
  1281. this.$confirm("确定需要删除选中数据吗?", "警告", {
  1282. confirmButtonText: "确定",
  1283. cancelButtonText: "取消",
  1284. type: "warning",
  1285. })
  1286. .then(function () {
  1287. return delTakeInventory(ids);
  1288. })
  1289. .then(() => {
  1290. this.getList();
  1291. this.msgSuccess("删除成功");
  1292. })
  1293. .catch(() => {});
  1294. },
  1295. /** 导出按钮操作 */
  1296. async handleExport() {
  1297. this.exportLoading = true;
  1298. try {
  1299. await this.$confirm("是否确认导出所有盘存单数据项?", "警告", {
  1300. confirmButtonText: "确定",
  1301. cancelButtonText: "取消",
  1302. type: "warning",
  1303. });
  1304. const data = await exportTakeInventory(this.queryParams)
  1305. this.$message.success(`导出 ${data.name} 成功`);
  1306. } catch (e) {}
  1307. this.exportLoading = false;
  1308. },
  1309. },
  1310. };
  1311. </script>