Просмотр исходного кода

冰排、保温箱、冷冻柜复制功能

AaronBruin 2 месяцев назад
Родитель
Сommit
8bc7b68117

+ 729 - 697
src/components/forms.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 表单 -->
-  <div class="card_employee" :style="{maxHeight:beyondHeight}">
+  <div class="card_employee" :style="{ maxHeight: beyondHeight }">
     <el-form ref="ruleForm" @submit.native.prevent :label-position="labelPosition" :model="ruleForm"
       :label-width="labelWidth">
       <el-row :gutter="10">
@@ -9,8 +9,8 @@
             :rules="detail ? item.rules : {}" v-if="item.type === 'input'">
             <el-input :placeholder="item.placeholder" :disabled="item.disabled" :id="item.field"
               v-model="ruleForm[`${item.field}`]" auto-complete="new-password"
-              :show-password="['newPassword','password'].includes(item.field) ? true : false"></el-input>
-            <div class="unit_card" v-if="item.unit">{{item.unit}}</div>
+              :show-password="['newPassword', 'password'].includes(item.field) ? true : false"></el-input>
+            <div class="unit_card" v-if="item.unit">{{ item.unit }}</div>
           </el-form-item>
           <!-- 坐标 -->
           <el-form-item class="card_independent" :label-width="item.labelWidth" :label="item.label" :prop="item.field"
@@ -28,6 +28,12 @@
                 inactive-color="#ff4949"></el-switch>
             </div>
           </el-form-item>
+          <!-- 复制数量 -->
+          <el-form-item class="card_independent" :label-width="item.labelWidth" label="复制数量" prop="copyNumber" :rules="copyRule"
+            v-if="item.type == 'copyflag' && copyFlag">
+            <el-input placeholder="请输入复制数量" v-model="ruleForm.copyNumber" auto-complete="new-password"
+              :show-password="['newPassword', 'password'].includes(item.field) ? true : false"></el-input>
+          </el-form-item>
           <!-- 扫码添加药品信息Drug tracing code -->
           <el-form-item class="card_independent" :label-width="item.labelWidth" :label="item.label" :prop="item.field"
             :rules="detail ? item.rules : {}" v-if="item.type === 'tracingCode'">
@@ -39,7 +45,7 @@
             </el-input>
           </el-form-item>
           <div style="margin-bottom: 10px;" v-if="item.field === 'divider'">
-            <el-divider>{{item.label}}</el-divider>
+            <el-divider>{{ item.label }}</el-divider>
             <el-table :data="commodityList" stripe style="width: 100%" max-height="220" v-loading="loadedDrug">
               <el-table-column align="center" prop="physic_name" label="商品名称"></el-table-column>
               <!-- <el-table-column align="center" prop="address" label="药品图片" width="100">
@@ -68,12 +74,12 @@
                 @click="serialNumber(item.field)"></el-button>
             </el-input>
             <div class="card_IceList" v-if="formIceTracing">
-              <div class="ser_card_ial" v-for="(serial,num) in inputsList" :key="num">
+              <div class="ser_card_ial" v-for="(serial, num) in inputsList" :key="num">
                 <div style="display: flex;align-items: center;">
-                  <div>{{num + 1}}</div>
-                  <div class="title_serial">{{serial}}</div>
+                  <div>{{ num + 1 }}</div>
+                  <div class="title_serial">{{ serial }}</div>
                 </div>
-                <span class="del_serial" @click="delSerial(serial,num)">删除</span>
+                <span class="del_serial" @click="delSerial(serial, num)">删除</span>
               </div>
             </div>
           </el-form-item>
@@ -81,7 +87,8 @@
             <el-transfer v-model="value" :data="data"></el-transfer>
           </div> -->
           <div v-if="formIceTracing && item.type === 'scan'"
-            :style="{height:scanHeight(inputsList.length),width:'100%'}"></div>
+            :style="{ height: scanHeight(inputsList.length), width: '100%' }">
+          </div>
           <el-form-item :label-width="item.labelWidth" :label="item.label" :prop="item.field"
             :rules="detail ? item.rules : {}" v-if="item.type === 'textarea'">
             <el-input :maxlength="item.maxLenght" type="textarea" :rows="item.rowsHeight" :disabled="item.disabled"
@@ -91,7 +98,7 @@
             :rules="detail ? item.rules : {}" v-if="item.type === 'select'">
             <el-select :id="item.field" v-model="ruleForm[`${item.field}`]" :placeholder="item.placeholder"
               :disabled="item.disabled" :multiple="item.multiple" style="width: 100%" :filterable="item.createEntry"
-              :allow-create="item.createEntry" @change="(params) => changeSelect(params,item.field)">
+              :allow-create="item.createEntry" @change="(params) => changeSelect(params, item.field)">
               <el-option v-for="(element, i) in item.options" :label="element.label" :value="`${element.value}`"
                 :key="i">
                 <span style="float: left">{{ element.label }}</span>
@@ -121,8 +128,8 @@
             <div style="display: flex;height: 40px;align-items: center;">
               <el-radio-group v-remove-hidden v-model="ruleForm[`${item.field}`]" :disabled="item.disabled"
                 @input="radioInput">
-                <el-radio v-for="(element, i) in item.options" :key="i"
-                  :label="element.value">{{element.label}}</el-radio>
+                <el-radio v-for="(element, i) in item.options" :key="i" :label="element.value">{{ element.label
+                }}</el-radio>
               </el-radio-group>
             </div>
           </el-form-item>
@@ -146,31 +153,32 @@
             </el-date-picker>
           </el-form-item>
           <div v-if="item.type === 'divider'">
-            <div v-if="item.label">{{item.label}}</div>
+            <div v-if="item.label">{{ item.label }}</div>
             <el-divider></el-divider>
           </div>
           <div style="height: 40px;display: flex;align-items: center;" v-if="item.type === 'search'">
             <el-button size="small" type="primary" :loading="curLoading" :disabled="item.disabled"
-              @click="numberSearch">{{item.label}}</el-button>
+              @click="numberSearch">{{
+                item.label }}</el-button>
           </div>
           <div style="height: 10px;width: 100%;" v-if="item.type === 'dividingSlot'"></div>
           <el-form-item class="card_descriptions" :label="item.label" :prop="item.field"
             :rules="detail ? item.rules : {}" v-if="item.type === 'descriptions'">
-            <span class="descriptions_title">{{ruleForm[`${item.field}`] || ''}}
+            <span class="descriptions_title">{{ ruleForm[`${item.field}`] || '' }}
               <span class="descriptions_badge center_in" v-if="item.field == 'name'">商户</span>
               <span v-if="item.field == 'quantity'">瓶</span>
             </span>
           </el-form-item>
           <el-form-item class="card_descriptions" :label="item.label" :prop="item.field"
             :rules="detail ? item.rules : {}" v-if="item.type === 'nvarchar' || item.type === 'nvarcharil'">
-            <span class="descriptions_title" v-if="item.type === 'nvarchar'">{{ruleForm[`${item.field}`]}}</span>
-            <span class="descriptions_title" :style="{color: filterColor(ruleForm,item.options,item.field)}"
-              v-else-if="item.type === 'nvarcharil'">{{initDictvalueil(ruleForm,item.options,item.field)}}</span>
+            <span class="descriptions_title" v-if="item.type === 'nvarchar'">{{ ruleForm[`${item.field}`] }}</span>
+            <span class="descriptions_title" :style="{ color: filterColor(ruleForm, item.options, item.field) }"
+              v-else-if="item.type === 'nvarcharil'">{{ initDictvalueil(ruleForm, item.options, item.field) }}</span>
           </el-form-item>
           <el-form-item class="card_descriptions" :label="item.label" :prop="item.field"
             :rules="detail ? item.rules : {}" v-if="item.type === 'picture'">
             <div style="display: flex;align-items: center;flex-wrap: wrap;" v-if="item.urlList.length > 0">
-              <div v-for="(item,index) in item.urlList" :key="index">
+              <div v-for="(item, index) in item.urlList" :key="index">
                 <el-image style="width: 100px; height: 100px;border-radius: 5px;margin-right: 10px;" :src="item"
                   :preview-src-list="[item]">
                 </el-image>
@@ -181,7 +189,7 @@
           <el-form-item :class="item.crosswise ? '' : 'card_fuel_gas'" :label="item.label" :prop="item.field"
             :rules="detail ? item.rules : {}" v-if="item.type === 'singleUpload'">
             <el-upload class="avatar-uploader" action="#" :show-file-list="false" :disabled="item.disabled"
-              :http-request="(params) => singleUpload(params,item.field)">
+              :http-request="(params) => singleUpload(params, item.field)">
               <img v-if="ruleForm[`${item.field}`]" :src="$baseUrl + ruleForm[`${item.field}`]" class="avatar">
               <i v-else class="el-icon-plus avatar-uploader-icon"></i>
             </el-upload>
@@ -207,7 +215,7 @@
                   </div>
                 </el-upload>
                 <div class="card_image" v-else>
-                  <div v-for="(item,index) in ruleForm.fileList" :key="index">
+                  <div v-for="(item, index) in ruleForm.fileList" :key="index">
                     <img class="avatar_image" :src="item.url" alt="" />
                     <!-- <el-image class="avatar_image" :src="item.url" :preview-src-list="[item.url]">
                       <div slot="placeholder" class="image-slot">
@@ -227,12 +235,12 @@
         </el-col>
         <el-col :span="20" :offset="4" v-if="iceBank && !formIceTracing">
           <div style="display: flex;flex-direction: column;">
-            <div class="ser_card_ial margin_around" v-for="(serial,num) in inputsList" :key="num">
+            <div class="ser_card_ial margin_around" v-for="(serial, num) in inputsList" :key="num">
               <div style="display: flex;align-items: center;">
-                <div>{{num + 1}}</div>
-                <div class="title_serial">{{serial}}</div>
+                <div>{{ num + 1 }}</div>
+                <div class="title_serial">{{ serial }}</div>
               </div>
-              <span class="del_serial" @click="delSerial(serial,num)">删除</span>
+              <span class="del_serial" @click="delSerial(serial, num)">删除</span>
             </div>
           </div>
         </el-col>
@@ -252,8 +260,8 @@
       <span slot="footer" class="dialog-footer">
         <div class="space_between_in">
           <div class="card_coord">
-            <div class="coord_address">当前坐标:{{dataForm.kqLongitude}},{{dataForm.kqLatitude}}</div>
-            <div class="coord_address">地址:{{dataForm.kqLocation}}</div>
+            <div class="coord_address">当前坐标:{{ dataForm.kqLongitude }},{{ dataForm.kqLatitude }}</div>
+            <div class="coord_address">地址:{{ dataForm.kqLocation }}</div>
           </div>
           <div style="display: flex;align-items: center;">
             <el-button @click="innerVisible = false">取 消</el-button>
@@ -266,747 +274,771 @@
 </template>
 
 <script>
