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

stockInOrderEdit.vue 35KB

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