stockOutDetail.vue 41KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197
  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="exportListDetail"
  15. type="primary"
  16. v-if="orgId !=10480"
  17. >明细导出
  18. </el-button>
  19. <el-button
  20. style="float: right;margin-right:10px"
  21. size="small"
  22. @click="exportListDetailOne"
  23. type="primary"
  24. v-if="orgId ==10480"
  25. >明细导出
  26. </el-button>
  27. <el-button
  28. style="float: right;margin-right:10px"
  29. size="small"
  30. @click="exportList"
  31. type="primary"
  32. >汇总导出
  33. </el-button>
  34. <div class="cell clearfix">
  35. <label class="title"><span class="name">仓库</span> :</label>
  36. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changeHouseList">
  37. <el-option
  38. v-for="(option, index) in houseList"
  39. :key="index"
  40. :label="option.storehouse_name"
  41. :value="option.id">
  42. </el-option>
  43. </el-select>
  44. <el-input
  45. size="small"
  46. style="width:180px;"
  47. class="filter-item"
  48. v-model.trim="searchKey"
  49. placeholder="单据编码/制单人/规格名称/耗材名称"
  50. />
  51. <el-button
  52. size="small"
  53. class="filter-item"
  54. type="primary"
  55. icon="el-icon-search"
  56. @click="search"
  57. >搜索</el-button
  58. >
  59. <label class="title"><span class="name">日期查询</span> : </label>
  60. <el-date-picker
  61. size="small"
  62. v-model="start_time"
  63. prefix-icon="el-icon-date"
  64. :editable="false"
  65. style="width: 150px;"
  66. type="date"
  67. placeholder="选择日期时间"
  68. align="right"
  69. format="yyyy-MM-dd"
  70. value-format="yyyy-MM-dd"
  71. @change="startTimeChange"
  72. ></el-date-picker>
  73. <span class="cellLine"> - </span>
  74. <el-date-picker
  75. size="small"
  76. v-model="end_time"
  77. prefix-icon="el-icon-date"
  78. :editable="false"
  79. style="width: 150px;"
  80. type="date"
  81. placeholder="选择日期时间"
  82. align="right"
  83. format="yyyy-MM-dd"
  84. value-format="yyyy-MM-dd"
  85. @change="endTimeChange"
  86. ></el-date-picker>
  87. </div>
  88. <!-- <el-row :gutter="12" style="margin-top: 10px"> -->
  89. <el-table class="table"
  90. :data="cancelStockDate"
  91. :class="signAndWeighBoxPatients"
  92. border
  93. highlight-current-row
  94. ref="multipleTable"
  95. @selection-change="select"
  96. :row-style="{ color: '#303133' }"
  97. :header-cell-style="{
  98. backgroundColor: 'rgb(245, 247, 250)',
  99. color: '#606266'
  100. }"
  101. height="calc(100vh - 300px)"
  102. >
  103. <el-table-column label="单据编号" align="center" width="200">
  104. <template slot-scope="scope">
  105. {{ scope.row.warehouse_out_order_number }}
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="耗材类型" align="center">
  109. <template slot-scope="scope">
  110. {{ typeName(scope.row.good_type_id) }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="耗材名称" align="center">
  114. <template slot-scope="scope">
  115. {{ typeNameOne(scope.row.good_id) }}
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="规格型号" align="center">
  119. <template slot-scope="scope">
  120. {{ specificationName(scope.row.good_id) }}
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="生产厂商" align="center">
  124. <template slot-scope="scope">
  125. {{ getManufactuerName(scope.row.manufacturer) }}
  126. </template>
  127. </el-table-column>
  128. <!-- <el-table-column label="单据类型" align="center">
  129. <template slot-scope="scope">
  130. {{ getTypeName(scope.row) }}
  131. </template>
  132. </el-table-column> -->
  133. <el-table-column label="操作时间" align="center">
  134. <template slot-scope="scope">
  135. {{ getTime(scope.row.WarehouseOut.warehouse_out_time) }}
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="制单人" align="center">
  139. <template slot-scope="scope">
  140. {{ getXuserName(scope.row.WarehouseOut.creater) }}
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="仓库名称" align="center">
  144. <template slot-scope="scope">
  145. {{ getStorehouseName(scope.row.storehouse_id) }}
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="出货价" align="center">
  149. <template slot-scope="scope">
  150. <span v-if="scope.row.is_total == 0 && (orgId == 9919)">{{scope.row.GoodInfo.buy_price}}</span>
  151. <span v-else>
  152. <span v-if="scope.row.price > 0"> {{ scope.row.price }} </span>
  153. <span v-if="scope.row.price == 0"> {{ scope.row.GoodInfo.packing_price }} </span>
  154. </span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="使用人" align="center">
  158. <template slot-scope="scope">
  159. {{getPatientName(scope.row.patient_id) }}
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="数量" align="center">
  163. <template slot-scope="scope">
  164. <span v-if="scope.row.is_total == 0">
  165. <span v-if="orgId!=9583">{{ scope.row.count }}</span>
  166. <span v-if="orgId ==9583">{{getStockCount(scope.row.good_id) }}</span>
  167. </span>
  168. <span v-if="scope.row.is_total == 1">
  169. {{scope.row.count}}
  170. </span>
  171. </template>
  172. </el-table-column>
  173. <el-table-column label="总价" align="center">
  174. <template slot-scope="scope">
  175. <span v-if="scope.row.is_total == 0 && scope.row.price > 0">{{getTotal(scope.row.price, scope.row.count)}}</span>
  176. <span v-if="scope.row.is_total == 0 && scope.row.price == 0">{{getTotal(scope.row.GoodInfo.packing_price, scope.row.count)}}</span>
  177. <span v-else>{{ scope.row.total }}</span>
  178. </template>
  179. </el-table-column>
  180. </el-table>
  181. <el-pagination
  182. @size-change="handleSizeChange"
  183. @current-change="handleCurrentChange"
  184. :page-sizes="[10, 50, 100,1000,1500,3000,5000,8000,10000,12000,15000,20000]"
  185. :page-size="10"
  186. background
  187. style="margin-top:20px;float: right"
  188. layout="total, sizes, prev, pager, next, jumper"
  189. :total="total"
  190. >
  191. </el-pagination>
  192. <!-- </el-row> -->
  193. </div>
  194. </template>
  195. <script>
  196. import { uParseTime } from "@/utils/tools";
  197. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  198. import { deleteCancelStock, GetAllConfig, getStockDetail,getPrintStockGood,getGoodInfoList,getGoodDetailPrintList } from "@/api/stock";
  199. export default {
  200. name: "stockOutDetail",
  201. created() {
  202. var nowDate = new Date();
  203. var nowYear = nowDate.getFullYear();
  204. var nowMonth = nowDate.getMonth() + 1;
  205. var nowDay = nowDate.getDate();
  206. this.end_time =
  207. nowYear +
  208. "-" +
  209. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  210. "-" +
  211. (nowDay < 10 ? "0" + nowDay : nowDay);
  212. nowDate.setMonth(nowDate.getMonth() - 1);
  213. nowYear = nowDate.getFullYear();
  214. nowMonth = nowDate.getMonth() + 1;
  215. nowDay = nowDate.getDate();
  216. this.start_time =
  217. nowYear +
  218. "-" +
  219. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  220. "-" +
  221. (nowDay < 10 ? "0" + nowDay : nowDay);
  222. var start_time = window.sessionStorage.getItem('start')
  223. var end_time = window.sessionStorage.getItem('end')
  224. if(start_time !=null){
  225. this.start_time = start_time
  226. }
  227. if(end_time!=null){
  228. this.end_time = end_time
  229. }
  230. window.sessionStorage.removeItem('start')
  231. window.sessionStorage.removeItem('end')
  232. this.getGoodDetailPrintList()
  233. this.GetCancelStock();
  234. this.GetConfigInfo();
  235. this.fetchAllAdminUsers();
  236. this.goodUnit = this.$store.getters.good_unit
  237. var org_id = this.$store.getters.xt_user.org.id
  238. this.orgId = org_id
  239. },
  240. data() {
  241. return {
  242. orderTypeArr: [
  243. { value: 1, label: "耗材入库单" },
  244. { value: 2, label: "其他入库单" }
  245. ],
  246. manufacturer_id: "",
  247. dealer_id: "",
  248. order_type:"",
  249. searchKey: "",
  250. type: 2,
  251. page: 1,
  252. limit: 10,
  253. checked: false,
  254. total: 0,
  255. pageTotal: 0,
  256. pageSelect: 0,
  257. adminUserOptions: [],
  258. multipleSelection: [],
  259. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  260. start_time: "",
  261. cancelStockDate: [],
  262. end_time: "",
  263. goodType: [],
  264. goodInfo: [],
  265. manufacturer: [],
  266. selectedTableData: [],
  267. dealer: [],
  268. goodUnit:[],
  269. tableList:[],
  270. stockTotal:[],
  271. goodInfoData:[],
  272. orgId:"",
  273. tableData:[],
  274. tableOut:[],
  275. tableDataList:[],
  276. storehouse_id:0,
  277. houseList:[],
  278. wareOutList:[],
  279. manufacturerList:[],
  280. dealerList:[],
  281. patientsList:[],
  282. };
  283. },
  284. methods: {
  285. changeType: function(val) {
  286. this.order_type = val;
  287. this.GetCancelStock();
  288. this.getGoodDetailPrintList()
  289. },
  290. changeManufacturer: function(val) {
  291. this.manufacturer_id = val;
  292. this.GetCancelStock();
  293. this.getGoodDetailPrintList()
  294. },
  295. getTypeName: function(row) {
  296. let name = "";
  297. const name2 = "";
  298. if (row.type == 1) {
  299. name = "耗材出库单";
  300. } else if (row.type == 2) {
  301. name = "其他出库单";
  302. }
  303. return name;
  304. },
  305. specificationName: function(good_info_id) {
  306. let name = "";
  307. for (let i = 0; i < this.goodInfo.length; i++) {
  308. if (this.goodInfo[i].id == good_info_id) {
  309. name = this.goodInfo[i].specification_name;
  310. }
  311. }
  312. return name;
  313. },
  314. typeName: function(good_type_id) {
  315. let name = "";
  316. for (let i = 0; i < this.goodType.length; i++) {
  317. if (this.goodType[i].id == good_type_id) {
  318. name = this.goodType[i].type_name;
  319. }
  320. }
  321. return name;
  322. },
  323. typeNameOne:function(good_id){
  324. let name = "";
  325. for (let i = 0; i < this.goodInfo.length; i++) {
  326. if (this.goodInfo[i].id == good_id) {
  327. name = this.goodInfo[i].good_name;
  328. }
  329. }
  330. return name;
  331. },
  332. search: function() {
  333. const Params = {
  334. page: this.page,
  335. limit: this.limit,
  336. start_time: this.start_time,
  337. end_time: this.end_time,
  338. type: this.type,
  339. keywords: this.searchKey
  340. };
  341. this.cancelStockDate = [];
  342. this.tableData = []
  343. getStockDetail(Params).then(response => {
  344. if (response.data.state == 0) {
  345. this.$message.error(response.data.msg);
  346. return false;
  347. } else {
  348. this.total = response.data.data.total;
  349. this.wareOutList = []
  350. this.wareOutList = response.data.data.list
  351. this.patientsList = []
  352. this.patientsList = response.data.data.patientsList
  353. var total = 0
  354. var objOne = {
  355. warehouse_out_order_number: "合计",
  356. is_total: 1,
  357. total:total.toFixed(2),
  358. WarehouseOut: {
  359. warehouse_out_time: 0
  360. },
  361. count:0
  362. }
  363. for (let i = 0; i < response.data.data.list.length; i++) {
  364. this.tableData.push(response.data.data.list[i])
  365. var obj = response.data.data.list[i];
  366. total += response.data.data.list[i].price * response.data.data.list[i].count
  367. obj["is_total"] = 0;
  368. this.cancelStockDate.push(obj);
  369. objOne.count += response.data.data.list[i].count
  370. }
  371. this.cancelStockDate.push(objOne);
  372. }
  373. });
  374. },
  375. AddNewOrder: function() {
  376. this.$router.push({
  377. name: "cancelStockOrderAdd",
  378. query: { type: this.type }
  379. });
  380. },
  381. GetCancelStock: function() {
  382. const Params = {
  383. page: this.page,
  384. limit: this.limit,
  385. start_time: this.start_time,
  386. end_time: this.end_time,
  387. type: this.type,
  388. manufacturer: this.manufacturer_id,
  389. order_type: this.order_type,
  390. dealer: this.dealer_id,
  391. keywords: this.searchKey,
  392. storehouse_id:this.storehouse_id,
  393. };
  394. this.cancelStockDate = [];
  395. getStockDetail(Params).then(response => {
  396. if (response.data.state == 0) {
  397. this.$message.error(response.data.msg);
  398. return false;
  399. } else {
  400. this.total = response.data.data.total;
  401. var obj = {id:0,storehouse_name:"全部"}
  402. this.houseList = []
  403. this.houseList.push(obj)
  404. for(let i=0;i<response.data.data.houseList.length;i++){
  405. this.houseList.push(response.data.data.houseList[i])
  406. }
  407. this.wareOutList = response.data.data.list
  408. // console.log("党的20大长长",this.wareOutList)
  409. this.patientsList = []
  410. this.patientsList = response.data.data.patientsList
  411. var total = 0
  412. var objOne = {
  413. warehouse_out_order_number: "合计",
  414. is_total: 1,
  415. total: total.toFixed(2),
  416. WarehouseOut: {
  417. warehouse_out_time: 0
  418. },
  419. count:0,
  420. }
  421. for (let i = 0; i < response.data.data.list.length; i++) {
  422. this.tableData.push(response.data.data.list[i])
  423. var obj = response.data.data.list[i];
  424. if(response.data.data.list[i].price > 0){
  425. total += response.data.data.list[i].price * response.data.data.list[i].count
  426. }
  427. if(response.data.data.list[i].price == 0){
  428. total += response.data.data.list[i].GoodInfo.packing_price * response.data.data.list[i].count
  429. }
  430. objOne.count +=response.data.data.list[i].count
  431. obj["is_total"] = 0;
  432. this.cancelStockDate.push(obj);
  433. }
  434. this.tableDataList = response.data.data.list
  435. this.manufacturerList = response.data.data.manufacturerList
  436. this.dealerList = response.data.data.dealerList
  437. this.cancelStockDate.push(objOne);
  438. }
  439. });
  440. },
  441. getXuserName(id) {
  442. if (id <= 0) {
  443. return "";
  444. }
  445. var name = "";
  446. if (
  447. this.adminUserOptions == null ||
  448. typeof this.adminUserOptions.length === "undefined"
  449. ) {
  450. return name;
  451. }
  452. var leng = this.adminUserOptions.length;
  453. if (leng == 0) {
  454. return name;
  455. }
  456. for (let index = 0; index < leng; index++) {
  457. if (this.adminUserOptions[index].id == id) {
  458. name = this.adminUserOptions[index].name;
  459. break;
  460. }
  461. }
  462. return name;
  463. },
  464. fetchAllAdminUsers() {
  465. fetchAllAdminUsers().then(response => {
  466. if (response.data.state == 1) {
  467. this.adminUserOptions = response.data.data.users;
  468. var alen = this.adminUserOptions.length;
  469. for (let index = 0; index < alen; index++) {
  470. if (this.adminUserOptions[index].user_type == 2) {
  471. // this.doctorOptions.push(this.adminUserOptions[index]);
  472. }
  473. }
  474. }
  475. });
  476. },
  477. handleSelectionChange: function(val) {
  478. this.multipleSelection = val;
  479. },
  480. handleSizeChange(val) {
  481. this.limit = val;
  482. this.GetCancelStock();
  483. // this.getPrintStockGood()
  484. },
  485. handleCurrentChange(val) {
  486. this.page = val;
  487. this.GetCancelStock();
  488. // this.getPrintStockGood()
  489. },
  490. startTimeChange(val) {
  491. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  492. if (time > 0) {
  493. this.$message.error("结束时间不能小于开始时间");
  494. this.start_time = "";
  495. } else {
  496. window.sessionStorage.removeItem('start')
  497. this.cancelStockDate = []
  498. this.GetCancelStock();
  499. this.getGoodDetailPrintList()
  500. }
  501. },
  502. endTimeChange(val) {
  503. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  504. if (time < 0) {
  505. this.$message.error("结束时间不能小于开始时间");
  506. this.end_time = "";
  507. } else {
  508. window.sessionStorage.removeItem('end')
  509. this.cancelStockDate = []
  510. this.GetCancelStock();
  511. this.getGoodDetailPrintList()
  512. }
  513. },
  514. getTimestamp(time) {
  515. // 把时间日期转成时间戳
  516. return new Date(time).getTime() / 1000;
  517. },
  518. calculate: function(val) {
  519. return Math.round(parseFloat(val) * 100) / 100;
  520. },
  521. GetConfigInfo: function() {
  522. GetAllConfig().then(response => {
  523. if (response.data.state == 0) {
  524. this.$message.error(response.data.msg);
  525. return false;
  526. } else {
  527. this.manufacturer = response.data.data.manufacturer;
  528. this.dealer = response.data.data.dealer;
  529. this.goodInfo = response.data.data.goodInfo;
  530. this.goodType = response.data.data.goodType;
  531. }
  532. });
  533. },
  534. getManufacturerNameOne(id){
  535. var manufacturer_name = ""
  536. for(let i=0;i<this.manufacturerList.length;i++){
  537. if(id == this.manufacturerList[i].id){
  538. manufacturer_name = this.manufacturerList[i].manufacturer_name
  539. }
  540. }
  541. return manufacturer_name
  542. },
  543. getDealerNameOne(id){
  544. var dealer_name = ""
  545. for(let i=0;i<this.dealerList.length;i++){
  546. if(id == this.dealerList[i].id){
  547. dealer_name = this.dealerList[i].dealer_name
  548. }
  549. }
  550. return dealer_name
  551. },
  552. getManufactuerName: function(manufacturer_id) {
  553. for (let i = 0; i < this.manufacturer.length; i++) {
  554. if (this.manufacturer[i].id == manufacturer_id) {
  555. return this.manufacturer[i].manufacturer_name;
  556. }
  557. }
  558. },
  559. getDealerName: function(dealer_id) {
  560. for (let i = 0; i < this.dealer.length; i++) {
  561. if (this.dealer[i].id == dealer_id) {
  562. return this.dealer[i].dealer_name;
  563. }
  564. }
  565. },
  566. handleEdit: function(index, row) {
  567. this.$router.push({
  568. name: "cancelStockDetail",
  569. query: { id: row.id, type: this.type }
  570. });
  571. },
  572. handleDelete: function(index, row) {
  573. const ids = [];
  574. ids.push(row.id);
  575. const idStr = ids.join(",");
  576. const params = {
  577. ids: idStr
  578. };
  579. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  580. confirmButtonText: "确定",
  581. cancelButtonText: "取消",
  582. type: "warning"
  583. })
  584. .then(() => {
  585. deleteCancelStock(params).then(response => {
  586. if (response.data.state == 0) {
  587. this.$message.error(response.data.msg);
  588. return false;
  589. } else {
  590. this.$notify({
  591. title: "成功",
  592. message: "删除成功",
  593. type: "success",
  594. duration: 2000
  595. });
  596. for (let i = 0; i < ids.length; i++) {
  597. for (let y = 0; y < this.cancelStockDate.length; y++) {
  598. if (ids[i] == this.cancelStockDate[y].id) {
  599. this.cancelStockDate.splice(y, 1);
  600. }
  601. }
  602. }
  603. }
  604. });
  605. })
  606. .catch(() => {});
  607. },
  608. changeAllSelected: function(val) {
  609. if (val) {
  610. this.$refs.multipleTable.toggleAllSelection();
  611. } else {
  612. this.$refs.multipleTable.clearSelection();
  613. }
  614. },
  615. select(selection) {
  616. this.selectedTableData = selection;
  617. },
  618. batchDelete() {
  619. if (this.selectedTableData.length <= 0) {
  620. this.$message.error("请选择要删除的记录");
  621. return;
  622. }
  623. const ids = [];
  624. for (let i = 0; i < this.selectedTableData.length; i++) {
  625. ids.push(this.selectedTableData[i].id);
  626. }
  627. const idStr = ids.join(",");
  628. const params = {
  629. ids: idStr
  630. };
  631. this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
  632. confirmButtonText: "确定",
  633. cancelButtonText: "取消",
  634. type: "warning"
  635. })
  636. .then(() => {
  637. deleteCancelStock(params).then(response => {
  638. if (response.data.state == 0) {
  639. this.$message.error(response.data.msg);
  640. return false;
  641. } else {
  642. this.$notify({
  643. title: "成功",
  644. message: "删除成功",
  645. type: "success",
  646. duration: 2000
  647. });
  648. for (let i = 0; i < ids.length; i++) {
  649. for (let y = 0; y < this.cancelStockDate.length; y++) {
  650. if (ids[i] == this.cancelStockDate[y].id) {
  651. this.cancelStockDate.splice(y, 1);
  652. }
  653. }
  654. }
  655. }
  656. });
  657. })
  658. .catch(() => {});
  659. },
  660. getTotal: function(price, total) {
  661. var m = 0,
  662. r1,
  663. r2;
  664. var s1 = price.toString();
  665. var s2 = total.toString();
  666. try {
  667. m += s1.split(".")[1].length;
  668. } catch (e) {}
  669. try {
  670. } catch (e) {
  671. m += s2.split(".")[1].length;
  672. }
  673. r1 = Number(price.toString().replace(".", ""));
  674. r2 = Number(total.toString().replace(".", ""));
  675. return (r1 * r2) / Math.pow(10, m);
  676. },
  677. getTime: function(val) {
  678. if (val == 0) {
  679. return "";
  680. } else {
  681. return uParseTime(val, "{y}-{m}-{d}");
  682. }
  683. },
  684. getTimeOne: function(val) {
  685. if (val == 0) {
  686. return "";
  687. } else {
  688. return uParseTime(val, "{y}-{m}-{d} {h}:{i}");
  689. }
  690. },
  691. PrintAction: function() {
  692. window.sessionStorage.setItem('start',this.start_time)
  693. window.sessionStorage.setItem('end',this.end_time)
  694. if(this.orgId != 9671){
  695. this.$router.push({
  696. path: "/stock/print",
  697. query: {
  698. type: 2,
  699. start_time: this.start_time,
  700. end_time: this.end_time,
  701. limit:this.limit,
  702. page:this.page,
  703. }
  704. });
  705. }
  706. if(this.orgId == 9671){
  707. this.$router.push({
  708. path: "/stock/print/two",
  709. query: {
  710. type: 2,
  711. start_time: this.start_time,
  712. end_time: this.end_time,
  713. limit:this.limit,
  714. page:this.page,
  715. storehouse_id:this.storehouse_id,
  716. keyword:this.searchKey,
  717. }
  718. });
  719. }
  720. },
  721. // getPrintStockGood(){
  722. // const params = {
  723. // start_time:this.start_time,
  724. // end_time:this.end_time,
  725. // type:3,
  726. // }
  727. // getPrintStockGood(params).then(response=>{
  728. // if(response.data.state == 1){
  729. // var stockTotal = response.data.data.stockTotal
  730. // this.stockTotal = stockTotal
  731. // var list = response.data.data.list
  732. // this.tableList = []
  733. // for(let i=0;i<list.length;i++){
  734. // if (list[i].query_warehouseout_info.length > 0) {
  735. // this.tableList.push(list[i])
  736. // }
  737. // }
  738. // }
  739. // })
  740. // },
  741. calCount(stock) {
  742. let total = 0
  743. var array = []
  744. array = stock.query_warehousing_info
  745. for (let i = 0; i < array.length; i++) {
  746. total = total + array[i].warehousing_count
  747. }
  748. return total
  749. },
  750. calTotal(stock) {
  751. var array = []
  752. array = stock.query_warehousing_info
  753. let total_price = 0.0
  754. for (let i = 0; i < array.length; i++) {
  755. total_price = total_price + array[i].warehousing_count * array[i].price
  756. }
  757. return Math.floor(total_price * 100) / 100
  758. },
  759. calTotalPrice() {
  760. var amountPrice = 0
  761. for (let i = 0; i < this.tableList.length; i++) {
  762. var obj = this.tableList[i]
  763. var len = 0
  764. len = obj.query_warehouseout_info.length
  765. let total_price = 0.0
  766. for (let a = 0; a < len; a++) {
  767. total_price = total_price + obj.query_warehouseout_info[a].total_price
  768. }
  769. amountPrice = amountPrice + Math.floor(total_price* 100) / 100
  770. }
  771. return Math.floor(amountPrice* 100) / 100
  772. },
  773. getTotal: function(price, total) {
  774. var m = 0, r1, r2
  775. var s1 = price.toString()
  776. var s2 = total.toString()
  777. try {
  778. m += s1.split('.')[1].length
  779. } catch (e) {
  780. }
  781. try {
  782. } catch (e) {
  783. m += s2.split('.')[1].length
  784. }
  785. r1 = Number(price.toString().replace('.', ''))
  786. r2 = Number(total.toString().replace('.', ''))
  787. return r1 * r2 / Math.pow(10, m)
  788. },
  789. unique(arr) {
  790. const res = new Map();
  791. return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
  792. },
  793. getList() {
  794. let params = {
  795. page: 1,
  796. limit: 1000,
  797. keyword: "",
  798. is_use:"",
  799. good_kind:"",
  800. is_charge: "",
  801. is_mark:"",
  802. manufacturer:"",
  803. }
  804. getGoodInfoList(params).then(response => {
  805. if (response.data.state == 0) {
  806. this.$message.error(response.data.msg)
  807. return false
  808. } else {
  809. this.goodInfoData = []
  810. for (let i = 0; i < response.data.data.list.length; i++) {
  811. this.goodInfoData.push(response.data.data.list[i])
  812. }
  813. }
  814. })
  815. },
  816. exportList(){
  817. for(let i=0;i<this.tableOut.length;i++){
  818. this.tableOut[i].index = i+1
  819. this.tableOut[i].good_name = this.tableOut[i].good_name
  820. this.tableOut[i].specification_name = this.tableOut[i].specification_name
  821. this.tableOut[i].packing_unit = this.tableOut[i].packing_unit
  822. this.tableOut[i].ctime = this.getTime(this.tableOut[i].ctime)
  823. if(this.orgId == 9919 || this.orgId == 10402){
  824. this.tableOut[i].total_price = (this.tableOut[i].count * this.tableOut[i].buy_price).toFixed(2)
  825. this.tableOut[i].packing_price = this.tableOut[i].buy_price
  826. }else if(this.orgId == 10265){
  827. this.tableOut[i].total_price = (this.getMySelfCount(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  828. }else if(this.orgId == 10445){
  829. this.tableOut[i].total_price = (this.getMySelfCount(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  830. }else if(this.orgId == 10215){
  831. this.tableOut[i].total_price = (this.getMySelfCount(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  832. }else if(this.orgId == 10210){
  833. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  834. }else if(this.orgId == 9675){
  835. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  836. }else if(this.orgId == 9679){
  837. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  838. }else if(this.orgId == 9956){
  839. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  840. }else if(this.orgId == 10217){
  841. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  842. }else if(this.orgId == 10191){
  843. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  844. }else if(this.orgId == 10188){
  845. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  846. }else if(this.orgId == 10489){
  847. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  848. }else if(this.orgId == 10375){
  849. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  850. }else if(this.orgId == 10485){
  851. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  852. }else if(this.orgId ==10138){
  853. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  854. }else if(this.orgId == 10278){
  855. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  856. }else if(this.orgId == 10610){
  857. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  858. }else if(this.orgId==10537){
  859. this.tableOut[i].total_price = (this.getWarehouseOut(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  860. }else{
  861. this.tableOut[i].total_price = (this.getStockCount(this.tableOut[i].good_id) * this.tableOut[i].retail_price).toFixed(2)
  862. }
  863. if(this.orgId == 10265 || this.orgId ==10215 || this.orgId == 9919 || this.orgId == 9671 || this.orgId == 10402 || this.orgId==10138 || this.orgId==10278||this.orgId==10537||this.orgId==10610||this.orgId==0 || this.org_id==10445){
  864. this.tableOut[i].out_count = this.getMySelfCount(this.tableOut[i].good_id)
  865. }
  866. if(this.orgId == 10210 || this.orgId == 9675 || this.orgId == 9956 || this.orgId == 10217 || this.orgId == 10188 || this.orgId == 10191 || this.orgId == 0 || this.orgId ==10489 || this.orgId == 10375 || this.orgId == 10485){
  867. this.tableOut[i].out_count = this.getWarehouseOut(this.tableOut[i].good_id)
  868. }
  869. if(this.orgId!=10265 && this.orgId !=10215 && this.orgId != 9671 &&this.orgId!=10210&&this.orgId!=9675 && this.orgId!=9956&& this.orgId!=10217 && this.orgId!=10188 && this.orgId!=10191 && this.orgId!=9919 && this.orgId!=0&& this.orgId!=10402 && this.orgId != 10489 && this.orgId!=10375 && this.orgId!=10485&&this.orgId!=0&&this.orgId!=10138&&this.orgId!=10278&&this.orgId!=10537&&this.orgId!=10610&&this.orgId==0){
  870. this.tableOut[i].out_count = this.getStockCount(this.tableOut[i].good_id)
  871. }
  872. this.tableOut[i].manufacturer_name = this.getManufacturerNameOne(this.tableOut[i].manufacturer)
  873. this.tableOut[i].dealer_name = this.getDealerNameOne(this.tableOut[i].dealer)
  874. this.tableOut[i].order_time = this.start_time + " ~ " + this.end_time
  875. }
  876. console.log("retusoossoso",this.tableOut)
  877. import('@/vendor/Export2Excel').then(excel => {
  878. const tHeader = ['序号','耗材名称', '规格型号','生产厂商','进销商', '单位','数量','出货价','总价','出库时间','备注']
  879. const filterVal = ['index','good_name', 'specification_name', 'manufacturer_name','dealer_name','packing_unit','out_count','packing_price','total_price','order_time','remark']
  880. const data = this.formatJson(filterVal, this.tableOut)
  881. excel.export_json_to_excel({
  882. header: tHeader,
  883. data,
  884. filename: '耗材出库明细'
  885. })
  886. this.downloadLoading = false
  887. })
  888. },
  889. exportListDetail(){
  890. console.log("hahhdhafhhahdf",this.tableDataList)
  891. var obj = {index:"合计",total_price:0}
  892. var total = 0
  893. for(let i=0;i<this.tableDataList.length;i++){
  894. this.tableDataList[i].index = i + 1
  895. this.tableDataList[i].good_type_name = this.typeName(this.tableDataList[i].good_type_id)
  896. this.tableDataList[i].good_name = this.typeNameOne(this.tableDataList[i].good_id)
  897. this.tableDataList[i].specification_name = this.specificationName(this.tableDataList[i].good_id)
  898. this.tableDataList[i].time = this.getTime(this.tableDataList[i].WarehouseOut.warehouse_out_time)
  899. this.tableDataList[i].user_name = this.getXuserName(this.tableDataList[i].WarehouseOut.creater)
  900. this.tableDataList[i].out_count = this.tableDataList[i].count
  901. this.tableDataList[i].manufacturer_name = this.getManufacturerNameOne(this.tableDataList[i].GoodInfo.manufacturer)
  902. this.tableDataList[i].dealer_name = this.getDealerNameOne(this.tableDataList[i].GoodInfo.dealer)
  903. if(this.orgId == 9919){
  904. this.tableDataList[i].total_price = (this.tableDataList[i].count * this.tableDataList[i].GoodInfo.buy_price).toFixed(2)
  905. total += this.tableDataList[i].count * this.tableDataList[i].buy_price
  906. }
  907. if(this.orgId != 9919){
  908. this.tableDataList[i].total_price = (this.tableDataList[i].count * this.tableDataList[i].price).toFixed(2)
  909. total += this.tableDataList[i].count * this.tableDataList[i].price
  910. }
  911. this.tableDataList[i].in_price = this.tableDataList[i].WarehousingInfoNight.price
  912. this.tableDataList[i].expiry_date = this.getTime(this.tableDataList[i].expiry_date)
  913. }
  914. obj.total_price = total.toFixed(2)
  915. console.log("WOHHAHHAHAH",this.tableDataList)
  916. this.tableDataList.push(obj)
  917. import('@/vendor/Export2Excel').then(excel => {
  918. const tHeader = ['序号','单据编号', '耗材类型', '耗材名称','规格型号','生产厂商','进销商','操作时间','制单人','进货价','出货价','数量','总价']
  919. const filterVal = ['index','warehouse_out_order_number', 'good_type_name', 'good_name','specification_name','manufacturer_name','dealer_name','time','user_name','in_price','price','out_count','total_price']
  920. const data = this.formatJson(filterVal, this.tableDataList)
  921. excel.export_json_to_excel({
  922. header: tHeader,
  923. data,
  924. filename: '耗材出库明细'
  925. })
  926. this.downloadLoading = false
  927. })
  928. },
  929. exportListDetailOne(){
  930. console.log("hhahah",this.tableDataList)
  931. var obj = {index:"合计",out_total_price:0,in_total_price:0}
  932. var out_total = 0
  933. var in_total =0
  934. if(this.tableDataList!=null&&this.tableDataList.length>0){
  935. for(let i=0;i<this.tableDataList.length;i++){
  936. this.tableDataList[i].index = i+1
  937. this.tableDataList[i].good_type_name = this.typeName(this.tableDataList[i].good_type_id)
  938. this.tableDataList[i].good_name = this.typeNameOne(this.tableDataList[i].good_id)
  939. this.tableDataList[i].specification_name = this.specificationName(this.tableDataList[i].good_id)
  940. this.tableDataList[i].batch_number =this.tableDataList[i].WarehousingInfoNight.number
  941. this.tableDataList[i].manufacturer_name = this.getManufacturerNameOne(this.tableDataList[i].GoodInfo.manufacturer)
  942. this.tableDataList[i].in_price = this.tableDataList[i].WarehousingInfoNight.price
  943. this.tableDataList[i].out_count = this.tableDataList[i].count
  944. this.tableDataList[i].max_unit = this.tableDataList[i].GoodInfo.max_unit
  945. this.tableDataList[i].out_total_price = (this.tableDataList[i].count * this.tableDataList[i].price).toFixed(2)
  946. this.tableDataList[i].in_total_price = (this.tableDataList[i].count * this.tableDataList[i].WarehousingInfoNight.price).toFixed(2)
  947. this.tableDataList[i].patient_name = this.getPatientName(this.tableDataList[i].patient_id)
  948. this.tableDataList[i].ctimeOne = this.getTime(this.tableDataList[i].ctime)
  949. this.tableDataList[i].ctimeTwo = this.getTimeOne(this.tableDataList[i].ctime)
  950. this.tableDataList[i].expiry_date = this.getTime(this.tableDataList[i].expiry_date)
  951. this.tableDataList[i].project_name ="居民报销"
  952. out_total += this.tableDataList[i].count * this.tableDataList[i].price
  953. in_total += this.tableDataList[i].count *this.tableDataList[i].WarehousingInfoNight.price
  954. }
  955. }
  956. obj.out_total_price = out_total.toFixed(2)
  957. obj.in_total_price = in_total.toFixed(2)
  958. this.tableDataList.push(obj)
  959. import('@/vendor/Export2Excel').then(excel => {
  960. const tHeader = ['序号','耗材名称', '耗材规格', '批号','生成厂家','耗材类型','报销方式','入库单价','出库单价','出库数量','实际出库数量','单位','出库金额','实际出库金额','实际成本','出库对象','有效日期','出库日期','操作时间','出库单号','备注']
  961. const filterVal = ['index','good_name', 'specification_name', 'batch_number','manufacturer_name','good_type_name','project_name','in_price','price','out_count','out_count','max_unit','out_total_price','out_total_price','in_total_price','patient_name','expiry_date','ctimeOne','ctimeTwo','warehouse_out_order_number','remark']
  962. const data = this.formatJson(filterVal, this.tableDataList)
  963. excel.export_json_to_excel({
  964. header: tHeader,
  965. data,
  966. filename: '耗材出库明细'
  967. })
  968. this.downloadLoading = false
  969. })
  970. },
  971. formatJson(filterVal, jsonData) {
  972. return jsonData.map(v => filterVal.map(j => v[j]));
  973. },
  974. getUnit(id){
  975. var name = ""
  976. for(let i=0;i<this.goodUnit.length;i++){
  977. if(this.goodUnit[i].id == id){
  978. name = this.goodUnit[i].name
  979. }
  980. }
  981. return name
  982. },
  983. getTotalPrice(){
  984. var total_price = 0
  985. for(let i=0;i<this.tableList.length;i++){
  986. total_price += this.getStockCount(this.tableList[i].id) * this.tableList[i].retail_price
  987. }
  988. return total_price
  989. },
  990. getGoodDetailPrintList(){
  991. const params = {
  992. start_time:this.start_time,
  993. end_time:this.end_time,
  994. type:2,
  995. }
  996. this.tableOut = []
  997. getGoodDetailPrintList(params).then(response=>{
  998. if(response.data.state == 1){
  999. var list = response.data.data.list
  1000. this.tableOut = list
  1001. var stockTotal = response.data.data.stockTotal
  1002. this.stockTotal = stockTotal
  1003. }
  1004. })
  1005. },
  1006. getStockCount(id){
  1007. var count = ""
  1008. for(let i=0;i<this.stockTotal.length;i++){
  1009. if(id == this.stockTotal[i].good_id){
  1010. count = this.stockTotal[i].count
  1011. }
  1012. }
  1013. return count
  1014. },
  1015. getMySelfCount(good_id){
  1016. var total = 0
  1017. for(let i=0;i<this.tableOut.length;i++){
  1018. if(good_id == this.tableOut[i].good_id){
  1019. total+= this.tableOut[i].count
  1020. }
  1021. }
  1022. return total
  1023. },
  1024. getWareOutTotalSix(){
  1025. var total = 0
  1026. for(let i=0;i<this.tableOut.length;i++){
  1027. total+= this.getMySelfCount(this.tableOut[i].good_id) * this.tableOut[i].packing_price
  1028. }
  1029. return total
  1030. },
  1031. getStorehouseName(id){
  1032. var storehouse_name = ""
  1033. for(let i=0;i<this.houseList.length;i++){
  1034. if(id == this.houseList[i].id){
  1035. storehouse_name = this.houseList[i].storehouse_name
  1036. }
  1037. }
  1038. if(storehouse_name == "全部"){
  1039. return ""
  1040. }else{
  1041. return storehouse_name
  1042. }
  1043. },
  1044. changeHouseList(){
  1045. this.houseList = []
  1046. this.GetCancelStock()
  1047. },
  1048. getWarehouseOut(good_id){
  1049. var total = 0
  1050. for(let i=0;i<this.wareOutList.length;i++){
  1051. if(this.wareOutList[i].good_id == good_id){
  1052. total += this.wareOutList[i].count
  1053. }
  1054. }
  1055. return total
  1056. },
  1057. getPatientName(id){
  1058. var name =""
  1059. for(let i=0;i<this.patientsList.length;i++){
  1060. if(id == this.patientsList[i].id){
  1061. name = this.patientsList[i].name
  1062. }
  1063. }
  1064. return name
  1065. }
  1066. }
  1067. };
  1068. </script>
  1069. <style rel="stylesheet/css" lang="scss" scoped>
  1070. .information {
  1071. border: 1px #dcdfe6 solid;
  1072. padding: 30px 20px 30px 20px;
  1073. .border {
  1074. border-bottom: 1px #dcdfe6 solid;
  1075. margin: 0px 0 20px 0;
  1076. }
  1077. }
  1078. .edit_separater {
  1079. border-top: 1px solid rgb(233, 233, 233);
  1080. margin-top: 15px;
  1081. margin-bottom: 15px;
  1082. }
  1083. // .table{
  1084. // display: flex;
  1085. // flex-direction: column;
  1086. // .el-table__header-wrapper {
  1087. // height: 70px !important;
  1088. // }
  1089. // }
  1090. </style>
  1091. <style>
  1092. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1093. font-size: 12px;
  1094. }
  1095. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1096. background: #6fb5fa;
  1097. }
  1098. .count {
  1099. color: #bd2c00;
  1100. }
  1101. .el-table td,
  1102. .el-table th.is-leaf,
  1103. .el-table--border,
  1104. .el-table--group {
  1105. border-color: #d0d3da;
  1106. }
  1107. .el-table--border::after,
  1108. .el-table--group::after,
  1109. .el-table::before {
  1110. background-color: #d0d3da;
  1111. }
  1112. </style>