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

editGoodOrder.vue 38KB

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