editWarehouseInfo.vue 38KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb v-if="type == 1" :crumbs="crumbs"></bread-crumb>
  5. <bread-crumb v-if="type == 2" :crumbs="crumbs2"></bread-crumb>
  6. <div style="float: right">
  7. <el-button size="small" @click="back()" class="filter-item"
  8. >取 消</el-button
  9. >
  10. <el-button
  11. size="small"
  12. type="primary"
  13. @click="submit()"
  14. class="filter-item"
  15. >保 存</el-button
  16. >
  17. <el-button
  18. size="small"
  19. type="primary"
  20. @click="toCheck()"
  21. v-show ="showCheck"
  22. class="filter-item"
  23. >审核</el-button
  24. >
  25. <el-button
  26. size="small"
  27. type="primary"
  28. v-if="is_check == 1 && parseInt(this.$route.query.is_sys) == 0"
  29. @click="toReturnCheck()"
  30. class="filter-item"
  31. >反审核</el-button>
  32. </div>
  33. </div>
  34. <div class="app-container" v-loading="loading">
  35. <div class="cell clearfix">
  36. <label class="title"
  37. ><span class="name"><span style="color: red">*</span>患者</span>
  38. :</label
  39. >
  40. <el-select
  41. size="small"
  42. v-model="patient_id"
  43. filterable
  44. placeholder="请选择患者"
  45. style="width: 200px"
  46. >
  47. <el-option
  48. v-for="(option, index) in patientList"
  49. :key="index"
  50. :label="option.name"
  51. :value="option.id"
  52. >
  53. </el-option>
  54. </el-select>
  55. <label class="title"><span class="name">入库时间</span> : </label>
  56. <el-date-picker
  57. size="small"
  58. v-model="warehousing_time"
  59. prefix-icon="el-icon-date"
  60. :editable="false"
  61. style="width: 196px"
  62. type="date"
  63. placeholder="选择日期时间"
  64. align="right"
  65. format="yyyy-MM-dd"
  66. value-format="yyyy-MM-dd"
  67. ></el-date-picker>
  68. <div class="titleOne">
  69. 制单人:{{ this.$store.getters.xt_user.user.user_name }}
  70. </div>
  71. </div>
  72. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  73. <el-table
  74. id="oictable"
  75. :data="recordInfo.recordData"
  76. :class="signAndWeighBoxPatients"
  77. style="width: 100%"
  78. border
  79. max-height="450"
  80. v-loading="listLoading"
  81. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  82. >
  83. <el-table-column align="center" width="200" fixed="left">
  84. <template slot="header" slot-scope="scope">
  85. <span>药品名称<span style="color: red">*</span></span>
  86. </template>
  87. <template slot-scope="scope">
  88. <el-form-item style="padding-top: 20px">
  89. <el-autocomplete
  90. class="checkSearch"
  91. popper-class="my-autocomplete"
  92. v-model="scope.row.drug_name"
  93. :fetch-suggestions="querySearchAsync"
  94. :trigger-on-focus="true"
  95. placeholder="请输入药品名称"
  96. @select="handleSelect"
  97. @input="changeDrugName(scope.$index)"
  98. style="width: 160px"
  99. >
  100. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  101. <template slot-scope="{ item }">
  102. <div class="name">
  103. {{
  104. item.drug_name +
  105. item.dose +
  106. item.dose_unit +
  107. "*" +
  108. item.min_number +
  109. item.min_unit +
  110. "/" +
  111. item.max_unit +
  112. " " +
  113. item.manufacturer
  114. }}
  115. </div>
  116. </template>
  117. </el-autocomplete>
  118. </el-form-item>
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="center" width="140">
  122. <template slot="header" slot-scope="scope">
  123. <span>药品类型</span>
  124. </template>
  125. <template slot-scope="scope">
  126. <el-select
  127. v-model="scope.row.drug_type"
  128. filterable
  129. placeholder="请选择药品类型"
  130. >
  131. <el-option
  132. v-for="(option, index) in drugTypeList"
  133. :key="index"
  134. :label="option.name"
  135. :value="option.id"
  136. >
  137. </el-option>
  138. </el-select>
  139. </template>
  140. </el-table-column>
  141. <el-table-column align="center" width="140">
  142. <template slot="header" slot-scope="scope">
  143. <span>规格&单位</span>
  144. </template>
  145. <template slot-scope="scope">
  146. <el-form-item style="padding-top: 20px">
  147. <el-input
  148. :disabled="true"
  149. placeholder="请输入规格&单位"
  150. v-model="scope.row.name"
  151. ></el-input>
  152. </el-form-item>
  153. </template>
  154. </el-table-column>
  155. <el-table-column align="center" width="150">
  156. <template slot="header" slot-scope="scope">
  157. <span>批号<span style="color: red">*</span></span>
  158. </template>
  159. <template slot-scope="scope">
  160. <el-form-item
  161. style="padding-top: 20px"
  162. :rules="tableRules.batch_number"
  163. :prop="'recordData.' + scope.$index + '.batch_number'"
  164. >
  165. <el-input
  166. placeholder="请输入批号"
  167. v-model="scope.row.batch_number"
  168. ></el-input>
  169. </el-form-item>
  170. </template>
  171. </el-table-column>
  172. <el-table-column align="center" width="200">
  173. <template slot="header" slot-scope="scope">
  174. <span>入库数量<span style="color: red">*</span></span>
  175. </template>
  176. <template slot-scope="scope">
  177. <el-form-item
  178. :prop="'recordData.' + scope.$index + '.warehousing_count'"
  179. :rules="tableRules.warehousing_count"
  180. style="padding-top: 10px"
  181. >
  182. <div style="display: flex">
  183. <!-- <el-input
  184. oninput="value=value.replace(/\D|^0/g,'')"
  185. placeholder="请输入入库数量"
  186. type="number"
  187. v-model="scope.row.warehousing_count"
  188. style="width:120px"
  189. ></el-input> -->
  190. <el-input
  191. placeholder="请输入入库数量"
  192. v-model="scope.row.warehousing_count"
  193. style="width: 120px"
  194. ></el-input>
  195. <el-select
  196. v-model="scope.row.max_unit"
  197. filterable
  198. placeholder="请选择单位"
  199. style="width: 80px"
  200. @change="changeUnit(scope.row,scope.$index)"
  201. >
  202. <el-option
  203. v-for="(option, index) in scope.row.unitList"
  204. :key="index"
  205. :label="option.name"
  206. :value="option.name"
  207. >
  208. </el-option>
  209. </el-select>
  210. </div>
  211. </el-form-item>
  212. </template>
  213. </el-table-column>
  214. <el-table-column width="180" align="center">
  215. <template slot="header" slot-scope="scope">
  216. <span>有效日期<span style="color: red">*</span></span>
  217. </template>
  218. <template slot-scope="scope">
  219. <el-form-item
  220. :prop="'recordData.' + scope.$index + '.expiry_date'"
  221. :rules="tableRules.expiry_date"
  222. style="padding-top: 20px"
  223. >
  224. <el-date-picker
  225. prefix-icon="el-icon-date"
  226. style="width: 145px"
  227. v-model="scope.row.expiry_date"
  228. type="date"
  229. placeholder="选择日期时间"
  230. format="yyyy-MM-dd"
  231. value-format="yyyy-MM-dd"
  232. ></el-date-picker>
  233. </el-form-item>
  234. </template>
  235. </el-table-column>
  236. <el-table-column label="生产日期" width="180" align="center">
  237. <template slot-scope="scope">
  238. <el-date-picker
  239. prefix-icon="el-icon-date"
  240. style="width: 145px"
  241. v-model="scope.row.product_date"
  242. type="date"
  243. placeholder="选择日期时间"
  244. format="yyyy-MM-dd"
  245. value-format="yyyy-MM-dd"
  246. ></el-date-picker>
  247. </template>
  248. </el-table-column>
  249. <el-table-column label="生产厂家" width="140" align="center">
  250. <template slot-scope="scope">
  251. <el-select
  252. v-model="scope.row.manufacturer"
  253. filterable
  254. placeholder="请选择厂商"
  255. >
  256. <el-option
  257. v-for="(option, index) in manufacturerList"
  258. :key="index"
  259. :label="option.manufacturer_name"
  260. :value="option.id"
  261. >
  262. </el-option>
  263. </el-select>
  264. </template>
  265. </el-table-column>
  266. <el-table-column label="经销商" width="140" align="center">
  267. <template slot-scope="scope">
  268. <el-select
  269. v-model="scope.row.dealer"
  270. filterable
  271. placeholder="请选择经销商"
  272. >
  273. <el-option
  274. v-for="(option, index) in dealerList"
  275. :key="index"
  276. :label="option.dealer_name"
  277. :value="option.id"
  278. >
  279. </el-option>
  280. </el-select>
  281. </template>
  282. </el-table-column>
  283. <el-table-column label="备注" width="150" align="center">
  284. <template slot-scope="scope">
  285. <el-input v-model="scope.row.remark"></el-input>
  286. </template>
  287. </el-table-column>
  288. <el-table-column
  289. label="操作"
  290. fixed="right"
  291. align="center"
  292. width="150"
  293. >
  294. <template slot-scope="scope">
  295. <el-tooltip
  296. class="item"
  297. effect="dark"
  298. content="新增"
  299. placement="top"
  300. >
  301. <el-button
  302. size="mini"
  303. type="primary"
  304. icon="el-icon-circle-plus-outline"
  305. @click="handleEdit(scope.$index, scope.row)"
  306. >
  307. </el-button>
  308. </el-tooltip>
  309. <el-tooltip
  310. class="item"
  311. effect="dark"
  312. content="删除"
  313. placement="top"
  314. >
  315. <el-button
  316. size="mini"
  317. type="danger"
  318. icon="el-icon-delete"
  319. @click="handleDelete(scope.$index, scope.row)"
  320. >
  321. </el-button>
  322. </el-tooltip>
  323. </template>
  324. </el-table-column>
  325. </el-table>
  326. <!-- <div style="margin-top: 20px;">合计金额: {{getTotalPirce() }} </div> -->
  327. </el-form>
  328. </div>
  329. </div>
  330. </template>
  331. <script>
  332. import { uParseTime } from "@/utils/tools";
  333. import {
  334. GetAllDrugInfoByID,
  335. } from "@/api/drug/drug_stock";
  336. import BreadCrumb from "../../components/bread-crumb";
  337. import { getDataConfig, getDictionaryDataConfig } from "@/utils/data";
  338. import { getAllDrugList } from "@/api/data";
  339. import { getallPatientList,postSearchSelfDrugList,ModifySelfDrugWarehouse,getSelfDrugWarehouseInfoById,deleteSelfWarehouseInfo,toCheckSelfWarehousingInfo,returnSelfCheckWarehouse} from "@/api/drug/drug"
  340. export default {
  341. components: { BreadCrumb },
  342. name: "stockIn",
  343. data() {
  344. var checkGoodId = (rule, value, callback) => {
  345. setTimeout(() => {
  346. if (value == "" || value == 0) {
  347. return callback(new Error("规格名称不能为空"));
  348. }
  349. }, 2000);
  350. };
  351. return {
  352. crumbs: [
  353. { path: false, name: "库存管理" },
  354. { path: false, name: "药品入库单" },
  355. { path: false, name: "新增入库单" },
  356. ],
  357. crumbs2: [
  358. { path: false, name: "库存管理" },
  359. { path: false, name: "其他入库单" },
  360. { path: false, name: "新增入库单" },
  361. ],
  362. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  363. warehousing_time: "",
  364. adminUserOptions: null,
  365. currentIndex: 0,
  366. listLoading: false,
  367. recordInfo: {
  368. recordData: [],
  369. stock_in_code: "",
  370. current_index: "",
  371. },
  372. tableRules: {
  373. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  374. warehousing_count: [
  375. { required: true, message: "数量不能为空", trigger: "blur" },
  376. ],
  377. good_id: [{ validator: checkGoodId, trigger: "blur" }],
  378. min_unit: [
  379. { required: true, message: "单位不能为空", trigger: "blur" },
  380. ],
  381. batch_number: [
  382. { required: true, message: "批号不能为空", trigger: "blur" },
  383. ],
  384. expiry_date: [
  385. { required: true, message: "有效日期不能为空", trigger: "blur" },
  386. ],
  387. retail_price: [
  388. { required: true, message: "请输入包装零售价", trigger: "blur" },
  389. ],
  390. },
  391. type: this.$route.query.type,
  392. total: "",
  393. product_date: "",
  394. expiry_date: "",
  395. numbers: "",
  396. // prop
  397. isVisibility: false,
  398. propForm: {
  399. goods: [],
  400. goodType: [],
  401. goodInfo: [],
  402. goodUnit: [],
  403. title: "入库",
  404. formValue: {
  405. good_type_id: "",
  406. good_id: "",
  407. number: "",
  408. product_date: "",
  409. expiry_date: "",
  410. warehousing_count: "",
  411. price: "",
  412. remark: "",
  413. dealer: "",
  414. manufacturer: "",
  415. },
  416. isCreated: 1,
  417. },
  418. form: {
  419. manufacturer: "",
  420. dealer: "",
  421. },
  422. formValue: {
  423. good_type_id: "",
  424. good_id: "",
  425. number: "",
  426. product_date: "",
  427. expiry_date: "",
  428. warehousing_count: "",
  429. price: "",
  430. remark: "",
  431. dealer: "",
  432. manufacturer: "",
  433. },
  434. manufacturer: [],
  435. dealer: [],
  436. goodType: [],
  437. goodInfo: [],
  438. drugList: [],
  439. manufacturerList: [],
  440. dealerList: [],
  441. showOne: true,
  442. showTwo: false,
  443. drugTypeList: [],
  444. totalPrice: 0,
  445. unitList: [],
  446. loading: false,
  447. list: [],
  448. patient_id: "",
  449. warehousing_id:0,
  450. showCheck:false,
  451. showReturnCheck:false,
  452. patientList:[],
  453. id:0,
  454. is_check:0,
  455. is_sys:0,
  456. };
  457. },
  458. methods: {
  459. getallPatientList(){
  460. getallPatientList().then(response=>{
  461. if(response.data.state ==1){
  462. var patient = response.data.data.patient
  463. console.log("patient====",patient)
  464. this.patientList = []
  465. this.patientList = patient
  466. }
  467. })
  468. },
  469. handleSave: function () {
  470. if (this.recordInfo.recordData.length <= 0) {
  471. this.$message.error("请添加入库信息");
  472. return;
  473. }
  474. sessionStorage.removeItem("warehousing_orders");
  475. this.$router.back(-1);
  476. },
  477. handleCancle: function () {
  478. this.$confirm("是否放弃编辑返回上一页?", "放弃编辑", {
  479. confirmButtonText: "确定",
  480. cancelButtonText: "取消",
  481. type: "warning",
  482. })
  483. .then(() => {
  484. sessionStorage.removeItem("warehousing_orders");
  485. this.$router.back(-1);
  486. })
  487. .catch(() => {});
  488. },
  489. handleCreate: function () {
  490. this.propForm.formValue = {};
  491. this.propForm.isCreated = 1;
  492. this.isVisibility = true;
  493. },
  494. typeName: function (drug_id) {
  495. let name = "";
  496. for (let i = 0; i < this.goodInfo.length; i++) {
  497. if (this.goodInfo[i].id == drug_id) {
  498. name = this.goodInfo[i].drug_name;
  499. }
  500. }
  501. return name;
  502. },
  503. specificationName: function (drug_id) {
  504. let name = "";
  505. for (let i = 0; i < this.goodInfo.length; i++) {
  506. if (this.goodInfo[i].id == drug_id) {
  507. name = this.goodInfo[i].drug_spec;
  508. }
  509. }
  510. return name;
  511. },
  512. getDrugName: function (drug_id) {
  513. let name = "";
  514. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  515. if (drug_id == this.recordInfo.recordData[i].id) {
  516. name =
  517. this.recordInfo.recordData[i].dose +
  518. this.recordInfo.recordData[i].dose_unit +
  519. "*" +
  520. this.recordInfo.recordData[i].min_number +
  521. this.recordInfo.recordData[i].min_unit +
  522. "/" +
  523. this.recordInfo.recordData[i].max_unit;
  524. }
  525. }
  526. return name;
  527. },
  528. handleEdit: function (index, row) {
  529. const tempObj = {};
  530. tempObj["id"] = 0;
  531. tempObj["drug_name"] = "";
  532. tempObj["drug_id"] = 0;
  533. tempObj["number"] = "";
  534. tempObj["product_date"] = "";
  535. tempObj["expiry_date"] = "";
  536. tempObj["warehousing_count"] = "";
  537. tempObj["retail_price"] = "";
  538. tempObj["price"] = "";
  539. tempObj["remark"] = "";
  540. tempObj["dealer"] = "";
  541. tempObj["manufacturer"] = "";
  542. tempObj["min_unit"] = "";
  543. tempObj["max_unit"] = "";
  544. tempObj["drug_type"] = "";
  545. tempObj["batch_number"] = "";
  546. tempObj["dose"] = "";
  547. tempObj["dose_unit"] = "";
  548. tempObj["dealer"] = "";
  549. tempObj["last_price"] = "";
  550. tempObj["count_unit"] = "";
  551. tempObj["min_number"] = "";
  552. this.recordInfo.recordData.push(tempObj);
  553. },
  554. handleDelete: function (index, row) {
  555. this.$confirm('确定删除' + row.name + row.sub_name + '方案吗?', '提示', {
  556. confirmButtonText: '确定',
  557. cancelButtonText: '取消',
  558. type: 'warning'
  559. }).then(() => {
  560. deleteSelfWarehouseInfo(row.id).then(response => {
  561. if (response.data.state == 0) {
  562. this.$message.error(response.data.msg)
  563. return false
  564. } else {
  565. this.$notify({
  566. title: '成功',
  567. message: '删除成功',
  568. type: 'success',
  569. duration: 2000
  570. })
  571. this.tableData.splice(index, 1)
  572. }
  573. })
  574. })
  575. },
  576. calculate: function (val) {
  577. if (val == 0) {
  578. return "";
  579. }
  580. return Math.round(parseFloat(val) * 100) / 100;
  581. },
  582. getTime(val, temp) {
  583. if (val != 0) {
  584. return uParseTime(val, temp);
  585. } else {
  586. return "";
  587. }
  588. },
  589. getTimeOne(val) {
  590. if(val < 0){
  591. return ""
  592. }
  593. if(val == ""){
  594. return ""
  595. }else {
  596. return uParseTime(val, '{y}-{m}-{d}')
  597. }
  598. },
  599. showDialog(index, row) {
  600. const loading = this.$loading({
  601. lock: true,
  602. text: "Loading",
  603. spinner: "el-icon-loading",
  604. background: "rgba(0, 0, 0, 0.7)",
  605. });
  606. this.currentIndex = index;
  607. this.isVisibility = true;
  608. const params = {
  609. manufacturer_id: this.form.manufacturer,
  610. dealer_id: this.form.dealer,
  611. };
  612. GetAllDrugInfoByID(params).then((response) => {
  613. if (response.data.state == 0) {
  614. this.$message.error(response.data.msg);
  615. return false;
  616. loading.close();
  617. } else {
  618. loading.close();
  619. if (response.data.data.drugs.length <= 0) {
  620. this.$message.error("该厂商或经销商没有药品信息");
  621. return;
  622. }
  623. for (let i = 0; i < response.data.data.drugs.length; i++) {
  624. this.propForm.goods.push(response.data.data.drugs[i]);
  625. }
  626. this.$refs.dialog.show();
  627. const obj = {};
  628. this.propForm.goods = this.propForm.goods.reduce((cur, next) => {
  629. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  630. return cur;
  631. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  632. }
  633. for (let i = 0; i < this.propForm.goods.length; i++) {
  634. for (let a = 0; a < this.propForm.goods[i].drug_specs.length; a++) {
  635. var respObj = this.propForm.goods[i].drug_specs[a];
  636. respObj["isSelected"] = false;
  637. }
  638. }
  639. });
  640. },
  641. getSummaries(param) {
  642. const { columns, data } = param;
  643. const sums = [];
  644. columns.forEach((column, index) => {
  645. if (index === 0) {
  646. sums[index] = "总价";
  647. return;
  648. }
  649. const values = data.map((item) => Number(item[column.property]));
  650. if (!values.every((value) => isNaN(value))) {
  651. sums[index] = values.reduce((prev, curr) => {
  652. const value = Number(curr);
  653. if (!isNaN(value)) {
  654. return prev + curr;
  655. } else {
  656. return prev;
  657. }
  658. }, 0);
  659. sums[index] += " 元";
  660. } else {
  661. sums[index] = "N/A";
  662. }
  663. });
  664. return sums;
  665. },
  666. back() {
  667. this.$router.go(-1);
  668. },
  669. submit() {
  670. this.$refs["tableForm"].validate((valid) => {
  671. if (valid) {
  672. this.loading = true;
  673. const array = this.recordInfo.recordData;
  674. if (this.patient_id == 0) {
  675. this.$message.error("患者不能为空!");
  676. this.loading = false;
  677. return false;
  678. }
  679. for (let i = 0; i < array.length; i++) {
  680. if (array[i].drug_id == 0) {
  681. this.$message.error("药品名称或者药品规格名称不能为空");
  682. this.loading = false;
  683. return;
  684. }
  685. }
  686. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  687. if (this.recordInfo.recordData[i].dealer == "") {
  688. this.recordInfo.recordData[i].dealer = 0;
  689. }
  690. if (this.recordInfo.recordData[i].dealer == "") {
  691. this.recordInfo.recordData[i].dealer = 0;
  692. }
  693. for (let j = 0; j < this.manufacturerList.length; j++) {
  694. if (
  695. this.recordInfo.recordData[i].manufacturer ==
  696. this.manufacturerList[j].manufacturer_name
  697. ) {
  698. this.recordInfo.recordData[i].manufacturer =
  699. this.manufacturerList[j].id;
  700. }
  701. }
  702. for (let z = 0; z < this.dealerList.length; z++) {
  703. if (
  704. this.recordInfo.recordData[i].dealer ==
  705. this.dealerList[z].dealer_name
  706. ) {
  707. this.recordInfo.recordData[i].dealer = this.dealerList[z].id;
  708. }
  709. }
  710. }
  711. const params = {
  712. stockIn: this.recordInfo.recordData,
  713. };
  714. console.log("params=---------------",params)
  715. console.log("patinet_id-----------",this.patient_id)
  716. console.log("warehousing_time-----------",this.warehousing_time)
  717. console.log("warehousing_id--------------",this.warehousing_id)
  718. ModifySelfDrugWarehouse(
  719. params,
  720. this.patient_id,
  721. this.warehousing_time,
  722. this.warehousing_id,
  723. ).then((response) => {
  724. if (response.data.state == 0) {
  725. this.loading = false;
  726. this.$message.error(response.data.msg);
  727. return false;
  728. } else {
  729. this.loading = false;
  730. this.$message.success("保存成功");
  731. this.showCheck = true
  732. this.showReturnCheck = false
  733. this.listLoading = false;
  734. var list = response.data.data.list
  735. var manufacturerList = response.data.data.manufacturerList
  736. var dealerList = response.data.data.dealerList
  737. var drugTypeList = response.data.data.drugTypeList
  738. var info = response.data.data.info
  739. this.warehousing_id = info.id
  740. for(let i=0;i<list.length;i++){
  741. for(let j=0;j<manufacturerList.length;j++){
  742. if(list[i].manufacturer_id == manufacturerList[j].id){
  743. list[i].manufacturer_id = manufacturerList[j].manufacturer_name
  744. }
  745. }
  746. for(let s=0;s<dealerList.length;s++){
  747. if(list[i].dealer_id == dealerList[s].id){
  748. list[i].dealer_id = dealerList[s].manufacturer_name
  749. }
  750. }
  751. list[i].expiry_date = this.getTimeOne(list[i].expiry_date)
  752. list[i].product_date = this.getTimeOne(list[i].product_date)
  753. list[i].drug_name = list[i].drug.drug_name
  754. list[i].name = list[i].drug.dose + list[i].drug.dose_unit +"*"+list[i].drug.min_number +list[i].drug.min_unit+"/"+list[i].drug.max_unit
  755. for(let z=0;z<drugTypeList.length;z++){
  756. if(list[i].drug.drug_type == drugTypeList[z].value){
  757. list[i].drug_type = drugTypeList[z].name
  758. }
  759. }
  760. list[i].last_price = list[i].price
  761. list[i].warehousing_count = list[i].warehousing_count.toString()
  762. list[i].unitList = []
  763. var obj = {id:1,name:""}
  764. obj.name = list[i].drug.max_unit
  765. var objOne = {id:2,name:""}
  766. objOne.name = list[i].drug.min_unit
  767. list[i].unitList.push(obj)
  768. list[i].unitList.push(objOne)
  769. }
  770. this.recordInfo.recordData = []
  771. console.log("list========================",list)
  772. this.recordInfo.recordData = list
  773. }
  774. });
  775. } else {
  776. return false;
  777. }
  778. });
  779. },
  780. changeManufacturer(val) {},
  781. changeDealer(val) {
  782. this.form.dealer = val;
  783. this.propForm.goods = [];
  784. },
  785. getDataConfig(module, filed_name) {
  786. return getDataConfig(module, filed_name);
  787. },
  788. getDictionaryDataConfig(module, filed_name) {
  789. return getDictionaryDataConfig(module, filed_name);
  790. },
  791. // 改版后的JS
  792. getlist() {
  793. getAllDrugList().then((response) => {
  794. if (response.data.state == 1) {
  795. var list = response.data.data.list;
  796. this.drugList = list;
  797. var manufacturerList = response.data.data.manufacturerList;
  798. this.manufacturerList = manufacturerList;
  799. for (let i = 0; i < this.drugList.length; i++) {
  800. for (let j = 0; j < this.manufacturerList.length; j++) {
  801. if (
  802. this.drugList[i].manufacturer == this.manufacturerList[j].id
  803. ) {
  804. this.drugList[i].manufacturer =
  805. this.manufacturerList[j].manufacturer_name;
  806. }
  807. }
  808. }
  809. }
  810. });
  811. },
  812. changeDrugName(val) {
  813. this.showOne = false;
  814. this.showTwo = true;
  815. },
  816. querySearchAsync(keyword, cb) {
  817. let key = "";
  818. if (keyword != undefined) {
  819. key = keyword;
  820. }
  821. let searchArray = [];
  822. postSearchSelfDrugList(key).then((response) => {
  823. if (response.data.state == 1) {
  824. searchArray = response.data.data.list;
  825. var list = response.data.data.list;
  826. this.drugList = list;
  827. var manufacturerList = response.data.data.manufacturerList;
  828. this.manufacturerList = manufacturerList;
  829. var dealerList = response.data.data.dealerList;
  830. this.dealerList = dealerList;
  831. for (let i = 0; i < this.drugList.length; i++) {
  832. for (let j = 0; j < this.manufacturerList.length; j++) {
  833. if (
  834. this.drugList[i].manufacturer == this.manufacturerList[j].id
  835. ) {
  836. this.drugList[i].manufacturer =
  837. this.manufacturerList[j].manufacturer_name;
  838. }
  839. }
  840. for (let z = 0; z < dealerList.length; z++) {
  841. if (this.drugList[i].dealer == this.dealerList[z].id) {
  842. this.drugList[i].dealer = this.dealerList[z].dealer_name;
  843. }
  844. }
  845. }
  846. cb(this.drugList);
  847. } else {
  848. cb([]);
  849. }
  850. });
  851. },
  852. changeDrugName(val) {
  853. this.currentIndex = val;
  854. },
  855. handleSelect(val) {
  856. console.log("val-------------------",val)
  857. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  858. if (i == this.currentIndex) {
  859. this.recordInfo.recordData[i].drug_id = val.id;
  860. this.recordInfo.recordData[i].drug_name = val.drug_name;
  861. this.recordInfo.recordData[i].drug_type = val.drug_type;
  862. this.recordInfo.recordData[i].name = val.dose + val.dose_unit +"*" +val.min_number +val.min_unit +"/" +val.max_unit;
  863. this.recordInfo.recordData[i].last_price = val.last_price;
  864. this.recordInfo.recordData[i].retail_price = val.min_price;
  865. this.recordInfo.recordData[i].manufacturer = val.manufacturer;
  866. this.recordInfo.recordData[i].number = val.number;
  867. this.recordInfo.recordData[i].max_unit = val.max_unit;
  868. this.recordInfo.recordData[i].min_unit = val.min_unit;
  869. this.recordInfo.recordData[i].count_unit = val.max_unit;
  870. this.recordInfo.recordData[i].min_number = val.min_number
  871. if (val.dealer == 0) {
  872. this.recordInfo.recordData[i].dealer = "";
  873. } else {
  874. this.recordInfo.recordData[i].dealer = val.dealer;
  875. }
  876. this.recordInfo.recordData[i].unitList = []
  877. var obj = {id:1,name:""}
  878. var objOne= {id:2,name:""}
  879. obj.name = val.max_unit
  880. objOne.name = val.min_unit
  881. this.recordInfo.recordData[i].unitList.push(obj)
  882. this.recordInfo.recordData[i].unitList.push(objOne)
  883. }
  884. }
  885. },
  886. toCheck(){
  887. const loading = this.$loading({
  888. lock: true,
  889. text: "Loading",
  890. spinner: "el-icon-loading",
  891. background: "rgba(0, 0, 0, 0.7)",
  892. });
  893. var params = {
  894. warehousing_id:this.warehousing_id,
  895. patient_id:this.patient_id
  896. }
  897. console.log("praams------",params)
  898. toCheckSelfWarehousingInfo(params).then(response=>{
  899. if(response.data.state == 1){
  900. var list = response.data.data.list
  901. this.$message.success("审核成功!")
  902. this.$router.back(-1);
  903. this.showCheck = false
  904. this.showReturnCheck = true
  905. loading.close()
  906. }else{
  907. this.$message.error("审核失败!")
  908. loading.close()
  909. }
  910. })
  911. },
  912. toReturnCheck(){
  913. const loading = this.$loading({
  914. lock: true,
  915. text: "Loading",
  916. spinner: "el-icon-loading",
  917. background: "rgba(0, 0, 0, 0.7)",
  918. });
  919. var params = {
  920. warehousing_id:this.warehousing_id,
  921. patient_id:this.patient_id,
  922. }
  923. returnSelfCheckWarehouse(params).then(response=>{
  924. if(response.data.state == 1){
  925. var list = response.data.data.list
  926. this.$message.success("反审核成功!")
  927. this.showCheck = true
  928. this.showReturnCheck = false
  929. loading.close()
  930. }else{
  931. this.$message.error("反审核失败!")
  932. loading.close()
  933. }
  934. })
  935. },
  936. //新
  937. getSelfDrugWarehouseInfoById(id){
  938. getSelfDrugWarehouseInfoById(id).then(response=>{
  939. if(response.data.state == 1){
  940. var info = response.data.data.info
  941. if(info.is_check == 2){
  942. this.showCheck = true
  943. this.showReturnCheck = false
  944. }
  945. if(info.is_check == 1){
  946. this.showCheck = false
  947. this.showReturnCheck = true
  948. }
  949. this.patient_id = info.patient_id
  950. this.warehousing_time =this.getTimeOne(info.record_date)
  951. this.manufacturerList = response.data.data.manufacturerList
  952. this.dealerList = response.data.data.dealerList
  953. this.drugTypeList = response.data.data.drugTypeList
  954. var warehouseInfo = response.data.data.warehouseInfo
  955. this.warehousing_id = warehouseInfo.id
  956. const tempObj = {};
  957. tempObj["id"] = info.id;
  958. tempObj["drug_id"] = info.drug_id;
  959. tempObj["drug_name"] = info.drug.drug_name;
  960. tempObj["max_unit"] = info.max_unit;
  961. tempObj["min_unit"] = info.min_unit,
  962. tempObj["product_date"] = this.getTimeOne(info.product_date);
  963. tempObj["expiry_date"] = this.getTimeOne(info.expiry_date);
  964. tempObj["warehousing_count"] = info.warehousing_count.toString();
  965. tempObj["remark"] = info.remark;
  966. tempObj["dealer"] =this.getDealer(info.dealer)
  967. tempObj["manufacturer"] = this.getManufacturer(info.manufacturer);
  968. tempObj["batch_number"] = info.batch_number;
  969. tempObj["drug_type"] =this.GetDrugTypeName(info.drug.drug_type)
  970. tempObj["number"] = info.number;
  971. tempObj["count_unit"] = info.max_unit;
  972. tempObj["name"] = info.drug.dose + info.drug.dose_unit + "*" + info.drug.min_number+info.drug.min_unit +"/"+info.drug.max_unit
  973. this.recordInfo.recordData = []
  974. this.recordInfo.recordData.push(tempObj);
  975. }
  976. })
  977. },
  978. getManufacturer(id) {
  979. var name = "";
  980. for (let i = 0; i < this.manufacturerList.length; i++) {
  981. if (id == this.manufacturerList[i].id) {
  982. name = this.manufacturerList[i].manufacturer_name;
  983. }
  984. }
  985. return name;
  986. },
  987. getDealer(id) {
  988. var name = "";
  989. for (let i = 0; i < this.dealerList.length; i++) {
  990. if (id == this.dealerList[i].id) {
  991. name = this.dealerList[i].dealer_name;
  992. }
  993. }
  994. return name;
  995. },
  996. GetDrugTypeName(drug_type){
  997. var name = ""
  998. for(let i=0;i<this.drugTypeList.length;i++){
  999. if(drug_type == this.drugTypeList[i].value){
  1000. name = this.drugTypeList[i].name
  1001. }
  1002. }
  1003. return name
  1004. },
  1005. },
  1006. created() {
  1007. var id = this.$route.query.id
  1008. var is_sys = this.$route.query.is_sys
  1009. this.is_sys = is_sys
  1010. console.log("is_check-=------------------------------------",is_sys)
  1011. var is_check = this.$route.query.is_check
  1012. console.log("is_check-=------------------------------------",is_check)
  1013. this.is_check= is_check
  1014. this.drugTypeList = getDictionaryDataConfig("system", "drug_type");
  1015. this.getallPatientList()
  1016. this.getSelfDrugWarehouseInfoById(id)
  1017. this.propForm.goodUnit = this.$store.getters.good_unit;
  1018. },
  1019. };
  1020. </script>
  1021. <style>
  1022. #oictable ::-webkit-scrollbar {
  1023. height: 15px;
  1024. }
  1025. </style>
  1026. <style rel="stylesheet/css" lang="scss" scoped>
  1027. .information {
  1028. border: 1px #dcdfe6 solid;
  1029. padding: 30px 20px 30px 20px;
  1030. .border {
  1031. border-bottom: 1px #dcdfe6 solid;
  1032. margin: 0px 0 20px 0;
  1033. }
  1034. }
  1035. .edit_separater {
  1036. border-top: 1px solid rgb(233, 233, 233);
  1037. margin-top: 15px;
  1038. margin-bottom: 15px;
  1039. }
  1040. .titleOne {
  1041. width: 120px;
  1042. display: inline-block;
  1043. font-weight: normal;
  1044. color: #909399;
  1045. padding: 6px 0;
  1046. margin-left: 20px;
  1047. }
  1048. </style>
  1049. <style>
  1050. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1051. font-size: 12px;
  1052. }
  1053. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1054. background: #6fb5fa;
  1055. }
  1056. .el-autocomplete-suggestion {
  1057. width: 400px !important;
  1058. }
  1059. </style>