stockInOrderEdit.vue 31KB

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