|
|
@@ -0,0 +1,919 @@
|
|
|
+/* eslint-disable no-debugger */
|
|
|
+<style>
|
|
|
+ .input-with-select .el-select .el-input {
|
|
|
+ width: 110px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .input-with-select .el-input-group__append {
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <el-dialog title="批量添加" :visible.sync="visible" width="1000px" :before-close="handleDialogClose">
|
|
|
+ <el-form ref="samplemanageform" :rules="sampleformrule" :model="sampleform" label-width="100px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样本数量" prop="SampleNumber">
|
|
|
+ <el-input v-model="sampleform.SampleNumber"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样本条码" prop="BarCode">
|
|
|
+ <el-input v-model="sampleform.BarCode" placeholder="为空默认自动生成" :disabled="disabledbarcode"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样本类型" required prop="SampleType">
|
|
|
+ <el-select v-model="sampleform.SampleType" clearable placeholder="请选择" style="width:100%" ref="SampleTypeselect"
|
|
|
+ @change="choosetype" :disabled="disabledsampletype">
|
|
|
+ <el-option v-for="item in sampletypelist" :label="item.label" :value="item.value" :key="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样本编码" required prop="SampleCode">
|
|
|
+ <el-input v-model="sampleform.SampleCode" :disabled="disabledsamplecode" @blur="blursamplecode"
|
|
|
+ placeholder="样本编码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样本名称">
|
|
|
+ <el-input v-model="sampleform.Name" placeholder="样本名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="可用容量" placeholder="可用容量">
|
|
|
+ <el-input v-model="sampleform.Capacitystr" :disabled="disabledcapacity" placeholder="可用容量"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="容量单位">
|
|
|
+ <el-select v-model="sampleform.Unit" clearable style="width:100%" :disabled="disabledunit">
|
|
|
+ <el-option v-for="item in sampeunitlist" :label="item.Value" :value="item.Value" :key="item.Value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="接收日期">
|
|
|
+ <el-date-picker style="width: 100%" v-model="sampleform.ReceiveDatedate" type="date" :clearable="false"
|
|
|
+ placeholder="请选择接收日期" :disabled="diaabledreceiveDate">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="有效日期">
|
|
|
+ <el-date-picker style="width: 70%" v-model="sampleform.ValidityDatedate" type="date" :clearable="false"
|
|
|
+ :placeholder="sampleform.Isyongjiu ? '永久' : '请选择有效日期'"
|
|
|
+ :disabled="disabledvaliditydate || sampleform.Isyongjiu">
|
|
|
+ </el-date-picker>
|
|
|
+ <el-checkbox v-model="sampleform.Isyongjiu" style="float:right" :disabled="diaabledyongjiu">永久
|
|
|
+ </el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样本内码" v-if="acc !='srNA2'">
|
|
|
+ <el-input v-model="sampleform.InnerCode" placeholder="样本内码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- <el-col :span="8">
|
|
|
+ <el-form-item label="样本来源" v-if="acc !='sBBo4' && acc != 'ssqOy' && acc != 'saB4v'">
|
|
|
+ <el-input v-model="sampleform.SourceName" placeholder="样本来源" style="width:68%" disabled></el-input>
|
|
|
+ <el-button type="primary" :disabled="disabledsourcebutton" style="width:30%"
|
|
|
+ @click="dialogsamplesourceVisible = true" class="btnbox">选择1</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样本来源" v-if="acc =='sBBo4' || acc == 'saB4v'">
|
|
|
+ <el-input v-model="sampleform.SourceName" placeholder="样本来源" style="width:68%" disabled></el-input>
|
|
|
+ <el-button type="primary" :disabled="disabledanimalbutton" style="width:30%"
|
|
|
+ @click="animalSourceVisible = true" class="btnbox">选择2</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样本来源" v-if="acc =='ssqOy'">
|
|
|
+ <el-input v-model="sampleform.SourceName" placeholder="样本来源" style="width:68%" disabled></el-input>
|
|
|
+ <el-button type="primary" :disabled="disabledanimalbutton" style="width:30%"
|
|
|
+ @click="microSourceVisible = true" class="btnbox">选择3</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col> -->
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注">
|
|
|
+ <el-input v-model="sampleform.Remark" type="textarea" :rows="1" placeholder="样本备注"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="录入人">
|
|
|
+ <el-select ref="reflrrselect" v-model="sampleform.CreateUserId" style="width:100%">
|
|
|
+ <el-option v-for="item in userlist" :label="item.Realname" :value="item.Id" :key="item.Id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="所属分组">
|
|
|
+ <el-select ref="refGroup" multiple filterable default-first-option v-model="GroupIdOption"
|
|
|
+ placeholder="请选择" style="width: 100%">
|
|
|
+ <el-option v-for="item in groupList" :key="item.Key" :label="item.Value" :value="item.Id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item>
|
|
|
+ <el-checkbox :disabled="disabledcheckprint" v-model="sampleform.autoprintchecked" class="title">
|
|
|
+ 新增保存时打印标签(如若勾选,请确保已经设置过默认打印方案)
|
|
|
+ </el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-tabs tab-position="top" v-model="Tabs">
|
|
|
+ <el-tab-pane :label="groupname" :name="groupname" :key="groupname" v-for="groupname in groupnameList">
|
|
|
+ <el-card class="box-card infocard">
|
|
|
+ <el-row>
|
|
|
+ <template v-for="(item, index) in typetykzlist">
|
|
|
+ <el-col :span="(item.FieldType === '3')? 24:8" :key="index" v-if="item.GroupName === groupname">
|
|
|
+ <el-form-item :label="item.Name">
|
|
|
+ <el-input v-model="item.FieldDefault" v-if="item.FieldType === '1'" :placeholder="'请输入'+item.Name"
|
|
|
+ auto-complete="off"></el-input>
|
|
|
+
|
|
|
+ <el-select v-model="item.FieldDefault" v-if="item.FieldType === '2'" clearable
|
|
|
+ :placeholder="'请选择'+item.Name" style="width:100%">
|
|
|
+ <el-option :label="v" :value="v" :key="v" v-for=" v in item.FieldContent.split(',')">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ <el-input v-model="item.FieldDefault" v-if="item.FieldType === '3'" :placeholder="'请输入'+item.Name"
|
|
|
+ type="textarea" :rows=3 auto-complete="off"></el-input>
|
|
|
+
|
|
|
+ <el-date-picker v-model="item.FieldDefault" v-if="item.FieldType === '4'" type="datetime"
|
|
|
+ style="width:100%" placeholder="选择日期"></el-date-picker>
|
|
|
+
|
|
|
+ <el-button plain v-model="item.FieldDefault" v-if="item.FieldType === '5'" type="primary"
|
|
|
+ size="mini" class="el-button--small" style="margin-left: 8px" @click="getitem(item)">上传图片
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </el-row>
|
|
|
+ </el-card>
|
|
|
+ <el-dialog :title="ImageTitle" width="80%" :visible.sync="imageDialog">
|
|
|
+ <el-upload action="" :before-upload="beforeAvatarUpload" :on-preview="handlePictureCardPreview"
|
|
|
+ :http-request="uploadrequest" :on-success="handleAvatarSuccess" :on-remove="handleRemove"
|
|
|
+ :file-list="imagefilelist" list-type="picture">
|
|
|
+ <el-button size="small" type="primary">点击上传</el-button>
|
|
|
+ <div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
|
|
|
+ </el-upload>
|
|
|
+ </el-dialog>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer" style="margin-top:-30px;">
|
|
|
+ <el-button @click="handleDialogClose()" size="mini">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="savedata()" size="mini">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ mapGetters
|
|
|
+ } from 'vuex'
|
|
|
+ import axios from 'axios'
|
|
|
+ export default {
|
|
|
+ name: 'batchadddialog',
|
|
|
+ props: {
|
|
|
+ visible: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ model: {}
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.acc = this.authUser.Profile.AccCode
|
|
|
+ },
|
|
|
+ computed: mapGetters({
|
|
|
+ authUser: 'authUser'
|
|
|
+ }),
|
|
|
+ data () {
|
|
|
+ var checkSampleType = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请选择样本类型'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var checkCapacity = (rule, value, callback) => {
|
|
|
+ if (!isNaN(parseFloat(value)) && !isNaN(value)) {
|
|
|
+ callback()
|
|
|
+ // }
|
|
|
+ } else {
|
|
|
+ callback(new Error('请输入正确数字值'))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var checkSampleCode = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请输入样本编码'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var checkBarCode = (rule, value, callback) => {
|
|
|
+ let _this = this
|
|
|
+ if (_this.sampleform.type_flag === 'add') {
|
|
|
+ if (value === '') {
|
|
|
+ callback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ _this.$axios.get('/sampleoperation/validformdetailbarcoder?param=' + value, {})
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ callback()
|
|
|
+ } else {
|
|
|
+ callback(new Error(res.data.message))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ callback(new Error('网络异常请重试'))
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 校验输入的样本数量与所选冻存盒数量大小关系
|
|
|
+ var checkSampleNumber = (rule, value, callback) => {
|
|
|
+ let _this = this
|
|
|
+ if (_this.sampleform.type_flag === 'add') {
|
|
|
+ let params = {
|
|
|
+ equipmentId: _this.sampleform.eid,
|
|
|
+ batchAddSelectBox: _this.batchAddSelectBox.join('-')
|
|
|
+ }
|
|
|
+ _this.$axios.get('/shelfset/getCountByBoxs', {params})
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ if (value <= res.data.item) {
|
|
|
+ callback()
|
|
|
+ } else {
|
|
|
+ callback(new Error('样本数量大于所选冻存盒总容量'))
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ callback(new Error(res.data.message))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ callback(new Error('网络异常请重试'))
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ disabledbarcode: false,
|
|
|
+ disabledsamplecode: false,
|
|
|
+ disabledsampletype: false,
|
|
|
+ disabledvaliditydate: false,
|
|
|
+ disabledsourcebutton: false,
|
|
|
+ disabledanimalbutton: false,
|
|
|
+ disabledcheckprint: false,
|
|
|
+ diaabledreceiveDate: false,
|
|
|
+ diaabledyongjiu: false,
|
|
|
+ disabledsamplingsite: false,
|
|
|
+ disabledcapacity: false,
|
|
|
+ disabledunit: false,
|
|
|
+ disabledbtnpreopera: false,
|
|
|
+ sampleform: {
|
|
|
+ id: 0,
|
|
|
+ BarCode: '', // 样本条码
|
|
|
+ SampleCode: '', // 样本编码
|
|
|
+ SampleType: '', // 样本类型
|
|
|
+ SampleTypeName: '',
|
|
|
+ SamplingOrgan: '', // 组织器官
|
|
|
+ SamplingSite: '', // 取材部位
|
|
|
+ SamplingSiteName: '',
|
|
|
+ Name: '', // 名称
|
|
|
+ ReceiveDatedate: new Date(), // 接收日期
|
|
|
+ Capacitystr: '0', // 可用容量
|
|
|
+ Unit: '', // 单位(容量)
|
|
|
+ ValidityDatedate: '', // 有效日期
|
|
|
+ InnerCode: '', // 样本内码
|
|
|
+ SourceName: '', // 样本来源
|
|
|
+ Remark: '', // 备注----------------------
|
|
|
+ Isyongjiu: false, // 是否永久
|
|
|
+ code_default: '',
|
|
|
+ code_codeId: 0,
|
|
|
+ code_lastnum: '',
|
|
|
+ coderule_samplingorgan_flag: 0,
|
|
|
+ coderule_sampletype_flag: 0,
|
|
|
+ eid: '',
|
|
|
+ x_shelf: '',
|
|
|
+ y_shelf: '',
|
|
|
+ x_box: '',
|
|
|
+ y_box: '',
|
|
|
+ min_x: '',
|
|
|
+ min_y: '',
|
|
|
+ autoprintchecked: true,
|
|
|
+ type_flag: 'add', // 标记点预录入或者没点
|
|
|
+ saveandadd: '', // 保存并新增:1;保存新增分管:2
|
|
|
+ // SampleTypeName: '', // 样本类型名称
|
|
|
+ // zuzhiName: '', // 组织器官名称
|
|
|
+ // SamplingSiteName: '', // 取材部位名称
|
|
|
+ PositionStr: '', // 样本位置信息
|
|
|
+ CreateUserId: 0, // 录入人
|
|
|
+ CreateBy: '', // 录入人
|
|
|
+ SampleNumber: 0
|
|
|
+ },
|
|
|
+ sampleformrule: {
|
|
|
+ SampleCode: [{
|
|
|
+ validator: checkSampleCode,
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ SampleType: [{
|
|
|
+ validator: checkSampleType,
|
|
|
+ trigger: 'change'
|
|
|
+ }],
|
|
|
+ Capacitystr: [{
|
|
|
+ validator: checkCapacity,
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ BarCode: [{
|
|
|
+ validator: checkBarCode,
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ SampleNumber: [{
|
|
|
+ validator: checkSampleNumber,
|
|
|
+ trigger: 'blur'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ Tabs: '',
|
|
|
+ groupnameList: [], // 扩展字段分组列表
|
|
|
+ imageDialog: false,
|
|
|
+ ImageTitle: '',
|
|
|
+ imagefiles: '',
|
|
|
+ imagefilelist: [],
|
|
|
+ imagenewlist: '', // 删除图片时使用
|
|
|
+ dialogImageUrl: '',
|
|
|
+ dialogVisible: false,
|
|
|
+
|
|
|
+ groupList: [], // 合作用户分组
|
|
|
+ GroupIdOption: [],
|
|
|
+ GroupId: '',
|
|
|
+ GroupName: '',
|
|
|
+
|
|
|
+ dialogsamplesourceVisible: false,
|
|
|
+ animalSourceVisible: false,
|
|
|
+ microSourceVisible: false,
|
|
|
+ // 选项的基础资料
|
|
|
+ sampletypelist: [],
|
|
|
+ sampeunitlist: [],
|
|
|
+ selectedorgan: [], // 级联所选组织结构
|
|
|
+ organlist2: [],
|
|
|
+ typetykzlist: [], // 特有扩展
|
|
|
+ // publickzlist: [], // 公共扩展
|
|
|
+ userlist: [], // 录入人
|
|
|
+ acc: '',
|
|
|
+ batchAddSelectBox: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ // initial data
|
|
|
+ this.getType()
|
|
|
+ this.getsampetypeunit()
|
|
|
+ this.getsametypetreelist()
|
|
|
+ this.getautocodedata()
|
|
|
+ // 获取公共扩展
|
|
|
+ // this.getpublickz()
|
|
|
+ this.acc = this.authUser.Profile.AccCode
|
|
|
+ // 获取录入人
|
|
|
+ this.getuserlist()
|
|
|
+ // 获取合作用户分组列表
|
|
|
+ this.getGrouplist()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleDialogClose () {
|
|
|
+ this.$emit('close')
|
|
|
+ },
|
|
|
+ savedata () {
|
|
|
+ // eslint-disable-next-line no-debugger
|
|
|
+ let _this = this
|
|
|
+
|
|
|
+ this.$refs['samplemanageform'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ // 拼接扩展字段
|
|
|
+ let jsonstr = _this.getkuozhandata()
|
|
|
+ // 转换为json对象
|
|
|
+ let jsonobj = JSON.parse(jsonstr)
|
|
|
+ // 拼接两个对象
|
|
|
+ _this.sampleform.CreateBy = _this.$refs.reflrrselect.selectedLabel
|
|
|
+ _this.sampleform.SampleType = parseInt(_this.sampleform.SampleType)
|
|
|
+ _this.sampleform.SampleNumber = parseInt(_this.sampleform.SampleNumber)
|
|
|
+ _this.sampleform.SampleTypeName = _this.$refs.SampleTypeselect.selectedLabel
|
|
|
+ let params = _this.sampleform
|
|
|
+ params = Object.assign(params, jsonobj)
|
|
|
+ // 时间格式数据拼接
|
|
|
+ if (_this.sampleform.ReceiveDatedate && _this.sampleform.ReceiveDatedate.getTime() > 0) {
|
|
|
+ params = Object.assign(params, {
|
|
|
+ ReceiveDateint: _this.sampleform.ReceiveDatedate.getTime()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (_this.sampleform.ValidityDatedate && _this.sampleform.ValidityDatedate.getTime() > 0) {
|
|
|
+ params = Object.assign(params, {
|
|
|
+ ValidityDateint: _this.sampleform.ValidityDatedate.getTime()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (_this.GroupIdOption.length > 0) {
|
|
|
+ _this.GroupId = _this.GroupIdOption.join(',')
|
|
|
+ let tempOfficers = []
|
|
|
+ for (let idx in this.GroupIdOption) {
|
|
|
+ let selectId = this.GroupIdOption[idx]
|
|
|
+ for (let idx2 in this.groupList) {
|
|
|
+ let item = this.groupList[idx2]
|
|
|
+ if (item.Id === selectId) {
|
|
|
+ tempOfficers.push(item.Value)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.GroupName = tempOfficers.join(',')
|
|
|
+ }
|
|
|
+ _this.$axios.post('/sampleoperation/saveBatchAdd?groupid=' + _this.GroupId + '&groupname=' + _this.GroupName + '&batchAddSelectBox=' + _this.batchAddSelectBox.join('-'), params)
|
|
|
+ .then(res => {
|
|
|
+ this.handleDialogClose()
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ } else if (res.data.code === 10 || res.data.code === 11) { // 保存成功后打印
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ // 自动打印
|
|
|
+ if (res.data.item !== '') {
|
|
|
+ let printparams = res.data.item.split(',')
|
|
|
+ if (printparams.length === 3 && printparams[0] !== '' && printparams[1] !== '' && printparams[2] !== '') {
|
|
|
+ // 执行打印操作
|
|
|
+ window.PrintReport(printparams[1], `samplespreinput,${printparams[2]},${printparams[0]}`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getkuozhandata () {
|
|
|
+ // 拼接扩展字段
|
|
|
+ let _this = this
|
|
|
+ let jsonstr = ''
|
|
|
+ // 公共扩展
|
|
|
+ // for (let i = 0; i < _this.publickzlist.length; i++) {
|
|
|
+ // jsonstr += '"' + _this.publickzlist[i].FieldName + '" : "' + _this.publickzlist[i].FieldDefault + '",'
|
|
|
+ // }
|
|
|
+ // 特有扩展
|
|
|
+ for (let i = 0; i < _this.typetykzlist.length; i++) {
|
|
|
+ jsonstr += '"' + _this.typetykzlist[i].FieldName + '" : "' + _this.typetykzlist[i].FieldDefault + '",'
|
|
|
+ }
|
|
|
+ jsonstr = '{' + jsonstr.substring(0, jsonstr.length - 1) + '}'
|
|
|
+ return jsonstr
|
|
|
+ },
|
|
|
+ savesample () {
|
|
|
+ let _this = this
|
|
|
+ if (_this.sampleform.type_flag === 'add') {
|
|
|
+ if (_this.sampleform.InnerCode != '') {
|
|
|
+ _this.trueInnoCode()
|
|
|
+ } else {
|
|
|
+ _this.saveadd()
|
|
|
+ }
|
|
|
+ } else if (_this.sampleform.type_flag === 'edit') {
|
|
|
+ if (_this.sampleform.id > 0) {
|
|
|
+ _this.saveedit()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请求参数有错误!请重新操作!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请求参数有错误!请重新操作!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trueInnoCode () {
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/samplepreinput/innernomakesure?InnerCode=' + this.sampleform.InnerCode, {})
|
|
|
+ .then(function (response) {
|
|
|
+ let innerTotal = response.data.items
|
|
|
+ if (innerTotal === 0) {
|
|
|
+ _this.saveadd()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '样本内码重复!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ getautocodedata () {
|
|
|
+ let _this = this
|
|
|
+ // 获取冻存架信息
|
|
|
+ _this.$axios.get('/sampleoperation/getautocodedata', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.sampleform.code_default = res.data.code_default
|
|
|
+ _this.sampleform.code_codeId = res.data.code_codeId
|
|
|
+ _this.sampleform.code_lastnum = res.data.code_lastnum
|
|
|
+ _this.sampleform.coderule_samplingorgan_flag = res.data.coderule_samplingorgan_flag
|
|
|
+ _this.sampleform.coderule_sampletype_flag = res.data.coderule_sampletype_flag
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getsampetypeunit () {
|
|
|
+ // 获取样本单位
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/sampletype/sunitajax', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.sampeunitlist = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ choosetype (v) {
|
|
|
+ // 获取特有扩展
|
|
|
+ let _this = this
|
|
|
+ _this.groupnameList = []
|
|
|
+ _this.typetykzlist = []
|
|
|
+ if (_this.sampleform.type_flag === 'add' && v !== '') {
|
|
|
+ _this.$axios.get('/sampletype/gettykzzdgroup?SampleType=' + v, {})
|
|
|
+ .then(res => {
|
|
|
+ console.log('kuozhan', res)
|
|
|
+ for (var i = 0; i < res.data.length; i++) {
|
|
|
+ if (res.data[i].GroupName != '') {
|
|
|
+ _this.groupnameList.push(res.data[i].GroupName)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.Tabs = _this.groupnameList[0]
|
|
|
+ _this.getSpecialkz(v)
|
|
|
+ _this.getCodeRule()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSpecialkz (v) {
|
|
|
+ // 获取特有扩展
|
|
|
+ let _this = this
|
|
|
+ if (_this.sampleform.type_flag === 'add' && v !== '') {
|
|
|
+ _this.$axios.get('/sampletype/gettykzzd?SampleType=' + v, {})
|
|
|
+ .then(res => {
|
|
|
+ _this.typetykzlist = res.data
|
|
|
+ // 获取样本类型数据
|
|
|
+ _this.getsampetypedata(v)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getsampetypedata (v) {
|
|
|
+ // 获取样本类型数据
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/sampletype/sampletypeajax?id=' + v, {})
|
|
|
+ .then(res => {
|
|
|
+ _this.sampleform.Capacitystr = res.data.SampleType.DefaultCapacity + ''
|
|
|
+ if (res.data.VHours === '5000-1-1 23:59:59') {
|
|
|
+ _this.sampleform.Isyongjiu = true
|
|
|
+ } else {
|
|
|
+ _this.sampleform.ValidityDatedate = new Date(res.data.VHours)
|
|
|
+ _this.sampleform.Isyongjiu = false
|
|
|
+ }
|
|
|
+ _this.sampleform.Unit = res.data.SampleType.Unit
|
|
|
+ if (_this.sampleform.code_default === 'true' && _this.sampleform.coderule_sampletype_flag === 1) {
|
|
|
+ if (_this.sampleform.coderule_samplingorgan_flag !== 1 || (_this.sampleform
|
|
|
+ .coderule_samplingorgan_flag ===
|
|
|
+ 1 && _this.selectedorgan.length > 0)) {
|
|
|
+ let sampletype = _this.sampleform.SampleType
|
|
|
+ let sampleselectedorgan = ''
|
|
|
+ if (_this.selectedorgan.length > 0) {
|
|
|
+ sampleselectedorgan = _this.selectedorgan[_this.selectedorgan.length - 1]
|
|
|
+ }
|
|
|
+ _this.getautobarcode(sampletype, sampleselectedorgan)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getCodeRule () {
|
|
|
+ this.$axios.get('/sampleoperation/getcoderule', {})
|
|
|
+ .then(res => {
|
|
|
+ let sampletype = this.sampleform.SampleType
|
|
|
+ this.getautobarcode(sampletype)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getautobarcode (samptype, samporg) {
|
|
|
+ // 获取自动编码
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/sampleoperation/getautobarcode?SampleType=' + samptype + '&fid=' + samporg, {})
|
|
|
+ .then(res => {
|
|
|
+ _this.sampleform.code_lastnum = res.data.num
|
|
|
+ _this.sampleform.SampleCode = res.data.barcode
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getsametypetreelist () {
|
|
|
+ let _this = this
|
|
|
+ // request
|
|
|
+ _this.$axios.get('/sampleorgan/gettreelist', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.organlist2 = window.toolfun_gettreejson(res.data, 'id', 'pId', 'id,name,code')
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ blursamplecode () {
|
|
|
+ let _this = this
|
|
|
+ if (_this.sampleform.SampleCode !== '' && _this.sampleform.type_flag === 'add') {
|
|
|
+ _this.$axios.get('/sampleoperation/getsamplebysamplecode?samplecode=' + this.sampleform.SampleCode, {})
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.SampleCode !== '') {
|
|
|
+ _this.disabledsamplecode = true
|
|
|
+ _this.disabledsampletype = true
|
|
|
+ _this.disabledsourcebutton = true
|
|
|
+ _this.disabledanimalbutton = true
|
|
|
+ _this.sampleform.BarCode = ''
|
|
|
+ _this.sampleform.SampleCode = res.data.SampleCode
|
|
|
+ _this.sampleform.SampleType = res.data.SampleType
|
|
|
+ _this.getparentcodebytopcode(res.data.SamplingOrgan)
|
|
|
+ _this.sampleform.SamplingSite = res.data.SamplingSite
|
|
|
+ _this.sampleform.Name = res.data.Name
|
|
|
+ _this.sampleform.SourceId = res.data.SourceId
|
|
|
+ _this.sampleform.SourceIdCard = res.data.SourceIdCard
|
|
|
+ _this.sampleform.SourceName = res.data.SourceName
|
|
|
+ if (res.data.ReceiveDate.substring(0, 3) === '000') {
|
|
|
+ _this.sampleform.ReceiveDatedate = null
|
|
|
+ } else {
|
|
|
+ _this.sampleform.ReceiveDatedate = new Date(res.data.ReceiveDate)
|
|
|
+ }
|
|
|
+ _this.geteditsampetypedata(_this.sampleform.SampleType)
|
|
|
+ // 定义window变量,eval使用需要
|
|
|
+ let foo = window
|
|
|
+ foo.samplepreoperav = res.data
|
|
|
+ // 给公共扩展信息赋值
|
|
|
+ // for (let i = 0; i < _this.publickzlist.length; i++) {
|
|
|
+ // _this.publickzlist[i].FieldDefault = foo.eval('samplepreoperav.' + _this.publickzlist[i].FieldName)
|
|
|
+ // }
|
|
|
+ // 获取特有扩展并给特有扩展信息赋值
|
|
|
+ _this.getItemGroupName(res.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getItemGroupName (val) {
|
|
|
+ // 获取特有扩展
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/sampletype/gettykzzdgroup?SampleType=' + val.SampleType, {})
|
|
|
+ .then(res => {
|
|
|
+ for (var i = 0; i < res.data.length; i++) {
|
|
|
+ if (res.data[i].GroupName != '') {
|
|
|
+ _this.groupnameList.push(res.data[i].GroupName)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.Tabs = _this.groupnameList[0]
|
|
|
+ _this.getItemDetail(val)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getItemDetail (val) {
|
|
|
+ // 获取特有扩展并赋值
|
|
|
+ if (val && val.SampleType > 0) {
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/sampletype/gettykzzd?SampleType=' + val.SampleType, {})
|
|
|
+ .then(res => {
|
|
|
+ _this.typetykzlist = res.data
|
|
|
+ // 定义window变量,eval使用需要
|
|
|
+ let foo = window
|
|
|
+ foo.typetykzsampedit = val
|
|
|
+ // 给扩展信息赋值
|
|
|
+ for (let i = 0; i < this.typetykzlist.length; i++) {
|
|
|
+ if (this.typetykzlist[i].FieldType == '4') {
|
|
|
+ this.typetykzlist[i].FieldDefault = foo.eval('typetykzsampedit.' + this.typetykzlist[i].FieldName)
|
|
|
+ .substr(
|
|
|
+ 0, 24)
|
|
|
+ } else {
|
|
|
+ this.typetykzlist[i].FieldDefault = foo.eval('typetykzsampedit.' + this.typetykzlist[i].FieldName)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ geteditsampetypedata (v) {
|
|
|
+ // 获取样本类型数据
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/sampletype/sampletypeajax?id=' + v, {})
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ _this.sampleform.Capacitystr = res.data.SampleType.DefaultCapacity + ''
|
|
|
+ if (res.data.VHours === '5000-1-1 23:59:59') {
|
|
|
+ _this.sampleform.Isyongjiu = true
|
|
|
+ } else {
|
|
|
+ _this.sampleform.ValidityDatedate = new Date(res.data.VHours)
|
|
|
+ _this.sampleform.Isyongjiu = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getparentcodebytopcode (v) {
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/sampleorgan/getparentcodebytopcode/' + v, {})
|
|
|
+ .then(res => {
|
|
|
+ _this.selectedorgan = []
|
|
|
+ let pidarr = res.data.split(',')
|
|
|
+ for (var i = pidarr.length - 1; i >= 0; i--) {
|
|
|
+ if (pidarr[i] !== '0') {
|
|
|
+ _this.selectedorgan.push(pidarr[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.getOrgan(_this.selectedorgan[_this.selectedorgan.length - 1])
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取样本类型
|
|
|
+ getType () {
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/sampletype/list', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.sampletypelist = []
|
|
|
+ for (var i = 0; i < res.data.currentItemCount; i++) {
|
|
|
+ _this.sampletypelist.push({
|
|
|
+ label: res.data.items[i].Name,
|
|
|
+ code: res.data.items[i].Code,
|
|
|
+ photo: res.data.items[i].Photo,
|
|
|
+ value: res.data.items[i].Id + ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getuserlist () {
|
|
|
+ this.$axios.get('users/list', {})
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ this.userlist = res.data.items
|
|
|
+ // this.userlist.unshift({
|
|
|
+ // 'Id': this.authUser.Profile.Id,
|
|
|
+ // 'Realname': this.authUser.Profile.Realname
|
|
|
+ // })
|
|
|
+ this.sampleform.CreateUserId = this.authUser.Profile.Id
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取当前上传图片字段
|
|
|
+ getitem (val) {
|
|
|
+ this.imagefiles = ''
|
|
|
+ this.imagefilelist = []
|
|
|
+ this.ImageTitle = val.Name
|
|
|
+ // 显示已存储图片
|
|
|
+ if (val.FieldDefault != '') {
|
|
|
+ let imagearr = []
|
|
|
+ imagearr = val.FieldDefault.split('|')
|
|
|
+ for (var i = 0; i < imagearr.length; i++) {
|
|
|
+ if (imagearr[i] !== '') {
|
|
|
+ this.imagefilelist.unshift({
|
|
|
+ 'name': 'picture - ' + (i + 1),
|
|
|
+ 'url': 'http://' + imagearr[i]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.imagefiles = val.FieldDefault
|
|
|
+ }
|
|
|
+ this.imageDialog = true
|
|
|
+ this.extendId = val.Id
|
|
|
+ },
|
|
|
+ // 扩展字段图片类型处理
|
|
|
+ beforeAvatarUpload (file) {
|
|
|
+ const isJPG = (file.type.indexOf('image/') === 0)
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 10
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error('上传影像文件只能是 图片 格式!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传影像图片大小不能超过 1MB!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ handlePictureCardPreview (file) {
|
|
|
+ this.dialogImageUrl = file.url
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ uploadrequest (option) {
|
|
|
+ let _this = this
|
|
|
+ axios.post(process.env.upfilehost, {})
|
|
|
+ .then(function (res) {
|
|
|
+ if (res.data && res.data.fid && res.data.fid !== '') {
|
|
|
+ option.action = `http://${res.data.url}/${res.data.fid}`
|
|
|
+ _this.uploadimg = {
|
|
|
+ uid: option.file.uid,
|
|
|
+ url: res.data.publicUrl,
|
|
|
+ fid: res.data.fid
|
|
|
+ }
|
|
|
+ uploadajax(option)
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '未上传成功!请刷新界面重新上传!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(function (error) {
|
|
|
+ console.log(error)
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '未上传成功!请重新上传!'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleAvatarSuccess (res, file) {
|
|
|
+ for (var i = 0; i < this.typetykzlist.length; i++) {
|
|
|
+ if (this.typetykzlist[i].Id == this.extendId) {
|
|
|
+ this.typetykzlist[i].FieldDefault = this.typetykzlist[i].FieldDefault +
|
|
|
+ `${this.uploadimg.url}/${this.uploadimg.fid}|`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.imagefiles = ''
|
|
|
+ },
|
|
|
+ handleRemove (file, fileList) {
|
|
|
+ console.log(this.imagefilelist)
|
|
|
+ for (var i = 0; i < this.imagefilelist.length; i++) {
|
|
|
+ if (this.imagefilelist[i].uid != file.uid) {
|
|
|
+ this.imagenewlist = this.imagenewlist + this.imagefilelist[i].url.substring(7, 42) + `|`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var j = 0; j < this.typetykzlist.length; j++) {
|
|
|
+ if (this.typetykzlist[j].Id == this.extendId) {
|
|
|
+ this.typetykzlist[j].FieldDefault = this.imagenewlist
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 合作用户分组处理
|
|
|
+ getGroup (val) {
|
|
|
+ this.$axios.get('samplesgroup/groupbybarcode/' + val, {})
|
|
|
+ .then(res => {
|
|
|
+ this.GroupIdOption = []
|
|
|
+ if (res.data.GroupId != '') {
|
|
|
+ let tempArr = res.data.GroupId.split(',')
|
|
|
+ for (let idx in tempArr) {
|
|
|
+ this.GroupIdOption.push(parseInt(tempArr[idx]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getGrouplist () {
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/samplesgroup/grouplist', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.groupList = res.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ .donorsggextendcard .el-card__header {
|
|
|
+ padding: 5px 10px;
|
|
|
+ font-size: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .donorsggextendcard .el-card__body {
|
|
|
+ padding: 5px;
|
|
|
+ margin: -11px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|