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

editPurchaseOrder.vue 38KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  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>
  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. >
  313. </el-input>
  314. </div>
  315. <!-- 审核水印 -->
  316. <img
  317. src="@/assets/purchase/Reviewed.png"
  318. alt="正在加载..."
  319. class="reviewImg"
  320. v-show="Reviewed == true"
  321. />
  322. </el-form>
  323. <div style="margin-top: 10px">合计:{{ getAllPrice() }} 元</div>
  324. <div style="margin-top: 10px">
  325. <span
  326. >优惠率:<el-input
  327. style="width: 150px"
  328. v-model="rate_of_concession"
  329. @input="addressChange"
  330. :disabled="disabled"
  331. placeholder="请输入优惠率"
  332. ></el-input
  333. >%</span
  334. >
  335. <span
  336. >优惠金额:<el-input
  337. style="width: 150px"
  338. v-model="discount_amount"
  339. :disabled="disabled"
  340. placeholder="请输入优惠金额"
  341. ></el-input
  342. ></span>
  343. </div>
  344. </div>
  345. <!-- <el-dialog
  346. title="系统提示"
  347. :visible.sync="dialogVisible"
  348. width="30%">
  349. <span>
  350. 采购订单{{number}}已有以下关联数据,不能反审核
  351. <div v-for="(item,index) in orderList" :key="index">
  352. <li>采购单{{item.good_number}}</li> <a @click="toClick(item.id)">点击查看</a>
  353. </div>
  354. </span>
  355. <span slot="footer" class="dialog-footer">
  356. <el-button @click="dialogVisible = false">取 消</el-button>
  357. </span>
  358. </el-dialog> -->
  359. <popup ref="Popup" :content="content" :content_1="content_1" :content_2="content_2" :number="number" :orderList ="orderList" :type="type"></popup>
  360. </div>
  361. </template>
  362. <script>
  363. import popup from "./Popup"
  364. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  365. import { uParseTime } from "@/utils/tools";
  366. import {
  367. getInitOrder,
  368. updatePurchaseOrder,
  369. checkPurchaseOrder,
  370. getPurchaseOrderDetail,
  371. getAllOrderCountList,
  372. getGoodOrderList,
  373. getReturnOrder,
  374. deletePurchaseOrder,
  375. deletePurchOder
  376. } from "@/api/supply";
  377. export default {
  378. name: "addPurchaseOrder",
  379. components: {
  380. BreadCrumb,
  381. popup
  382. },
  383. data() {
  384. return {
  385. content_2:"采购单",
  386. content:"采购订单",
  387. content_1:"已有以下关联数据,不能反审核",
  388. type:1,
  389. Reviewed: false,
  390. crumbs: [
  391. { path: false, name: "采购订单" },
  392. { path: "/supply/query", name: "编辑采购订单" },
  393. ],
  394. showTwo: true,
  395. showOne: false,
  396. recordInfo: {
  397. tableList: [],
  398. },
  399. keywords: "",
  400. total: 0,
  401. multipleSelection: [],
  402. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  403. start_time: "",
  404. end_time: "",
  405. page: 1,
  406. limit: 10,
  407. goodType: [],
  408. goodInfo: [],
  409. org_id: 0,
  410. types: [],
  411. tyep_name: "",
  412. form: {
  413. manufacturer_id: "",
  414. },
  415. tabList: [],
  416. manufactuerList: [],
  417. currentIndex: 0,
  418. goodTypeList: [],
  419. drugTypeList: [],
  420. supplier_name: "",
  421. supplyList: [],
  422. rate_of_concession: "",
  423. discount_amount: "",
  424. tableRules: {
  425. name: [{ required: true, message: "商品不能为空", trigger: "blur" }],
  426. supply_count: [
  427. { required: true, message: "数量不能为空", trigger: "blur" },
  428. ],
  429. },
  430. warehousing_id: 0,
  431. number: "",
  432. loading: false,
  433. drugList: [],
  434. goodList: [],
  435. id: 0,
  436. disabled: false,
  437. is_check: 0,
  438. dialogVisible: false,
  439. total_price: 0,
  440. showOne: true,
  441. showTwo: true,
  442. showThree: false,
  443. orderList: [],
  444. return_remark: "",
  445. };
  446. },
  447. methods: {
  448. getInitOrder() {
  449. getInitOrder().then((response) => {
  450. if (response.data.state == 1) {
  451. var drugList = response.data.data.drugList;
  452. this.manufactuerList = response.data.data.manufactuerList;
  453. this.goodTypeList = response.data.data.goodTypeList;
  454. this.drugTypeList = response.data.data.drugTypeList;
  455. this.supplyList = response.data.data.supplyList;
  456. for (let i = 0; i < drugList.length; i++) {
  457. for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
  458. if (
  459. drugList[i].max_unit ==
  460. drugList[i].drug_warehouse_info[z].max_unit
  461. ) {
  462. drugList[i].drug_warehouse_info[z].stock_max_number =
  463. drugList[i].drug_warehouse_info[z].stock_max_number *
  464. drugList[i].min_number;
  465. }
  466. }
  467. for (let j = 0; j < this.manufactuerList.length; j++) {
  468. if (drugList[i].manufacturer == this.manufactuerList[j].id) {
  469. drugList[i].manufacturer =
  470. this.manufactuerList[j].manufacturer_name;
  471. }
  472. }
  473. for (let y = 0; y < this.drugTypeList.length; y++) {
  474. if (drugList[i].drug_type == this.drugTypeList[y].value) {
  475. drugList[i].drug_type = this.drugTypeList[y].name;
  476. }
  477. }
  478. drugList[i].supply_name =
  479. drugList[i].drug_name +
  480. " " +
  481. drugList[i].dose +
  482. drugList[i].dose_unit +
  483. "*" +
  484. drugList[i].min_number +
  485. drugList[i].min_unit +
  486. "/" +
  487. drugList[i].max_unit +
  488. " " +
  489. drugList[i].manufacturer;
  490. drugList[i].supply_type = drugList[i].drug_type;
  491. drugList[i].supply_specification_name =
  492. drugList[i].dose +
  493. drugList[i].dose_unit +
  494. "*" +
  495. drugList[i].min_number +
  496. drugList[i].min_unit +
  497. "/" +
  498. drugList[i].max_unit;
  499. drugList[i].supply_total = this.getWarehoseInfo(
  500. drugList[i].drug_warehouse_info,
  501. drugList[i].max_unit,
  502. drugList[i].min_unit,
  503. drugList[i].min_number
  504. );
  505. drugList[i].supply_count = "";
  506. drugList[i].supply_total_price = "";
  507. drugList[i].supply_manufacturer = drugList[i].manufacturer;
  508. drugList[i].supply_license_number = drugList[i].number;
  509. drugList[i].supply_remake = "";
  510. drugList[i].type = 1;
  511. drugList[i].supply_price = drugList[i].last_price;
  512. drugList[i].name = drugList[i].drug_name;
  513. if (drugList[i].max_unit != drugList[i].min_unit) {
  514. drugList[i].unitList = [
  515. { id: 1, name: "" },
  516. { id: 2, name: "" },
  517. ];
  518. }
  519. if (drugList[i].max_unit == drugList[i].min_unit) {
  520. drugList[i].unitList = [{ id: 1, name: "" }];
  521. }
  522. drugList[i].supply_unit = drugList[i].max_unit;
  523. for (let j = 0; j < drugList[i].unitList.length; j++) {
  524. if (drugList[i].max_unit != drugList[i].min_unit) {
  525. drugList[i].unitList[0].name = drugList[i].max_unit;
  526. drugList[i].unitList[1].name = drugList[i].min_unit;
  527. }
  528. if (drugList[i].max_unit == drugList[i].min_unit) {
  529. drugList[i].unitList[0].name = drugList[i].max_unit;
  530. }
  531. }
  532. this.tabList.push(drugList[i]);
  533. }
  534. this.drugList = drugList;
  535. var goodList = response.data.data.goodList;
  536. for (let i = 0; i < goodList.length; i++) {
  537. for (let j = 0; j < this.manufactuerList.length; j++) {
  538. if (goodList[i].manufacturer == this.manufactuerList[j].id) {
  539. goodList[i].manufacturer =
  540. this.manufactuerList[j].manufacturer_name;
  541. }
  542. }
  543. for (let y = 0; y < this.goodTypeList.length; y++) {
  544. if (goodList[i].good_type_id == this.goodTypeList[y].id) {
  545. goodList[i].good_type_id = this.goodTypeList[y].type_name;
  546. }
  547. }
  548. goodList[i].supply_name =goodList[i].good_name +" " +goodList[i].specification_name +" " + goodList[i].manufacturer;
  549. goodList[i].supply_type = goodList[i].good_type_id;
  550. goodList[i].supply_specification_name =goodList[i].specification_name;
  551. goodList[i].supply_price = goodList[i].buy_price;
  552. goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info);
  553. goodList[i].supply_count = "";
  554. goodList[i].supply_total_price = "";
  555. goodList[i].supply_manufacturer = goodList[i].manufacturer;
  556. goodList[i].supply_license_number = goodList[i].number
  557. goodList[i].supply_remake = "";
  558. goodList[i].type = 2;
  559. goodList[i].name = goodList[i].good_name;
  560. goodList[i].unitList = [{ id: 1, name: "" }];
  561. goodList[i].supply_unit = goodList[i].packing_unit;
  562. for (let j = 0; j < goodList[i].unitList.length; j++) {
  563. goodList[i].unitList[0].name = goodList[i].packing_unit;
  564. }
  565. this.tabList.push(goodList[i]);
  566. }
  567. this.goodList = goodList;
  568. }
  569. });
  570. },
  571. changeGoodName(val) {
  572. this.currentIndex = val;
  573. },
  574. changeName(val) {
  575. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  576. if (this.currentIndex == i) {
  577. this.recordInfo.tableList[i].project_id = val.id;
  578. this.recordInfo.tableList[i].type = val.type;
  579. this.recordInfo.tableList[i].name = val.name;
  580. this.recordInfo.tableList[i].supply_name = val.supply_name;
  581. this.recordInfo.tableList[i].supply_type = val.supply_type;
  582. this.recordInfo.tableList[i].supply_specification_name =val.supply_specification_name;
  583. this.recordInfo.tableList[i].supply_total = val.supply_total;
  584. if (val.supply_count == NaN) {
  585. this.recordInfo.tableList[i].supply_count = "";
  586. } else {
  587. this.recordInfo.tableList[i].supply_count = val.supply_count
  588. ? val.supply_count
  589. : "";
  590. }
  591. this.recordInfo.tableList[i].supply_price = val.supply_price? val.supply_price: "";
  592. this.recordInfo.tableList[i].supply_total_price =val.supply_total_price ? val.supply_total_price : "";
  593. this.recordInfo.tableList[i].supply_manufacturer =val.supply_manufacturer;
  594. this.recordInfo.tableList[i].supply_license_number =val.supply_license_number;
  595. this.recordInfo.tableList[i].supply_remake = val.supply_remake;
  596. this.recordInfo.tableList[i].is_total = val.is_total;
  597. this.recordInfo.tableList[i].supply_unit = val.supply_unit;
  598. this.recordInfo.tableList[i].unitList = val.unitList;
  599. }
  600. }
  601. },
  602. handleEdit() {
  603. if (this.is_check == 1) {
  604. this.$message.error("已审核的不能新增!");
  605. return false;
  606. }
  607. const tempObj = {};
  608. tempObj["id"] = 0;
  609. tempObj["name"] = "";
  610. tempObj["supply_name"] = "";
  611. tempObj["supply_type"] = "";
  612. tempObj["supply_specification_name"] = "";
  613. tempObj["supply_total"] = "";
  614. tempObj["supply_count"] = "";
  615. tempObj["supply_price"] = "";
  616. tempObj["supply_total_price"] = "";
  617. tempObj["supply_manufacturer"] = "";
  618. tempObj["supply_license_number"] = "";
  619. tempObj["supply_remake"] = "";
  620. tempObj["type"] = 0;
  621. tempObj["is_total"] = 1;
  622. tempObj["project_id"] = 0;
  623. tempObj["supply_unit"] = "";
  624. tempObj["manufacturer_id"] = "";
  625. this.recordInfo.tableList.push(tempObj);
  626. },
  627. handleDelete: function (index, row) {
  628. if(this.is_check == 1){
  629. this.$message.error("已审核单据,不能删除!")
  630. return false
  631. }
  632. if(row.id == 0){
  633. if (this.recordInfo.tableList.length <= 1) {
  634. this.$message.error("只有一条记录的时候无法删除");
  635. return;
  636. } else {
  637. this.recordInfo.tableList.splice(index, 1);
  638. }
  639. }else{
  640. const params = {
  641. id: row.id
  642. }
  643. this.$confirm('确认删除吗?', {
  644. confirmButtonText: '确定',
  645. cancelButtonText: '取消',
  646. type: 'warning'
  647. }).then(() => {
  648. deletePurchOder(params).then(response => {
  649. if (response.data.state == 0) {
  650. this.$message.error(response.data.msg)
  651. return false
  652. } else {
  653. this.$message.success('删除成功')
  654. this.recordInfo.tableList.splice(index, 1)
  655. }
  656. })
  657. }).catch(() => {
  658. })
  659. }
  660. },
  661. changeTypeName() {},
  662. startTimeChange() {},
  663. endTimeChange() {},
  664. search() {},
  665. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  666. var total = 0;
  667. var max_str = "";
  668. var min_str = "";
  669. if (arr.length > 0) {
  670. for (let i = 0; i < arr.length; i++) {
  671. total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
  672. }
  673. }
  674. if (total < min_number) {
  675. min_str = total + min_unit;
  676. }
  677. if (total == 0) {
  678. min_str = "";
  679. max_str = "";
  680. }
  681. if (total >= min_number) {
  682. if (parseInt(total / min_number) != 0) {
  683. max_str = parseInt(total / min_number) + max_unit;
  684. }
  685. if (total % min_number != 0) {
  686. min_str = (total % min_number) + min_unit;
  687. }
  688. }
  689. return max_str + min_str;
  690. },
  691. getTotalStockCount(arr) {
  692. var total_count = 0;
  693. for (let i = 0; i < arr.length; i++) {
  694. total_count += arr[i].stock_count;
  695. }
  696. return total_count;
  697. },
  698. calculate: function (val) {
  699. if (isNaN(val)) {
  700. return "";
  701. }
  702. if (val == 0) {
  703. return "";
  704. }
  705. return Math.round(parseFloat(val) * 100) / 100;
  706. },
  707. getTimes(time) {
  708. if (time === "") {
  709. return "";
  710. }
  711. return uParseTime(time, "{y}-{m}-{d}");
  712. },
  713. updatePurchaseOrder() {
  714. if (this.supplier_name == 0 || this.supplier_name == "") {
  715. this.$message.error("供应商不能为空!");
  716. this.loading = false;
  717. return false;
  718. }
  719. this.$refs["tableForm"].validate((valid) => {
  720. if (valid) {
  721. this.loading = true;
  722. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  723. this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
  724. this.recordInfo.tableList[i].supply_license_number =this.recordInfo.tableList[i].supply_license_number.toString();
  725. this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count *this.recordInfo.tableList[i].supply_price).toString();
  726. this.recordInfo.tableList[i].supply_total =this.recordInfo.tableList[i].supply_total.toString();
  727. this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString();
  728. for (let j = 0; j < this.manufactuerList.length; j++) {
  729. if (
  730. this.recordInfo.tableList[i].supply_manufacturer ==
  731. this.manufactuerList[j].id
  732. ) {
  733. this.recordInfo.tableList[i].supply_manufacturer =
  734. this.manufactuerList[j].manufacturer_name;
  735. }
  736. if (
  737. this.recordInfo.tableList[i].supply_manufacturer ==
  738. this.manufactuerList[j].manufacturer_name
  739. ) {
  740. this.recordInfo.tableList[i].manufacturer_id =
  741. this.manufactuerList[j].id;
  742. }
  743. }
  744. }
  745. var start = this.start_time;
  746. var end = this.end_time;
  747. const params = {
  748. stockIn: this.recordInfo.tableList,
  749. return_remake: this.return_remark,
  750. };
  751. updatePurchaseOrder(
  752. params,
  753. this.supplier_name,
  754. start,
  755. end,
  756. this.rate_of_concession,
  757. this.discount_amount,
  758. this.id,
  759. this.number
  760. ).then((response) => {
  761. if (response.data.state == 1) {
  762. this.loading = false;
  763. var warehousingInfo = response.data.data.warehousingInfo;
  764. this.$message.success("保存成功!");
  765. }
  766. });
  767. }
  768. });
  769. },
  770. getAllPrice() {
  771. var total_price = 0;
  772. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  773. total_price +=
  774. this.recordInfo.tableList[i].supply_price *
  775. this.recordInfo.tableList[i].supply_count;
  776. }
  777. this.total_price = total_price;
  778. this.addressChange()
  779. return total_price.toFixed(2);
  780. },
  781. checkPurchaseOrder(id, index) {
  782. this.$confirm("是否审核?", {
  783. confirmButtonText: "确 定",
  784. cancelButtonText: "取 消",
  785. type: "warning",
  786. }).then(() => {
  787. checkPurchaseOrder(this.id).then((response) => {
  788. if (response.data.state == 1) {
  789. var info = response.data.data.info;
  790. this.disabled = true;
  791. this.$message.success("审核成功!");
  792. this.showOne = true;
  793. this.showTwo = false;
  794. this.showThree = true;
  795. this.getPurchaseOrderDetail();
  796. }
  797. });
  798. })
  799. .catch(() => {});
  800. },
  801. getPurchaseOrderDetail() {
  802. var id = this.$route.query.id;
  803. getPurchaseOrderDetail(id).then((response) => {
  804. if (response.data.state == 1) {
  805. var info = response.data.data.info;
  806. if (info.is_check == 1) {
  807. this.Reviewed = true;
  808. }
  809. this.is_check = info.is_check;
  810. this.number = info.number;
  811. this.return_remark = info.return_remake;
  812. this.id = info.id;
  813. this.supplier_name = info.supplier_id;
  814. this.rate_of_concession = info.rate_of_concession;
  815. this.discount_amount = info.discount_amount;
  816. this.start_time = this.getTimes(info.document_date);
  817. this.end_time = this.getTimes(info.delivery_date);
  818. var orderInfo = response.data.data.orderInfo;
  819. if (info.is_check == 2) {
  820. this.disabled = false;
  821. this.showOne = false;
  822. this.showTwo = true;
  823. this.showThree = false;
  824. }
  825. if (info.is_check == 1) {
  826. this.disabled = true;
  827. this.showOne = true;
  828. this.showTwo = false;
  829. this.showThree = true;
  830. }
  831. var drugList = response.data.data.baseList;
  832. var goodList = response.data.data.goodList;
  833. for (let i = 0; i < orderInfo.length; i++) {
  834. orderInfo[i].supply_count = orderInfo[i].count;
  835. orderInfo[i].supply_price = orderInfo[i].price;
  836. orderInfo[i].supply_remake = orderInfo[i].remark;
  837. orderInfo[i].type = orderInfo[i].is_source;
  838. orderInfo[i].project_id = orderInfo[i].project_id;
  839. orderInfo[i].supply_unit = orderInfo[i].supply_unit;
  840. if (orderInfo[i].is_source == 1) {
  841. for (let j = 0; j < drugList.length; j++) {
  842. if (orderInfo[i].project_id == drugList[j].id) {
  843. if (drugList[j].max_unit != drugList[j].min_unit) {
  844. orderInfo[i].unitList = [
  845. { id: 1, name: "" },
  846. { id: 2, name: "" },
  847. ];
  848. orderInfo[i].unitList[0].name = drugList[j].max_unit;
  849. orderInfo[i].unitList[1].name = drugList[j].min_unit;
  850. }
  851. if (drugList[j].max_unit == drugList[j].min_unit) {
  852. orderInfo[i].unitList = [{ id: 1, name: "" }];
  853. orderInfo[i].unitList[0].name = drugList[j].max_unit;
  854. }
  855. }
  856. }
  857. }
  858. if (orderInfo[i].is_source == 2) {
  859. for (let j = 0; j < goodList.length; j++) {
  860. if (orderInfo[i].project_id == goodList[j].id) {
  861. orderInfo[i].unitList = [{ id: 1, name: "" }];
  862. orderInfo[i].unitList[0].name = goodList[j].packing_unit;
  863. }
  864. }
  865. }
  866. }
  867. this.recordInfo.tableList = [];
  868. if(orderInfo.length == 0){
  869. const tempObj = {};
  870. tempObj["id"] = 0;
  871. tempObj["name"] = "";
  872. tempObj["supply_name"] = "";
  873. tempObj["supply_type"] = "";
  874. tempObj["supply_specification_name"] = "";
  875. tempObj["supply_total"] = "";
  876. tempObj["supply_count"] = "";
  877. tempObj["supply_price"] = "";
  878. tempObj["supply_total_price"] = "";
  879. tempObj["supply_manufacturer"] = "";
  880. tempObj["supply_license_number"] = "";
  881. tempObj["supply_remake"] = "";
  882. tempObj["type"] = 0;
  883. tempObj["is_total"] = 1;
  884. tempObj["project_id"] = 0;
  885. tempObj["supply_unit"] = "";
  886. tempObj["manufacturer_id"] = "";
  887. this.recordInfo.tableList.push(tempObj);
  888. }else{
  889. this.recordInfo.tableList = orderInfo;
  890. }
  891. }
  892. });
  893. },
  894. toPrint() {
  895. var id = this.$route.query.id;
  896. this.$router.push({ path: "/purchase/order/print?&id=" + id });
  897. },
  898. toAdd() {
  899. var id = this.$route.query.id;
  900. if (this.is_check == 2) {
  901. this.$message.error("该采购订单未审核,不能生成采购数据!");
  902. return false;
  903. }
  904. //获取商品购货订单 和 购货单的总数量
  905. getAllOrderCountList(id).then((response) => {
  906. if (response.data.state == 1) {
  907. var purcaseOrder = response.data.data.purcaseOrder;
  908. var goodOrder = response.data.data.goodOrder;
  909. var drugList = response.data.data.drugList;
  910. var ids = "";
  911. // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
  912. if (goodOrder.length == 0) {
  913. this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + ids});
  914. }
  915. for (let i = 0; i < purcaseOrder.length; i++) {
  916. for (let j = 0; j < drugList.length; j++) {
  917. if (purcaseOrder[i].is_source == 1) {
  918. if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
  919. purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number;
  920. }
  921. }
  922. }
  923. }
  924. for (let i = 0; i < goodOrder.length; i++) {
  925. for (let j = 0; j < drugList.length; j++) {
  926. if (goodOrder[i].is_source == 1) {
  927. if (goodOrder[i].supply_unit == drugList[j].max_unit) {
  928. goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
  929. }
  930. }
  931. }
  932. }
  933. let objInfo = {};
  934. if (goodOrder.length > 0) {
  935. goodOrder.forEach((item, index) => {
  936. let { project_id } = item;
  937. if (!objInfo[project_id]) {
  938. objInfo[project_id] = {
  939. project_id,
  940. child: [],
  941. count: 0,
  942. };
  943. }
  944. });
  945. let newArr = Object.values(objInfo);
  946. for (let i = 0; i < goodOrder.length; i++) {
  947. for (let j = 0; j < newArr.length; j++) {
  948. if (goodOrder[i].project_id == newArr[j].project_id) {
  949. newArr[j].child.push(goodOrder[i]);
  950. }
  951. }
  952. }
  953. for (let i = 0; i < newArr.length; i++) {
  954. for (let j = 0; j < newArr[i].child.length; j++) {
  955. newArr[i].count += newArr[i].child[j].count;
  956. }
  957. }
  958. var arr = [];
  959. var total = 0;
  960. var str = "";
  961. //如果采购单有数据,则需要比较数量
  962. if (newArr.length > 0) {
  963. for (let i = 0; i < purcaseOrder.length; i++) {
  964. for (let j = 0; j < newArr.length; j++) {
  965. if (purcaseOrder[i].project_id == newArr[j].project_id) {
  966. //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,可以继续生成采购单
  967. if (purcaseOrder[i].count > newArr[j].count) {
  968. arr.push(purcaseOrder[i].project_id);
  969. }
  970. }
  971. }
  972. }
  973. //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
  974. if (arr.length == 0) {
  975. this.$message.error("该订单已全部生成采购单,请知悉!");
  976. return;
  977. }
  978. if (arr.length >0) {
  979. str = arr.join(",");
  980. this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + str});
  981. }
  982. }
  983. }
  984. }
  985. });
  986. },
  987. addressChange() {
  988. if (this.rate_of_concession > 0) {
  989. this.discount_amount = (
  990. (this.rate_of_concession / 100) *
  991. this.total_price
  992. ).toFixed(2);
  993. }
  994. },
  995. checkReturnOrder() {
  996. var id = this.$route.query.id;
  997. //获取购货订单号
  998. getGoodOrderList(id).then((response) => {
  999. if (response.data.state == 1) {
  1000. var list = response.data.data.list
  1001. this.orderList = list
  1002. //如果长度大于0,有购货单不能反审核
  1003. if (list.length > 0) {
  1004. this.$refs.Popup.dialogVisible = true
  1005. return
  1006. }
  1007. if (list.length == 0) {
  1008. this.getReturnOrder()
  1009. this.showOne = false
  1010. this.showTwo = true
  1011. this.showThree = false
  1012. }
  1013. }
  1014. });
  1015. },
  1016. getReturnOrder() {
  1017. var id = this.$route.query.id;
  1018. getReturnOrder(id).then((response) => {
  1019. if (response.data.state == 1) {
  1020. var msg = response.data.data.msg;
  1021. this.disabled = false;
  1022. this.Reviewed = false
  1023. this.$message.success("反审核成功!");
  1024. this.getPurchaseOrderDetail();
  1025. }
  1026. });
  1027. },
  1028. toClick(id) {
  1029. this.$router.push({path:"/good/order/edit?id=" + id});
  1030. },
  1031. },
  1032. created() {
  1033. const tempObj = {};
  1034. tempObj["id"] = 0;
  1035. tempObj["name"] = "";
  1036. tempObj["supply_name"] = "";
  1037. tempObj["supply_type"] = "";
  1038. tempObj["supply_specification_name"] = "";
  1039. tempObj["supply_total"] = "";
  1040. tempObj["supply_count"] = "";
  1041. tempObj["supply_price"] = "";
  1042. tempObj["supply_total_price"] = "";
  1043. tempObj["supply_manufacturer"] = "";
  1044. tempObj["supply_license_number"] = "";
  1045. tempObj["supply_remake"] = "";
  1046. tempObj["type"] = 0;
  1047. tempObj["is_total"] = 1;
  1048. tempObj["project_id"] = 0;
  1049. tempObj["supply_unit"] = "";
  1050. tempObj["manufacturer_id"] = "";
  1051. this.recordInfo.tableList.push(tempObj);
  1052. this.getInitOrder();
  1053. this.getPurchaseOrderDetail();
  1054. },
  1055. };
  1056. </script>
  1057. <style rel="stylesheet/css" lang="scss" scoped>
  1058. .information {
  1059. border: 1px #dcdfe6 solid;
  1060. padding: 30px 20px 30px 20px;
  1061. .border {
  1062. border-bottom: 1px #dcdfe6 solid;
  1063. margin: 0px 0 20px 0;
  1064. }
  1065. }
  1066. .title {
  1067. background: #409eff;
  1068. height: 44px;
  1069. line-height: 44px;
  1070. padding: 0 0 0 10px;
  1071. color: #fff;
  1072. margin: 0 0 10px 0;
  1073. }
  1074. .edit_separater {
  1075. border-top: 1px solid rgb(233, 233, 233);
  1076. margin-top: 15px;
  1077. margin-bottom: 15px;
  1078. }
  1079. </style>
  1080. <style>
  1081. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1082. font-size: 12px;
  1083. }
  1084. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1085. background: #6fb5fa;
  1086. }
  1087. .count {
  1088. color: #bd2c00;
  1089. }
  1090. .el-table td,
  1091. .el-table th.is-leaf,
  1092. .el-table--border,
  1093. .el-table--group {
  1094. border-color: #d0d3da;
  1095. }
  1096. .el-table--border::after,
  1097. .el-table--group::after,
  1098. .el-table::before {
  1099. background-color: #d0d3da;
  1100. }
  1101. .el-table__fixed-right {
  1102. width: 150px;
  1103. bottom: 20px;
  1104. height: 100%;
  1105. }
  1106. .reviewImg {
  1107. position: fixed;
  1108. left: 50%;
  1109. transform: translateX(-50%);
  1110. top: 30%;
  1111. }
  1112. </style>