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

stockOutOrderEdit.vue 34KB

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