stockInOrderEdit.vue 42KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250
  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="100">
  159. <template slot="header" slot-scope="scope">
  160. <span>拆零次数</span>
  161. </template>
  162. <template slot-scope="scope">
  163. <el-form-item
  164. style="padding-top: 10px"
  165. >
  166. <div style="display: flex">
  167. <el-input
  168. type="number"
  169. placeholder="请输入入库数量"
  170. v-model="scope.row.split_of_number"
  171. style="width: 100px"
  172. ></el-input>
  173. </div>
  174. </el-form-item>
  175. </template>
  176. </el-table-column>
  177. <el-table-column align="center" width="120">
  178. <template slot="header" slot-scope="scope">
  179. <span>进货价<span style="color: red">*</span></span>
  180. </template>
  181. <template slot-scope="scope">
  182. <!--<el-input type="number" v-model="scope.row.price" @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
  183. <el-form-item
  184. :prop="'recordData.' + scope.$index + '.price'"
  185. :rules="tableRules.price"
  186. style="padding-top: 20px"
  187. >
  188. <el-input
  189. :disabled ="disabled"
  190. placeholder="请输入单价"
  191. type="number"
  192. v-model="scope.row.price"
  193. ></el-input>
  194. </el-form-item>
  195. </template>
  196. </el-table-column>
  197. <el-table-column align="center" width="120">
  198. <template slot="header" slot-scope="scope">
  199. <span>入库数量<span style="color: red">*</span></span>
  200. </template>
  201. <template slot-scope="scope">
  202. <el-form-item
  203. :prop="'recordData.' + scope.$index + '.warehousing_count'"
  204. :rules="tableRules.warehousing_count"
  205. style="padding-top: 20px"
  206. >
  207. <!-- <el-input
  208. oninput="value=value.replace(/\D|^0/g,'')"
  209. placeholder="请输入入库数量"
  210. type="number"
  211. v-model="scope.row.warehousing_count"
  212. :disabled ="disabled"
  213. ></el-input> -->
  214. <el-input
  215. placeholder="请输入入库数量"
  216. v-model="scope.row.warehousing_count"
  217. :disabled ="disabled"
  218. ></el-input>
  219. {{scope.row.min_unit}}
  220. </el-form-item>
  221. </template>
  222. </el-table-column>
  223. <el-table-column label="总价" align="center" width="80">
  224. <template slot-scope="scope">
  225. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  226. </template>
  227. </el-table-column>
  228. <el-table-column align="center" width="180">
  229. <template slot="header" slot-scope="scope">
  230. <span>有效日期<span style="color: red">*</span></span>
  231. </template>
  232. <template slot-scope="scope">
  233. <el-form-item :prop="'recordData.' + scope.$index + '.expiry_date'"
  234. :rules="tableRules.expiry_date">
  235. <el-date-picker prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.expiry_date"
  236. type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
  237. value-format="yyyy-MM-dd" :disabled ="disabled">
  238. </el-date-picker>
  239. </el-form-item>
  240. </template>
  241. </el-table-column>
  242. <el-table-column label="生产日期" width="180" align="center">
  243. <template slot-scope="scope">
  244. <el-date-picker
  245. prefix-icon="el-icon-date"
  246. style="width: 145px"
  247. v-model="scope.row.product_date"
  248. type="date"
  249. placeholder="选择日期时间"
  250. format="yyyy-MM-dd"
  251. value-format="yyyy-MM-dd"
  252. :disabled ="disabled"
  253. ></el-date-picker>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="生产厂家" align="center" width="150">
  257. <template slot-scope="scope">
  258. <el-select size="small" v-model="scope.row.manufacturer" filterable placeholder="请选择厂商" :disabled ="disabled">
  259. <el-option
  260. v-for="(option, index) in manufacturerList"
  261. :key="index"
  262. :label="option.manufacturer_name"
  263. :value="option.id">
  264. </el-option>
  265. </el-select>
  266. </template>
  267. </el-table-column>
  268. <el-table-column align="center" width="150">
  269. <template slot="header" slot-scope="scope">
  270. <span>批准文号</span>
  271. </template>
  272. <template slot-scope="scope">
  273. <el-form-item style="padding-top: 20px">
  274. <el-input
  275. placeholder="请输入批准文号"
  276. v-model="scope.row.license_number"
  277. :disabled ="disabled"
  278. ></el-input>
  279. </el-form-item>
  280. </template>
  281. </el-table-column>
  282. <el-table-column align="center" width="150">
  283. <template slot="header" slot-scope="scope">
  284. <span>注册编码</span>
  285. </template>
  286. <template slot-scope="scope">
  287. <el-form-item style="padding-top: 20px">
  288. <el-input placeholder="请输入注册编码" v-model="scope.row.register_number" ></el-input>
  289. </el-form-item>
  290. </template>
  291. </el-table-column>
  292. <el-table-column label="经销商" align="center" width="150">
  293. <template slot-scope="scope">
  294. <el-select size="small" v-model="scope.row.dealer" filterable placeholder="请选择厂商">
  295. <el-option
  296. v-for="(option, index) in dealerList"
  297. :key="index"
  298. :label="option.dealer_name"
  299. :value="option.id"
  300. :disabled ="disabled">
  301. </el-option>
  302. </el-select>
  303. </template>
  304. </el-table-column>
  305. <el-table-column label="耗材追溯码" align="center" width="150">
  306. <template slot-scope="scope">
  307. <div @click="changeGoodCode(scope.row,scope.$index)">
  308. <el-input v-model="scope.row.good_code" placeholder="请输入耗材追溯码"></el-input>
  309. </div>
  310. </template>
  311. </el-table-column>
  312. <el-table-column label="追溯码数量" align="center" width="150">
  313. <template slot-scope="scope">
  314. {{ getGoodCode(scope.row.good_code) }}
  315. </template>
  316. </el-table-column>
  317. <el-table-column label="备注" width="150" align="center">
  318. <template slot-scope="scope">
  319. <el-input v-model="scope.row.remark" :disabled ="disabled"></el-input>
  320. </template>
  321. </el-table-column>
  322. <el-table-column
  323. label="操作"
  324. fixed="right"
  325. align="center"
  326. width="150"
  327. >
  328. <template slot-scope="scope">
  329. <el-tooltip
  330. class="item"
  331. effect="dark"
  332. content="新增"
  333. placement="top"
  334. >
  335. <el-button
  336. size="mini"
  337. type="primary"
  338. icon="el-icon-circle-plus-outline"
  339. @click="handleEdit(scope.$index, scope.row)"
  340. >
  341. </el-button>
  342. </el-tooltip>
  343. <el-tooltip
  344. class="item"
  345. effect="dark"
  346. content="删除"
  347. placement="top"
  348. >
  349. <el-button
  350. size="mini"
  351. type="danger"
  352. icon="el-icon-delete"
  353. @click="handleDelete(scope.$index, scope.row)"
  354. >
  355. </el-button>
  356. </el-tooltip>
  357. </template>
  358. </el-table-column>
  359. </el-table>
  360. <div style="margin-top: 20px;">合计金额: {{getTotalPirce() }} </div>
  361. </el-form>
  362. </div>
  363. <el-dialog
  364. title="耗材追溯码"
  365. :visible.sync="dialogVisible"
  366. width="40%">
  367. <div style="margin-bottom: 10px;">
  368. <span >追溯码个数:{{getTotal() }} 个</span>
  369. </div>
  370. <span>
  371. <el-input
  372. @keyup.native="changeText"
  373. type="textarea"
  374. placeholder="请输入内容"
  375. v-model="textarea"
  376. :rows="10"
  377. >
  378. </el-input>
  379. </span>
  380. <span slot="footer" class="dialog-footer">
  381. <el-button @click="dialogVisible = false">取 消</el-button>
  382. <el-button type="primary" @click="saveTextArea()">确 定</el-button>
  383. </span>
  384. </el-dialog>
  385. </div>
  386. </template>
  387. <script>
  388. import stockInDialog from "./Dialog/stockInDialog";
  389. import { uParseTime } from "@/utils/tools";
  390. import {
  391. GetAllConfig,
  392. getWarehouseInfoList,
  393. GetAllGoodInfoByID,
  394. DeleteWarehouseInfoItem,
  395. EditWarehouse,
  396. postSearchGoodList,
  397. toCheckWarehouseInfo,
  398. toReturnCheckWarehouseInfo
  399. } from "@/api/stock";
  400. import BreadCrumb from "../components/bread-crumb";
  401. export default {
  402. components: { BreadCrumb, stockInDialog },
  403. name: "stockIn",
  404. data() {
  405. var checkGoodId = (rule, value, callback) => {
  406. setTimeout(() => {
  407. if (value == "" || value == 0) {
  408. return callback(new Error("规格名称不能为空"));
  409. }
  410. }, 2000);
  411. };
  412. return {
  413. crumbs: [
  414. { path: false, name: "库存管理" },
  415. { path: false, name: "耗材入库单" },
  416. { path: false, name: "编辑入库单" }
  417. ],
  418. crumbs2: [
  419. { path: false, name: "库存管理" },
  420. { path: false, name: "其他入库单" },
  421. { path: false, name: "编辑入库单" }
  422. ],
  423. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  424. warehousing_time: "",
  425. adminUserOptions: null,
  426. currentIndex: 0,
  427. recordInfo: {
  428. recordData: [],
  429. stock_in_code: "",
  430. current_index: ""
  431. },
  432. tableRules: {
  433. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  434. packing_price: [
  435. { required: true, message: '零售价不能为空', trigger: 'blur' }
  436. ],
  437. warehousing_count: [
  438. { required: true, message: "数量不能为空", trigger: "blur" }
  439. ],
  440. good_id: [{ validator: checkGoodId, trigger: "blur" }],
  441. expiry_date:[
  442. { required: true, message: '有效日期不能为空', trigge: 'blur' }
  443. ],
  444. number:[
  445. { required: true, message: '批号不能为空', trigge: 'blur' }
  446. ],
  447. },
  448. total: "",
  449. product_date: "",
  450. expiry_date: "",
  451. numbers: "",
  452. // prop
  453. isVisibility: false,
  454. propForm: {
  455. goods: [],
  456. goodType: [],
  457. goodInfo: [],
  458. goodUnit: [],
  459. title: "入库",
  460. isCreated: 1
  461. },
  462. form: {
  463. manufacturer: "",
  464. dealer: ""
  465. },
  466. warehouse: {},
  467. manufacturer: [],
  468. dealerList: [],
  469. goodType: [],
  470. manufacturerList:[],
  471. numberList:[],
  472. loading:false,
  473. disabled:false,
  474. storehouse_id:0,
  475. list:[],
  476. is_check:0,
  477. order_id:0,
  478. org_id:0,
  479. dialogVisible:false,
  480. currentRow:{},
  481. currentIndex:0,
  482. textarea:""
  483. };
  484. },
  485. methods: {
  486. changeText(event){
  487. const halfWidth = this.textarea.replace(/[\uff01-\uff5e]/g, ch =>
  488. String.fromCharCode(ch.charCodeAt(0) - 0xfee0)
  489. );
  490. // 2. 移除中文空格(全角空格转半角)
  491. const normalizedSpace = halfWidth.replace(/\u3000/g, ' ');
  492. var textAreaList = normalizedSpace.split(",")
  493. if (event.key === 'Enter') {
  494. var textarea = ""
  495. textarea += normalizedSpace.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
  496. var parts = textarea.split(',')
  497. for(let i=0;i<textAreaList.length;i++){
  498. if(parts[parts.length-2] == textAreaList[i]){
  499. this.$message.error("该条码已经存在,不能重复扫码")
  500. }
  501. }
  502. const uniqueStr = [...new Set(textarea.split(','))].join(',');
  503. this.textarea = uniqueStr
  504. }
  505. // var textAreaList = this.textarea.split(",")
  506. // if (event.key === 'Enter') {
  507. // var textarea = ""
  508. // textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
  509. // var parts = textarea.split(',')
  510. // for(let i=0;i<textAreaList.length;i++){
  511. // if(parts[parts.length-2] == textAreaList[i]){
  512. // this.$message.error("该条码已经存在,不能重复扫码")
  513. // }
  514. // }
  515. // const uniqueStr = [...new Set(textarea.split(','))].join(',');
  516. // this.textarea = uniqueStr
  517. // }
  518. },
  519. getGoodCode(val){
  520. var newArr = []
  521. var total = 0
  522. if(val!=undefined){
  523. newArr = val.split(",")
  524. total = newArr.length - 1
  525. if(total >0){
  526. return total
  527. }else{
  528. return ""
  529. }
  530. }
  531. },
  532. getTotal(){
  533. if(this.textarea!=null){
  534. var textAreaList = this.textarea.split(",")
  535. var arr = []
  536. if(textAreaList!=null && textAreaList.length>0){
  537. for(let i=0;i<textAreaList.length;i++){
  538. if(textAreaList[i]!=""){
  539. arr.push(textAreaList[i])
  540. }
  541. }
  542. return arr.length
  543. }else{
  544. return ""
  545. }
  546. }
  547. },
  548. comfirm: function(val) {
  549. this.$refs.dialog.hide();
  550. this.propForm.goodType = [];
  551. this.propForm.goods = [];
  552. if (val.selectedGoodInfo.length > 0) {
  553. for (let i = val.selectedGoodInfo.length - 1; ; i--) {
  554. if (i == 0) {
  555. this.recordInfo.recordData[this.currentIndex].good_type_id =
  556. val.selectedGoodInfo[i].good_type_id;
  557. this.recordInfo.recordData[this.currentIndex].good_id =
  558. val.selectedGoodInfo[i].id;
  559. this.recordInfo.recordData[
  560. this.currentIndex
  561. ].price = val.selectedGoodInfo[i].buy_price.toString();
  562. } else {
  563. const tempForm = {};
  564. tempForm["id"] = 0;
  565. tempForm["good_type_id"] = val.selectedGoodInfo[i].good_type_id;
  566. tempForm["good_id"] = val.selectedGoodInfo[i].id;
  567. tempForm["number"] = "";
  568. tempForm["product_date"] = "";
  569. tempForm["expiry_date"] = "";
  570. tempForm["warehousing_count"] = "";
  571. tempForm["price"] = val.selectedGoodInfo[i].buy_price.toString();
  572. tempForm["remark"] = "";
  573. tempForm["dealer"] = "";
  574. tempForm["manufacturer"] = "";
  575. tempForm["good_code"] = ""
  576. this.recordInfo.recordData.splice(
  577. this.currentIndex + 1,
  578. 0,
  579. tempForm
  580. );
  581. }
  582. }
  583. }
  584. this.currentIndex = -1;
  585. },
  586. cancle: function() {
  587. this.$refs.dialog.hide();
  588. this.propForm.goods = [];
  589. this.propForm.goodType = [];
  590. },
  591. GetConfigInfo: function() {
  592. const loading = this.$loading({
  593. lock: true,
  594. text: "Loading",
  595. spinner: "el-icon-loading",
  596. background: "rgba(0, 0, 0, 0.7)"
  597. });
  598. GetAllConfig().then(response => {
  599. if (response.data.state == 0) {
  600. this.$message.error(response.data.msg);
  601. return false;
  602. } else {
  603. this.manufacturer = response.data.data.manufacturer;
  604. this.manufacturerList = response.data.data.manufacturer
  605. this.dealerList = response.data.data.dealer
  606. this.dealer = response.data.data.dealer;
  607. this.goodType = response.data.data.goodType;
  608. this.goodInfo = response.data.data.goodInfo;
  609. this.list = response.data.data.list
  610. // this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: "全部" });
  611. // this.dealer.splice(0, 0, { id: 0, dealer_name: "全部" });
  612. }
  613. loading.close();
  614. });
  615. },
  616. typeName: function(good_type_id) {
  617. let name = "";
  618. for (let i = 0; i < this.goodType.length; i++) {
  619. if (this.goodType[i].id == good_type_id) {
  620. name = this.goodType[i].type_name;
  621. }
  622. }
  623. return name;
  624. },
  625. specificationName: function(good_info_id) {
  626. let name = "";
  627. for (let i = 0; i < this.goodInfo.length; i++) {
  628. if (this.goodInfo[i].id == good_info_id) {
  629. name = this.goodInfo[i].specification_name;
  630. }
  631. }
  632. return name;
  633. },
  634. handleEdit: function(index, row) {
  635. if(row.supply_warehouse_id > 0){
  636. this.$message.error("采购入库数据不能新增!")
  637. return false
  638. }
  639. if(parseInt(this.$route.query.is_sys) >0){
  640. this.$message.error("调拨入库数据不能新增!")
  641. return false
  642. }
  643. if(parseInt(this.$route.query.is_check) == 1){
  644. this.$message.error("已审核的单据不能新增!")
  645. return false
  646. }
  647. const tempObj = {};
  648. tempObj["id"] = 0;
  649. tempObj["good_type_id"] = 0;
  650. tempObj["good_id"] = 0;
  651. tempObj["number"] = "";
  652. tempObj["product_date"] = "";
  653. tempObj["expiry_date"] = "";
  654. tempObj["warehousing_count"] = "";
  655. tempObj["price"] = "";
  656. tempObj["remark"] = "";
  657. tempObj["dealer"] = "";
  658. tempObj["manufacturer"] = "";
  659. tempObj["license_number"] = ""
  660. tempObj["packing_price"] = ""
  661. tempObj["good_code"] = ""
  662. tempObj['split_of_number'] = 24
  663. this.recordInfo.recordData.push(tempObj);
  664. },
  665. handleDelete: function(index, row) {
  666. if(parseInt(this.$route.query.is_sys) >0){
  667. this.$message.error("调拨入库数据不能删除!")
  668. return false
  669. }
  670. if(row.supply_warehouse_id >0){
  671. this.$message.error("采购入库数据不能删除!")
  672. return false
  673. }
  674. if(parseInt(this.$route.query.is_check) == 1){
  675. this.$message.error("已审核的单据不能删除!")
  676. return false
  677. }
  678. if (row.id == 0) {
  679. this.recordInfo.recordData.splice(index, 1);
  680. } else {
  681. const params = {
  682. id: row.id
  683. };
  684. this.$confirm("确认删除该入库商品信息记录?", "删除入库商品信息记录", {
  685. confirmButtonText: "确定",
  686. cancelButtonText: "取消",
  687. type: "warning"
  688. })
  689. .then(() => {
  690. DeleteWarehouseInfoItem(params).then(response => {
  691. if (response.data.state == 0) {
  692. this.$message.error(response.data.msg);
  693. return false;
  694. } else {
  695. this.$message.success("删除成功");
  696. this.recordInfo.recordData.splice(index, 1);
  697. }
  698. });
  699. })
  700. .catch(() => {});
  701. }
  702. },
  703. calculate: function(val) {
  704. if (val == 0) {
  705. return "";
  706. }
  707. return Math.round(parseFloat(val) * 100) / 100;
  708. },
  709. getTime(val, temp) {
  710. if (val != 0) {
  711. return uParseTime(val, temp);
  712. } else {
  713. return "";
  714. }
  715. },
  716. showDialog(index, row) {
  717. this.currentIndex = index;
  718. const loading = this.$loading({
  719. lock: true,
  720. text: "Loading",
  721. spinner: "el-icon-loading",
  722. background: "rgba(0, 0, 0, 0.7)"
  723. });
  724. const params = {
  725. manufacturer_id: this.form.manufacturer,
  726. dealer_id: this.form.dealer
  727. };
  728. this.propForm.goods = []
  729. GetAllGoodInfoByID(params).then(response => {
  730. if (response.data.state == 0) {
  731. this.$message.error(response.data.msg);
  732. return false;
  733. } else {
  734. if (response.data.data.goodInfo.length <= 0) {
  735. this.$message.error("该厂商或经销商没有物品信息");
  736. return;
  737. }
  738. this.$refs.dialog.show();
  739. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  740. this.propForm.goodType.push(
  741. response.data.data.goodInfo[i].type
  742. );
  743. }
  744. const obj = {};
  745. this.propForm.goodType = this.propForm.goodType.reduce(
  746. (cur, next) => {
  747. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  748. return cur;
  749. },
  750. []
  751. ); // 设置cur默认类型为数组,并且初始值为空的数组
  752. }
  753. for (let i = 0; i < this.propForm.goodType.length; i++) {
  754. let goodInfo = [];
  755. let goodObj = {};
  756. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  757. var respObj = response.data.data.goodInfo[a];
  758. respObj["isSelected"] = false;
  759. if (respObj.type.id == this.propForm.goodType[i].id) {
  760. goodInfo.push(respObj);
  761. }
  762. }
  763. const obj = {};
  764. goodInfo = goodInfo.reduce((cur, next) => {
  765. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  766. return cur;
  767. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  768. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo);
  769. this.propForm.goods.push(goodObj);
  770. }
  771. loading.close();
  772. });
  773. },
  774. back() {
  775. this.$router.go(-1);
  776. },
  777. submit() {
  778. this.$refs["tableForm"].validate(valid => {
  779. if (valid) {
  780. this.loading = true
  781. const array = this.recordInfo.recordData;
  782. if(this.storehouse_id == 0){
  783. this.$message.error("仓库不能为空!")
  784. return
  785. }
  786. for (let i = 0; i < array.length; i++) {
  787. if (array[i].good_type_id == 0) {
  788. this.$message.error("商品类型不能为空");
  789. return;
  790. }
  791. if (array[i].good_id == 0) {
  792. this.$message.error("规格名称不能为空");
  793. return;
  794. }
  795. }
  796. for(let i=0;i<this.recordInfo.recordData.length;i++){
  797. this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
  798. this.recordInfo.recordData[i].packing_price = this.recordInfo.recordData[i].packing_price.toString()
  799. if(this.recordInfo.recordData[i].dealer == ""){
  800. this.recordInfo.recordData[i].dealer = 0
  801. }
  802. for(let j=0;j<this.manufacturerList.length;j++){
  803. if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
  804. this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
  805. }
  806. }
  807. for(let z=0;z<this.dealerList.length;z++){
  808. if(this.recordInfo.recordData[i].dealer == this.dealerList[z].dealer_name){
  809. this.recordInfo.recordData[i].dealer = this.dealerList[z].id
  810. }
  811. }
  812. if(this.recordInfo.recordData[i].split_of_number>0){
  813. this.recordInfo.recordData[i].split_of_number = parseInt(this.recordInfo.recordData[i].split_of_number)
  814. }else{
  815. this.recordInfo.recordData[i].split_of_number=0
  816. }
  817. this.recordInfo.recordData[i].warehousing_count = this.recordInfo.recordData[i].warehousing_count.toString()
  818. }
  819. const params = {
  820. stockIn: this.recordInfo.recordData
  821. };
  822. console.log("param22332322332",params)
  823. const loading = this.$loading({
  824. lock: true,
  825. text: 'Loading',
  826. spinner: 'el-icon-loading',
  827. background: 'rgba(0, 0, 0, 0.7)'
  828. })
  829. EditWarehouse(
  830. params,
  831. this.warehousing_time,
  832. this.$route.query.id,
  833. this.$route.query.type,
  834. this.form.manufacturer,
  835. this.form.dealer,
  836. this.storehouse_id,
  837. ).then(response => {
  838. if (response.data.state == 0) {
  839. this.loading =false
  840. this.$message.error(response.data.msg);
  841. loading.close()
  842. return false;
  843. } else {
  844. loading.close()
  845. this.loading = false
  846. var list = response.data.data.list
  847. var manufacturerList = response.data.data.manufacturerList
  848. var dealerList = response.data.data.dealerList
  849. for(let i=0;i<list.length;i++){
  850. for(let j=0;j<dealerList.length;j++){
  851. if(list[i].dealer == dealerList[j].id){
  852. list[i].dealer = dealerList[j].dealer_name
  853. }
  854. }
  855. for(let s=0;s<manufacturerList.length;s++){
  856. if(list[i].manufacturer == manufacturerList[s].id){
  857. list[i].manufacturer = manufacturerList[s].manufacturer_name
  858. }
  859. }
  860. list[i].expiry_date = this.getTimeOne(list[i].expiry_date)
  861. list[i].product_date = this.getTimeOne(list[i].product_date)
  862. list[i].good_name = list[i].GoodInfo.good_name
  863. list[i].name = list[i].GoodInfo.specification_name
  864. list[i].good_code = list[i].good_code
  865. list[i].split_of_number = list[i].split_of_number
  866. }
  867. this.recordInfo.recordData = []
  868. this.recordInfo.recordData = list
  869. this.$message.success("保存成功");
  870. }
  871. });
  872. } else {
  873. return false;
  874. }
  875. });
  876. },
  877. GetOrderDetail: function(order_id) {
  878. const params = {
  879. id: order_id
  880. };
  881. getWarehouseInfoList(params).then(response => {
  882. if (response.data.state == 0) {
  883. this.$message.error(response.data.msg);
  884. return false;
  885. } else {
  886. for (let i = 0; i < response.data.data.info.length; i++) {
  887. response.data.data.info[i].product_date = this.getTime(
  888. response.data.data.info[i].product_date,
  889. "{y}-{m}-{d}"
  890. );
  891. response.data.data.info[i].expiry_date = this.getTime(
  892. response.data.data.info[i].expiry_date,
  893. "{y}-{m}-{d}"
  894. );
  895. response.data.data.info[i].price = response.data.data.info[i].price.toString();
  896. response.data.data.info[i].warehousing_count = response.data.data.info[i].warehousing_count.toString();
  897. response.data.data.info[i].good_name = response.data.data.info[i].GoodInfo.good_name
  898. response.data.data.info[i].name = response.data.data.info[i].GoodInfo.specification_name + "/"+response.data.data.info[i].GoodInfo.packing_unit
  899. response.data.data.info[i].packing_unit = response.data.data.info[i].GoodInfo.packing_unit
  900. response.data.data.info[i].split_of_number = response.data.data.info[i].split_of_number
  901. if(response.data.data.info[i].manufacturer == 0){
  902. response.data.data.manufacturer = ""
  903. }
  904. if(response.data.data.info[i].dealer == 0){
  905. response.data.data.info[i].dealer = ""
  906. }
  907. this.recordInfo.recordData.push(response.data.data.info[i]);
  908. }
  909. this.warehouse = response.data.data.warehousing;
  910. this.storehouse_id = response.data.data.warehousing[0].storehouse_id
  911. this.warehousing_time = this.getTime(
  912. this.warehouse[0].warehousing_time,
  913. "{y}-{m}-{d}"
  914. );
  915. if (this.recordInfo.recordData.length == 0) {
  916. const tempObj = {};
  917. tempObj["id"] = 0;
  918. tempObj["good_type_id"] = 0;
  919. tempObj["good_id"] = 0;
  920. tempObj["number"] = "";
  921. tempObj["product_date"] = "";
  922. tempObj["expiry_date"] = "";
  923. tempObj["warehousing_count"] = "";
  924. tempObj["price"] = "";
  925. tempObj["remark"] = "";
  926. tempObj["dealer"] = "";
  927. tempObj["manufacturer"] = "";
  928. tempObj["license_number"] = ""
  929. tempObj["register_number"] = ""
  930. tempObj["good_code"] = ""
  931. tempObj['split_of_number'] = 24
  932. this.recordInfo.recordData.push(tempObj);
  933. }
  934. }
  935. });
  936. },
  937. querySearchAsync(keyword, cb) {
  938. let key = '';
  939. if (keyword != undefined) {
  940. key = keyword
  941. }
  942. postSearchGoodList(key,this.storehouse_id).then(response => {
  943. if (response.data.state == 1) {
  944. var list = response.data.data.list
  945. this.goodList = list
  946. var manufacturerList = response.data.data.manufacturerList
  947. this.manufacturerList = manufacturerList
  948. this.dealerList = response.data.data.dealerList
  949. for(let i=0;i<this.goodList.length;i++){
  950. for(let j=0;j<manufacturerList.length;j++){
  951. if(this.goodList[i].manufacturer == manufacturerList[j].id){
  952. this.goodList[i].manufacturer = manufacturerList[j].manufacturer_name
  953. }
  954. }
  955. }
  956. for(let i=0;i<this.goodList.length;i++){
  957. for(let j=0;j<this.dealerList.length;j++){
  958. if(this.goodList[i].dealer == this.dealerList[j].id){
  959. this.goodList[i].dealer = this.dealerList[j].dealer_name
  960. }
  961. }
  962. }
  963. cb(this.goodList)
  964. } else {
  965. cb([])
  966. }
  967. })
  968. },
  969. changeGoodName(val){
  970. this.currentIndex = val
  971. },
  972. handleSelect(val){
  973. for(let i=0;i<this.recordInfo.recordData.length;i++){
  974. if(this.currentIndex == i){
  975. this.recordInfo.recordData[i].good_type_id = val.id
  976. this.recordInfo.recordData[i].good_name = val.good_name
  977. this.recordInfo.recordData[i].good_type_id = val.good_type_id
  978. this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
  979. // this.recordInfo.recordData[i].number = val.number
  980. this.recordInfo.recordData[i].manufacturer = val.manufacturer
  981. this.recordInfo.recordData[i].remark = val.remark
  982. this.recordInfo.recordData[i].license_number = val.number
  983. this.recordInfo.recordData[i].register_number = val.register_number
  984. if(val.buy_price == 0){
  985. this.recordInfo.recordData[i].price= "0"
  986. }else{
  987. this.recordInfo.recordData[i].price = val.buy_price
  988. }
  989. if(this.org_id == 0 || this.org_id == 10633){
  990. this.recordInfo.recordData[i].price = val.first_xt_warehouse_info.packing_price
  991. }
  992. if(val.packing_price == 0){
  993. this.recordInfo.recordData[i].packing_price = "0"
  994. }else{
  995. this.recordInfo.recordData[i].packing_price = val.packing_price
  996. }
  997. this.recordInfo.recordData[i].specification_name = val.specification_name
  998. this.recordInfo.recordData[i].good_id = val.id
  999. this.recordInfo.recordData[i].packing_unit = val.packing_unit
  1000. if(val.dealer == 0){
  1001. this.recordInfo.recordData[i].dealer
  1002. }else{
  1003. this.recordInfo.recordData[i].dealer = val.dealer
  1004. }
  1005. // for(let i=0;i<this.recordInfo.recordData.length;i++){
  1006. // this.recordInfo.recordData[i].warehouse_info_str = ""
  1007. // for(let j=0;j<this.recordInfo.recordData[i].xt_warehouse_info.length;j++){
  1008. // this.recordInfo.recordData[i].warehouse_info_str += "批次:"+this.recordInfo.recordData[i].xt_warehouse_info[j].number+" " + "剩余:"+this.recordInfo.recordData[i].xt_warehouse_info[j].stock_count+this.recordInfo.recordData[i].packing_unit +"\n"
  1009. // }
  1010. // }
  1011. }
  1012. }
  1013. },
  1014. toCheck(){
  1015. const loading = this.$loading({
  1016. lock: true,
  1017. text: 'Loading',
  1018. spinner: 'el-icon-loading',
  1019. background: 'rgba(0, 0, 0, 0.7)'
  1020. })
  1021. var params = {
  1022. warehousing_info_id:this.order_id,
  1023. }
  1024. toCheckWarehouseInfo(params).then(response=>{
  1025. if(response.data.state == 1){
  1026. var list = response.data.data.list
  1027. this.$message.success("审核成功!")
  1028. loading.close()
  1029. this.$router.back(-1)
  1030. }else{
  1031. this.$message.error("审核失败!")
  1032. loading.close()
  1033. }
  1034. })
  1035. },
  1036. toReturnCheck(){
  1037. const loading = this.$loading({
  1038. lock: true,
  1039. text: 'Loading',
  1040. spinner: 'el-icon-loading',
  1041. background: 'rgba(0, 0, 0, 0.7)'
  1042. })
  1043. var params = {
  1044. warehousing_info_id:this.order_id,
  1045. }
  1046. toReturnCheckWarehouseInfo(params).then(response=>{
  1047. if(response.data.state == 1){
  1048. this.$message.success(response.data.data.msg)
  1049. loading.close()
  1050. this.$router.back(-1)
  1051. }else{
  1052. this.$message.error(response.data.msg)
  1053. loading.close()
  1054. this.$router.back(-1)
  1055. }
  1056. })
  1057. },
  1058. getTimeOne(val) {
  1059. if(val < 0){
  1060. return ""
  1061. }
  1062. if(val == ""){
  1063. return ""
  1064. }else {
  1065. return uParseTime(val, '{y}-{m}-{d}')
  1066. }
  1067. },
  1068. getTotalPirce(){
  1069. var total_price = 0
  1070. if(this.recordInfo.recordData!=null && this.recordInfo.recordData.length>0){
  1071. for(let i=0;i<this.recordInfo.recordData.length;i++){
  1072. total_price += this.recordInfo.recordData[i].price * parseInt(this.recordInfo.recordData[i].warehousing_count)
  1073. }
  1074. if(total_price>0){
  1075. return total_price.toFixed(4)
  1076. }else{
  1077. return ""
  1078. }
  1079. }
  1080. },
  1081. changeGoodCode(row,index){
  1082. this.textarea=""
  1083. this.textarea = row.good_code
  1084. this.currentRow = row
  1085. this.currentIndex =index
  1086. this.dialogVisible = true
  1087. },
  1088. changeText(event){
  1089. // 检查是否为特定的按键,例如回车键,来确认扫码枪输入完成
  1090. var textAreaList = this.textarea.split(",")
  1091. if (event.key === 'Enter') {
  1092. var textarea = ""
  1093. textarea += this.textarea.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
  1094. var parts = textarea.split(',')
  1095. for(let i=0;i<textAreaList.length;i++){
  1096. if(parts[parts.length-2] == textAreaList[i]){
  1097. this.$message.error("该条码已经存在,不能重复扫码")
  1098. }
  1099. }
  1100. const uniqueStr = [...new Set(textarea.split(','))].join(',');
  1101. this.textarea = uniqueStr
  1102. }
  1103. },
  1104. saveTextArea(){
  1105. for(let i=0;i<this.recordInfo.recordData.length;i++){
  1106. if(this.currentIndex == i){
  1107. this.recordInfo.recordData[i].good_code = this.textarea
  1108. }
  1109. }
  1110. this.dialogVisible = false
  1111. },
  1112. },
  1113. created() {
  1114. this.org_id = this.$store.getters.xt_user.org.id
  1115. this.GetConfigInfo();
  1116. this.propForm.goodUnit = this.$store.getters.good_unit;
  1117. const order_id = this.$route.query.id;
  1118. this.order_id = order_id
  1119. var supply_warehouse_id = parseInt(this.$route.query.supply_warehouse_id)
  1120. var is_sys = parseInt(this.$route.query.is_sys)
  1121. this.is_check = parseInt(this.$route.query.is_check)
  1122. if(supply_warehouse_id > 0){
  1123. this.disabled = true
  1124. }
  1125. if(is_sys == 12 || this.is_check == 1){
  1126. this.disabled = true
  1127. }
  1128. this.GetOrderDetail(order_id);
  1129. }
  1130. };
  1131. </script>
  1132. <style>
  1133. #oictable ::-webkit-scrollbar {
  1134. height: 15px;
  1135. }
  1136. </style>
  1137. <style rel="stylesheet/css" lang="scss" scoped>
  1138. .information {
  1139. border: 1px #dcdfe6 solid;
  1140. padding: 30px 20px 30px 20px;
  1141. .border {
  1142. border-bottom: 1px #dcdfe6 solid;
  1143. margin: 0px 0 20px 0;
  1144. }
  1145. }
  1146. .edit_separater {
  1147. border-top: 1px solid rgb(233, 233, 233);
  1148. margin-top: 15px;
  1149. margin-bottom: 15px;
  1150. }
  1151. </style>
  1152. <style>
  1153. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1154. font-size: 12px;
  1155. }
  1156. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1157. background: #6fb5fa;
  1158. }
  1159. </style>