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

drugStockInOrderEdit.vue 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  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. class="filter-item"
  21. >保 存</el-button
  22. >
  23. </div>
  24. </div>
  25. <div class="app-container">
  26. <!--<stock-in-dialog-->
  27. <!--ref="dialog"-->
  28. <!--:propForm="propForm"-->
  29. <!--:visibility="isVisibility"-->
  30. <!--v-on:dialog-comfirm="comfirm"-->
  31. <!--v-on:dialog-cancle="cancle"-->
  32. <!--&gt;</stock-in-dialog>-->
  33. <drugs-stock-dialog
  34. ref="dialog"
  35. :propForm="propForm"
  36. :visibility="isVisibility"
  37. v-on:dialog-comfirm="comfirm"
  38. v-on:dialog-cancle="cancle"
  39. >
  40. </drugs-stock-dialog>
  41. <div class="cell clearfix">
  42. <label class="title"><span class="name">入库时间</span> : </label>
  43. <el-date-picker
  44. size="small"
  45. v-model="warehousing_time"
  46. prefix-icon="el-icon-date"
  47. :editable="false"
  48. style="width: 196px;"
  49. type="date"
  50. placeholder="选择日期时间"
  51. align="right"
  52. format="yyyy-MM-dd"
  53. value-format="yyyy-MM-dd"
  54. >
  55. </el-date-picker>
  56. </div>
  57. <div class="cell clearfix">
  58. <label class="title"><span class="name">经销商</span> : </label>
  59. <el-select
  60. size="small"
  61. v-model="form.dealer"
  62. clearable
  63. placeholder="请选择经销商"
  64. >
  65. <el-option
  66. v-for="(option, index) in dealer"
  67. :key="index"
  68. :label="option.dealer_name"
  69. :value="option.id"
  70. >
  71. </el-option>
  72. </el-select>
  73. </div>
  74. <div class="cell clearfix">
  75. <label class="title"><span class="name">厂商</span> : </label>
  76. <el-select
  77. size="small"
  78. v-model="form.manufacturer"
  79. clearable
  80. placeholder="请选择厂商"
  81. >
  82. <el-option
  83. v-for="(option, index) in manufacturer"
  84. :key="index"
  85. :label="option.manufacturer_name"
  86. :value="option.id"
  87. >
  88. </el-option>
  89. </el-select>
  90. </div>
  91. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  92. <el-table
  93. id="oictable"
  94. :data="recordInfo.recordData"
  95. :class="signAndWeighBoxPatients"
  96. style="width: 100%"
  97. border
  98. max-height="450"
  99. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  100. >
  101. <el-table-column align="center" width="200">
  102. <template slot="header" slot-scope="scope">
  103. <span>药品名称<span style="color: red">*</span></span>
  104. </template>
  105. <template slot-scope="scope">
  106. <el-form-item style="padding-top: 15px">
  107. <el-input
  108. placeholder="请输入药品名称"
  109. v-model="scope.row.drug_id"
  110. :value="typeName(scope.row.drug_id)"
  111. @focus="showDialog(scope.$index, scope.row)"
  112. ></el-input>
  113. </el-form-item>
  114. </template>
  115. </el-table-column>
  116. <el-table-column align="center" width="200">
  117. <template slot="header" slot-scope="scope">
  118. <span>规格名称<span style="color: red">*</span></span>
  119. </template>
  120. <template slot-scope="scope">
  121. <el-form-item style="padding-top: 15px">
  122. <el-input
  123. placeholder="请输入规格名称"
  124. v-model="scope.row.drug_id"
  125. :value="specificationName(scope.row.drug_id)"
  126. @focus="showDialog(scope.$index, scope.row)"
  127. ></el-input>
  128. </el-form-item>
  129. </template>
  130. </el-table-column>
  131. <el-table-column align="center" width="150">
  132. <template slot="header" slot-scope="scope">
  133. <span>进价<span style="color: red">*</span></span>
  134. </template>
  135. <template slot-scope="scope">
  136. <!--<el-input type="number" v-model="scope.row.price" @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
  137. <el-form-item
  138. :prop="'recordData.' + scope.$index + '.price'"
  139. :rules="tableRules.price"
  140. style="padding-top: 17px"
  141. >
  142. <el-input
  143. placeholder="请输入单价"
  144. type="number"
  145. v-model="scope.row.price"
  146. ></el-input>
  147. </el-form-item>
  148. </template>
  149. </el-table-column>
  150. <el-table-column align="center" width="180">
  151. <template slot="header" slot-scope="scope">
  152. <span>入库数量<span style="color: red">*</span></span>
  153. </template>
  154. <template slot-scope="scope">
  155. <!--{{scope.row.warehousing_count}}-->
  156. <!--<el-input type="number" v-model="scope.row.warehousing_count" @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
  157. <el-form-item
  158. :prop="'recordData.' + scope.$index + '.warehousing_count'"
  159. :rules="tableRules.warehousing_count"
  160. style="padding-top: 17px"
  161. >
  162. <el-input
  163. placeholder="请输入入库数量"
  164. type="number"
  165. v-model="scope.row.warehousing_count"
  166. ></el-input>
  167. </el-form-item>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="进价总价" align="center" width="150">
  171. <template slot-scope="scope">
  172. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="零价" align="center" width="150">
  176. <template slot-scope="scope">
  177. {{ scope.row.retail_price }}
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="零价总价" align="center" width="150">
  181. <template slot-scope="scope">
  182. {{ calculate(scope.row.retail_price * scope.row.warehousing_count) }}
  183. </template>
  184. </el-table-column>
  185. <el-table-column align="center" width="150">
  186. <template slot="header" slot-scope="scope">
  187. <span>批号</span>
  188. </template>
  189. <template slot-scope="scope">
  190. <el-form-item>
  191. <el-input
  192. placeholder="请输入批号"
  193. v-model="scope.row.number"
  194. ></el-input>
  195. </el-form-item>
  196. </template>
  197. </el-table-column>
  198. <el-table-column label="生产日期" width="250" align="center">
  199. <template slot-scope="scope">
  200. <!--{{scope.row.product_date | parseTime("{y}-{m}-{d}")}}-->
  201. <el-date-picker
  202. prefix-icon="el-icon-date"
  203. style="width: 145px"
  204. v-model="scope.row.product_date"
  205. type="date"
  206. placeholder="选择日期时间"
  207. format="yyyy-MM-dd"
  208. value-format="yyyy-MM-dd"
  209. ></el-date-picker>
  210. </template>
  211. </el-table-column>
  212. <el-table-column label="有效日期" width="250" align="center">
  213. <template slot-scope="scope">
  214. <!--{{ scope.row.expiry_date | parseTime("{y}-{m}-{d}")}}-->
  215. <el-date-picker
  216. prefix-icon="el-icon-date"
  217. style="width: 145px"
  218. v-model="scope.row.expiry_date"
  219. type="date"
  220. placeholder="选择日期时间"
  221. format="yyyy-MM-dd"
  222. value-format="yyyy-MM-dd"
  223. ></el-date-picker>
  224. </template>
  225. </el-table-column>
  226. <el-table-column label="备注" width="150" align="center">
  227. <template slot-scope="scope">
  228. <el-input v-model="scope.row.remark"></el-input>
  229. </template>
  230. </el-table-column>
  231. <el-table-column
  232. label="操作"
  233. fixed="right"
  234. align="center"
  235. width="150"
  236. >
  237. <template slot-scope="scope">
  238. <el-tooltip
  239. class="item"
  240. effect="dark"
  241. content="新增"
  242. placement="top"
  243. >
  244. <el-button
  245. size="mini"
  246. type="primary"
  247. icon="el-icon-circle-plus-outline"
  248. @click="handleEdit(scope.$index, scope.row)"
  249. >
  250. </el-button>
  251. </el-tooltip>
  252. <el-tooltip
  253. class="item"
  254. effect="dark"
  255. content="删除"
  256. placement="top"
  257. >
  258. <el-button
  259. size="mini"
  260. type="danger"
  261. icon="el-icon-delete"
  262. @click="handleDelete(scope.$index, scope.row)"
  263. >
  264. </el-button>
  265. </el-tooltip>
  266. </template>
  267. </el-table-column>
  268. </el-table>
  269. </el-form>
  270. </div>
  271. </div>
  272. </template>
  273. <script>
  274. // import stockInDialog from "./Dialog/stockInDialog";
  275. import { uParseTime } from "@/utils/tools";
  276. import {
  277. GetAllConfig,
  278. GetAllDrugInfoByID,
  279. getDrugWarehouseInfoList,
  280. modifyDrugWarehouseInfo,
  281. deleteDrugWarehouseInfo,
  282. DeleteDrugWarehouseInfoItem,
  283. EditDrugWarehouse
  284. } from "@/api/drug/drug_stock";
  285. import BreadCrumb from "../../components/bread-crumb";
  286. import DrugsStockDialog from './drugsStockDialog/index'
  287. export default {
  288. components: { DrugsStockDialog, BreadCrumb },
  289. name: "stockIn",
  290. data() {
  291. var checkGoodId = (rule, value, callback) => {
  292. setTimeout(() => {
  293. if (value == "" || value == 0) {
  294. return callback(new Error("规格名称不能为空"));
  295. }
  296. }, 2000);
  297. };
  298. return {
  299. crumbs: [
  300. { path: false, name: "库存管理" },
  301. { path: false, name: "药品入库单" },
  302. { path: false, name: "药品入库单" }
  303. ],
  304. crumbs2: [
  305. { path: false, name: "库存管理" },
  306. { path: false, name: "其他入库单" },
  307. { path: false, name: "编辑入库单" }
  308. ],
  309. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  310. warehousing_time: "",
  311. adminUserOptions: null,
  312. currentIndex: 0,
  313. recordInfo: {
  314. recordData: [],
  315. stock_in_code: "",
  316. current_index: ""
  317. },
  318. tableRules: {
  319. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  320. warehousing_count: [
  321. { required: true, message: "数量不能为空", trigge: "blur" }
  322. ],
  323. good_id: [{ validator: checkGoodId, trigger: "blur" }]
  324. },
  325. total: "",
  326. product_date: "",
  327. expiry_date: "",
  328. numbers: "",
  329. // prop
  330. isVisibility: false,
  331. propForm: {
  332. goods: [],
  333. goodType: [],
  334. goodInfo: [],
  335. goodUnit: [],
  336. title: "入库",
  337. isCreated: 1
  338. },
  339. form: {
  340. manufacturer: "",
  341. dealer: ""
  342. },
  343. warehouse: {},
  344. manufacturer: [],
  345. dealer: [],
  346. goodType: [],
  347. goodInfo:[],
  348. };
  349. },
  350. methods: {
  351. comfirm: function(val) {
  352. this.$refs.dialog.hide();
  353. console.log(val)
  354. if (val.selectedGoodInfo.length > 0) {
  355. for (let i = val.selectedGoodInfo.length - 1; i >= 0 ; i--) {
  356. if (i == 0) {
  357. this.recordInfo.recordData[this.currentIndex].drug_id =
  358. val.selectedGoodInfo[i].id;
  359. this.recordInfo.recordData[this.currentIndex].price = val.selectedGoodInfo[i].last_price.toString()
  360. this.recordInfo.recordData[this.currentIndex].retail_price = val.selectedGoodInfo[i].retail_price.toString()
  361. } else {
  362. const tempForm = {};
  363. tempForm["id"] = 0;
  364. tempForm["drug_id"] = val.selectedGoodInfo[i].id;
  365. tempForm["number"] = "";
  366. tempForm["product_date"] = "";
  367. tempForm["expiry_date"] = "";
  368. tempForm["warehousing_count"] = "";
  369. tempForm["price"] = val.selectedGoodInfo[i].last_price.toString();
  370. tempForm["remark"] = "";
  371. tempForm["dealer"] = "";
  372. tempForm["manufacturer"] = "";
  373. tempForm["retail_price"] = val.selectedGoodInfo[i].retail_price.toString();
  374. this.recordInfo.recordData.splice(
  375. this.currentIndex + 1,
  376. 0,
  377. tempForm
  378. );
  379. }
  380. }
  381. }
  382. console.log( this.recordInfo.recordData)
  383. this.currentIndex = -1;
  384. },
  385. cancle: function() {
  386. this.$refs.dialog.hide();
  387. this.propForm.goods = [];
  388. this.propForm.goodType = [];
  389. },
  390. GetConfigInfo: function() {
  391. const loading = this.$loading({
  392. lock: true,
  393. text: "Loading",
  394. spinner: "el-icon-loading",
  395. background: "rgba(0, 0, 0, 0.7)"
  396. });
  397. GetAllConfig().then(response => {
  398. if (response.data.state == 0) {
  399. this.$message.error(response.data.msg);
  400. return false;
  401. } else {
  402. this.manufacturer = response.data.data.manufacturer;
  403. this.dealer = response.data.data.dealer;
  404. for(let i = 0; i< response.data.data.drugs.length;i++){
  405. this.goodType.push(response.data.data.drugs[i])
  406. if(response.data.data.drugs[i].drug_specs != null) {
  407. for (let b = 0; b < response.data.data.drugs[i].drug_specs.length; b++) {
  408. this.goodInfo.push(response.data.data.drugs[i].drug_specs[b])
  409. }
  410. }
  411. }
  412. this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: "全部" });
  413. this.dealer.splice(0, 0, { id: 0, dealer_name: "全部" });
  414. }
  415. loading.close();
  416. });
  417. },
  418. typeName: function(drug_id) {
  419. let name = "";
  420. for (let i = 0; i < this.goodInfo.length; i++) {
  421. if (this.goodInfo[i].id == drug_id) {
  422. name = this.goodInfo[i].drug_name;
  423. }
  424. }
  425. return name;
  426. },
  427. specificationName: function(drug_id) {
  428. console.log(this.goodInfo)
  429. let name = "";
  430. for (let i = 0; i < this.goodInfo.length; i++) {
  431. if (this.goodInfo[i].id == drug_id) {
  432. name = this.goodInfo[i].drug_spec;
  433. }
  434. }
  435. return name;
  436. },
  437. handleEdit: function(index, row) {
  438. const tempObj = {};
  439. tempObj["id"] = 0;
  440. tempObj["drug_id"] = 0;
  441. tempObj["number"] = "";
  442. tempObj["product_date"] = "";
  443. tempObj["expiry_date"] = "";
  444. tempObj["warehousing_count"] = "";
  445. tempObj["price"] = "";
  446. tempObj["remark"] = "";
  447. tempObj["dealer"] = "";
  448. tempObj["manufacturer"] = "";
  449. tempObj['retail_price'] = ""
  450. this.recordInfo.recordData.push(tempObj);
  451. },
  452. handleDelete: function(index, row) {
  453. if (row.id == 0) {
  454. this.recordInfo.recordData.splice(index, 1);
  455. } else {
  456. const params = {
  457. id: row.id
  458. };
  459. this.$confirm("确认删除该入库商品信息记录?", "删除入库商品信息记录", {
  460. confirmButtonText: "确定",
  461. cancelButtonText: "取消",
  462. type: "warning"
  463. })
  464. .then(() => {
  465. DeleteDrugWarehouseInfoItem(params).then(response => {
  466. if (response.data.state == 0) {
  467. this.$message.error(response.data.msg);
  468. return false;
  469. } else {
  470. this.$message.success("删除成功");
  471. this.recordInfo.recordData.splice(index, 1);
  472. }
  473. });
  474. })
  475. .catch(() => {});
  476. }
  477. },
  478. calculate: function(val) {
  479. if (val == 0) {
  480. return "";
  481. }
  482. return Math.round(parseFloat(val) * 100) / 100;
  483. },
  484. getTime(val, temp) {
  485. if (val != 0) {
  486. return uParseTime(val, temp);
  487. } else {
  488. return "";
  489. }
  490. },
  491. showDialog(index, row) {
  492. this.currentIndex = index;
  493. const loading = this.$loading({
  494. lock: true,
  495. text: "Loading",
  496. spinner: "el-icon-loading",
  497. background: "rgba(0, 0, 0, 0.7)"
  498. });
  499. const params = {
  500. manufacturer_id: this.form.manufacturer,
  501. dealer_id: this.form.dealer
  502. };
  503. GetAllDrugInfoByID(params).then(response => {
  504. if (response.data.state == 0) {
  505. this.$message.error(response.data.msg);
  506. return false;
  507. } else {
  508. if (response.data.data.drugs.length <= 0) {
  509. this.$message.error("该厂商或经销商没有药品信息");
  510. loading.close();
  511. return;
  512. }
  513. this.$refs.dialog.show();
  514. for (let i = 0; i < response.data.data.drugs.length; i++) {
  515. this.propForm.goods.push(
  516. response.data.data.drugs[i]
  517. );
  518. }
  519. const obj = {};
  520. this.propForm.goods = this.propForm.goods.reduce(
  521. (cur, next) => {
  522. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  523. return cur;
  524. },
  525. []
  526. ); // 设置cur默认类型为数组,并且初始值为空的数组
  527. }
  528. for (let i = 0; i < this.propForm.goods.length; i++) {
  529. for (let a = 0; a < this.propForm.goods[i].drug_specs.length; a++) {
  530. var respObj = this.propForm.goods[i].drug_specs[a];
  531. respObj["isSelected"] = false;
  532. }
  533. }
  534. loading.close();
  535. });
  536. },
  537. back() {
  538. this.$router.go(-1);
  539. },
  540. submit() {
  541. this.$refs["tableForm"].validate(valid => {
  542. if (valid) {
  543. const array = this.recordInfo.recordData;
  544. for (let i = 0; i < array.length; i++) {
  545. if (array[i].drug_id == 0) {
  546. this.$message.error("药品名称或者药品规格名称不能为空");
  547. return;
  548. }
  549. }
  550. const params = {
  551. stockIn: this.recordInfo.recordData
  552. };
  553. console.log("params",params)
  554. EditDrugWarehouse(
  555. params,
  556. this.warehousing_time,
  557. this.$route.query.id,
  558. this.$route.query.type,
  559. this.form.manufacturer,
  560. this.form.dealer
  561. ).then(response => {
  562. if (response.data.state == 0) {
  563. this.$message.error(response.data.msg);
  564. return false;
  565. } else {
  566. this.$message.success("入库成功");
  567. this.$router.back(-1);
  568. }
  569. });
  570. } else {
  571. return false;
  572. }
  573. });
  574. },
  575. GetOrderDetail: function(order_id) {
  576. const params = {
  577. id: order_id
  578. };
  579. getDrugWarehouseInfoList(params).then(response => {
  580. if (response.data.state == 0) {
  581. this.$message.error(response.data.msg);
  582. return false;
  583. } else {
  584. for (let i = 0; i < response.data.data.info.length; i++) {
  585. response.data.data.info[i].product_date = this.getTime(
  586. response.data.data.info[i].product_date,
  587. "{y}-{m}-{d}"
  588. );
  589. response.data.data.info[i].expiry_date = this.getTime(
  590. response.data.data.info[i].expiry_date,
  591. "{y}-{m}-{d}"
  592. );
  593. response.data.data.info[i].price = response.data.data.info[
  594. i
  595. ].price.toString();
  596. response.data.data.info[i].retail_price = response.data.data.info[
  597. i
  598. ].retail_price.toString();
  599. response.data.data.info[
  600. i
  601. ].warehousing_count = response.data.data.info[
  602. i
  603. ].warehousing_count.toString();
  604. this.recordInfo.recordData.push(response.data.data.info[i]);
  605. }
  606. this.warehouse = response.data.data.warehousing;
  607. this.form.manufacturer = this.warehouse.manufacturer;
  608. this.form.dealer = this.warehouse.dealer;
  609. this.warehousing_time = this.getTime(
  610. this.warehouse.warehousing_time,
  611. "{y}-{m}-{d}"
  612. );
  613. if (this.recordInfo.recordData.length == 0) {
  614. const tempObj = {};
  615. tempObj["id"] = 0;
  616. tempObj["drug_id"] = 0;
  617. tempObj["number"] = "";
  618. tempObj["product_date"] = "";
  619. tempObj["expiry_date"] = "";
  620. tempObj["warehousing_count"] = "";
  621. tempObj["price"] = "";
  622. tempObj["remark"] = "";
  623. tempObj["dealer"] = "";
  624. tempObj["manufacturer"] = "";
  625. tempObj['retail_price'] = ""
  626. this.recordInfo.recordData.push(tempObj);
  627. }
  628. }
  629. });
  630. }
  631. },
  632. created() {
  633. this.GetConfigInfo();
  634. this.propForm.goodUnit = this.$store.getters.good_unit;
  635. const order_id = this.$route.query.id;
  636. this.GetOrderDetail(order_id);
  637. }
  638. };
  639. </script>
  640. <style>
  641. #oictable ::-webkit-scrollbar {
  642. height: 15px;
  643. }
  644. </style>
  645. <style rel="stylesheet/css" lang="scss" scoped>
  646. .information {
  647. border: 1px #dcdfe6 solid;
  648. padding: 30px 20px 30px 20px;
  649. .border {
  650. border-bottom: 1px #dcdfe6 solid;
  651. margin: 0px 0 20px 0;
  652. }
  653. }
  654. .edit_separater {
  655. border-top: 1px solid rgb(233, 233, 233);
  656. margin-top: 15px;
  657. margin-bottom: 15px;
  658. }
  659. </style>
  660. <style>
  661. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  662. font-size: 12px;
  663. }
  664. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  665. background: #6fb5fa;
  666. }
  667. </style>