123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545 |
- <template>
- <div>
- <el-button
- style="float: right"
- size="small"
- icon="el-icon-printer"
- @click="PrintAction"
- type="primary"
- >打印
- </el-button>
-
-
-
-
- <el-button
- style="float: right;margin-right:10px"
- size="small"
- @click="exportListDetal"
- type="primary"
- >明细导出
- </el-button>
-
- <el-button
- style="float: right;margin-right:10px"
- size="small"
- @click="exportList"
- type="primary"
- >汇总导出
- </el-button>
-
- <div class="cell clearfix">
- <label class="title"><span class="name">仓库</span> :</label>
- <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:100px" @change="changeHouseList">
- <el-option
- v-for="(option, index) in houseList"
- :key="index"
- :label="option.storehouse_name"
- :value="option.id">
- </el-option>
- </el-select>
-
- <el-input
- size="small"
- style="width: 180px;"
- class="filter-item"
- v-model.trim="searchKey"
- placeholder="单据编码/制单人/规格名称/耗材名称"
- />
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- @click="search"
- >搜索</el-button
- >
-
-
-
-
-
-
- <label class="title"><span class="name">日期查询</span> : </label>
- <el-date-picker
- size="small"
- v-model="start_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 150px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
-
- ></el-date-picker>
- <span class="cellLine"> - </span>
- <el-date-picker
- size="small"
- v-model="end_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 150px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- @click="getAllQuery"
- >查询</el-button
- >
- </div>
-
- <div style="margin-bottom: 10px;">
- <label class="title"><span class="name">耗材名称</span> : </label>
- <el-autocomplete
- class="checkSearch"
- popper-class="my-autocomplete"
- v-model="good_name"
- :fetch-suggestions="querySearchAsync"
- :trigger-on-focus="true"
- placeholder="请输入耗材名称"
- @select="handleSelect"
- style="width:500px;"
- :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>
-
- <el-button
- style="float: right"
- size="small"
- icon="el-icon-printer"
- @click="BatchPrintAction"
- type="primary"
- >批量打印
- </el-button>
- </div>
-
- <!-- <el-row :gutter="12" style="margin-top: 10px"> -->
- <div style="width: 100%;">
- <el-table
- class="table"
- :data="cancelStockDate"
- :class="signAndWeighBoxPatients"
- border
- highlight-current-row
- ref="multipleTable"
- height="calc(100vh - 300px)"
- @selection-change="select"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- >
- <el-table-column label="单据编号" align="center" width="200">
- <template slot-scope="scope">
- {{ scope.row.warehousing_order }}
- </template>
- </el-table-column>
-
- <el-table-column label="耗材类型" align="center">
- <template slot-scope="scope">
- {{ typeName(scope.row.good_type_id) }}
- </template>
- </el-table-column>
-
- <el-table-column label="耗材批次" align="center">
- <template slot-scope="scope">
- {{ scope.row.number }}
- </template>
- </el-table-column>
-
- <el-table-column label="耗材名称" align="center">
- <template slot-scope="scope">
- {{ typeNameOne(scope.row.good_id) }}
-
- </template>
- </el-table-column>
-
- <el-table-column label="规格型号" align="center">
- <template slot-scope="scope">
- {{ specificationName(scope.row.good_id) }}
-
- </template>
- </el-table-column>
-
- <el-table-column label="生产厂商" align="center">
- <template slot-scope="scope">
- {{ getManufactuerName(scope.row.manufacturer) }}
- </template>
- </el-table-column>
-
- <!-- <el-table-column label="进销商" align="center">
- <template slot-scope="scope">
- {{ getDealerName(scope.row.dealer) }}
- </template>
- </el-table-column> -->
-
- <el-table-column label="操作时间" align="center">
- <template slot-scope="scope">
- {{ getTime(scope.row.Warehousing.warehousing_time) }}
- </template>
- </el-table-column>
- <el-table-column label="制单人" align="center">
- <template slot-scope="scope">
- {{ getXuserName(scope.row.Warehousing.creater) }}
- </template>
- </el-table-column>
- <el-table-column label="仓库名称" align="center">
- <template slot-scope="scope">
- {{getStorehouseName(scope.row.storehouse_id) }}
- </template>
- </el-table-column>
- <el-table-column label="进货价" align="center">
- <template slot-scope="scope">
- {{ scope.row.price }}
- </template>
- </el-table-column>
- <el-table-column label="数量" align="center">
- <template slot-scope="scope">
- {{ scope.row.warehousing_count }}
- </template>
- </el-table-column>
- <el-table-column label="总价" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.is_total == 0">{{
- getTotal(scope.row.price, scope.row.warehousing_count)
- }}</span>
- <span v-else>{{ scope.row.total }}</span>
- </template>
- </el-table-column>
-
- <el-table-column label="耗材追溯码" align="center">
- <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">
- <template slot-scope="scope">
- {{ getGoodCode(scope.row.good_code) }}
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 50, 100,500,1000]"
- :page-size="10"
- background
- style="margin-top:20px;float: right"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
-
- <div>
-
- <el-dialog
- title="入库记录"
- :visible.sync="dialogVisible"
- width="80%"
- top="5vh"
- :close-on-click-modal="false"
- >
- <!-- 查询条件区域 -->
- <div class="filter-container">
- <el-row :gutter="20">
- <el-col :span="8">
- <span class="demonstration">日期查询:</span>
- <el-date-picker
- size="small"
- v-model="listQuery.start_time"
- prefix-icon="el-icon-date"
- @change="changeStartTime"
- :editable="false"
- style="width: 196px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- :picker-options="pickerOptions"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- -
- <el-date-picker
- size="small"
- v-model="listQuery.end_time"
- prefix-icon="el-icon-date"
- @change="changeEndTime"
- :editable="false"
- style="width: 196px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- :picker-options="pickerOptions"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- </el-col>
- <el-col :span="8">
- <el-autocomplete
- class="checkSearch"
- popper-class="my-autocomplete"
- v-model="good_name"
- :fetch-suggestions="querySearchAsync"
- :trigger-on-focus="true"
- placeholder="请输入耗材名称"
- @select="handleSelectOne"
- style="width:400px;"
- :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>
-
- </el-col>
- <el-col :span="2">
- <el-button type="primary" @click="handleQuery" style="width: 100%">查询</el-button>
- </el-col>
- </el-row>
- </div>
-
- <!-- 操作按钮区域 -->
- <div class="operation-buttons" style="margin-bottom: 10px;">
- <el-button type="primary" @click="toGoodPrint">打印</el-button>
- <!-- <el-button type="primary" @click="toPrint">导出</el-button> -->
- </div>
-
- <!-- 表格区域 -->
- <el-table
- :data="tablePrintData"
- border
- style="width: 100%"
- height="60vh"
- v-loading="loading"
- @selection-change="batchSelect"
- element-loading-text="数据加载中"
- >
- <el-table-column align="center" type="selection" width="55">
- </el-table-column>
- <el-table-column prop="index" label="序号" width="60" align="center">
- <template slot-scope="scope">
- {{ scope.$index+1 }}
- </template>
- </el-table-column>
-
- <el-table-column prop="medicalCode" label="医保编码" width="200" align="center">
- <template slot-scope="scope">
- {{ getSocialSecurityDirectoryCode(scope.row.good_id) }}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="耗材名称" width="180" align="center">
- <template slot-scope="scope">
- {{ getGoodName(scope.row.good_id) }}
- </template>
- </el-table-column>
- <el-table-column prop="specification" label="耗材规格" width="200" align="center">
- <template slot-scope="scope">
- {{ getSpecificationName(scope.row.good_id) }}
- </template>
- </el-table-column>
- <el-table-column prop="unit" label="单位" width="80" align="center">
- <template slot-scope="scope">
- {{ getPackingUnit(scope.row.good_id) }}
- </template>
- </el-table-column>
- <el-table-column prop="batchNumber" label="批号" width="120" align="center">
- <template slot-scope="scope">
- {{ scope.row.number }}
- </template>
- </el-table-column>
- <el-table-column prop="productionDate" label="生产日期" width="120" align="center">
- <template slot-scope="scope">
- {{ getTime(scope.row.product_date) }}
- </template>
- </el-table-column>
- <el-table-column prop="expiryDate" label="有效日期" width="120" align="center">
- <template slot-scope="scope">
- {{ getTime(scope.row.expiry_date) }}
- </template>
- </el-table-column>
- <el-table-column prop="purchasePrice" label="进货单价" width="100" align="center">
- <template slot-scope="scope">
- {{ scope.row.price }}
- </template>
- </el-table-column>
-
- <el-table-column prop="stockQuantity" label="入库数量" width="100" align="center">
- <template slot-scope="scope">
- {{ scope.row.warehousing_count }}
- </template>
- </el-table-column>
- <el-table-column prop="stockAmount" label="入库金额" width="120" align="center">
- <template slot-scope="scope">
- {{ (scope.row.price * scope.row.warehousing_count).toFixed(2) }}
- </template>
- </el-table-column>
-
- <el-table-column prop="purchasePrice" label="零售价" width="100" align="center">
- <template slot-scope="scope">
- {{ scope.row.packing_price }}
- </template>
- </el-table-column>
-
- <el-table-column prop="purchasePrice" label="生产厂家" width="100" align="center">
- <template slot-scope="scope">
- {{getManufactuerName(scope.row.manufacturer) }}
- </template>
- </el-table-column>
-
- <el-table-column prop="purchasePrice" label="经销商" width="100" align="center">
- <template slot-scope="scope">
- {{getDealerName(scope.row.dealer_name) }}
- </template>
- </el-table-column>
-
- <el-table-column prop="purchasePrice" label="入库时间" width="100" align="center">
- <template slot-scope="scope">
- {{getTime(scope.row.ctime) }}
- </template>
- </el-table-column>
-
- <el-table-column prop="purchasePrice" label="备注" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.remark }}
- </template>
- </el-table-column>
- </el-table>
-
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">关闭</el-button>
- </div>
- </el-dialog>
- </div>
-
- <good-print
- ref="goodPrint"
- :visibility="isVisibility"
- :propsTable="propsTable"
- >
- </good-print>
-
- <el-dialog
- title="耗材追溯码"
- :visible.sync="dialogVisibleCode"
- width="40%">
- <div style="margin-bottom: 10px;">
- <span >追溯码个数:{{getGoodTotal() }} 个</span>
- </div>
- <span>
- <el-input
- @keyup.native="changeText"
- type="textarea"
- placeholder="请输入内容"
- v-model="textarea"
- :rows="10"
- >
- </el-input>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisibleCode = false">取 消</el-button>
- <el-button type="primary" @click="saveTextArea()">确 定</el-button>
- </span>
- </el-dialog>
-
- </div>
-
-
- </template>
-
- <script>
- import goodPrint from "../goodPrint.vue";
- const moment = require('moment')
- import { uParseTime } from "@/utils/tools";
- import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
- import {
- deleteCancelStock,
- GetAllConfig,
- getStockDetail,
- getPrintStockGood,
- getGoodDetailPrintList,
- postSearchGoodList,
- getGoodWarehosueInPrintList,
- changeGoodWarehouseInfo
- } from "@/api/stock";
-
- export default {
- name: "stockInDetail",
- components: {
- goodPrint,
- },
- created() {
-
- var nowDate = new Date();
- var nowYear = nowDate.getFullYear();
- var nowMonth = nowDate.getMonth() + 1;
- var nowDay = nowDate.getDate();
- this.end_time =
- nowYear +
- "-" +
- (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
- "-" +
- (nowDay < 10 ? "0" + nowDay : nowDay);
- nowDate.setMonth(nowDate.getMonth() - 1);
- nowYear = nowDate.getFullYear();
- nowMonth = nowDate.getMonth() + 1;
- nowDay = nowDate.getDate();
- this.start_time =
- nowYear +
- "-" +
- (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
- "-" +
- (nowDay < 10 ? "0" + nowDay : nowDay);
- var start_time = window.sessionStorage.getItem('start_time')
- var end_time = window.sessionStorage.getItem('end_time')
- if(start_time !=null){
- this.start_time = start_time
- }
- if(end_time!=null){
- this.end_time = end_time
- }
- window.sessionStorage.removeItem('start_time')
- window.sessionStorage.removeItem('end_time')
- this.GetCancelStock();
- this.GetConfigInfo();
- this.fetchAllAdminUsers();
- this.goodUnit = this.$store.getters.good_unit
- this.org_id = this.$store.getters.xt_user.template_info.org_id
-
- this.getGoodDetailPrintList()
- },
- data() {
- return {
- orderTypeArr: [
- { value: 1, label: "耗材入库单" },
- { value: 2, label: "其他入库单" }
- ],
- newDate: [{ name: "合计", num: "111111" }],
- good_name:"",
- searchKey: "",
- type: 1,
- page: 1,
- limit: 10,
- manufacturer_id: "",
- dealer_id: "",
- order_type: "",
- checked: false,
- total: 0,
- pageTotal: 0,
- pageSelect: 0,
- adminUserOptions: [],
- multipleSelection: [],
- signAndWeighBoxPatients: "sign-and-weigh-box-patients",
- start_time: "",
- cancelStockDate: [],
- end_time: "",
- goodType: [],
- goodInfo: [],
- manufacturer: [],
- selectedTableData: [],
- dealer: [],
- tableList:[],
- goodUnit:[],
- stockTotal:[],
- org_id:0,
- tableInfo:[],
- tableDataList:[],
- houseList:[],
- storehouse_id:0,
- manufacturerList:[],
- dealerList:[],
- currentIndex:0,
- good_id:0,
- goodKindList:[],
- dialogVisible:false,
- loading: false,
- queryParams: {
- dateRange: [],
- itemType: '',
- stockType: '',
- keyword: ''
- },
- listQuery:{
- start_time: moment().startOf('month').format('YYYY-MM-DD'),
- end_time:moment().endOf('month').format('YYYY-MM-DD')
- },
- tableData: [],
- pagination: {
- currentPage: 1,
- pageSize: 20,
- total: 0
- },
- tablePrintData:[],
- goodList:[],
- goodsType:[],
- idsList:[],
- printData:[],
- isVisibility: "",
- propsTable: "",
- textarea:"",
- currentRow:{},
- currentIndex:0,
- dialogVisibleCode:false,
- id:0,
- };
- },
- methods: {
- getGoodCode(val){
- var newArr = []
- var total = 0
- if(val!=undefined){
- newArr = val.split(",")
- total = newArr.length - 1
- if(total >0){
- return total
- }else{
- return ""
- }
- }
-
- },
- changeText(event){
- // 检查是否为特定的按键,例如回车键,来确认扫码枪输入完成
- var textAreaList = this.textarea.split(",")
- if (event.key === 'Enter') {
- var textarea = ""
- textarea += this.textarea.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
- }
-
- },
- getGoodTotal(){
- if(this.textarea!=null){
- var textAreaList = this.textarea.split(",")
- 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 ""
- }
-
- }
- },
- saveTextArea(){
- var params = {
- id:this.id,
- good_code:this.textarea
- }
- changeGoodWarehouseInfo(params).then(response=>{
- if(response.data.state == 1){
- this.$message.success("保存成功")
- for(let i=0;i<this.cancelStockDate.length;i++){
- if(this.currentIndex == i){
- this.cancelStockDate[i].good_code = this.textarea
- }
- }
- this.dialogVisibleCode = false
- }
- })
-
- },
- changeGoodCode(row,index){
- this.id = 0
- this.id = row.id
- this.textarea=""
- this.textarea = row.good_code
- this.currentRow = row
- this.currentIndex =index
- this.dialogVisibleCode = true
- },
- changeStartTime(){
-
- },
- changeEndTime(){
-
- },
- pickerOptions(){
-
- },
- toGoodPrint() {
- this.$refs.goodPrint.show(
- this.printData,
- this.goodList,
- this.manufacturerList,
- this.dealerList,
- this.goodKindList
- );
- },
- batchSelect(selection){
- if(selection.length == 0){
- this.$message.error("请选中需要打印的内容")
- return
- }
- this.printData = []
- for(let i=0;i<selection.length;i++){
- for(let j=0;j<this.tablePrintData.length;j++){
- if(selection[i].id == this.tablePrintData[j].id){
- this.printData.push(this.tablePrintData[j])
- }
- }
- }
- console.log("打印数据=====",this.printData)
- },
- BatchPrintAction(){
- this.dialogVisible = true
- },
- handleSelectOne(val){
- this.good_name = val.good_name
- this.good_id = val.id
- this.handleQuery()
- },
- getSocialSecurityDirectoryCode(good_id){
- var social_security_directory_code = ""
- for(let i=0;i<this.goodList.length;i++){
- if(good_id == this.goodList[i].id){
- social_security_directory_code = this.goodList[i].social_security_directory_code
- }
- }
- return social_security_directory_code
- },
- getGoodName(good_id){
- var good_name = ""
- for(let i=0;i<this.goodList.length;i++){
- if(good_id == this.goodList[i].id){
- good_name = this.goodList[i].good_name
- }
- }
- return good_name
- },
- getSpecificationName(good_id){
- var specification_name = ""
- for(let i=0;i<this.goodList.length;i++){
- if(good_id == this.goodList[i].id){
- specification_name = this.goodList[i].specification_name
- }
- }
- return specification_name
- },
- getPackingUnit(good_id){
- var packing_unit = ""
- for(let i=0;i<this.goodList.length;i++){
- if(good_id == this.goodList[i].id){
- packing_unit = this.goodList[i].packing_unit
- }
- }
- return packing_unit
- },
- handleQuery(){
- var params = {
- start_time:this.listQuery.start_time,
- end_time:this.listQuery.end_time,
- good_id:this.good_id,
- }
- console.log("param===",params)
- getGoodWarehosueInPrintList(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
-
- this.tablePrintData = list
- var manufacturerList = response.data.data.manufacturerList
- this.manufacturerList = []
- this.manufacturerList = manufacturerList
- var dealerList = response.data.data.dealerList
- this.dealerList = []
- this.dealerList = dealerList
- var goodList = response.data.data.goodList
- this.goodList = []
- this.goodList= goodList
- var goodsType = response.data.data.goodsType
- this.goodsType = []
- this.goodsType = goodsType
-
- }
- })
- },
- getGoodKandName(id){
- var name = ""
- for(let i=0;i<this.goodKindList.length;i++){
- if(id == this.goodKindList[i].value){
- name = this.goodKindList[i].name
- }
- }
- return name
- },
- handleSelect(val){
- this.good_name = val.good_name
- this.good_id = val.id
- this.GetCancelStock();
- this.getGoodDetailPrintList()
- },
- 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([])
- }
- })
- },
- changeType: function(val) {
- this.order_type = val;
- this.GetCancelStock();
-
- },
- changeManufacturer: function(val) {
- this.manufacturer_id = val;
- this.GetCancelStock();
-
- },
- changeDealer: function(val) {
- this.dealer_id = val;
- this.GetCancelStock();
- },
- getTypeName: function(row) {
- let name = "";
- if (row.type == 1) {
- name = "耗材入库单";
- } else if (row.type == 2) {
- name = "其他入库单";
- }
-
- return name;
- },
- 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;
- },
- typeNameOne:function(good_id){
- let name = "";
- for (let i = 0; i < this.goodInfo.length; i++) {
- if (this.goodInfo[i].id == good_id) {
- name = this.goodInfo[i].good_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;
- },
- search: function() {
- this.getGoodDetailPrintList()
- const Params = {
- page: this.page,
- limit: this.limit,
- start_time: this.start_time,
- end_time: this.end_time,
- type: this.type,
- keywords: this.searchKey,
- storehouse_id:this.storehouse_id,
- };
- this.cancelStockDate = [];
- this.tableList = []
- getStockDetail(Params).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.total = response.data.data.total;
- var total_price = 0
- for (let i = 0; i < response.data.data.list.length; i++) {
- this.tableList.push(response.data.data.list[i])
- var obj = response.data.data.list[i];
- total_price += response.data.data.list[i].price * response.data.data.list[i].warehousing_count
- obj["is_total"] = 0;
- this.cancelStockDate.push(obj);
- }
- this.manufacturerList = response.data.data.manufacturerList
- this.dealerList = response.data.data.dealerList
-
- this.cancelStockDate.push({
- warehousing_order: "合计",
- is_total: 1,
- total: total_price,
- Warehousing: {
- warehousing_time: 0
- }
- });
- }
- });
- },
- getTime: function(val) {
- if (val == 0) {
- return "";
- } else {
- return uParseTime(val, "{y}-{m}-{d}");
- }
- },
- AddNewOrder: function() {
- this.$router.push({
- name: "cancelStockOrderAdd",
- query: { type: this.type }
- });
- },
- GetCancelStock: function() {
- const Params = {
- page: this.page,
- limit: this.limit,
- start_time: this.start_time,
- end_time: this.end_time,
- type: this.type,
- manufacturer: this.manufacturer_id,
- order_type: this.order_type,
- dealer: this.dealer_id,
- keywords: this.searchKey,
- storehouse_id:this.storehouse_id,
- good_id:this.good_id,
- order_way:0
- };
- this.cancelStockDate = [];
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- })
- getStockDetail(Params).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- loading.close()
- return false;
- } else {
- loading.close()
- this.total = response.data.data.total;
- var obj = {id:0,storehouse_name:"全部"}
- this.houseList = []
- this.houseList.push(obj)
- for(let i=0;i<response.data.data.houseList.length;i++){
- this.houseList.push(response.data.data.houseList[i])
- }
- var total_price = 0
- for (let i = 0; i < response.data.data.list.length; i++) {
- total_price += parseInt(response.data.data.list[i].warehousing_count) * response.data.data.list[i].price
- this.tableList.push(response.data.data.list[i])
- var obj = response.data.data.list[i];
- obj["is_total"] = 0;
- this.cancelStockDate.push(obj);
- }
- this.tableDataList = response.data.data.list
- this.manufacturerList = response.data.data.manufacturerList
- this.dealerList = response.data.data.dealerList
-
- this.goodKindList = response.data.data.goodKindList
-
- this.cancelStockDate.push({
- warehousing_order: "合计",
- is_total: 1,
- total:total_price.toFixed(2),
- Warehousing: {
- warehousing_time: 0
- }
- });
- }
- });
- },
- getXuserName(id) {
- if (id <= 0) {
- return "";
- }
- var name = "";
- if (
- this.adminUserOptions == null ||
- typeof this.adminUserOptions.length === "undefined"
- ) {
- return name;
- }
- var leng = this.adminUserOptions.length;
- if (leng == 0) {
- return name;
- }
- for (let index = 0; index < leng; index++) {
- if (this.adminUserOptions[index].id == id) {
- name = this.adminUserOptions[index].name;
- break;
- }
- }
- return name;
- },
- fetchAllAdminUsers() {
- fetchAllAdminUsers().then(response => {
- if (response.data.state == 1) {
- this.adminUserOptions = response.data.data.users;
- var alen = this.adminUserOptions.length;
- for (let index = 0; index < alen; index++) {
- if (this.adminUserOptions[index].user_type == 2) {
-
- }
- }
- }
- });
- },
- handleSelectionChange: function(val) {
- this.multipleSelection = val;
- this.GetCancelStock();
- this.getGoodDetailPrintList()
- },
- handleSizeChange(val) {
- this.limit = val;
- this.GetCancelStock();
- this.getGoodDetailPrintList()
- },
- handleCurrentChange(val) {
- this.page = val;
- this.GetCancelStock();
- this.getGoodDetailPrintList()
- },
- startTimeChange(val) {
-
- var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
- if (time > 0) {
- this.$message.error("结束时间不能小于开始时间");
- this.start_time = "";
- } else {
-
- this.GetCancelStock();
- this.getGoodDetailPrintList()
-
- }
- },
- endTimeChange(val) {
- var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
- if (time < 0) {
- this.$message.error("结束时间不能小于开始时间");
- this.end_time = "";
- } else {
-
- this.GetCancelStock();
- this.getGoodDetailPrintList()
- }
- },
- getAllQuery(){
- this.GetCancelStock();
- this.getGoodDetailPrintList()
- },
- getTimestamp(time) {
- // 把时间日期转成时间戳
- return new Date(time).getTime() / 1000;
- },
- calculate: function(val) {
- return Math.round(parseFloat(val) * 100) / 100;
- },
- GetConfigInfo: function() {
- 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.goodInfo = response.data.data.goodInfo;
- this.goodType = response.data.data.goodType;
- }
- });
- },
- getManufactuerName: function(manufacturer_id) {
- for (let i = 0; i < this.manufacturer.length; i++) {
- if (this.manufacturer[i].id == manufacturer_id) {
- return this.manufacturer[i].manufacturer_name;
- }
- }
- },
- getDealerName: function(dealer_id) {
- for (let i = 0; i < this.dealer.length; i++) {
- if (this.dealer[i].id == dealer_id) {
- return this.dealer[i].dealer_name;
- }
- }
- },
- handleEdit: function(index, row) {
- this.$router.push({
- name: "cancelStockDetail",
- query: { id: row.id, type: this.type }
- });
- },
- handleDelete: function(index, row) {
- const ids = [];
- ids.push(row.id);
- const idStr = ids.join(",");
-
- const params = {
- ids: idStr
- };
-
- this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- deleteCancelStock(params).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "删除成功",
- type: "success",
- duration: 2000
- });
- for (let i = 0; i < ids.length; i++) {
- for (let y = 0; y < this.cancelStockDate.length; y++) {
- if (ids[i] == this.cancelStockDate[y].id) {
- this.cancelStockDate.splice(y, 1);
- }
- }
- }
- }
- });
- })
- .catch(() => {});
- },
- changeAllSelected: function(val) {
- if (val) {
- this.$refs.multipleTable.toggleAllSelection();
- } else {
- this.$refs.multipleTable.clearSelection();
- }
- },
- select(selection) {
- this.selectedTableData = selection;
- },
- batchDelete() {
- if (this.selectedTableData.length <= 0) {
- this.$message.error("请选择要删除的记录");
- return;
- }
- const ids = [];
- for (let i = 0; i < this.selectedTableData.length; i++) {
- ids.push(this.selectedTableData[i].id);
- }
- const idStr = ids.join(",");
- const params = {
- ids: idStr
- };
- this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- deleteCancelStock(params).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "删除成功",
- type: "success",
- duration: 2000
- });
-
- for (let i = 0; i < ids.length; i++) {
- for (let y = 0; y < this.cancelStockDate.length; y++) {
- if (ids[i] == this.cancelStockDate[y].id) {
- this.cancelStockDate.splice(y, 1);
- }
- }
- }
- }
- });
- })
- .catch(() => {});
- },
- getTotal: function(price, total) {
- var m = 0,
- r1,
- r2;
- var s1 = price.toString();
- var s2 = total.toString();
- try {
- m += s1.split(".")[1].length;
- } catch (e) {}
- try {
- } catch (e) {
- m += s2.split(".")[1].length;
- }
- r1 = Number(price.toString().replace(".", ""));
- r2 = Number(total.toString().replace(".", ""));
- return (r1 * r2) / Math.pow(10, m);
- },
- PrintAction: function() {
-
-
- window.sessionStorage.setItem('start_time',this.start_time)
- window.sessionStorage.setItem('end_time',this.end_time)
-
- if(this.org_id!=9671){
- this.$router.push({
- path: "/stock/print",
- query: {
- type: 1,
- start_time: this.start_time,
- end_time: this.end_time,
- limit:this.limit,
- page:this.page,
- keywords:this.$router.keywords,
- good_id:this.good_id,
- order_way:0,
- }
- });
- }
- if(this.org_id == 9671){
-
- this.$router.push({
- path: "/stock/print/one",
- query: {
- type: 1,
- start_time: this.start_time,
- end_time: this.end_time,
- limit:this.limit,
- page:this.page,
- keywords:this.searchKey,
- storehouse_id:this.storehouse_id,
- good_id:this.good_id,
- order_way:0,
- }
- });
- }
-
- },
- getPrintStockGood(){
- const params = {
- start_time:this.start_time,
- end_time:this.end_time,
- type:1,
- }
-
- getPrintStockGood(params).then(response=>{
- if(response.data.state == 1){
- this.tableList = []
- var stockTotal = response.data.data.stockTotal
-
- this.stockTotal = stockTotal
- var list = response.data.data.list
-
- for(let i=0;i<list.length;i++){
- if (list[i].query_warehousing_info.length > 0) {
- this.tableList.push(list[i])
- }
- }
-
- }
- })
- },
-
- calCount(stock) {
- let total = 0
- var array = []
- array = stock.query_warehousing_info
- for (let i = 0; i < array.length; i++) {
- total = total + array[i].warehousing_count
- }
- return total
- },
-
- calTotal(stock) {
- var array = []
- array = stock.query_warehousing_info
- let total_price = 0.0
- for (let i = 0; i < array.length; i++) {
- total_price = total_price + array[i].warehousing_count * array[i].price
- }
- return Math.floor(total_price * 100) / 100
- },
- calTotalPrice() {
- var amountPrice = 0
- for (let i = 0; i < this.tableList.length; i++) {
- var obj = this.tableList[i]
- var len = 0
- len = obj.query_warehousing_info.length
- let total_price = 0.0
- for (let a = 0; a < len; a++) {
- total_price = total_price + obj.query_warehousing_info[a].total_price
- }
-
- amountPrice = amountPrice + Math.floor(total_price* 100) / 100
- }
- return Math.floor(amountPrice* 100) / 100
- },
- getStockCount(id){
-
- var count = ""
- for(let i=0;i<this.stockTotal.length;i++){
- if(id == this.stockTotal[i].good_id){
- count = this.stockTotal[i].count
- }
- }
- return count
- },
- getTotal: function(price, total) {
- var m = 0, r1, r2
- var s1 = price.toString()
- var s2 = total.toString()
- try {
- m += s1.split('.')[1].length
- } catch (e) {
-
- }
- try {
- } catch (e) {
- m += s2.split('.')[1].length
- }
- r1 = Number(price.toString().replace('.', ''))
- r2 = Number(total.toString().replace('.', ''))
- return r1 * r2 / Math.pow(10, m)
- },
- unique(arr) {
- const res = new Map();
- return arr.filter((arr) => !res.has(arr.specification_name) && res.set(arr.specification_name, 1));
- },
- uniqueOne(arr) {
- const res = new Map();
- return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
- },
-
- exportList(){
-
- for(let i=0;i<this.tableInfo.length;i++){
- this.tableInfo[i].index = i+1
- this.tableInfo[i].total_price = (this.tableInfo[i].warehousing_count * this.tableInfo[i].price).toFixed(2)
- this.tableInfo[i].manufacturer_name = this.getManufactuerName(this.tableInfo[i].manufacturer)
- this.tableInfo[i].dealer_name = this.getDealerName(this.tableInfo[i].dealer)
- }
-
- import('@/vendor/Export2Excel').then(excel => {
- const tHeader = ['序号','耗材名称', '规格型号','生产厂商','进销商', '单位','数量','进货价','总价','备注']
- const filterVal = ['index','good_name', 'specification_name','manufacturer_name','dealer_name', 'packing_unit','warehousing_count','price','total_price','remark']
-
-
- const data = this.formatJson(filterVal, this.tableInfo)
-
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '耗材入库明细'
- })
- this.downloadLoading = false
- })
- },
- getManufacturerName(id){
- var manufacturer_name = ""
- for(let i=0;i<this.manufacturerList.length;i++){
- if(id == this.manufacturerList[i].id){
- manufacturer_name = this.manufacturerList[i].manufacturer_name
- }
- }
- return manufacturer_name
- },
- getDealerName(id){
- var dealer_name = ""
- for(let i=0;i<this.dealerList.length;i++){
- if(id == this.dealerList[i].id){
- dealer_name = this.dealerList[i].dealer_name
- }
- }
- return dealer_name
- },
- exportListDetal(){
-
- var obj = {index:"合计",total_price:0}
- var total = 0
- console.log("wowowows",this.tableDataList)
-
- for(let i=0;i<this.tableDataList.length;i++){
- this.tableDataList[i].good_kand_name = this.getGoodKandName(this.tableDataList[i].GoodInfo.good_kind)
- this.tableDataList[i].index = i + 1
- this.tableDataList[i].good_type_name = this.typeName(this.tableDataList[i].good_type_id)
- this.tableDataList[i].good_name = this.typeNameOne(this.tableDataList[i].good_id)
- this.tableDataList[i].specification_name = this.specificationName(this.tableDataList[i].good_id)
- this.tableDataList[i].time = this.getTime(this.tableDataList[i].Warehousing.warehousing_time)
- this.tableDataList[i].user_name = this.getXuserName(this.tableDataList[i].Warehousing.creater)
- this.tableDataList[i].total_price = (this.tableDataList[i].warehousing_count * this.tableDataList[i].price).toFixed(2)
- this.tableDataList[i].manufacturer_name = this.getManufactuerName(this.tableDataList[i].manufacturer)
- this.tableDataList[i].dealer_name = this.getDealerName(this.tableDataList[i].dealer)
- this.tableDataList[i].expiry_date_name = this.getTime(this.tableDataList[i].expiry_date)
- this.tableDataList[i].product_date_name = this.getTime(this.tableDataList[i].product_date)
- total += this.tableDataList[i].warehousing_count * this.tableDataList[i].price
-
- }
- obj.total_price = total.toFixed(2)
- this.tableDataList.push(obj)
-
- console.log("hhhhhhhhhhhhhhhh",this.tableDataList)
-
- import('@/vendor/Export2Excel').then(excel => {
- const tHeader = ['序号','单据编号','耗材种类', '耗材类型', '耗材名称','规格型号','生产厂商','进销商','批号','生产日期','有效日期','操作时间','制单人','进货价','数量','总价']
- const filterVal = ['index','warehousing_order','good_kand_name', 'good_type_name', 'good_name','specification_name','manufacturer_name','dealer_name','number','product_date_name','expiry_date_name','time','user_name','price','warehousing_count','total_price']
-
-
- const data = this.formatJson(filterVal, this.tableDataList)
- console.log("this.tableDataList",this.tableDataList)
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '耗材入库明细'
- })
- this.downloadLoading = false
- })
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map(v => filterVal.map(j => v[j]));
- },
- getUnit(id){
- var name = ""
- for(let i=0;i<this.goodUnit.length;i++){
- if(this.goodUnit[i].id == id){
- name = this.goodUnit[i].name
- }
- }
- return name
- },
- getGoodDetailPrintList(){
- const params = {
- start_time:this.start_time,
- end_time:this.end_time,
- type:1,
- storehouse_id:this.storehouse_id,
- good_id:this.good_id,
- }
- getGoodDetailPrintList(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- this.tableInfo = []
- this.tableInfo = list
- }
- })
- },
- getStorehouseName(id){
- var storehouse_name = ""
- for(let i=0;i<this.houseList.length;i++){
- if(id == this.houseList[i].id){
- storehouse_name = this.houseList[i].storehouse_name
- }
- }
- if(storehouse_name == "全部"){
- return ""
- }else{
- return storehouse_name
- }
- },
- changeHouseList(){
- this.houseList = []
- this.GetCancelStock()
- this.getGoodDetailPrintList()
- }
- }
- };
- </script>
-
- <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;
- }
-
- .count {
- color: #bd2c00;
- }
- .el-table td,
- .el-table th.is-leaf,
- .el-table--border,
- .el-table--group {
- border-color: #d0d3da;
- }
- .el-table--border::after,
- .el-table--group::after,
- .el-table::before {
- background-color: #d0d3da;
- }
-
- </style>
|