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

stockOutOrderEdit.vue 39KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  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" v-loading="loading" @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 align="center" width="150">
  235. <template slot="header" slot-scope="scope">
  236. <span>注册编码</span>
  237. </template>
  238. <template slot-scope="scope">
  239. <el-form-item style="padding-top: 20px">
  240. <el-input placeholder="请输入注册编码" v-model="scope.row.register_number" ></el-input>
  241. </el-form-item>
  242. </template>
  243. </el-table-column>
  244. <el-table-column label="经销商" width="150" align="center">
  245. <template slot-scope="scope">
  246. <el-select size="small" v-model="scope.row.dealer" filterable placeholder="请选择厂商" :disabled="stockShow">
  247. <el-option
  248. v-for="(option, index) in dealerList"
  249. :key="index"
  250. :label="option.dealer_name"
  251. :value="option.id">
  252. </el-option>
  253. </el-select>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="备注" width="150" align="center">
  257. <template slot-scope="scope">
  258. <el-input v-model="scope.row.remark" :disabled="stockShow"></el-input>
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="操作" align="center" width="150" fixed="right">
  262. <template slot-scope="scope">
  263. <el-tooltip class="item" effect="dark" content="新增" placement="top">
  264. <el-button
  265. size="mini"
  266. type="primary"
  267. icon="el-icon-circle-plus-outline"
  268. @click="handleEdit(scope.$index, scope.row)">
  269. </el-button>
  270. </el-tooltip>
  271. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  272. <el-button
  273. size="mini"
  274. type="danger"
  275. icon="el-icon-delete"
  276. @click="handleDelete(scope.$index, scope.row)">
  277. </el-button>
  278. </el-tooltip>
  279. </template>
  280. </el-table-column>
  281. </el-table>
  282. </el-form>
  283. </div>
  284. </div>
  285. </template>
  286. <script>
  287. import { uParseTime } from '@/utils/tools'
  288. import { deleteWarehouseOutInfo, editWarehouseoutInfo,GetAllConfig,GetAllGoodInfoByID,postSearchGoodList,getSingleOutOrderDetail,getStockBatchNumber,checkWarehouseOut,returnCheckWarehouseOut } from '@/api/stock'
  289. import BreadCrumb from '../components/bread-crumb'
  290. import StockInDialog from './Dialog/stockInDialog'
  291. export default {
  292. components: { StockInDialog, BreadCrumb},
  293. name: 'stockOutOrderEdit',
  294. data() {
  295. return {
  296. crumbs: [
  297. { path: false, name: '库存管理' },
  298. { path: false, name: '耗材出库单' },
  299. { path: false, name: '编辑出库单' }
  300. ],
  301. crumbs2: [
  302. { path: false, name: '库存管理' },
  303. { path: false, name: '其他出库单' },
  304. { path: false, name: '编辑出库单' }
  305. ],
  306. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  307. adminUserOptions: null,
  308. currentIndex: 0,
  309. warehouse_out_time: '',
  310. recordInfo: {
  311. recordData: [],
  312. stock_in_code: '',
  313. current_index: ''
  314. },
  315. tableRules: {
  316. count: [
  317. { required: true, message: '数量不能为空', trigge: 'blur' }
  318. ],
  319. price: [
  320. { required: true, message: '单价不能为空', trigger: 'blur' }
  321. ]
  322. },
  323. ruleForm: {
  324. manufacturer: [
  325. { required: true, message: '请选择厂商', trigger: 'change' }
  326. ]
  327. },
  328. // prop
  329. isVisibility: false,
  330. propForm: {
  331. goods:[],
  332. goodType: [],
  333. goodInfo: [],
  334. goodUnit: [],
  335. title: '入库',
  336. manufacturer: 0,
  337. dealer: 0
  338. },
  339. form: {
  340. manufacturer: 0,
  341. dealer: 0
  342. },
  343. warehouseInfoList: [],
  344. warehouseOut: {},
  345. manufacturer: [],
  346. dealer: [],
  347. goodType: [],
  348. goodInfo:[],
  349. numberList:[],
  350. stockShow:false,
  351. stockTrue:true,
  352. storelist:[],
  353. storehouse_id:"",
  354. doctorList:[],
  355. showCheck:false,
  356. showReturnCheck:false,
  357. loading:false,
  358. }
  359. },
  360. methods: {
  361. comfirm: function(val) {
  362. this.$refs.dialog.hide();
  363. this.propForm.goodType = [];
  364. this.propForm.goods = [];
  365. if (val.selectedGoodInfo.length > 0) {
  366. for (let i = val.selectedGoodInfo.length - 1; ; i--) {
  367. if (i == 0) {
  368. this.recordInfo.recordData[this.currentIndex].good_type_id =
  369. val.selectedGoodInfo[i].good_type_id;
  370. this.recordInfo.recordData[this.currentIndex].good_id =
  371. val.selectedGoodInfo[i].id;
  372. this.recordInfo.recordData[
  373. this.currentIndex
  374. ].price = val.selectedGoodInfo[i].buy_price.toString();
  375. } else {
  376. const tempForm = {};
  377. tempForm["id"] = 0;
  378. tempForm["good_type_id"] = val.selectedGoodInfo[i].good_type_id;
  379. tempForm["good_id"] = val.selectedGoodInfo[i].id;
  380. tempForm["count"] = "";
  381. tempForm["price"] = val.selectedGoodInfo[i].buy_price.toString();
  382. tempForm["remark"] = "";
  383. this.recordInfo.recordData.splice(
  384. this.currentIndex + 1,
  385. 0,
  386. tempForm
  387. );
  388. }
  389. }
  390. }
  391. this.currentIndex = -1;
  392. },
  393. cancle: function() {
  394. this.$refs.dialog.hide()
  395. this.propForm.goods = [];
  396. this.propForm.goodType = [];
  397. },
  398. GetConfigInfo: function() {
  399. const loading = this.$loading({
  400. lock: true,
  401. text: "Loading",
  402. spinner: "el-icon-loading",
  403. background: "rgba(0, 0, 0, 0.7)"
  404. });
  405. GetAllConfig().then(response => {
  406. if (response.data.state == 0) {
  407. this.$message.error(response.data.msg);
  408. return false;
  409. } else {
  410. this.manufacturerList = response.data.data.manufacturer;
  411. this.dealer = response.data.data.dealer;
  412. this.goodType = response.data.data.goodType;
  413. this.goodInfo = response.data.data.goodInfo;
  414. }
  415. loading.close();
  416. });
  417. }, typeName: function(good_type_id) {
  418. let name = "";
  419. for (let i = 0; i < this.goodType.length; i++) {
  420. if (this.goodType[i].id == good_type_id) {
  421. name = this.goodType[i].type_name;
  422. }
  423. }
  424. return name;
  425. }, specificationName: function(good_info_id) {
  426. let name = "";
  427. for (let i = 0; i < this.goodInfo.length; i++) {
  428. if (this.goodInfo[i].id == good_info_id) {
  429. name = this.goodInfo[i].specification_name;
  430. }
  431. }
  432. return name;
  433. },
  434. handleEdit: function(index, row) {
  435. if(parseInt(this.$route.query.is_sys) == 5){
  436. this.$message.error("结算出库数据不能新增!")
  437. return
  438. }
  439. if(parseInt(this.$route.query.is_sys) == 12){
  440. this.$message.error("调拨出库数据不能新增!")
  441. return
  442. }
  443. if(row.supply_cancel_out_id >0){
  444. this.$message.error("采购出库数据不能新增!")
  445. return
  446. }
  447. if(this.is_check == 1){
  448. this.$message.error("已审核的数据不能新增")
  449. return
  450. }
  451. this.stockTrue = false
  452. if(this.stockShow == true){
  453. this.$message.error("自动出库数据无法编辑")
  454. return
  455. }
  456. const tempObj = {}
  457. tempObj['id'] = 0
  458. tempObj['good_type_id'] = 0
  459. tempObj['good_id'] = 0
  460. tempObj['count'] = ''
  461. tempObj['price'] = ''
  462. tempObj['remark'] = ''
  463. tempObj['number'] = ""
  464. tempObj['license_number'] = ""
  465. tempObj['dealer'] = ""
  466. tempObj['manufacturer'] = ""
  467. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
  468. tempObj["buy_price"]= ""
  469. tempObj["stock_count"] = ""
  470. tempObj['register_number'] = ''
  471. this.recordInfo.recordData.push(tempObj)
  472. },
  473. handleDelete: function(index, row) {
  474. if(parseInt(this.$route.query.is_sys) == 12){
  475. this.$message.error("调拨出库数据不能删除!")
  476. return
  477. }
  478. if(parseInt(this.$route.query.is_sys) == 5){
  479. this.$message.error("结算出库数据不能删除!")
  480. return
  481. }
  482. if(row.supply_cancel_out_id >0){
  483. this.$message.error("采购出库数据不能删除!")
  484. return
  485. }
  486. if(this.is_check == 1){
  487. this.$message.error("已审核的数据不能删除!")
  488. return
  489. }
  490. if(this.stockShow == true){
  491. this.$message.error("自动出库数据无法删除")
  492. return
  493. }
  494. if (row.id == 0) {
  495. this.recordInfo.recordData.splice(index, 1)
  496. } else {
  497. const params = {
  498. id: row.id
  499. }
  500. this.$confirm('确认删除该出库耗材信息记录?', '删除出库耗材信息记录', {
  501. confirmButtonText: '确定',
  502. cancelButtonText: '取消',
  503. type: 'warning'
  504. }).then(() => {
  505. deleteWarehouseOutInfo(params).then(response => {
  506. if (response.data.state == 0) {
  507. this.$message.error(response.data.msg)
  508. return false
  509. } else {
  510. this.$message.success('删除成功')
  511. this.recordInfo.recordData.splice(index, 1)
  512. }
  513. })
  514. }).catch(() => {
  515. })
  516. }
  517. }, getTime(val, temp) {
  518. if (val != 0) {
  519. return uParseTime(val, temp)
  520. } else {
  521. return ''
  522. }
  523. },
  524. showDialog(index, row) {
  525. this.currentIndex = index;
  526. const loading = this.$loading({
  527. lock: true,
  528. text: "Loading",
  529. spinner: "el-icon-loading",
  530. background: "rgba(0, 0, 0, 0.7)"
  531. });
  532. const params = {
  533. manufacturer_id: this.form.manufacturer,
  534. dealer_id: this.form.dealer
  535. };
  536. this.propForm.goods = []
  537. GetAllGoodInfoByID(params).then(response => {
  538. if (response.data.state == 0) {
  539. this.$message.error(response.data.msg);
  540. return false;
  541. } else {
  542. if (response.data.data.goodInfo.length <= 0) {
  543. this.$message.error("该厂商或经销商没有物品信息");
  544. return;
  545. }
  546. this.$refs.dialog.show();
  547. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  548. this.propForm.goodType.push(
  549. response.data.data.goodInfo[i].type
  550. );
  551. }
  552. const obj = {};
  553. this.propForm.goodType = this.propForm.goodType.reduce(
  554. (cur, next) => {
  555. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  556. return cur;
  557. },
  558. []
  559. ); // 设置cur默认类型为数组,并且初始值为空的数组
  560. }
  561. for (let i = 0; i < this.propForm.goodType.length; i++) {
  562. let goodInfo = [];
  563. let goodObj = {};
  564. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  565. var respObj = response.data.data.goodInfo[a];
  566. respObj["isSelected"] = false;
  567. if (respObj.type.id == this.propForm.goodType[i].id) {
  568. goodInfo.push(respObj);
  569. }
  570. }
  571. const obj = {};
  572. goodInfo = goodInfo.reduce((cur, next) => {
  573. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  574. return cur;
  575. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  576. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo);
  577. this.propForm.goods.push(goodObj);
  578. }
  579. loading.close();
  580. });
  581. },
  582. back() {
  583. this.$router.go(-1)
  584. },
  585. submit() {
  586. this.loading = true
  587. this.$refs['tableForm'].validate((valid) => {
  588. if (valid) {
  589. const array = this.recordInfo.recordData
  590. for (let i = 0; i < array.length; i++) {
  591. if (array[i].good_type_id == 0) {
  592. this.$message.error('商品类型不能为空')
  593. this.loading = false
  594. return
  595. }
  596. if (array[i].good_id == 0) {
  597. this.$message.error('规格名称不能为空')
  598. this.loading = false
  599. return
  600. }
  601. }
  602. for(let i=0;i<this.recordInfo.recordData.length;i++){
  603. if(parseInt(this.recordInfo.recordData[i].count) > parseInt(this.recordInfo.recordData[i].stock_count) ){
  604. this.$message.error(this.recordInfo.recordData[i].good_name+"/"+this.recordInfo.recordData[i].specification_name+"库存不足!")
  605. this.loading = false
  606. return
  607. }
  608. if(this.recordInfo.recordData[i].dealer == ""){
  609. this.recordInfo.recordData[i].dealer = 0
  610. }
  611. if(this.recordInfo.recordData[i].expiry_date == "" || this.recordInfo.recordData[i].expiry_date == undefined){
  612. this.recordInfo.recordData[i].expiry_date = ""
  613. }
  614. if(this.recordInfo.recordData[i].product_date == "" || this.recordInfo.recordData[i].product_date == undefined){
  615. this.recordInfo.recordData[i].product_date = ""
  616. }
  617. this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
  618. this.recordInfo.recordData[i].buy_price = this.recordInfo.recordData[i].buy_price.toString()
  619. this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
  620. for(let j=0;j<this.manufacturerList.length;j++){
  621. if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
  622. this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
  623. }
  624. }
  625. for(let z=0;z<this.dealerList.length;z++){
  626. if(this.recordInfo.recordData[i].dealer == this.dealerList[z].dealer_name){
  627. this.recordInfo.recordData[i].dealer = this.dealerList[z].id
  628. }
  629. }
  630. for(let y=0;y<this.numberList.length;y++){
  631. if(this.recordInfo.recordData[i].number == this.numberList[y].id){
  632. this.recordInfo.recordData[i].number = this.numberList[y].number
  633. }
  634. }
  635. for(let s=0;s<this.doctorList.length;s++){
  636. if(this.recordInfo.recordData[i].admin_user_id == this.doctorList[s].user_name){
  637. this.recordInfo.recordData[i].admin_user_id = this.doctorList[s].admin_user_id
  638. }
  639. }
  640. }
  641. const loading = this.$loading({
  642. lock: true,
  643. text: 'Loading',
  644. spinner: 'el-icon-loading',
  645. background: 'rgba(0, 0, 0, 0.7)'
  646. })
  647. const params = {
  648. 'warehouse_out_time':this.warehouse_out_time,
  649. 'stockOut': this.recordInfo.recordData,
  650. "warehout_id":parseInt(this.$route.query.id),
  651. "storehouse_id":parseInt(this.storehouse_id),
  652. }
  653. var warehout_id = parseInt(this.$route.query.id)
  654. editWarehouseoutInfo(params, this.warehouse_out_time, warehout_id, this.$route.query.type, this.form.manufacturer, this.form.dealer,this.storehouse_id).then(response => {
  655. if (response.data.state == 0) {
  656. this.$message.error(response.data.msg)
  657. loading.close()
  658. return false
  659. } else {
  660. this.loading = false
  661. if(response.data.data.msg == 1){
  662. this.$message.success('保存成功')
  663. // this.$router.back(-1)
  664. loading.close()
  665. const order_id = this.$route.query.id
  666. this.getSingleOutOrderDetail(order_id)
  667. }
  668. if(response.data.data.msg == 5){
  669. this.$message.error("该耗材无库存,请入库")
  670. }
  671. var msg = response.data.data.msg
  672. var good_name = response.data.data.good_name
  673. var specification_name = response.data.data.specification_name
  674. var str = good_name +"*" + specification_name +"无库存,请入库"
  675. if(msg == 7){
  676. this.$message.error(str)
  677. }
  678. if(response.data.data.msg == 6){
  679. this.$message.error("该耗材的出库数量大于入库数量,无法出库")
  680. }
  681. loading.close()
  682. }
  683. })
  684. } else {
  685. return false
  686. }
  687. })
  688. },
  689. calculate: function(val) {
  690. if (val == 0) {
  691. return ''
  692. }
  693. return Math.round(parseFloat(val) * 100) / 100
  694. }, changeManufacturer(val) {
  695. this.propForm.manufacturer = val
  696. }, changeDealer(val) {
  697. this.propForm.dealer = val
  698. },
  699. querySearchAsync(keyword, cb) {
  700. let key = '';
  701. if (keyword != undefined) {
  702. key = keyword
  703. }
  704. postSearchGoodList(key,this.storehouse_id).then(response => {
  705. if (response.data.state == 1) {
  706. var list = response.data.data.list
  707. this.goodList = list
  708. var manufacturerList = response.data.data.manufacturerList
  709. this.manufacturerList = manufacturerList
  710. for(let i=0;i<this.goodList.length;i++){
  711. for(let j=0;j<this.manufacturerList.length;j++){
  712. if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
  713. this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  714. }
  715. }
  716. for(let z=0;z<this.dealerList.length;z++){
  717. if(this.goodList[i].dealer == this.dealerList[z].id){
  718. this.goodList[i].dealer = this.dealerList[z].dealer_name
  719. }
  720. }
  721. }
  722. cb(this.goodList)
  723. } else {
  724. cb([])
  725. }
  726. })
  727. },
  728. changeGoodName(val){
  729. this.currentIndex = val
  730. },
  731. handleSelect(val){
  732. var arr = []
  733. for(let i=0;i<this.recordInfo.recordData.length;i++){
  734. arr.push(this.recordInfo.recordData[i].good_id)
  735. }
  736. var str = arr.join(",")
  737. if(str.indexOf(val.id)!=-1){
  738. this.$message.error("该耗材已存在列表中")
  739. return
  740. }
  741. this.getStockBatchNumber(val.id)
  742. var total_count = 0
  743. for(let i=0;i<val.xt_warehouse_info.length;i++){
  744. total_count += val.xt_warehouse_info[i].stock_count
  745. }
  746. for(let i=0;i<this.recordInfo.recordData.length;i++){
  747. if(this.currentIndex == i){
  748. this.recordInfo.recordData[i].good_type_id = val.id
  749. this.recordInfo.recordData[i].good_name = val.good_name
  750. this.recordInfo.recordData[i].good_type_id = val.good_type_id
  751. this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
  752. this.recordInfo.recordData[i].manufacturer = val.manufacturer
  753. this.recordInfo.recordData[i].remark = val.remark
  754. this.recordInfo.recordData[i].license_number = val.number
  755. this.recordInfo.recordData[i].warehouse_info_id = 0
  756. this.recordInfo.recordData[i].buy_price = val.buy_price
  757. this.recordInfo.recordData[i].stock_count = total_count
  758. if( val.first_xt_warehouse_info!=null&&val.first_xt_warehouse_info.expiry_date >0){
  759. this.recordInfo.recordData[i].expiry_date = this.getTime(val.first_xt_warehouse_info.expiry_date)
  760. }else{
  761. this.recordInfo.recordData[i].expiry_date = ""
  762. }
  763. if( val.first_xt_warehouse_info!=null&&val.first_xt_warehouse_info.product_date >0){
  764. this.recordInfo.recordData[i].product_date = this.getTime(val.first_xt_warehouse_info.product_date)
  765. }else{
  766. this.recordInfo.recordData[i].product_date = ""
  767. }
  768. if(val.packing_price == 0){
  769. this.recordInfo.recordData[i].price = "0"
  770. }else{
  771. this.recordInfo.recordData[i].price = val.packing_price
  772. }
  773. this.recordInfo.recordData[i].specification_name = val.specification_name
  774. this.recordInfo.recordData[i].good_id = val.id
  775. if(val.dealer == 0){
  776. this.recordInfo.recordData[i].dealer = ""
  777. }else{
  778. this.recordInfo.recordData[i].dealer = val.dealer
  779. }
  780. }
  781. }
  782. },
  783. getSingleOutOrderDetail(order_id){
  784. this.recordInfo.recordData = []
  785. const loading = this.$loading({
  786. lock: true,
  787. text: "Loading",
  788. spinner: "el-icon-loading",
  789. background: "rgba(0, 0, 0, 0.7)"
  790. });
  791. const params = {
  792. 'id': order_id
  793. }
  794. getSingleOutOrderDetail(params).then(response=>{
  795. if(response.data.state == 1){
  796. var dealerList = response.data.data.dealerList
  797. this.dealerList = dealerList
  798. var manufacturerList = response.data.data.manufacturerList
  799. this.manufacturerList = manufacturerList
  800. this.goodType = response.data.data.goodType
  801. this.doctorList = response.data.data.doctorlist
  802. for (let i = 0; i < response.data.data.list.length; i++) {
  803. response.data.data.list[i].price = response.data.data.list[i].price.toString()
  804. response.data.data.list[i].count = response.data.data.list[i].count.toString()
  805. response.data.data.list[i].good_name = response.data.data.list[i].good_name
  806. response.data.data.list[i].name = response.data.data.list[i].specification_name + "/" + response.data.data.list[i].packing_unit
  807. response.data.data.list[i].good_type_id = response.data.data.list[i].good_type_id
  808. response.data.data.list[i].expiry_date = this.getTime(response.data.data.list[i].expiry_date,"{y}-{m}-{d}")
  809. response.data.data.list[i].product_date = this.getTime(response.data.data.list[i].product_date,"{y}-{m}-{d}")
  810. response.data.data.list[i].remark = response.data.data.list[i].remark
  811. response.data.data.list[i].buy_price = response.data.data.list[i].buy_price.toString()
  812. response.data.data.list[i].stock_count = response.data.data.list[i].stock_count.toString()
  813. if(response.data.data.list[i].dealer == 0){
  814. response.data.data.list[i].dealer = ""
  815. }
  816. if(response.data.data.list[i].manufacturer ==0 ){
  817. response.data.data.list[i].manufacturer = ""
  818. }
  819. this.recordInfo.recordData.push(response.data.data.list[i])
  820. }
  821. this.storelist = response.data.data.storelist
  822. this.warehouse_out_time = this.getTime(response.data.data.out.warehouse_out_time,"{y}-{m}-{d}")
  823. this.storehouse_id = response.data.data.out.storehouse_id
  824. loading.close();
  825. }
  826. })
  827. },
  828. getStockBatchNumber(id){
  829. var params = {
  830. id:id
  831. }
  832. getStockBatchNumber(params).then(response=>{
  833. if(response.data.state == 1){
  834. var list = response.data.data.list
  835. this.numberList = list
  836. }
  837. })
  838. },
  839. changeNumberList(val,index){
  840. for(let i=0;i<this.recordInfo.recordData.length;i++){
  841. if(index == i){
  842. this.recordInfo.recordData[i].warehouse_info_id = val.number
  843. }
  844. }
  845. },
  846. getSupplyCount(count,sum_count,index){
  847. if(sum_count < count){
  848. this.$message.error("出库数量不能大于剩余库存")
  849. for(let i=0;i<this.recordInfo.recordData.length;i++){
  850. if(index == i){
  851. this.recordInfo.recordData[i].count = ""
  852. }
  853. return
  854. }
  855. }else{
  856. for(let i=0;i<this.recordInfo.recordData.length;i++){
  857. if(index == i){
  858. this.recordInfo.recordData[i].count = count
  859. }
  860. return
  861. }
  862. }
  863. },
  864. toCheck(){
  865. const loading = this.$loading({
  866. lock: true,
  867. text: "Loading",
  868. spinner: "el-icon-loading",
  869. background: "rgba(0, 0, 0, 0.7)"
  870. });
  871. var params = {
  872. id:parseInt(this.$route.query.id)
  873. }
  874. checkWarehouseOut(params).then(response=>{
  875. if(response.data.state == 1){
  876. var msg = response.data.data.msg
  877. var good_name = response.data.data.good_name
  878. var specification_name = response.data.data.specification_name
  879. var storehose_name = response.data.data.storehose_name
  880. var str = storehose_name + " " + good_name +"*" + specification_name +"库存不足,请入库"
  881. if(msg == 1){
  882. this.$message.error(str)
  883. loading.close()
  884. }
  885. if(msg == 2){
  886. this.$message.success("审核成功!")
  887. this.recordInfo.recordData = [];
  888. this.is_check = 1
  889. this.$router.back(-1);
  890. loading.close()
  891. }
  892. }else{
  893. this.$message.error("审核失败!")
  894. loading.close()
  895. }
  896. })
  897. },
  898. toReturnCheck(){
  899. const loading = this.$loading({
  900. lock: true,
  901. text: "Loading",
  902. spinner: "el-icon-loading",
  903. background: "rgba(0, 0, 0, 0.7)"
  904. });
  905. var params = {
  906. id:parseInt(this.$route.query.id),
  907. }
  908. returnCheckWarehouseOut(params).then(response=>{
  909. if(response.data.state == 1){
  910. var list = response.data.data.list
  911. this.$message.success("反审核成功")
  912. this.is_check = 2
  913. this.$router.back(-1);
  914. loading.close()
  915. }else{
  916. this.$message.error("反审核失败!")
  917. loading.close()
  918. }
  919. })
  920. }
  921. },
  922. created() {
  923. // var nowDate = new Date();
  924. // var nowYear = nowDate.getFullYear();
  925. // var nowMonth = nowDate.getMonth() + 1;
  926. // var nowDay = nowDate.getDate();
  927. // this.warehouse_out_time =
  928. // nowYear +
  929. // "-" +
  930. // (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  931. // "-" +
  932. // (nowDay < 10 ? "0" + nowDay : nowDay);
  933. this.is_check = parseInt(this.$route.query.is_check)
  934. this.propForm.goodUnit = this.$store.getters.good_unit
  935. const order_id = this.$route.query.id
  936. this.getSingleOutOrderDetail(order_id)
  937. var is_sys = this.$route.query.is_sys
  938. if(is_sys == 0){
  939. this.stockShow = false
  940. }
  941. if(is_sys == 1 || this.is_check == 1){
  942. this.stockShow = true
  943. }
  944. if(is_sys == 12){
  945. this.stockShow = true
  946. }
  947. if(parseInt(this.$route.query.supply_cancel_out_id) >0){
  948. this.stockShow = true
  949. }
  950. }
  951. }
  952. </script>
  953. <style rel="stylesheet/css" lang="scss" scoped>
  954. .information {
  955. border: 1px #dcdfe6 solid;
  956. padding: 30px 20px 30px 20px;
  957. .border {
  958. border-bottom: 1px #dcdfe6 solid;
  959. margin: 0px 0 20px 0;
  960. }
  961. }
  962. .edit_separater {
  963. border-top: 1px solid rgb(233, 233, 233);
  964. margin-top: 15px;
  965. margin-bottom: 15px;
  966. }
  967. </style>
  968. <style>
  969. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  970. font-size: 12px;
  971. }
  972. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  973. background: #6fb5fa;
  974. }
  975. .el-autocomplete-suggestion{
  976. width: 400px !important;
  977. }
  978. </style>