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

editGoodOrder.vue 38KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  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. </div>
  254. </div>
  255. </template>
  256. <script>
  257. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  258. import {uParseTime } from '@/utils/tools'
  259. import {getInitOrder,checkPurchaseOrder,getGoodOrderDetail,updateGoodOrder,getGoodOrderCountList,ModefySupplyWarehousing,MofyGoodOrder,UpdateSupplyWahouseingInfo,getSupplyWarehouseOutById} from "@/api/supply"
  260. export default {
  261. name: "addPurchaseOrder",
  262. components: {
  263. BreadCrumb
  264. },
  265. data() {
  266. return {
  267. crumbs: [
  268. { path: false, name: "采购单" },
  269. { path: "/supply/good/order/query", name: "编辑采购单" }
  270. ],
  271. showOne:true,
  272. showTwo:false,
  273. showThree:false,
  274. recordInfo: {
  275. tableList:[],
  276. },
  277. keywords: "",
  278. total: 0,
  279. multipleSelection: [],
  280. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  281. start_time: "",
  282. end_time: "",
  283. page: 1,
  284. limit: 10,
  285. goodType: [],
  286. goodInfo: [],
  287. org_id:0,
  288. types:[],
  289. tyep_name:"",
  290. form:{
  291. manufacturer_id:"",
  292. },
  293. tabList:[],
  294. manufactuerList:[],
  295. currentIndex: 0,
  296. goodTypeList:[],
  297. drugTypeList:[],
  298. supplier_name:"",
  299. supplyList:[],
  300. rate_of_concession:"",
  301. discount_amount:"",
  302. start_time:"",
  303. end_time:"",
  304. tableRules: {
  305. name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
  306. supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
  307. supply_batch_number:[{required:true,message:"批号不能为空", trigger: 'blur'}],
  308. supply_product_date:[{required:true,message:"生产日期不能为空", trigger: 'blur'}],
  309. supply_expiry_date:[{required:true,message:"有效日期不能为空",trigger: 'blur'}]
  310. },
  311. warehousing_id:0,
  312. number:"",
  313. loading:false,
  314. drugList:[],
  315. goodList:[],
  316. id:0,
  317. disabled:false,
  318. is_check:0,
  319. dialogVisible:false,
  320. arrearage:"",
  321. payment:"",
  322. good_number:"",
  323. orderInfo:[],
  324. warese_out_id:0,
  325. return_remark:"",
  326. };
  327. },
  328. methods:{
  329. getInitOrder(){
  330. getInitOrder().then(response=>{
  331. if(response.data.state == 1){
  332. var drugList = response.data.data.drugList
  333. this.manufactuerList = response.data.data.manufactuerList
  334. this.goodTypeList = response.data.data.goodTypeList
  335. this.drugTypeList = response.data.data.drugTypeList
  336. this.supplyList = response.data.data.supplyList
  337. for(let i=0;i<drugList.length;i++){
  338. for(let z=0;z<drugList[i].drug_warehouse_info.length;z++){
  339. if(drugList[i].max_unit == drugList[i].drug_warehouse_info[z].max_unit){
  340. drugList[i].drug_warehouse_info[z].stock_max_number = drugList[i].drug_warehouse_info[z].stock_max_number * drugList[i].min_number
  341. }
  342. }
  343. for(let j=0;j<this.manufactuerList.length;j++){
  344. if(drugList[i].manufacturer == this.manufactuerList[j].id){
  345. drugList[i].manufacturer = this.manufactuerList[j].manufacturer_name
  346. }
  347. }
  348. for(let y=0;y<this.drugTypeList.length;y++){
  349. if(drugList[i].drug_type == this.drugTypeList[y].value){
  350. drugList[i].drug_type = this.drugTypeList[y].name
  351. }
  352. }
  353. 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
  354. drugList[i].supply_type = drugList[i].drug_type
  355. drugList[i].supply_specification_name = drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit
  356. drugList[i].supply_total = this.getWarehoseInfo(drugList[i].drug_warehouse_info,drugList[i].max_unit,drugList[i].min_unit,drugList[i].min_number)
  357. drugList[i].supply_count = ""
  358. drugList[i].supply_total_price = ""
  359. drugList[i].supply_manufacturer= drugList[i].manufacturer
  360. drugList[i].supply_license_number= drugList[i].number
  361. drugList[i].supply_remake = ""
  362. drugList[i].type = 1
  363. drugList[i].supply_price = drugList[i].last_price
  364. drugList[i].name = drugList[i].drug_name
  365. if(drugList[i].max_unit != drugList[i].min_unit){
  366. drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
  367. }
  368. if(drugList[i].max_unit == drugList[i].min_unit){
  369. drugList[i].unitList = [{id:1,name:""}]
  370. }
  371. drugList[i].warehouse_info_id = 0
  372. drugList[i].warehousing_id= 0
  373. drugList[i].supply_unit = drugList[i].max_unit
  374. for(let j=0;j<drugList[i].unitList.length;j++){
  375. if(drugList[i].max_unit != drugList[i].min_unit){
  376. drugList[i].unitList[0].name = drugList[i].max_unit
  377. drugList[i].unitList[1].name = drugList[i].min_unit
  378. }
  379. if(drugList[i].max_unit == drugList[i].min_unit){
  380. drugList[i].unitList[0].name = drugList[i].max_unit
  381. }
  382. }
  383. this.tabList.push(drugList[i])
  384. }
  385. this.drugList = drugList
  386. var goodList = response.data.data.goodList
  387. for(let i=0;i<goodList.length;i++){
  388. for(let j=0;j<this.manufactuerList.length;j++){
  389. if(goodList[i].manufacturer == this.manufactuerList[j].id){
  390. goodList[i].manufacturer = this.manufactuerList[j].manufacturer_name
  391. }
  392. }
  393. for(let y=0;y<this.goodTypeList.length;y++){
  394. if(goodList[i].good_type_id == this.goodTypeList[y].id){
  395. goodList[i].good_type_id = this.goodTypeList[y].type_name
  396. }
  397. }
  398. goodList[i].supply_name = goodList[i].good_name + " " + goodList[i].specification_name + " " +goodList[i].manufacturer
  399. goodList[i].supply_type = goodList[i].good_type_id
  400. goodList[i].supply_specification_name =goodList[i].specification_name
  401. goodList[i].supply_price = goodList[i].buy_price
  402. goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info)
  403. goodList[i].supply_count = ""
  404. goodList[i].supply_total_price = ""
  405. goodList[i].supply_manufacturer = goodList[i].manufacturer
  406. goodList[i].supply_license_number = ""
  407. goodList[i].supply_remake = ""
  408. goodList[i].type = 2
  409. goodList[i].name = goodList[i].good_name
  410. goodList[i].unitList = [{id:1,name:""}]
  411. goodList[i].supply_unit = goodList[i].packing_unit
  412. goodList[i].warehouse_info_id = 0
  413. goodList[i].warehousing_id= 0
  414. for(let j=0;j<goodList[i].unitList.length;j++){
  415. goodList[i].unitList[0].name = goodList[i].packing_unit
  416. }
  417. this.tabList.push(goodList[i])
  418. }
  419. this.goodList = goodList
  420. }
  421. })
  422. },
  423. changeGoodName(val){
  424. this.currentIndex = val
  425. },
  426. changeName(val){
  427. for(let i=0;i<this.recordInfo.tableList.length;i++){
  428. if(this.currentIndex == i){
  429. this.recordInfo.tableList[i].project_id = val.id
  430. this.recordInfo.tableList[i].type = val.type
  431. this.recordInfo.tableList[i].name = val.name
  432. this.recordInfo.tableList[i].supply_name = val.supply_name
  433. this.recordInfo.tableList[i].supply_type = val.supply_type
  434. this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name
  435. this.recordInfo.tableList[i].supply_total = val.supply_total
  436. if(val.supply_count == NaN){
  437. this.recordInfo.tableList[i].supply_count = ""
  438. }else{
  439. this.recordInfo.tableList[i].supply_count = val.supply_count?val.supply_count:""
  440. }
  441. this.recordInfo.tableList[i].supply_price = val.supply_price?val.supply_price:""
  442. this.recordInfo.tableList[i].supply_total_price = (val.supply_count * val.supply_price).toFixed(2)
  443. this.recordInfo.tableList[i].supply_manufacturer = val.supply_manufacturer
  444. this.recordInfo.tableList[i].supply_license_number = val.supply_license_number
  445. this.recordInfo.tableList[i].supply_remake = val.supply_remake
  446. this.recordInfo.tableList[i].is_total = val.is_total
  447. this.recordInfo.tableList[i].supply_unit = val.supply_unit
  448. this.recordInfo.tableList[i].unitList = val.unitList
  449. this.recordInfo.tableList[i].warehouse_info_id = val.warehouse_info_id
  450. this.recordInfo.tableList[i].warehousing_id = val.warehousing_id
  451. }
  452. }
  453. },
  454. handleEdit(){
  455. const tempObj = {}
  456. tempObj["id"] = 0
  457. tempObj["name"] = ""
  458. tempObj['supply_name'] = ""
  459. tempObj['supply_type'] = ""
  460. tempObj['supply_specification_name'] = ''
  461. tempObj['supply_total'] = ""
  462. tempObj['supply_count'] = ""
  463. tempObj['supply_price'] = ""
  464. tempObj['supply_total_price'] = ""
  465. tempObj['supply_manufacturer'] = ''
  466. tempObj['supply_license_number'] = ''
  467. tempObj['supply_remake'] = ''
  468. tempObj['type'] = 0
  469. tempObj['is_total'] = 1
  470. tempObj["project_id"] = 0
  471. tempObj["supply_unit"] = ""
  472. tempObj["supply_batch_number"] = ""
  473. tempObj["supply_product_date"] = ""
  474. tempObj["order_number"] = ""
  475. tempObj["supply_expiry_date"] = ""
  476. tempObj["manufacturer_id"] = ""
  477. tempObj["warehouse_info_id"] = ""
  478. tempObj["warehousing_id"]= ""
  479. tempObj["number"] = ""
  480. tempObj["good_number"] = ""
  481. this.recordInfo.tableList.push(tempObj)
  482. },
  483. handleDelete: function(index, row) {
  484. if (this.recordInfo.tableList.length <= 1) {
  485. this.$message.error('只有一条记录的时候无法删除')
  486. return
  487. } else {
  488. this.recordInfo.tableList.splice(index, 1)
  489. }
  490. },
  491. getWarehoseInfo(arr,max_unit,min_unit,min_number){
  492. var total = 0
  493. var max_str= ""
  494. var min_str = ""
  495. if (arr.length > 0) {
  496. for(let i=0;i<arr.length;i++){
  497. total += parseInt(arr[i].stock_max_number+arr[i].stock_min_number)
  498. }
  499. }
  500. if (total < min_number){
  501. min_str = total + min_unit
  502. }
  503. if (total == 0) {
  504. min_str = ""
  505. max_str = ""
  506. }
  507. if (total >=min_number) {
  508. if(parseInt(total/min_number)!=0){
  509. max_str = parseInt(total/min_number) + max_unit
  510. }
  511. if(total%min_number!=0){
  512. min_str = total%min_number + min_unit
  513. }
  514. }
  515. return max_str + min_str
  516. },
  517. getTotalStockCount(arr){
  518. var total_count = 0
  519. for(let i=0;i<arr.length;i++){
  520. total_count += arr[i].stock_count
  521. }
  522. return total_count
  523. },
  524. calculate: function(val) {
  525. if (isNaN(val)) {
  526. return "";
  527. }
  528. if (val == 0) {
  529. return "";
  530. }
  531. return Math.round(parseFloat(val) * 100) / 100;
  532. },
  533. getTimes(time) {
  534. if (time === '') {
  535. return ''
  536. }
  537. return uParseTime(time, '{y}-{m}-{d}')
  538. },
  539. getAllPrice(){
  540. var total_price = 0
  541. for(let i=0;i<this.recordInfo.tableList.length;i++){
  542. total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
  543. }
  544. return total_price.toFixed(2)
  545. },
  546. checkPurchaseOrder(id,index){
  547. this.$confirm('是否审核?', {
  548. confirmButtonText: '确 定',
  549. cancelButtonText: '取 消',
  550. type: 'warning'
  551. }).then(() => {
  552. checkPurchaseOrder(this.id).then(response => {
  553. if (response.data.state == 1) {
  554. var info = response.data.data.info
  555. this.disabled = true
  556. this.$message.success("审核成功!")
  557. this.getPurchaseOrderDetail()
  558. }
  559. })
  560. })
  561. .catch(() => {
  562. })
  563. },
  564. getGoodOrderDetail(){
  565. var id = this.$route.query.id
  566. getGoodOrderDetail(id).then(response=>{
  567. if(response.data.state == 1){
  568. var out = response.data.data.out
  569. this.is_check = out.is_check
  570. if(out.is_check == 1){
  571. this.showOne = false
  572. this.showTwo = true
  573. this.showThree = true
  574. }
  575. this.id = out.id
  576. this.supplier_name = out.supplier_id
  577. this.rate_of_concession = out.rate_of_concession
  578. this.discount_amount = out.discount_amount
  579. this.payment = out.payment
  580. this.arrearage = out.arrearage
  581. this.number = out.number
  582. this.good_number = out.good_number
  583. this.return_remark = out.return_remake
  584. this.start_time = this.getTimes(out.document_date)
  585. var orderInfo = response.data.data.list
  586. var drugList = response.data.data.drugList
  587. var goodList = response.data.data.goodList
  588. for(let i=0;i< orderInfo.length;i++){
  589. orderInfo[i].supply_count = orderInfo[i].count
  590. orderInfo[i].supply_price = orderInfo[i].price
  591. orderInfo[i].supply_remake = orderInfo[i].remark
  592. orderInfo[i].type = orderInfo[i].is_source
  593. orderInfo[i].project_id = orderInfo[i].project_id
  594. orderInfo[i].supply_unit = orderInfo[i].supply_unit
  595. orderInfo[i].order_number = orderInfo[i].order_number
  596. orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2)
  597. orderInfo[i].supply_expiry_date = this.getTimes(orderInfo[i].supply_expiry_date)
  598. orderInfo[i].supply_product_date = this.getTimes(orderInfo[i].supply_product_date)
  599. if(orderInfo[i].is_source == 1){
  600. for(let j=0;j<drugList.length;j++){
  601. if( orderInfo[i].project_id == drugList[j].id){
  602. if(drugList[j].max_unit!=drugList[j].min_unit){
  603. orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
  604. orderInfo[i].unitList[0].name = drugList[j].max_unit
  605. orderInfo[i].unitList[1].name = drugList[j].min_unit
  606. }
  607. if(drugList[j].max_unit ==drugList[j].min_unit){
  608. orderInfo[i].unitList = [{id:1,name:""}]
  609. orderInfo[i].unitList[0].name = drugList[j].max_unit
  610. }
  611. }
  612. }
  613. }
  614. if(orderInfo[i].is_source == 2){
  615. for(let j=0;j<goodList.length;j++){
  616. if(orderInfo[i].project_id == goodList[j].id){
  617. orderInfo[i].unitList = [{id:1,name:""}]
  618. orderInfo[i].unitList[0].name = goodList[j].packing_unit
  619. }
  620. }
  621. }
  622. }
  623. this.recordInfo.tableList= []
  624. this.recordInfo.tableList = orderInfo
  625. }
  626. })
  627. },
  628. toPrint(){
  629. var id = this.$route.query.id
  630. this.$router.push({path:"/purchase/order/print?&id="+id})
  631. },
  632. updateGoodOrder(){
  633. if(this.supplier_name == 0 || this.supplier_name == ""){
  634. this.$message.error("供应商不能为空!")
  635. this.loading = false
  636. return false
  637. }
  638. for(let i=0;i<this.recordInfo.tableList.length;i++){
  639. this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
  640. this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
  641. this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
  642. this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
  643. for(let j=0;j<this.manufactuerList.length;j++){
  644. if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
  645. this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
  646. }
  647. if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
  648. this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
  649. }
  650. }
  651. }
  652. var start = this.start_time
  653. this.$refs["tableForm"].validate((valid)=>{
  654. if(valid){
  655. this.loading = true
  656. var warehose_out_id = this.$route.query.id
  657. var params = {
  658. stockIn:this.recordInfo.tableList,
  659. return_remake:this.return_remark,
  660. }
  661. 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=>{
  662. if(response.data.state == 1){
  663. this.loading = false
  664. this.$message.success("保存成功!")
  665. }
  666. })
  667. }
  668. })
  669. },
  670. checkGoodOrder(){
  671. var id = this.$route.query.id
  672. var warehousing_id = this.$route.query.warehousing_id
  673. getGoodOrderCountList(id,warehousing_id).then(response=>{
  674. if(response.data.state == 1){
  675. this.$message.success("审核成功!")
  676. this.showOne = false
  677. this.showTwo = true
  678. this.showThree = true
  679. var purcaseOrder = response.data.data.purcaseOrder
  680. console.log("采购订单",purcaseOrder)
  681. var goodOrder = response.data.data.goodOrder
  682. console.log("采购单",goodOrder)
  683. var drugList = response.data.data.drugList
  684. console.log("druglist23323223",drugList)
  685. var is_warehouse = 0
  686. for(let i=0;i<purcaseOrder.length;i++){
  687. for(let j=0;j<drugList.length;j++){
  688. if(purcaseOrder[i].is_source == 1){
  689. if(purcaseOrder[i].supply_unit == drugList[j].max_unit){
  690. purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number
  691. }
  692. }
  693. }
  694. }
  695. for(let i=0;i<goodOrder.length;i++){
  696. for(let j=0;j<drugList.length;j++){
  697. if(goodOrder[i].is_source == 1){
  698. if(goodOrder[i].supply_unit == drugList[j].max_unit){
  699. goodOrder[i].count = goodOrder[i].count * drugList[j].min_number
  700. }
  701. }
  702. }
  703. }
  704. let objInfo = {}
  705. if (goodOrder.length >0){
  706. goodOrder.forEach((item,index)=>{
  707. let { project_id } = item
  708. if(!objInfo[project_id]){
  709. objInfo[project_id] = {
  710. project_id,
  711. child:[],
  712. count:0,
  713. }
  714. }
  715. })
  716. let newArr = Object.values(objInfo);
  717. for(let i=0;i<goodOrder.length;i++){
  718. for(let j=0;j<newArr.length;j++){
  719. if(goodOrder[i].project_id == newArr[j].project_id){
  720. newArr[j].child.push(goodOrder[i])
  721. }
  722. }
  723. }
  724. console.log("newAr2332232323",newArr)
  725. for(let i=0;i<newArr.length;i++){
  726. for(let j=0;j<newArr[i].child.length;j++){
  727. newArr[i].count += newArr[i].child[j].count
  728. }
  729. }
  730. var arr = []
  731. var total = 0
  732. var str = ""
  733. //如果采购单有数据,则需要比较数量
  734. if(newArr.length > 0){
  735. for(let i=0;i<purcaseOrder.length;i++){
  736. for(let j=0;j<newArr.length;j++){
  737. if(purcaseOrder[i].project_id == newArr[j].project_id){
  738. //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,部分入库
  739. if(purcaseOrder[i].count > newArr[j].count){
  740. arr.push(purcaseOrder[i].project_id)
  741. }
  742. }
  743. }
  744. }
  745. //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
  746. if(arr.length == 0){
  747. is_warehouse = 1
  748. this.ModefySupplyWarehousing(is_warehouse,warehousing_id)
  749. }
  750. //部分入库
  751. if(total!=goodOrder.length){
  752. //修改订购单
  753. is_warehouse = 3
  754. this.ModefySupplyWarehousing(is_warehouse,warehousing_id)
  755. }
  756. }
  757. }
  758. }
  759. })
  760. },
  761. ModefySupplyWarehousing(is_warehouse,warehousing_id){
  762. var params = {
  763. is_warehouse:is_warehouse,
  764. warehousing_id:warehousing_id,
  765. }
  766. ModefySupplyWarehousing(params).then(response=>{
  767. if(response.data.state == 1){
  768. var msg = response.data.data.msg
  769. }
  770. })
  771. },
  772. toClick(){
  773. //先判断采购单号有没有关联的采购退货单号,如果没有,则为首次生成采购退货单
  774. if(this.is_check == 2){
  775. this.$message.error("该采购单未审核,不能生成退货单数据!")
  776. return false
  777. }
  778. var id = this.$route.query.id
  779. getSupplyWarehouseOutById(id).then(response=>{
  780. if(response.data.state == 1){
  781. var cancelList = response.data.data.cancelList
  782. console.log("cancelList23232232323323223",cancelList)
  783. if(cancelList.length >0){
  784. }
  785. var outList = response.data.data.outList
  786. console.log("outList2332232332",outList)
  787. var cancelOrderList = response.data.data.cancelOrderList
  788. console.log("cancelOrderList2323322322332",cancelOrderList)
  789. var drugList = response.data.data.drugList
  790. console.log("drugList233223232323232",drugList)
  791. }
  792. })
  793. this.$router.push({path:"/good/return/add?id="+this.id})
  794. },
  795. //反审核
  796. MofyGoodOrder(){
  797. var id = this.$route.query.id
  798. var warehousing_id = this.$route.query.warehousing_id
  799. var params = {
  800. id:id,
  801. warehousing_id:warehousing_id,
  802. }
  803. MofyGoodOrder(params).then(response=>{
  804. if(response.data.state == 1){
  805. var msg = response.data.data.msg
  806. if(msg == 1){
  807. this.$message.success("反审核成功!")
  808. }
  809. if(msg == 2){
  810. this.$message.error("该单有自动出库或生成了退货单,反审核失败!")
  811. }
  812. var purcaseOrder = response.data.data.purcaseOrder
  813. console.log("采购订单",purcaseOrder)
  814. var goodOrder = response.data.data.goodOrder
  815. console.log("采购单",goodOrder)
  816. var drugList = response.data.data.drugList
  817. console.log("druglist23323223",drugList)
  818. var ids =""
  819. // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
  820. if(goodOrder.length == 0){
  821. this.$router.push({path:"/good/order/add?id="+id+"&ids="+ids})
  822. }
  823. for(let i=0;i<purcaseOrder.length;i++){
  824. for(let j=0;j<drugList.length;j++){
  825. if(purcaseOrder[i].is_source == 1){
  826. if(purcaseOrder[i].supply_unit == drugList[j].max_unit){
  827. purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number
  828. }
  829. }
  830. }
  831. }
  832. for(let i=0;i<goodOrder.length;i++){
  833. for(let j=0;j<drugList.length;j++){
  834. if(goodOrder[i].is_source == 1){
  835. if(goodOrder[i].supply_unit == drugList[j].max_unit){
  836. goodOrder[i].count = goodOrder[i].count * drugList[j].min_number
  837. }
  838. }
  839. }
  840. }
  841. let objInfo = {}
  842. if (goodOrder.length >0){
  843. goodOrder.forEach((item,index)=>{
  844. let { project_id } = item
  845. if(!objInfo[project_id]){
  846. objInfo[project_id] = {
  847. project_id,
  848. child:[],
  849. count:0,
  850. }
  851. }
  852. })
  853. let newArr = Object.values(objInfo);
  854. for(let i=0;i<goodOrder.length;i++){
  855. for(let j=0;j<newArr.length;j++){
  856. if(goodOrder[i].project_id == newArr[j].project_id){
  857. newArr[j].child.push(goodOrder[i])
  858. }
  859. }
  860. }
  861. console.log("newAr2332232323",newArr)
  862. for(let i=0;i<newArr.length;i++){
  863. for(let j=0;j<newArr[i].child.length;j++){
  864. newArr[i].count += newArr[i].child[j].count
  865. }
  866. }
  867. var arr = []
  868. var total = 0
  869. var str = ""
  870. //如果采购单有数据,则需要比较数量
  871. if(newArr.length > 0){
  872. for(let i=0;i<purcaseOrder.length;i++){
  873. for(let j=0;j<newArr.length;j++){
  874. if(purcaseOrder[i].project_id == newArr[j].project_id){
  875. //根据商品ID比较数量大小,如果采购单的数量大于采购订单的数据
  876. if(purcaseOrder[i].count < newArr[j].count){
  877. arr.push(purcaseOrder[i].project_id)
  878. }
  879. }
  880. }
  881. }
  882. //如果total的长度等于0,怎修改该订单的状态为全部入库
  883. if(arr.length > 0){
  884. //修改采购订单的状态为全部入库
  885. this.UpdateSupplyWahouseingInfo()
  886. }
  887. }
  888. }
  889. }
  890. })
  891. },
  892. UpdateSupplyWahouseingInfo(){
  893. var params = {
  894. warehousing_id:this.$route.query.warehousing_id,
  895. }
  896. UpdateSupplyWahouseingInfo(params).then(response =>{
  897. if(response.data.state == 1){
  898. var msg = response.data.data.msg
  899. }
  900. })
  901. }
  902. },
  903. created(){
  904. const tempObj = {}
  905. tempObj["id"] = 0
  906. tempObj["name"] = ""
  907. tempObj['supply_name'] = ""
  908. tempObj['supply_type'] = ""
  909. tempObj['supply_specification_name'] = ''
  910. tempObj['supply_total'] = ""
  911. tempObj['supply_count'] = ""
  912. tempObj['supply_price'] = ""
  913. tempObj['supply_total_price'] = ""
  914. tempObj['supply_manufacturer'] = ''
  915. tempObj['supply_license_number'] = ''
  916. tempObj['supply_remake'] = ''
  917. tempObj['type'] = 0
  918. tempObj['is_total'] = 1
  919. tempObj["project_id"] = 0
  920. tempObj["supply_unit"] = ""
  921. tempObj["supply_batch_number"] = ""
  922. tempObj["supply_product_date"] = ""
  923. tempObj["order_number"] = ""
  924. tempObj["supply_expiry_date"] = ""
  925. tempObj["manufacturer_id"] = ""
  926. tempObj["warehouse_info_id"] = ""
  927. tempObj["warehousing_id"]= ""
  928. tempObj["number"] = ""
  929. tempObj["good_number"] = ""
  930. this.recordInfo.tableList.push(tempObj)
  931. this.getInitOrder()
  932. if(parseInt(this.$route.query.id) > 0){
  933. this.getGoodOrderDetail()
  934. }
  935. this.start_time = this.getTimes(new Date())
  936. this.end_time = this.getTimes(new Date())
  937. }
  938. };
  939. </script>
  940. <style rel="stylesheet/css" lang="scss" scoped>
  941. .information {
  942. border: 1px #dcdfe6 solid;
  943. padding: 30px 20px 30px 20px;
  944. .border {
  945. border-bottom: 1px #dcdfe6 solid;
  946. margin: 0px 0 20px 0;
  947. }
  948. }
  949. .title {
  950. background: #409eff;
  951. height: 44px;
  952. line-height: 44px;
  953. padding: 0 0 0 10px;
  954. color: #fff;
  955. margin: 0 0 10px 0;
  956. }
  957. .edit_separater {
  958. border-top: 1px solid rgb(233, 233, 233);
  959. margin-top: 15px;
  960. margin-bottom: 15px;
  961. }
  962. </style>
  963. <style>
  964. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  965. font-size: 12px;
  966. }
  967. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  968. background: #6fb5fa;
  969. }
  970. .count {
  971. color: #bd2c00;
  972. }
  973. .el-table td,
  974. .el-table th.is-leaf,
  975. .el-table--border,
  976. .el-table--group {
  977. border-color: #d0d3da;
  978. }
  979. .el-table--border::after,
  980. .el-table--group::after,
  981. .el-table::before {
  982. background-color: #d0d3da;
  983. }
  984. .el-table__fixed-right{
  985. width:150px;
  986. bottom: 20px;
  987. height: 100%;
  988. }
  989. </style>