stockInDetail.vue 46KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545
  1. <template>
  2. <div>
  3. <el-button
  4. style="float: right"
  5. size="small"
  6. icon="el-icon-printer"
  7. @click="PrintAction"
  8. type="primary"
  9. >打印
  10. </el-button>
  11. <el-button
  12. style="float: right;margin-right:10px"
  13. size="small"
  14. @click="exportListDetal"
  15. type="primary"
  16. >明细导出
  17. </el-button>
  18. <el-button
  19. style="float: right;margin-right:10px"
  20. size="small"
  21. @click="exportList"
  22. type="primary"
  23. >汇总导出
  24. </el-button>
  25. <div class="cell clearfix">
  26. <label class="title"><span class="name">仓库</span> :</label>
  27. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:100px" @change="changeHouseList">
  28. <el-option
  29. v-for="(option, index) in houseList"
  30. :key="index"
  31. :label="option.storehouse_name"
  32. :value="option.id">
  33. </el-option>
  34. </el-select>
  35. <el-input
  36. size="small"
  37. style="width: 180px;"
  38. class="filter-item"
  39. v-model.trim="searchKey"
  40. placeholder="单据编码/制单人/规格名称/耗材名称"
  41. />
  42. <el-button
  43. size="small"
  44. class="filter-item"
  45. type="primary"
  46. icon="el-icon-search"
  47. @click="search"
  48. >搜索</el-button
  49. >
  50. <label class="title"><span class="name">日期查询</span> : </label>
  51. <el-date-picker
  52. size="small"
  53. v-model="start_time"
  54. prefix-icon="el-icon-date"
  55. :editable="false"
  56. style="width: 150px;"
  57. type="date"
  58. placeholder="选择日期时间"
  59. align="right"
  60. format="yyyy-MM-dd"
  61. value-format="yyyy-MM-dd"
  62. ></el-date-picker>
  63. <span class="cellLine"> - </span>
  64. <el-date-picker
  65. size="small"
  66. v-model="end_time"
  67. prefix-icon="el-icon-date"
  68. :editable="false"
  69. style="width: 150px;"
  70. type="date"
  71. placeholder="选择日期时间"
  72. align="right"
  73. format="yyyy-MM-dd"
  74. value-format="yyyy-MM-dd"
  75. ></el-date-picker>
  76. <el-button
  77. size="small"
  78. class="filter-item"
  79. type="primary"
  80. icon="el-icon-search"
  81. @click="getAllQuery"
  82. >查询</el-button
  83. >
  84. </div>
  85. <div style="margin-bottom: 10px;">
  86. <label class="title"><span class="name">耗材名称</span> : </label>
  87. <el-autocomplete
  88. class="checkSearch"
  89. popper-class="my-autocomplete"
  90. v-model="good_name"
  91. :fetch-suggestions="querySearchAsync"
  92. :trigger-on-focus="true"
  93. placeholder="请输入耗材名称"
  94. @select="handleSelect"
  95. style="width:500px;"
  96. :popper-append-to-body="true"
  97. >
  98. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  99. <template slot-scope="{ item }">
  100. <div class="name">{{ item.good_name +" " +item.specification_name + " "+item.manufacturer }}</div>
  101. </template>
  102. </el-autocomplete>
  103. <el-button
  104. style="float: right"
  105. size="small"
  106. icon="el-icon-printer"
  107. @click="BatchPrintAction"
  108. type="primary"
  109. >批量打印
  110. </el-button>
  111. </div>
  112. <!-- <el-row :gutter="12" style="margin-top: 10px"> -->
  113. <div style="width: 100%;">
  114. <el-table
  115. class="table"
  116. :data="cancelStockDate"
  117. :class="signAndWeighBoxPatients"
  118. border
  119. highlight-current-row
  120. ref="multipleTable"
  121. height="calc(100vh - 300px)"
  122. @selection-change="select"
  123. :row-style="{ color: '#303133' }"
  124. :header-cell-style="{
  125. backgroundColor: 'rgb(245, 247, 250)',
  126. color: '#606266'
  127. }"
  128. >
  129. <el-table-column label="单据编号" align="center" width="200">
  130. <template slot-scope="scope">
  131. {{ scope.row.warehousing_order }}
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="耗材类型" align="center">
  135. <template slot-scope="scope">
  136. {{ typeName(scope.row.good_type_id) }}
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="耗材批次" align="center">
  140. <template slot-scope="scope">
  141. {{ scope.row.number }}
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="耗材名称" align="center">
  145. <template slot-scope="scope">
  146. {{ typeNameOne(scope.row.good_id) }}
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="规格型号" align="center">
  150. <template slot-scope="scope">
  151. {{ specificationName(scope.row.good_id) }}
  152. </template>
  153. </el-table-column>
  154. <el-table-column label="生产厂商" align="center">
  155. <template slot-scope="scope">
  156. {{ getManufactuerName(scope.row.manufacturer) }}
  157. </template>
  158. </el-table-column>
  159. <!-- <el-table-column label="进销商" align="center">
  160. <template slot-scope="scope">
  161. {{ getDealerName(scope.row.dealer) }}
  162. </template>
  163. </el-table-column> -->
  164. <el-table-column label="操作时间" align="center">
  165. <template slot-scope="scope">
  166. {{ getTime(scope.row.Warehousing.warehousing_time) }}
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="制单人" align="center">
  170. <template slot-scope="scope">
  171. {{ getXuserName(scope.row.Warehousing.creater) }}
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="仓库名称" align="center">
  175. <template slot-scope="scope">
  176. {{getStorehouseName(scope.row.storehouse_id) }}
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="进货价" align="center">
  180. <template slot-scope="scope">
  181. {{ scope.row.price }}
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="数量" align="center">
  185. <template slot-scope="scope">
  186. {{ scope.row.warehousing_count }}
  187. </template>
  188. </el-table-column>
  189. <el-table-column label="总价" align="center">
  190. <template slot-scope="scope">
  191. <span v-if="scope.row.is_total == 0">{{
  192. getTotal(scope.row.price, scope.row.warehousing_count)
  193. }}</span>
  194. <span v-else>{{ scope.row.total }}</span>
  195. </template>
  196. </el-table-column>
  197. <el-table-column label="耗材追溯码" align="center">
  198. <template slot-scope="scope">
  199. <div @click="changeGoodCode(scope.row,scope.$index)">
  200. <el-input v-model="scope.row.good_code" placeholder="请输入耗材追溯码"></el-input>
  201. </div>
  202. </template>
  203. </el-table-column>
  204. <el-table-column label="追溯码数量" align="center">
  205. <template slot-scope="scope">
  206. {{ getGoodCode(scope.row.good_code) }}
  207. </template>
  208. </el-table-column>
  209. </el-table>
  210. </div>
  211. <el-pagination
  212. @size-change="handleSizeChange"
  213. @current-change="handleCurrentChange"
  214. :page-sizes="[10, 50, 100,500,1000]"
  215. :page-size="10"
  216. background
  217. style="margin-top:20px;float: right"
  218. layout="total, sizes, prev, pager, next, jumper"
  219. :total="total"
  220. >
  221. </el-pagination>
  222. <div>
  223. <el-dialog
  224. title="入库记录"
  225. :visible.sync="dialogVisible"
  226. width="80%"
  227. top="5vh"
  228. :close-on-click-modal="false"
  229. >
  230. <!-- 查询条件区域 -->
  231. <div class="filter-container">
  232. <el-row :gutter="20">
  233. <el-col :span="8">
  234. <span class="demonstration">日期查询:</span>
  235. <el-date-picker
  236. size="small"
  237. v-model="listQuery.start_time"
  238. prefix-icon="el-icon-date"
  239. @change="changeStartTime"
  240. :editable="false"
  241. style="width: 196px;"
  242. type="date"
  243. placeholder="选择日期时间"
  244. align="right"
  245. :picker-options="pickerOptions"
  246. format="yyyy-MM-dd"
  247. value-format="yyyy-MM-dd"
  248. ></el-date-picker>
  249. -
  250. <el-date-picker
  251. size="small"
  252. v-model="listQuery.end_time"
  253. prefix-icon="el-icon-date"
  254. @change="changeEndTime"
  255. :editable="false"
  256. style="width: 196px;"
  257. type="date"
  258. placeholder="选择日期时间"
  259. align="right"
  260. :picker-options="pickerOptions"
  261. format="yyyy-MM-dd"
  262. value-format="yyyy-MM-dd"
  263. ></el-date-picker>
  264. </el-col>
  265. <el-col :span="8">
  266. <el-autocomplete
  267. class="checkSearch"
  268. popper-class="my-autocomplete"
  269. v-model="good_name"
  270. :fetch-suggestions="querySearchAsync"
  271. :trigger-on-focus="true"
  272. placeholder="请输入耗材名称"
  273. @select="handleSelectOne"
  274. style="width:400px;"
  275. :popper-append-to-body="true"
  276. >
  277. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  278. <template slot-scope="{ item }">
  279. <div class="name">{{ item.good_name +" " +item.specification_name + " "+item.manufacturer }}</div>
  280. </template>
  281. </el-autocomplete>
  282. </el-col>
  283. <el-col :span="2">
  284. <el-button type="primary" @click="handleQuery" style="width: 100%">查询</el-button>
  285. </el-col>
  286. </el-row>
  287. </div>
  288. <!-- 操作按钮区域 -->
  289. <div class="operation-buttons" style="margin-bottom: 10px;">
  290. <el-button type="primary" @click="toGoodPrint">打印</el-button>
  291. <!-- <el-button type="primary" @click="toPrint">导出</el-button> -->
  292. </div>
  293. <!-- 表格区域 -->
  294. <el-table
  295. :data="tablePrintData"
  296. border
  297. style="width: 100%"
  298. height="60vh"
  299. v-loading="loading"
  300. @selection-change="batchSelect"
  301. element-loading-text="数据加载中"
  302. >
  303. <el-table-column align="center" type="selection" width="55">
  304. </el-table-column>
  305. <el-table-column prop="index" label="序号" width="60" align="center">
  306. <template slot-scope="scope">
  307. {{ scope.$index+1 }}
  308. </template>
  309. </el-table-column>
  310. <el-table-column prop="medicalCode" label="医保编码" width="200" align="center">
  311. <template slot-scope="scope">
  312.  {{ getSocialSecurityDirectoryCode(scope.row.good_id) }}
  313. </template>
  314. </el-table-column>
  315. <el-table-column prop="name" label="耗材名称" width="180" align="center">
  316. <template slot-scope="scope">
  317. {{ getGoodName(scope.row.good_id) }}
  318. </template>
  319. </el-table-column>
  320. <el-table-column prop="specification" label="耗材规格" width="200" align="center">
  321. <template slot-scope="scope">
  322. {{ getSpecificationName(scope.row.good_id) }}
  323. </template>
  324. </el-table-column>
  325. <el-table-column prop="unit" label="单位" width="80" align="center">
  326. <template slot-scope="scope">
  327. {{ getPackingUnit(scope.row.good_id) }}
  328. </template>
  329. </el-table-column>
  330. <el-table-column prop="batchNumber" label="批号" width="120" align="center">
  331. <template slot-scope="scope">
  332. {{ scope.row.number }}
  333. </template>
  334. </el-table-column>
  335. <el-table-column prop="productionDate" label="生产日期" width="120" align="center">
  336. <template slot-scope="scope">
  337. {{ getTime(scope.row.product_date) }}
  338. </template>
  339. </el-table-column>
  340. <el-table-column prop="expiryDate" label="有效日期" width="120" align="center">
  341. <template slot-scope="scope">
  342. {{ getTime(scope.row.expiry_date) }}
  343. </template>
  344. </el-table-column>
  345. <el-table-column prop="purchasePrice" label="进货单价" width="100" align="center">
  346. <template slot-scope="scope">
  347. {{ scope.row.price }}
  348. </template>
  349. </el-table-column>
  350. <el-table-column prop="stockQuantity" label="入库数量" width="100" align="center">
  351. <template slot-scope="scope">
  352. {{ scope.row.warehousing_count }}
  353. </template>
  354. </el-table-column>
  355. <el-table-column prop="stockAmount" label="入库金额" width="120" align="center">
  356. <template slot-scope="scope">
  357. {{ (scope.row.price * scope.row.warehousing_count).toFixed(2) }}
  358. </template>
  359. </el-table-column>
  360. <el-table-column prop="purchasePrice" label="零售价" width="100" align="center">
  361. <template slot-scope="scope">
  362. {{ scope.row.packing_price }}
  363. </template>
  364. </el-table-column>
  365. <el-table-column prop="purchasePrice" label="生产厂家" width="100" align="center">
  366. <template slot-scope="scope">
  367. {{getManufactuerName(scope.row.manufacturer) }}
  368. </template>
  369. </el-table-column>
  370. <el-table-column prop="purchasePrice" label="经销商" width="100" align="center">
  371. <template slot-scope="scope">
  372. {{getDealerName(scope.row.dealer_name) }}
  373. </template>
  374. </el-table-column>
  375. <el-table-column prop="purchasePrice" label="入库时间" width="100" align="center">
  376. <template slot-scope="scope">
  377. {{getTime(scope.row.ctime) }}
  378. </template>
  379. </el-table-column>
  380. <el-table-column prop="purchasePrice" label="备注" width="100" align="center">
  381. <template slot-scope="scope">
  382. {{scope.row.remark }}
  383. </template>
  384. </el-table-column>
  385. </el-table>
  386. <div slot="footer" class="dialog-footer">
  387. <el-button @click="dialogVisible = false">关闭</el-button>
  388. </div>
  389. </el-dialog>
  390. </div>
  391. <good-print
  392. ref="goodPrint"
  393. :visibility="isVisibility"
  394. :propsTable="propsTable"
  395. >
  396. </good-print>
  397. <el-dialog
  398. title="耗材追溯码"
  399. :visible.sync="dialogVisibleCode"
  400. width="40%">
  401. <div style="margin-bottom: 10px;">
  402. <span >追溯码个数:{{getGoodTotal() }} 个</span>
  403. </div>
  404. <span>
  405. <el-input
  406. @keyup.native="changeText"
  407. type="textarea"
  408. placeholder="请输入内容"
  409. v-model="textarea"
  410. :rows="10"
  411. >
  412. </el-input>
  413. </span>
  414. <span slot="footer" class="dialog-footer">
  415. <el-button @click="dialogVisibleCode = false">取 消</el-button>
  416. <el-button type="primary" @click="saveTextArea()">确 定</el-button>
  417. </span>
  418. </el-dialog>
  419. </div>
  420. </template>
  421. <script>
  422. import goodPrint from "../goodPrint.vue";
  423. const moment = require('moment')
  424. import { uParseTime } from "@/utils/tools";
  425. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  426. import {
  427. deleteCancelStock,
  428. GetAllConfig,
  429. getStockDetail,
  430. getPrintStockGood,
  431. getGoodDetailPrintList,
  432. postSearchGoodList,
  433. getGoodWarehosueInPrintList,
  434. changeGoodWarehouseInfo
  435. } from "@/api/stock";
  436. export default {
  437. name: "stockInDetail",
  438. components: {
  439. goodPrint,
  440. },
  441. created() {
  442. var nowDate = new Date();
  443. var nowYear = nowDate.getFullYear();
  444. var nowMonth = nowDate.getMonth() + 1;
  445. var nowDay = nowDate.getDate();
  446. this.end_time =
  447. nowYear +
  448. "-" +
  449. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  450. "-" +
  451. (nowDay < 10 ? "0" + nowDay : nowDay);
  452. nowDate.setMonth(nowDate.getMonth() - 1);
  453. nowYear = nowDate.getFullYear();
  454. nowMonth = nowDate.getMonth() + 1;
  455. nowDay = nowDate.getDate();
  456. this.start_time =
  457. nowYear +
  458. "-" +
  459. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  460. "-" +
  461. (nowDay < 10 ? "0" + nowDay : nowDay);
  462. var start_time = window.sessionStorage.getItem('start_time')
  463. var end_time = window.sessionStorage.getItem('end_time')
  464. if(start_time !=null){
  465. this.start_time = start_time
  466. }
  467. if(end_time!=null){
  468. this.end_time = end_time
  469. }
  470. window.sessionStorage.removeItem('start_time')
  471. window.sessionStorage.removeItem('end_time')
  472. this.GetCancelStock();
  473. this.GetConfigInfo();
  474. this.fetchAllAdminUsers();
  475. this.goodUnit = this.$store.getters.good_unit
  476. this.org_id = this.$store.getters.xt_user.template_info.org_id
  477. this.getGoodDetailPrintList()
  478. },
  479. data() {
  480. return {
  481. orderTypeArr: [
  482. { value: 1, label: "耗材入库单" },
  483. { value: 2, label: "其他入库单" }
  484. ],
  485. newDate: [{ name: "合计", num: "111111" }],
  486. good_name:"",
  487. searchKey: "",
  488. type: 1,
  489. page: 1,
  490. limit: 10,
  491. manufacturer_id: "",
  492. dealer_id: "",
  493. order_type: "",
  494. checked: false,
  495. total: 0,
  496. pageTotal: 0,
  497. pageSelect: 0,
  498. adminUserOptions: [],
  499. multipleSelection: [],
  500. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  501. start_time: "",
  502. cancelStockDate: [],
  503. end_time: "",
  504. goodType: [],
  505. goodInfo: [],
  506. manufacturer: [],
  507. selectedTableData: [],
  508. dealer: [],
  509. tableList:[],
  510. goodUnit:[],
  511. stockTotal:[],
  512. org_id:0,
  513. tableInfo:[],
  514. tableDataList:[],
  515. houseList:[],
  516. storehouse_id:0,
  517. manufacturerList:[],
  518. dealerList:[],
  519. currentIndex:0,
  520. good_id:0,
  521. goodKindList:[],
  522. dialogVisible:false,
  523. loading: false,
  524. queryParams: {
  525. dateRange: [],
  526. itemType: '',
  527. stockType: '',
  528. keyword: ''
  529. },
  530. listQuery:{
  531. start_time: moment().startOf('month').format('YYYY-MM-DD'),
  532. end_time:moment().endOf('month').format('YYYY-MM-DD')
  533. },
  534. tableData: [],
  535. pagination: {
  536. currentPage: 1,
  537. pageSize: 20,
  538. total: 0
  539. },
  540. tablePrintData:[],
  541. goodList:[],
  542. goodsType:[],
  543. idsList:[],
  544. printData:[],
  545. isVisibility: "",
  546. propsTable: "",
  547. textarea:"",
  548. currentRow:{},
  549. currentIndex:0,
  550. dialogVisibleCode:false,
  551. id:0,
  552. };
  553. },
  554. methods: {
  555. getGoodCode(val){
  556. var newArr = []
  557. var total = 0
  558. if(val!=undefined){
  559. newArr = val.split(",")
  560. total = newArr.length - 1
  561. if(total >0){
  562. return total
  563. }else{
  564. return ""
  565. }
  566. }
  567. },
  568. changeText(event){
  569. // 检查是否为特定的按键,例如回车键,来确认扫码枪输入完成
  570. var textAreaList = this.textarea.split(",")
  571. if (event.key === 'Enter') {
  572. var textarea = ""
  573. textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
  574. var parts = textarea.split(',')
  575. for(let i=0;i<textAreaList.length;i++){
  576. if(parts[parts.length-2] == textAreaList[i]){
  577. this.$message.error("该条码已经存在,不能重复扫码")
  578. }
  579. }
  580. const uniqueStr = [...new Set(textarea.split(','))].join(',');
  581. this.textarea = uniqueStr
  582. }
  583. },
  584. getGoodTotal(){
  585. if(this.textarea!=null){
  586. var textAreaList = this.textarea.split(",")
  587. var arr = []
  588. if(textAreaList!=null && textAreaList.length>0){
  589. for(let i=0;i<textAreaList.length;i++){
  590. if(textAreaList[i]!=""){
  591. arr.push(textAreaList[i])
  592. }
  593. }
  594. return arr.length
  595. }else{
  596. return ""
  597. }
  598. }
  599. },
  600. saveTextArea(){
  601. var params = {
  602. id:this.id,
  603. good_code:this.textarea
  604. }
  605. changeGoodWarehouseInfo(params).then(response=>{
  606. if(response.data.state == 1){
  607. this.$message.success("保存成功")
  608. for(let i=0;i<this.cancelStockDate.length;i++){
  609. if(this.currentIndex == i){
  610. this.cancelStockDate[i].good_code = this.textarea
  611. }
  612. }
  613. this.dialogVisibleCode = false
  614. }
  615. })
  616. },
  617. changeGoodCode(row,index){
  618. this.id = 0
  619. this.id = row.id
  620. this.textarea=""
  621. this.textarea = row.good_code
  622. this.currentRow = row
  623. this.currentIndex =index
  624. this.dialogVisibleCode = true
  625. },
  626. changeStartTime(){
  627. },
  628. changeEndTime(){
  629. },
  630. pickerOptions(){
  631. },
  632. toGoodPrint() {
  633. this.$refs.goodPrint.show(
  634. this.printData,
  635. this.goodList,
  636. this.manufacturerList,
  637. this.dealerList,
  638. this.goodKindList
  639. );
  640. },
  641. batchSelect(selection){
  642. if(selection.length == 0){
  643. this.$message.error("请选中需要打印的内容")
  644. return
  645. }
  646. this.printData = []
  647. for(let i=0;i<selection.length;i++){
  648. for(let j=0;j<this.tablePrintData.length;j++){
  649. if(selection[i].id == this.tablePrintData[j].id){
  650. this.printData.push(this.tablePrintData[j])
  651. }
  652. }
  653. }
  654. console.log("打印数据=====",this.printData)
  655. },
  656. BatchPrintAction(){
  657. this.dialogVisible = true
  658. },
  659. handleSelectOne(val){
  660. this.good_name = val.good_name
  661. this.good_id = val.id
  662. this.handleQuery()
  663. },
  664. getSocialSecurityDirectoryCode(good_id){
  665. var social_security_directory_code = ""
  666. for(let i=0;i<this.goodList.length;i++){
  667. if(good_id == this.goodList[i].id){
  668. social_security_directory_code = this.goodList[i].social_security_directory_code
  669. }
  670. }
  671. return social_security_directory_code
  672. },
  673. getGoodName(good_id){
  674. var good_name = ""
  675. for(let i=0;i<this.goodList.length;i++){
  676. if(good_id == this.goodList[i].id){
  677. good_name = this.goodList[i].good_name
  678. }
  679. }
  680. return good_name
  681. },
  682. getSpecificationName(good_id){
  683. var specification_name = ""
  684. for(let i=0;i<this.goodList.length;i++){
  685. if(good_id == this.goodList[i].id){
  686. specification_name = this.goodList[i].specification_name
  687. }
  688. }
  689. return specification_name
  690. },
  691. getPackingUnit(good_id){
  692. var packing_unit = ""
  693. for(let i=0;i<this.goodList.length;i++){
  694. if(good_id == this.goodList[i].id){
  695. packing_unit = this.goodList[i].packing_unit
  696. }
  697. }
  698. return packing_unit
  699. },
  700. handleQuery(){
  701. var params = {
  702. start_time:this.listQuery.start_time,
  703. end_time:this.listQuery.end_time,
  704. good_id:this.good_id,
  705. }
  706. console.log("param===",params)
  707. getGoodWarehosueInPrintList(params).then(response=>{
  708. if(response.data.state == 1){
  709. var list = response.data.data.list
  710. this.tablePrintData = list
  711. var manufacturerList = response.data.data.manufacturerList
  712. this.manufacturerList = []
  713. this.manufacturerList = manufacturerList
  714. var dealerList = response.data.data.dealerList
  715. this.dealerList = []
  716. this.dealerList = dealerList
  717. var goodList = response.data.data.goodList
  718. this.goodList = []
  719. this.goodList= goodList
  720. var goodsType = response.data.data.goodsType
  721. this.goodsType = []
  722. this.goodsType = goodsType
  723. }
  724. })
  725. },
  726. getGoodKandName(id){
  727. var name = ""
  728. for(let i=0;i<this.goodKindList.length;i++){
  729. if(id == this.goodKindList[i].value){
  730. name = this.goodKindList[i].name
  731. }
  732. }
  733. return name
  734. },
  735. handleSelect(val){
  736. this.good_name = val.good_name
  737. this.good_id = val.id
  738. this.GetCancelStock();
  739. this.getGoodDetailPrintList()
  740. },
  741. querySearchAsync(keyword, cb) {
  742. let key = '';
  743. if (keyword != undefined) {
  744. key = keyword
  745. }
  746. postSearchGoodList(key,this.storehouse_id).then(response => {
  747. if (response.data.state == 1) {
  748. var list = response.data.data.list
  749. this.goodList = list
  750. var manufacturerList = response.data.data.manufacturerList
  751. this.manufacturerList = manufacturerList
  752. var dealer = response.data.data.dealerList
  753. this.dealerList = dealer
  754. for(let i=0;i<this.goodList.length;i++){
  755. for(let j=0;j<this.manufacturerList.length;j++){
  756. if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
  757. this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  758. }
  759. }
  760. }
  761. for(let i=0;i<this.goodList.length;i++){
  762. for(let j=0;j<this.dealerList.length;j++){
  763. if(this.goodList[i].dealer == this.dealerList[j].id){
  764. this.goodList[i].dealer = this.dealerList[j].dealer_name
  765. }
  766. }
  767. }
  768. cb(this.goodList)
  769. } else {
  770. cb([])
  771. }
  772. })
  773. },
  774. changeType: function(val) {
  775. this.order_type = val;
  776. this.GetCancelStock();
  777. },
  778. changeManufacturer: function(val) {
  779. this.manufacturer_id = val;
  780. this.GetCancelStock();
  781. },
  782. changeDealer: function(val) {
  783. this.dealer_id = val;
  784. this.GetCancelStock();
  785. },
  786. getTypeName: function(row) {
  787. let name = "";
  788. if (row.type == 1) {
  789. name = "耗材入库单";
  790. } else if (row.type == 2) {
  791. name = "其他入库单";
  792. }
  793. return name;
  794. },
  795. typeName: function(good_type_id) {
  796. let name = "";
  797. for (let i = 0; i < this.goodType.length; i++) {
  798. if (this.goodType[i].id == good_type_id) {
  799. name = this.goodType[i].type_name;
  800. }
  801. }
  802. return name;
  803. },
  804. typeNameOne:function(good_id){
  805. let name = "";
  806. for (let i = 0; i < this.goodInfo.length; i++) {
  807. if (this.goodInfo[i].id == good_id) {
  808. name = this.goodInfo[i].good_name;
  809. }
  810. }
  811. return name;
  812. },
  813. specificationName: function(good_info_id) {
  814. let name = "";
  815. for (let i = 0; i < this.goodInfo.length; i++) {
  816. if (this.goodInfo[i].id == good_info_id) {
  817. name = this.goodInfo[i].specification_name;
  818. }
  819. }
  820. return name;
  821. },
  822. search: function() {
  823. this.getGoodDetailPrintList()
  824. const Params = {
  825. page: this.page,
  826. limit: this.limit,
  827. start_time: this.start_time,
  828. end_time: this.end_time,
  829. type: this.type,
  830. keywords: this.searchKey,
  831. storehouse_id:this.storehouse_id,
  832. };
  833. this.cancelStockDate = [];
  834. this.tableList = []
  835. getStockDetail(Params).then(response => {
  836. if (response.data.state == 0) {
  837. this.$message.error(response.data.msg);
  838. return false;
  839. } else {
  840. this.total = response.data.data.total;
  841. var total_price = 0
  842. for (let i = 0; i < response.data.data.list.length; i++) {
  843. this.tableList.push(response.data.data.list[i])
  844. var obj = response.data.data.list[i];
  845. total_price += response.data.data.list[i].price * response.data.data.list[i].warehousing_count
  846. obj["is_total"] = 0;
  847. this.cancelStockDate.push(obj);
  848. }
  849. this.manufacturerList = response.data.data.manufacturerList
  850. this.dealerList = response.data.data.dealerList
  851. this.cancelStockDate.push({
  852. warehousing_order: "合计",
  853. is_total: 1,
  854. total: total_price,
  855. Warehousing: {
  856. warehousing_time: 0
  857. }
  858. });
  859. }
  860. });
  861. },
  862. getTime: function(val) {
  863. if (val == 0) {
  864. return "";
  865. } else {
  866. return uParseTime(val, "{y}-{m}-{d}");
  867. }
  868. },
  869. AddNewOrder: function() {
  870. this.$router.push({
  871. name: "cancelStockOrderAdd",
  872. query: { type: this.type }
  873. });
  874. },
  875. GetCancelStock: function() {
  876. const Params = {
  877. page: this.page,
  878. limit: this.limit,
  879. start_time: this.start_time,
  880. end_time: this.end_time,
  881. type: this.type,
  882. manufacturer: this.manufacturer_id,
  883. order_type: this.order_type,
  884. dealer: this.dealer_id,
  885. keywords: this.searchKey,
  886. storehouse_id:this.storehouse_id,
  887. good_id:this.good_id,
  888. order_way:0
  889. };
  890. this.cancelStockDate = [];
  891. const loading = this.$loading({
  892. lock: true,
  893. text: 'Loading',
  894. spinner: 'el-icon-loading',
  895. background: 'rgba(0, 0, 0, 0.7)'
  896. })
  897. getStockDetail(Params).then(response => {
  898. if (response.data.state == 0) {
  899. this.$message.error(response.data.msg);
  900. loading.close()
  901. return false;
  902. } else {
  903. loading.close()
  904. this.total = response.data.data.total;
  905. var obj = {id:0,storehouse_name:"全部"}
  906. this.houseList = []
  907. this.houseList.push(obj)
  908. for(let i=0;i<response.data.data.houseList.length;i++){
  909. this.houseList.push(response.data.data.houseList[i])
  910. }
  911. var total_price = 0
  912. for (let i = 0; i < response.data.data.list.length; i++) {
  913. total_price += parseInt(response.data.data.list[i].warehousing_count) * response.data.data.list[i].price
  914. this.tableList.push(response.data.data.list[i])
  915. var obj = response.data.data.list[i];
  916. obj["is_total"] = 0;
  917. this.cancelStockDate.push(obj);
  918. }
  919. this.tableDataList = response.data.data.list
  920. this.manufacturerList = response.data.data.manufacturerList
  921. this.dealerList = response.data.data.dealerList
  922. this.goodKindList = response.data.data.goodKindList
  923. this.cancelStockDate.push({
  924. warehousing_order: "合计",
  925. is_total: 1,
  926. total:total_price.toFixed(2),
  927. Warehousing: {
  928. warehousing_time: 0
  929. }
  930. });
  931. }
  932. });
  933. },
  934. getXuserName(id) {
  935. if (id <= 0) {
  936. return "";
  937. }
  938. var name = "";
  939. if (
  940. this.adminUserOptions == null ||
  941. typeof this.adminUserOptions.length === "undefined"
  942. ) {
  943. return name;
  944. }
  945. var leng = this.adminUserOptions.length;
  946. if (leng == 0) {
  947. return name;
  948. }
  949. for (let index = 0; index < leng; index++) {
  950. if (this.adminUserOptions[index].id == id) {
  951. name = this.adminUserOptions[index].name;
  952. break;
  953. }
  954. }
  955. return name;
  956. },
  957. fetchAllAdminUsers() {
  958. fetchAllAdminUsers().then(response => {
  959. if (response.data.state == 1) {
  960. this.adminUserOptions = response.data.data.users;
  961. var alen = this.adminUserOptions.length;
  962. for (let index = 0; index < alen; index++) {
  963. if (this.adminUserOptions[index].user_type == 2) {
  964. }
  965. }
  966. }
  967. });
  968. },
  969. handleSelectionChange: function(val) {
  970. this.multipleSelection = val;
  971. this.GetCancelStock();
  972. this.getGoodDetailPrintList()
  973. },
  974. handleSizeChange(val) {
  975. this.limit = val;
  976. this.GetCancelStock();
  977. this.getGoodDetailPrintList()
  978. },
  979. handleCurrentChange(val) {
  980. this.page = val;
  981. this.GetCancelStock();
  982. this.getGoodDetailPrintList()
  983. },
  984. startTimeChange(val) {
  985. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  986. if (time > 0) {
  987. this.$message.error("结束时间不能小于开始时间");
  988. this.start_time = "";
  989. } else {
  990. this.GetCancelStock();
  991. this.getGoodDetailPrintList()
  992. }
  993. },
  994. endTimeChange(val) {
  995. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  996. if (time < 0) {
  997. this.$message.error("结束时间不能小于开始时间");
  998. this.end_time = "";
  999. } else {
  1000. this.GetCancelStock();
  1001. this.getGoodDetailPrintList()
  1002. }
  1003. },
  1004. getAllQuery(){
  1005. this.GetCancelStock();
  1006. this.getGoodDetailPrintList()
  1007. },
  1008. getTimestamp(time) {
  1009. // 把时间日期转成时间戳
  1010. return new Date(time).getTime() / 1000;
  1011. },
  1012. calculate: function(val) {
  1013. return Math.round(parseFloat(val) * 100) / 100;
  1014. },
  1015. GetConfigInfo: function() {
  1016. GetAllConfig().then(response => {
  1017. if (response.data.state == 0) {
  1018. this.$message.error(response.data.msg);
  1019. return false;
  1020. } else {
  1021. this.manufacturer = response.data.data.manufacturer;
  1022. this.dealer = response.data.data.dealer;
  1023. this.goodInfo = response.data.data.goodInfo;
  1024. this.goodType = response.data.data.goodType;
  1025. }
  1026. });
  1027. },
  1028. getManufactuerName: function(manufacturer_id) {
  1029. for (let i = 0; i < this.manufacturer.length; i++) {
  1030. if (this.manufacturer[i].id == manufacturer_id) {
  1031. return this.manufacturer[i].manufacturer_name;
  1032. }
  1033. }
  1034. },
  1035. getDealerName: function(dealer_id) {
  1036. for (let i = 0; i < this.dealer.length; i++) {
  1037. if (this.dealer[i].id == dealer_id) {
  1038. return this.dealer[i].dealer_name;
  1039. }
  1040. }
  1041. },
  1042. handleEdit: function(index, row) {
  1043. this.$router.push({
  1044. name: "cancelStockDetail",
  1045. query: { id: row.id, type: this.type }
  1046. });
  1047. },
  1048. handleDelete: function(index, row) {
  1049. const ids = [];
  1050. ids.push(row.id);
  1051. const idStr = ids.join(",");
  1052. const params = {
  1053. ids: idStr
  1054. };
  1055. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  1056. confirmButtonText: "确定",
  1057. cancelButtonText: "取消",
  1058. type: "warning"
  1059. })
  1060. .then(() => {
  1061. deleteCancelStock(params).then(response => {
  1062. if (response.data.state == 0) {
  1063. this.$message.error(response.data.msg);
  1064. return false;
  1065. } else {
  1066. this.$notify({
  1067. title: "成功",
  1068. message: "删除成功",
  1069. type: "success",
  1070. duration: 2000
  1071. });
  1072. for (let i = 0; i < ids.length; i++) {
  1073. for (let y = 0; y < this.cancelStockDate.length; y++) {
  1074. if (ids[i] == this.cancelStockDate[y].id) {
  1075. this.cancelStockDate.splice(y, 1);
  1076. }
  1077. }
  1078. }
  1079. }
  1080. });
  1081. })
  1082. .catch(() => {});
  1083. },
  1084. changeAllSelected: function(val) {
  1085. if (val) {
  1086. this.$refs.multipleTable.toggleAllSelection();
  1087. } else {
  1088. this.$refs.multipleTable.clearSelection();
  1089. }
  1090. },
  1091. select(selection) {
  1092. this.selectedTableData = selection;
  1093. },
  1094. batchDelete() {
  1095. if (this.selectedTableData.length <= 0) {
  1096. this.$message.error("请选择要删除的记录");
  1097. return;
  1098. }
  1099. const ids = [];
  1100. for (let i = 0; i < this.selectedTableData.length; i++) {
  1101. ids.push(this.selectedTableData[i].id);
  1102. }
  1103. const idStr = ids.join(",");
  1104. const params = {
  1105. ids: idStr
  1106. };
  1107. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  1108. confirmButtonText: "确定",
  1109. cancelButtonText: "取消",
  1110. type: "warning"
  1111. })
  1112. .then(() => {
  1113. deleteCancelStock(params).then(response => {
  1114. if (response.data.state == 0) {
  1115. this.$message.error(response.data.msg);
  1116. return false;
  1117. } else {
  1118. this.$notify({
  1119. title: "成功",
  1120. message: "删除成功",
  1121. type: "success",
  1122. duration: 2000
  1123. });
  1124. for (let i = 0; i < ids.length; i++) {
  1125. for (let y = 0; y < this.cancelStockDate.length; y++) {
  1126. if (ids[i] == this.cancelStockDate[y].id) {
  1127. this.cancelStockDate.splice(y, 1);
  1128. }
  1129. }
  1130. }
  1131. }
  1132. });
  1133. })
  1134. .catch(() => {});
  1135. },
  1136. getTotal: function(price, total) {
  1137. var m = 0,
  1138. r1,
  1139. r2;
  1140. var s1 = price.toString();
  1141. var s2 = total.toString();
  1142. try {
  1143. m += s1.split(".")[1].length;
  1144. } catch (e) {}
  1145. try {
  1146. } catch (e) {
  1147. m += s2.split(".")[1].length;
  1148. }
  1149. r1 = Number(price.toString().replace(".", ""));
  1150. r2 = Number(total.toString().replace(".", ""));
  1151. return (r1 * r2) / Math.pow(10, m);
  1152. },
  1153. PrintAction: function() {
  1154. window.sessionStorage.setItem('start_time',this.start_time)
  1155. window.sessionStorage.setItem('end_time',this.end_time)
  1156. if(this.org_id!=9671){
  1157. this.$router.push({
  1158. path: "/stock/print",
  1159. query: {
  1160. type: 1,
  1161. start_time: this.start_time,
  1162. end_time: this.end_time,
  1163. limit:this.limit,
  1164. page:this.page,
  1165. keywords:this.$router.keywords,
  1166. good_id:this.good_id,
  1167. order_way:0,
  1168. }
  1169. });
  1170. }
  1171. if(this.org_id == 9671){
  1172. this.$router.push({
  1173. path: "/stock/print/one",
  1174. query: {
  1175. type: 1,
  1176. start_time: this.start_time,
  1177. end_time: this.end_time,
  1178. limit:this.limit,
  1179. page:this.page,
  1180. keywords:this.searchKey,
  1181. storehouse_id:this.storehouse_id,
  1182. good_id:this.good_id,
  1183. order_way:0,
  1184. }
  1185. });
  1186. }
  1187. },
  1188. getPrintStockGood(){
  1189. const params = {
  1190. start_time:this.start_time,
  1191. end_time:this.end_time,
  1192. type:1,
  1193. }
  1194. getPrintStockGood(params).then(response=>{
  1195. if(response.data.state == 1){
  1196. this.tableList = []
  1197. var stockTotal = response.data.data.stockTotal
  1198. this.stockTotal = stockTotal
  1199. var list = response.data.data.list
  1200. for(let i=0;i<list.length;i++){
  1201. if (list[i].query_warehousing_info.length > 0) {
  1202. this.tableList.push(list[i])
  1203. }
  1204. }
  1205. }
  1206. })
  1207. },
  1208. calCount(stock) {
  1209. let total = 0
  1210. var array = []
  1211. array = stock.query_warehousing_info
  1212. for (let i = 0; i < array.length; i++) {
  1213. total = total + array[i].warehousing_count
  1214. }
  1215. return total
  1216. },
  1217. calTotal(stock) {
  1218. var array = []
  1219. array = stock.query_warehousing_info
  1220. let total_price = 0.0
  1221. for (let i = 0; i < array.length; i++) {
  1222. total_price = total_price + array[i].warehousing_count * array[i].price
  1223. }
  1224. return Math.floor(total_price * 100) / 100
  1225. },
  1226. calTotalPrice() {
  1227. var amountPrice = 0
  1228. for (let i = 0; i < this.tableList.length; i++) {
  1229. var obj = this.tableList[i]
  1230. var len = 0
  1231. len = obj.query_warehousing_info.length
  1232. let total_price = 0.0
  1233. for (let a = 0; a < len; a++) {
  1234. total_price = total_price + obj.query_warehousing_info[a].total_price
  1235. }
  1236. amountPrice = amountPrice + Math.floor(total_price* 100) / 100
  1237. }
  1238. return Math.floor(amountPrice* 100) / 100
  1239. },
  1240. getStockCount(id){
  1241. var count = ""
  1242. for(let i=0;i<this.stockTotal.length;i++){
  1243. if(id == this.stockTotal[i].good_id){
  1244. count = this.stockTotal[i].count
  1245. }
  1246. }
  1247. return count
  1248. },
  1249. getTotal: function(price, total) {
  1250. var m = 0, r1, r2
  1251. var s1 = price.toString()
  1252. var s2 = total.toString()
  1253. try {
  1254. m += s1.split('.')[1].length
  1255. } catch (e) {
  1256. }
  1257. try {
  1258. } catch (e) {
  1259. m += s2.split('.')[1].length
  1260. }
  1261. r1 = Number(price.toString().replace('.', ''))
  1262. r2 = Number(total.toString().replace('.', ''))
  1263. return r1 * r2 / Math.pow(10, m)
  1264. },
  1265. unique(arr) {
  1266. const res = new Map();
  1267. return arr.filter((arr) => !res.has(arr.specification_name) && res.set(arr.specification_name, 1));
  1268. },
  1269. uniqueOne(arr) {
  1270. const res = new Map();
  1271. return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
  1272. },
  1273. exportList(){
  1274. for(let i=0;i<this.tableInfo.length;i++){
  1275. this.tableInfo[i].index = i+1
  1276. this.tableInfo[i].total_price = (this.tableInfo[i].warehousing_count * this.tableInfo[i].price).toFixed(2)
  1277. this.tableInfo[i].manufacturer_name = this.getManufactuerName(this.tableInfo[i].manufacturer)
  1278. this.tableInfo[i].dealer_name = this.getDealerName(this.tableInfo[i].dealer)
  1279. }
  1280. import('@/vendor/Export2Excel').then(excel => {
  1281. const tHeader = ['序号','耗材名称', '规格型号','生产厂商','进销商', '单位','数量','进货价','总价','备注']
  1282. const filterVal = ['index','good_name', 'specification_name','manufacturer_name','dealer_name', 'packing_unit','warehousing_count','price','total_price','remark']
  1283. const data = this.formatJson(filterVal, this.tableInfo)
  1284. excel.export_json_to_excel({
  1285. header: tHeader,
  1286. data,
  1287. filename: '耗材入库明细'
  1288. })
  1289. this.downloadLoading = false
  1290. })
  1291. },
  1292. getManufacturerName(id){
  1293. var manufacturer_name = ""
  1294. for(let i=0;i<this.manufacturerList.length;i++){
  1295. if(id == this.manufacturerList[i].id){
  1296. manufacturer_name = this.manufacturerList[i].manufacturer_name
  1297. }
  1298. }
  1299. return manufacturer_name
  1300. },
  1301. getDealerName(id){
  1302. var dealer_name = ""
  1303. for(let i=0;i<this.dealerList.length;i++){
  1304. if(id == this.dealerList[i].id){
  1305. dealer_name = this.dealerList[i].dealer_name
  1306. }
  1307. }
  1308. return dealer_name
  1309. },
  1310. exportListDetal(){
  1311. var obj = {index:"合计",total_price:0}
  1312. var total = 0
  1313. console.log("wowowows",this.tableDataList)
  1314. for(let i=0;i<this.tableDataList.length;i++){
  1315. this.tableDataList[i].good_kand_name = this.getGoodKandName(this.tableDataList[i].GoodInfo.good_kind)
  1316. this.tableDataList[i].index = i + 1
  1317. this.tableDataList[i].good_type_name = this.typeName(this.tableDataList[i].good_type_id)
  1318. this.tableDataList[i].good_name = this.typeNameOne(this.tableDataList[i].good_id)
  1319. this.tableDataList[i].specification_name = this.specificationName(this.tableDataList[i].good_id)
  1320. this.tableDataList[i].time = this.getTime(this.tableDataList[i].Warehousing.warehousing_time)
  1321. this.tableDataList[i].user_name = this.getXuserName(this.tableDataList[i].Warehousing.creater)
  1322. this.tableDataList[i].total_price = (this.tableDataList[i].warehousing_count * this.tableDataList[i].price).toFixed(2)
  1323. this.tableDataList[i].manufacturer_name = this.getManufactuerName(this.tableDataList[i].manufacturer)
  1324. this.tableDataList[i].dealer_name = this.getDealerName(this.tableDataList[i].dealer)
  1325. this.tableDataList[i].expiry_date_name = this.getTime(this.tableDataList[i].expiry_date)
  1326. this.tableDataList[i].product_date_name = this.getTime(this.tableDataList[i].product_date)
  1327. total += this.tableDataList[i].warehousing_count * this.tableDataList[i].price
  1328. }
  1329. obj.total_price = total.toFixed(2)
  1330. this.tableDataList.push(obj)
  1331. console.log("hhhhhhhhhhhhhhhh",this.tableDataList)
  1332. import('@/vendor/Export2Excel').then(excel => {
  1333. const tHeader = ['序号','单据编号','耗材种类', '耗材类型', '耗材名称','规格型号','生产厂商','进销商','批号','生产日期','有效日期','操作时间','制单人','进货价','数量','总价']
  1334. const filterVal = ['index','warehousing_order','good_kand_name', 'good_type_name', 'good_name','specification_name','manufacturer_name','dealer_name','number','product_date_name','expiry_date_name','time','user_name','price','warehousing_count','total_price']
  1335. const data = this.formatJson(filterVal, this.tableDataList)
  1336. console.log("this.tableDataList",this.tableDataList)
  1337. excel.export_json_to_excel({
  1338. header: tHeader,
  1339. data,
  1340. filename: '耗材入库明细'
  1341. })
  1342. this.downloadLoading = false
  1343. })
  1344. },
  1345. formatJson(filterVal, jsonData) {
  1346. return jsonData.map(v => filterVal.map(j => v[j]));
  1347. },
  1348. getUnit(id){
  1349. var name = ""
  1350. for(let i=0;i<this.goodUnit.length;i++){
  1351. if(this.goodUnit[i].id == id){
  1352. name = this.goodUnit[i].name
  1353. }
  1354. }
  1355. return name
  1356. },
  1357. getGoodDetailPrintList(){
  1358. const params = {
  1359. start_time:this.start_time,
  1360. end_time:this.end_time,
  1361. type:1,
  1362. storehouse_id:this.storehouse_id,
  1363. good_id:this.good_id,
  1364. }
  1365. getGoodDetailPrintList(params).then(response=>{
  1366. if(response.data.state == 1){
  1367. var list = response.data.data.list
  1368. this.tableInfo = []
  1369. this.tableInfo = list
  1370. }
  1371. })
  1372. },
  1373. getStorehouseName(id){
  1374. var storehouse_name = ""
  1375. for(let i=0;i<this.houseList.length;i++){
  1376. if(id == this.houseList[i].id){
  1377. storehouse_name = this.houseList[i].storehouse_name
  1378. }
  1379. }
  1380. if(storehouse_name == "全部"){
  1381. return ""
  1382. }else{
  1383. return storehouse_name
  1384. }
  1385. },
  1386. changeHouseList(){
  1387. this.houseList = []
  1388. this.GetCancelStock()
  1389. this.getGoodDetailPrintList()
  1390. }
  1391. }
  1392. };
  1393. </script>
  1394. <style rel="stylesheet/css" lang="scss" scoped>
  1395. .information {
  1396. border: 1px #dcdfe6 solid;
  1397. padding: 30px 20px 30px 20px;
  1398. .border {
  1399. border-bottom: 1px #dcdfe6 solid;
  1400. margin: 0px 0 20px 0;
  1401. }
  1402. }
  1403. .edit_separater {
  1404. border-top: 1px solid rgb(233, 233, 233);
  1405. margin-top: 15px;
  1406. margin-bottom: 15px;
  1407. }
  1408. </style>
  1409. <style>
  1410. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1411. font-size: 12px;
  1412. }
  1413. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1414. background: #6fb5fa;
  1415. }
  1416. .count {
  1417. color: #bd2c00;
  1418. }
  1419. .el-table td,
  1420. .el-table th.is-leaf,
  1421. .el-table--border,
  1422. .el-table--group {
  1423. border-color: #d0d3da;
  1424. }
  1425. .el-table--border::after,
  1426. .el-table--group::after,
  1427. .el-table::before {
  1428. background-color: #d0d3da;
  1429. }
  1430. </style>