Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

drugStockInOrderEdit.vue 36KB

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