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

editPurchaseOrder.vue 39KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container" v-loading="loading">
  7. <div
  8. style="
  9. justify-content: space-between;
  10. margin: 0px 0 12px 0;
  11. display: flex;
  12. align-items: center;
  13. "
  14. >
  15. <div style="display:flex;align-items: center;">
  16. <span style="color: red">*</span><span>供应商:</span>
  17. <el-select
  18. v-model="supplier_name"
  19. style="width: 140px; margin-right: 10px"
  20. placeholder="请选择"
  21. @change="changeTypeName"
  22. :disabled="disabled"
  23. >
  24. <el-option
  25. v-for="item in supplyList"
  26. :key="item.id"
  27. :label="item.supplier_name"
  28. :value="item.id"
  29. >
  30. </el-option>
  31. </el-select>
  32. <span>单据日期:</span>
  33. <el-date-picker
  34. size="small"
  35. v-model="start_time"
  36. prefix-icon="el-icon-date"
  37. :editable="false"
  38. style="width: 196px"
  39. type="date"
  40. placeholder="选择日期时间"
  41. align="right"
  42. format="yyyy-MM-dd"
  43. value-format="yyyy-MM-dd"
  44. :disabled="disabled"
  45. ></el-date-picker>
  46. <span>交货日期:</span>
  47. <el-date-picker
  48. size="small"
  49. v-model="end_time"
  50. prefix-icon="el-icon-date"
  51. :editable="false"
  52. style="width: 196px"
  53. type="date"
  54. placeholder="选择日期时间"
  55. align="right"
  56. format="yyyy-MM-dd"
  57. value-format="yyyy-MM-dd"
  58. @change="endTimeChange"
  59. :disabled="disabled"
  60. ></el-date-picker>
  61. <span>单据编码:{{ number }}</span>
  62. </div>
  63. <div style="display: flex;">
  64. <el-button size="small" type="primary" @click="toAdd" v-show="showOne"
  65. >生成采购单</el-button
  66. >
  67. <el-button size="small" type="primary" @click="updatePurchaseOrder"
  68. >保存</el-button
  69. >
  70. <el-button size="small" type="primary" @click="toPrint"
  71. >打印</el-button
  72. >
  73. <el-button
  74. size="small"
  75. type="primary"
  76. v-if="is_check == 2"
  77. @click="checkPurchaseOrder"
  78. v-show="showTwo"
  79. >审核</el-button
  80. >
  81. <el-button
  82. size="small"
  83. type="primary"
  84. v-if="is_check == 1"
  85. @click="checkReturnOrder"
  86. v-show="showThree"
  87. >反审核</el-button
  88. >
  89. </div>
  90. </div>
  91. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  92. <el-table
  93. :row-style="{ color: '#303133' }"
  94. :header-cell-style="{
  95. backgroundColor: 'rgb(245, 247, 250)',
  96. color: '#606266',
  97. }"
  98. :data="recordInfo.tableList"
  99. :class="signAndWeighBoxPatients"
  100. border
  101. style="width: 100%"
  102. max-height="450"
  103. >
  104. <el-table-column align="center" width="200px">
  105. <template slot="header" slot-scope="scope">
  106. <span>商品<span style="color: red">*</span></span>
  107. </template>
  108. <template slot-scope="scope">
  109. <el-form-item
  110. :prop="'tableList.' + scope.$index + '.name'"
  111. :rules="tableRules.name"
  112. >
  113. <el-select
  114. v-model="scope.row.name"
  115. style="width: 160px"
  116. filterable
  117. placeholder="请选择"
  118. @change="changeName"
  119. @input="changeGoodName(scope.$index)"
  120. :disabled="disabled"
  121. >
  122. <el-option
  123. v-for="(item, index) in tabList"
  124. :key="index"
  125. :label="item.supply_name"
  126. :value="item"
  127. >
  128. </el-option>
  129. </el-select>
  130. </el-form-item>
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="center" width="150px">
  134. <template slot="header" slot-scope="scope">
  135. <span>商品类别</span>
  136. </template>
  137. <template slot-scope="scope">
  138. <el-input
  139. v-model="scope.row.supply_type"
  140. style="width: 120px"
  141. :disabled="true"
  142. ></el-input>
  143. <div style="visibility: hidden">/</div>
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="规格&单位" align="center" width="200px">
  147. <template slot-scope="scope">
  148. <el-input
  149. v-model="scope.row.supply_specification_name"
  150. style="width: 150px"
  151. :disabled="true"
  152. ></el-input>
  153. <div style="visibility: hidden">/</div>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="单位" align="center" width="120px">
  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. :prop="'tableList.' + scope.$index + '.supply_unit'"
  163. :rules="tableRules.supply_unit"
  164. >
  165. <el-select
  166. v-model="scope.row.supply_unit"
  167. style="width: 100px"
  168. filterable
  169. placeholder="请选择"
  170. :disabled="disabled"
  171. >
  172. <el-option
  173. v-for="(item, index) in scope.row.unitList"
  174. :key="index"
  175. :label="item.name"
  176. :value="item.name"
  177. >
  178. </el-option>
  179. </el-select>
  180. </el-form-item>
  181. </template>
  182. </el-table-column>
  183. <el-table-column label="可用库存" align="center" width="130px">
  184. <template slot-scope="scope">
  185. <el-input
  186. v-model="scope.row.supply_total"
  187. style="width: 100px"
  188. :disabled="true"
  189. ></el-input>
  190. <div style="visibility: hidden">/</div>
  191. </template>
  192. </el-table-column>
  193. <el-table-column label="数量" align="center" width="180px">
  194. <template slot="header" slot-scope="scope">
  195. <span>数量<span style="color: red">*</span></span>
  196. </template>
  197. <template slot-scope="scope">
  198. <el-form-item
  199. :prop="'tableList.' + scope.$index + '.supply_count'"
  200. :rules="tableRules.supply_count"
  201. >
  202. <el-input
  203. v-model="scope.row.supply_count"
  204. style="width: 140px"
  205. :disabled="disabled"
  206. placeholder="请输入数量"
  207. ></el-input>
  208. </el-form-item>
  209. </template>
  210. </el-table-column>
  211. <el-table-column label="采购单价" align="center" width="120px">
  212. <template slot-scope="scope">
  213. <el-input
  214. v-model="scope.row.supply_price"
  215. style="width: 80px"
  216. :disabled="disabled"
  217. placeholder="请输入采购单价"
  218. ></el-input>
  219. <div style="visibility: hidden">/</div>
  220. </template>
  221. </el-table-column>
  222. <el-table-column label="采购金额" align="center" width="120px">
  223. <template slot-scope="scope">
  224. {{ calculate(scope.row.supply_count * scope.row.supply_price) }}
  225. <div style="visibility: hidden">/</div>
  226. </template>
  227. </el-table-column>
  228. <el-table-column label="生产厂家" align="center" width="200px">
  229. <template slot-scope="scope">
  230. <el-select
  231. size="small"
  232. v-model="scope.row.supply_manufacturer"
  233. filterable
  234. :disabled="true"
  235. >
  236. <el-option
  237. v-for="(option, index) in manufactuerList"
  238. :key="index"
  239. :label="option.manufacturer_name"
  240. :value="option.id"
  241. >
  242. </el-option>
  243. </el-select>
  244. <div style="visibility: hidden">/</div>
  245. </template>
  246. </el-table-column>
  247. <el-table-column label="批准文号" align="center" width="200px">
  248. <template slot-scope="scope">
  249. <el-input
  250. v-model="scope.row.supply_license_number"
  251. style="width: 160px"
  252. :disabled="true"
  253. ></el-input>
  254. <div style="visibility: hidden">/</div>
  255. </template>
  256. </el-table-column>
  257. <el-table-column label="备注" align="center" width="200px">
  258. <template slot-scope="scope">
  259. <el-input
  260. v-model="scope.row.supply_remake"
  261. style="width: 160px"
  262. :disabled="disabled"
  263. placeholder="请输入备注"
  264. ></el-input>
  265. <div style="visibility: hidden">/</div>
  266. </template>
  267. </el-table-column>
  268. <el-table-column
  269. label="操作"
  270. align="center"
  271. width="150px"
  272. fixed="right"
  273. >
  274. <template slot-scope="scope">
  275. <el-tooltip
  276. class="item"
  277. effect="dark"
  278. content="新增"
  279. placement="top"
  280. >
  281. <el-button
  282. size="mini"
  283. type="primary"
  284. icon="el-icon-circle-plus-outline"
  285. @click="handleEdit(scope.$index, scope.row)"
  286. >
  287. </el-button>
  288. </el-tooltip>
  289. <el-tooltip
  290. class="item"
  291. effect="dark"
  292. content="删除"
  293. placement="top"
  294. >
  295. <el-button
  296. size="mini"
  297. type="danger"
  298. icon="el-icon-delete"
  299. @click="handleDelete(scope.$index, scope.row)"
  300. >
  301. </el-button>
  302. </el-tooltip>
  303. </template>
  304. </el-table-column>
  305. </el-table>
  306. <div style="margin-top: 10px">
  307. <el-input
  308. type="textarea"
  309. :rows="2"
  310. placeholder="备注信息"
  311. v-model="return_remark"
  312. :disabled="disabled"
  313. >
  314. </el-input>
  315. </div>
  316. <!-- 审核水印 -->
  317. <img
  318. src="@/assets/purchase/Reviewed.png"
  319. alt="正在加载..."
  320. class="reviewImg"
  321. v-show="Reviewed == true"
  322. />
  323. </el-form>
  324. <div style="margin-top: 10px">合计:{{ getAllPrice() }} 元</div>
  325. <div style="margin-top: 10px">
  326. <span
  327. >优惠率:<el-input
  328. style="width: 150px"
  329. v-model="rate_of_concession"
  330. @input="addressChange"
  331. :disabled="disabled"
  332. placeholder="请输入优惠率"
  333. ></el-input
  334. >%</span
  335. >
  336. <span
  337. >优惠金额:<el-input
  338. style="width: 150px"
  339. v-model="discount_amount"
  340. :disabled="disabled"
  341. placeholder="请输入优惠金额"
  342. ></el-input
  343. ></span>
  344. </div>
  345. </div>
  346. <!-- <el-dialog
  347. title="系统提示"
  348. :visible.sync="dialogVisible"
  349. width="30%">
  350. <span>
  351. 采购订单{{number}}已有以下关联数据,不能反审核
  352. <div v-for="(item,index) in orderList" :key="index">
  353. <li>采购单{{item.good_number}}</li> <a @click="toClick(item.id)">点击查看</a>
  354. </div>
  355. </span>
  356. <span slot="footer" class="dialog-footer">
  357. <el-button @click="dialogVisible = false">取 消</el-button>
  358. </span>
  359. </el-dialog> -->
  360. <popup ref="Popup" :content="content" :content_1="content_1" :content_2="content_2" :number="number" :orderList ="orderList" :type="type"></popup>
  361. </div>
  362. </template>
  363. <script>
  364. import popup from "./Popup"
  365. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  366. import { uParseTime } from "@/utils/tools";
  367. import {
  368. getInitOrder,
  369. updatePurchaseOrder,
  370. checkPurchaseOrder,
  371. getPurchaseOrderDetail,
  372. getAllOrderCountList,
  373. getGoodOrderList,
  374. getReturnOrder,
  375. deletePurchaseOrder,
  376. deletePurchOder
  377. } from "@/api/supply";
  378. export default {
  379. name: "addPurchaseOrder",
  380. components: {
  381. BreadCrumb,
  382. popup
  383. },
  384. data() {
  385. return {
  386. content_2:"采购单",
  387. content:"采购订单",
  388. content_1:"已有以下关联数据,不能反审核",
  389. type:1,
  390. Reviewed: false,
  391. crumbs: [
  392. { path: false, name: "采购订单" },
  393. { path: "/supply/query", name: "编辑采购订单" },
  394. ],
  395. showTwo: true,
  396. showOne: false,
  397. recordInfo: {
  398. tableList: [],
  399. },
  400. keywords: "",
  401. total: 0,
  402. multipleSelection: [],
  403. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  404. start_time: "",
  405. end_time: "",
  406. page: 1,
  407. limit: 10,
  408. goodType: [],
  409. goodInfo: [],
  410. org_id: 0,
  411. types: [],
  412. tyep_name: "",
  413. form: {
  414. manufacturer_id: "",
  415. },
  416. tabList: [],
  417. manufactuerList: [],
  418. currentIndex: 0,
  419. goodTypeList: [],
  420. drugTypeList: [],
  421. supplier_name: "",
  422. supplyList: [],
  423. rate_of_concession: "",
  424. discount_amount: "",
  425. tableRules: {
  426. name: [{ required: true, message: "商品不能为空", trigger: "blur" }],
  427. supply_count: [
  428. { required: true, message: "数量不能为空", trigger: "blur" },
  429. ],
  430. },
  431. warehousing_id: 0,
  432. number: "",
  433. loading: false,
  434. drugList: [],
  435. goodList: [],
  436. id: 0,
  437. disabled: false,
  438. is_check: 0,
  439. dialogVisible: false,
  440. total_price: 0,
  441. showOne: true,
  442. showTwo: true,
  443. showThree: false,
  444. orderList: [],
  445. return_remark: "",
  446. };
  447. },
  448. methods: {
  449. getInitOrder() {
  450. getInitOrder().then((response) => {
  451. if (response.data.state == 1) {
  452. var drugList = response.data.data.drugList;
  453. this.manufactuerList = response.data.data.manufactuerList;
  454. this.goodTypeList = response.data.data.goodTypeList;
  455. this.drugTypeList = response.data.data.drugTypeList;
  456. this.supplyList = response.data.data.supplyList;
  457. for (let i = 0; i < drugList.length; i++) {
  458. for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
  459. if (
  460. drugList[i].max_unit ==
  461. drugList[i].drug_warehouse_info[z].max_unit
  462. ) {
  463. drugList[i].drug_warehouse_info[z].stock_max_number =
  464. drugList[i].drug_warehouse_info[z].stock_max_number *
  465. drugList[i].min_number;
  466. }
  467. }
  468. for (let j = 0; j < this.manufactuerList.length; j++) {
  469. if (drugList[i].manufacturer == this.manufactuerList[j].id) {
  470. drugList[i].manufacturer =
  471. this.manufactuerList[j].manufacturer_name;
  472. }
  473. }
  474. for (let y = 0; y < this.drugTypeList.length; y++) {
  475. if (drugList[i].drug_type == this.drugTypeList[y].value) {
  476. drugList[i].drug_type = this.drugTypeList[y].name;
  477. }
  478. }
  479. drugList[i].supply_name =
  480. drugList[i].drug_name +
  481. " " +
  482. drugList[i].dose +
  483. drugList[i].dose_unit +
  484. "*" +
  485. drugList[i].min_number +
  486. drugList[i].min_unit +
  487. "/" +
  488. drugList[i].max_unit +
  489. " " +
  490. drugList[i].manufacturer;
  491. drugList[i].supply_type = drugList[i].drug_type;
  492. drugList[i].supply_specification_name =
  493. drugList[i].dose +
  494. drugList[i].dose_unit +
  495. "*" +
  496. drugList[i].min_number +
  497. drugList[i].min_unit +
  498. "/" +
  499. drugList[i].max_unit;
  500. drugList[i].supply_total = this.getWarehoseInfo(
  501. drugList[i].drug_warehouse_info,
  502. drugList[i].max_unit,
  503. drugList[i].min_unit,
  504. drugList[i].min_number
  505. );
  506. drugList[i].supply_count = "";
  507. drugList[i].supply_total_price = "";
  508. drugList[i].supply_manufacturer = drugList[i].manufacturer;
  509. drugList[i].supply_license_number = drugList[i].number;
  510. drugList[i].supply_remake = "";
  511. drugList[i].type = 1;
  512. drugList[i].supply_price = drugList[i].last_price;
  513. drugList[i].name = drugList[i].drug_name;
  514. if (drugList[i].max_unit != drugList[i].min_unit) {
  515. drugList[i].unitList = [
  516. { id: 1, name: "" },
  517. { id: 2, name: "" },
  518. ];
  519. }
  520. if (drugList[i].max_unit == drugList[i].min_unit) {
  521. drugList[i].unitList = [{ id: 1, name: "" }];
  522. }
  523. drugList[i].supply_unit = drugList[i].max_unit;
  524. for (let j = 0; j < drugList[i].unitList.length; j++) {
  525. if (drugList[i].max_unit != drugList[i].min_unit) {
  526. drugList[i].unitList[0].name = drugList[i].max_unit;
  527. drugList[i].unitList[1].name = drugList[i].min_unit;
  528. }
  529. if (drugList[i].max_unit == drugList[i].min_unit) {
  530. drugList[i].unitList[0].name = drugList[i].max_unit;
  531. }
  532. }
  533. this.tabList.push(drugList[i]);
  534. }
  535. this.drugList = drugList;
  536. var goodList = response.data.data.goodList;
  537. for (let i = 0; i < goodList.length; i++) {
  538. for (let j = 0; j < this.manufactuerList.length; j++) {
  539. if (goodList[i].manufacturer == this.manufactuerList[j].id) {
  540. goodList[i].manufacturer =
  541. this.manufactuerList[j].manufacturer_name;
  542. }
  543. }
  544. for (let y = 0; y < this.goodTypeList.length; y++) {
  545. if (goodList[i].good_type_id == this.goodTypeList[y].id) {
  546. goodList[i].good_type_id = this.goodTypeList[y].type_name;
  547. }
  548. }
  549. goodList[i].supply_name =goodList[i].good_name +" " +goodList[i].specification_name +" " + goodList[i].manufacturer;
  550. goodList[i].supply_type = goodList[i].good_type_id;
  551. goodList[i].supply_specification_name =goodList[i].specification_name;
  552. goodList[i].supply_price = goodList[i].buy_price;
  553. goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info);
  554. goodList[i].supply_count = "";
  555. goodList[i].supply_total_price = "";
  556. goodList[i].supply_manufacturer = goodList[i].manufacturer;
  557. goodList[i].supply_license_number = goodList[i].number
  558. goodList[i].supply_remake = "";
  559. goodList[i].type = 2;
  560. goodList[i].name = goodList[i].good_name;
  561. goodList[i].unitList = [{ id: 1, name: "" }];
  562. goodList[i].supply_unit = goodList[i].packing_unit;
  563. for (let j = 0; j < goodList[i].unitList.length; j++) {
  564. goodList[i].unitList[0].name = goodList[i].packing_unit;
  565. }
  566. this.tabList.push(goodList[i]);
  567. }
  568. this.goodList = goodList;
  569. }
  570. });
  571. },
  572. changeGoodName(val) {
  573. this.currentIndex = val;
  574. },
  575. changeName(val) {
  576. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  577. if (this.currentIndex == i) {
  578. this.recordInfo.tableList[i].project_id = val.id;
  579. this.recordInfo.tableList[i].type = val.type;
  580. this.recordInfo.tableList[i].name = val.name;
  581. this.recordInfo.tableList[i].supply_name = val.supply_name;
  582. this.recordInfo.tableList[i].supply_type = val.supply_type;
  583. this.recordInfo.tableList[i].supply_specification_name =val.supply_specification_name;
  584. this.recordInfo.tableList[i].supply_total = val.supply_total;
  585. if (val.supply_count == NaN) {
  586. this.recordInfo.tableList[i].supply_count = "";
  587. } else {
  588. this.recordInfo.tableList[i].supply_count = val.supply_count
  589. ? val.supply_count
  590. : "";
  591. }
  592. this.recordInfo.tableList[i].supply_price = val.supply_price? val.supply_price: "";
  593. this.recordInfo.tableList[i].supply_total_price =val.supply_total_price ? val.supply_total_price : "";
  594. this.recordInfo.tableList[i].supply_manufacturer =val.supply_manufacturer;
  595. this.recordInfo.tableList[i].supply_license_number =val.supply_license_number;
  596. this.recordInfo.tableList[i].supply_remake = val.supply_remake;
  597. this.recordInfo.tableList[i].is_total = val.is_total;
  598. this.recordInfo.tableList[i].supply_unit = val.supply_unit;
  599. this.recordInfo.tableList[i].unitList = val.unitList;
  600. }
  601. }
  602. },
  603. handleEdit() {
  604. if (this.is_check == 1) {
  605. this.$message.error("已审核的不能新增!");
  606. return false;
  607. }
  608. const tempObj = {};
  609. tempObj["id"] = 0;
  610. tempObj["name"] = "";
  611. tempObj["supply_name"] = "";
  612. tempObj["supply_type"] = "";
  613. tempObj["supply_specification_name"] = "";
  614. tempObj["supply_total"] = "";
  615. tempObj["supply_count"] = "";
  616. tempObj["supply_price"] = "";
  617. tempObj["supply_total_price"] = "";
  618. tempObj["supply_manufacturer"] = "";
  619. tempObj["supply_license_number"] = "";
  620. tempObj["supply_remake"] = "";
  621. tempObj["type"] = 0;
  622. tempObj["is_total"] = 1;
  623. tempObj["project_id"] = 0;
  624. tempObj["supply_unit"] = "";
  625. tempObj["manufacturer_id"] = "";
  626. this.recordInfo.tableList.push(tempObj);
  627. },
  628. handleDelete: function (index, row) {
  629. if(this.is_check == 1){
  630. this.$message.error("已审核单据,不能删除!")
  631. return false
  632. }
  633. if(row.id == 0){
  634. if (this.recordInfo.tableList.length <= 1) {
  635. this.$message.error("只有一条记录的时候无法删除");
  636. return;
  637. } else {
  638. this.recordInfo.tableList.splice(index, 1);
  639. }
  640. }else{
  641. const params = {
  642. id: row.id
  643. }
  644. this.$confirm('确认删除吗?', {
  645. confirmButtonText: '确定',
  646. cancelButtonText: '取消',
  647. type: 'warning'
  648. }).then(() => {
  649. deletePurchOder(params).then(response => {
  650. if (response.data.state == 0) {
  651. this.$message.error(response.data.msg)
  652. return false
  653. } else {
  654. this.$message.success('删除成功')
  655. this.recordInfo.tableList.splice(index, 1)
  656. }
  657. })
  658. }).catch(() => {
  659. })
  660. }
  661. },
  662. changeTypeName() {},
  663. startTimeChange() {},
  664. endTimeChange() {},
  665. search() {},
  666. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  667. var total = 0;
  668. var max_str = "";
  669. var min_str = "";
  670. if (arr.length > 0) {
  671. for (let i = 0; i < arr.length; i++) {
  672. total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
  673. }
  674. }
  675. if (total < min_number) {
  676. min_str = total + min_unit;
  677. }
  678. if (total == 0) {
  679. min_str = "";
  680. max_str = "";
  681. }
  682. if (total >= min_number) {
  683. if (parseInt(total / min_number) != 0) {
  684. max_str = parseInt(total / min_number) + max_unit;
  685. }
  686. if (total % min_number != 0) {
  687. min_str = (total % min_number) + min_unit;
  688. }
  689. }
  690. return max_str + min_str;
  691. },
  692. getTotalStockCount(arr) {
  693. var total_count = 0;
  694. for (let i = 0; i < arr.length; i++) {
  695. total_count += arr[i].stock_count;
  696. }
  697. return total_count;
  698. },
  699. calculate: function (val) {
  700. if (isNaN(val)) {
  701. return "";
  702. }
  703. if (val == 0) {
  704. return "";
  705. }
  706. return Math.round(parseFloat(val) * 100) / 100;
  707. },
  708. getTimes(time) {
  709. if (time === "") {
  710. return "";
  711. }
  712. return uParseTime(time, "{y}-{m}-{d}");
  713. },
  714. updatePurchaseOrder() {
  715. if (this.supplier_name == 0 || this.supplier_name == "") {
  716. this.$message.error("供应商不能为空!");
  717. this.loading = false;
  718. return false;
  719. }
  720. this.$refs["tableForm"].validate((valid) => {
  721. if (valid) {
  722. this.loading = true;
  723. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  724. this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
  725. this.recordInfo.tableList[i].supply_license_number =this.recordInfo.tableList[i].supply_license_number.toString();
  726. this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count *this.recordInfo.tableList[i].supply_price).toString();
  727. this.recordInfo.tableList[i].supply_total =this.recordInfo.tableList[i].supply_total.toString();
  728. this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString();
  729. for (let j = 0; j < this.manufactuerList.length; j++) {
  730. if (
  731. this.recordInfo.tableList[i].supply_manufacturer ==
  732. this.manufactuerList[j].id
  733. ) {
  734. this.recordInfo.tableList[i].supply_manufacturer =
  735. this.manufactuerList[j].manufacturer_name;
  736. }
  737. if (
  738. this.recordInfo.tableList[i].supply_manufacturer ==
  739. this.manufactuerList[j].manufacturer_name
  740. ) {
  741. this.recordInfo.tableList[i].manufacturer_id =
  742. this.manufactuerList[j].id;
  743. }
  744. }
  745. }
  746. var start = this.start_time;
  747. var end = this.end_time;
  748. const params = {
  749. stockIn: this.recordInfo.tableList,
  750. return_remake: this.return_remark,
  751. };
  752. updatePurchaseOrder(
  753. params,
  754. this.supplier_name,
  755. start,
  756. end,
  757. this.rate_of_concession,
  758. this.discount_amount,
  759. this.id,
  760. this.number
  761. ).then((response) => {
  762. if (response.data.state == 1) {
  763. this.loading = false;
  764. var warehousingInfo = response.data.data.warehousingInfo;
  765. this.$message.success("保存成功!");
  766. }
  767. });
  768. }
  769. });
  770. },
  771. getAllPrice() {
  772. var total_price = 0;
  773. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  774. total_price +=
  775. this.recordInfo.tableList[i].supply_price *
  776. this.recordInfo.tableList[i].supply_count;
  777. }
  778. this.total_price = total_price;
  779. this.addressChange()
  780. return total_price.toFixed(2);
  781. },
  782. checkPurchaseOrder(id, index) {
  783. this.$confirm("是否审核?", {
  784. confirmButtonText: "确 定",
  785. cancelButtonText: "取 消",
  786. type: "warning",
  787. }).then(() => {
  788. checkPurchaseOrder(this.id).then((response) => {
  789. if (response.data.state == 1) {
  790. var info = response.data.data.info;
  791. this.disabled = true;
  792. this.$message.success("审核成功!");
  793. this.showOne = true;
  794. this.showTwo = false;
  795. this.showThree = true;
  796. this.getPurchaseOrderDetail();
  797. }
  798. });
  799. })
  800. .catch(() => {});
  801. },
  802. getPurchaseOrderDetail() {
  803. var id = this.$route.query.id;
  804. getPurchaseOrderDetail(id).then((response) => {
  805. if (response.data.state == 1) {
  806. var info = response.data.data.info;
  807. if (info.is_check == 1) {
  808. this.Reviewed = true;
  809. }
  810. this.is_check = info.is_check;
  811. this.number = info.number;
  812. this.return_remark = info.return_remake;
  813. this.id = info.id;
  814. this.supplier_name = info.supplier_id;
  815. this.rate_of_concession = info.rate_of_concession;
  816. this.discount_amount = info.discount_amount;
  817. this.start_time = this.getTimes(info.document_date);
  818. this.end_time = this.getTimes(info.delivery_date);
  819. var orderInfo = response.data.data.orderInfo;
  820. if (info.is_check == 2) {
  821. this.disabled = false;
  822. this.showOne = false;
  823. this.showTwo = true;
  824. this.showThree = false;
  825. }
  826. if (info.is_check == 1) {
  827. this.disabled = true;
  828. this.showOne = true;
  829. this.showTwo = false;
  830. this.showThree = true;
  831. }
  832. var drugList = response.data.data.baseList;
  833. var goodList = response.data.data.goodList;
  834. for (let i = 0; i < orderInfo.length; i++) {
  835. orderInfo[i].supply_count = orderInfo[i].count;
  836. orderInfo[i].supply_price = orderInfo[i].price;
  837. orderInfo[i].supply_remake = orderInfo[i].remark;
  838. orderInfo[i].type = orderInfo[i].is_source;
  839. orderInfo[i].project_id = orderInfo[i].project_id;
  840. orderInfo[i].supply_unit = orderInfo[i].supply_unit;
  841. if (orderInfo[i].is_source == 1) {
  842. for (let j = 0; j < drugList.length; j++) {
  843. if (orderInfo[i].project_id == drugList[j].id) {
  844. if (drugList[j].max_unit != drugList[j].min_unit) {
  845. orderInfo[i].unitList = [
  846. { id: 1, name: "" },
  847. { id: 2, name: "" },
  848. ];
  849. orderInfo[i].unitList[0].name = drugList[j].max_unit;
  850. orderInfo[i].unitList[1].name = drugList[j].min_unit;
  851. }
  852. if (drugList[j].max_unit == drugList[j].min_unit) {
  853. orderInfo[i].unitList = [{ id: 1, name: "" }];
  854. orderInfo[i].unitList[0].name = drugList[j].max_unit;
  855. }
  856. }
  857. }
  858. }
  859. if (orderInfo[i].is_source == 2) {
  860. for (let j = 0; j < goodList.length; j++) {
  861. if (orderInfo[i].project_id == goodList[j].id) {
  862. orderInfo[i].unitList = [{ id: 1, name: "" }];
  863. orderInfo[i].unitList[0].name = goodList[j].packing_unit;
  864. }
  865. }
  866. }
  867. }
  868. this.recordInfo.tableList = [];
  869. if(orderInfo.length == 0){
  870. const tempObj = {};
  871. tempObj["id"] = 0;
  872. tempObj["name"] = "";
  873. tempObj["supply_name"] = "";
  874. tempObj["supply_type"] = "";
  875. tempObj["supply_specification_name"] = "";
  876. tempObj["supply_total"] = "";
  877. tempObj["supply_count"] = "";
  878. tempObj["supply_price"] = "";
  879. tempObj["supply_total_price"] = "";
  880. tempObj["supply_manufacturer"] = "";
  881. tempObj["supply_license_number"] = "";
  882. tempObj["supply_remake"] = "";
  883. tempObj["type"] = 0;
  884. tempObj["is_total"] = 1;
  885. tempObj["project_id"] = 0;
  886. tempObj["supply_unit"] = "";
  887. tempObj["manufacturer_id"] = "";
  888. this.recordInfo.tableList.push(tempObj);
  889. }else{
  890. this.recordInfo.tableList = orderInfo;
  891. }
  892. }
  893. });
  894. },
  895. toPrint() {
  896. var id = this.$route.query.id;
  897. this.$router.push({ path: "/purchase/order/print?&id=" + id });
  898. },
  899. toAdd() {
  900. var id = this.$route.query.id;
  901. if (this.is_check == 2) {
  902. this.$message.error("该采购订单未审核,不能生成采购数据!");
  903. return false;
  904. }
  905. //获取商品购货订单 和 购货单的总数量
  906. getAllOrderCountList(id).then((response) => {
  907. if (response.data.state == 1) {
  908. var purcaseOrder = response.data.data.purcaseOrder;
  909. var goodOrder = response.data.data.goodOrder;
  910. var drugList = response.data.data.drugList;
  911. var ids = "";
  912. // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
  913. if (goodOrder.length == 0) {
  914. this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + ids});
  915. }
  916. for (let i = 0; i < purcaseOrder.length; i++) {
  917. for (let j = 0; j < drugList.length; j++) {
  918. if (purcaseOrder[i].is_source == 1) {
  919. if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
  920. purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number;
  921. }
  922. }
  923. }
  924. }
  925. for (let i = 0; i < goodOrder.length; i++) {
  926. for (let j = 0; j < drugList.length; j++) {
  927. if (goodOrder[i].is_source == 1) {
  928. if (goodOrder[i].supply_unit == drugList[j].max_unit) {
  929. goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
  930. }
  931. }
  932. }
  933. }
  934. let objInfo = {};
  935. if (goodOrder.length > 0) {
  936. goodOrder.forEach((item, index) => {
  937. let { project_id } = item;
  938. if (!objInfo[project_id]) {
  939. objInfo[project_id] = {
  940. project_id,
  941. child: [],
  942. count: 0,
  943. };
  944. }
  945. });
  946. let newArr = Object.values(objInfo);
  947. for (let i = 0; i < goodOrder.length; i++) {
  948. for (let j = 0; j < newArr.length; j++) {
  949. if (goodOrder[i].project_id == newArr[j].project_id) {
  950. newArr[j].child.push(goodOrder[i]);
  951. }
  952. }
  953. }
  954. for (let i = 0; i < newArr.length; i++) {
  955. for (let j = 0; j < newArr[i].child.length; j++) {
  956. newArr[i].count += newArr[i].child[j].count;
  957. }
  958. }
  959. var arr = [];
  960. var total = 0;
  961. var str = "";
  962. //如果采购单有数据,则需要比较数量
  963. if (newArr.length > 0) {
  964. for (let i = 0; i < purcaseOrder.length; i++) {
  965. for (let j = 0; j < newArr.length; j++) {
  966. if (purcaseOrder[i].project_id == newArr[j].project_id) {
  967. //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,可以继续生成采购单
  968. if (purcaseOrder[i].count > newArr[j].count) {
  969. arr.push(purcaseOrder[i].project_id);
  970. }
  971. }
  972. }
  973. }
  974. //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
  975. if (arr.length == 0) {
  976. this.$message.error("该订单已全部生成采购单,请知悉!");
  977. return;
  978. }
  979. if (arr.length >0) {
  980. str = arr.join(",");
  981. this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + str});
  982. }
  983. }
  984. }
  985. }
  986. });
  987. },
  988. addressChange() {
  989. if (this.rate_of_concession > 0) {
  990. this.discount_amount = (
  991. (this.rate_of_concession / 100) *
  992. this.total_price
  993. ).toFixed(2);
  994. }
  995. },
  996. checkReturnOrder() {
  997. var id = this.$route.query.id;
  998. //获取购货订单号
  999. getGoodOrderList(id).then((response) => {
  1000. if (response.data.state == 1) {
  1001. var list = response.data.data.list
  1002. this.orderList = list
  1003. //如果长度大于0,有购货单不能反审核
  1004. if (list.length > 0) {
  1005. this.$refs.Popup.dialogVisible = true
  1006. return
  1007. }
  1008. if (list.length == 0) {
  1009. this.getReturnOrder()
  1010. this.showOne = false
  1011. this.showTwo = true
  1012. this.showThree = false
  1013. }
  1014. }
  1015. });
  1016. },
  1017. getReturnOrder() {
  1018. var id = this.$route.query.id;
  1019. getReturnOrder(id).then((response) => {
  1020. if (response.data.state == 1) {
  1021. var msg = response.data.data.msg;
  1022. this.disabled = false;
  1023. this.Reviewed = false
  1024. this.$message.success("反审核成功!");
  1025. this.getPurchaseOrderDetail();
  1026. }
  1027. });
  1028. },
  1029. toClick(id) {
  1030. this.$router.push({path:"/good/order/edit?id=" + id});
  1031. },
  1032. },
  1033. created() {
  1034. const tempObj = {};
  1035. tempObj["id"] = 0;
  1036. tempObj["name"] = "";
  1037. tempObj["supply_name"] = "";
  1038. tempObj["supply_type"] = "";
  1039. tempObj["supply_specification_name"] = "";
  1040. tempObj["supply_total"] = "";
  1041. tempObj["supply_count"] = "";
  1042. tempObj["supply_price"] = "";
  1043. tempObj["supply_total_price"] = "";
  1044. tempObj["supply_manufacturer"] = "";
  1045. tempObj["supply_license_number"] = "";
  1046. tempObj["supply_remake"] = "";
  1047. tempObj["type"] = 0;
  1048. tempObj["is_total"] = 1;
  1049. tempObj["project_id"] = 0;
  1050. tempObj["supply_unit"] = "";
  1051. tempObj["manufacturer_id"] = "";
  1052. this.recordInfo.tableList.push(tempObj);
  1053. this.getInitOrder();
  1054. this.getPurchaseOrderDetail();
  1055. },
  1056. };
  1057. </script>
  1058. <style rel="stylesheet/css" lang="scss" scoped>
  1059. .information {
  1060. border: 1px #dcdfe6 solid;
  1061. padding: 30px 20px 30px 20px;
  1062. .border {
  1063. border-bottom: 1px #dcdfe6 solid;
  1064. margin: 0px 0 20px 0;
  1065. }
  1066. }
  1067. .title {
  1068. background: #409eff;
  1069. height: 44px;
  1070. line-height: 44px;
  1071. padding: 0 0 0 10px;
  1072. color: #fff;
  1073. margin: 0 0 10px 0;
  1074. }
  1075. .edit_separater {
  1076. border-top: 1px solid rgb(233, 233, 233);
  1077. margin-top: 15px;
  1078. margin-bottom: 15px;
  1079. }
  1080. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  1081. width: 10px;
  1082. height: 10px;
  1083. }
  1084. </style>
  1085. <style>
  1086. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1087. font-size: 12px;
  1088. }
  1089. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1090. background: #6fb5fa;
  1091. }
  1092. .count {
  1093. color: #bd2c00;
  1094. }
  1095. .el-table td,
  1096. .el-table th.is-leaf,
  1097. .el-table--border,
  1098. .el-table--group {
  1099. border-color: #d0d3da;
  1100. }
  1101. .el-table--border::after,
  1102. .el-table--group::after,
  1103. .el-table::before {
  1104. background-color: #d0d3da;
  1105. }
  1106. .el-table__fixed-right {
  1107. width: 150px;
  1108. bottom: 20px;
  1109. height: 100%;
  1110. }
  1111. .reviewImg {
  1112. position: fixed;
  1113. left: 50%;
  1114. transform: translateX(-50%);
  1115. top: 30%;
  1116. }
  1117. </style>