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

editPurchaseOrder.vue 39KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  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. console.log("哈哈哈哈哈哈",params)
  753. updatePurchaseOrder(
  754. params,
  755. this.supplier_name,
  756. start,
  757. end,
  758. this.rate_of_concession,
  759. this.discount_amount,
  760. this.id,
  761. this.number
  762. ).then((response) => {
  763. if (response.data.state == 1) {
  764. this.loading = false;
  765. var warehousingInfo = response.data.data.warehousingInfo;
  766. this.$message.success("保存成功!");
  767. this.getPurchaseOrderDetail()
  768. }
  769. });
  770. }
  771. });
  772. },
  773. getAllPrice() {
  774. var total_price = 0;
  775. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  776. total_price +=
  777. this.recordInfo.tableList[i].supply_price *
  778. this.recordInfo.tableList[i].supply_count;
  779. }
  780. this.total_price = total_price;
  781. this.addressChange()
  782. return total_price.toFixed(2);
  783. },
  784. checkPurchaseOrder(id, index) {
  785. this.$confirm("是否审核?", {
  786. confirmButtonText: "确 定",
  787. cancelButtonText: "取 消",
  788. type: "warning",
  789. }).then(() => {
  790. checkPurchaseOrder(this.id).then((response) => {
  791. if (response.data.state == 1) {
  792. var info = response.data.data.info;
  793. this.disabled = true;
  794. this.$message.success("审核成功!");
  795. this.showOne = true;
  796. this.showTwo = false;
  797. this.showThree = true;
  798. this.getPurchaseOrderDetail();
  799. }
  800. });
  801. })
  802. .catch(() => {});
  803. },
  804. getPurchaseOrderDetail() {
  805. var id = this.$route.query.id;
  806. getPurchaseOrderDetail(id).then((response) => {
  807. if (response.data.state == 1) {
  808. var info = response.data.data.info;
  809. if (info.is_check == 1) {
  810. this.Reviewed = true;
  811. }
  812. this.is_check = info.is_check;
  813. this.number = info.number;
  814. this.return_remark = info.return_remake;
  815. this.id = info.id;
  816. this.supplier_name = info.supplier_id;
  817. this.rate_of_concession = info.rate_of_concession;
  818. this.discount_amount = info.discount_amount;
  819. this.start_time = this.getTimes(info.document_date);
  820. this.end_time = this.getTimes(info.delivery_date);
  821. var orderInfo = response.data.data.orderInfo;
  822. if (info.is_check == 2) {
  823. this.disabled = false;
  824. this.showOne = false;
  825. this.showTwo = true;
  826. this.showThree = false;
  827. }
  828. if (info.is_check == 1) {
  829. this.disabled = true;
  830. this.showOne = true;
  831. this.showTwo = false;
  832. this.showThree = true;
  833. }
  834. var drugList = response.data.data.baseList;
  835. var goodList = response.data.data.goodList;
  836. for (let i = 0; i < orderInfo.length; i++) {
  837. orderInfo[i].id = orderInfo[i].id
  838. orderInfo[i].supply_count = orderInfo[i].count;
  839. orderInfo[i].supply_price = orderInfo[i].price;
  840. orderInfo[i].supply_remake = orderInfo[i].remark;
  841. orderInfo[i].type = orderInfo[i].is_source;
  842. orderInfo[i].project_id = orderInfo[i].project_id;
  843. orderInfo[i].supply_unit = orderInfo[i].supply_unit;
  844. if (orderInfo[i].is_source == 1) {
  845. for (let j = 0; j < drugList.length; j++) {
  846. if (orderInfo[i].project_id == drugList[j].id) {
  847. if (drugList[j].max_unit != drugList[j].min_unit) {
  848. orderInfo[i].unitList = [
  849. { id: 1, name: "" },
  850. { id: 2, name: "" },
  851. ];
  852. orderInfo[i].unitList[0].name = drugList[j].max_unit;
  853. orderInfo[i].unitList[1].name = drugList[j].min_unit;
  854. }
  855. if (drugList[j].max_unit == drugList[j].min_unit) {
  856. orderInfo[i].unitList = [{ id: 1, name: "" }];
  857. orderInfo[i].unitList[0].name = drugList[j].max_unit;
  858. }
  859. }
  860. }
  861. }
  862. if (orderInfo[i].is_source == 2) {
  863. for (let j = 0; j < goodList.length; j++) {
  864. if (orderInfo[i].project_id == goodList[j].id) {
  865. orderInfo[i].unitList = [{ id: 1, name: "" }];
  866. orderInfo[i].unitList[0].name = goodList[j].packing_unit;
  867. }
  868. }
  869. }
  870. }
  871. this.recordInfo.tableList = [];
  872. if(orderInfo.length == 0){
  873. const tempObj = {};
  874. tempObj["id"] = 0;
  875. tempObj["name"] = "";
  876. tempObj["supply_name"] = "";
  877. tempObj["supply_type"] = "";
  878. tempObj["supply_specification_name"] = "";
  879. tempObj["supply_total"] = "";
  880. tempObj["supply_count"] = "";
  881. tempObj["supply_price"] = "";
  882. tempObj["supply_total_price"] = "";
  883. tempObj["supply_manufacturer"] = "";
  884. tempObj["supply_license_number"] = "";
  885. tempObj["supply_remake"] = "";
  886. tempObj["type"] = 0;
  887. tempObj["is_total"] = 1;
  888. tempObj["project_id"] = 0;
  889. tempObj["supply_unit"] = "";
  890. tempObj["manufacturer_id"] = "";
  891. this.recordInfo.tableList.push(tempObj);
  892. }else{
  893. this.recordInfo.tableList = orderInfo;
  894. }
  895. }
  896. });
  897. },
  898. toPrint() {
  899. var id = this.$route.query.id;
  900. this.$router.push({ path: "/purchase/order/print?&id=" + id });
  901. },
  902. toAdd() {
  903. var id = this.$route.query.id;
  904. if (this.is_check == 2) {
  905. this.$message.error("该采购订单未审核,不能生成采购数据!");
  906. return false;
  907. }
  908. //获取商品购货订单 和 购货单的总数量
  909. getAllOrderCountList(id).then((response) => {
  910. if (response.data.state == 1) {
  911. var purcaseOrder = response.data.data.purcaseOrder;
  912. var goodOrder = response.data.data.goodOrder;
  913. var drugList = response.data.data.drugList;
  914. var ids = "";
  915. // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
  916. if (goodOrder.length == 0) {
  917. this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + ids});
  918. }
  919. for (let i = 0; i < purcaseOrder.length; i++) {
  920. for (let j = 0; j < drugList.length; j++) {
  921. if (purcaseOrder[i].is_source == 1) {
  922. if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
  923. purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number;
  924. }
  925. }
  926. }
  927. }
  928. for (let i = 0; i < goodOrder.length; i++) {
  929. for (let j = 0; j < drugList.length; j++) {
  930. if (goodOrder[i].is_source == 1) {
  931. if (goodOrder[i].supply_unit == drugList[j].max_unit) {
  932. goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
  933. }
  934. }
  935. }
  936. }
  937. let objInfo = {};
  938. if (goodOrder.length > 0) {
  939. goodOrder.forEach((item, index) => {
  940. let { project_id } = item;
  941. if (!objInfo[project_id]) {
  942. objInfo[project_id] = {
  943. project_id,
  944. child: [],
  945. count: 0,
  946. };
  947. }
  948. });
  949. let newArr = Object.values(objInfo);
  950. for (let i = 0; i < goodOrder.length; i++) {
  951. for (let j = 0; j < newArr.length; j++) {
  952. if (goodOrder[i].project_id == newArr[j].project_id) {
  953. newArr[j].child.push(goodOrder[i]);
  954. }
  955. }
  956. }
  957. for (let i = 0; i < newArr.length; i++) {
  958. for (let j = 0; j < newArr[i].child.length; j++) {
  959. newArr[i].count += newArr[i].child[j].count;
  960. }
  961. }
  962. var arr = [];
  963. var total = 0;
  964. var str = "";
  965. //如果采购单有数据,则需要比较数量
  966. if (newArr.length > 0) {
  967. for (let i = 0; i < purcaseOrder.length; i++) {
  968. for (let j = 0; j < newArr.length; j++) {
  969. if (purcaseOrder[i].project_id == newArr[j].project_id) {
  970. //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,可以继续生成采购单
  971. if (purcaseOrder[i].count > newArr[j].count) {
  972. arr.push(purcaseOrder[i].project_id);
  973. }
  974. }
  975. }
  976. }
  977. //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
  978. if (arr.length == 0) {
  979. this.$message.error("该订单已全部生成采购单,请知悉!");
  980. return;
  981. }
  982. if (arr.length >0) {
  983. str = arr.join(",");
  984. this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + str});
  985. }
  986. }
  987. }
  988. }
  989. });
  990. },
  991. addressChange() {
  992. if (this.rate_of_concession > 0) {
  993. this.discount_amount = (
  994. (this.rate_of_concession / 100) *
  995. this.total_price
  996. ).toFixed(2);
  997. }
  998. },
  999. checkReturnOrder() {
  1000. var id = this.$route.query.id;
  1001. //获取购货订单号
  1002. getGoodOrderList(id).then((response) => {
  1003. if (response.data.state == 1) {
  1004. var list = response.data.data.list
  1005. this.orderList = list
  1006. //如果长度大于0,有购货单不能反审核
  1007. if (list.length > 0) {
  1008. this.$refs.Popup.dialogVisible = true
  1009. return
  1010. }
  1011. if (list.length == 0) {
  1012. this.getReturnOrder()
  1013. this.showOne = false
  1014. this.showTwo = true
  1015. this.showThree = false
  1016. }
  1017. }
  1018. });
  1019. },
  1020. getReturnOrder() {
  1021. var id = this.$route.query.id;
  1022. getReturnOrder(id).then((response) => {
  1023. if (response.data.state == 1) {
  1024. var msg = response.data.data.msg;
  1025. this.disabled = false;
  1026. this.Reviewed = false
  1027. this.$message.success("反审核成功!");
  1028. this.getPurchaseOrderDetail();
  1029. }
  1030. });
  1031. },
  1032. toClick(id) {
  1033. this.$router.push({path:"/good/order/edit?id=" + id});
  1034. },
  1035. },
  1036. created() {
  1037. const tempObj = {};
  1038. tempObj["id"] = 0;
  1039. tempObj["name"] = "";
  1040. tempObj["supply_name"] = "";
  1041. tempObj["supply_type"] = "";
  1042. tempObj["supply_specification_name"] = "";
  1043. tempObj["supply_total"] = "";
  1044. tempObj["supply_count"] = "";
  1045. tempObj["supply_price"] = "";
  1046. tempObj["supply_total_price"] = "";
  1047. tempObj["supply_manufacturer"] = "";
  1048. tempObj["supply_license_number"] = "";
  1049. tempObj["supply_remake"] = "";
  1050. tempObj["type"] = 0;
  1051. tempObj["is_total"] = 1;
  1052. tempObj["project_id"] = 0;
  1053. tempObj["supply_unit"] = "";
  1054. tempObj["manufacturer_id"] = "";
  1055. this.recordInfo.tableList.push(tempObj);
  1056. this.getInitOrder();
  1057. this.getPurchaseOrderDetail();
  1058. },
  1059. };
  1060. </script>
  1061. <style rel="stylesheet/css" lang="scss" scoped>
  1062. .information {
  1063. border: 1px #dcdfe6 solid;
  1064. padding: 30px 20px 30px 20px;
  1065. .border {
  1066. border-bottom: 1px #dcdfe6 solid;
  1067. margin: 0px 0 20px 0;
  1068. }
  1069. }
  1070. .title {
  1071. background: #409eff;
  1072. height: 44px;
  1073. line-height: 44px;
  1074. padding: 0 0 0 10px;
  1075. color: #fff;
  1076. margin: 0 0 10px 0;
  1077. }
  1078. .edit_separater {
  1079. border-top: 1px solid rgb(233, 233, 233);
  1080. margin-top: 15px;
  1081. margin-bottom: 15px;
  1082. }
  1083. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  1084. width: 10px;
  1085. height: 10px;
  1086. }
  1087. </style>
  1088. <style>
  1089. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1090. font-size: 12px;
  1091. }
  1092. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1093. background: #6fb5fa;
  1094. }
  1095. .count {
  1096. color: #bd2c00;
  1097. }
  1098. .el-table td,
  1099. .el-table th.is-leaf,
  1100. .el-table--border,
  1101. .el-table--group {
  1102. border-color: #d0d3da;
  1103. }
  1104. .el-table--border::after,
  1105. .el-table--group::after,
  1106. .el-table::before {
  1107. background-color: #d0d3da;
  1108. }
  1109. .el-table__fixed-right {
  1110. width: 150px;
  1111. bottom: 20px;
  1112. height: 100%;
  1113. }
  1114. .reviewImg {
  1115. position: fixed;
  1116. left: 50%;
  1117. transform: translateX(-50%);
  1118. top: 30%;
  1119. }
  1120. </style>