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

editSupply.vue 33KB

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