stockInOrderAdd.vue 49KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb v-if="type == 1" :crumbs='crumbs'></bread-crumb>
  5. <bread-crumb v-if="type == 2" :crumbs='crumbs2'></bread-crumb>
  6. <div style="float:right;">
  7. <el-button size="small" @click="back()" class="filter-item">取 消</el-button>
  8. <el-button size="small" type="primary" @click="submit()" class="filter-item" v-loading="loading">保 存</el-button>
  9. <el-button size="small" type="primary" v-show="showCheck" @click="toCheck()" class="filter-item">审 核</el-button>
  10. <!-- <el-button size="small" type="primary" v-show="showReturnCheck" @click="toReturnCheck()" class="filter-item">反 审 核</el-button> -->
  11. </div>
  12. </div>
  13. <div class="app-container" v-loading="loading">
  14. <stock-in-dialog ref="dialog" :propForm="propForm"
  15. :visibility="isVisibility"
  16. v-on:dialog-comfirm="comfirm"
  17. v-on:dialog-cancle="cancle">
  18. </stock-in-dialog>
  19. <div class="cell clearfix">
  20. <label class="title"><span class="name"><span style="color:red">*</span>仓库</span> :</label>
  21. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px">
  22. <el-option
  23. v-for="(option, index) in list"
  24. :key="index"
  25. :label="option.storehouse_name"
  26. :value="option.id">
  27. </el-option>
  28. </el-select>
  29. <label class="title"><span class="name">入库时间</span> : </label>
  30. <el-date-picker size="small" v-model="warehousing_time" prefix-icon="el-icon-date" :editable="false"
  31. style="width: 196px;" type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  32. value-format="yyyy-MM-dd"></el-date-picker>
  33. </div>
  34. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  35. <el-table id="oictable" :data="recordInfo.recordData" :class="signAndWeighBoxPatients" border
  36. style="width: 100%"
  37. max-height="450" :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  38. >
  39. <el-table-column align="center" width="200" fixed="left">
  40. <template slot="header" slot-scope="scope">
  41. <span>耗材名称</span>
  42. </template>
  43. <template slot-scope="scope">
  44. <el-autocomplete
  45. class="checkSearch"
  46. popper-class="my-autocomplete"
  47. v-model="scope.row.good_name"
  48. :fetch-suggestions="querySearchAsync"
  49. :trigger-on-focus="true"
  50. placeholder="请输入耗材名称"
  51. @select="handleSelect"
  52. @input="changeGoodName(scope.$index)"
  53. style="width:160px;"
  54. :popper-append-to-body="true"
  55. >
  56. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  57. <template slot-scope="{ item }">
  58. <div class="name">{{ item.good_name +" " +item.specification_name + " "+item.manufacturer }}</div>
  59. </template>
  60. </el-autocomplete>
  61. </template>
  62. </el-table-column>
  63. <el-table-column align="center" width="140">
  64. <template slot="header" slot-scope="scope">
  65. <span>耗材类型<span style="color: red">*</span></span>
  66. </template>
  67. <template slot-scope="scope">
  68. <el-form-item style="padding-top: 20px;">
  69. <el-input placeholder="请输入耗材类型" v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)"></el-input>
  70. </el-form-item>
  71. </template>
  72. </el-table-column>
  73. <el-table-column align="center" width="140">
  74. <template slot="header" slot-scope="scope">
  75. <span>规格&单位<span style="color: red">*</span></span>
  76. </template>
  77. <template slot-scope="scope">
  78. <el-form-item style="padding-top: 20px">
  79. <el-input placeholder="请输入规格名称" v-model="scope.row.name"></el-input>
  80. </el-form-item>
  81. </template>
  82. </el-table-column>
  83. <el-table-column align="center" width="150">
  84. <template slot="header" slot-scope="scope">
  85. <span>批号<span style="color: red">*</span></span>
  86. </template>
  87. <template slot-scope="scope">
  88. <el-form-item style="padding-top: 20px" :prop="'recordData.' + scope.$index + '.number'"
  89. :rules='tableRules.number' >
  90. <el-input placeholder="请输入批号" v-model="scope.row.number"></el-input>
  91. </el-form-item>
  92. </template>
  93. </el-table-column>
  94. <el-table-column align="center" width="120">
  95. <template slot="header" slot-scope="scope">
  96. <span>入库数量<span style="color: red">*</span></span>
  97. </template>
  98. <template slot-scope="scope">
  99. <el-form-item :prop="'recordData.' + scope.$index + '.warehousing_count'"
  100. :rules='tableRules.warehousing_count' style="padding-top: 20px">
  101. <!-- <el-input placeholder="请输入入库数量" type="number" v-model="scope.row.warehousing_count" oninput="value=value.replace(/\D|^0/g,'')"></el-input> -->
  102. <el-input placeholder="请输入入库数量" v-model="scope.row.warehousing_count"></el-input>
  103. {{scope.row.min_unit}}
  104. </el-form-item>
  105. </template>
  106. </el-table-column>
  107. <el-table-column align="center" width="200">
  108. <template slot="header" slot-scope="scope">
  109. <span>当前溯源码数量</span>
  110. </template>
  111. <template slot-scope="scope">
  112. <el-form-item
  113. :prop="'recordData.' + scope.$index + '.good_code_cnt'"
  114. style="padding-top: 10px"
  115. >
  116. <div style="display: flex">
  117. <el-input
  118. placeholder="请输入入库数量"
  119. v-model="scope.row.good_code_cnt"
  120. style="width: 120px"
  121. disabled
  122. ></el-input>
  123. </div>
  124. </el-form-item>
  125. </template>
  126. </el-table-column>
  127. <el-table-column align="center" width="100">
  128. <template slot="header" slot-scope="scope">
  129. <span>拆零次数</span>
  130. </template>
  131. <template slot-scope="scope">
  132. <el-form-item
  133. style="padding-top: 10px"
  134. >
  135. <div style="display: flex">
  136. <el-input
  137. type="number"
  138. placeholder="请输入入库数量"
  139. v-model="scope.row.split_of_number"
  140. style="width: 100px"
  141. ></el-input>
  142. </div>
  143. </el-form-item>
  144. </template>
  145. </el-table-column>
  146. <el-table-column align="center" width="120">
  147. <template slot="header" slot-scope="scope">
  148. <span>零售价<span style="color: red">*</span></span>
  149. </template>
  150. <template slot-scope="scope">
  151. <el-form-item :prop="'recordData.' + scope.$index + '.packing_price'" :rules='tableRules.packing_price'
  152. style="padding-top: 20px">
  153. <el-input placeholder="请输入单价" type="number" v-model="scope.row.packing_price"></el-input>
  154. </el-form-item>
  155. </template>
  156. </el-table-column>
  157. <el-table-column align="center" width="120">
  158. <template slot="header" slot-scope="scope">
  159. <span>进货单价<span style="color: red">*</span></span>
  160. </template>
  161. <template slot-scope="scope">
  162. <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price'
  163. style="padding-top: 20px">
  164. <el-input placeholder="请输入单价" type="number" v-model="scope.row.price"></el-input>
  165. </el-form-item>
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="总价" align="center" width="80">
  169. <template slot-scope="scope">
  170. {{calculate(scope.row.price*scope.row.warehousing_count)}}
  171. </template>
  172. </el-table-column>
  173. <el-table-column align="center" width="180">
  174. <template slot="header" slot-scope="scope">
  175. <span>有效日期<span style="color: red">*</span></span>
  176. </template>
  177. <template slot-scope="scope">
  178. <el-form-item :prop="'recordData.' + scope.$index + '.expiry_date'"
  179. :rules="tableRules.expiry_date">
  180. <el-date-picker prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.expiry_date"
  181. type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
  182. value-format="yyyy-MM-dd">
  183. </el-date-picker>
  184. </el-form-item>
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="生产日期" align="center" width="180">
  188. <template slot-scope="scope">
  189. <el-date-picker prefix-icon="el-icon-date" v-model="scope.row.product_date" style="width: 145px"
  190. type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
  191. value-format="yyyy-MM-dd">
  192. </el-date-picker>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="生产厂家" align="center" width="150">
  196. <template slot-scope="scope">
  197. <el-select size="small" v-model="scope.row.manufacturer" filterable placeholder="请选择厂商">
  198. <el-option
  199. v-for="(option, index) in manufacturerList"
  200. :key="index"
  201. :label="option.manufacturer_name"
  202. :value="option.id">
  203. </el-option>
  204. </el-select>
  205. </template>
  206. </el-table-column>
  207. <el-table-column align="center" width="150" v-if="org_id!=10653&&org_id!=0">
  208. <template slot="header" slot-scope="scope">
  209. <span>批准文号</span>
  210. </template>
  211. <template slot-scope="scope">
  212. <el-form-item style="padding-top: 20px">
  213. <el-input placeholder="请输入批准文号" v-model="scope.row.license_number" ></el-input>
  214. </el-form-item>
  215. </template>
  216. </el-table-column>
  217. <el-table-column align="center" width="150" v-if="org_id ==10653 || org_id == 0">
  218. <template slot="header" slot-scope="scope">
  219. <span>生产许可证号</span>
  220. </template>
  221. <template slot-scope="scope">
  222. <el-form-item style="padding-top: 20px">
  223. <el-input placeholder="请输入生产许可证号" v-model="scope.row.license_number" ></el-input>
  224. </el-form-item>
  225. </template>
  226. </el-table-column>
  227. <el-table-column align="center" width="150">
  228. <template slot="header" slot-scope="scope">
  229. <span>注册编码</span>
  230. </template>
  231. <template slot-scope="scope">
  232. <el-form-item style="padding-top: 20px">
  233. <el-input placeholder="请输入注册编码" v-model="scope.row.register_number" ></el-input>
  234. </el-form-item>
  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.dealer" filterable placeholder="请选择厂商">
  240. <el-option
  241. v-for="(option, index) in dealerList"
  242. :key="index"
  243. :label="option.dealer_name"
  244. :value="option.id">
  245. </el-option>
  246. </el-select>
  247. </template>
  248. </el-table-column>
  249. <el-table-column label="耗材追溯码" align="center" width="150">
  250. <template slot-scope="scope">
  251. <div @click="changeGoodCode(scope.row,scope.$index)">
  252. <el-input v-model="scope.row.good_code" placeholder="请输入耗材追溯码"></el-input>
  253. </div>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="追溯码数量" align="center" width="150">
  257. <template slot-scope="scope">
  258. {{ getGoodCode(scope.row.good_code) }}
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="备注" align="center" width="150">
  262. <template slot-scope="scope">
  263. <el-input placeholder="请输入备注" v-model="scope.row.remark"></el-input>
  264. </template>
  265. </el-table-column>
  266. <el-table-column label="操作" align="center" fixed="right" width="150">
  267. <template slot-scope="scope">
  268. <el-tooltip class="item" effect="dark" content="新增" placement="top">
  269. <el-button
  270. size="mini"
  271. type="primary"
  272. icon="el-icon-circle-plus-outline"
  273. @click="handleEdit(scope.$index, scope.row)">
  274. </el-button>
  275. </el-tooltip>
  276. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  277. <el-button
  278. size="mini"
  279. type="danger"
  280. icon="el-icon-delete"
  281. @click="handleDelete(scope.$index, scope.row)">
  282. </el-button>
  283. </el-tooltip>
  284. </template>
  285. </el-table-column>
  286. </el-table>
  287. <div style="margin-top: 20px;">合计金额: {{getTotalPirce() }} </div>
  288. </el-form>
  289. </div>
  290. <el-dialog
  291. title="耗材追溯码"
  292. @open="openDialog"
  293. :visible.sync="dialogVisible"
  294. width="40%">
  295. <div style="margin-bottom: 10px;">
  296. <span >追溯码个数:{{getTotal() }} 个</span>
  297. </div>
  298. <span>
  299. <el-input
  300. ref="inputRef"
  301. inputmode="verbatim"
  302. @keyup.native="changeText"
  303. @paste.native.prevent="handlePaste"
  304. @compositionstart="handleCompositionStart"
  305. @compositionend="handleCompositionEnd"
  306. type="textarea"
  307. placeholder="请输入内容"
  308. v-model="textarea"
  309. :rows="10"
  310. >
  311. </el-input>
  312. </span>
  313. <span slot="footer" class="dialog-footer">
  314. <el-button @click="dialogVisible = false">取 消</el-button>
  315. <el-button type="primary" @click="saveTextArea()">确 定</el-button>
  316. </span>
  317. </el-dialog>
  318. <el-dialog
  319. title="重复值警告"
  320. :visible.sync="showDuplicateAlert"
  321. width="30%"
  322. append-to-body>
  323. <div v-for="(item, index) in duplicateList" :key="index">
  324. <el-alert
  325. :title="`重复值: ${item.value} (出现 ${item.count} 次)`"
  326. type="error"
  327. :closable="false"
  328. show-icon>
  329. </el-alert>
  330. </div>
  331. <span slot="footer" class="dialog-footer">
  332. <el-button type="primary" @click="showDuplicateAlert = false">我知道了</el-button>
  333. </span>
  334. </el-dialog>
  335. <el-dialog
  336. title="重复值警告"
  337. :visible.sync="showDuplicateAlertOne"
  338. width="30%"
  339. append-to-body>
  340. <span>{{ msg }}</span>
  341. <span slot="footer" class="dialog-footer">
  342. <el-button type="primary" @click="showDuplicateAlertOne = false">我知道了</el-button>
  343. </span>
  344. </el-dialog>
  345. </div>
  346. </template>
  347. <script>
  348. import stockInDialog from './Dialog/stockInDialog'
  349. import { uParseTime } from '@/utils/tools'
  350. import {getDataConfig } from "@/utils/data";
  351. import {
  352. deleteWarehouseInfo,
  353. GetAllConfig,
  354. GetAllGoodInfo,
  355. GetAllGoodInfoByID,
  356. GetAllGoodType,
  357. getWarehouseInfoByOrdeNumber,
  358. modifyWarehouseInfo,
  359. postWarehouse,
  360. postSearchGoodList,
  361. toCheckWarehouseInfo,
  362. toReturnCheckWarehouseInfo,
  363. getRepatGoodList
  364. } from '@/api/stock'
  365. import BreadCrumb from '../components/bread-crumb'
  366. export default {
  367. components: { BreadCrumb, stockInDialog },
  368. name: 'stockIn',
  369. data() {
  370. var checkGoodId = (rule, value, callback) => {
  371. setTimeout(() => {
  372. if (value == '' || value == 0) {
  373. return callback(new Error('规格名称不能为空'))
  374. }
  375. }, 2000)
  376. }
  377. return {
  378. crumbs: [
  379. { path: false, name: '库存管理' },
  380. { path: false, name: '耗材入库单' },
  381. { path: false, name: '新增入库单' }
  382. ],
  383. crumbs2: [
  384. { path: false, name: '库存管理' },
  385. { path: false, name: '其他入库单' },
  386. { path: false, name: '新增入库单' }
  387. ],
  388. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  389. warehousing_time: '',
  390. adminUserOptions: null,
  391. currentIndex: 0,
  392. recordInfo: {
  393. recordData: [],
  394. stock_in_code: '',
  395. current_index: ''
  396. },
  397. tableRules: {
  398. price: [
  399. { required: true, message: '单价不能为空', trigger: 'blur' }
  400. ],
  401. packing_price: [
  402. { required: true, message: '零售价不能为空', trigger: 'blur' }
  403. ],
  404. warehousing_count: [
  405. { required: true, message: '数量不能为空', trigger: 'blur' }
  406. ],
  407. good_id: [
  408. { validator: checkGoodId, trigger: 'blur' }
  409. ],
  410. number:[
  411. { required: true, message: '批号不能为空', trigger: 'blur' }
  412. ],
  413. expiry_date:[
  414. { required: true, message: '有效日期不能为空', trigger: 'blur' }
  415. ],
  416. },
  417. type: this.$route.query.type,
  418. total: '',
  419. product_date: '',
  420. expiry_date: '',
  421. numbers: '',
  422. // prop
  423. isVisibility: false,
  424. propForm: {
  425. goods: [],
  426. goodType: [],
  427. goodInfo: [],
  428. goodUnit: [],
  429. title: '入库',
  430. formValue: {
  431. good_type_id: '',
  432. good_id: '',
  433. number: '',
  434. product_date: '',
  435. expiry_date: '',
  436. warehousing_count: '',
  437. price: '',
  438. remark: '',
  439. dealer: '',
  440. manufacturer: '',
  441. good_code:"",
  442. good_code_count:""
  443. },
  444. isCreated: 1
  445. },
  446. goodInfo: {
  447. loading: false,
  448. goodTypeData: [],
  449. type_code: ''
  450. },
  451. form: {
  452. manufacturer: '',
  453. dealer: ''
  454. },
  455. formValue: {
  456. good_type_id: '',
  457. good_id: '',
  458. number: '',
  459. product_date: '',
  460. expiry_date: '',
  461. warehousing_count: '',
  462. price: '',
  463. remark: '',
  464. dealer: '',
  465. manufacturer: ''
  466. },
  467. manufacturer: [],
  468. dealerList: [],
  469. goodType: [],
  470. manufacturerList:[],
  471. goodList:[],
  472. loading:false,
  473. list:[],
  474. storehouse_id:"",
  475. showCheck:false,
  476. showReturnCheck:false,
  477. warehousing_info_id:0,
  478. org_id:0,
  479. dialogVisible:false,
  480. currentRow:{},
  481. currentIndex:0,
  482. textarea:"",
  483. duplicateList:[],
  484. showDuplicateAlert:false,
  485. showDuplicateAlertOne:false,
  486. good_id:0,
  487. isComposing: false,
  488. msg:"",
  489. isChineseIME: false
  490. }
  491. },
  492. methods: {
  493. handleCompositionStart() {
  494. this.isChineseIME = true
  495. },
  496. handleCompositionEnd() {
  497. this.isChineseIME = false
  498. },
  499. getTotal(){
  500. if(this.textarea!=null){
  501. var textAreaList = this.textarea.split(",")
  502. var arr = []
  503. if(textAreaList!=null && textAreaList.length>0){
  504. for(let i=0;i<textAreaList.length;i++){
  505. if(textAreaList[i]!=""){
  506. arr.push(textAreaList[i])
  507. }
  508. }
  509. return arr.length
  510. }else{
  511. return ""
  512. }
  513. }
  514. },
  515. openDialog(){
  516. this.$nextTick(() => {
  517. this.$refs.inputRef.focus()
  518. });
  519. },
  520. handleSave: function() {
  521. if (this.recordInfo.recordData.length <= 0) {
  522. this.$message.error('请添加入库信息')
  523. return
  524. }
  525. sessionStorage.removeItem('warehousing_orders')
  526. this.$router.back(-1)
  527. }, handleCancle: function() {
  528. this.$confirm('是否放弃编辑返回上一页?', '放弃编辑', {
  529. confirmButtonText: '确定',
  530. cancelButtonText: '取消',
  531. type: 'warning'
  532. }).then(() => {
  533. sessionStorage.removeItem('warehousing_orders')
  534. this.$router.back(-1)
  535. }).catch(() => {
  536. })
  537. }, handleCreate: function() {
  538. this.propForm.formValue = {}
  539. this.propForm.isCreated = 1
  540. this.isVisibility = true
  541. },
  542. comfirm: function(val) {
  543. this.propForm.goodType = []
  544. this.propForm.goods = []
  545. this.$refs.dialog.hide()
  546. console.log(val)
  547. if (val.selectedGoodInfo.length > 0) {
  548. for (let i = val.selectedGoodInfo.length - 1; i >= 0; i--) {
  549. if (i == 0) {
  550. this.recordInfo.recordData[this.currentIndex].good_type_id = val.selectedGoodInfo[i].good_type_id
  551. this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
  552. this.recordInfo.recordData[this.currentIndex].price = val.selectedGoodInfo[i].buy_price.toString()
  553. this.recordInfo.recordData[this.currentIndex].good_unit = val.selectedGoodInfo[i].good_unit
  554. this.recordInfo.recordData[this.currentIndex].good_name = val.selectedGoodInfo[i].good_name
  555. } else {
  556. const tempForm = {}
  557. tempForm['good_type_id'] =val.selectedGoodInfo[i].good_type_id
  558. tempForm['good_id'] = val.selectedGoodInfo[i].id
  559. tempForm['number'] = ''
  560. tempForm['product_date'] = ''
  561. tempForm['expiry_date'] = ''
  562. tempForm['warehousing_count'] = ''
  563. tempForm['price'] = val.selectedGoodInfo[i].buy_price.toString()
  564. tempForm['remark'] = ''
  565. tempForm['dealer'] = ''
  566. tempForm['manufacturer'] = ''
  567. tempForm['good_unit'] = val.selectedGoodInfo[i].good_unit
  568. tempForm['good_name'] = val.selectedGoodInfo[i].good_name
  569. this.recordInfo.recordData.splice(this.currentIndex + 1, 0, tempForm)
  570. }
  571. }
  572. }
  573. this.currentIndex = -1
  574. }, cancle: function() {
  575. this.propForm.goodType = []
  576. this.propForm.goods = []
  577. this.$refs.dialog.hide()
  578. },
  579. GetAllGoodType: function() {
  580. GetAllGoodType().then(response => {
  581. if (response.data.state == 0) {
  582. this.$message.error(response.data.msg)
  583. return false
  584. } else {
  585. for (let i = 0; i < response.data.data.goodType.length; i++) {
  586. this.propForm.goodType.push(response.data.data.goodType[i])
  587. }
  588. }
  589. })
  590. },
  591. GetAllGoodInfo: function() {
  592. GetAllGoodInfo().then(response => {
  593. if (response.data.state == 0) {
  594. this.$message.error(response.data.msg)
  595. return false
  596. } else {
  597. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  598. this.propForm.goodInfo.push(response.data.data.goodInfo[i])
  599. }
  600. }
  601. })
  602. },
  603. GetConfigInfo: function() {
  604. const loading = this.$loading({
  605. lock: true,
  606. text: 'Loading',
  607. spinner: 'el-icon-loading',
  608. background: 'rgba(0, 0, 0, 0.7)'
  609. })
  610. GetAllConfig().then(response => {
  611. if (response.data.state == 0) {
  612. this.$message.error(response.data.msg)
  613. return false
  614. } else {
  615. this.manufacturer = response.data.data.manufacturer
  616. this.dealer = response.data.data.dealer
  617. this.goodType = response.data.data.goodType
  618. this.goodInfo = response.data.data.goodInfo
  619. this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: '全部' })
  620. this.dealer.splice(0, 0, { id: 0, dealer_name: '全部' })
  621. this.manufacturer.splice(0, 0, { id: -1, manufacturer_name: '其他' })
  622. this.dealer.splice(0, 0, { id: -1, dealer_name: '其他' })
  623. this.form.manufacturer = 0
  624. this.form.dealer = 0
  625. this.list = response.data.data.list
  626. this.storehouse_id = response.data.data.configlist.storehouse_info
  627. }
  628. loading.close()
  629. })
  630. }, typeName: function(good_type_id) {
  631. let name = ''
  632. for (let i = 0; i < this.goodType.length; i++) {
  633. if (this.goodType[i].id == good_type_id) {
  634. name = this.goodType[i].type_name
  635. }
  636. }
  637. return name
  638. }, specificationName: function(good_info_id) {
  639. let name = ''
  640. for (let i = 0; i < this.goodInfo.length; i++) {
  641. if (this.goodInfo[i].id == good_info_id) {
  642. name = this.goodInfo[i].specification_name
  643. }
  644. }
  645. return name
  646. },
  647. handleEdit: function(index, row) {
  648. const tempObj = {}
  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['good_unit'] = ''
  660. tempObj['specification_name'] = ''
  661. tempObj['name'] = ''
  662. tempObj['license_number'] = ""
  663. tempObj["packing_price"] = ""
  664. tempObj["id"] = 0
  665. tempObj['register_number'] = ''
  666. tempObj['good_code'] = ""
  667. tempObj['good_code_cnt'] = ''
  668. tempObj["good_code_count"] =''
  669. tempObj['split_of_number'] = 24
  670. this.recordInfo.recordData.push(tempObj)
  671. }, handleDelete: function(index, row) {
  672. if (this.recordInfo.recordData.length <= 1) {
  673. this.$message.error('只有一条记录的时候无法删除')
  674. return
  675. } else {
  676. this.recordInfo.recordData.splice(index, 1)
  677. }
  678. },
  679. calculate: function(val) {
  680. if (val == 0) {
  681. return ''
  682. }
  683. return Math.round(parseFloat(val) * 100) / 100
  684. },
  685. GetWarehouseInfoByOrdeNumber: function() {
  686. const params = {
  687. 'warehousing_order': sessionStorage.getItem('warehousing_orders')
  688. }
  689. this.recordInfo.recordData = []
  690. getWarehouseInfoByOrdeNumber(params).then(response => {
  691. if (response.data.state != 0) {
  692. for (let i = 0; i < response.data.data.info.length; i++) {
  693. this.recordInfo.recordData.push(response.data.data.info[i])
  694. }
  695. console.log("333333333",this.recordInfo.recordData)
  696. }
  697. })
  698. }, getTime(val, temp) {
  699. if (val != 0) {
  700. return uParseTime(val, temp)
  701. } else {
  702. return ''
  703. }
  704. },
  705. showDialog(index, row) {
  706. const loading = this.$loading({
  707. lock: true,
  708. text: 'Loading',
  709. spinner: 'el-icon-loading',
  710. background: 'rgba(0, 0, 0, 0.7)'
  711. })
  712. this.currentIndex = index
  713. this.isVisibility = true
  714. const params = {
  715. manufacturer_id: this.form.manufacturer,
  716. dealer_id: this.form.dealer
  717. }
  718. this.propForm.goods = []
  719. GetAllGoodInfoByID(params).then(response => {
  720. if (response.data.state == 0) {
  721. this.$message.error(response.data.msg)
  722. return false
  723. loading.close()
  724. } else {
  725. loading.close()
  726. if (response.data.data.goodInfo.length <= 0) {
  727. this.$message.error('该厂商或经销商没有物品信息')
  728. return
  729. }
  730. this.$refs.dialog.show()
  731. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  732. this.propForm.goodType.push(response.data.data.goodInfo[i].type)
  733. }
  734. const obj = {}
  735. this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
  736. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  737. return cur
  738. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  739. }
  740. for (let i = 0; i < this.propForm.goodType.length; i++) {
  741. let goodInfo = []
  742. let goodObj = {}
  743. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  744. var respObj = response.data.data.goodInfo[a]
  745. respObj['isSelected'] = false
  746. if (respObj.type.id == this.propForm.goodType[i].id) {
  747. goodInfo.push(respObj)
  748. }
  749. }
  750. const obj = {}
  751. goodInfo = goodInfo.reduce((cur, next) => {
  752. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  753. return cur
  754. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  755. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo)
  756. this.propForm.goods.push(goodObj)
  757. }
  758. console.log( this.propForm.goods)
  759. }
  760. )
  761. },
  762. getSummaries(param) {
  763. const { columns, data } = param
  764. const sums = []
  765. columns.forEach((column, index) => {
  766. if (index === 0) {
  767. sums[index] = '总价'
  768. return
  769. }
  770. const values = data.map(item => Number(item[column.property]))
  771. if (!values.every(value => isNaN(value))) {
  772. sums[index] = values.reduce((prev, curr) => {
  773. const value = Number(curr)
  774. if (!isNaN(value)) {
  775. return prev + curr
  776. } else {
  777. return prev
  778. }
  779. }, 0)
  780. sums[index] += ' 元'
  781. } else {
  782. sums[index] = 'N/A'
  783. }
  784. })
  785. return sums
  786. }
  787. ,
  788. back() {
  789. this.$router.go(-1)
  790. }
  791. ,
  792. submit() {
  793. this.$refs['tableForm'].validate((valid) => {
  794. if (valid) {
  795. this.loading = true
  796. const array = this.recordInfo.recordData
  797. if(this.storehouse_id == 0){
  798. this.$message.error("仓库不能为空!")
  799. return
  800. }
  801. for (let i = 0; i < array.length; i++) {
  802. if (array[i].good_type_id == 0) {
  803. this.$message.error('商品类型不能为空')
  804. return
  805. }
  806. array[i].price = array[i].price.toString()
  807. array[i].packing_price = array[i].packing_price.toString()
  808. }
  809. if(this.$store.getters.xt_user.org_id == 10138 || this.$store.getters.xt_user.org_id == 10278 || this.$store.getters.xt_user.org_id == 10610 || this.$store.getters.xt_user.org_id == 10537 ) {
  810. for (let i = 0; i < array.length; i++) {
  811. if (array[i].good_code.length == 0) {
  812. this.$message.error(array[i].good_name + " 溯源码不能为空");
  813. this.loading = false;
  814. return;
  815. }
  816. var aaa = array[i].good_code.split(",")
  817. if(new Set(aaa).size !== aaa.length){
  818. this.$message.error( array[i].good_name + " 溯源码不能重复");
  819. this.loading = false;
  820. return;
  821. }
  822. }
  823. }
  824. if(this.recordInfo.recordData.length <= 0){
  825. this.$message.success('请添加入库商品')
  826. return
  827. }
  828. for(let i=0;i<this.recordInfo.recordData.length;i++){
  829. if(this.recordInfo.recordData[i].dealer == ""){
  830. this.recordInfo.recordData[i].dealer = 0
  831. }
  832. if(this.recordInfo.recordData[i].split_of_number>0){
  833. this.recordInfo.recordData[i].split_of_number = parseInt(this.recordInfo.recordData[i].split_of_number)
  834. }else{
  835. this.recordInfo.recordData[i].split_of_number=0
  836. }
  837. for(let j=0;j<this.manufacturerList.length;j++){
  838. if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
  839. this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
  840. }
  841. }
  842. }
  843. for(let i=0;i<this.recordInfo.recordData.length;i++){
  844. for(let j=0;j<this.dealerList.length;j++){
  845. if(this.recordInfo.recordData[i].dealer == this.dealerList[j].dealer_name){
  846. this.recordInfo.recordData[i].dealer = this.dealerList[j].id
  847. }
  848. }
  849. this.recordInfo.recordData[i].warehousing_count = this.recordInfo.recordData[i].warehousing_count.toString()
  850. }
  851. const loading = this.$loading({
  852. lock: true,
  853. text: 'Loading',
  854. spinner: 'el-icon-loading',
  855. background: 'rgba(0, 0, 0, 0.7)'
  856. })
  857. const params = {
  858. 'stockIn': this.recordInfo.recordData
  859. }
  860. console.log("param232232323232323w",params)
  861. postWarehouse(params, this.warehousing_time, this.type,this.storehouse_id,this.warehousing_info_id).then(response => {
  862. if (response.data.state == 0) {
  863. this.loading = false
  864. this.$message.error(response.data.msg)
  865. loading.close()
  866. return false
  867. } else {
  868. loading.close()
  869. this.loading = false
  870. this.$message.success('保存成功')
  871. var list = response.data.data.list
  872. console.log("list2332323323",list)
  873. var dealerList = response.data.data.dealerList
  874. var manufacturerList = response.data.data.manufacturerList
  875. var info = response.data.data.info
  876. this.warehousing_info_id = info.id
  877. for(let i=0;i<list.length;i++){
  878. for(let j=0;j<dealerList.length;j++){
  879. if(list[i].dealer == dealerList[j].id){
  880. list[i].dealer = dealerList[j].dealer_name
  881. }
  882. }
  883. for(let s=0;s<manufacturerList.length;s++){
  884. if(list[i].manufacturer == manufacturerList[s].id){
  885. list[i].manufacturer = manufacturerList[s].manufacturer_name
  886. }
  887. }
  888. list[i].expiry_date = this.getTimeOne(list[i].expiry_date)
  889. list[i].product_date = this.getTimeOne(list[i].product_date)
  890. list[i].good_name = list[i].GoodInfo.good_name
  891. list[i].name = list[i].GoodInfo.specification_name +"/"+ list[i].GoodInfo.packing_unit
  892. list[i].good_code = list[i].good_code
  893. list[i].split_of_number = list[i].split_of_number
  894. }
  895. this.recordInfo.recordData = []
  896. this.recordInfo.recordData = list
  897. this.showCheck = true
  898. // this.$router.back(-1)
  899. }
  900. })
  901. } else {
  902. return false
  903. }
  904. })
  905. }
  906. ,
  907. changeManufacturer(val) {
  908. },
  909. changeDealer(val) {
  910. },
  911. getDataConfig(module, filed_name){
  912. return getDataConfig(module, filed_name)
  913. },
  914. querySearchAsync(keyword, cb) {
  915. let key = '';
  916. if (keyword != undefined) {
  917. key = keyword
  918. }
  919. postSearchGoodList(key,this.storehouse_id).then(response => {
  920. if (response.data.state == 1) {
  921. var list = response.data.data.list
  922. this.goodList = list
  923. var manufacturerList = response.data.data.manufacturerList
  924. this.manufacturerList = manufacturerList
  925. var dealer = response.data.data.dealerList
  926. this.dealerList = dealer
  927. for(let i=0;i<this.goodList.length;i++){
  928. for(let j=0;j<this.manufacturerList.length;j++){
  929. if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
  930. this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  931. }
  932. }
  933. }
  934. for(let i=0;i<this.goodList.length;i++){
  935. for(let j=0;j<this.dealerList.length;j++){
  936. if(this.goodList[i].dealer == this.dealerList[j].id){
  937. this.goodList[i].dealer = this.dealerList[j].dealer_name
  938. }
  939. }
  940. }
  941. cb(this.goodList)
  942. } else {
  943. cb([])
  944. }
  945. })
  946. },
  947. changeGoodName(val){
  948. this.currentIndex = val
  949. },
  950. handleSelect(val){
  951. console.log("al32323232323223",val)
  952. this.good_id = 0
  953. this.good_id = val.id
  954. for(let i=0;i<this.recordInfo.recordData.length;i++){
  955. if(this.currentIndex == i){
  956. this.recordInfo.recordData[i].id = 0
  957. this.recordInfo.recordData[i].good_name = val.good_name
  958. this.recordInfo.recordData[i].good_type_id = val.good_type_id
  959. this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
  960. this.recordInfo.recordData[i].manufacturer = val.manufacturer
  961. this.recordInfo.recordData[i].remark = val.remark
  962. this.recordInfo.recordData[i].license_number = val.number
  963. this.recordInfo.recordData[i].register_number = val.register_number
  964. if(val.buy_price == 0){
  965. this.recordInfo.recordData[i].price = "0"
  966. }else{
  967. this.recordInfo.recordData[i].price = val.buy_price
  968. }
  969. if(val.packing_price == 0){
  970. this.recordInfo.recordData[i].packing_price = "0"
  971. }else{
  972. this.recordInfo.recordData[i].packing_price = val.packing_price
  973. }
  974. this.recordInfo.recordData[i].specification_name = val.specification_name
  975. this.recordInfo.recordData[i].good_id = val.id
  976. this.recordInfo.recordData[i].packing_unit = val.packing_unit
  977. if(val.dealer == 0){
  978. this.recordInfo.recordData[i].dealer = ""
  979. }else{
  980. this.recordInfo.recordData[i].dealer = val.dealer
  981. }
  982. }
  983. }
  984. },
  985. getTimeOne(val) {
  986. if(val < 0){
  987. return ""
  988. }
  989. if(val == ""){
  990. return ""
  991. }else {
  992. return uParseTime(val, '{y}-{m}-{d}')
  993. }
  994. },
  995. toCheck(){
  996. const loading = this.$loading({
  997. lock: true,
  998. text: 'Loading',
  999. spinner: 'el-icon-loading',
  1000. background: 'rgba(0, 0, 0, 0.7)'
  1001. })
  1002. var params = {
  1003. warehousing_info_id:this.warehousing_info_id,
  1004. }
  1005. toCheckWarehouseInfo(params).then(response=>{
  1006. if(response.data.state == 1){
  1007. var list = response.data.data.list
  1008. // var total_one = response.data.data.total_one
  1009. // var total_two = response.data.data.total_two
  1010. // this.$message.success("审核成功!,追溯码成功"+total_one+"个"+"追溯码重复"+total_two+"个")
  1011. this.showCheck = false
  1012. this.showReturnCheck = true
  1013. this.$router.back(-1)
  1014. loading.close()
  1015. }else{
  1016. this.$message.error("审核失败")
  1017. loading.close()
  1018. }
  1019. })
  1020. },
  1021. toReturnCheck(){
  1022. const loading = this.$loading({
  1023. lock: true,
  1024. text: 'Loading',
  1025. spinner: 'el-icon-loading',
  1026. background: 'rgba(0, 0, 0, 0.7)'
  1027. })
  1028. var params = {
  1029. warehousing_info_id:this.warehousing_info_id,
  1030. }
  1031. toReturnCheckWarehouseInfo(params).then(response=>{
  1032. if(response.data.state == 1){
  1033. var list = response.data.data.list
  1034. this.$message.success("反审核成功!")
  1035. this.showCheck = true
  1036. this.showReturnCheck = false
  1037. loading.close()
  1038. this.$router.back(-1)
  1039. }else{
  1040. this.$message.error("反审核失败!")
  1041. loading.close()
  1042. }
  1043. })
  1044. },
  1045. getTotalPirce(){
  1046. var total_price = 0
  1047. if(this.recordInfo.recordData!=null && this.recordInfo.recordData.length>0){
  1048. for(let i=0;i<this.recordInfo.recordData.length;i++){
  1049. total_price += this.recordInfo.recordData[i].price * parseInt(this.recordInfo.recordData[i].warehousing_count)
  1050. }
  1051. if(total_price>0){
  1052. return total_price.toFixed(4)
  1053. }else{
  1054. return ""
  1055. }
  1056. }
  1057. },
  1058. changeGoodCode(row,index){
  1059. this.textarea=""
  1060. this.textarea = row.good_code
  1061. this.currentRow = row
  1062. this.currentIndex =index
  1063. this.dialogVisible = true
  1064. },
  1065. changeText(event){
  1066. // if (this.isChineseIME == false) {
  1067. // console.log("因为======英文",)
  1068. // }
  1069. // if (this.isChineseIME == true) {
  1070. // console.log("因为======中文")
  1071. // }
  1072. // var str = this.toHalfWidth(this.textarea)
  1073. // console.log("str===============",this.convertToHalfWidth(str))
  1074. // var newArr = []
  1075. // newArr.push(this.convertToHalfWidth(str).replace(/\s+/g, ""))
  1076. // console.log("newArr------",newArr)
  1077. // var normalizedSpace = this.fullWidthToHalfWidth(this.textarea);
  1078. // console.log("halfWidthStr",normalizedSpace);
  1079. // this.textarea = normalizedSpace
  1080. // 1. 转换为半角字符(英文输入法标准)
  1081. const halfWidth = this.textarea.replace(/[\uff01-\uff5e]/g, ch =>
  1082. String.fromCharCode(ch.charCodeAt(0) - 0xfee0)
  1083. );
  1084. // 2. 移除中文空格(全角空格转半角)
  1085. const normalizedSpace = halfWidth.replace(/\u3000/g, ' ');
  1086. var textAreaList = normalizedSpace.split(",")
  1087. console.log("textarealist====",textAreaList)
  1088. if (event.key === 'Enter') {
  1089. var textarea = ""
  1090. textarea += normalizedSpace + ","
  1091. var parts = textarea.split(',')
  1092. for(let i=0;i<textAreaList.length;i++){
  1093. if(parts[parts.length-2] == textAreaList[i]){
  1094. this.$message.error("该条码已经存在,不能重复扫码")
  1095. }
  1096. }
  1097. const uniqueStr = [...new Set(textarea.split(','))].join(',');
  1098. this.textarea = uniqueStr
  1099. }
  1100. },
  1101. saveTextArea(){
  1102. for(let i=0;i<this.recordInfo.recordData.length;i++){
  1103. if(this.currentIndex == i){
  1104. this.recordInfo.recordData[i].good_code = this.textarea
  1105. this.recordInfo.recordData[i].good_code_count = this.getTotal()
  1106. // 去除换行符
  1107. let noNewLineStr = this.textarea.replace(/\n/g, "");
  1108. // 按逗号分割成数组
  1109. let resultArray = noNewLineStr.split(",");
  1110. let arr = []
  1111. for(let c = 0; c < resultArray.length; c++){
  1112. if(resultArray[c] != ""){
  1113. arr.push(resultArray[c])
  1114. }
  1115. }
  1116. this.recordInfo.recordData[i].good_code_cnt = arr.length
  1117. }
  1118. }
  1119. if (this.checkDuplicates()) {
  1120. this.showDuplicateAlert = true
  1121. return
  1122. }
  1123. if(this.org_id == 10164 || this.org_id == 0){
  1124. this.getRepatGood(this.textarea)
  1125. this.showDuplicateAlertOne = true
  1126. }
  1127. this.dialogVisible = false
  1128. },
  1129. getCodeList() {
  1130. return this.textarea.replace(/\n/g,',') .split(',').map(item => item.trim()).filter(item => item !== '')
  1131. },
  1132. checkDuplicates() {
  1133. const codes = this.getCodeList()
  1134. const countMap = new Map()
  1135. this.duplicateList = []
  1136. this.duplicateCount = 0
  1137. // 统计出现次数
  1138. codes.forEach(code => {
  1139. countMap.set(code, (countMap.get(code) || 0) + 1)
  1140. })
  1141. // 找出重复项
  1142. countMap.forEach((count, code) => {
  1143. if (count > 1) {
  1144. this.duplicateList.push({
  1145. value: code,
  1146. count: count
  1147. })
  1148. this.duplicateCount += (count - 1)
  1149. }
  1150. })
  1151. return this.duplicateList.length > 0
  1152. },
  1153. getGoodCode(val){
  1154. var newArr = []
  1155. var total = 0
  1156. if(val!=undefined){
  1157. newArr = val.split(",")
  1158. total = newArr.length - 1
  1159. if(total >0){
  1160. return total
  1161. }else{
  1162. return ""
  1163. }
  1164. }
  1165. },
  1166. getRepatGood(val){
  1167. var params = {
  1168. good_str:val,
  1169. good_id:this.good_id,
  1170. }
  1171. getRepatGoodList(params).then(response=>{
  1172. if(response.data.state == 1){
  1173. var msg = response.data.data.msg
  1174. }else{
  1175. var msg = response.data.msg
  1176. console.log("msg-------------------",msg)
  1177. this.msg = msg
  1178. this.$message.error(msg)
  1179. }
  1180. })
  1181. },
  1182. toHalfWidth(str) {
  1183. return str.replace(/[0-9]/g, function(c) { // 转换数字
  1184. return String.fromCharCode(c.charCodeAt(0) - 0xfee0);
  1185. }).replace(/[A-zA-Z]/g, function(c) { // 转换英文字母
  1186. return String.fromCharCode(c.charCodeAt(0) - 0xfee0);
  1187. });
  1188. },
  1189. convertToHalfWidth(str) {
  1190. // 1. 替换所有全角括号为半角
  1191. str = str.replace(/[()]/g, c => c === '(' ? '(' : ')');
  1192. // 2. 处理特殊格式转换
  1193. str = str
  1194. // 处理 (01) 开头的特殊情况
  1195. .replace(/^\(11\)/, '(01)')
  1196. .replace(/^\(01\)/, '(01)')
  1197. // 处理 ()1) 转换为 (11)
  1198. .replace(/\(\)1\)/g, '(11)')
  1199. // 处理 ()7) 转换为 (17)
  1200. .replace(/\(\)7\)/g, '(17)')
  1201. // 处理 ()X) 的一般情况
  1202. .replace(/\(\)(\d)\)/g, '(1$1)');
  1203. // 3. 移除末尾多余的括号和数字
  1204. str = str.replace(/[)\d]+$/, '');
  1205. return str;
  1206. }
  1207. },
  1208. created() {
  1209. this.org_id = this.$store.getters.xt_user.org.id
  1210. var nowDate = new Date()
  1211. var nowYear = nowDate.getFullYear()
  1212. var nowMonth = nowDate.getMonth() + 1
  1213. var nowDay = nowDate.getDate()
  1214. this.warehousing_time =
  1215. nowYear +
  1216. '-' +
  1217. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1218. '-' +
  1219. (nowDay < 10 ? '0' + nowDay : nowDay)
  1220. const tempObj = {}
  1221. tempObj['good_type_id'] = 0
  1222. tempObj['good_id'] = 0
  1223. tempObj['number'] = ''
  1224. tempObj['product_date'] = ''
  1225. tempObj['expiry_date'] = ''
  1226. tempObj['warehousing_count'] = ''
  1227. tempObj['price'] = ''
  1228. tempObj['remark'] = ''
  1229. tempObj['dealer'] = ''
  1230. tempObj['manufacturer'] = ''
  1231. tempObj['good_unit'] = ''
  1232. tempObj['good_name'] = ''
  1233. tempObj['specification_name'] = ''
  1234. tempObj['name'] = ''
  1235. tempObj['license_number'] = ''
  1236. tempObj['packing_price']= ''
  1237. tempObj['id']= 0
  1238. tempObj['register_number'] = ''
  1239. tempObj['good_code'] = ''
  1240. tempObj['good_code_cnt'] = ''
  1241. tempObj['split_of_number'] = 24
  1242. this.recordInfo.recordData.push(tempObj)
  1243. this.GetConfigInfo()
  1244. this.propForm.goodUnit = this.$store.getters.good_unit
  1245. }
  1246. }
  1247. </script>
  1248. <style>
  1249. #oictable ::-webkit-scrollbar {
  1250. height: 15px;
  1251. }
  1252. </style>
  1253. <style rel="stylesheet/css" lang="scss" scoped>
  1254. .information {
  1255. border: 1px #dcdfe6 solid;
  1256. padding: 30px 20px 30px 20px;
  1257. .border {
  1258. border-bottom: 1px #dcdfe6 solid;
  1259. margin: 0px 0 20px 0;
  1260. }
  1261. }
  1262. .edit_separater {
  1263. border-top: 1px solid rgb(233, 233, 233);
  1264. margin-top: 15px;
  1265. margin-bottom: 15px;
  1266. }
  1267. </style>
  1268. <style>
  1269. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1270. font-size: 12px;
  1271. }
  1272. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1273. background: #6fb5fa;
  1274. }
  1275. .el-autocomplete-suggestion{
  1276. /* width: 400px !important; */
  1277. width: auto !important;
  1278. }
  1279. </style>