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

stockOutOrderEdit.vue 37KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb v-if="this.$route.query.type == 1" :crumbs='crumbs'></bread-crumb>
  5. <bread-crumb v-if="this.$route.query.type == 2" :crumbs='crumbs2'></bread-crumb>
  6. <div style="float:right;">
  7. <el-button size="small" @click="back()" class="filter-item">取 消</el-button>
  8. <el-button size="small" type="primary" @click="submit()" class="filter-item" v-if="is_check == 2 && parseInt(this.$route.query.is_sys) == 0">保 存</el-button>
  9. <el-button size="small" type="primary" @click="toCheck()" v-if="is_check == 2 && parseInt(this.$route.query.is_sys) == 0" class="filter-item">审 核</el-button>
  10. <el-button size="small" type="primary" @click="toReturnCheck()" v-if="is_check == 1 && parseInt(this.$route.query.is_sys) == 0" class="filter-item">反 审 核</el-button>
  11. </div>
  12. </div>
  13. <div class="app-container">
  14. <stock-in-dialog
  15. ref="dialog"
  16. :propForm="propForm"
  17. :visibility="isVisibility"
  18. v-on:dialog-comfirm="comfirm"
  19. v-on:dialog-cancle="cancle"
  20. >
  21. </stock-in-dialog>
  22. <div class="cell clearfix">
  23. <label class="title"><span class="name"><span style="color:red">*</span>仓库</span> :</label>
  24. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" :disabled="true">
  25. <el-option
  26. v-for="(option, index) in storelist"
  27. :key="index"
  28. :label="option.storehouse_name"
  29. :value="option.id">
  30. </el-option>
  31. </el-select>
  32. <label class="title"><span class="name">出库时间</span> : </label>
  33. <el-date-picker size="small" v-model="warehouse_out_time" prefix-icon="el-icon-date" :disabled="stockShow"
  34. style="width: 200px;"
  35. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  36. value-format="yyyy-MM-dd"></el-date-picker>
  37. </div>
  38. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  39. <el-table :data="recordInfo.recordData" :class="signAndWeighBoxPatients" style="width: 100%" border
  40. max-height="450" :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  41. >
  42. <el-table-column width="200" align="center">
  43. <template slot="header" slot-scope="scope">
  44. <span>耗材名称</span>
  45. </template>
  46. <template slot-scope="scope">
  47. <el-form-item style="padding-top: 20px">
  48. <el-autocomplete
  49. class="checkSearch"
  50. popper-class="my-autocomplete"
  51. v-model="scope.row.good_name"
  52. :fetch-suggestions="querySearchAsync"
  53. :trigger-on-focus="true"
  54. placeholder="请输入耗材名称"
  55. @select="handleSelect"
  56. @input="changeGoodName(scope.$index)"
  57. style="width:150px;"
  58. :disabled="stockShow"
  59. >
  60. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  61. <template slot-scope="{ item }">
  62. <div class="name">{{item.good_name +" " +item.specification_name + " "+ item.manufacturer}}</div>
  63. </template>
  64. </el-autocomplete>
  65. </el-form-item>
  66. </template>
  67. </el-table-column>
  68. <el-table-column width="140" align="center">
  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 style="padding-top: 20px">
  74. <el-input
  75. :disabled="stockShow"
  76. placeholder="请输入商品类型"
  77. v-model="scope.row.good_type_id"
  78. :value="typeName(scope.row.good_type_id)"
  79. ></el-input>
  80. </el-form-item>
  81. </template>
  82. </el-table-column>
  83. <el-table-column width="140" align="center">
  84. <template slot="header" slot-scope="scope">
  85. <span>规格&单位<span style="color: red">*</span></span>
  86. </template>
  87. <template slot-scope="scope">
  88. <el-form-item style="padding-top: 20px">
  89. <el-input v-model="scope.row.name" :disabled="stockShow"></el-input>
  90. </el-form-item>
  91. </template>
  92. </el-table-column>
  93. <!-- <el-table-column width="140" align="center">
  94. <template slot="header" slot-scope="scope">
  95. <span>批号<span style="color: red"></span></span>
  96. </template>
  97. <template slot-scope="scope">
  98. <el-form-item style="padding-top: 20px">
  99. <el-select v-model="scope.row.number" filterable placeholder="请选择" :disabled="stockTrue" @change="changeNumberList(scope.row,scope.$index)">
  100. <el-option
  101. v-for="(item,index) in numberList"
  102. :key="index"
  103. :label="item.number"
  104. :value="item.id">
  105. </el-option>
  106. </el-select>
  107. </el-form-item>
  108. </template>
  109. </el-table-column> -->
  110. <!-- <el-table-column width="150" align="center">
  111. <template slot="header" slot-scope="scope">
  112. <span>进货价</span>
  113. </template>
  114. <template slot-scope="scope">
  115. <el-form-item
  116. :prop="'recordData.' + scope.$index + '.buy_price'"
  117. :rules="tableRules.buy_price"
  118. style="padding-top: 20px"
  119. >
  120. <el-input
  121. :disabled="true"
  122. placeholder="进货价"
  123. type="number"
  124. v-model="scope.row.buy_price"
  125. ></el-input>
  126. </el-form-item>
  127. </template>
  128. </el-table-column> -->
  129. <el-table-column width="150" align="center">
  130. <template slot="header" slot-scope="scope">
  131. <span>单价<span style="color: red">*</span></span>
  132. </template>
  133. <template slot-scope="scope">
  134. <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price'
  135. style="padding-top: 17px">
  136. <el-input type="number" v-model="scope.row.price" :disabled="stockShow"></el-input>
  137. </el-form-item>
  138. </template>
  139. </el-table-column>
  140. <el-table-column width="150" align="center">
  141. <template slot="header" slot-scope="scope">
  142. <span>剩余库存</span>
  143. </template>
  144. <template slot-scope="scope">
  145. <el-form-item
  146. :rules="tableRules.count"
  147. style="padding-top: 17px"
  148. >
  149. <el-input
  150. :disabled="true"
  151. placeholder="剩余库存"
  152. type="number"
  153. v-model="scope.row.stock_count"
  154. ></el-input>
  155. </el-form-item>
  156. </template>
  157. </el-table-column>
  158. <el-table-column width="150" align="center">
  159. <template slot="header" slot-scope="scope">
  160. <span>出库数量<span style="color: red">*</span></span>
  161. </template>
  162. <template slot-scope="scope">
  163. <el-form-item :prop="'recordData.' + scope.$index + '.count'" :rules='tableRules.count'
  164. style="padding-top: 17px">
  165. <el-input type="number" v-model="scope.row.count" :disabled="stockShow" oninput="value=value.replace(/\D|^0/g,'')" @input="getSupplyCount(scope.row.count,scope.row.stock_count,scope.$index)"></el-input>
  166. </el-form-item>
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="出库对象" width="150" align="center">
  170. <template slot-scope="scope">
  171. <el-select size="small" v-model="scope.row.admin_user_id" filterable placeholder="请选择厂商" :disabled="stockShow">
  172. <el-option
  173. v-for="(option, index) in doctorList"
  174. :key="index"
  175. :label="option.user_name"
  176. :value="option.admin_user_id">
  177. </el-option>
  178. </el-select>
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="总价" width="150" align="center">
  182. <template slot-scope="scope">
  183. {{calculate(scope.row.price*scope.row.count)}}
  184. </template>
  185. </el-table-column>
  186. <el-table-column label="生产厂商" width="150" align="center">
  187. <template slot-scope="scope">
  188. <el-select size="small" v-model="scope.row.manufacturer" filterable placeholder="请选择厂商" :disabled="stockShow">
  189. <el-option
  190. v-for="(option, index) in manufacturerList"
  191. :key="index"
  192. :label="option.manufacturer_name"
  193. :value="option.id">
  194. </el-option>
  195. </el-select>
  196. </template>
  197. </el-table-column>
  198. <el-table-column label="生产日期" width="150" align="center">
  199. <template slot-scope="scope">
  200. <el-date-picker
  201. :disabled="stockShow"
  202. prefix-icon="el-icon-date"
  203. style="width: 145px"
  204. v-model="scope.row.product_date"
  205. type="date"
  206. placeholder="选择日期时间"
  207. format="yyyy-MM-dd"
  208. value-format="yyyy-MM-dd"
  209. ></el-date-picker>
  210. </template>
  211. </el-table-column>
  212. <el-table-column label="有效期" width="150" align="center">
  213. <template slot-scope="scope">
  214. <el-date-picker
  215. :disabled="stockShow"
  216. prefix-icon="el-icon-date"
  217. style="width: 145px"
  218. v-model="scope.row.expiry_date"
  219. type="date"
  220. placeholder="选择日期时间"
  221. format="yyyy-MM-dd"
  222. value-format="yyyy-MM-dd"
  223. ></el-date-picker>
  224. </template>
  225. </el-table-column>
  226. <el-table-column width="150" align="center">
  227. <template slot="header" slot-scope="scope">
  228. <span>批准文号<span style="color: red"></span></span>
  229. </template>
  230. <template slot-scope="scope">
  231. <el-input placeholder="请输入批准文号" v-model="scope.row.license_number" :disabled="stockShow"></el-input>
  232. </template>
  233. </el-table-column>
  234. <el-table-column label="经销商" width="150" align="center">
  235. <template slot-scope="scope">
  236. <el-select size="small" v-model="scope.row.dealer" filterable placeholder="请选择厂商" :disabled="stockShow">
  237. <el-option
  238. v-for="(option, index) in dealerList"
  239. :key="index"
  240. :label="option.dealer_name"
  241. :value="option.id">
  242. </el-option>
  243. </el-select>
  244. </template>
  245. </el-table-column>
  246. <el-table-column label="备注" width="150" align="center">
  247. <template slot-scope="scope">
  248. <el-input v-model="scope.row.remark" :disabled="stockShow"></el-input>
  249. </template>
  250. </el-table-column>
  251. <el-table-column label="操作" align="center" width="150" fixed="right">
  252. <template slot-scope="scope">
  253. <el-tooltip class="item" effect="dark" content="新增" placement="top">
  254. <el-button
  255. size="mini"
  256. type="primary"
  257. icon="el-icon-circle-plus-outline"
  258. @click="handleEdit(scope.$index, scope.row)">
  259. </el-button>
  260. </el-tooltip>
  261. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  262. <el-button
  263. size="mini"
  264. type="danger"
  265. icon="el-icon-delete"
  266. @click="handleDelete(scope.$index, scope.row)">
  267. </el-button>
  268. </el-tooltip>
  269. </template>
  270. </el-table-column>
  271. </el-table>
  272. </el-form>
  273. </div>
  274. </div>
  275. </template>
  276. <script>
  277. import { uParseTime } from '@/utils/tools'
  278. import { deleteWarehouseOutInfo, editWarehouseoutInfo,GetAllConfig,GetAllGoodInfoByID,postSearchGoodList,getSingleOutOrderDetail,getStockBatchNumber,checkWarehouseOut,returnCheckWarehouseOut } from '@/api/stock'
  279. import BreadCrumb from '../components/bread-crumb'
  280. import StockInDialog from './Dialog/stockInDialog'
  281. export default {
  282. components: { StockInDialog, BreadCrumb},
  283. name: 'stockOutOrderEdit',
  284. data() {
  285. return {
  286. crumbs: [
  287. { path: false, name: '库存管理' },
  288. { path: false, name: '耗材出库单' },
  289. { path: false, name: '编辑出库单' }
  290. ],
  291. crumbs2: [
  292. { path: false, name: '库存管理' },
  293. { path: false, name: '其他出库单' },
  294. { path: false, name: '编辑出库单' }
  295. ],
  296. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  297. adminUserOptions: null,
  298. currentIndex: 0,
  299. warehouse_out_time: '',
  300. recordInfo: {
  301. recordData: [],
  302. stock_in_code: '',
  303. current_index: ''
  304. },
  305. tableRules: {
  306. count: [
  307. { required: true, message: '数量不能为空', trigge: 'blur' }
  308. ],
  309. price: [
  310. { required: true, message: '单价不能为空', trigger: 'blur' }
  311. ]
  312. },
  313. ruleForm: {
  314. manufacturer: [
  315. { required: true, message: '请选择厂商', trigger: 'change' }
  316. ]
  317. },
  318. // prop
  319. isVisibility: false,
  320. propForm: {
  321. goods:[],
  322. goodType: [],
  323. goodInfo: [],
  324. goodUnit: [],
  325. title: '入库',
  326. manufacturer: 0,
  327. dealer: 0
  328. },
  329. form: {
  330. manufacturer: 0,
  331. dealer: 0
  332. },
  333. warehouseInfoList: [],
  334. warehouseOut: {},
  335. manufacturer: [],
  336. dealer: [],
  337. goodType: [],
  338. goodInfo:[],
  339. numberList:[],
  340. stockShow:false,
  341. stockTrue:true,
  342. storelist:[],
  343. storehouse_id:"",
  344. doctorList:[],
  345. showCheck:false,
  346. showReturnCheck:false,
  347. }
  348. },
  349. methods: {
  350. comfirm: function(val) {
  351. this.$refs.dialog.hide();
  352. this.propForm.goodType = [];
  353. this.propForm.goods = [];
  354. if (val.selectedGoodInfo.length > 0) {
  355. for (let i = val.selectedGoodInfo.length - 1; ; i--) {
  356. if (i == 0) {
  357. this.recordInfo.recordData[this.currentIndex].good_type_id =
  358. val.selectedGoodInfo[i].good_type_id;
  359. this.recordInfo.recordData[this.currentIndex].good_id =
  360. val.selectedGoodInfo[i].id;
  361. this.recordInfo.recordData[
  362. this.currentIndex
  363. ].price = val.selectedGoodInfo[i].buy_price.toString();
  364. } else {
  365. const tempForm = {};
  366. tempForm["id"] = 0;
  367. tempForm["good_type_id"] = val.selectedGoodInfo[i].good_type_id;
  368. tempForm["good_id"] = val.selectedGoodInfo[i].id;
  369. tempForm["count"] = "";
  370. tempForm["price"] = val.selectedGoodInfo[i].buy_price.toString();
  371. tempForm["remark"] = "";
  372. this.recordInfo.recordData.splice(
  373. this.currentIndex + 1,
  374. 0,
  375. tempForm
  376. );
  377. }
  378. }
  379. }
  380. this.currentIndex = -1;
  381. },
  382. cancle: function() {
  383. this.$refs.dialog.hide()
  384. this.propForm.goods = [];
  385. this.propForm.goodType = [];
  386. },
  387. GetConfigInfo: function() {
  388. const loading = this.$loading({
  389. lock: true,
  390. text: "Loading",
  391. spinner: "el-icon-loading",
  392. background: "rgba(0, 0, 0, 0.7)"
  393. });
  394. GetAllConfig().then(response => {
  395. if (response.data.state == 0) {
  396. this.$message.error(response.data.msg);
  397. return false;
  398. } else {
  399. this.manufacturerList = response.data.data.manufacturer;
  400. this.dealer = response.data.data.dealer;
  401. this.goodType = response.data.data.goodType;
  402. this.goodInfo = response.data.data.goodInfo;
  403. }
  404. loading.close();
  405. });
  406. }, typeName: function(good_type_id) {
  407. let name = "";
  408. for (let i = 0; i < this.goodType.length; i++) {
  409. if (this.goodType[i].id == good_type_id) {
  410. name = this.goodType[i].type_name;
  411. }
  412. }
  413. return name;
  414. }, specificationName: function(good_info_id) {
  415. let name = "";
  416. for (let i = 0; i < this.goodInfo.length; i++) {
  417. if (this.goodInfo[i].id == good_info_id) {
  418. name = this.goodInfo[i].specification_name;
  419. }
  420. }
  421. return name;
  422. },
  423. handleEdit: function(index, row) {
  424. if(parseInt(this.$route.query.is_sys) == 12){
  425. this.$message.error("调拨出库数据不能新增!")
  426. return
  427. }
  428. if(row.supply_cancel_out_id >0){
  429. this.$message.error("采购出库数据不能新增!")
  430. return
  431. }
  432. if(this.is_check == 1){
  433. this.$message.error("已审核的数据不能新增")
  434. return
  435. }
  436. this.stockTrue = false
  437. if(this.stockShow == true){
  438. this.$message.error("自动出库数据无法编辑")
  439. return
  440. }
  441. const tempObj = {}
  442. tempObj['id'] = 0
  443. tempObj['good_type_id'] = 0
  444. tempObj['good_id'] = 0
  445. tempObj['count'] = ''
  446. tempObj['price'] = ''
  447. tempObj['remark'] = ''
  448. tempObj['number'] = ""
  449. tempObj['license_number'] = ""
  450. tempObj['dealer'] = ""
  451. tempObj['manufacturer'] = ""
  452. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
  453. tempObj["buy_price"]= ""
  454. tempObj["stock_count"] = ""
  455. this.recordInfo.recordData.push(tempObj)
  456. },
  457. handleDelete: function(index, row) {
  458. if(parseInt(this.$route.query.is_sys) == 12){
  459. this.$message.error("调拨出库数据不能删除!")
  460. return
  461. }
  462. if(row.supply_cancel_out_id >0){
  463. this.$message.error("采购出库数据不能删除!")
  464. return
  465. }
  466. if(this.is_check == 1){
  467. this.$message.error("已审核的数据不能删除!")
  468. return
  469. }
  470. if(this.stockShow == true){
  471. this.$message.error("自动出库数据无法删除")
  472. return
  473. }
  474. if (row.id == 0) {
  475. this.recordInfo.recordData.splice(index, 1)
  476. } else {
  477. const params = {
  478. id: row.id
  479. }
  480. this.$confirm('确认删除该出库耗材信息记录?', '删除出库耗材信息记录', {
  481. confirmButtonText: '确定',
  482. cancelButtonText: '取消',
  483. type: 'warning'
  484. }).then(() => {
  485. deleteWarehouseOutInfo(params).then(response => {
  486. if (response.data.state == 0) {
  487. this.$message.error(response.data.msg)
  488. return false
  489. } else {
  490. this.$message.success('删除成功')
  491. this.recordInfo.recordData.splice(index, 1)
  492. }
  493. })
  494. }).catch(() => {
  495. })
  496. }
  497. }, getTime(val, temp) {
  498. if (val != 0) {
  499. return uParseTime(val, temp)
  500. } else {
  501. return ''
  502. }
  503. },
  504. showDialog(index, row) {
  505. this.currentIndex = index;
  506. const loading = this.$loading({
  507. lock: true,
  508. text: "Loading",
  509. spinner: "el-icon-loading",
  510. background: "rgba(0, 0, 0, 0.7)"
  511. });
  512. const params = {
  513. manufacturer_id: this.form.manufacturer,
  514. dealer_id: this.form.dealer
  515. };
  516. this.propForm.goods = []
  517. GetAllGoodInfoByID(params).then(response => {
  518. if (response.data.state == 0) {
  519. this.$message.error(response.data.msg);
  520. return false;
  521. } else {
  522. if (response.data.data.goodInfo.length <= 0) {
  523. this.$message.error("该厂商或经销商没有物品信息");
  524. return;
  525. }
  526. this.$refs.dialog.show();
  527. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  528. this.propForm.goodType.push(
  529. response.data.data.goodInfo[i].type
  530. );
  531. }
  532. const obj = {};
  533. this.propForm.goodType = this.propForm.goodType.reduce(
  534. (cur, next) => {
  535. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  536. return cur;
  537. },
  538. []
  539. ); // 设置cur默认类型为数组,并且初始值为空的数组
  540. }
  541. for (let i = 0; i < this.propForm.goodType.length; i++) {
  542. let goodInfo = [];
  543. let goodObj = {};
  544. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  545. var respObj = response.data.data.goodInfo[a];
  546. respObj["isSelected"] = false;
  547. if (respObj.type.id == this.propForm.goodType[i].id) {
  548. goodInfo.push(respObj);
  549. }
  550. }
  551. const obj = {};
  552. goodInfo = goodInfo.reduce((cur, next) => {
  553. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  554. return cur;
  555. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  556. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo);
  557. this.propForm.goods.push(goodObj);
  558. }
  559. loading.close();
  560. });
  561. },
  562. back() {
  563. this.$router.go(-1)
  564. },
  565. submit() {
  566. this.$refs['tableForm'].validate((valid) => {
  567. if (valid) {
  568. const array = this.recordInfo.recordData
  569. for (let i = 0; i < array.length; i++) {
  570. if (array[i].good_type_id == 0) {
  571. this.$message.error('商品类型不能为空')
  572. return
  573. }
  574. if (array[i].good_id == 0) {
  575. this.$message.error('规格名称不能为空')
  576. return
  577. }
  578. }
  579. for(let i=0;i<this.recordInfo.recordData.length;i++){
  580. if(this.recordInfo.recordData[i].dealer == ""){
  581. this.recordInfo.recordData[i].dealer = 0
  582. }
  583. if(this.recordInfo.recordData[i].expiry_date == "" || this.recordInfo.recordData[i].expiry_date == undefined){
  584. this.recordInfo.recordData[i].expiry_date = ""
  585. }
  586. if(this.recordInfo.recordData[i].product_date == "" || this.recordInfo.recordData[i].product_date == undefined){
  587. this.recordInfo.recordData[i].product_date = ""
  588. }
  589. this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
  590. this.recordInfo.recordData[i].buy_price = this.recordInfo.recordData[i].buy_price.toString()
  591. this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
  592. for(let j=0;j<this.manufacturerList.length;j++){
  593. if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
  594. this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
  595. }
  596. }
  597. for(let z=0;z<this.dealerList.length;z++){
  598. if(this.recordInfo.recordData[i].dealer == this.dealerList[z].dealer_name){
  599. this.recordInfo.recordData[i].dealer = this.dealerList[z].id
  600. }
  601. }
  602. for(let y=0;y<this.numberList.length;y++){
  603. if(this.recordInfo.recordData[i].number == this.numberList[y].id){
  604. this.recordInfo.recordData[i].number = this.numberList[y].number
  605. }
  606. }
  607. for(let s=0;s<this.doctorList.length;s++){
  608. if(this.recordInfo.recordData[i].admin_user_id == this.doctorList[s].user_name){
  609. this.recordInfo.recordData[i].admin_user_id = this.doctorList[s].admin_user_id
  610. }
  611. }
  612. }
  613. const loading = this.$loading({
  614. lock: true,
  615. text: 'Loading',
  616. spinner: 'el-icon-loading',
  617. background: 'rgba(0, 0, 0, 0.7)'
  618. })
  619. const params = {
  620. 'warehouse_out_time':this.warehouse_out_time,
  621. 'stockOut': this.recordInfo.recordData,
  622. "warehout_id":parseInt(this.$route.query.id),
  623. "storehouse_id":parseInt(this.storehouse_id),
  624. }
  625. var warehout_id = parseInt(this.$route.query.id)
  626. editWarehouseoutInfo(params, this.warehouse_out_time, warehout_id, this.$route.query.type, this.form.manufacturer, this.form.dealer,this.storehouse_id).then(response => {
  627. if (response.data.state == 0) {
  628. this.$message.error(response.data.msg)
  629. loading.close()
  630. return false
  631. } else {
  632. if(response.data.data.msg == 1){
  633. this.$message.success('保存成功')
  634. // this.$router.back(-1)
  635. loading.close()
  636. }
  637. if(response.data.data.msg == 5){
  638. this.$message.error("该耗材无库存,请入库")
  639. }
  640. var msg = response.data.data.msg
  641. var good_name = response.data.data.good_name
  642. var specification_name = response.data.data.specification_name
  643. var str = good_name +"*" + specification_name +"无库存,请入库"
  644. if(msg == 7){
  645. this.$message.error(str)
  646. }
  647. if(response.data.data.msg == 6){
  648. this.$message.error("该耗材的出库数量大于入库数量,无法出库")
  649. }
  650. loading.close()
  651. }
  652. })
  653. } else {
  654. return false
  655. }
  656. })
  657. },
  658. calculate: function(val) {
  659. if (val == 0) {
  660. return ''
  661. }
  662. return Math.round(parseFloat(val) * 100) / 100
  663. }, changeManufacturer(val) {
  664. this.propForm.manufacturer = val
  665. }, changeDealer(val) {
  666. this.propForm.dealer = val
  667. },
  668. querySearchAsync(keyword, cb) {
  669. let key = '';
  670. if (keyword != undefined) {
  671. key = keyword
  672. }
  673. postSearchGoodList(key,this.storehouse_id).then(response => {
  674. if (response.data.state == 1) {
  675. var list = response.data.data.list
  676. this.goodList = list
  677. var manufacturerList = response.data.data.manufacturerList
  678. this.manufacturerList = manufacturerList
  679. for(let i=0;i<this.goodList.length;i++){
  680. for(let j=0;j<this.manufacturerList.length;j++){
  681. if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
  682. this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  683. }
  684. }
  685. for(let z=0;z<this.dealerList.length;z++){
  686. if(this.goodList[i].dealer == this.dealerList[z].id){
  687. this.goodList[i].dealer = this.dealerList[z].dealer_name
  688. }
  689. }
  690. }
  691. cb(this.goodList)
  692. } else {
  693. cb([])
  694. }
  695. })
  696. },
  697. changeGoodName(val){
  698. this.currentIndex = val
  699. },
  700. handleSelect(val){
  701. var arr = []
  702. for(let i=0;i<this.recordInfo.recordData.length;i++){
  703. arr.push(this.recordInfo.recordData[i].good_id)
  704. }
  705. var str = arr.join(",")
  706. if(str.indexOf(val.id)!=-1){
  707. this.$message.error("该耗材已存在列表中")
  708. return
  709. }
  710. this.getStockBatchNumber(val.id)
  711. var total_count = 0
  712. for(let i=0;i<val.xt_warehouse_info.length;i++){
  713. total_count += val.xt_warehouse_info[i].stock_count
  714. }
  715. for(let i=0;i<this.recordInfo.recordData.length;i++){
  716. if(this.currentIndex == i){
  717. this.recordInfo.recordData[i].good_type_id = val.id
  718. this.recordInfo.recordData[i].good_name = val.good_name
  719. this.recordInfo.recordData[i].good_type_id = val.good_type_id
  720. this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
  721. this.recordInfo.recordData[i].manufacturer = val.manufacturer
  722. this.recordInfo.recordData[i].remark = val.remark
  723. this.recordInfo.recordData[i].license_number = val.number
  724. this.recordInfo.recordData[i].warehouse_info_id = 0
  725. this.recordInfo.recordData[i].buy_price = val.buy_price
  726. this.recordInfo.recordData[i].stock_count = total_count
  727. if(val.packing_price == 0){
  728. this.recordInfo.recordData[i].price = ""
  729. }else{
  730. this.recordInfo.recordData[i].price = val.packing_price
  731. }
  732. this.recordInfo.recordData[i].specification_name = val.specification_name
  733. this.recordInfo.recordData[i].good_id = val.id
  734. if(val.dealer == 0){
  735. this.recordInfo.recordData[i].dealer = ""
  736. }else{
  737. this.recordInfo.recordData[i].dealer = val.dealer
  738. }
  739. }
  740. }
  741. },
  742. getSingleOutOrderDetail(order_id){
  743. const loading = this.$loading({
  744. lock: true,
  745. text: "Loading",
  746. spinner: "el-icon-loading",
  747. background: "rgba(0, 0, 0, 0.7)"
  748. });
  749. const params = {
  750. 'id': order_id
  751. }
  752. getSingleOutOrderDetail(params).then(response=>{
  753. if(response.data.state == 1){
  754. var dealerList = response.data.data.dealerList
  755. this.dealerList = dealerList
  756. var manufacturerList = response.data.data.manufacturerList
  757. this.manufacturerList = manufacturerList
  758. this.goodType = response.data.data.goodType
  759. this.doctorList = response.data.data.doctorlist
  760. for (let i = 0; i < response.data.data.list.length; i++) {
  761. response.data.data.list[i].price = response.data.data.list[i].price.toString()
  762. response.data.data.list[i].count = response.data.data.list[i].count.toString()
  763. response.data.data.list[i].good_name = response.data.data.list[i].good_name
  764. response.data.data.list[i].name = response.data.data.list[i].specification_name + "/" + response.data.data.list[i].packing_unit
  765. response.data.data.list[i].good_type_id = response.data.data.list[i].good_type_id
  766. response.data.data.list[i].expiry_date = this.getTime(response.data.data.list[i].expiry_date,"{y}-{m}-{d}")
  767. response.data.data.list[i].product_date = this.getTime(response.data.data.list[i].product_date,"{y}-{m}-{d}")
  768. response.data.data.list[i].remark = response.data.data.list[i].remark
  769. response.data.data.list[i].buy_price = response.data.data.list[i].buy_price.toString()
  770. response.data.data.list[i].stock_count = response.data.data.list[i].stock_count.toString()
  771. if(response.data.data.list[i].dealer == 0){
  772. response.data.data.list[i].dealer = ""
  773. }
  774. if(response.data.data.list[i].manufacturer ==0 ){
  775. response.data.data.list[i].manufacturer = ""
  776. }
  777. this.recordInfo.recordData.push(response.data.data.list[i])
  778. }
  779. this.storelist = response.data.data.storelist
  780. this.warehouse_out_time = this.getTime(response.data.data.out.warehouse_out_time,"{y}-{m}-{d}")
  781. this.storehouse_id = response.data.data.out.storehouse_id
  782. loading.close();
  783. }
  784. })
  785. },
  786. getStockBatchNumber(id){
  787. var params = {
  788. id:id
  789. }
  790. getStockBatchNumber(params).then(response=>{
  791. if(response.data.state == 1){
  792. var list = response.data.data.list
  793. this.numberList = list
  794. }
  795. })
  796. },
  797. changeNumberList(val,index){
  798. for(let i=0;i<this.recordInfo.recordData.length;i++){
  799. if(index == i){
  800. this.recordInfo.recordData[i].warehouse_info_id = val.number
  801. }
  802. }
  803. },
  804. getSupplyCount(count,sum_count,index){
  805. if(sum_count < count){
  806. this.$message.error("出库数量不能大于剩余库存")
  807. for(let i=0;i<this.recordInfo.recordData.length;i++){
  808. if(index == i){
  809. this.recordInfo.recordData[i].count = ""
  810. }
  811. return
  812. }
  813. }else{
  814. for(let i=0;i<this.recordInfo.recordData.length;i++){
  815. if(index == i){
  816. this.recordInfo.recordData[i].count = count
  817. }
  818. return
  819. }
  820. }
  821. },
  822. toCheck(){
  823. const loading = this.$loading({
  824. lock: true,
  825. text: "Loading",
  826. spinner: "el-icon-loading",
  827. background: "rgba(0, 0, 0, 0.7)"
  828. });
  829. var params = {
  830. id:parseInt(this.$route.query.id)
  831. }
  832. checkWarehouseOut(params).then(response=>{
  833. if(response.data.state == 1){
  834. var msg = response.data.data.msg
  835. var good_name = response.data.data.good_name
  836. var specification_name = response.data.data.specification_name
  837. var storehose_name = response.data.data.storehose_name
  838. var str = storehose_name + " " + good_name +"*" + specification_name +"库存不足,请入库"
  839. if(msg == 1){
  840. this.$message.error(str)
  841. loading.close()
  842. }
  843. if(msg == 2){
  844. this.$message.success("审核成功!")
  845. this.recordInfo.recordData = [];
  846. this.is_check = 1
  847. this.$router.back(-1);
  848. loading.close()
  849. }
  850. }else{
  851. this.$message.error("审核失败!")
  852. loading.close()
  853. }
  854. })
  855. },
  856. toReturnCheck(){
  857. const loading = this.$loading({
  858. lock: true,
  859. text: "Loading",
  860. spinner: "el-icon-loading",
  861. background: "rgba(0, 0, 0, 0.7)"
  862. });
  863. var params = {
  864. id:parseInt(this.$route.query.id),
  865. }
  866. returnCheckWarehouseOut(params).then(response=>{
  867. if(response.data.state == 1){
  868. var list = response.data.data.list
  869. this.$message.success("反审核成功")
  870. this.is_check = 2
  871. this.$router.back(-1);
  872. loading.close()
  873. }else{
  874. this.$message.error("反审核失败!")
  875. loading.close()
  876. }
  877. })
  878. }
  879. },
  880. created() {
  881. // var nowDate = new Date();
  882. // var nowYear = nowDate.getFullYear();
  883. // var nowMonth = nowDate.getMonth() + 1;
  884. // var nowDay = nowDate.getDate();
  885. // this.warehouse_out_time =
  886. // nowYear +
  887. // "-" +
  888. // (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  889. // "-" +
  890. // (nowDay < 10 ? "0" + nowDay : nowDay);
  891. this.is_check = parseInt(this.$route.query.is_check)
  892. this.propForm.goodUnit = this.$store.getters.good_unit
  893. const order_id = this.$route.query.id
  894. this.getSingleOutOrderDetail(order_id)
  895. var is_sys = this.$route.query.is_sys
  896. if(is_sys == 0){
  897. this.stockShow = false
  898. }
  899. if(is_sys == 1 || this.is_check == 1){
  900. this.stockShow = true
  901. }
  902. if(is_sys == 12){
  903. this.stockShow = true
  904. }
  905. if(parseInt(this.$route.query.supply_cancel_out_id) >0){
  906. this.stockShow = true
  907. }
  908. }
  909. }
  910. </script>
  911. <style rel="stylesheet/css" lang="scss" scoped>
  912. .information {
  913. border: 1px #dcdfe6 solid;
  914. padding: 30px 20px 30px 20px;
  915. .border {
  916. border-bottom: 1px #dcdfe6 solid;
  917. margin: 0px 0 20px 0;
  918. }
  919. }
  920. .edit_separater {
  921. border-top: 1px solid rgb(233, 233, 233);
  922. margin-top: 15px;
  923. margin-bottom: 15px;
  924. }
  925. </style>
  926. <style>
  927. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  928. font-size: 12px;
  929. }
  930. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  931. background: #6fb5fa;
  932. }
  933. </style>