12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403 |
- <template>
-
- <div class="main-contain">
- <div class="position">
- <bread-crumb v-if="type == 1" :crumbs='crumbs'></bread-crumb>
- <bread-crumb v-if="type == 2" :crumbs='crumbs2'></bread-crumb>
-
- <div style="float:right;">
- <el-button size="small" @click="back()" class="filter-item">取 消</el-button>
- <el-button size="small" type="primary" @click="submit()" class="filter-item" v-loading="loading">保 存</el-button>
- <el-button size="small" type="primary" v-show="showCheck" @click="toCheck()" class="filter-item">审 核</el-button>
- <!-- <el-button size="small" type="primary" v-show="showReturnCheck" @click="toReturnCheck()" class="filter-item">反 审 核</el-button> -->
- </div>
- </div>
- <div class="app-container" v-loading="loading">
-
- <stock-in-dialog ref="dialog" :propForm="propForm"
- :visibility="isVisibility"
- v-on:dialog-comfirm="comfirm"
- v-on:dialog-cancle="cancle">
- </stock-in-dialog>
-
-
- <div class="cell clearfix">
- <label class="title"><span class="name"><span style="color:red">*</span>仓库</span> :</label>
- <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px">
- <el-option
- v-for="(option, index) in list"
- :key="index"
- :label="option.storehouse_name"
- :value="option.id">
- </el-option>
- </el-select>
- <label class="title"><span class="name">入库时间</span> : </label>
- <el-date-picker size="small" v-model="warehousing_time" prefix-icon="el-icon-date" :editable="false"
- style="width: 196px;" type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"></el-date-picker>
- </div>
-
-
- <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
- <el-table id="oictable" :data="recordInfo.recordData" :class="signAndWeighBoxPatients" border
- style="width: 100%"
- max-height="450" :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
- >
- <el-table-column align="center" width="200" fixed="left">
- <template slot="header" slot-scope="scope">
- <span>耗材名称</span>
- </template>
- <template slot-scope="scope">
- <el-autocomplete
- class="checkSearch"
- popper-class="my-autocomplete"
- v-model="scope.row.good_name"
- :fetch-suggestions="querySearchAsync"
- :trigger-on-focus="true"
- placeholder="请输入耗材名称"
- @select="handleSelect"
- @input="changeGoodName(scope.$index)"
- style="width:160px;"
- :popper-append-to-body="true"
- >
- <i class="el-icon-search el-input__icon" slot="suffix"></i>
- <template slot-scope="{ item }">
- <div class="name">{{ item.good_name +" " +item.specification_name + " "+item.manufacturer }}</div>
- </template>
- </el-autocomplete>
- </template>
- </el-table-column>
- <el-table-column align="center" width="140">
-
- <template slot="header" slot-scope="scope">
- <span>耗材类型<span style="color: red">*</span></span>
- </template>
-
- <template slot-scope="scope">
- <el-form-item style="padding-top: 20px;">
- <el-input placeholder="请输入耗材类型" v-model="scope.row.good_type_id" :value="typeName(scope.row.good_type_id)"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column align="center" width="140">
-
- <template slot="header" slot-scope="scope">
- <span>规格&单位<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
-
- <el-form-item style="padding-top: 20px">
- <el-input placeholder="请输入规格名称" v-model="scope.row.name"></el-input>
- </el-form-item>
-
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="150">
- <template slot="header" slot-scope="scope">
- <span>批号<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item style="padding-top: 20px" :prop="'recordData.' + scope.$index + '.number'"
- :rules='tableRules.number' >
- <el-input placeholder="请输入批号" v-model="scope.row.number"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
-
-
- <el-table-column align="center" width="120">
- <template slot="header" slot-scope="scope">
- <span>入库数量<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item :prop="'recordData.' + scope.$index + '.warehousing_count'"
- :rules='tableRules.warehousing_count' style="padding-top: 20px">
- <!-- <el-input placeholder="请输入入库数量" type="number" v-model="scope.row.warehousing_count" oninput="value=value.replace(/\D|^0/g,'')"></el-input> -->
- <el-input placeholder="请输入入库数量" v-model="scope.row.warehousing_count"></el-input>
- {{scope.row.min_unit}}
- </el-form-item>
-
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="200">
- <template slot="header" slot-scope="scope">
- <span>当前溯源码数量</span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'recordData.' + scope.$index + '.good_code_cnt'"
- style="padding-top: 10px"
- >
- <div style="display: flex">
- <el-input
- placeholder="请输入入库数量"
- v-model="scope.row.good_code_cnt"
- style="width: 120px"
- disabled
- ></el-input>
- </div>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="100">
- <template slot="header" slot-scope="scope">
- <span>拆零次数</span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- style="padding-top: 10px"
- >
- <div style="display: flex">
- <el-input
- type="number"
- placeholder="请输入入库数量"
- v-model="scope.row.split_of_number"
- style="width: 100px"
- ></el-input>
- </div>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="120">
- <template slot="header" slot-scope="scope">
- <span>零售价<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
-
- <el-form-item :prop="'recordData.' + scope.$index + '.packing_price'" :rules='tableRules.packing_price'
- style="padding-top: 20px">
- <el-input placeholder="请输入单价" type="number" v-model="scope.row.packing_price"></el-input>
- </el-form-item>
-
-
- </template>
- </el-table-column>
- <el-table-column align="center" width="120">
- <template slot="header" slot-scope="scope">
- <span>进货单价<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
-
- <el-form-item :prop="'recordData.' + scope.$index + '.price'" :rules='tableRules.price'
- style="padding-top: 20px">
- <el-input placeholder="请输入单价" type="number" v-model="scope.row.price"></el-input>
- </el-form-item>
-
-
- </template>
- </el-table-column>
-
- <el-table-column label="总价" align="center" width="80">
- <template slot-scope="scope">
- {{calculate(scope.row.price*scope.row.warehousing_count)}}
- </template>
- </el-table-column>
- <el-table-column align="center" width="180">
- <template slot="header" slot-scope="scope">
- <span>有效日期<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item :prop="'recordData.' + scope.$index + '.expiry_date'"
- :rules="tableRules.expiry_date">
- <el-date-picker prefix-icon="el-icon-date" style="width: 145px" v-model="scope.row.expiry_date"
- type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
- value-format="yyyy-MM-dd">
- </el-date-picker>
- </el-form-item>
- </template>
- </el-table-column>
-
-
- <el-table-column label="生产日期" align="center" width="180">
- <template slot-scope="scope">
- <el-date-picker prefix-icon="el-icon-date" v-model="scope.row.product_date" style="width: 145px"
- type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
- value-format="yyyy-MM-dd">
- </el-date-picker>
-
- </template>
- </el-table-column>
-
- <el-table-column label="生产厂家" align="center" width="150">
- <template slot-scope="scope">
- <el-select size="small" v-model="scope.row.manufacturer" filterable placeholder="请选择厂商">
- <el-option
- v-for="(option, index) in manufacturerList"
- :key="index"
- :label="option.manufacturer_name"
- :value="option.id">
- </el-option>
- </el-select>
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="150" v-if="org_id!=10653&&org_id!=0">
- <template slot="header" slot-scope="scope">
- <span>批准文号</span>
- </template>
- <template slot-scope="scope">
- <el-form-item style="padding-top: 20px">
- <el-input placeholder="请输入批准文号" v-model="scope.row.license_number" ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column align="center" width="150" v-if="org_id ==10653 || org_id == 0">
- <template slot="header" slot-scope="scope">
- <span>生产许可证号</span>
- </template>
- <template slot-scope="scope">
- <el-form-item style="padding-top: 20px">
- <el-input placeholder="请输入生产许可证号" v-model="scope.row.license_number" ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column align="center" width="150">
- <template slot="header" slot-scope="scope">
- <span>注册编码</span>
- </template>
- <template slot-scope="scope">
- <el-form-item style="padding-top: 20px">
- <el-input placeholder="请输入注册编码" v-model="scope.row.register_number" ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
-
-
- <el-table-column label="经销商" align="center" width="150">
- <template slot-scope="scope">
- <el-select size="small" v-model="scope.row.dealer" filterable placeholder="请选择厂商">
- <el-option
- v-for="(option, index) in dealerList"
- :key="index"
- :label="option.dealer_name"
- :value="option.id">
- </el-option>
- </el-select>
- </template>
- </el-table-column>
-
- <el-table-column label="耗材追溯码" align="center" width="150">
-
- <template slot-scope="scope">
- <div @click="changeGoodCode(scope.row,scope.$index)">
- <el-input v-model="scope.row.good_code" placeholder="请输入耗材追溯码"></el-input>
- </div>
- </template>
-
- </el-table-column>
-
- <el-table-column label="追溯码数量" align="center" width="150">
-
- <template slot-scope="scope">
- {{ getGoodCode(scope.row.good_code) }}
- </template>
-
- </el-table-column>
-
- <el-table-column label="备注" align="center" width="150">
- <template slot-scope="scope">
- <el-input placeholder="请输入备注" v-model="scope.row.remark"></el-input>
- </template>
- </el-table-column>
-
- <el-table-column label="操作" align="center" fixed="right" width="150">
- <template slot-scope="scope">
- <el-tooltip class="item" effect="dark" content="新增" placement="top">
-
- <el-button
- size="mini"
- type="primary"
- icon="el-icon-circle-plus-outline"
- @click="handleEdit(scope.$index, scope.row)">
- </el-button>
- </el-tooltip>
- <el-tooltip class="item" effect="dark" content="删除" placement="top">
-
- <el-button
- size="mini"
- type="danger"
- icon="el-icon-delete"
- @click="handleDelete(scope.$index, scope.row)">
- </el-button>
- </el-tooltip>
-
- </template>
- </el-table-column>
-
- </el-table>
-
- <div style="margin-top: 20px;">合计金额: {{getTotalPirce() }} </div>
- </el-form>
-
-
- </div>
-
- <el-dialog
- title="耗材追溯码"
- @open="openDialog"
- :visible.sync="dialogVisible"
- width="40%">
- <div style="margin-bottom: 10px;">
- <span >追溯码个数:{{getTotal() }} 个</span>
- </div>
- <span>
- <el-input
- ref="inputRef"
- inputmode="verbatim"
- @keyup.native="changeText"
- @paste.native.prevent="handlePaste"
- type="textarea"
- placeholder="请输入内容"
- v-model="textarea"
- :rows="10"
- >
- </el-input>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="saveTextArea()">确 定</el-button>
- </span>
- </el-dialog>
-
- <el-dialog
- title="重复值警告"
- :visible.sync="showDuplicateAlert"
- width="30%"
- append-to-body>
- <div v-for="(item, index) in duplicateList" :key="index">
- <el-alert
- :title="`重复值: ${item.value} (出现 ${item.count} 次)`"
- type="error"
- :closable="false"
- show-icon>
- </el-alert>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="showDuplicateAlert = false">我知道了</el-button>
- </span>
- </el-dialog>
-
- <el-dialog
- title="重复值警告"
- :visible.sync="showDuplicateAlertOne"
- width="30%"
- append-to-body>
- <span>{{ msg }}</span>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="showDuplicateAlertOne = false">我知道了</el-button>
- </span>
- </el-dialog>
- </div>
-
- </template>
-
- <script>
- import stockInDialog from './Dialog/stockInDialog'
- import { uParseTime } from '@/utils/tools'
- import {getDataConfig } from "@/utils/data";
- import {
- deleteWarehouseInfo,
- GetAllConfig,
- GetAllGoodInfo,
- GetAllGoodInfoByID,
- GetAllGoodType,
- getWarehouseInfoByOrdeNumber,
- modifyWarehouseInfo,
- postWarehouse,
- postSearchGoodList,
- toCheckWarehouseInfo,
- toReturnCheckWarehouseInfo,
- getRepatGoodList
- } from '@/api/stock'
- import BreadCrumb from '../components/bread-crumb'
-
- export default {
- components: { BreadCrumb, stockInDialog },
- name: 'stockIn',
-
- data() {
- var checkGoodId = (rule, value, callback) => {
- setTimeout(() => {
- if (value == '' || value == 0) {
- return callback(new Error('规格名称不能为空'))
- }
- }, 2000)
- }
-
- return {
- crumbs: [
- { path: false, name: '库存管理' },
- { path: false, name: '耗材入库单' },
- { path: false, name: '新增入库单' }
- ],
- crumbs2: [
- { path: false, name: '库存管理' },
- { path: false, name: '其他入库单' },
- { path: false, name: '新增入库单' }
- ],
- signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
- warehousing_time: '',
- adminUserOptions: null,
- currentIndex: 0,
-
- recordInfo: {
- recordData: [],
- stock_in_code: '',
- current_index: ''
-
- },
- tableRules: {
- price: [
- { required: true, message: '单价不能为空', trigger: 'blur' }
- ],
- packing_price: [
- { required: true, message: '零售价不能为空', trigger: 'blur' }
- ],
- warehousing_count: [
- { required: true, message: '数量不能为空', trigger: 'blur' }
- ],
-
- good_id: [
- { validator: checkGoodId, trigger: 'blur' }
- ],
- number:[
- { required: true, message: '批号不能为空', trigger: 'blur' }
- ],
- expiry_date:[
- { required: true, message: '有效日期不能为空', trigger: 'blur' }
- ],
-
- },
- type: this.$route.query.type,
- total: '',
- product_date: '',
- expiry_date: '',
- numbers: '',
-
- // prop
- isVisibility: false,
- propForm: {
- goods: [],
- goodType: [],
- goodInfo: [],
- goodUnit: [],
- title: '入库',
- formValue: {
- good_type_id: '',
- good_id: '',
- number: '',
- product_date: '',
- expiry_date: '',
- warehousing_count: '',
- price: '',
- remark: '',
- dealer: '',
- manufacturer: '',
- good_code:"",
- good_code_count:""
- },
- isCreated: 1
-
- },
-
- goodInfo: {
- loading: false,
- goodTypeData: [],
- type_code: ''
- },
- form: {
- manufacturer: '',
- dealer: ''
- },
-
- formValue: {
- good_type_id: '',
- good_id: '',
- number: '',
- product_date: '',
- expiry_date: '',
- warehousing_count: '',
- price: '',
- remark: '',
- dealer: '',
- manufacturer: ''
-
- },
-
- manufacturer: [],
- dealerList: [],
- goodType: [],
- manufacturerList:[],
- goodList:[],
- loading:false,
- list:[],
- storehouse_id:"",
- showCheck:false,
- showReturnCheck:false,
- warehousing_info_id:0,
- org_id:0,
- dialogVisible:false,
- currentRow:{},
- currentIndex:0,
- textarea:"",
- duplicateList:[],
- showDuplicateAlert:false,
- showDuplicateAlertOne:false,
- good_id:0,
- isComposing: false
- }
- },
- methods: {
-
- handleKeyDown(e) {
-
- },
-
- handlePaste(e) {
- e.preventDefault(); // 完全禁止粘贴,避免绕过输入限制
- this.$message.warning('扫码输入不支持粘贴');
- },
- getTotal(){
- if(this.textarea!=null){
- var textAreaList = this.textarea.split(",")
- console.log("textArrleti",textAreaList)
- var arr = []
- if(textAreaList!=null && textAreaList.length>0){
- for(let i=0;i<textAreaList.length;i++){
- if(textAreaList[i]!=""){
- arr.push(textAreaList[i])
- }
- }
- return arr.length
- }else{
- return ""
- }
-
- }
- },
- openDialog(){
- this.$nextTick(() => {
- this.$refs.inputRef.focus()
- });
- },
- handleSave: function() {
- if (this.recordInfo.recordData.length <= 0) {
- this.$message.error('请添加入库信息')
- return
- }
- sessionStorage.removeItem('warehousing_orders')
- this.$router.back(-1)
- }, handleCancle: function() {
- this.$confirm('是否放弃编辑返回上一页?', '放弃编辑', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- sessionStorage.removeItem('warehousing_orders')
- this.$router.back(-1)
- }).catch(() => {
-
- })
- }, handleCreate: function() {
-
- this.propForm.formValue = {}
- this.propForm.isCreated = 1
- this.isVisibility = true
- },
- comfirm: function(val) {
- this.propForm.goodType = []
- this.propForm.goods = []
-
- this.$refs.dialog.hide()
- console.log(val)
- if (val.selectedGoodInfo.length > 0) {
- for (let i = val.selectedGoodInfo.length - 1; i >= 0; i--) {
- if (i == 0) {
- this.recordInfo.recordData[this.currentIndex].good_type_id = val.selectedGoodInfo[i].good_type_id
- this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
- this.recordInfo.recordData[this.currentIndex].price = val.selectedGoodInfo[i].buy_price.toString()
- this.recordInfo.recordData[this.currentIndex].good_unit = val.selectedGoodInfo[i].good_unit
- this.recordInfo.recordData[this.currentIndex].good_name = val.selectedGoodInfo[i].good_name
- } else {
- const tempForm = {}
- tempForm['good_type_id'] =val.selectedGoodInfo[i].good_type_id
- tempForm['good_id'] = val.selectedGoodInfo[i].id
- tempForm['number'] = ''
- tempForm['product_date'] = ''
- tempForm['expiry_date'] = ''
- tempForm['warehousing_count'] = ''
- tempForm['price'] = val.selectedGoodInfo[i].buy_price.toString()
- tempForm['remark'] = ''
- tempForm['dealer'] = ''
- tempForm['manufacturer'] = ''
- tempForm['good_unit'] = val.selectedGoodInfo[i].good_unit
- tempForm['good_name'] = val.selectedGoodInfo[i].good_name
- this.recordInfo.recordData.splice(this.currentIndex + 1, 0, tempForm)
- }
- }
- }
-
- this.currentIndex = -1
- }, cancle: function() {
- this.propForm.goodType = []
- this.propForm.goods = []
- this.$refs.dialog.hide()
- },
- GetAllGoodType: function() {
- GetAllGoodType().then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- for (let i = 0; i < response.data.data.goodType.length; i++) {
- this.propForm.goodType.push(response.data.data.goodType[i])
- }
- }
- })
- },
- GetAllGoodInfo: function() {
- GetAllGoodInfo().then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- for (let i = 0; i < response.data.data.goodInfo.length; i++) {
- this.propForm.goodInfo.push(response.data.data.goodInfo[i])
- }
- }
- })
- },
- GetConfigInfo: function() {
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- })
-
- GetAllConfig().then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- this.manufacturer = response.data.data.manufacturer
- this.dealer = response.data.data.dealer
- this.goodType = response.data.data.goodType
- this.goodInfo = response.data.data.goodInfo
- this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: '全部' })
- this.dealer.splice(0, 0, { id: 0, dealer_name: '全部' })
- this.manufacturer.splice(0, 0, { id: -1, manufacturer_name: '其他' })
- this.dealer.splice(0, 0, { id: -1, dealer_name: '其他' })
- this.form.manufacturer = 0
- this.form.dealer = 0
- this.list = response.data.data.list
- this.storehouse_id = response.data.data.configlist.storehouse_info
- }
- loading.close()
-
- })
- }, typeName: function(good_type_id) {
- let name = ''
- for (let i = 0; i < this.goodType.length; i++) {
- if (this.goodType[i].id == good_type_id) {
- name = this.goodType[i].type_name
- }
- }
- return name
- }, specificationName: function(good_info_id) {
-
- let name = ''
- for (let i = 0; i < this.goodInfo.length; i++) {
- if (this.goodInfo[i].id == good_info_id) {
- name = this.goodInfo[i].specification_name
- }
- }
- return name
- },
- handleEdit: function(index, row) {
- const tempObj = {}
- tempObj['good_type_id'] = 0
- tempObj['good_id'] = 0
- tempObj['number'] = ''
- tempObj['product_date'] = ''
- tempObj['expiry_date'] = ''
- tempObj['warehousing_count'] = ''
- tempObj['price'] = ''
- tempObj['remark'] = ''
- tempObj['dealer'] = ''
- tempObj['manufacturer'] = ''
- tempObj['good_unit'] = ''
- tempObj['specification_name'] = ''
- tempObj['name'] = ''
- tempObj['license_number'] = ""
- tempObj["packing_price"] = ""
- tempObj["id"] = 0
- tempObj['register_number'] = ''
- tempObj['good_code'] = ""
- tempObj['good_code_cnt'] = ''
- tempObj["good_code_count"] =''
- tempObj['split_of_number'] = 24
- this.recordInfo.recordData.push(tempObj)
- }, handleDelete: function(index, row) {
- if (this.recordInfo.recordData.length <= 1) {
- this.$message.error('只有一条记录的时候无法删除')
- return
- } else {
- this.recordInfo.recordData.splice(index, 1)
- }
- },
- calculate: function(val) {
- if (val == 0) {
- return ''
- }
- return Math.round(parseFloat(val) * 100) / 100
- },
- GetWarehouseInfoByOrdeNumber: function() {
- const params = {
- 'warehousing_order': sessionStorage.getItem('warehousing_orders')
- }
- this.recordInfo.recordData = []
- getWarehouseInfoByOrdeNumber(params).then(response => {
- if (response.data.state != 0) {
-
- for (let i = 0; i < response.data.data.info.length; i++) {
- this.recordInfo.recordData.push(response.data.data.info[i])
- }
- console.log("333333333",this.recordInfo.recordData)
- }
- })
- }, getTime(val, temp) {
- if (val != 0) {
- return uParseTime(val, temp)
- } else {
- return ''
- }
- },
- showDialog(index, row) {
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- })
- this.currentIndex = index
- this.isVisibility = true
- const params = {
- manufacturer_id: this.form.manufacturer,
- dealer_id: this.form.dealer
- }
- this.propForm.goods = []
-
- GetAllGoodInfoByID(params).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- loading.close()
-
- } else {
- loading.close()
-
- if (response.data.data.goodInfo.length <= 0) {
- this.$message.error('该厂商或经销商没有物品信息')
- return
- }
- this.$refs.dialog.show()
- for (let i = 0; i < response.data.data.goodInfo.length; i++) {
- this.propForm.goodType.push(response.data.data.goodInfo[i].type)
- }
- const obj = {}
- this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
- obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
- return cur
- }, []) // 设置cur默认类型为数组,并且初始值为空的数组
- }
-
- for (let i = 0; i < this.propForm.goodType.length; i++) {
- let goodInfo = []
- let goodObj = {}
-
- for (let a = 0; a < response.data.data.goodInfo.length; a++) {
- var respObj = response.data.data.goodInfo[a]
- respObj['isSelected'] = false
- if (respObj.type.id == this.propForm.goodType[i].id) {
- goodInfo.push(respObj)
- }
- }
- const obj = {}
- goodInfo = goodInfo.reduce((cur, next) => {
- obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
- return cur
- }, []) // 设置cur默认类型为数组,并且初始值为空的数组
-
- this.$set(goodObj, this.propForm.goodType[i].id, goodInfo)
- this.propForm.goods.push(goodObj)
-
- }
- console.log( this.propForm.goods)
- }
- )
- },
- getSummaries(param) {
- const { columns, data } = param
- const sums = []
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = '总价'
- return
- }
- const values = data.map(item => Number(item[column.property]))
- if (!values.every(value => isNaN(value))) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr)
- if (!isNaN(value)) {
- return prev + curr
- } else {
- return prev
- }
- }, 0)
- sums[index] += ' 元'
- } else {
- sums[index] = 'N/A'
- }
- })
-
- return sums
- }
- ,
- back() {
- this.$router.go(-1)
- }
- ,
- submit() {
- this.$refs['tableForm'].validate((valid) => {
- if (valid) {
- this.loading = true
- const array = this.recordInfo.recordData
- if(this.storehouse_id == 0){
- this.$message.error("仓库不能为空!")
- return
- }
- for (let i = 0; i < array.length; i++) {
- if (array[i].good_type_id == 0) {
- this.$message.error('商品类型不能为空')
- return
- }
- array[i].price = array[i].price.toString()
- array[i].packing_price = array[i].packing_price.toString()
- }
-
- 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 ) {
- for (let i = 0; i < array.length; i++) {
- if (array[i].good_code.length == 0) {
- this.$message.error(array[i].good_name + " 溯源码不能为空");
- this.loading = false;
- return;
- }
-
-
- var aaa = array[i].good_code.split(",")
- if(new Set(aaa).size !== aaa.length){
- this.$message.error( array[i].good_name + " 溯源码不能重复");
- this.loading = false;
- return;
-
- }
- }
- }
-
-
- if(this.recordInfo.recordData.length <= 0){
- this.$message.success('请添加入库商品')
- return
- }
-
- for(let i=0;i<this.recordInfo.recordData.length;i++){
- if(this.recordInfo.recordData[i].dealer == ""){
- this.recordInfo.recordData[i].dealer = 0
- }
-
- if(this.recordInfo.recordData[i].split_of_number>0){
- this.recordInfo.recordData[i].split_of_number = parseInt(this.recordInfo.recordData[i].split_of_number)
- }else{
- this.recordInfo.recordData[i].split_of_number=0
- }
- for(let j=0;j<this.manufacturerList.length;j++){
- if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
-
- this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
- }
- }
- }
-
- for(let i=0;i<this.recordInfo.recordData.length;i++){
- for(let j=0;j<this.dealerList.length;j++){
- if(this.recordInfo.recordData[i].dealer == this.dealerList[j].dealer_name){
- this.recordInfo.recordData[i].dealer = this.dealerList[j].id
- }
- }
- this.recordInfo.recordData[i].warehousing_count = this.recordInfo.recordData[i].warehousing_count.toString()
- }
-
-
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- })
- const params = {
- 'stockIn': this.recordInfo.recordData
- }
- console.log("param232232323232323w",params)
-
- postWarehouse(params, this.warehousing_time, this.type,this.storehouse_id,this.warehousing_info_id).then(response => {
- if (response.data.state == 0) {
- this.loading = false
- this.$message.error(response.data.msg)
- loading.close()
- return false
- } else {
- loading.close()
- this.loading = false
- this.$message.success('保存成功')
- var list = response.data.data.list
- console.log("list2332323323",list)
- var dealerList = response.data.data.dealerList
- var manufacturerList = response.data.data.manufacturerList
- var info = response.data.data.info
- this.warehousing_info_id = info.id
- for(let i=0;i<list.length;i++){
- for(let j=0;j<dealerList.length;j++){
- if(list[i].dealer == dealerList[j].id){
- list[i].dealer = dealerList[j].dealer_name
- }
- }
- for(let s=0;s<manufacturerList.length;s++){
- if(list[i].manufacturer == manufacturerList[s].id){
- list[i].manufacturer = manufacturerList[s].manufacturer_name
- }
- }
- list[i].expiry_date = this.getTimeOne(list[i].expiry_date)
- list[i].product_date = this.getTimeOne(list[i].product_date)
- list[i].good_name = list[i].GoodInfo.good_name
- list[i].name = list[i].GoodInfo.specification_name +"/"+ list[i].GoodInfo.packing_unit
- list[i].good_code = list[i].good_code
- list[i].split_of_number = list[i].split_of_number
- }
- this.recordInfo.recordData = []
- this.recordInfo.recordData = list
- this.showCheck = true
- // this.$router.back(-1)
- }
- })
- } else {
- return false
- }
- })
- }
- ,
- changeManufacturer(val) {
-
- },
- changeDealer(val) {
-
- },
- getDataConfig(module, filed_name){
- return getDataConfig(module, filed_name)
- },
- querySearchAsync(keyword, cb) {
- let key = '';
- if (keyword != undefined) {
- key = keyword
- }
- postSearchGoodList(key,this.storehouse_id).then(response => {
- if (response.data.state == 1) {
-
- var list = response.data.data.list
-
- this.goodList = list
- var manufacturerList = response.data.data.manufacturerList
- this.manufacturerList = manufacturerList
- var dealer = response.data.data.dealerList
- this.dealerList = dealer
- for(let i=0;i<this.goodList.length;i++){
- for(let j=0;j<this.manufacturerList.length;j++){
- if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
- this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
- }
- }
- }
-
- for(let i=0;i<this.goodList.length;i++){
- for(let j=0;j<this.dealerList.length;j++){
- if(this.goodList[i].dealer == this.dealerList[j].id){
- this.goodList[i].dealer = this.dealerList[j].dealer_name
- }
- }
- }
-
- cb(this.goodList)
- } else {
- cb([])
- }
- })
- },
- changeGoodName(val){
- this.currentIndex = val
- },
- handleSelect(val){
- console.log("al32323232323223",val)
- this.good_id = 0
- this.good_id = val.id
- for(let i=0;i<this.recordInfo.recordData.length;i++){
- if(this.currentIndex == i){
- this.recordInfo.recordData[i].id = 0
- this.recordInfo.recordData[i].good_name = val.good_name
- this.recordInfo.recordData[i].good_type_id = val.good_type_id
- this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
- this.recordInfo.recordData[i].manufacturer = val.manufacturer
- this.recordInfo.recordData[i].remark = val.remark
- this.recordInfo.recordData[i].license_number = val.number
- this.recordInfo.recordData[i].register_number = val.register_number
- if(val.buy_price == 0){
- this.recordInfo.recordData[i].price = "0"
- }else{
- this.recordInfo.recordData[i].price = val.buy_price
- }
-
- if(val.packing_price == 0){
- this.recordInfo.recordData[i].packing_price = "0"
- }else{
- this.recordInfo.recordData[i].packing_price = val.packing_price
- }
-
- this.recordInfo.recordData[i].specification_name = val.specification_name
- this.recordInfo.recordData[i].good_id = val.id
- this.recordInfo.recordData[i].packing_unit = val.packing_unit
- if(val.dealer == 0){
- this.recordInfo.recordData[i].dealer = ""
- }else{
- this.recordInfo.recordData[i].dealer = val.dealer
- }
-
- }
- }
- },
- getTimeOne(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d}')
- }
- },
- toCheck(){
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- })
-
- var params = {
- warehousing_info_id:this.warehousing_info_id,
- }
- toCheckWarehouseInfo(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- // var total_one = response.data.data.total_one
- // var total_two = response.data.data.total_two
- // this.$message.success("审核成功!,追溯码成功"+total_one+"个"+"追溯码重复"+total_two+"个")
- this.showCheck = false
- this.showReturnCheck = true
- this.$router.back(-1)
- loading.close()
- }else{
- this.$message.error("审核失败")
- loading.close()
- }
- })
- },
- toReturnCheck(){
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- })
- var params = {
- warehousing_info_id:this.warehousing_info_id,
- }
- toReturnCheckWarehouseInfo(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- this.$message.success("反审核成功!")
- this.showCheck = true
- this.showReturnCheck = false
- loading.close()
- this.$router.back(-1)
- }else{
- this.$message.error("反审核失败!")
- loading.close()
- }
- })
- },
- getTotalPirce(){
-
- var total_price = 0
- if(this.recordInfo.recordData!=null && this.recordInfo.recordData.length>0){
-
- for(let i=0;i<this.recordInfo.recordData.length;i++){
- total_price += this.recordInfo.recordData[i].price * parseInt(this.recordInfo.recordData[i].warehousing_count)
- }
-
- if(total_price>0){
- return total_price.toFixed(4)
- }else{
- return ""
- }
- }
- },
- changeGoodCode(row,index){
-
- this.textarea=""
- this.textarea = row.good_code
- this.currentRow = row
- this.currentIndex =index
- this.dialogVisible = true
- },
- changeText(event){
-
- // 1. 转换为半角字符(英文输入法标准)
- const halfWidth = this.textarea.replace(/[\uff01-\uff5e]/g, ch =>
- String.fromCharCode(ch.charCodeAt(0) - 0xfee0)
- );
-
- // 2. 移除中文空格(全角空格转半角)
- const normalizedSpace = halfWidth.replace(/\u3000/g, ' ');
-
-
- // const fullToHalfMap = {
- // '(': '(', ')': ')',
- // '0': '0', '1': '1', '2': '2', '3': '3', '4': '4',
- // '5': '5', '6': '6', '7': '7', '8': '8', '9': '9',
- // 'A': 'A', 'B': 'B', 'C': 'C', 'D': 'D', 'E': 'E',
- // 'F': 'F', 'G': 'G', 'H': 'H', 'I': 'I', 'J': 'J',
- // 'K': 'K', 'L': 'L', 'M': 'M', 'N': 'N', 'O': 'O',
- // 'P': 'P', 'Q': 'Q', 'R': 'R', 'S': 'S', 'T': 'T',
- // 'U': 'U', 'V': 'V', 'W': 'W', 'X': 'X', 'Y': 'Y',
- // 'Z': 'Z', 'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd',
- // 'e': 'e', 'f': 'f', 'g': 'g', 'h': 'h', 'i': 'i',
- // 'j': 'j', 'k': 'k', 'l': 'l', 'm': 'm', 'n': 'n',
- // 'o': 'o', 'p': 'p', 'q': 'q', 'r': 'r', 's': 's',
- // 't': 't', 'u': 'u', 'v': 'v', 'w': 'w', 'x': 'x',
- // 'y': 'y', 'z': 'z'
- // };
-
- // // 2. 执行转换
- // let result = '';
- // for (const char of this.textarea) {
- // result += fullToHalfMap[char] || char;
- // }
-
- // // 3. 提取标准格式数据
- // const normalizedSpace = result.match(/(\(\d{2}\)[\dA-Za-z]+)+/g);
-
- // console.log("normalizedSpace---",normalizedSpace[0])
-
-
- var textAreaList = normalizedSpace.split(",")
- if (event.key === 'Enter') {
- var textarea = ""
- textarea += normalizedSpace.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
- var parts = textarea.split(',')
- for(let i=0;i<textAreaList.length;i++){
- if(parts[parts.length-2] == textAreaList[i]){
- this.$message.error("该条码已经存在,不能重复扫码")
- }
- }
- const uniqueStr = [...new Set(textarea.split(','))].join(',');
- this.textarea = uniqueStr
- }
- },
- saveTextArea(){
- for(let i=0;i<this.recordInfo.recordData.length;i++){
- if(this.currentIndex == i){
- this.recordInfo.recordData[i].good_code = this.textarea
- this.recordInfo.recordData[i].good_code_count = this.getTotal()
- // 去除换行符
- let noNewLineStr = this.textarea.replace(/\n/g, "");
- // 按逗号分割成数组
- let resultArray = noNewLineStr.split(",");
- let arr = []
- for(let c = 0; c < resultArray.length; c++){
- if(resultArray[c] != ""){
- arr.push(resultArray[c])
- }
- }
- this.recordInfo.recordData[i].good_code_cnt = arr.length
-
- }
- }
- if (this.checkDuplicates()) {
- this.showDuplicateAlert = true
- return
- }
-
- // if(this.org_id == 10164 || this.org_id == 0){
-
- // this.getRepatGood(this.textarea)
- // this.showDuplicateAlertOne = true
- // }
-
- this.dialogVisible = false
- },
- getCodeList() {
- return this.textarea.replace(/\n/g,',') .split(',').map(item => item.trim()).filter(item => item !== '')
- },
- checkDuplicates() {
- const codes = this.getCodeList()
- const countMap = new Map()
- this.duplicateList = []
- this.duplicateCount = 0
-
- // 统计出现次数
- codes.forEach(code => {
- countMap.set(code, (countMap.get(code) || 0) + 1)
- })
-
- // 找出重复项
- countMap.forEach((count, code) => {
- if (count > 1) {
- this.duplicateList.push({
- value: code,
- count: count
- })
- this.duplicateCount += (count - 1)
- }
- })
- return this.duplicateList.length > 0
- },
- getGoodCode(val){
- var newArr = []
- var total = 0
- if(val!=undefined){
- newArr = val.split(",")
- total = newArr.length - 1
- if(total >0){
- return total
- }else{
- return ""
- }
- }
- },
- getRepatGood(val){
- var params = {
- good_str:val,
- good_id:this.good_id,
- }
- getRepatGoodList(params).then(response=>{
- if(response.data.state == 1){
- var msg = response.data.data.msg
- }else{
- var msg = response.data.msg
- this.msg = msg
- this.$message.error(msg)
- }
- })
- }
- }
- ,
- created() {
- this.org_id = this.$store.getters.xt_user.org.id
- var nowDate = new Date()
- var nowYear = nowDate.getFullYear()
- var nowMonth = nowDate.getMonth() + 1
- var nowDay = nowDate.getDate()
- this.warehousing_time =
- nowYear +
- '-' +
- (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
- '-' +
- (nowDay < 10 ? '0' + nowDay : nowDay)
- const tempObj = {}
- tempObj['good_type_id'] = 0
- tempObj['good_id'] = 0
- tempObj['number'] = ''
- tempObj['product_date'] = ''
- tempObj['expiry_date'] = ''
- tempObj['warehousing_count'] = ''
- tempObj['price'] = ''
- tempObj['remark'] = ''
- tempObj['dealer'] = ''
- tempObj['manufacturer'] = ''
- tempObj['good_unit'] = ''
- tempObj['good_name'] = ''
- tempObj['specification_name'] = ''
- tempObj['name'] = ''
- tempObj['license_number'] = ''
- tempObj['packing_price']= ''
- tempObj['id']= 0
- tempObj['register_number'] = ''
- tempObj['good_code'] = ''
- tempObj['good_code_cnt'] = ''
- tempObj['split_of_number'] = 24
-
-
- this.recordInfo.recordData.push(tempObj)
- this.GetConfigInfo()
- this.propForm.goodUnit = this.$store.getters.good_unit
- }
-
- }
- </script>
-
- <style>
- #oictable ::-webkit-scrollbar {
- height: 15px;
- }
- </style>
-
- <style rel="stylesheet/css" lang="scss" scoped>
- .information {
- border: 1px #dcdfe6 solid;
- padding: 30px 20px 30px 20px;
-
- .border {
- border-bottom: 1px #dcdfe6 solid;
- margin: 0px 0 20px 0;
- }
-
- }
-
- .edit_separater {
- border-top: 1px solid rgb(233, 233, 233);
- margin-top: 15px;
- margin-bottom: 15px;
- }
-
-
- </style>
-
- <style>
- .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
- font-size: 12px;
- }
-
- .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
- background: #6fb5fa;
- }
- .el-autocomplete-suggestion{
- /* width: 400px !important; */
- width: auto !important;
- }
-
-
- </style>
|