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

transEdit.vue 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <div>
  6. <el-button type="primary" @click="submit">保存</el-button>
  7. <el-button type="warning" @click="examine" v-if="is_check == 2"
  8. >审核</el-button
  9. >
  10. <el-button type="warning" @click="approval" v-if="is_check == 1"
  11. >反审核</el-button
  12. >
  13. </div>
  14. </div>
  15. <div class="app-container" v-loading="loading">
  16. <div
  17. style="
  18. justify-content: flex-start;
  19. margin: 0px 0 12px 0;
  20. display: flex;
  21. align-items: center;
  22. "
  23. >
  24. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  25. <el-form-item label="单据日期:">
  26. <el-date-picker
  27. :disabled="store_disabled"
  28. v-model="warehousing_time"
  29. type="date"
  30. format="yyyy-MM-dd"
  31. value-format="yyyy-MM-dd"
  32. placeholder="选择日期"
  33. ></el-date-picker>
  34. </el-form-item>
  35. <span style="display: inline-block; margin-top: 8px; font-size: 14px"
  36. ><span style="color: red; font-size: 14px">*</span>调出仓库:</span
  37. >
  38. <el-form-item prop="storehouse_out_id">
  39. <el-select
  40. size="small"
  41. v-model="storehouse_out_id"
  42. filterable
  43. placeholder="请选择调出仓库"
  44. :disabled="store_disabled"
  45. @change="changeHouseList"
  46. >
  47. <el-option
  48. v-for="(option, index) in houseList"
  49. :key="index"
  50. :label="option.storehouse_name"
  51. :value="option.id"
  52. >
  53. </el-option>
  54. </el-select>
  55. </el-form-item>
  56. <span style="display: inline-block; margin-top: 8px; font-size: 14px"
  57. ><span style="color: red; font-size: 14px">*</span>调入仓库:</span
  58. >
  59. <el-form-item prop="storehouse_in_id">
  60. <el-select
  61. size="small"
  62. v-model="storehouse_in_id"
  63. filterable
  64. placeholder="请选择调入仓库"
  65. :disabled="store_disabled"
  66. @change="changeHouseInfoList"
  67. >
  68. <el-option
  69. v-for="(option, index) in houseList"
  70. :key="index"
  71. :label="option.storehouse_name"
  72. :value="option.id"
  73. >
  74. </el-option>
  75. </el-select>
  76. </el-form-item>
  77. </el-form>
  78. </div>
  79. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  80. <el-table
  81. :header-cell-style="{
  82. backgroundColor: 'rgb(245, 247, 250)',
  83. color: '#606266',
  84. }"
  85. :data="recordInfo.recordData"
  86. border
  87. >
  88. >
  89. <el-table-column align="center" width="230">
  90. <template slot="header" slot-scope="scope">
  91. 商品名称<span style="color: red">*</span>
  92. </template>
  93. <template slot-scope="scope">
  94. <el-form-item
  95. :prop="'recordData.' + scope.$index + '.name'"
  96. :rules="tableRules.name"
  97. >
  98. <el-select
  99. v-model="scope.row.name"
  100. style="width: 200"
  101. filterable
  102. placeholder="请选择商品"
  103. @change="changeName"
  104. @input="changeGoodName(scope.$index)"
  105. :disabled="store_disabled"
  106. >
  107. <el-option
  108. v-for="(item, index) in tabList"
  109. :key="index"
  110. :label="item.project_name"
  111. :value="item"
  112. >
  113. </el-option>
  114. </el-select>
  115. </el-form-item>
  116. </template>
  117. </el-table-column>
  118. <el-table-column align="center" width="200">
  119. <template slot="header" slot-scope="scope">
  120. <span>商品类型<span style="color: red">*</span></span>
  121. </template>
  122. <template slot-scope="scope">
  123. <el-form-item style="padding-top: 20px">
  124. <el-input
  125. v-model="scope.row.project_type"
  126. :disabled="true"
  127. style="width: 180px"
  128. ></el-input>
  129. <div style="height: 20px;visibility: hidden">/</div>
  130. </el-form-item>
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="center" width="100">
  134. <template slot="header" slot-scope="scope">
  135. 国家编码
  136. </template>
  137. <template slot-scope="scope">
  138. {{ scope.row.medical_insurance_number? scope.row.medical_insurance_number:"" }}
  139. </template>
  140. </el-table-column>
  141. <el-table-column align="center" width="250">
  142. <template slot="header" slot-scope="scope">
  143. <span>规格<span style="color: red">*</span></span>
  144. </template>
  145. <template slot-scope="scope">
  146. <el-form-item style="padding-top: 20px">
  147. <el-input
  148. v-model="scope.row.second_specification_name"
  149. style="width: 200px"
  150. :disabled="true"
  151. ></el-input>
  152. <div style="height: 20px;visibility: hidden">/</div>
  153. </el-form-item>
  154. </template>
  155. </el-table-column>
  156. <el-table-column align="center" width="250">
  157. <template slot="header" slot-scope="scope">
  158. <span>调拨数量<span style="color: red">*</span></span>
  159. </template>
  160. <template slot-scope="scope">
  161. <el-form-item
  162. style="padding-top: 20px"
  163. :prop="'recordData.' + scope.$index + '.count'"
  164. oninput="value=value.replace(/\D|^0/g,'')"
  165. :rules="tableRules.count"
  166. >
  167. <el-input
  168. v-model="scope.row.count"
  169. style="width: 100px"
  170. :disabled="store_disabled"
  171. @input="
  172. selectCount(
  173. scope.row.project_id,
  174. scope.row.sencond_unit,
  175. scope.row.is_source,
  176. scope.row.count,
  177. scope.$index
  178. )
  179. "
  180. ></el-input>
  181. <el-select
  182. :disabled="store_disabled"
  183. v-model="scope.row.sencond_unit"
  184. style="width: 100px"
  185. filterable
  186. placeholder="请选择"
  187. >
  188. <el-option
  189. v-for="(item, index) in scope.row.unitList"
  190. :key="index"
  191. :label="item.name"
  192. :value="item.name"
  193. >
  194. </el-option>
  195. </el-select>
  196. <div style="height: 20px;visibility: hidden">/</div>
  197. </el-form-item>
  198. </template>
  199. </el-table-column>
  200. <el-table-column label="库存总数" align="center" width="200">
  201. <template slot="header" slot-scope="scope">
  202. <span>库存总数<span style="color: red">*</span></span>
  203. </template>
  204. <template slot-scope="scope">
  205. <el-form-item style="padding-top: 20px">
  206. <el-input
  207. v-model="scope.row.second_total"
  208. style="width: 150px"
  209. :disabled="true"
  210. ></el-input>
  211. <div style="height: 20px;visibility: hidden">/</div>
  212. </el-form-item>
  213. </template>
  214. </el-table-column>
  215. <el-table-column label="备注" align="center" width="200">
  216. <template slot-scope="scope">
  217. <el-input
  218. v-model="scope.row.remake"
  219. style="width: 160px"
  220. :disabled="store_disabled"
  221. ></el-input>
  222. <div style="height: 20px;visibility: hidden">/</div>
  223. </template>
  224. </el-table-column>
  225. <el-table-column label="操作" align="center" width="190px">
  226. <template slot-scope="scope">
  227. <el-tooltip class="item" content="新增" placement="top-start">
  228. <el-button
  229. icon="el-icon-plus"
  230. size="small"
  231. type="primary"
  232. @click="toAdd(scope.row)"
  233. >
  234. </el-button>
  235. </el-tooltip>
  236. <el-tooltip class="item" content="删除" placement="top-start">
  237. <el-button
  238. icon="el-icon-delete"
  239. size="small"
  240. type="danger"
  241. @click="toDelete(scope.row, scope.$index)"
  242. >
  243. </el-button>
  244. </el-tooltip>
  245. </template>
  246. </el-table-column>
  247. </el-table>
  248. </el-form>
  249. </div>
  250. </div>
  251. </template>
  252. <script>
  253. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  254. import { uParseTime } from "@/utils/tools";
  255. import {
  256. getSencondeGoodList,
  257. updateSencondOrder,
  258. getSencondOrderDetail,
  259. returnCheckSecondOrder,
  260. getSumSecondeCount,
  261. checkSecondOrder,
  262. getStoreHouseGoodList,
  263. deleteSecondeOrderInfo,
  264. } from "@/api/seconde";
  265. export default {
  266. components: {
  267. BreadCrumb,
  268. },
  269. data() {
  270. return {
  271. crumbs: [
  272. { path: false, name: "库房管理" },
  273. { path: "/stock/warehousequery", name: "编辑调拨" },
  274. ],
  275. value1: "",
  276. total: 0,
  277. page: 1,
  278. limit: 10,
  279. tableData: [{}, {}],
  280. formInline: {
  281. user: "",
  282. region: "",
  283. },
  284. currentIndex: 0,
  285. tableRules: {
  286. name: [
  287. { required: true, message: "商品名称不能为空", trigger: "blur" },
  288. ],
  289. count: [
  290. { required: true, message: "调拨数量不能为空", trigger: "blur" },
  291. ],
  292. },
  293. goodType: [],
  294. manufacturerList: [],
  295. goodList: [],
  296. loading: false,
  297. list: [],
  298. configlist: {},
  299. recordInfo: {
  300. recordData: [],
  301. },
  302. drugList: [],
  303. goodTypeList: [],
  304. drugTypeList: [],
  305. houseList: [],
  306. tabList: [],
  307. disabled: false,
  308. storehouse_out_id: "",
  309. storehouse_in_id: "",
  310. is_check: 0,
  311. store_disabled: false,
  312. loading: false,
  313. warehousing_time: "",
  314. };
  315. },
  316. methods: {
  317. // 初始化数据
  318. init() {},
  319. // 反审核
  320. // 反审核
  321. approval() {
  322. this.loading = true;
  323. var id = this.$route.query.id;
  324. var array = [];
  325. array.push(id);
  326. var ids = array.join(",");
  327. returnCheckSecondOrder(ids).then((response) => {
  328. if (response.data.state == 1) {
  329. this.loading = false;
  330. var msg = response.data.data.msg;
  331. if (msg == 0) {
  332. this.$message.success("反审核失败!");
  333. this.getlist();
  334. }
  335. if (msg == 1) {
  336. this.$message.success("反审核成功!");
  337. this.getlist();
  338. }
  339. if (msg == 2) {
  340. var good_name = response.data.data.good_name;
  341. var specification_name = response.data.data.specification_name;
  342. var storehose_name = response.data.data.storehose_name;
  343. this.$message.error(
  344. storehose_name +
  345. " " +
  346. good_name +
  347. "*" +
  348. specification_name +
  349. "库存不足,无法调拨,请修改调拨数量!"
  350. );
  351. }
  352. if (msg == 3) {
  353. var drug_name = response.data.data.drug_name;
  354. var dose = response.data.data.dose;
  355. var dose_unit = response.data.data.dose_unit;
  356. var min_number = response.data.data.min_number;
  357. var min_unit = response.data.data.min_unit;
  358. var max_unit = response.data.data.max_unit;
  359. var str =
  360. drug_name +
  361. " " +
  362. dose +
  363. dose_unit +
  364. "*" +
  365. min_number +
  366. min_unit +
  367. "/" +
  368. max_unit;
  369. var storehose_name = response.data.data.storehose_name;
  370. this.$message.error(
  371. storehose_name + " " + str + "库存不足,无法调拨,请修改调拨数量!"
  372. );
  373. }
  374. }
  375. });
  376. },
  377. // 审核
  378. examine() {
  379. this.loading = true;
  380. var array = [];
  381. var id = parseInt(this.$route.query.id);
  382. array.push(id);
  383. var ids = array.join(",");
  384. console.log("ids233232232332", array);
  385. checkSecondOrder(ids).then((response) => {
  386. if (response.data.state == 1) {
  387. var msg = response.data.data.msg;
  388. this.loading = false;
  389. if (msg == 1) {
  390. this.$message.success("审核成功!");
  391. this.$router.push({ path: "/stock/inventoryTransfer" });
  392. }
  393. if (msg == 2) {
  394. var good_name = response.data.data.good_name;
  395. var specification_name = response.data.data.specification_name;
  396. var storehose_name = response.data.data.storehose_name;
  397. this.$message.error(
  398. storehose_name +
  399. " " +
  400. good_name +
  401. "*" +
  402. specification_name +
  403. "库存不足,无法调拨,请修改调拨数量!"
  404. );
  405. }
  406. if (msg == 3) {
  407. var drug_name = response.data.data.drug_name;
  408. var dose = response.data.data.dose;
  409. var dose_unit = response.data.data.dose_unit;
  410. var min_number = response.data.data.min_number;
  411. var min_unit = response.data.data.min_unit;
  412. var max_unit = response.data.data.max_unit;
  413. var str =
  414. drug_name +
  415. " " +
  416. dose +
  417. dose_unit +
  418. "*" +
  419. min_number +
  420. min_unit +
  421. "/" +
  422. max_unit;
  423. var storehose_name = response.data.data.storehose_name;
  424. this.$message.error(
  425. storehose_name + " " + str + "库存不足,无法调拨,请修改调拨数量!"
  426. );
  427. }
  428. }
  429. });
  430. },
  431. // 表单添加
  432. toAdd() {
  433. if (this.is_check == 1) {
  434. this.$message.error("已审核的数据不能新增!");
  435. return;
  436. }
  437. const tempObj = {};
  438. tempObj["id"] = 0;
  439. tempObj["name"] = "";
  440. tempObj["project_name"] = "";
  441. tempObj["project_type"] = "";
  442. tempObj["second_specification_name"] = "";
  443. tempObj["sencond_unit"] = "";
  444. tempObj["count"] = "";
  445. tempObj["second_total"] = "";
  446. tempObj["is_source"] = 0;
  447. tempObj["remake"] = "";
  448. tempObj["project_id"] = 0;
  449. tempObj["min_price"] = 0;
  450. tempObj["medical_insurance_number"] = ""
  451. this.recordInfo.recordData.push(tempObj);
  452. },
  453. // 删除
  454. toDelete(val, index) {
  455. if (this.is_check == 1) {
  456. this.$message.error("已审核的数据不能删除!");
  457. return;
  458. }
  459. if (this.recordInfo.recordData.length <= 1) {
  460. this.$message.error("只有一条记录的时候无法删除");
  461. return;
  462. }
  463. this.$confirm("确认删除吗?", "删除", {
  464. confirmButtonText: "确 定",
  465. cancelButtonText: "取 消",
  466. type: "warning",
  467. })
  468. .then(() => {
  469. deleteSecondeOrderInfo(val.id).then((response) => {
  470. if (response.data.state == 1) {
  471. var msg = response.data.data.msg;
  472. this.$message.success("删除成功");
  473. this.recordInfo.recordData.splice(index, 1);
  474. } else {
  475. this.$message.error("删除失败");
  476. }
  477. });
  478. })
  479. .catch(() => {});
  480. },
  481. // 详情查看
  482. toDetails() {},
  483. // 表单全选
  484. handleSelectionChange() {},
  485. // 页表操作
  486. handleSizeChange(val) {
  487. this.limit = val;
  488. this.init();
  489. },
  490. handleCurrentChange(val) {
  491. this.page = val;
  492. this.init();
  493. },
  494. // 表格样式
  495. changColor({ rowIndex }) {
  496. if (rowIndex % 2 == 1) {
  497. return {
  498. backgroundColor: "#C4E1FF",
  499. color: "#303133",
  500. };
  501. } else {
  502. return {
  503. backgroundColor: "#ACD6FF",
  504. color: "#303133",
  505. };
  506. }
  507. },
  508. //获取基本数据信息
  509. getlist() {
  510. getSencondeGoodList().then((response) => {
  511. if (response.data.state == 1) {
  512. var houseList = response.data.data.houseList;
  513. this.houseList = houseList;
  514. }
  515. });
  516. },
  517. getTime(val, temp) {
  518. if (val != 0) {
  519. return uParseTime(val, temp);
  520. } else {
  521. return "";
  522. }
  523. },
  524. changeGoodName(val) {
  525. this.currentIndex = val;
  526. },
  527. changeName(val) {
  528. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  529. if (this.currentIndex == i) {
  530. this.recordInfo.recordData[i].project_id = val.id;
  531. this.recordInfo.recordData[i].is_source = val.is_source;
  532. this.recordInfo.recordData[i].name = val.name;
  533. this.recordInfo.recordData[i].project_name = val.project_name;
  534. this.recordInfo.recordData[i].project_type = val.project_type;
  535. this.recordInfo.recordData[i].second_specification_name =
  536. val.second_specification_name;
  537. this.recordInfo.recordData[i].second_total = val.second_total;
  538. this.recordInfo.recordData[i].sencond_unit = val.sencond_unit;
  539. this.recordInfo.recordData[i].min_price = val.min_price;
  540. if (val.count == NaN) {
  541. this.recordInfo.recordData[i].count = "";
  542. } else {
  543. this.recordInfo.recordData[i].count = val.count ? val.count : "";
  544. }
  545. this.recordInfo.recordData[i].unitList = val.unitList;
  546. }
  547. }
  548. },
  549. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  550. var total = 0;
  551. var max_str = "";
  552. var min_str = "";
  553. if (arr.length > 0) {
  554. for (let i = 0; i < arr.length; i++) {
  555. total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
  556. }
  557. }
  558. if (total < min_number) {
  559. min_str = total + min_unit;
  560. }
  561. if (total == 0) {
  562. min_str = "";
  563. max_str = "";
  564. }
  565. if (total >= min_number) {
  566. if (parseInt(total / min_number) != 0) {
  567. max_str = parseInt(total / min_number) + max_unit;
  568. }
  569. if (total % min_number != 0) {
  570. min_str = (total % min_number) + min_unit;
  571. }
  572. }
  573. return max_str + min_str;
  574. },
  575. getTotalStockCount(arr) {
  576. var total_count = 0;
  577. for (let i = 0; i < arr.length; i++) {
  578. total_count += arr[i].stock_count;
  579. }
  580. return total_count;
  581. },
  582. getSencondOrderDetail() {
  583. var id = parseInt(this.$route.query.id);
  584. getSencondOrderDetail(id).then((response) => {
  585. if (response.data.state == 1) {
  586. var warehouse = response.data.data.warehouse;
  587. this.storehouse_in_id = warehouse.storehouse_in_id;
  588. this.storehouse_out_id = warehouse.storehouse_out_id;
  589. this.is_check = warehouse.is_check;
  590. if (warehouse.is_check == 1) {
  591. this.store_disabled = true;
  592. }
  593. if (warehouse.is_check == 2) {
  594. this.store_disabled = false;
  595. }
  596. var list = response.data.data.list;
  597. for (let i = 0; i < list.length; i++) {
  598. list[i].id = list[i].id;
  599. list[i].name = list[i].project_name;
  600. }
  601. this.recordInfo.recordData = list;
  602. this.warehousing_time = this.getTime(
  603. warehouse.record_date,
  604. "{y}-{m}-{d}"
  605. );
  606. var drugList = response.data.data.drugList;
  607. this.drugList = drugList;
  608. var goodList = response.data.data.goodList;
  609. this.goodList = goodList;
  610. var manufactuerList = response.data.data.manufacturerList;
  611. console.log("manufactuerList233232", manufactuerList);
  612. var goodTypeList = response.data.data.goodTypeList;
  613. this.goodTypeList = goodTypeList;
  614. var drugTypeList = response.data.data.drugTypeList;
  615. this.drugTypeList = drugTypeList;
  616. for (let i = 0; i < drugList.length; i++) {
  617. for (let j = 0; j < manufactuerList.length; j++) {
  618. if (drugList[i].manufacturer == manufactuerList[j].id) {
  619. drugList[i].manufacturer = manufactuerList[j].manufacturer_name;
  620. }
  621. }
  622. for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
  623. if (
  624. drugList[i].max_unit ==
  625. drugList[i].drug_warehouse_info[z].max_unit
  626. ) {
  627. drugList[i].drug_warehouse_info[z].stock_max_number =
  628. drugList[i].drug_warehouse_info[z].stock_max_number *
  629. drugList[i].min_number;
  630. }
  631. }
  632. for (let y = 0; y < this.drugTypeList.length; y++) {
  633. if (drugList[i].drug_type == this.drugTypeList[y].value) {
  634. drugList[i].drug_type = this.drugTypeList[y].name;
  635. }
  636. }
  637. drugList[i].name = drugList[i].drug_name;
  638. drugList[i].project_name =
  639. drugList[i].drug_name +
  640. " " +
  641. drugList[i].dose +
  642. drugList[i].dose_unit +
  643. "*" +
  644. drugList[i].min_number +
  645. drugList[i].min_unit +
  646. "/" +
  647. drugList[i].max_unit +
  648. " " +
  649. drugList[i].manufacturer;
  650. drugList[i].project_type = drugList[i].drug_type;
  651. drugList[i].second_specification_name =
  652. drugList[i].dose +
  653. drugList[i].dose_unit +
  654. "*" +
  655. drugList[i].min_number +
  656. drugList[i].min_unit +
  657. "/" +
  658. drugList[i].max_unit;
  659. drugList[i].second_total = this.getWarehoseInfo(
  660. drugList[i].drug_warehouse_info,
  661. drugList[i].max_unit,
  662. drugList[i].min_unit,
  663. drugList[i].min_number
  664. );
  665. drugList[i].is_source = 1;
  666. drugList[i].count = "";
  667. drugList[i].remake = "";
  668. drugList[i].min_price = drugList[i].min_price;
  669. if (drugList[i].max_unit != drugList[i].min_unit) {
  670. drugList[i].unitList = [
  671. { id: 1, name: "" },
  672. { id: 2, name: "" },
  673. ];
  674. }
  675. if (drugList[i].max_unit == drugList[i].min_unit) {
  676. drugList[i].unitList = [{ id: 1, name: "" }];
  677. }
  678. drugList[i].sencond_unit = drugList[i].max_unit;
  679. drugList[i].medical_insurance_number = drugList[i].medical_insurance_number
  680. for (let j = 0; j < drugList[i].unitList.length; j++) {
  681. if (drugList[i].max_unit != drugList[i].min_unit) {
  682. drugList[i].unitList[0].name = drugList[i].max_unit;
  683. drugList[i].unitList[1].name = drugList[i].min_unit;
  684. }
  685. if (drugList[i].max_unit == drugList[i].min_unit) {
  686. drugList[i].unitList[0].name = drugList[i].max_unit;
  687. }
  688. }
  689. this.tabList.push(drugList[i]);
  690. }
  691. for (let i = 0; i < goodList.length; i++) {
  692. for (let j = 0; j < manufactuerList.length; j++) {
  693. if (goodList[i].manufacturer == manufactuerList[j].id) {
  694. goodList[i].manufacturer = manufactuerList[j].manufacturer_name;
  695. }
  696. }
  697. for (let y = 0; y < this.goodTypeList.length; y++) {
  698. if (goodList[i].good_type_id == this.goodTypeList[y].id) {
  699. goodList[i].good_type_id = this.goodTypeList[y].type_name;
  700. }
  701. }
  702. goodList[i].name = goodList[i].good_name;
  703. goodList[i].project_name =
  704. goodList[i].good_name +
  705. " " +
  706. goodList[i].specification_name +
  707. " " +
  708. goodList[i].manufacturer;
  709. goodList[i].project_type = goodList[i].good_type_id;
  710. goodList[i].second_specification_name =
  711. goodList[i].specification_name;
  712. goodList[i].second_total = this.getTotalStockCount(
  713. goodList[i].good_warehouse_info
  714. );
  715. goodList[i].count = "";
  716. goodList[i].is_source = 2;
  717. goodList[i].name = goodList[i].good_name;
  718. goodList[i].unitList = [{ id: 1, name: "" }];
  719. goodList[i].sencond_unit = goodList[i].packing_unit;
  720. goodList[i].remake = "";
  721. goodList[i].min_price = goodList[i].retail_price;
  722. goodList[i].medical_insurance_number = goodList[i].medical_insurance_number
  723. for (let j = 0; j < goodList[i].unitList.length; j++) {
  724. goodList[i].unitList[0].name = goodList[i].packing_unit;
  725. }
  726. this.tabList.push(goodList[i]);
  727. }
  728. }
  729. });
  730. },
  731. submit() {
  732. this.$refs["tableForm"].validate((valid) => {
  733. if (valid) {
  734. const loading = this.$loading({
  735. lock: true,
  736. text: "Loading",
  737. spinner: "el-icon-loading",
  738. background: "rgba(0, 0, 0, 0.7)",
  739. });
  740. this.loading = true;
  741. const array = this.recordInfo.recordData;
  742. if(array!=null && array.length ==0){
  743. this.$message.error("请新增药品或者耗材")
  744. return false
  745. }
  746. if (this.storehouse_in_id <= 0) {
  747. this.$message.error("调入仓库不能为空!");
  748. this.loading = false;
  749. loading.close();
  750. return;
  751. }
  752. if (this.storehouse_out_id <= 0) {
  753. this.$message.error("调出仓库不能为空!");
  754. this.loading = false;
  755. loading.close();
  756. return;
  757. }
  758. for (let i = 0; i < array.length; i++) {
  759. array[i].count = parseInt(array[i].count);
  760. array[i].second_total = array[i].second_total.toString();
  761. }
  762. const params = {
  763. stockIn: this.recordInfo.recordData,
  764. };
  765. var storehouse_in_id = parseInt(this.storehouse_in_id);
  766. var storehouse_out_id = parseInt(this.storehouse_out_id);
  767. var id = parseInt(this.$route.query.id);
  768. var warehouse_time = this.warehousing_time;
  769. updateSencondOrder(
  770. params,
  771. warehouse_time,
  772. storehouse_in_id,
  773. storehouse_out_id,
  774. id
  775. ).then((response) => {
  776. if (response.data.state == 1) {
  777. var warehousingInfo = response.data.data.warehousingInfo;
  778. this.$message.success("保存成功");
  779. this.loading = false;
  780. loading.close();
  781. this.$router.push({ path: "/stock/inventoryTransfer" });
  782. } else {
  783. this.$message.error("保存失败");
  784. loading.close();
  785. this.loading = false;
  786. }
  787. });
  788. } else {
  789. return false;
  790. }
  791. });
  792. },
  793. selectCount(project_id, sencond_unit, is_source, count, index) {
  794. var params = {
  795. project_id: project_id,
  796. sencond_unit: sencond_unit,
  797. is_source: parseInt(is_source),
  798. count: parseInt(count),
  799. storehouse_out_id: this.storehouse_out_id,
  800. };
  801. console.log("params23323232", params);
  802. getSumSecondeCount(params).then((response) => {
  803. if (response.data.state == 1) {
  804. var msg = response.data.data.msg;
  805. if (msg == 2) {
  806. this.$message.error("调拨数量不能大于库存总量!");
  807. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  808. if (index == i) {
  809. this.recordInfo.recordData[i].count = "";
  810. }
  811. }
  812. }
  813. }
  814. });
  815. },
  816. changeHouseInfoList(){
  817. if(this.storehouse_in_id == this.storehouse_out_id){
  818. this.$message.error("调出仓库和调入仓库不能是同一个仓库!")
  819. this.storehouse_in_id = ""
  820. return false
  821. }
  822. },
  823. changeHouseList() {
  824. const tempObj = {};
  825. tempObj["id"] = 0;
  826. tempObj["name"] = "";
  827. tempObj["project_name"] = "";
  828. tempObj["project_type"] = "";
  829. tempObj["second_specification_name"] = "";
  830. tempObj["sencond_unit"] = "";
  831. tempObj["count"] = "";
  832. tempObj["second_total"] = "";
  833. tempObj["is_source"] = 0;
  834. tempObj["remake"] = "";
  835. tempObj["project_id"] = 0;
  836. tempObj["min_price"] = 0;
  837. tempObj["medical_insurance_number"] = ""
  838. if(this.storehouse_in_id == this.storehouse_out_id){
  839. this.$message.error("调出仓库和调入仓库不能是同一个仓库!")
  840. this.storehouse_out_id = ""
  841. return false
  842. }
  843. var params = {
  844. storehouse_out_id: this.storehouse_out_id,
  845. };
  846. console.log("para323232233223", params);
  847. getStoreHouseGoodList(params).then((response) => {
  848. var drugList = response.data.data.drugList;
  849. this.drugList = [];
  850. this.drugList = drugList;
  851. var goodList = response.data.data.goodList;
  852. this.goodList = [];
  853. this.goodList = goodList;
  854. var goodTypeList = response.data.data.goodTypeList;
  855. this.goodTypeList = [];
  856. this.goodTypeList = goodTypeList;
  857. var drugTypeList = response.data.data.drugTypeList;
  858. this.drugTypeList = [];
  859. this.drugTypeList = drugTypeList;
  860. this.tabList = [];
  861. var manufactuerList = response.data.data.manufacturerList;
  862. console.log("manufactuerList23323232", manufactuerList);
  863. for (let i = 0; i < drugList.length; i++) {
  864. for (let j = 0; j < manufactuerList.length; j++) {
  865. if (drugList[i].manufacturer == manufactuerList[j].id) {
  866. drugList[i].manufacturer = manufactuerList[j].manufacturer_name;
  867. }
  868. }
  869. for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
  870. if (
  871. drugList[i].max_unit ==
  872. drugList[i].drug_warehouse_info[z].max_unit
  873. ) {
  874. drugList[i].drug_warehouse_info[z].stock_max_number =
  875. drugList[i].drug_warehouse_info[z].stock_max_number *
  876. drugList[i].min_number;
  877. }
  878. }
  879. for (let y = 0; y < this.drugTypeList.length; y++) {
  880. if (drugList[i].drug_type == this.drugTypeList[y].value) {
  881. drugList[i].drug_type = this.drugTypeList[y].name;
  882. }
  883. }
  884. drugList[i].name = drugList[i].drug_name;
  885. drugList[i].project_name =
  886. drugList[i].drug_name +
  887. " " +
  888. drugList[i].dose +
  889. drugList[i].dose_unit +
  890. "*" +
  891. drugList[i].min_number +
  892. drugList[i].min_unit +
  893. "/" +
  894. drugList[i].max_unit +
  895. " " +
  896. drugList[i].manufacturer;
  897. drugList[i].project_type = drugList[i].drug_type;
  898. drugList[i].second_specification_name =
  899. drugList[i].dose +
  900. drugList[i].dose_unit +
  901. "*" +
  902. drugList[i].min_number +
  903. drugList[i].min_unit +
  904. "/" +
  905. drugList[i].max_unit;
  906. drugList[i].second_total = this.getWarehoseInfo(
  907. drugList[i].drug_warehouse_info,
  908. drugList[i].max_unit,
  909. drugList[i].min_unit,
  910. drugList[i].min_number
  911. );
  912. drugList[i].is_source = 1;
  913. drugList[i].count = "";
  914. drugList[i].remake = "";
  915. drugList[i].min_price = drugList[i].min_price;
  916. drugList[i].medical_insurance_number = drugList[i].medical_insurance_number
  917. if (drugList[i].max_unit != drugList[i].min_unit) {
  918. drugList[i].unitList = [
  919. { id: 1, name: "" },
  920. { id: 2, name: "" },
  921. ];
  922. }
  923. if (drugList[i].max_unit == drugList[i].min_unit) {
  924. drugList[i].unitList = [{ id: 1, name: "" }];
  925. }
  926. drugList[i].sencond_unit = drugList[i].max_unit;
  927. for (let j = 0; j < drugList[i].unitList.length; j++) {
  928. if (drugList[i].max_unit != drugList[i].min_unit) {
  929. drugList[i].unitList[0].name = drugList[i].max_unit;
  930. drugList[i].unitList[1].name = drugList[i].min_unit;
  931. }
  932. if (drugList[i].max_unit == drugList[i].min_unit) {
  933. drugList[i].unitList[0].name = drugList[i].max_unit;
  934. }
  935. }
  936. this.tabList.push(drugList[i]);
  937. }
  938. for (let i = 0; i < goodList.length; i++) {
  939. for (let j = 0; j < manufactuerList.length; j++) {
  940. if (goodList[i].manufacturer == manufactuerList[j].id) {
  941. goodList[i].manufacturer = manufactuerList[j].manufacturer_name;
  942. }
  943. }
  944. for (let y = 0; y < this.goodTypeList.length; y++) {
  945. if (goodList[i].good_type_id == this.goodTypeList[y].id) {
  946. goodList[i].good_type_id = this.goodTypeList[y].type_name;
  947. }
  948. }
  949. goodList[i].name = goodList[i].good_name;
  950. goodList[i].project_name =
  951. goodList[i].good_name +
  952. " " +
  953. goodList[i].specification_name +
  954. " " +
  955. goodList[i].manufacturer;
  956. goodList[i].project_type = goodList[i].good_type_id;
  957. goodList[i].second_specification_name =
  958. goodList[i].specification_name;
  959. goodList[i].second_total = this.getTotalStockCount(
  960. goodList[i].good_warehouse_info
  961. );
  962. goodList[i].count = "";
  963. goodList[i].is_source = 2;
  964. goodList[i].name = goodList[i].good_name;
  965. goodList[i].unitList = [{ id: 1, name: "" }];
  966. goodList[i].sencond_unit = goodList[i].packing_unit;
  967. goodList[i].remake = "";
  968. goodList[i].min_price = goodList[i].retail_price;
  969. goodList[i].medical_insurance_number= goodList[i].medical_insurance_number
  970. for (let j = 0; j < goodList[i].unitList.length; j++) {
  971. goodList[i].unitList[0].name = goodList[i].packing_unit;
  972. }
  973. this.tabList.push(goodList[i]);
  974. }
  975. });
  976. },
  977. },
  978. created() {
  979. // var nowDate = new Date()
  980. // var nowYear = nowDate.getFullYear()
  981. // var nowMonth = nowDate.getMonth() + 1
  982. // var nowDay = nowDate.getDate()
  983. // this.warehousing_time =
  984. // nowYear +
  985. // '-' +
  986. // (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  987. // '-' +
  988. // (nowDay < 10 ? '0' + nowDay : nowDay)
  989. const tempObj = {};
  990. tempObj["id"] = 0;
  991. tempObj["name"] = "";
  992. tempObj["project_name"] = "";
  993. tempObj["project_type"] = "";
  994. tempObj["second_specification_name"] = "";
  995. tempObj["sencond_unit"] = "";
  996. tempObj["count"] = "";
  997. tempObj["second_total"] = "";
  998. tempObj["remake"] = "";
  999. tempObj["is_source"] = 0;
  1000. tempObj["project_id"] = 0;
  1001. tempObj["min_price"] = 0;
  1002. tempObj["medical_insurance_number"] = ""
  1003. this.recordInfo.recordData.push(tempObj);
  1004. this.getlist();
  1005. this.getSencondOrderDetail();
  1006. },
  1007. };
  1008. </script>
  1009. <style rel="stylesheet/css" lang="scss" scoped>
  1010. </style>
  1011. <style scoped>
  1012. /deep/ .el-table__body {
  1013. width: 100% !important;
  1014. }
  1015. /deep/ .el-table__header {
  1016. width: 100% !important;
  1017. }
  1018. /deep/ .el-table--scrollable-x .el-table__body-wrapper {
  1019. overflow: auto;
  1020. }
  1021. /deep/ .gutter {
  1022. width: 15px !important;
  1023. display: inline-block !important;
  1024. }
  1025. /deep/ .el-table__fixed-right-patch {
  1026. width: 15px !important;
  1027. }
  1028. /deep/ .el-table__fixed-right {
  1029. bottom: 0 !important;
  1030. left: auto;
  1031. right: 0;
  1032. }
  1033. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  1034. width: 15px !important;
  1035. height: 15px !important;
  1036. }
  1037. </style>