drugOutDetail.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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. <div class="cell clearfix">
  12. <el-input
  13. size="small"
  14. style="width: 400px;"
  15. class="filter-item"
  16. v-model.trim="searchKey"
  17. placeholder="单据编码/制单人/规格名称"
  18. />
  19. <el-button
  20. size="small"
  21. class="filter-item"
  22. type="primary"
  23. icon="el-icon-search"
  24. @click="search"
  25. >搜索</el-button
  26. >
  27. </div>
  28. <div class="cell clearfix">
  29. <label class="title"><span class="name">日期查询</span> : </label>
  30. <el-date-picker
  31. size="small"
  32. v-model="start_time"
  33. prefix-icon="el-icon-date"
  34. :editable="false"
  35. style="width: 196px;"
  36. type="date"
  37. placeholder="选择日期时间"
  38. align="right"
  39. format="yyyy-MM-dd"
  40. value-format="yyyy-MM-dd"
  41. @change="startTimeChange"
  42. ></el-date-picker>
  43. <span class="cellLine"> - </span>
  44. <el-date-picker
  45. size="small"
  46. v-model="end_time"
  47. prefix-icon="el-icon-date"
  48. :editable="false"
  49. style="width: 196px;"
  50. type="date"
  51. placeholder="选择日期时间"
  52. align="right"
  53. format="yyyy-MM-dd"
  54. value-format="yyyy-MM-dd"
  55. @change="endTimeChange"
  56. ></el-date-picker>
  57. </div>
  58. <div class="cell clearfix">
  59. <label class="title"><span class="name">单据类型</span> : </label>
  60. <el-select
  61. size="small"
  62. v-model="order_type"
  63. clearable
  64. placeholder="单据类型"
  65. @change="changeType"
  66. >
  67. <el-option
  68. v-for="item in orderTypeArr"
  69. :key="item.value"
  70. :label="item.label"
  71. :value="item.value"
  72. >
  73. </el-option>
  74. </el-select>
  75. </div>
  76. <div class="cell clearfix">
  77. <label class="title"><span class="name">其它</span> : </label>
  78. <el-select
  79. size="small"
  80. v-model="manufacturer_id"
  81. clearable
  82. placeholder="厂商"
  83. @change="changeManufacturer"
  84. >
  85. <el-option
  86. v-for="item in manufacturer"
  87. :key="item.id"
  88. :label="item.manufacturer_name"
  89. :value="item.id"
  90. >
  91. </el-option>
  92. </el-select>
  93. </div>
  94. <el-row :gutter="12" style="margin-top: 10px">
  95. <el-table
  96. :data="tableData"
  97. :class="signAndWeighBoxPatients"
  98. border
  99. highlight-current-row
  100. ref="multipleTable"
  101. @selection-change="select"
  102. :row-style="{ color: '#303133' }"
  103. :header-cell-style="{
  104. backgroundColor: 'rgb(245, 247, 250)',
  105. color: '#606266'
  106. }"
  107. >
  108. <el-table-column label="单据编号" align="center" width="200">
  109. <template slot-scope="scope">
  110. {{ scope.row.warehouse_out_order_number }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="药品类型" align="center">
  114. <template slot-scope="scope">
  115. <span v-if="scope.row.drug_type == 1">西药</span>
  116. <span v-if="scope.row.drug_type == 2">草药</span>
  117. <span v-if="scope.row.drug_type == 3">成药</span>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="药品名称" align="center">
  121. <template slot-scope="scope">
  122. {{scope.row.drug_name}}
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="规格型号" align="center">
  126. <template slot-scope="scope">
  127. {{scope.row.drug_spec}}
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="单据类型" align="center">
  131. <template slot-scope="scope">
  132. <span v-if="scope.row.type == 1">药品出库单</span>
  133. <span v-if="scope.row.type == 2">其他</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="操作时间" align="center">
  137. <template slot-scope="scope">
  138. <span>{{getTime(scope.row.ctime)}}</span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="制单人" align="center">
  142. <template slot-scope="scope">
  143. {{getAdminUser(scope.row.creater)}}
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="出货价" align="center">
  147. <template slot-scope="scope">
  148. {{scope.row.price}}
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="数量" align="center">
  152. <template slot-scope="scope">
  153. {{scope.row.count}}
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="总价" align="center">
  157. <template slot-scope="scope">
  158. {{scope.row.total_price}}
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. <el-pagination
  163. @size-change="handleSizeChange"
  164. @current-change="handleCurrentChange"
  165. :page-sizes="[10, 50, 100]"
  166. :page-size="10"
  167. background
  168. style="margin-top:20px;float: right"
  169. layout="total, sizes, prev, pager, next, jumper"
  170. :total="total"
  171. >
  172. </el-pagination>
  173. </el-row>
  174. </div>
  175. </template>
  176. <script>
  177. import { uParseTime } from "@/utils/tools";
  178. import { fetchAllAdminUsers } from "@/api/doctor";
  179. import {GetAllConfig } from "@/api/stock";
  180. import {getDrugOutDetail } from "@/api/drug/drug_stock"
  181. export default {
  182. name: "stockOutDetail",
  183. created() {
  184. var nowDate = new Date();
  185. var nowYear = nowDate.getFullYear();
  186. var nowMonth = nowDate.getMonth() + 1;
  187. var nowDay = nowDate.getDate();
  188. this.end_time =
  189. nowYear +
  190. "-" +
  191. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  192. "-" +
  193. (nowDay < 10 ? "0" + nowDay : nowDay);
  194. nowDate.setMonth(nowDate.getMonth() - 1);
  195. nowYear = nowDate.getFullYear();
  196. nowMonth = nowDate.getMonth() + 1;
  197. nowDay = nowDate.getDate();
  198. this.start_time =
  199. nowYear +
  200. "-" +
  201. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  202. "-" +
  203. (nowDay < 10 ? "0" + nowDay : nowDay);
  204. this.GetConfigInfo();
  205. this.fetchAllAdminUsers();
  206. this.getlist()
  207. },
  208. data() {
  209. return {
  210. orderTypeArr: [
  211. { value: 1, label: "药品出库单" },
  212. { value: 2, label: "其他入库单" }
  213. ],
  214. manufacturer_id: "",
  215. dealer_id: "",
  216. order_type: "",
  217. searchKey: "",
  218. type: 2,
  219. page: 1,
  220. limit: 10,
  221. checked: false,
  222. total: 0,
  223. pageTotal: 0,
  224. pageSelect: 0,
  225. adminUserOptions: [],
  226. multipleSelection: [],
  227. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  228. start_time: "",
  229. cancelStockDate: [],
  230. end_time: "",
  231. goodType: [],
  232. goodInfo: [],
  233. manufacturer: [],
  234. selectedTableData: [],
  235. dealer: [],
  236. tableData:[]
  237. };
  238. },
  239. methods: {
  240. changeType: function(val) {
  241. this.order_type = val;
  242. this.getlist()
  243. },
  244. changeManufacturer: function(val) {
  245. this.manufacturer_id = val;
  246. this.getlist()
  247. },
  248. getTypeName: function(row) {
  249. let name = "";
  250. const name2 = "";
  251. if (row.type == 1) {
  252. name = "药品出库单";
  253. } else if (row.type == 2) {
  254. name = "其他出库单";
  255. }
  256. return name;
  257. },
  258. search: function() {
  259. this.getlist()
  260. },
  261. getXuserName(id) {
  262. if (id <= 0) {
  263. return "";
  264. }
  265. var name = "";
  266. if (
  267. this.adminUserOptions == null ||
  268. typeof this.adminUserOptions.length === "undefined"
  269. ) {
  270. return name;
  271. }
  272. var leng = this.adminUserOptions.length;
  273. if (leng == 0) {
  274. return name;
  275. }
  276. for (let index = 0; index < leng; index++) {
  277. if (this.adminUserOptions[index].id == id) {
  278. name = this.adminUserOptions[index].name;
  279. break;
  280. }
  281. }
  282. return name;
  283. },
  284. fetchAllAdminUsers() {
  285. fetchAllAdminUsers().then(response => {
  286. console.log(response);
  287. if (response.data.state == 1) {
  288. this.adminUserOptions = response.data.data.users;
  289. }
  290. });
  291. },
  292. handleSelectionChange: function(val) {
  293. this.multipleSelection = val;
  294. },
  295. handleSizeChange(val) {
  296. this.limit = val;
  297. this.getlist()
  298. },
  299. handleCurrentChange(val) {
  300. this.page = val;
  301. this.getlist()
  302. },
  303. startTimeChange(val) {
  304. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  305. if (time > 0) {
  306. this.$message.error("结束时间不能小于开始时间");
  307. this.start_time = "";
  308. } else {
  309. this.getlist()
  310. }
  311. },
  312. endTimeChange(val) {
  313. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  314. if (time < 0) {
  315. this.$message.error("结束时间不能小于开始时间");
  316. this.end_time = "";
  317. } else {
  318. this.getlist()
  319. }
  320. },
  321. getTimestamp(time) {
  322. // 把时间日期转成时间戳
  323. return new Date(time).getTime() / 1000;
  324. },
  325. calculate: function(val) {
  326. return Math.round(parseFloat(val) * 100) / 100;
  327. },
  328. GetConfigInfo() {
  329. GetAllConfig().then(response => {
  330. if (response.data.state == 0) {
  331. this.$message.error(response.data.msg);
  332. return false;
  333. } else {
  334. this.manufacturer = response.data.data.manufacturer;
  335. this.dealer = response.data.data.dealer;
  336. this.goodInfo = response.data.data.goodInfo;
  337. this.goodType = response.data.data.goodType;
  338. }
  339. });
  340. },
  341. getTime: function(val) {
  342. if (val == 0) {
  343. return "";
  344. } else {
  345. return uParseTime(val, "{y}-{m}-{d}");
  346. }
  347. },
  348. PrintAction: function() {
  349. this.$router.push("/stock/drugoutorderprint?start_time="+this.start_time+"&end_time="+this.end_time+"&order_type="+this.order_type+"&manufacturer_id="+this.manufacturer_id+"&keyword="+this.keyword+"&limit="+this.limit+"&page="+this.page)
  350. },
  351. getlist(){
  352. var params = {
  353. start_time:this.start_time,
  354. end_time:this.end_time,
  355. order_type:this.order_type,
  356. manufacturer_id:this.manufacturer_id,
  357. keyword:this.searchKey,
  358. page:this.page,
  359. limit:this.limit,
  360. }
  361. getDrugOutDetail(params).then(response=>{
  362. if(response.data.state == 1){
  363. var order = response.data.data.order
  364. console.log("出库数据",order)
  365. this.tableData = order
  366. var total = response.data.data.total
  367. this.total = total
  368. }
  369. })
  370. },
  371. select(){
  372. },
  373. getAdminUser(id){
  374. var name = ""
  375. for(let i=0;i<this.adminUserOptions.length;i++){
  376. if(id == this.adminUserOptions[i].id){
  377. name = this.adminUserOptions[i].name
  378. }
  379. }
  380. return name
  381. }
  382. }
  383. };
  384. </script>
  385. <style rel="stylesheet/css" lang="scss" scoped>
  386. .information {
  387. border: 1px #dcdfe6 solid;
  388. padding: 30px 20px 30px 20px;
  389. .border {
  390. border-bottom: 1px #dcdfe6 solid;
  391. margin: 0px 0 20px 0;
  392. }
  393. }
  394. .edit_separater {
  395. border-top: 1px solid rgb(233, 233, 233);
  396. margin-top: 15px;
  397. margin-bottom: 15px;
  398. }
  399. </style>
  400. <style>
  401. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  402. font-size: 12px;
  403. }
  404. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  405. background: #6fb5fa;
  406. }
  407. .count {
  408. color: #bd2c00;
  409. }
  410. .el-table td,
  411. .el-table th.is-leaf,
  412. .el-table--border,
  413. .el-table--group {
  414. border-color: #d0d3da;
  415. }
  416. .el-table--border::after,
  417. .el-table--group::after,
  418. .el-table::before {
  419. background-color: #d0d3da;
  420. }
  421. </style>