-  import {
-    getFileToken,
-    aliMsfx
-  } from '@/api/login'
-  import {
-    getIceRaftCode,
-  } from '@/api/iceRaft'
-  export default {
-    name: "forms",
-    props: {
-      // 表单tabel数据
-      formNewList: {
-        type: Array,
-        default: () => [],
-      },
-      // 表单label宽度
-      labelWidth: {
-        type: String,
-        default: () => '120px',
-      },
-      // 对齐方式
-      labelPosition: {
-        type: String,
-        default: () => 'right',
-      },
-      // 绑定值
-      ruleForm: {
-        type: Object,
-        default: () => {},
-      },
-      // 类型
-      operationType: {
-        type: String,
-        default: () => '',
-      },
-      // 冰排冰库
-      iceBank: {
-        type: Boolean,
-        default: () => false,
-      },
-      // 冰排追溯
-      iceTracing: {
-        type: Boolean,
-        default: () => false,
-      },
-      // 表单冰排
-      formIceTracing: {
-        type: Boolean,
-        default: () => false,
-      },
-      // 超出隐藏
-      beyondHeight: {
-        type: String,
-        default: () => '630px',
-      },
-      // 商品列表
-      delDrug: {
-        type: Boolean,
-        default: () => false,
-      },
+import {
+  getFileToken,
+  aliMsfx
+} from '@/api/login'
+import {
+  getIceRaftCode,
+} from '@/api/iceRaft'
+export default {
+  name: "forms",
+  props: {
+    // 表单tabel数据
+    formNewList: {
+      type: Array,
+      default: () => [],
     },
-    watch: {
-      formNewList: {
-        immediate: true, // 立即触发监听函数
-        handler() {
-          this.formList = this.formNewList;
-        },
-      },
+    // 表单label宽度
+    labelWidth: {
+      type: String,
+      default: () => '120px',
     },
-    data() {
-      return {
-        detail: true,
-        formList: [],
-        imageUrl: '',
-        file: null,
-        dialogImageUrl: '',
-        dialogVisible: false,
-        disabled: false,
-        fileList: [],
-        curLoading: false,
-
-        inputs: "",
-        timearr: [0, 0],
-        isScanningGun: false,
-        inputsList: [],
-        typeField: '',
-
-        // 商品列表
-        commodityList: [],
-        loadedDrug: false,
-        innerVisible: false,
-        map: null,
-
-        inputAddress: '',
-        address: '',
-        auto: null,
-        placeSearch: null,
-        lnglat: [],
-        markers: [],
-        dataForm: {
-          kqLocation: undefined,
-          kqLongitude: undefined,
-          kqLatitude: undefined,
-        },
-        position: {},
-        city: [],
-        province: {},
-        form: {
-          province: {},
-          city: [],
-          address: '',
-        },
-        value: [],
-        data: [{
-          key: 1,
-          label: '004'
-        }],
-      }
+    // 对齐方式
+    labelPosition: {
+      type: String,
+      default: () => 'right',
+    },
+    // 绑定值
+    ruleForm: {
+      type: Object,
+      default: () => { },
+    },
+    // 类型
+    operationType: {
+      type: String,
+      default: () => '',
+    },
+    // 冰排冰库
+    iceBank: {
+      type: Boolean,
+      default: () => false,
+    },
+    // 冰排追溯
+    iceTracing: {
+      type: Boolean,
+      default: () => false,
+    },
+    // 表单冰排
+    formIceTracing: {
+      type: Boolean,
+      default: () => false,
     },
-    methods: {
-      //下拉框下拉事件
-      changeSelect(row, field) {
-        this.$forceUpdate()
-        this.$emit("changeSelect", row, field);
+    // 超出隐藏
+    beyondHeight: {
+      type: String,
+      default: () => '630px',
+    },
+    // 商品列表
+    delDrug: {
+      type: Boolean,
+      default: () => false,
+    },
+    // 复制数量
+    copyFlag: {
+      type: Boolean,
+      default: () => false,
+    },
+  },
+  watch: {
+    formNewList: {
+      immediate: true, // 立即触发监听函数
+      handler() {
+        this.formList = this.formNewList;
       },
-      // 搜索选择
-      changeOption(row, field) {
-        this.$emit("changeOption", row, field);
+    },
+  },
+  data() {
+    return {
+      detail: true,
+      formList: [],
+      imageUrl: '',
+      file: null,
+      dialogImageUrl: '',
+      dialogVisible: false,
+      disabled: false,
+      fileList: [],
+      curLoading: false,
+
+      inputs: "",
+      timearr: [0, 0],
+      isScanningGun: false,
+      inputsList: [],
+      typeField: '',
+
+      // 商品列表
+      commodityList: [],
+      loadedDrug: false,
+      innerVisible: false,
+      map: null,
+
+      inputAddress: '',
+      address: '',
+      auto: null,
+      placeSearch: null,
+      lnglat: [],
+      markers: [],
+      dataForm: {
+        kqLocation: undefined,
+        kqLongitude: undefined,
+        kqLatitude: undefined,
       },
-      // 重置校验
-      resetCheck() {
-        const that = this
-        if (that.iceTracing) {
-          that.inputs = ''
-          that.inputsList = []
-          checkType(that.ruleForm.code)
-
-          function checkType(value) {
-            if (typeof value === 'string') {
-              that.ruleForm.code = ''
-            } else if (Array.isArray(value)) {
-              that.ruleForm.code = []
-            } else {
-              that.ruleForm.code = []
-            }
-          }
-        }
-        that.$refs.ruleForm.resetFields();
+      position: {},
+      city: [],
+      province: {},
+      form: {
+        province: {},
+        city: [],
+        address: '',
       },
-      // 单个图片上传
-      singleUpload(file, value) {
-        const loading = this.$loading({
-          lock: true,
-          text: 'Loading',
-          spinner: 'el-icon-loading',
-          background: 'rgba(0, 0, 0, 0.7)'
-        });
-        this.file = file.file;
-        let formData = new FormData();
-        formData.append('file', this.file);
-        getFileToken(formData).then(res => {
-          if (res.code == 200) {
-            this.ruleForm[`${value}`] = res.data
-            this.$forceUpdate()
+      value: [],
+      data: [{
+        key: 1,
+        label: '004'
+      }],
+      copyRule: [{
+        required: false,
+        message: '请输入复制数量',
+        trigger: 'blur'
+      }, {
+        required: false,
+        validator: (rule, value, callback) => {
+          if (!value && rule.required) {
+            return callback(new Error('请输入复制数量'));
           }
-          loading.close();
-        }).catch(e => {
-          loading.close();
-          this.$message.error('上传失败');
-        })
-      },
-      // 上传文件
-      UploadImage(file) {
-        const loading = this.$loading({
-          lock: true,
-          text: 'Loading',
-          spinner: 'el-icon-loading',
-          background: 'rgba(0, 0, 0, 0.7)'
-        });
-        this.file = file.file;
-        let formData = new FormData();
-        formData.append('file', this.file);
-        getFileToken(formData).then(res => {
-          if (res.code == 200) {
-            let arr1 = {
-              uid: this.file.uid,
-              url: res.data,
+          if (value) {
+            if (!/^(\d+)?(\.\d+)?$/.test(value)) {
+              return callback(new Error('请输入有效的数值'));
             }
-            this.ruleForm.fileList.push(arr1)
           }
-          loading.close();
-        }).catch(e => {
-          // console.log(e, 23)
-          loading.close();
-          this.$message.error('上传失败');
-        })
-      },
-      // 手机号搜索
-      numberSearch() {
-        let flag = false
-        this.$refs['ruleForm'].validateField('phone', valid => {
-          if (!valid) {
-            this.curLoading = true
-            this.$emit('numberSearch', this.ruleForm.phone)
+          return callback();
+        },
+        trigger: ['blur', 'change']
+      }],
+    }
+  },
+  methods: {
+    //下拉框下拉事件
+    changeSelect(row, field) {
+      this.$forceUpdate()
+      this.$emit("changeSelect", row, field);
+    },
+    // 搜索选择
+    changeOption(row, field) {
+      this.$emit("changeOption", row, field);
+    },
+    // 重置校验
+    resetCheck() {
+      const that = this
+      if (that.iceTracing) {
+        that.inputs = ''
+        that.inputsList = []
+        checkType(that.ruleForm.code)
+
+        function checkType(value) {
+          if (typeof value === 'string') {
+            that.ruleForm.code = ''
+          } else if (Array.isArray(value)) {
+            that.ruleForm.code = []
           } else {
-            console.log('error submit!!');
-            return false;
+            that.ruleForm.code = []
           }
-        });
-      },
-      // 单选选择
-      radioInput(label) {
-        this.$emit('radioInput', label)
-      },
-      // tag颜色获取
-      filterColor(value, list, type) {
-        let color = ''
-        list.forEach(item => {
-          if (value[type] === item.value) {
-            color = item.bgcolor
+        }
+      }
+      that.$refs.ruleForm.resetFields();
+    },
+    // 单个图片上传
+    singleUpload(file, value) {
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      this.file = file.file;
+      let formData = new FormData();
+      formData.append('file', this.file);
+      getFileToken(formData).then(res => {
+        if (res.code == 200) {
+          this.ruleForm[`${value}`] = res.data
+          this.$forceUpdate()
+        }
+        loading.close();
+      }).catch(e => {
+        loading.close();
+        this.$message.error('上传失败');
+      })
+    },
+    // 上传文件
+    UploadImage(file) {
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      this.file = file.file;
+      let formData = new FormData();
+      formData.append('file', this.file);
+      getFileToken(formData).then(res => {
+        if (res.code == 200) {
+          let arr1 = {
+            uid: this.file.uid,
+            url: res.data,
           }
-        })
-        return color
-      },
-      // 普通类型文字匹配
-      initDictvalueil(value, list, type) {
-        let name = ''
-        if (list) {
-          list.forEach(item => {
-            if (value[type] === item.value) {
-              name = item.label
-            }
-          })
+          this.ruleForm.fileList.push(arr1)
         }
-        return name
-      },
-      handleScroll() {
-        // console.log('触底了')
-        this.$emit('handleScroll')
-      },
-      remoteMethod(val, type) {
-        // console.log('远程搜索', val, type)
-        this.$emit('remoteMethod', val, type)
-      },
-      // 删除
-      handleRemove(file) {
-        const filteredArr = this.ruleForm.fileList.filter(obj => obj.uid !== file.uid);
-        this.ruleForm.fileList = filteredArr
-        this.$forceUpdate()
-      },
-      // 查看
-      handlePictureCardPreview(file) {
-        this.dialogImageUrl = file.url;
-        this.dialogVisible = true;
-      },
-      beforeAvatarUpload(file) {
-        const isJPG = file.type === 'image/jpeg';
-        const isLt2M = file.size / 1024 / 1024 < 2;
-        if (!isJPG) {
-          this.$message.error('上传头像图片只能是 JPG 格式!');
+        loading.close();
+      }).catch(e => {
+        // console.log(e, 23)
+        loading.close();
+        this.$message.error('上传失败');
+      })
+    },
+    // 手机号搜索
+    numberSearch() {
+      let flag = false
+      this.$refs['ruleForm'].validateField('phone', valid => {
+        if (!valid) {
+          this.curLoading = true
+          this.$emit('numberSearch', this.ruleForm.phone)
+        } else {
+          console.log('error submit!!');
+          return false;
         }
-        if (!isLt2M) {
-          this.$message.error('上传头像图片大小不能超过 2MB!');
+      });
+    },
+    // 单选选择
+    radioInput(label) {
+      this.$emit('radioInput', label)
+    },
+    // tag颜色获取
+    filterColor(value, list, type) {
+      let color = ''
+      list.forEach(item => {
+        if (value[type] === item.value) {
+          color = item.bgcolor
         }
-        return isJPG && isLt2M;
-      },
-      // 添加编号
-      serialNumber(field) {
-        if (this.inputs) {
-          if (field == 'drugCode') {
-            let index = this.commodityList.findIndex((item) => item.code === this.inputs);
-            // 如果有就替换,没有就添加
-            if (index == -1) {
-              this.loadedDrug = true
-              var requestOptions = {
-                method: 'GET',
-                redirect: 'follow'
-              };
-              fetch("https://public.coldbaozhida.com/Ali_msfx/codedetail?code=" + this.inputs, requestOptions)
-                .then(response => response.json())
-                .then(data => {
-                  if (data.status == 200) {
-                    this.inputs = ''
-                    let arr = JSON.parse(data.data)
-                    // console.log(arr, 24)
-                    if (arr.result.models.length > 0) {
-                      let drugList = {
-                        code: '',
-                        physic_name: '',
-                        physic_type_desc: '',
-                        pkg_spec_crit: '',
-                        ent_name: '',
-                      }
-                      drugList.code = arr.result.models[0].code
-                      drugList.physic_name = arr.result.models[0].drug_ent_base_d_t_o.physic_name
-                      drugList.physic_type_desc = arr.result.models[0].drug_ent_base_d_t_o.physic_type_desc
-                      drugList.pkg_spec_crit = arr.result.models[0].drug_ent_base_d_t_o.pkg_spec_crit
-                      drugList.ent_name = arr.result.models[0].p_user_ent_d_t_o.ent_name
-                      this.commodityList.push(drugList)
-                      this.commodityList = this.uniqueArray(this.commodityList)
-                      this.ruleForm[`${field}`] = this.commodityList
-                    } else {
-                      this.$message.error('该商品不存在');
+      })
+      return color
+    },
+    // 普通类型文字匹配
+    initDictvalueil(value, list, type) {
+      let name = ''
+      if (list) {
+        list.forEach(item => {
+          if (value[type] === item.value) {
+            name = item.label
+          }
+        })
+      }
+      return name
+    },
+    handleScroll() {
+      // console.log('触底了')
+      this.$emit('handleScroll')
+    },
+    remoteMethod(val, type) {
+      // console.log('远程搜索', val, type)
+      this.$emit('remoteMethod', val, type)
+    },
+    // 删除
+    handleRemove(file) {
+      const filteredArr = this.ruleForm.fileList.filter(obj => obj.uid !== file.uid);
+      this.ruleForm.fileList = filteredArr
+      this.$forceUpdate()
+    },
+    // 查看
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+    },
+    beforeAvatarUpload(file) {
+      const isJPG = file.type === 'image/jpeg';
+      const isLt2M = file.size / 1024 / 1024 < 2;
+      if (!isJPG) {
+        this.$message.error('上传头像图片只能是 JPG 格式!');
+      }
+      if (!isLt2M) {
+        this.$message.error('上传头像图片大小不能超过 2MB!');
+      }
+      return isJPG && isLt2M;
+    },
+    // 添加编号
+    serialNumber(field) {
+      if (this.inputs) {
+        if (field == 'drugCode') {
+          let index = this.commodityList.findIndex((item) => item.code === this.inputs);
+          // 如果有就替换,没有就添加
+          if (index == -1) {
+            this.loadedDrug = true
+            var requestOptions = {
+              method: 'GET',
+              redirect: 'follow'
+            };
+            fetch("https://public.coldbaozhida.com/Ali_msfx/codedetail?code=" + this.inputs, requestOptions)
+              .then(response => response.json())
+              .then(data => {
+                if (data.status == 200) {
+                  this.inputs = ''
+                  let arr = JSON.parse(data.data)
+                  // console.log(arr, 24)
+                  if (arr.result.models.length > 0) {
+                    let drugList = {
+                      code: '',
+                      physic_name: '',
+                      physic_type_desc: '',
+                      pkg_spec_crit: '',
+                      ent_name: '',
                     }
+                    drugList.code = arr.result.models[0].code
+                    drugList.physic_name = arr.result.models[0].drug_ent_base_d_t_o.physic_name
+                    drugList.physic_type_desc = arr.result.models[0].drug_ent_base_d_t_o.physic_type_desc
+                    drugList.pkg_spec_crit = arr.result.models[0].drug_ent_base_d_t_o.pkg_spec_crit
+                    drugList.ent_name = arr.result.models[0].p_user_ent_d_t_o.ent_name
+                    this.commodityList.push(drugList)
+                    this.commodityList = this.uniqueArray(this.commodityList)
+                    this.ruleForm[`${field}`] = this.commodityList
+                  } else {
+                    this.$message.error('该商品不存在');
                   }
-                  this.loadedDrug = false
-                }).catch(error => {
-                  this.$message.error('添加失败');
-                  this.loadedDrug = false
-                });
-              // return
-              // aliMsfx({
-              //   code: this.inputs,
-              // }).then(res => {}).catch(() => {
-              //   this.$message.error('添加失败');
-              //   this.loadedDrug = false
-              // })
-            } else {
-              this.$message.warning('该商品已存在');
-            }
+                }
+                this.loadedDrug = false
+              }).catch(error => {
+                this.$message.error('添加失败');
+                this.loadedDrug = false
+              });
+            // return
+            // aliMsfx({
+            //   code: this.inputs,
+            // }).then(res => {}).catch(() => {
+            //   this.$message.error('添加失败');
+            //   this.loadedDrug = false
+            // })
           } else {
-            getIceRaftCode(this.inputs).then(res => {
-              if (res.code == 200) {
-                this.inputsList.push(this.inputs)
-                this.inputsList = this.uniqueArray(this.inputsList)
-                console.log(this.inputsList, 889)
-                this.inputs = ''
-                this.ruleForm[`${field}`] = this.inputsList
-              }
-            })
+            this.$message.warning('该商品已存在');
           }
+        } else {
+          getIceRaftCode(this.inputs).then(res => {
+            if (res.code == 200) {
+              this.inputsList.push(this.inputs)
+              this.inputsList = this.uniqueArray(this.inputsList)
+              console.log(this.inputsList, 889)
+              this.inputs = ''
+              this.ruleForm[`${field}`] = this.inputsList
+            }
+          })
         }
-      },
-      // 回车添加
-      keydownBarcode(field) {
-        if (this.inputs) {
-          this.inputsList.push(this.inputs)
-          this.inputsList = this.uniqueArray(this.inputsList)
-          this.inputs = ''
-          this.ruleForm[`${field}`] = this.inputsList
-        }
-      },
-      // 输入
-      iceRaftInput(value) {
-        let arr = []
-        arr.push(value)
-        this.ruleForm.code = arr
-      },
-      // 药品删除
-      deleteRow(index, rows) {
-        rows.splice(index, 1);
-      },
-      // 去重
-      uniqueArray(arr) {
-        return [...new Set(arr)];
-      },
-      // 删除编号
-      delSerial(value, index) {
-        this.inputsList.splice(index, 1)
-        this.ruleForm[`${this.typeField}`] = this.inputsList
-        // this.ruleForm['code'].splice(index, 1);
-      },
-      focus(field) {
-        this.typeField = field
-      },
-      // 级联选择器关闭
-      handleChange(value, type) {
-        if (this.$refs.organizerUnit) {
-          this.$refs.organizerUnit[0].dropDownVisible = false
-        }
-      },
-      scanHeight(num) {
-        let arr = '0px'
-        if (num < 4) {
-          arr = num * 45 + 'px'
+      }
+    },
+    // 回车添加
+    keydownBarcode(field) {
+      if (this.inputs) {
+        this.inputsList.push(this.inputs)
+        this.inputsList = this.uniqueArray(this.inputsList)
+        this.inputs = ''
+        this.ruleForm[`${field}`] = this.inputsList
+      }
+    },
+    // 输入
+    iceRaftInput(value) {
+      let arr = []
+      arr.push(value)
+      this.ruleForm.code = arr
+    },
+    // 药品删除
+    deleteRow(index, rows) {
+      rows.splice(index, 1);
+    },
+    // 去重
+    uniqueArray(arr) {
+      return [...new Set(arr)];
+    },
+    // 删除编号
+    delSerial(value, index) {
+      this.inputsList.splice(index, 1)
+      this.ruleForm[`${this.typeField}`] = this.inputsList
+      // this.ruleForm['code'].splice(index, 1);
+    },
+    focus(field) {
+      this.typeField = field
+    },
+    // 级联选择器关闭
+    handleChange(value, type) {
+      if (this.$refs.organizerUnit) {
+        this.$refs.organizerUnit[0].dropDownVisible = false
+      }
+    },
+    scanHeight(num) {
+      let arr = '0px'
+      if (num < 4) {
+        arr = num * 45 + 'px'
+      } else {
+        arr = 3 * 45 + 'px'
+      }
+      return arr
+    },
+    //子组件校验,传递到父组件
+    validateForm() {
+      let flag = null
+      this.$refs['ruleForm'].validate(valid => {
+        if (valid) {
+          flag = true
         } else {
-          arr = 3 * 45 + 'px'
+          flag = false
         }
-        return arr
-      },
-      //子组件校验,传递到父组件
-      validateForm() {
-        let flag = null
-        this.$refs['ruleForm'].validate(valid => {
-          if (valid) {
-            flag = true
-          } else {
-            flag = false
-          }
-        })
-        return flag
-      },
-      coordFocus() {
-        this.innerVisible = true
+      })
+      return flag
+    },
+    coordFocus() {
+      this.innerVisible = true
 
-      },
-      mapOpened() {
-        this.$nextTick(() => {
-          setTimeout(() => {
-            this.keyUpSearch()
-          }, 100)
-        })
-      },
-      keyUpSearch() {
-        var that = this
-        that.map = new AMap.Map("container", {
-          resizeEnable: true,
-          zoom: 3,
-        });
-        that.map.setFitView()
-        // 关键字查询
-        that.searchMap();
-        // 监听鼠标点击事件
-        that.map.on("click", that.clickMapHandler);
+    },
+    mapOpened() {
+      this.$nextTick(() => {
+        setTimeout(() => {
+          this.keyUpSearch()
+        }, 100)
+      })
+    },
+    keyUpSearch() {
+      var that = this
+      that.map = new AMap.Map("container", {
+        resizeEnable: true,
+        zoom: 3,
+      });
+      that.map.setFitView()
+      // 关键字查询
+      that.searchMap();
+      // 监听鼠标点击事件
+      that.map.on("click", that.clickMapHandler);
 
-      },
-      searchMap() {
-        var that = this
-        // 搜索框自动完成类
-        that.auto = new AMap.Autocomplete({
-          input: "tipinputMap", // 使用联想输入的input的id
-        });
-        //构造地点查询类
-        that.placeSearch = new AMap.PlaceSearch({
-          map: that.map,
-        });
-        // 当选中某条搜索记录时触发
-        that.auto.on("select", that.selectSite);
-      },
-      //选中查询出的记录
-      selectSite(e) {
-        if (e.poi.location) {
-          // this.lnglat = [e.poi.location.lng, e.poi.location.lat];
-          this.placeSearch.setCity(e.poi.adcode);
-          this.placeSearch.search(e.poi.name); //关键字查询
-          let geocoder = new AMap.Geocoder({});
-          let that = this;
-          geocoder.getAddress(this.lnglat, function(status, result) {
-            if (status === "complete" && result.regeocode) {
-              if (result.regeocode) {
-                that.province = result.regeocode.addressComponent.province;
-                that.city = result.regeocode.addressComponent.city;
-                //自己想要赋的值,根据自己的做修改
-                that.$set(that.form, "province", that.province);
-              }
-              that.$set(that.form, "city", that.city);
-              that.$set(that.form, "address", e.poi.name);
-              that.$set(
-                that.form,
-                "companyCoordinate",
-                e.poi.location.lng + "," + e.poi.location.lat
-              ); //纬度,经度
-            } else {}
-          });
-        } else {
-          this.$message.error("查询地址失败,请重新输入地址");
-        }
-      },
-      // 点击地图事件获取经纬度,并添加标记
-      clickMapHandler(e) {
-        // console.log(e, 23)
-        this.dataForm.kqLongitude = e.lnglat.getLng();
-        this.dataForm.kqLatitude = e.lnglat.getLat();
-        this.lnglat = [e.lnglat.getLng(), e.lnglat.getLat()];
-        // this.ruleForm.companyCoordinate = e.lnglat.getLng() + ',' + e.lnglat.getLat();
-        this.setMarker(this.lnglat);
-        // 点击地图上的位置,根据经纬度转换成详细地址
+    },
+    searchMap() {
+      var that = this
+      // 搜索框自动完成类
+      that.auto = new AMap.Autocomplete({
+        input: "tipinputMap", // 使用联想输入的input的id
+      });
+      //构造地点查询类
+      that.placeSearch = new AMap.PlaceSearch({
+        map: that.map,
+      });
+      // 当选中某条搜索记录时触发
+      that.auto.on("select", that.selectSite);
+    },
+    //选中查询出的记录
+    selectSite(e) {
+      if (e.poi.location) {
+        // this.lnglat = [e.poi.location.lng, e.poi.location.lat];
+        this.placeSearch.setCity(e.poi.adcode);
+        this.placeSearch.search(e.poi.name); //关键字查询
         let geocoder = new AMap.Geocoder({});
         let that = this;
-        geocoder.getAddress(this.lnglat, function(status, result) {
+        geocoder.getAddress(this.lnglat, function (status, result) {
           if (status === "complete" && result.regeocode) {
-            // that.ruleForm.companyAddress = result.regeocode.formattedAddress;
-            that.dataForm.kqLocation = result.regeocode.formattedAddress;
-          } else {}
-        });
-        this.position = {
-          longitude: e.lnglat.getLng(),
-          latitude: e.lnglat.getLat(),
-          address: that.address,
-        };
-        this.inputAddress = that.address;
-      },
-      //  添加标记
-      setMarker(lnglat) {
-        this.removeMarker();
-        let marker = new AMap.Marker({
-          position: lnglat,
+            if (result.regeocode) {
+              that.province = result.regeocode.addressComponent.province;
+              that.city = result.regeocode.addressComponent.city;
+              //自己想要赋的值,根据自己的做修改
+              that.$set(that.form, "province", that.province);
+            }
+            that.$set(that.form, "city", that.city);
+            that.$set(that.form, "address", e.poi.name);
+            that.$set(
+              that.form,
+              "companyCoordinate",
+              e.poi.location.lng + "," + e.poi.location.lat
+            ); //纬度,经度
+          } else { }
         });
-        marker.setMap(this.map);
-        this.markers.push(marker);
-      },
-      // 删除之前后的标记点
-      removeMarker() {
-        if (this.markers) {
-          this.map.remove(this.markers);
-        }
-      },
-      // 确定经纬度
-      confirmLocation() {
-        if (this.dataForm.kqLongitude) {
-          this.innerVisible = false
-          this.ruleForm.companyCoordinate = this.dataForm.kqLongitude + ',' + this.dataForm.kqLatitude
-          this.ruleForm.companyAddress = this.dataForm.kqLocation
-          this.$refs.ruleForm.validateField('companyCoordinate')
-          this.$refs.ruleForm.validateField('companyAddress')
-        } else {
-          this.$message.warning("请点击选择具体位置");
-        }
+      } else {
+        this.$message.error("查询地址失败,请重新输入地址");
+      }
+    },
+    // 点击地图事件获取经纬度,并添加标记
+    clickMapHandler(e) {
+      // console.log(e, 23)
+      this.dataForm.kqLongitude = e.lnglat.getLng();
+      this.dataForm.kqLatitude = e.lnglat.getLat();
+      this.lnglat = [e.lnglat.getLng(), e.lnglat.getLat()];
+      // this.ruleForm.companyCoordinate = e.lnglat.getLng() + ',' + e.lnglat.getLat();
+      this.setMarker(this.lnglat);
+      // 点击地图上的位置,根据经纬度转换成详细地址
+      let geocoder = new AMap.Geocoder({});
+      let that = this;
+      geocoder.getAddress(this.lnglat, function (status, result) {
+        if (status === "complete" && result.regeocode) {
+          // that.ruleForm.companyAddress = result.regeocode.formattedAddress;
+          that.dataForm.kqLocation = result.regeocode.formattedAddress;
+        } else { }
+      });
+      this.position = {
+        longitude: e.lnglat.getLng(),
+        latitude: e.lnglat.getLat(),
+        address: that.address,
+      };
+      this.inputAddress = that.address;
+    },
+    //  添加标记
+    setMarker(lnglat) {
+      this.removeMarker();
+      let marker = new AMap.Marker({
+        position: lnglat,
+      });
+      marker.setMap(this.map);
+      this.markers.push(marker);
+    },
+    // 删除之前后的标记点
+    removeMarker() {
+      if (this.markers) {
+        this.map.remove(this.markers);
+      }
+    },
+    // 确定经纬度
+    confirmLocation() {
+      if (this.dataForm.kqLongitude) {
+        this.innerVisible = false
+        this.ruleForm.companyCoordinate = this.dataForm.kqLongitude + ',' + this.dataForm.kqLatitude
+        this.ruleForm.companyAddress = this.dataForm.kqLocation
+        this.$refs.ruleForm.validateField('companyCoordinate')
+        this.$refs.ruleForm.validateField('companyAddress')
+      } else {
+        this.$message.warning("请点击选择具体位置");
       }
     }
   }
+}
 </script>
 
 <style lang="scss" scoped>
-  ::v-deep .el-form-item__label {
-    pointer-events: none !important;
-  }
+::v-deep .el-form-item__label {
+  pointer-events: none !important;
+}
 
-  ::v-deep .el-cascader {
-    width: 100% !important;
-  }
+::v-deep .el-cascader {
+  width: 100% !important;
+}
 
-  .card_purple ::v-deep .el-upload-list__item {
-    width: 120px !important;
-    height: 120px !important;
-  }
+.card_purple ::v-deep .el-upload-list__item {
+  width: 120px !important;
+  height: 120px !important;
+}
 
-  .card_purple ::v-deep .el-upload--picture-card {
-    width: 120px !important;
-    height: 120px !important;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-  }
+.card_purple ::v-deep .el-upload--picture-card {
+  width: 120px !important;
+  height: 120px !important;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
 
-  .card_independent ::v-deep .icon_circle_btn {
-    font-size: 20px;
-  }
+.card_independent ::v-deep .icon_circle_btn {
+  font-size: 20px;
+}
 
-  .card_employee {
-    // max-height: 530px;
-    overflow-y: auto;
-    overflow-x: hidden;
-  }
+.card_employee {
+  // max-height: 530px;
+  overflow-y: auto;
+  overflow-x: hidden;
+}
 
-  .margin-l-50 {
-    margin-right: 50px;
-  }
+.margin-l-50 {
+  margin-right: 50px;
+}
 
-  .card_fuel_gas {
-    display: flex;
-    flex-direction: column;
-  }
+.card_fuel_gas {
+  display: flex;
+  flex-direction: column;
+}
 
-  ::v-deep .el-form-item__label {
-    height: 40px !important;
-    display: flex !important;
-    align-items: center !important;
-    justify-content: flex-end !important;
-    line-height: unset !important;
-  }
+::v-deep .el-form-item__label {
+  height: 40px !important;
+  display: flex !important;
+  align-items: center !important;
+  justify-content: flex-end !important;
+  line-height: unset !important;
+}
 
-  .card_fuel_gas ::v-deep .el-form-item__label {
-    width: 150px !important;
-    text-align: left;
-    // margin-bottom: 20px;
-  }
+.card_fuel_gas ::v-deep .el-form-item__label {
+  width: 150px !important;
+  text-align: left;
+  // margin-bottom: 20px;
+}
 
-  .card_descriptions {
-    margin-bottom: 10px !important;
-  }
+.card_descriptions {
+  margin-bottom: 10px !important;
+}
 
-  .card_fuel_gas ::v-deep .el-form-item__content {
-    margin-left: 0px !important;
-  }
+.card_fuel_gas ::v-deep .el-form-item__content {
+  margin-left: 0px !important;
+}
 
-  .card_purple {
-    display: flex;
-  }
+.card_purple {
+  display: flex;
+}
 
-  .descriptions_title {
-    position: relative;
-  }
+.descriptions_title {
+  position: relative;
+}
 
-  .descriptions_badge {
-    position: absolute;
-    width: fit-content;
-    width: -webkit-fit-content;
-    width: -moz-fit-content;
-    top: -10px;
-    right: -35px;
-    color: #169BD5;
-    font-size: 12px;
-    line-height: 14px;
-    padding: 2px;
-    border: 1px solid #169BD5;
-  }
+.descriptions_badge {
+  position: absolute;
+  width: fit-content;
+  width: -webkit-fit-content;
+  width: -moz-fit-content;
+  top: -10px;
+  right: -35px;
+  color: #169BD5;
+  font-size: 12px;
+  line-height: 14px;
+  padding: 2px;
+  border: 1px solid #169BD5;
+}
 
-  .unit_card {
-    width: auto;
-    padding-left: 10px;
-    flex: none;
-  }
+.unit_card {
+  width: auto;
+  padding-left: 10px;
+  flex: none;
+}
 
-  .card_independent ::v-deep .el-form-item__content {
-    display: flex !important;
-  }
+.card_independent ::v-deep .el-form-item__content {
+  display: flex !important;
+}
 
-  .card_image {
-    display: flex;
-    flex-direction: row;
-    flex-wrap: wrap;
-  }
+.card_image {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+}
 
-  .avatar_image {
-    width: 140px;
-    height: 140px;
-    border-radius: 6px;
-    margin: 0 8px 8px 0;
-  }
+.avatar_image {
+  width: 140px;
+  height: 140px;
+  border-radius: 6px;
+  margin: 0 8px 8px 0;
+}
 
-  .ser_card_ial {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-  }
+.ser_card_ial {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
 
-  .margin_around {
-    margin: 5px 0px;
-  }
+.margin_around {
+  margin: 5px 0px;
+}
 
-  .title_serial {
-    margin-left: 10px;
-  }
+.title_serial {
+  margin-left: 10px;
+}
 
-  .del_serial {
-    cursor: pointer;
-    color: #F56C6C;
-  }
+.del_serial {
+  cursor: pointer;
+  color: #F56C6C;
+}
 
-  .card_IceList {
-    display: flex;
-    flex-direction: column;
-    position: absolute;
-    top: 60px;
-    left: 0;
-    right: 5px;
-    padding: 0px 10px;
-    max-height: 125px;
-    overflow-y: auto;
-    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-    border-radius: 4px;
-  }
+.card_IceList {
+  display: flex;
+  flex-direction: column;
+  position: absolute;
+  top: 60px;
+  left: 0;
+  right: 5px;
+  padding: 0px 10px;
+  max-height: 125px;
+  overflow-y: auto;
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  border-radius: 4px;
+}
+
+::v-deep .el-transfer {
+  display: flex;
+  align-items: center;
+}
+
+::v-deep .el-transfer__buttons {
+  display: flex;
+  padding: 0px 10px;
 
-  ::v-deep .el-transfer {
+  .el-button {
     display: flex;
+    justify-content: center;
     align-items: center;
+    width: 30px;
+    height: 30px;
   }
+}
 
-  ::v-deep .el-transfer__buttons {
-    display: flex;
-    padding: 0px 10px;
-
-    .el-button {
-      display: flex;
-      justify-content: center;
-      align-items: center;
-      width: 30px;
-      height: 30px;
-    }
-  }
+.forms_switch {
+  height: 40px;
+  width: 100%;
+}
 
-  .forms_switch {
-    height: 40px;
-    width: 100%;
-  }
+.custom-width {
+  width: 100px;
+}
 
-  .custom-width {
-    width: 100px;
-  }
+.el-date-editor.el-input {
+  width: 100% !important;
+}
 
-  .el-date-editor.el-input {
-    width: 100% !important;
-  }
-
-  ::v-deep .el-dialog__header {
-    display: none;
-  }
+::v-deep .el-dialog__header {
+  display: none;
+}
 
-  ::v-deep .el-dialog__body {
-    // display: none;
-    padding: 0px;
-  }
+::v-deep .el-dialog__body {
+  // display: none;
+  padding: 0px;
+}
 
-  ::v-deep .el-select__input {
-    color: #ffffff;
-  }
+::v-deep .el-select__input {
+  color: #ffffff;
+}
 
-  .card_search_box {
-    width: 100%;
-    border-bottom: 1px solid rgba(95, 99, 127, 0.8);
-    padding: 10px 20px;
-  }
+.card_search_box {
+  width: 100%;
+  border-bottom: 1px solid rgba(95, 99, 127, 0.8);
+  padding: 10px 20px;
+}
 
-  .card_coordMap {
-    width: calc(100% - 40px);
-    height: 600px;
-    flex: 1;
-    padding: 20px;
-  }
+.card_coordMap {
+  width: calc(100% - 40px);
+  height: 600px;
+  flex: 1;
+  padding: 20px;
+}
 
-  #container {
-    position: relative;
-    width: 100%;
-    height: 100%;
-  }
+#container {
+  position: relative;
+  width: 100%;
+  height: 100%;
+}
 
-  .close_map {
-    cursor: pointer;
-    position: absolute;
-    top: 10px;
-    right: 10px;
-    font-size: 25px;
-    width: 40px;
-    height: 40px;
-    background-color: rgba(245, 108, 108, .7);
-    box-shadow: 0 2px 4px rgba(245, 108, 108, .7);
-    border-radius: 50%;
-  }
+.close_map {
+  cursor: pointer;
+  position: absolute;
+  top: 10px;
+  right: 10px;
+  font-size: 25px;
+  width: 40px;
+  height: 40px;
+  background-color: rgba(245, 108, 108, .7);
+  box-shadow: 0 2px 4px rgba(245, 108, 108, .7);
+  border-radius: 50%;
+}
 
-  .card_coord {
-    display: flex;
-    align-items: flex-start;
-    flex-direction: column;
-    background-color: rgba(103, 194, 58, .6);
-    padding: 4px 10px;
-    border-radius: 5px;
-  }
+.card_coord {
+  display: flex;
+  align-items: flex-start;
+  flex-direction: column;
+  background-color: rgba(103, 194, 58, .6);
+  padding: 4px 10px;
+  border-radius: 5px;
+}
 
-  .coord_address {
-    font-size: 15px;
-    color: #ffffff;
-  }
+.coord_address {
+  font-size: 15px;
+  color: #ffffff;
+}
 </style>

+ 5 - 4
src/permission.js

@@ -23,10 +23,11 @@ router.beforeEach(async (to, from, next) => {
     localStorage.setItem("activePath", to.path);
     if (to.path === '/login') {
       // 若此时页面在登录页面,则跳转至首页
-      next({
-        path: '/'
-      })
-      NProgress.done()
+      next()
+      // next({
+      //   path: '/'
+      // })
+      // NProgress.done()
     } else {
       if (store.getters.roles.length != 0 || allowList.includes(to.name)) {
         next()

+ 28 - 0
src/utils/base64Utils.js

@@ -0,0 +1,28 @@
+/**
+ * 从当前 URL 中解析并获取传递的数据
+ * @returns {Object|null} 解析后的数据对象,如果解析失败或无数据则返回 null
+ */
+export function handleBase64FromUrl() {
+  try {
+    // 获取 URL 参数
+    const urlParams = new URLSearchParams(window.location.search);
+    const base64Data = urlParams.get('data');
+    if (!base64Data) {
+      return null;
+    }
+    // 对 Base64 数据进行解码,然后使用 decodeURIComponent 解码,最后解析为 JSON 对象
+    return JSON.parse(decodeURIComponent(atob(base64Data)));
+  } catch (error) {
+    console.error('数据解析失败:', error);
+    return null;
+  }
+}
+
+/**
+ * 清除 URL 中的 data 参数
+ */
+export function clearDataParamFromUrl() {
+  const url = new URL(window.location.href);
+  url.searchParams.delete('data');
+  window.history.replaceState({}, '', url.toString());
+}

+ 505 - 462
src/views/IceCreamFreezer/FreezerManagement.vue

@@ -5,7 +5,7 @@
       @searchProtocol="searchProtocol"></actionBar>
     <div class="card_content">
       <!-- 表单 -->
-      <tables :tableList="tableList" :tableData="tableData" @buttonData="buttonData"></tables>
+      <tables ref="refWaybill" :tableList="tableList" :tableData="tableData" @buttonData="buttonData"></tables>
       <!-- 分页 -->
       <div v-if="Total">
         <pagination :total="Total" :currentPage="Pagination.PageIndex" @changeSize="changeSize"
@@ -15,7 +15,7 @@
     </div>
     <el-dialog :title="staffTitle" :visible.sync="staffDialogVisible" width="600px" :close-on-click-modal="false"
       @close="closeDialog">
-      <forms ref="childRules" :formNewList="formRuleList" :ruleForm="ruleForm" labelWidth="100px">
+      <forms ref="childRules" :copyFlag="copyFlag" :formNewList="formRuleList" :ruleForm="ruleForm" labelWidth="100px">
       </forms>
       <span slot="footer" class="dialog-footer" v-if="operationType != 'logs'">
         <el-button plain @click="staffDialogVisible = false">取 消</el-button>
@@ -82,514 +82,557 @@
 </template>
 
 <script>
-  import {
-    getIcelocker,
-    addIcelocker,
-    putIcelocker,
-    delIcelocker,
-    importIceLocker,
-    getIcelockerData,
-    startForCold
-  } from '@/api/refrigerator'
-  import {
-    getDevice
-  } from '@/api/incubator'
-  import actionBar from '@/components/actionBar'
-  import tables from '@/components/tables'
-  import pagination from '@/components/pagination'
-  import forms from '@/components/forms'
-  import thermography from '@/components/thermography'
-  import {
-    formRules,
-    employee,
-    incubator,
-    iceList
-  } from "./refrigerator.js";
-  import {
-    startStatus,
-    iceraftStatus
-  } from '@/assets/js/blockSort'
-  export default {
-    name: 'IceManagement',
-    components: {
-      actionBar,
-      tables,
-      pagination,
-      forms,
-      thermography
-    },
-    data() {
-      return {
-        pickerOptions: {
-          shortcuts: [{
-            text: '最近一周',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
-              picker.$emit('pick', [start, end]);
-            }
-          }, {
-            text: '最近一个月',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
-              picker.$emit('pick', [start, end]);
-            }
-          }, {
-            text: '最近三个月',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
-              picker.$emit('pick', [start, end]);
-            }
-          }]
-        },
-        timeQuantum: [this.getTime(new Date(new Date().toLocaleDateString())), this.getTime(new Date())],
-
-        operateList: [{
-          type: 'add',
-          title: '添加',
-          icon: 'el-icon-plus',
-        }, {
-          type: 'import',
-          title: '冷链平台导入',
-          icon: 'el-icon-upload',
-        }],
-        formList: [{
-          type: 'input',
-          label: '名称',
-          field: 'name',
-          placeholder: '请输入名称',
+import {
+  getIcelocker,
+  addIcelocker,
+  putIcelocker,
+  delIcelocker,
+  importIceLocker,
+  getIcelockerData,
+  startForCold
+} from '@/api/refrigerator'
+import {
+  getDevice
+} from '@/api/incubator'
+import actionBar from '@/components/actionBar'
+import tables from '@/components/tables'
+import pagination from '@/components/pagination'
+import forms from '@/components/forms'
+import thermography from '@/components/thermography'
+import {
+  formRules,
+  employee,
+  incubator,
+  iceList
+} from "./refrigerator.js";
+import {
+  startStatus,
+  iceraftStatus
+} from '@/assets/js/blockSort'
+export default {
+  name: 'IceManagement',
+  components: {
+    actionBar,
+    tables,
+    pagination,
+    forms,
+    thermography
+  },
+  data() {
+    return {
+      pickerOptions: {
+        shortcuts: [{
+          text: '最近一周',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+            picker.$emit('pick', [start, end]);
+          }
         }, {
-          type: 'input',
-          label: 'SN',
-          field: 'sn',
-          placeholder: 'SN',
+          text: '最近一个月',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+            picker.$emit('pick', [start, end]);
+          }
         }, {
-          type: 'select',
-          label: '状态',
-          field: 'status',
-          placeholder: '请选择状态',
-          options: iceraftStatus(),
-        }],
-        searchRuleForm: {
-          name: '',
-          sn: '',
-          status: '',
-        },
-        searchValue: {},
-        Pagination: {
-          PageIndex: 1,
-          PageSize: 10,
-        },
-        Total: 0,
-        tableData: [],
-        operationType: '',
-        tableList: employee(),
-        staffTitle: '添加',
-        staffDialogVisible: false,
-        formRuleList: [],
-        ruleForm: {
-          sn: '',
-          name: '',
-          status: '2',
-        },
-        confirmLoading: false,
-        selectingData: {},
+          text: '最近三个月',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+            picker.$emit('pick', [start, end]);
+          }
+        }]
+      },
+      timeQuantum: [this.getTime(new Date(new Date().toLocaleDateString())), this.getTime(new Date())],
+
+      operateList: [{
+        type: 'add',
+        title: '添加',
+        icon: 'el-icon-plus',
+      }, {
+        type: 'import',
+        title: '冷链平台导入',
+        icon: 'el-icon-upload',
+      }, {
+        type: 'copyIce',
+        title: '复制冷冻柜',
+        icon: 'el-icon-copy-document',
+      }],
+      formList: [{
+        type: 'input',
+        label: '名称',
+        field: 'name',
+        placeholder: '请输入名称',
+      }, {
+        type: 'input',
+        label: 'SN',
+        field: 'sn',
+        placeholder: 'SN',
+      }, {
+        type: 'select',
+        label: '状态',
+        field: 'status',
+        placeholder: '请选择状态',
+        options: iceraftStatus(),
+      }],
+      searchRuleForm: {
+        name: '',
+        sn: '',
+        status: '',
+      },
+      searchValue: {},
+      Pagination: {
+        PageIndex: 1,
+        PageSize: 10,
+      },
+      Total: 0,
+      tableData: [],
+      operationType: '',
+      tableList: employee(),
+      staffTitle: '添加',
+      staffDialogVisible: false,
+      formRuleList: [],
+      ruleForm: {
+        sn: '',
+        name: '',
+        status: '2',
+        copyNumber: ''
+      },
+      confirmLoading: false,
+      selectingData: {},
 
-        importDialogVisible: false,
-        incubatorList: incubator(),
-        incubatorData: [],
-        Total1: 0,
-        Paginationil: {
-          PageIndex: 1,
-          PageSize: 10,
-        },
-        stateRuleList: [{
-          field: 'status',
-          label: '状态',
-          placeholder: '状态',
-          type: 'radio',
-          colWidth: 24,
-          rules: [{
-            required: true,
-            message: '选择状态',
-            trigger: 'change'
-          }],
-          options: startStatus()
+      importDialogVisible: false,
+      incubatorList: incubator(),
+      incubatorData: [],
+      Total1: 0,
+      Paginationil: {
+        PageIndex: 1,
+        PageSize: 10,
+      },
+      stateRuleList: [{
+        field: 'status',
+        label: '状态',
+        placeholder: '状态',
+        type: 'radio',
+        colWidth: 24,
+        rules: [{
+          required: true,
+          message: '选择状态',
+          trigger: 'change'
         }],
-        stateRuleForm: {
-          status: '2',
-        },
-        nameTitle: '',
-        incubatorLoading: false,
+        options: startStatus()
+      }],
+      stateRuleForm: {
+        status: '2',
+      },
+      nameTitle: '',
+      incubatorLoading: false,
 
-        timer: null, //定时器名称
-        dialogVisible: false,
-        waybillNo: '',
-        // 冰排列表
-        freezerIceVisible: false,
-        freezerIceList: iceList(),
-        freezerIceData: [],
-        icePagination: {
-          Total: 0,
-          PageIndex: 10,
-          PageSize: 1,
-        },
-        iceLoading: false,
-      }
-    },
-    beforeDestroy() {
-      clearInterval(this.timer); // 清除定时器
-      this.timer = null;
+      timer: null, //定时器名称
+      dialogVisible: false,
+      waybillNo: '',
+      // 冰排列表
+      freezerIceVisible: false,
+      freezerIceList: iceList(),
+      freezerIceData: [],
+      icePagination: {
+        Total: 0,
+        PageIndex: 10,
+        PageSize: 1,
+      },
+      iceLoading: false,
+      copyFlag: false,
+    }
+  },
+  beforeDestroy() {
+    clearInterval(this.timer); // 清除定时器
+    this.timer = null;
+  },
+  mounted() {
+    this.getList()
+  },
+  methods: {
+    getTime(time) {
+      var date = new Date(time)
+      var y = date.getFullYear()
+      var m = date.getMonth() + 1
+      m = m < 10 ? '0' + m : m
+      var d = date.getDate()
+      d = d < 10 ? '0' + d : d
+      var h = date.getHours()
+      h = h < 10 ? '0' + h : h
+      var minute = date.getMinutes()
+      minute = minute < 10 ? '0' + minute : minute
+      var s = date.getSeconds()
+      s = s < 10 ? '0' + s : s
+      return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + s
     },
-    mounted() {
+    // 搜索
+    searchProtocol(value) {
+      this.Pagination.PageIndex = 1
+      this.searchValue = value
       this.getList()
     },
-    methods: {
-      getTime(time) {
-        var date = new Date(time)
-        var y = date.getFullYear()
-        var m = date.getMonth() + 1
-        m = m < 10 ? '0' + m : m
-        var d = date.getDate()
-        d = d < 10 ? '0' + d : d
-        var h = date.getHours()
-        h = h < 10 ? '0' + h : h
-        var minute = date.getMinutes()
-        minute = minute < 10 ? '0' + minute : minute
-        var s = date.getSeconds()
-        s = s < 10 ? '0' + s : s
-        return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + s
-      },
-      // 搜索
-      searchProtocol(value) {
-        this.Pagination.PageIndex = 1
-        this.searchValue = value
-        this.getList()
-      },
-      // 获取列表
-      getList() {
-        var params = {
-          page: this.Pagination.PageIndex,
-          pageSize: this.Pagination.PageSize,
-          showTemp: true,
-          ...this.searchValue
+    // 获取列表
+    getList() {
+      var params = {
+        page: this.Pagination.PageIndex,
+        pageSize: this.Pagination.PageSize,
+        showTemp: true,
+        ...this.searchValue
+      }
+      getIcelocker(params).then(res => {
+        if (res.code == 200) {
+          this.tableData = res.data.list
+          this.Total = res.data.count
+          this.timer = setTimeout(() => {
+            this.getList();
+          }, 60000)
         }
-        getIcelocker(params).then(res => {
-          if (res.code == 200) {
-            this.tableData = res.data.list
-            this.Total = res.data.count
-            this.timer = setTimeout(() => {
-              this.getList();
-            }, 60000)
+      })
+    },
+    // 弹窗表单添加
+    handleAdd() {
+      let flag = this.$refs['childRules'].validateForm();
+      if (flag) {
+        if (this.operationType == 'add') {
+          this.confirmLoading = true
+          var params = {
+            ...this.ruleForm
           }
-        })
-      },
-      // 弹窗表单添加
-      handleAdd() {
-        let flag = this.$refs['childRules'].validateForm();
-        if (flag) {
-          if (this.operationType == 'add') {
-            this.confirmLoading = true
-            var params = {
-              ...this.ruleForm
-            }
-            addIcelocker(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
+          addIcelocker(params).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                message: '操作成功',
+                type: 'success'
+              });
+              this.getList()
+              this.ruleForm.copyNumber--
+              if (this.ruleForm.copyNumber == 0 || this.ruleForm.copyNumber == null || this.ruleForm.copyNumber == undefined || this.ruleForm.copyNumber == 0) {
+                this.staffDialogVisible = false
               }
-              this.staffDialogVisible = false
-              this.confirmLoading = false
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-          } else if (this.operationType == 'edit') {
-            this.confirmLoading = true
-            var params = {
-              id: this.selectingData.id,
-              name: this.ruleForm.name,
-              status: this.ruleForm.status,
-              sn: this.ruleForm.sn,
             }
-            putIcelocker(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
-              }
-              this.staffDialogVisible = false
-              this.confirmLoading = false
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-          }
-        } else {
-          this.$message.error('表单信息不完整,请继续填写完整');
-        }
-      },
-      buttonData(row, type) {
-        const dataList = formRules();
-        this.formRuleList = dataList;
-        this.selectingData = row
-        this.operationType = type
-        if (type == 'edit') {
-          this.staffTitle = '编辑'
-          this.staffDialogVisible = true
-          setTimeout(() => {
-            this.$nextTick(() => {
-              this.ruleForm.sn = row.sn
-              this.ruleForm.name = row.name
-              this.ruleForm.status = row.status
-            })
+            this.confirmLoading = false
+          }).catch(() => {
+            this.confirmLoading = false
           })
-        } else if (type == 'logs') {
-          this.staffTitle = '详情'
-          this.staffDialogVisible = true
-          this.formRuleList.forEach((item, index) => {
-            item.disabled = true
+        } else if (this.operationType == 'edit') {
+          this.confirmLoading = true
+          var params = {
+            id: this.selectingData.id,
+            name: this.ruleForm.name,
+            status: this.ruleForm.status,
+            sn: this.ruleForm.sn,
+          }
+          putIcelocker(params).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                message: '操作成功',
+                type: 'success'
+              });
+              this.getList()
+            }
+            this.staffDialogVisible = false
+            this.confirmLoading = false
+          }).catch(() => {
+            this.confirmLoading = false
           })
-          this.ruleForm = JSON.parse(JSON.stringify(row))
-        } else if (type == 'del') {
-          this.deleteUser(row.id)
-        } else if (type == 'record') {
-          this.dialogVisible = true
-          this.waybillNo = row.sn
+        }
+      } else {
+        this.$message.error('表单信息不完整,请继续填写完整');
+      }
+    },
+    buttonData(row, type) {
+      const dataList = formRules();
+      this.formRuleList = dataList;
+      this.selectingData = row
+      this.operationType = type
+      if (type == 'edit') {
+        this.staffTitle = '编辑'
+        this.staffDialogVisible = true
+        setTimeout(() => {
           this.$nextTick(() => {
-            this.$refs.thermo.getProbe()
+            this.ruleForm.sn = row.sn
+            this.ruleForm.name = row.name
+            this.ruleForm.status = row.status
           })
-        } else if (type == 'cooling') {
-          this.freezerIceVisible = true
-          this.getIceData()
+        })
+      } else if (type == 'logs') {
+        this.staffTitle = '详情'
+        this.staffDialogVisible = true
+        this.formRuleList.forEach((item, index) => {
+          item.disabled = true
+        })
+        this.ruleForm = JSON.parse(JSON.stringify(row))
+      } else if (type == 'del') {
+        this.deleteUser(row.id)
+      } else if (type == 'record') {
+        this.dialogVisible = true
+        this.waybillNo = row.sn
+        this.$nextTick(() => {
+          this.$refs.thermo.getProbe()
+        })
+      } else if (type == 'cooling') {
+        this.freezerIceVisible = true
+        this.getIceData()
+      }
+    },
+    // 获取冷冻柜下的冰排列表
+    getIceData() {
+      getIcelockerData({
+        page: this.icePagination.PageSize,
+        pageSize: this.icePagination.PageIndex,
+      }).then(res => {
+        if (res.code == 200) {
+          this.freezerIceData = res.data.list
+          this.icePagination.Total = res.data.count
         }
-      },
-      // 获取冷冻柜下的冰排列表
-      getIceData() {
-        getIcelockerData({
-          page: this.icePagination.PageSize,
-          pageSize: this.icePagination.PageIndex,
+      })
+    },
+    // 选择新排出库释冷
+    releaseColdStorage() {
+      const arrID = this.$refs.refIce.waybillIds
+      let arrList = []
+      arrID.forEach(item => {
+        arrList.push(String(item.iceRaftRecord.id))
+      })
+      if (arrList.length != 0) {
+        startForCold({
+          id: arrList,
         }).then(res => {
           if (res.code == 200) {
-            this.freezerIceData = res.data.list
-            this.icePagination.Total = res.data.count
+            this.$message({
+              message: res.msg,
+              type: 'success'
+            });
+            this.getIceData()
           }
         })
-      },
-      // 选择新排出库释冷
-      releaseColdStorage() {
-        const arrID = this.$refs.refIce.waybillIds
-        let arrList = []
-        arrID.forEach(item => {
-          arrList.push(String(item.iceRaftRecord.id))
-        })
-        if (arrList.length != 0) {
-          startForCold({
-            id: arrList,
-          }).then(res => {
-            if (res.code == 200) {
-              this.$message({
-                message: res.msg,
-                type: 'success'
-              });
-              this.getIceData()
-            }
-          })
-        } else {
+      } else {
+        this.$message({
+          message: '请先选择需要批量操作的冰排',
+          type: 'warning'
+        });
+      }
+    },
+    // 选择时间
+    timeChange() {
+      this.$nextTick(() => {
+        this.$refs.thermo.getTemperature()
+      })
+    },
+    openModel(type) {
+      if (type == 'add') {
+        const dataList = formRules();
+        this.formRuleList = dataList;
+        this.staffTitle = '添加'
+        this.staffDialogVisible = true
+        this.operationType = type
+      } else if (type == 'import') {
+        this.importDialogVisible = true
+        this.getDeviceList()
+      } else if (type == 'copyIce') {
+        this.operationType = 'add'
+        const arrID = this.$refs.refWaybill.waybillIds
+        if (arrID.length == 0) {
           this.$message({
-            message: '请先选择需要批量操作的冰排',
+            message: '请先选择需要复制的冷冻柜',
             type: 'warning'
           });
+          return
         }
-      },
-      // 选择时间
-      timeChange() {
-        this.$nextTick(() => {
-          this.$refs.thermo.getTemperature()
-        })
-      },
-      openModel(type) {
-        if (type == 'add') {
+        if (arrID.length > 1) {
+          this.$message({
+            message: '只能选择一条冷冻柜进行复制',
+            type: 'warning'
+          });
+          return
+        }
+        if (arrID.length == 1) {
+          this.copyFlag = true
           const dataList = formRules();
           this.formRuleList = dataList;
           this.staffTitle = '添加'
           this.staffDialogVisible = true
-          this.operationType = type
-        } else if (type == 'import') {
-          this.importDialogVisible = true
-          this.getDeviceList()
-        }
-      },
-      // 获取设备列表
-      getDeviceList() {
-        var params = {
-          page: this.Paginationil.PageIndex,
-          pageSize: this.Paginationil.PageSize,
-          name: this.nameTitle,
-        }
-        getDevice(params).then(res => {
-          if (res.code == 200) {
-            if (res.data) {
-              this.incubatorData = res.data.list
-              this.Total1 = res.data.count
-            }
-          }
-        })
-      },
-      // 搜索保温箱
-      incubatorInput(value) {
-        this.nameTitle = value
-        this.getDeviceList()
-      },
-      // 批量导入保温箱
-      incubatorAdd() {
-        const arrID = this.$refs.refIncubator.waybillIds
-        let arr1 = []
-        arrID.forEach(item => {
-          let arr2 = {
-            sn: item.T_sn,
-            name: item.T_devName,
-          }
-          arr1.push(arr2)
-        })
-        let flag = this.$refs['incubatorRules'].validateForm();
-        if (flag) {
-          if (arr1.length > 0) {
-            this.incubatorLoading = true
-            let params = {
-              list: arr1,
-              ...this.stateRuleForm,
-            }
-            importIceLocker(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
-                this.importDialogVisible = false
-              }
-              this.incubatorLoading = false
+          setTimeout(() => {
+            this.$nextTick(() => {
+              this.ruleForm.sn = arrID[0].sn
+              this.ruleForm.name = arrID[0].name
+              this.ruleForm.status = arrID[0].status
+              this.ruleForm.copyNumber = ''
             })
-          } else {
-            this.$message.warning('请选择需要导入的保温箱');
+          })
+        }
+      }
+    },
+    // 获取设备列表
+    getDeviceList() {
+      var params = {
+        page: this.Paginationil.PageIndex,
+        pageSize: this.Paginationil.PageSize,
+        name: this.nameTitle,
+      }
+      getDevice(params).then(res => {
+        if (res.code == 200) {
+          if (res.data) {
+            this.incubatorData = res.data.list
+            this.Total1 = res.data.count
           }
-        } else {
-          this.$message.error('表单信息不完整,请继续填写完整');
         }
-      },
-      // 删除冷冻柜
-      deleteUser(id) {
-        this.$confirm('此操作将永久删除该冷冻柜, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          delIcelocker({
-            id: id,
-          }).then(res => {
+      })
+    },
+    // 搜索保温箱
+    incubatorInput(value) {
+      this.nameTitle = value
+      this.getDeviceList()
+    },
+    // 批量导入保温箱
+    incubatorAdd() {
+      const arrID = this.$refs.refIncubator.waybillIds
+      let arr1 = []
+      arrID.forEach(item => {
+        let arr2 = {
+          sn: item.T_sn,
+          name: item.T_devName,
+        }
+        arr1.push(arr2)
+      })
+      let flag = this.$refs['incubatorRules'].validateForm();
+      if (flag) {
+        if (arr1.length > 0) {
+          this.incubatorLoading = true
+          let params = {
+            list: arr1,
+            ...this.stateRuleForm,
+          }
+          importIceLocker(params).then(res => {
             if (res.code == 200) {
               this.$message({
                 message: '操作成功',
                 type: 'success'
               });
-              const precisePage = Math.ceil((this.Total - 1) / this.Pagination.PageSize)
-              this.Pagination.PageIndex = this.Pagination.PageIndex > precisePage ? precisePage : this
-                .Pagination.PageIndex
-              this.Pagination.PageIndex = this.Pagination.PageIndex < 1 ? 1 : this.Pagination.PageIndex
               this.getList()
+              this.importDialogVisible = false
             }
+            this.incubatorLoading = false
           })
-        }).catch(() => {});
-      },
-      changeSize(val) {
-        this.Pagination.PageSize = val
-        this.getList()
-      },
-      changeCurrent(val) {
-        this.Pagination.PageIndex = val
-        this.getList()
-      },
-      changeSizeil(val) {
-        this.Paginationil.PageSize = val
-        this.getDeviceList()
-      },
-      changeCurrentil(val) {
-        this.Paginationil.PageIndex = val
-        this.getDeviceList()
-      },
-      // 冷冻柜冰排列表
-      iceSize(val) {
-        this.icePagination.PageIndex = val
-        this.getIceData()
-      },
-      iceCurrent(val) {
-        this.icePagination.PageSize = val
-        this.getIceData()
-      },
-      // 清空表单
-      closeDialog() {
-        this.$refs.childRules.resetCheck();
-      },
-      // 关闭温湿度记录
-      temperatureClose() {
-        this.timeQuantum = [this.getTime(new Date(new Date().toLocaleDateString())), this.getTime(new Date())]
-      },
-      // 冰排关闭弹窗
-      iceClose() {
-        this.freezerIceVisible = false
-      },
-      closeDialogil() {
-        this.$refs.incubatorRules.resetCheck();
-        this.$refs.refIncubator.clearSelected();
+        } else {
+          this.$message.warning('请选择需要导入的保温箱');
+        }
+      } else {
+        this.$message.error('表单信息不完整,请继续填写完整');
       }
     },
-  }
+    // 删除冷冻柜
+    deleteUser(id) {
+      this.$confirm('此操作将永久删除该冷冻柜, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        delIcelocker({
+          id: id,
+        }).then(res => {
+          if (res.code == 200) {
+            this.$message({
+              message: '操作成功',
+              type: 'success'
+            });
+            const precisePage = Math.ceil((this.Total - 1) / this.Pagination.PageSize)
+            this.Pagination.PageIndex = this.Pagination.PageIndex > precisePage ? precisePage : this
+              .Pagination.PageIndex
+            this.Pagination.PageIndex = this.Pagination.PageIndex < 1 ? 1 : this.Pagination.PageIndex
+            this.getList()
+          }
+        })
+      }).catch(() => { });
+    },
+    changeSize(val) {
+      this.Pagination.PageSize = val
+      this.getList()
+    },
+    changeCurrent(val) {
+      this.Pagination.PageIndex = val
+      this.getList()
+    },
+    changeSizeil(val) {
+      this.Paginationil.PageSize = val
+      this.getDeviceList()
+    },
+    changeCurrentil(val) {
+      this.Paginationil.PageIndex = val
+      this.getDeviceList()
+    },
+    // 冷冻柜冰排列表
+    iceSize(val) {
+      this.icePagination.PageIndex = val
+      this.getIceData()
+    },
+    iceCurrent(val) {
+      this.icePagination.PageSize = val
+      this.getIceData()
+    },
+    // 清空表单
+    closeDialog() {
+      this.copyFlag = false
+      this.ruleForm.copyNumber = ''
+      this.$refs.childRules.resetCheck();
+    },
+    // 关闭温湿度记录
+    temperatureClose() {
+      this.timeQuantum = [this.getTime(new Date(new Date().toLocaleDateString())), this.getTime(new Date())]
+    },
+    // 冰排关闭弹窗
+    iceClose() {
+      this.freezerIceVisible = false
+    },
+    closeDialogil() {
+      this.$refs.incubatorRules.resetCheck();
+      this.$refs.refIncubator.clearSelected();
+    }
+  },
+}
 </script>
 
 <style lang="scss" scoped>
-  .card_import {
-    margin-top: 15px;
-    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-    margin-bottom: 20px;
-    border-radius: 10px;
-  }
+.card_import {
+  margin-top: 15px;
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  margin-bottom: 20px;
+  border-radius: 10px;
+}
 
-  .management_card ::v-deep .el-dialog__body {
-    padding: 0px 20px !important;
-  }
+.management_card ::v-deep .el-dialog__body {
+  padding: 0px 20px !important;
+}
 
-  .card_incubat {
-    padding-left: 15px;
-    border-bottom: 1px solid #EBEEF5;
-    padding-top: 15px;
-    margin-bottom: 15px;
-  }
+.card_incubat {
+  padding-left: 15px;
+  border-bottom: 1px solid #EBEEF5;
+  padding-top: 15px;
+  margin-bottom: 15px;
+}
 
-  .card_search_input {
-    display: flex;
-    align-items: center;
-    padding: 15px 20px 15px 20px;
-    border-bottom: 1px solid #EBEEF5;
-  }
+.card_search_input {
+  display: flex;
+  align-items: center;
+  padding: 15px 20px 15px 20px;
+  border-bottom: 1px solid #EBEEF5;
+}
 
-  .title_search {
-    flex: none;
-    margin-right: 5px;
-  }
+.title_search {
+  flex: none;
+  margin-right: 5px;
+}
 
-  .card_ice_bottom {
-    margin-top: 10px;
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-  }
+.card_ice_bottom {
+  margin-top: 10px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
 </style>

+ 470 - 421
src/views/IceCreamFreezer/IceManagement.vue

@@ -16,7 +16,7 @@
     <el-dialog :title="staffTitle" :visible.sync="staffDialogVisible" width="600px" :close-on-click-modal="false"
       @close="closeDialog">
       <forms ref="childRules" :iceBank="true" :iceTracing="iceTracing" :formNewList="formRuleList" :ruleForm="ruleForm"
-        labelWidth="100px" @handleScroll="handleScroll" @remoteMethod="remoteMethod">
+        labelWidth="100px" :copyFlag="copyFlag" @handleScroll="handleScroll" @remoteMethod="remoteMethod">
       </forms>
       <span slot="footer" class="dialog-footer" v-if="operationType != 'logs'">
         <el-button plain @click="staffDialogVisible = false">取 消</el-button>
@@ -27,325 +27,379 @@
 </template>
 
 <script>
-  import {
-    getIceRaft,
-    addIceRaft,
-    putIceRaft,
-    delIceRaft,
-    bindCoolerBox,
-    UnbindCoolerBox
-  } from '@/api/freezer'
-  import {
-    getCoolerBox
-  } from '@/api/incubator.js'
-  import actionBar from '@/components/actionBar'
-  import tables from '@/components/tables'
-  import pagination from '@/components/pagination'
-  import forms from '@/components/forms'
-  import {
-    formRules,
-    formRulesCold,
-    employee,
-    employeeCold,
-    bindingIncubator
-  } from "./freezer.js";
-  import {
-    iceraftStatus
-  } from '@/assets/js/blockSort'
-  export default {
-    name: 'IceManagement',
-    components: {
-      actionBar,
-      tables,
-      pagination,
-      forms
+import {
+  getIceRaft,
+  addIceRaft,
+  putIceRaft,
+  delIceRaft,
+  bindCoolerBox,
+  UnbindCoolerBox
+} from '@/api/freezer'
+import {
+  getCoolerBox
+} from '@/api/incubator.js'
+import actionBar from '@/components/actionBar'
+import tables from '@/components/tables'
+import pagination from '@/components/pagination'
+import forms from '@/components/forms'
+import {
+  formRules,
+  formRulesCold,
+  employee,
+  employeeCold,
+  bindingIncubator
+} from "./freezer.js";
+import {
+  iceraftStatus
+} from '@/assets/js/blockSort'
+export default {
+  name: 'IceManagement',
+  components: {
+    actionBar,
+    tables,
+    pagination,
+    forms
+  },
+  data() {
+    return {
+      operateList: [{
+        type: 'add',
+        title: '添加',
+        icon: 'el-icon-plus',
+      }, {
+        type: 'binding',
+        title: '绑定冰排',
+        icon: 'el-icon-link',
+      }, {
+        type: 'copyIce',
+        title: '复制冰排',
+        icon: 'el-icon-copy-document',
+      }],
+      formList: [{
+        type: 'input',
+        label: '编号',
+        field: 'code',
+        placeholder: '请输入编号',
+      }, {
+        type: 'select',
+        label: '状态',
+        field: 'status',
+        placeholder: '请选择状态',
+        options: iceraftStatus(),
+      }],
+      searchRuleForm: {
+        code: '',
+        status: '',
+      },
+      searchValue: {},
+      Pagination: {
+        PageIndex: 1,
+        PageSize: 10,
+      },
+      Total: 0,
+      tableData: [],
+      operationType: '',
+      tableList: [],
+      staffTitle: '添加',
+      staffDialogVisible: false,
+      formRuleList: [],
+      ruleForm: {
+        code: '',
+        status: null,
+        freezeClaim: [],
+        coolerBoxId: [],
+        label: '',
+        suitableForCold: '',
+        forColdTime: null,
+        iceColdAddress: '',
+        sort: null,
+      },
+      confirmLoading: false,
+      selectingData: {},
+      iceTracing: true,
+      // 是否释冷
+      iceColdFlag: false,
+      userList: {},
+      staffName: '',
+      page: 1,
+      limitNoil: true,
+      iceCode: [],
+      copyFlag: false,
+    }
+  },
+  mounted() {
+    const arr = localStorage.getItem('userList')
+    this.userList = JSON.parse(arr)
+    if (this.userList.dept) {
+      this.iceColdFlag = this.userList.dept.isIceReleaseCold
+    }
+    if (this.iceColdFlag) {
+      this.tableList = employeeCold()
+      this.formRuleList = formRulesCold()
+    } else {
+      this.tableList = employee()
+      this.formRuleList = formRules()
+    }
+    this.getList()
+  },
+  methods: {
+    // 搜索
+    searchProtocol(value) {
+      this.Pagination.PageIndex = 1
+      this.searchValue = value
+      this.getList()
     },
-    data() {
-      return {
-        operateList: [{
-          type: 'add',
-          title: '添加',
-          icon: 'el-icon-plus',
-        }, {
-          type: 'binding',
-          title: '绑定冰排',
-          icon: 'el-icon-link',
-        }],
-        formList: [{
-          type: 'input',
-          label: '编号',
-          field: 'code',
-          placeholder: '请输入编号',
-        }, {
-          type: 'select',
-          label: '状态',
-          field: 'status',
-          placeholder: '请选择状态',
-          options: iceraftStatus(),
-        }],
-        searchRuleForm: {
-          code: '',
-          status: '',
-        },
-        searchValue: {},
-        Pagination: {
-          PageIndex: 1,
-          PageSize: 10,
-        },
-        Total: 0,
-        tableData: [],
-        operationType: '',
-        tableList: [],
-        staffTitle: '添加',
-        staffDialogVisible: false,
-        formRuleList: [],
-        ruleForm: {
-          code: '',
-          status: null,
-          freezeClaim: [],
-          coolerBoxId: [],
-          label: '',
-          suitableForCold: '',
-          forColdTime: null,
-          iceColdAddress: '',
-          sort: null,
-        },
-        confirmLoading: false,
-        selectingData: {},
-        iceTracing: true,
-        // 是否释冷
-        iceColdFlag: false,
-        userList: {},
-        staffName: '',
-        page: 1,
-        limitNoil: true,
-        iceCode: [],
+    // 获取列表
+    getList() {
+      var params = {
+        page: this.Pagination.PageIndex,
+        pageSize: this.Pagination.PageSize,
+        ...this.searchValue
       }
+      getIceRaft(params).then(res => {
+        if (res.code == 200) {
+          this.tableData = res.data.list
+          this.tableData.forEach(item => {
+            if (item.coolerBoxName) {
+              item.coolerBoxData = item.coolerBoxName
+              item.coolerBoxName = item.coolerBoxName.join(',')
+            }
+          })
+          this.Total = res.data.count
+        }
+      })
     },
-    mounted() {
-      const arr = localStorage.getItem('userList')
-      this.userList = JSON.parse(arr)
-      if (this.userList.dept) {
-        this.iceColdFlag = this.userList.dept.isIceReleaseCold
+    // 弹窗表单添加
+    handleAdd() {
+      let flag = this.$refs['childRules'].validateForm();
+      if (flag) {
+        var turnNum = function (nums) {
+          let arrNum = nums
+          let arr2 = []
+          arrNum.forEach(item => {
+            var arr1 = item.split('小时')
+            arr2.push(Number(arr1[0]))
+          })
+          return arr2;
+        }
+        if (this.operationType == 'add') {
+          this.confirmLoading = true
+          let arr = []
+          arr.push(this.ruleForm.code)
+          var params = {
+            codeList: arr,
+            status: this.ruleForm.status,
+            freezeClaim: turnNum(this.ruleForm.freezeClaim),
+            label: this.ruleForm.label,
+            suitableForCold: this.ruleForm.suitableForCold,
+            forColdTime: Number(this.ruleForm.forColdTime),
+            iceColdAddress: this.ruleForm.iceColdAddress,
+            sort: Number(this.ruleForm.sort),
+          }
+          addIceRaft(params).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                message: '操作成功',
+                type: 'success'
+              });
+              this.getList()
+              this.ruleForm.copyNumber--
+              if (this.ruleForm.copyNumber == 0 || this.ruleForm.copyNumber == null || this.ruleForm.copyNumber == undefined || this.ruleForm.copyNumber == 0) {
+                this.staffDialogVisible = false
+              }
+            }
+            this.confirmLoading = false
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+        } else if (this.operationType == 'edit') {
+          this.confirmLoading = true
+          var params = {
+            id: this.selectingData.id,
+            code: this.ruleForm.code,
+            status: this.ruleForm.status,
+            freezeClaim: turnNum(this.ruleForm.freezeClaim),
+            label: this.ruleForm.label,
+            suitableForCold: this.ruleForm.suitableForCold,
+            forColdTime: Number(this.ruleForm.forColdTime),
+            iceColdAddress: this.ruleForm.iceColdAddress,
+            sort: Number(this.ruleForm.sort),
+          }
+          putIceRaft(params).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                message: '操作成功',
+                type: 'success'
+              });
+              this.getList()
+              this.staffDialogVisible = false
+            }
+            this.confirmLoading = false
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+        } else if (this.operationType == 'binding') {
+          this.confirmLoading = true
+          var arrBoxId = this.ruleForm.coolerBoxId.map(Number)
+          var params = {
+            code: this.iceCode,
+            coolerBoxId: arrBoxId,
+          }
+          bindCoolerBox(params).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                message: '操作成功',
+                type: 'success'
+              });
+              this.getList()
+              this.staffDialogVisible = false
+            }
+            this.confirmLoading = false
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+        } else if (this.operationType == 'unbind') {
+          this.confirmLoading = true
+          var arrBoxId = this.ruleForm.coolerBoxId.map(Number)
+          UnbindCoolerBox({
+            code: this.selectingData.code,
+            coolerBoxId: arrBoxId,
+          }).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                message: res.msg || '操作成功',
+                type: 'success'
+              });
+              this.getList()
+              this.staffDialogVisible = false
+            }
+            this.confirmLoading = false
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+        }
+      } else {
+        this.$message.error('表单信息不完整,请继续填写完整');
       }
+    },
+    buttonData(row, type) {
+      this.selectingData = row
+      this.operationType = type
       if (this.iceColdFlag) {
-        this.tableList = employeeCold()
         this.formRuleList = formRulesCold()
       } else {
-        this.tableList = employee()
         this.formRuleList = formRules()
       }
-      this.getList()
-    },
-    methods: {
-      // 搜索
-      searchProtocol(value) {
-        this.Pagination.PageIndex = 1
-        this.searchValue = value
-        this.getList()
-      },
-      // 获取列表
-      getList() {
-        var params = {
-          page: this.Pagination.PageIndex,
-          pageSize: this.Pagination.PageSize,
-          ...this.searchValue
-        }
-        getIceRaft(params).then(res => {
-          if (res.code == 200) {
-            this.tableData = res.data.list
-            this.tableData.forEach(item => {
-              if (item.coolerBoxName) {
-                item.coolerBoxData = item.coolerBoxName
-                item.coolerBoxName = item.coolerBoxName.join(',')
-              }
-            })
-            this.Total = res.data.count
-          }
+      if (type == 'edit') {
+        this.iceTracing = false
+        this.staffTitle = '编辑'
+        this.staffDialogVisible = true
+        setTimeout(() => {
+          this.$nextTick(() => {
+            this.ruleForm.code = row.code
+            this.ruleForm.status = row.status
+            this.ruleForm.freezeClaim = row.freezeClaim.map(String);
+            this.ruleForm.label = row.label
+            this.ruleForm.suitableForCold = row.suitableForCold
+            this.ruleForm.iceColdAddress = row.iceColdAddress
+            this.ruleForm.forColdTime = row.forColdTime
+            this.ruleForm.sort = row.sort
+          })
         })
-      },
-      // 弹窗表单添加
-      handleAdd() {
-        let flag = this.$refs['childRules'].validateForm();
-        if (flag) {
-          var turnNum = function(nums) {
-            let arrNum = nums
-            let arr2 = []
-            arrNum.forEach(item => {
-              var arr1 = item.split('小时')
-              arr2.push(Number(arr1[0]))
-            })
-            return arr2;
-          }
-          if (this.operationType == 'add') {
-            this.confirmLoading = true
-            let arr = []
-            arr.push(this.ruleForm.code)
-            var params = {
-              codeList: arr,
-              status: this.ruleForm.status,
-              freezeClaim: turnNum(this.ruleForm.freezeClaim),
-              label: this.ruleForm.label,
-              suitableForCold: this.ruleForm.suitableForCold,
-              forColdTime: Number(this.ruleForm.forColdTime),
-              iceColdAddress: this.ruleForm.iceColdAddress,
-              sort: Number(this.ruleForm.sort),
-            }
-            addIceRaft(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
-                this.staffDialogVisible = false
-              }
-              this.confirmLoading = false
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-          } else if (this.operationType == 'edit') {
-            this.confirmLoading = true
-            var params = {
-              id: this.selectingData.id,
-              code: this.ruleForm.code,
-              status: this.ruleForm.status,
-              freezeClaim: turnNum(this.ruleForm.freezeClaim),
-              label: this.ruleForm.label,
-              suitableForCold: this.ruleForm.suitableForCold,
-              forColdTime: Number(this.ruleForm.forColdTime),
-              iceColdAddress: this.ruleForm.iceColdAddress,
-              sort: Number(this.ruleForm.sort),
-            }
-            putIceRaft(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
-                this.staffDialogVisible = false
-              }
-              this.confirmLoading = false
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-          } else if (this.operationType == 'binding') {
-            this.confirmLoading = true
-            var arrBoxId = this.ruleForm.coolerBoxId.map(Number)
-            var params = {
-              code: this.iceCode,
-              coolerBoxId: arrBoxId,
-            }
-            bindCoolerBox(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
-                this.staffDialogVisible = false
-              }
-              this.confirmLoading = false
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-          } else if (this.operationType == 'unbind') {
-            this.confirmLoading = true
-            var arrBoxId = this.ruleForm.coolerBoxId.map(Number)
-            UnbindCoolerBox({
-              code: this.selectingData.code,
-              coolerBoxId: arrBoxId,
-            }).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: res.msg || '操作成功',
-                  type: 'success'
-                });
-                this.getList()
-                this.staffDialogVisible = false
-              }
-              this.confirmLoading = false
-            }).catch(() => {
-              this.confirmLoading = false
-            })
+      } else if (type == 'logs') {
+        this.iceTracing = false
+        this.staffTitle = '详情'
+        this.staffDialogVisible = true
+        setTimeout(() => {
+          this.$nextTick(() => {
+            this.ruleForm.code = row.code
+            this.ruleForm.status = row.status
+            this.ruleForm.freezeClaim = row.freezeClaim
+            this.ruleForm.label = row.label
+            this.ruleForm.suitableForColdTime = row.suitableForColdTime
+          })
+        })
+        this.formRuleList.forEach((item, index) => {
+          item.disabled = true
+        })
+      } else if (type == 'del') {
+        this.deleteUser(row.id)
+      } else if (type == 'unbind') {
+        let coolerID = []
+        if (row.bindCoolerBox) {
+          this.ruleForm.coolerBoxId = row.bindCoolerBox.map(String)
+          coolerID = zipToObjects(row.bindCoolerBox, row.coolerBoxData)
+
+          function zipToObjects(keys, values) {
+            return keys.map((key, index) => ({
+              label: values[index],
+              value: key
+            }));
           }
-        } else {
-          this.$message.error('表单信息不完整,请继续填写完整');
         }
-      },
-      buttonData(row, type) {
-        this.selectingData = row
-        this.operationType = type
+        this.staffDialogVisible = true
+        this.staffTitle = '修改绑定保温箱'
+        this.formRuleList = bindingIncubator()
+        this.formRuleList.forEach(item => {
+          if (item.type == 'searchSelect') {
+            item.options = coolerID
+          }
+        })
+        this.page = 1
+        this.limitNoil = true
+        this.getIncubator()
+        // this.remoteMethod()
+      }
+    },
+    openModel(type) {
+      this.operationType = type
+      if (type == 'add') {
+        this.iceTracing = true
+        this.staffTitle = '添加'
+        this.staffDialogVisible = true
         if (this.iceColdFlag) {
           this.formRuleList = formRulesCold()
         } else {
           this.formRuleList = formRules()
         }
-        if (type == 'edit') {
-          this.iceTracing = false
-          this.staffTitle = '编辑'
-          this.staffDialogVisible = true
-          setTimeout(() => {
-            this.$nextTick(() => {
-              this.ruleForm.code = row.code
-              this.ruleForm.status = row.status
-              this.ruleForm.freezeClaim = row.freezeClaim.map(String);
-              this.ruleForm.label = row.label
-              this.ruleForm.suitableForCold = row.suitableForCold
-              this.ruleForm.iceColdAddress = row.iceColdAddress
-              this.ruleForm.forColdTime = row.forColdTime
-              this.ruleForm.sort = row.sort
-            })
-          })
-        } else if (type == 'logs') {
-          this.iceTracing = false
-          this.staffTitle = '详情'
-          this.staffDialogVisible = true
-          setTimeout(() => {
-            this.$nextTick(() => {
-              this.ruleForm.code = row.code
-              this.ruleForm.status = row.status
-              this.ruleForm.freezeClaim = row.freezeClaim
-              this.ruleForm.label = row.label
-              this.ruleForm.suitableForColdTime = row.suitableForColdTime
-            })
-          })
-          this.formRuleList.forEach((item, index) => {
-            item.disabled = true
-          })
-        } else if (type == 'del') {
-          this.deleteUser(row.id)
-        } else if (type == 'unbind') {
-          let coolerID = []
-          if (row.bindCoolerBox) {
-            this.ruleForm.coolerBoxId = row.bindCoolerBox.map(String)
-            coolerID = zipToObjects(row.bindCoolerBox, row.coolerBoxData)
-
-            function zipToObjects(keys, values) {
-              return keys.map((key, index) => ({
-                label: values[index],
-                value: key
-              }));
-            }
-          }
+      } else if (type == 'binding') {
+        const arrID = this.$refs.refWaybill.waybillIds
+        let arrList = []
+        arrID.forEach(item => {
+          arrList.push(item.code)
+        })
+        this.iceCode = arrList
+        if (arrList.length != 0) {
+          this.ruleForm.coolerBoxId = []
           this.staffDialogVisible = true
-          this.staffTitle = '修改绑定保温箱'
+          this.staffTitle = '绑定保温箱'
           this.formRuleList = bindingIncubator()
-          this.formRuleList.forEach(item => {
-            if (item.type == 'searchSelect') {
-              item.options = coolerID
-            }
-          })
-          this.page = 1
-          this.limitNoil = true
-          this.getIncubator()
-          // this.remoteMethod()
+          this.remoteMethod()
+        } else {
+          this.$message({
+            message: '请先选择需要批量操作的冰排',
+            type: 'warning'
+          });
         }
-      },
-      openModel(type) {
-        this.operationType = type
-        if (type == 'add') {
+      } else if (type == 'copyIce') {
+        this.operationType = 'add'
+        const arrID = this.$refs.refWaybill.waybillIds
+        if (arrID.length == 0) {
+          this.$message({
+            message: '请先选择需要复制的冰排',
+            type: 'warning'
+          });
+          return
+        }
+        if (arrID.length > 1) {
+          this.$message({
+            message: '只能选择一条冰排进行复制',
+            type: 'warning'
+          });
+          return
+        }
+        if (arrID.length == 1) {
+          this.copyFlag = true
           this.iceTracing = true
           this.staffTitle = '添加'
           this.staffDialogVisible = true
@@ -354,138 +408,133 @@
           } else {
             this.formRuleList = formRules()
           }
-        } else if (type == 'binding') {
-          const arrID = this.$refs.refWaybill.waybillIds
-          let arrList = []
-          arrID.forEach(item => {
-            arrList.push(item.code)
+          setTimeout(() => {
+            this.$nextTick(() => {
+              this.ruleForm.code = arrID[0].code
+              this.ruleForm.status = arrID[0].status
+              this.ruleForm.freezeClaim = arrID[0].freezeClaim.map(String);
+              this.ruleForm.label = arrID[0].label
+              this.ruleForm.suitableForCold = arrID[0].suitableForCold
+              this.ruleForm.iceColdAddress = arrID[0].iceColdAddress
+              this.ruleForm.forColdTime = arrID[0].forColdTime
+              this.ruleForm.sort = arrID[0].sort
+            })
           })
-          this.iceCode = arrList
-          if (arrList.length != 0) {
-            this.ruleForm.coolerBoxId = []
-            this.staffDialogVisible = true
-            this.staffTitle = '绑定保温箱'
-            this.formRuleList = bindingIncubator()
-            this.remoteMethod()
-          } else {
-            this.$message({
-              message: '请先选择需要批量操作的冰排',
-              type: 'warning'
-            });
-          }
-        }
-      },
-      handleScroll() {
-        if (this.limitNoil) {
-          this.getIncubator()
         }
-      },
-      remoteMethod(value) {
-        this.formRuleList.forEach(item => {
-          if (item.type == 'searchSelect') {
-            item.options = []
-          }
-        })
-        this.page = 1
-        this.limitNoil = true
-        this.staffName = value
+      }
+    },
+    handleScroll() {
+      if (this.limitNoil) {
         this.getIncubator()
-      },
-      // 获取保温箱列表
-      getIncubator() {
-        let params = {
-          page: this.page,
-          pageSize: 10,
-          status: '2',
-          name: this.staffName,
+      }
+    },
+    remoteMethod(value) {
+      this.formRuleList.forEach(item => {
+        if (item.type == 'searchSelect') {
+          item.options = []
         }
-        getCoolerBox(params).then(res => {
-          if (res.code == 200) {
-            let arr = res.data.list
-            let arrList = []
-            arr.forEach(item1 => {
-              var arrData = {
-                label: null,
-                value: null,
-              }
-              arrData.label = item1.name
-              arrData.value = item1.id
-              arrList.push(arrData)
-            })
-            if (this.limitNoil == true) {
-              this.formRuleList.forEach(item => {
-                if (item.type == 'searchSelect') {
-                  let arrIce = item.options.concat(arrList)
-                  const uniqueObjectsArray = uniqueObjectArray(arrIce);
-                  item.options = uniqueObjectsArray
+      })
+      this.page = 1
+      this.limitNoil = true
+      this.staffName = value
+      this.copyFlag = false
+      this.getIncubator()
+    },
+    // 获取保温箱列表
+    getIncubator() {
+      let params = {
+        page: this.page,
+        pageSize: 10,
+        status: '2',
+        name: this.staffName,
+      }
+      getCoolerBox(params).then(res => {
+        if (res.code == 200) {
+          let arr = res.data.list
+          let arrList = []
+          arr.forEach(item1 => {
+            var arrData = {
+              label: null,
+              value: null,
+            }
+            arrData.label = item1.name
+            arrData.value = item1.id
+            arrList.push(arrData)
+          })
+          if (this.limitNoil == true) {
+            this.formRuleList.forEach(item => {
+              if (item.type == 'searchSelect') {
+                let arrIce = item.options.concat(arrList)
+                const uniqueObjectsArray = uniqueObjectArray(arrIce);
+                item.options = uniqueObjectsArray
 
-                  function uniqueObjectArray(arr) {
-                    const uniqueArray = [];
-                    const uniqueSet = new Set();
+                function uniqueObjectArray(arr) {
+                  const uniqueArray = [];
+                  const uniqueSet = new Set();
 
-                    for (const item of arr) {
-                      const uniqueId = JSON.stringify(item);
-                      if (!uniqueSet.has(uniqueId)) {
-                        uniqueSet.add(uniqueId);
-                        uniqueArray.push(item);
-                      }
+                  for (const item of arr) {
+                    const uniqueId = JSON.stringify(item);
+                    if (!uniqueSet.has(uniqueId)) {
+                      uniqueSet.add(uniqueId);
+                      uniqueArray.push(item);
                     }
-
-                    return uniqueArray;
                   }
+
+                  return uniqueArray;
                 }
-              })
-              // this.thermostat.options = this.thermostat.options.concat(arrList)
-            }
-            if (arrList.length >= 10) {
-              this.page = ++this.page;
-            } else {
-              // 已经没数据了 不需要增加数据
-              this.limitNoil = false;
-            }
+              }
+            })
+            // this.thermostat.options = this.thermostat.options.concat(arrList)
           }
-        })
-      },
-      // 删除冰排
-      deleteUser(id) {
-        this.$confirm('此操作将永久删除该冰排, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          delIceRaft({
-            id: id,
-          }).then(res => {
-            if (res.code == 200) {
-              this.$message({
-                message: '操作成功',
-                type: 'success'
-              });
+          if (arrList.length >= 10) {
+            this.page = ++this.page;
+          } else {
+            // 已经没数据了 不需要增加数据
+            this.limitNoil = false;
+          }
+        }
+      })
+    },
+    // 删除冰排
+    deleteUser(id) {
+      this.$confirm('此操作将永久删除该冰排, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        delIceRaft({
+          id: id,
+        }).then(res => {
+          if (res.code == 200) {
+            this.$message({
+              message: '操作成功',
+              type: 'success'
+            });
 
-              const precisePage = Math.ceil((this.Total - 1) / this.Pagination.PageSize)
-              this.Pagination.PageIndex = this.Pagination.PageIndex > precisePage ? precisePage : this
-                .Pagination.PageIndex
-              this.Pagination.PageIndex = this.Pagination.PageIndex < 1 ? 1 : this.Pagination.PageIndex
-              this.getList()
-            }
-          })
-        }).catch(() => {});
-      },
-      changeSize(val) {
-        this.Pagination.PageSize = val
-        this.getList()
-      },
-      changeCurrent(val) {
-        this.Pagination.PageIndex = val
-        this.getList()
-      },
-      // 清空表单
-      closeDialog() {
-        this.$refs.childRules.resetCheck();
-      }
+            const precisePage = Math.ceil((this.Total - 1) / this.Pagination.PageSize)
+            this.Pagination.PageIndex = this.Pagination.PageIndex > precisePage ? precisePage : this
+              .Pagination.PageIndex
+            this.Pagination.PageIndex = this.Pagination.PageIndex < 1 ? 1 : this.Pagination.PageIndex
+            this.getList()
+          }
+        })
+      }).catch(() => { });
+    },
+    changeSize(val) {
+      this.Pagination.PageSize = val
+      this.getList()
+    },
+    changeCurrent(val) {
+      this.Pagination.PageIndex = val
+      this.getList()
     },
-  }
+    // 清空表单
+    closeDialog() {
+      this.copyFlag = false
+      this.$refs.childRules.resetCheck();
+    }
+  },
+}
 </script>
 
-<style>
-</style>
+<style></style>

+ 6 - 0
src/views/IceCreamFreezer/freezer.js

@@ -191,6 +191,9 @@ export const formRules = () => {
       },
       trigger: ['blur', 'change']
     }]
+  },{
+    field: 'copyflag',
+    type: 'copyflag',
   }]
 }
 export const formRulesCold = () => {
@@ -316,6 +319,9 @@ export const formRulesCold = () => {
       },
       trigger: ['blur', 'change']
     }]
+  },{
+    field: 'copyflag',
+    type: 'copyflag',
   }]
 }
 // 绑定保温箱

+ 6 - 3
src/views/IceCreamFreezer/refrigerator.js

@@ -63,8 +63,8 @@ export const iceList = () => {
 }
 export const employee = () => {
   return [{
-    field: 'index',
-    label: '序号',
+    field: 'selection',
+    label: '多选',
     align: 'center',
   }, {
     field: 'name',
@@ -156,5 +156,8 @@ export const formRules = () => {
       trigger: 'change'
     }],
     options: iceraftStatus()
-  }, ]
+  }, {
+    field: 'copyflag',
+    type: 'copyflag',
+  }]
 }

+ 636 - 597
src/views/incubator/IncubatorManagement.vue

@@ -5,7 +5,7 @@
       @searchProtocol="searchProtocol"></actionBar>
     <div class="card_content">
       <!-- 表单 -->
-      <tables :tableList="tableList" :tableData="tableData" @buttonData="buttonData"></tables>
+      <tables ref="refWaybill" :tableList="tableList" :tableData="tableData" @buttonData="buttonData"></tables>
       <!-- 分页 -->
       <div v-if="Total">
         <pagination :total="Total" :currentPage="Pagination.PageIndex" @changeSize="changeSize"
@@ -15,7 +15,7 @@
     </div>
     <el-dialog :title="staffTitle" :visible.sync="staffDialogVisible" width="600px" :close-on-click-modal="false"
       @close="closeDialog">
-      <forms ref="childRules" :formNewList="formRuleList" :ruleForm="ruleForm" labelWidth="110px"
+      <forms ref="childRules" :formNewList="formRuleList" :ruleForm="ruleForm" labelWidth="110px" :copyFlag="copyFlag"
         @handleScroll="handleScroll" @remoteMethod="remoteMethod"></forms>
       <span slot="footer" class="dialog-footer" v-if="operationType != 'logs'">
         <el-button plain @click="staffDialogVisible = false">取 消</el-button>
@@ -66,655 +66,694 @@
 </template>
 
 <script>
-  import {
-    getIceRaft,
-  } from '@/api/freezer'
-  import {
-    getCoolerBox,
-    addCoolerBox,
-    putCoolerBox,
-    delCoolerBox,
-    getDevice,
-    addCoolerBoxImport
-  } from '@/api/incubator'
-  import {
-    getTemperature
-  } from '@/api/waybill'
-  import actionBar from '@/components/actionBar'
-  import tables from '@/components/tables'
-  import pagination from '@/components/pagination'
-  import forms from '@/components/forms'
-  import thermography from '@/components/thermography'
-  // import centerControl from '@/components/centerControl'
-  import {
-    formRules,
-    employee,
-    incubator,
-    historyRecord,
-  } from "./incubator.js";
-  import {
-    startStatus,
-    iceraftStatus
-  } from '@/assets/js/blockSort'
-  export default {
-    name: 'IncubatorManagement',
-    components: {
-      actionBar,
-      tables,
-      pagination,
-      forms,
-      thermography,
-      // centerControl
-    },
-    data() {
-      return {
-        pickerOptions: {
-          shortcuts: [{
-            text: '最近一周',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
-              picker.$emit('pick', [start, end]);
-            }
-          }, {
-            text: '最近一个月',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
-              picker.$emit('pick', [start, end]);
-            }
-          }, {
-            text: '最近三个月',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
-              picker.$emit('pick', [start, end]);
-            }
-          }]
-        },
-        timeQuantum: [this.getTime(new Date(new Date().toLocaleDateString())), this.getTime(new Date())],
-
-        operateList: [{
-            type: 'add',
-            title: '添加保温箱',
-            icon: 'el-icon-plus',
-          }, {
-            type: 'import',
-            title: '冷链平台导入',
-            icon: 'el-icon-upload',
-          },
-          // {
-          //   type: 'screen',
-          //   title: '中控大屏',
-          //   icon: 'el-icon-position',
-          //   colour: 'success'
-          // },
-        ],
-        formList: [{
-          type: 'input',
-          label: '名称',
-          field: 'name',
-          placeholder: '名称',
-        }, {
-          type: 'input',
-          label: 'SN',
-          field: 'sn',
-          placeholder: 'SN',
-        }, {
-          type: 'select',
-          label: '状态',
-          field: 'status',
-          placeholder: '请选择状态',
-          options: iceraftStatus(),
-        }],
-        searchRuleForm: {
-          name: '',
-          sn: '',
-          status: '',
-        },
-        searchValue: {},
-        Pagination: {
-          PageIndex: 1,
-          PageSize: 10,
-        },
-        Total: 0,
-        tableData: [],
-        operationType: '',
-        tableList: [],
-        staffTitle: '添加',
-        staffDialogVisible: false,
-        formRuleList: [],
-        ruleForm: {
-          name: '',
-          sn: '',
-          status: '2',
-        },
-        confirmLoading: false,
-        selectingData: {},
-        importDialogVisible: false,
-        incubatorList: incubator(),
-        incubatorData: [],
-        Total1: 0,
-        Paginationil: {
-          PageIndex: 1,
-          PageSize: 10,
-        },
-        stateRuleData: [{
-          field: 'cold_temperatures',
-          label: '预冷温度(℃)',
-          placeholder: '请输入预冷温度(℃)',
-          type: 'input',
-          colWidth: 24,
-          rules: [{
-            required: true,
-            message: '请输入预冷温度(℃)',
-            trigger: 'blur'
-          }]
+import {
+  getIceRaft,
+} from '@/api/freezer'
+import {
+  getCoolerBox,
+  addCoolerBox,
+  putCoolerBox,
+  delCoolerBox,
+  getDevice,
+  addCoolerBoxImport
+} from '@/api/incubator'
+import {
+  getTemperature
+} from '@/api/waybill'
+import actionBar from '@/components/actionBar'
+import tables from '@/components/tables'
+import pagination from '@/components/pagination'
+import forms from '@/components/forms'
+import thermography from '@/components/thermography'
+// import centerControl from '@/components/centerControl'
+import {
+  formRules,
+  employee,
+  incubator,
+  historyRecord,
+} from "./incubator.js";
+import {
+  startStatus,
+  iceraftStatus
+} from '@/assets/js/blockSort'
+export default {
+  name: 'IncubatorManagement',
+  components: {
+    actionBar,
+    tables,
+    pagination,
+    forms,
+    thermography,
+    // centerControl
+  },
+  data() {
+    return {
+      pickerOptions: {
+        shortcuts: [{
+          text: '最近一周',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+            picker.$emit('pick', [start, end]);
+          }
         }, {
-          field: 'cold_spots',
-          label: '预冷地点',
-          placeholder: '请输入预冷地点',
-          type: 'input',
-          colWidth: 24,
-          rules: [{
-            required: true,
-            message: '请输入预冷地点',
-            trigger: 'blur'
-          }]
+          text: '最近一个月',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+            picker.$emit('pick', [start, end]);
+          }
         }, {
-          field: 'status',
-          label: '状态',
-          placeholder: '状态',
-          type: 'radio',
-          colWidth: 24,
-          rules: [{
-            required: true,
-            message: '选择状态',
-            trigger: 'change'
-          }],
-          options: startStatus()
+          text: '最近三个月',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+            picker.$emit('pick', [start, end]);
+          }
+        }]
+      },
+      timeQuantum: [this.getTime(new Date(new Date().toLocaleDateString())), this.getTime(new Date())],
+
+      operateList: [{
+        type: 'add',
+        title: '添加保温箱',
+        icon: 'el-icon-plus',
+      }, {
+        type: 'import',
+        title: '冷链平台导入',
+        icon: 'el-icon-upload',
+      }, {
+        type: 'copyIce',
+        title: '复制保温箱',
+        icon: 'el-icon-copy-document',
+      }
+        // {
+        //   type: 'screen',
+        //   title: '中控大屏',
+        //   icon: 'el-icon-position',
+        //   colour: 'success'
+        // },
+      ],
+      formList: [{
+        type: 'input',
+        label: '名称',
+        field: 'name',
+        placeholder: '名称',
+      }, {
+        type: 'input',
+        label: 'SN',
+        field: 'sn',
+        placeholder: 'SN',
+      }, {
+        type: 'select',
+        label: '状态',
+        field: 'status',
+        placeholder: '请选择状态',
+        options: iceraftStatus(),
+      }],
+      searchRuleForm: {
+        name: '',
+        sn: '',
+        status: '',
+      },
+      searchValue: {},
+      Pagination: {
+        PageIndex: 1,
+        PageSize: 10,
+      },
+      Total: 0,
+      tableData: [],
+      operationType: '',
+      tableList: [],
+      staffTitle: '添加',
+      staffDialogVisible: false,
+      formRuleList: [],
+      ruleForm: {
+        name: '',
+        sn: '',
+        status: '2',
+      },
+      confirmLoading: false,
+      selectingData: {},
+      importDialogVisible: false,
+      incubatorList: incubator(),
+      incubatorData: [],
+      Total1: 0,
+      Paginationil: {
+        PageIndex: 1,
+        PageSize: 10,
+      },
+      stateRuleData: [{
+        field: 'cold_temperatures',
+        label: '预冷温度(℃)',
+        placeholder: '请输入预冷温度(℃)',
+        type: 'input',
+        colWidth: 24,
+        rules: [{
+          required: true,
+          message: '请输入预冷温度(℃)',
+          trigger: 'blur'
+        }]
+      }, {
+        field: 'cold_spots',
+        label: '预冷地点',
+        placeholder: '请输入预冷地点',
+        type: 'input',
+        colWidth: 24,
+        rules: [{
+          required: true,
+          message: '请输入预冷地点',
+          trigger: 'blur'
+        }]
+      }, {
+        field: 'status',
+        label: '状态',
+        placeholder: '状态',
+        type: 'radio',
+        colWidth: 24,
+        rules: [{
+          required: true,
+          message: '选择状态',
+          trigger: 'change'
         }],
-        stateRuleList: [],
-        stateRuleForm: {
-          status: '2',
-        },
-        nameTitle: '',
-        incubatorLoading: false,
+        options: startStatus()
+      }],
+      stateRuleList: [],
+      stateRuleForm: {
+        status: '2',
+      },
+      nameTitle: '',
+      incubatorLoading: false,
 
-        timer: null, //定时器名称
-        dialogVisible: false,
-        waybillNo: '',
-        iceTracingVisible: false,
-        value1: '',
-        // 历史记录
-        historyList: historyRecord(),
-        historyData: [],
-        historyTotal: 0,
-        historyPagination: {
-          PageIndex: 1,
-          PageSize: 10,
-        },
-        userList: {},
+      timer: null, //定时器名称
+      dialogVisible: false,
+      waybillNo: '',
+      iceTracingVisible: false,
+      value1: '',
+      // 历史记录
+      historyList: historyRecord(),
+      historyData: [],
+      historyTotal: 0,
+      historyPagination: {
+        PageIndex: 1,
+        PageSize: 10,
+      },
+      userList: {},
 
-        icePagination: {
-          PageIndex: 1,
-          PageSize: 10,
-        },
-        iceTotal: 0,
-        staffName: '',
-        limitNo: true,
-      }
-    },
-    beforeDestroy() {
-      clearInterval(this.timer); // 清除定时器
-      this.timer = null;
-    },
-    mounted() {
-      const arr = localStorage.getItem('userList')
-      this.userList = JSON.parse(arr)
-      if (this.userList.dept.isCoolerReleaseCold) {
-        const dataList = formRules();
-        this.formRuleList = dataList;
-        this.stateRuleList = this.stateRuleData
-        this.tableList = employee()
-      } else {
-        const dataList = formRules();
-        const tablearr = employee();
-        this.formRuleList = removePointById(dataList, ['cold_spots', 'iceBinding', 'for_cold_cooler_time',
-          'cold_temperatures'
-        ])
-        this.stateRuleList = removePointById(this.stateRuleData, ['cold_spots', 'iceBinding', 'for_cold_cooler_time',
-          'cold_temperatures'
-        ])
-        this.tableList = removePointById(tablearr, ['cold_spots', 'iceBinding', 'for_cold_cooler_time',
-          'cold_temperatures'
-        ])
-      }
+      icePagination: {
+        PageIndex: 1,
+        PageSize: 10,
+      },
+      iceTotal: 0,
+      staffName: '',
+      limitNo: true,
+      copyFlag: false,
+    }
+  },
+  beforeDestroy() {
+    clearInterval(this.timer); // 清除定时器
+    this.timer = null;
+  },
+  mounted() {
+    const arr = localStorage.getItem('userList')
+    this.userList = JSON.parse(arr)
+    if (this.userList.dept.isCoolerReleaseCold) {
+      const dataList = formRules();
+      this.formRuleList = dataList;
+      this.stateRuleList = this.stateRuleData
+      this.tableList = employee()
+    } else {
+      const dataList = formRules();
+      const tablearr = employee();
+      this.formRuleList = removePointById(dataList, ['cold_spots', 'iceBinding', 'for_cold_cooler_time',
+        'cold_temperatures'
+      ])
+      this.stateRuleList = removePointById(this.stateRuleData, ['cold_spots', 'iceBinding', 'for_cold_cooler_time',
+        'cold_temperatures'
+      ])
+      this.tableList = removePointById(tablearr, ['cold_spots', 'iceBinding', 'for_cold_cooler_time',
+        'cold_temperatures'
+      ])
+    }
 
-      function removePointById(arr1, arr2) {
-        for (let i = 0; i < arr2.length; i++) {
-          for (let j = 0; j < arr1.length; j++) {
-            if (arr2[i] == arr1[j].field) {
-              let indexs = arr1.indexOf(arr1[j]);
-              arr1.splice(indexs, 1);
-            }
+    function removePointById(arr1, arr2) {
+      for (let i = 0; i < arr2.length; i++) {
+        for (let j = 0; j < arr1.length; j++) {
+          if (arr2[i] == arr1[j].field) {
+            let indexs = arr1.indexOf(arr1[j]);
+            arr1.splice(indexs, 1);
           }
         }
-        return arr1
       }
-      this.getList()
-    },
-    methods: {
-      download() {
-        getTemperature().then(response => {
-          if (response.fileName) {
-            this.pdfDialogVisible = false
-            //fileName = decodeURIComponent(filename);//对filename进行转码
-            let fileName = decodeURI(response.fileName);
-            if (window.navigator.msSaveOrOpenBlob) {
-              navigator.msSaveBlob(new Blob([response.data]), fileName);
-            } else {
-              let url = window.URL.createObjectURL(new Blob([response.data]));
-              let link = document.createElement('a');
-              link.style.display = 'none';
-              link.href = url;
-              link.setAttribute('download', fileName);
-              document.body.appendChild(link);
-              link.click();
-            }
+      return arr1
+    }
+    this.getList()
+  },
+  methods: {
+    download() {
+      getTemperature().then(response => {
+        if (response.fileName) {
+          this.pdfDialogVisible = false
+          //fileName = decodeURIComponent(filename);//对filename进行转码
+          let fileName = decodeURI(response.fileName);
+          if (window.navigator.msSaveOrOpenBlob) {
+            navigator.msSaveBlob(new Blob([response.data]), fileName);
           } else {
-            this.$message.error('未获取到文件名');
+            let url = window.URL.createObjectURL(new Blob([response.data]));
+            let link = document.createElement('a');
+            link.style.display = 'none';
+            link.href = url;
+            link.setAttribute('download', fileName);
+            document.body.appendChild(link);
+            link.click();
           }
-        })
-      },
-      getTime(time) {
-        var date = new Date(time)
-        var y = date.getFullYear()
-        var m = date.getMonth() + 1
-        m = m < 10 ? '0' + m : m
-        var d = date.getDate()
-        d = d < 10 ? '0' + d : d
-        var h = date.getHours()
-        h = h < 10 ? '0' + h : h
-        var minute = date.getMinutes()
-        minute = minute < 10 ? '0' + minute : minute
-        var s = date.getSeconds()
-        s = s < 10 ? '0' + s : s
-        return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + s
-      },
-      // 搜索
-      searchProtocol(value) {
-        this.searchValue = value
-        this.getList()
-      },
-      // 获取保温箱列表
-      getList() {
-        var params = {
-          page: this.Pagination.PageIndex,
-          pageSize: this.Pagination.PageSize,
-          showTemp: true,
-          ...this.searchValue
+        } else {
+          this.$message.error('未获取到文件名');
         }
-        getCoolerBox(params).then(res => {
-          if (res.code == 200) {
-            this.tableData = res.data.list
-            this.Total = res.data.count
-            this.timer = setTimeout(() => {
-              this.getList();
-              clearInterval(this.timer); // 清除定时器
-              this.timer = null;
-            }, 60000)
-          }
-        })
-      },
-      // 选项赋值
-      optionMatching(value, field) {
-        this.formRuleList.forEach((item, index) => {
-          if (item.field == field) {
-            item.options = value
+      })
+    },
+    getTime(time) {
+      var date = new Date(time)
+      var y = date.getFullYear()
+      var m = date.getMonth() + 1
+      m = m < 10 ? '0' + m : m
+      var d = date.getDate()
+      d = d < 10 ? '0' + d : d
+      var h = date.getHours()
+      h = h < 10 ? '0' + h : h
+      var minute = date.getMinutes()
+      minute = minute < 10 ? '0' + minute : minute
+      var s = date.getSeconds()
+      s = s < 10 ? '0' + s : s
+      return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + s
+    },
+    // 搜索
+    searchProtocol(value) {
+      this.searchValue = value
+      this.getList()
+    },
+    // 获取保温箱列表
+    getList() {
+      var params = {
+        page: this.Pagination.PageIndex,
+        pageSize: this.Pagination.PageSize,
+        showTemp: true,
+        ...this.searchValue
+      }
+      getCoolerBox(params).then(res => {
+        if (res.code == 200) {
+          this.tableData = res.data.list
+          this.Total = res.data.count
+          this.timer = setTimeout(() => {
+            this.getList();
+            clearInterval(this.timer); // 清除定时器
+            this.timer = null;
+          }, 60000)
+        }
+      })
+    },
+    // 选项赋值
+    optionMatching(value, field) {
+      this.formRuleList.forEach((item, index) => {
+        if (item.field == field) {
+          item.options = value
+        }
+      })
+    },
+    // 弹窗表单添加
+    handleAdd() {
+      let flag = this.$refs['childRules'].validateForm();
+      if (flag) {
+        if (this.operationType == 'add') {
+          this.confirmLoading = true
+          var params = {
+            ...this.ruleForm
           }
-        })
-      },
-      // 弹窗表单添加
-      handleAdd() {
-        let flag = this.$refs['childRules'].validateForm();
-        if (flag) {
-          if (this.operationType == 'add') {
-            this.confirmLoading = true
-            var params = {
-              ...this.ruleForm
-            }
-            params.for_cold_cooler_time = Number(this.ruleForm.for_cold_cooler_time)
-            addCoolerBox(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
+          params.for_cold_cooler_time = Number(this.ruleForm.for_cold_cooler_time)
+          addCoolerBox(params).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                message: '操作成功',
+                type: 'success'
+              });
+              this.getList()
+              this.ruleForm.copyNumber--
+              if (this.ruleForm.copyNumber == 0 || this.ruleForm.copyNumber == null || this.ruleForm.copyNumber == undefined || this.ruleForm.copyNumber == 0) {
                 this.staffDialogVisible = false
               }
-              this.confirmLoading = false
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-          } else if (this.operationType == 'edit') {
-            this.confirmLoading = true
-            var params = {
-              id: this.selectingData.id,
-              name: this.ruleForm.name,
-              sn: this.ruleForm.sn,
-              status: this.ruleForm.status,
-              cold_spots: this.ruleForm.cold_spots,
-              cold_temperatures: this.ruleForm.cold_temperatures,
-              for_cold_cooler_time: Number(this.ruleForm.for_cold_cooler_time),
             }
-            console.log(params, 23)
-            putCoolerBox(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
-              }
-              this.staffDialogVisible = false
-              this.confirmLoading = false
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-          }
-        } else {
-          this.$message.error('表单信息不完整,请继续填写完整');
-        }
-      },
-      buttonData(row, type) {
-        this.selectingData = row
-        this.operationType = type
-        if (type == 'edit') {
-          this.staffTitle = '编辑'
-          this.staffDialogVisible = true
-          if (this.userList.dept.isCoolerReleaseCold) {
-            this.obtainIceRaft()
-          }
-          setTimeout(() => {
-            this.$nextTick(() => {
-              this.ruleForm = JSON.parse(JSON.stringify(row))
-            })
+            this.confirmLoading = false
+          }).catch(() => {
+            this.confirmLoading = false
           })
-        } else if (type == 'del') {
-          this.deleteUser(row.id)
-        } else if (type == 'logs') {
-          this.staffTitle = '详情'
-          this.staffDialogVisible = true
-          this.formRuleList.forEach((item, index) => {
-            item.disabled = true
+        } else if (this.operationType == 'edit') {
+          this.confirmLoading = true
+          var params = {
+            id: this.selectingData.id,
+            name: this.ruleForm.name,
+            sn: this.ruleForm.sn,
+            status: this.ruleForm.status,
+            cold_spots: this.ruleForm.cold_spots,
+            cold_temperatures: this.ruleForm.cold_temperatures,
+            for_cold_cooler_time: Number(this.ruleForm.for_cold_cooler_time),
+          }
+          console.log(params, 23)
+          putCoolerBox(params).then(res => {
+            if (res.code == 200) {
+              this.$message({
+                message: '操作成功',
+                type: 'success'
+              });
+              this.getList()
+            }
+            this.staffDialogVisible = false
+            this.confirmLoading = false
+          }).catch(() => {
+            this.confirmLoading = false
           })
-          this.ruleForm = JSON.parse(JSON.stringify(row))
-        } else if (type == 'record') {
-          this.dialogVisible = true
-          this.waybillNo = row.sn
+        }
+      } else {
+        this.$message.error('表单信息不完整,请继续填写完整');
+      }
+    },
+    buttonData(row, type) {
+      this.selectingData = row
+      this.operationType = type
+      if (type == 'edit') {
+        this.staffTitle = '编辑'
+        this.staffDialogVisible = true
+        if (this.userList.dept.isCoolerReleaseCold) {
+          this.obtainIceRaft()
+        }
+        setTimeout(() => {
           this.$nextTick(() => {
-            this.$refs.thermo.getProbe()
+            this.ruleForm = JSON.parse(JSON.stringify(row))
           })
-        } else if (type == 'ascend') {
-          this.iceTracingVisible = true
-        }
-      },
-      // 选择时间
-      timeChange() {
+        })
+      } else if (type == 'del') {
+        this.deleteUser(row.id)
+      } else if (type == 'logs') {
+        this.staffTitle = '详情'
+        this.staffDialogVisible = true
+        this.formRuleList.forEach((item, index) => {
+          item.disabled = true
+        })
+        this.ruleForm = JSON.parse(JSON.stringify(row))
+      } else if (type == 'record') {
+        this.dialogVisible = true
+        this.waybillNo = row.sn
         this.$nextTick(() => {
-          this.$refs.thermo.getTemperature()
+          this.$refs.thermo.getProbe()
         })
-      },
-      openModel(type) {
-        if (type == 'add') {
+      } else if (type == 'ascend') {
+        this.iceTracingVisible = true
+      }
+    },
+    // 选择时间
+    timeChange() {
+      this.$nextTick(() => {
+        this.$refs.thermo.getTemperature()
+      })
+    },
+    openModel(type) {
+      if (type == 'add') {
+        this.staffTitle = '添加'
+        this.staffDialogVisible = true
+        this.operationType = type
+        if (this.userList.dept.isCoolerReleaseCold) {
+          this.obtainIceRaft()
+        }
+      } else if (type == 'import') {
+        this.importDialogVisible = true
+        this.getDeviceList()
+      } else if (type == 'screen') {
+        // this.$refs.control.controlVisible = true
+        // this.$nextTick(() => {
+        //   setTimeout(() => {
+        //     this.$refs.control.keyUpSearch()
+        //     this.$refs.control.getList()
+        //   }, 100)
+        // })
+      } else if (type == 'copyIce') {
+        this.operationType = 'add'
+        const arrID = this.$refs.refWaybill.waybillIds
+        if (arrID.length == 0) {
+          this.$message({
+            message: '请先选择需要复制的冰排',
+            type: 'warning'
+          });
+          return
+        }
+        if (arrID.length > 1) {
+          this.$message({
+            message: '只能选择一条冰排进行复制',
+            type: 'warning'
+          });
+          return
+        }
+        if (arrID.length == 1) {
+          this.copyFlag = true
           this.staffTitle = '添加'
           this.staffDialogVisible = true
-          this.operationType = type
           if (this.userList.dept.isCoolerReleaseCold) {
             this.obtainIceRaft()
           }
-        } else if (type == 'import') {
-          this.importDialogVisible = true
-          this.getDeviceList()
-        } else if (type == 'screen') {
-          // this.$refs.control.controlVisible = true
-          // this.$nextTick(() => {
-          //   setTimeout(() => {
-          //     this.$refs.control.keyUpSearch()
-          //     this.$refs.control.getList()
-          //   }, 100)
-          // })
-        }
-      },
-      // 触底事件
-      handleScroll() {
-        if (this.limitNo) {
-          this.obtainIceRaft()
+          setTimeout(() => {
+            this.$nextTick(() => {
+              this.ruleForm = JSON.parse(JSON.stringify(arrID[0]))
+            })
+          })
         }
-      },
-      // 搜索
-      remoteMethod(value, type) {
-        this.resetSelect(type)
-        this.staffName = value
+      }
+    },
+    // 触底事件
+    handleScroll() {
+      if (this.limitNo) {
         this.obtainIceRaft()
-      },
-      // 重置选择冰排
-      resetSelect(type) {
-        this.formRuleList.forEach(item => {
-          if (item.field == type) {
-            item.options = []
-          }
-        })
-        this.icePagination.PageIndex = 1
-        this.limitNo = true
-        this.staffName = ''
-      },
-      // 获取冰排列表
-      obtainIceRaft() {
-        var params = {
-          page: this.icePagination.PageIndex,
-          pageSize: 10,
-          code: this.staffName,
-        }
-        getIceRaft(params).then(res => {
-          if (res.code == 200) {
-            let arr = res.data.list
-            let arrList = []
-            arr.forEach(item1 => {
-              var arrData = {
-                label: null,
-                value: null,
-              }
-              arrData.label = item1.code
-              arrData.value = item1.code
-              // arrData.value = item1.id
-              arrList.push(arrData)
-            })
-            if (this.limitNo == true) {
-              this.formRuleList.forEach(item => {
-                if (item.field == 'iceBinding') {
-                  item.options = item.options.concat(arrList);
-                  let some = [];
-                  item.options.forEach(el => {
-                    if (!some.some(e => e.value == el.value)) {
-                      some.push(el)
-                    }
-                  })
-                  item.options = some
-                }
-              })
-            }
-            if (arrList.length >= 10) {
-              this.icePagination.PageIndex = ++this.icePagination.PageIndex;
-            } else {
-              // 已经没数据了 不需要增加数据
-              this.limitNo = false;
-            }
-          }
-        })
-      },
-      // 获取设备列表
-      getDeviceList() {
-        var params = {
-          page: this.Paginationil.PageIndex,
-          pageSize: this.Paginationil.PageSize,
-          name: this.nameTitle,
+      }
+    },
+    // 搜索
+    remoteMethod(value, type) {
+      this.resetSelect(type)
+      this.staffName = value
+      this.obtainIceRaft()
+    },
+    // 重置选择冰排
+    resetSelect(type) {
+      this.formRuleList.forEach(item => {
+        if (item.field == type) {
+          item.options = []
         }
-        getDevice(params).then(res => {
-          if (res.code == 200) {
-            this.incubatorData = res.data.list
-            this.Total1 = res.data.count
-          }
-        })
-      },
-      // 搜索保温箱
-      incubatorInput(value) {
-        this.nameTitle = value
-        this.getDeviceList()
-      },
-      // 批量导入保温箱
-      incubatorAdd() {
-        const arrID = this.$refs.refIncubator.waybillIds
-        let arr1 = []
-        arrID.forEach(item => {
-          let arr2 = {
-            sn: item.T_sn,
-            name: item.T_devName,
-          }
-          arr1.push(arr2)
-        })
-        let flag = this.$refs['incubatorRules'].validateForm();
-        if (flag) {
-          if (arr1.length > 0) {
-            this.incubatorLoading = true
-            let params = {
-              list: arr1,
-              ...this.stateRuleForm,
+      })
+      this.icePagination.PageIndex = 1
+      this.limitNo = true
+      this.staffName = ''
+    },
+    // 获取冰排列表
+    obtainIceRaft() {
+      var params = {
+        page: this.icePagination.PageIndex,
+        pageSize: 10,
+        code: this.staffName,
+      }
+      getIceRaft(params).then(res => {
+        if (res.code == 200) {
+          let arr = res.data.list
+          let arrList = []
+          arr.forEach(item1 => {
+            var arrData = {
+              label: null,
+              value: null,
             }
-            addCoolerBoxImport(params).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success'
-                });
-                this.getList()
-                this.importDialogVisible = false
+            arrData.label = item1.code
+            arrData.value = item1.code
+            // arrData.value = item1.id
+            arrList.push(arrData)
+          })
+          if (this.limitNo == true) {
+            this.formRuleList.forEach(item => {
+              if (item.field == 'iceBinding') {
+                item.options = item.options.concat(arrList);
+                let some = [];
+                item.options.forEach(el => {
+                  if (!some.some(e => e.value == el.value)) {
+                    some.push(el)
+                  }
+                })
+                item.options = some
               }
-              this.incubatorLoading = false
-            }).catch(() => {
-              this.incubatorLoading = false
             })
+          }
+          if (arrList.length >= 10) {
+            this.icePagination.PageIndex = ++this.icePagination.PageIndex;
           } else {
-            this.$message.warning('请选择需要导入的保温箱');
+            // 已经没数据了 不需要增加数据
+            this.limitNo = false;
           }
-        } else {
-          this.$message.error('表单信息不完整,请继续填写完整');
         }
-      },
-      // 删除保温箱
-      deleteUser(id) {
-        this.$confirm('此操作将永久删除该保温箱, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          delCoolerBox({
-            id: id,
-          }).then(res => {
+      })
+    },
+    // 获取设备列表
+    getDeviceList() {
+      var params = {
+        page: this.Paginationil.PageIndex,
+        pageSize: this.Paginationil.PageSize,
+        name: this.nameTitle,
+      }
+      getDevice(params).then(res => {
+        if (res.code == 200) {
+          this.incubatorData = res.data.list
+          this.Total1 = res.data.count
+        }
+      })
+    },
+    // 搜索保温箱
+    incubatorInput(value) {
+      this.nameTitle = value
+      this.getDeviceList()
+    },
+    // 批量导入保温箱
+    incubatorAdd() {
+      const arrID = this.$refs.refIncubator.waybillIds
+      let arr1 = []
+      arrID.forEach(item => {
+        let arr2 = {
+          sn: item.T_sn,
+          name: item.T_devName,
+        }
+        arr1.push(arr2)
+      })
+      let flag = this.$refs['incubatorRules'].validateForm();
+      if (flag) {
+        if (arr1.length > 0) {
+          this.incubatorLoading = true
+          let params = {
+            list: arr1,
+            ...this.stateRuleForm,
+          }
+          addCoolerBoxImport(params).then(res => {
             if (res.code == 200) {
               this.$message({
                 message: '操作成功',
                 type: 'success'
               });
-              const precisePage = Math.ceil((this.Total - 1) / this.Pagination.PageSize)
-              this.Pagination.PageIndex = this.Pagination.PageIndex > precisePage ? precisePage : this
-                .Pagination.PageIndex
-              this.Pagination.PageIndex = this.Pagination.PageIndex < 1 ? 1 : this.Pagination.PageIndex
               this.getList()
+              this.importDialogVisible = false
             }
+            this.incubatorLoading = false
+          }).catch(() => {
+            this.incubatorLoading = false
           })
-        }).catch(() => {});
-      },
-      changeSize(val) {
-        this.Pagination.PageSize = val
-        this.getList()
-      },
-      changeCurrent(val) {
-        this.Pagination.PageIndex = val
-        this.getList()
-      },
-      changeSizeil(val) {
-        this.Paginationil.PageSize = val
-        this.getDeviceList()
-      },
-      changeCurrentil(val) {
-        this.Paginationil.PageIndex = val
-        this.getDeviceList()
-      },
-      // 清空表单
-      closeDialog() {
-        this.formRuleList.forEach((item, index) => {
-          item.disabled = false
-        })
-        this.ruleForm = {}
-        this.$refs.childRules.resetCheck();
-      },
-      // 关闭温湿度记录
-      temperatureClose() {
-        this.timeQuantum = [this.getTime(new Date(new Date().toLocaleDateString())), this.getTime(new Date())]
-      },
-      closeDialogil() {
-        this.$refs.incubatorRules.resetCheck();
-        this.$refs.refIncubator.clearSelected();
+        } else {
+          this.$message.warning('请选择需要导入的保温箱');
+        }
+      } else {
+        this.$message.error('表单信息不完整,请继续填写完整');
       }
+    },
+    // 删除保温箱
+    deleteUser(id) {
+      this.$confirm('此操作将永久删除该保温箱, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        delCoolerBox({
+          id: id,
+        }).then(res => {
+          if (res.code == 200) {
+            this.$message({
+              message: '操作成功',
+              type: 'success'
+            });
+            const precisePage = Math.ceil((this.Total - 1) / this.Pagination.PageSize)
+            this.Pagination.PageIndex = this.Pagination.PageIndex > precisePage ? precisePage : this
+              .Pagination.PageIndex
+            this.Pagination.PageIndex = this.Pagination.PageIndex < 1 ? 1 : this.Pagination.PageIndex
+            this.getList()
+          }
+        })
+      }).catch(() => { });
+    },
+    changeSize(val) {
+      this.Pagination.PageSize = val
+      this.getList()
+    },
+    changeCurrent(val) {
+      this.Pagination.PageIndex = val
+      this.getList()
+    },
+    changeSizeil(val) {
+      this.Paginationil.PageSize = val
+      this.getDeviceList()
+    },
+    changeCurrentil(val) {
+      this.Paginationil.PageIndex = val
+      this.getDeviceList()
+    },
+    // 清空表单
+    closeDialog() {
+      this.formRuleList.forEach((item, index) => {
+        item.disabled = false
+      })
+      this.copyFlag = false
+      this.ruleForm = {}
+      this.$refs.childRules.resetCheck();
+    },
+    // 关闭温湿度记录
+    temperatureClose() {
+      this.timeQuantum = [this.getTime(new Date(new Date().toLocaleDateString())), this.getTime(new Date())]
+    },
+    closeDialogil() {
+      this.$refs.incubatorRules.resetCheck();
+      this.$refs.refIncubator.clearSelected();
     }
   }
+}
 </script>
 
 <style lang="scss" scoped>
-  .card_check_title {
-    display: flex;
-    align-items: center;
-  }
+.card_check_title {
+  display: flex;
+  align-items: center;
+}
 
-  .icon_import {
-    margin-right: 5px;
-    font-size: 20px;
-  }
+.icon_import {
+  margin-right: 5px;
+  font-size: 20px;
+}
 
-  .card_import {
-    margin-top: 15px;
-    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-    margin-bottom: 20px;
-    border-radius: 10px;
-  }
+.card_import {
+  margin-top: 15px;
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+  margin-bottom: 20px;
+  border-radius: 10px;
+}
 
-  .management_card ::v-deep .el-dialog__body {
-    padding: 0px 20px !important;
-  }
+.management_card ::v-deep .el-dialog__body {
+  padding: 0px 20px !important;
+}
 
-  .card_incubat {
-    padding-left: 15px;
-    padding-right: 15px;
-    border-bottom: 1px solid #EBEEF5;
-    padding-top: 15px;
-    margin-bottom: 15px;
-  }
+.card_incubat {
+  padding-left: 15px;
+  padding-right: 15px;
+  border-bottom: 1px solid #EBEEF5;
+  padding-top: 15px;
+  margin-bottom: 15px;
+}
 
-  .card_search_input {
-    display: flex;
-    align-items: center;
-    padding: 15px 20px 15px 20px;
-    border-bottom: 1px solid #EBEEF5;
-  }
+.card_search_input {
+  display: flex;
+  align-items: center;
+  padding: 15px 20px 15px 20px;
+  border-bottom: 1px solid #EBEEF5;
+}
 
-  .title_search {
-    flex: none;
-    margin-right: 5px;
-  }
+.title_search {
+  flex: none;
+  margin-right: 5px;
+}
 </style>

+ 6 - 3
src/views/incubator/incubator.js

@@ -18,10 +18,10 @@ export const incubator = () => {
 
 export const employee = () => {
   return [{
-    field: 'index',
-    label: '序号',
+    field: 'selection',
+    label: '多选',
     align: 'center',
-  }, {
+  },{
     field: 'name',
     label: '名称',
     align: 'center',
@@ -172,6 +172,9 @@ export const formRules = () => {
       trigger: 'change'
     }],
     options: startStatus()
+  },{
+    field: 'copyflag',
+    type: 'copyflag',
   }]
 }
 

+ 12 - 0
src/views/login.vue

@@ -40,6 +40,10 @@
 </template>
 
 <script>
+  import {
+    handleBase64FromUrl,
+    clearDataParamFromUrl
+  } from '@/utils/base64Utils.js'
   import identifyingCode from '@/components/identifyingCode'
   import {
     mapActions
@@ -84,6 +88,14 @@
     },
     mounted() {
       this.refreshCode()
+      const result = handleBase64FromUrl();
+      if (result) {
+        this.form.name = result.account
+        this.form.password = result.password
+        this.form.captcha = this.identifyCode
+        clearDataParamFromUrl()
+        this.getLogin()
+      }
     },
     methods: {
       ...mapActions(['Login', 'Logout']),

+ 7 - 2
src/views/newInquiry.vue

@@ -155,12 +155,12 @@
         deviceType: false,
         waybillBasic: {},
         logisticsFlag: true,
-        logisticsData:[],
+        logisticsData: [],
         logisticsList: [{
           id: 1,
           flag: true,
           title: '基本信息'
-        },{
+        }, {
           id: 3,
           flag: false,
           title: '轨迹查询'
@@ -219,6 +219,11 @@
         }).then(res => {
           if (res.code == 200) {
             this.waybillBasic = res.data
+            if (this.waybillBasic.status == 5) {
+              this.logisticsData = this.logisticsList1
+            } else {
+              this.logisticsData = this.logisticsList
+            }
           }
         })
       },