Jelajahi Sumber

设备管理加入pos机

Joe 4 tahun lalu
induk
melakukan
946ebbcbbc

+ 0 - 305
src/views/station/configuration/applet .vue

@@ -1,305 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
-      <el-table-column v-if="false" label="自增主键id" align="center"  prop="deptId" />
-      <el-table-column label="油站名称" align="center" prop="deptName" />
-      <el-table-column label="油站地址" align="center" prop="deptAddress" />
-      <el-table-column label="联系人" align="center" prop="leader" />
-      <el-table-column label="电话" align="center" prop="phone" />
-      <el-table-column v-if="false" label="集团id"  align="center" prop="stationGroupId" />
-      <el-table-column v-if="false" label="集团名称" align="center" prop="stationGroupName" />
-      <el-table-column v-if="false" label="油站照片" align="center" prop="stationPic" />
-      <el-table-column label="油站经度" align="center" prop="stationLongitude" />
-      <el-table-column label="油站纬度" align="center" prop="stationLatitude" />
-      <el-table-column label="商户编码" align="center" prop="mno" />
-      <el-table-column label="操作" align="c--enter" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['station:info:edit']"
-          >修改</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
-
-    <!-- 添加或修改油站信息对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
-        <el-form-item label="油站形象照" prop="stationPic">
-          <el-upload
-            class="avatar-uploader"
-            :action="addressUrl"
-            :show-file-list="false"
-            :headers="headers"
-            :on-success="handleAvatarSuccess"
-            :before-upload="beforeAvatarUpload">
-            <img v-if="form.stationPic" :src="form.stationPic" style="width:150px;height: 150px;" class="avatar">
-            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
-            <div class="el-upload__tip" slot="tip">点击图片重新上传,只能上传jpg/png文件,图片大小不超过2M</div>
-          </el-upload>
-        </el-form-item>
-        <el-form-item label="油站名称" prop="deptName">
-          <el-input v-model="form.deptName" placeholder="请输入油站名称" />
-        </el-form-item>
-        <el-form-item label="油站地址" prop="deptAddress">
-          <el-input v-model="form.deptAddress" placeholder="请输入油站地址" />
-        </el-form-item>
-        <el-form-item label="联系人" prop="leader">
-          <el-input v-model="form.leader" placeholder="请输入联系人" />
-        </el-form-item>
-        <el-form-item label="电话" prop="phone">
-          <el-input v-model="form.phone" placeholder="请输入电话" />
-        </el-form-item>
-        <el-form-item label="油站经度" prop="stationLongitude">
-          <el-input v-model="form.stationLongitude" :disabled="true" placeholder="请输入油站经度" />
-        </el-form-item>
-        <el-form-item label="油站纬度" prop="stationLatitude">
-          <el-input v-model="form.stationLatitude"  :disabled="true" placeholder="请输入油站纬度" />
-        </el-form-item>
-        <el-form-item label="商户编码" prop="mno">
-          <el-input v-model="form.mno" :disabled="true"  placeholder="请输入商户编码" />
-        </el-form-item>
-        <el-form-item label="小程序appid" prop="appId">
-          <el-input v-model="form.appId" :disabled="true"  placeholder="小程序appid" />
-        </el-form-item>
-        <el-form-item label="小程序appSecret" prop="appSecret">
-          <el-input v-model="form.appSecret" :disabled="true"  placeholder="小程序appSecret" />
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo } from "@/api/station/info";
-import { getToken } from "@/utils/auth";
-import { treeselect } from "@/api/system/dept";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-export default {
-  name: "Info",
-  components: { Treeselect },
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 油站信息表格数据
-      infoList: [],
-      // 部门树选项
-      deptOptions: undefined,
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        stationName: null,
-        deptAddress: null,
-        oilGunNum: null,
-        contacts: null, 
-        phone: null,
-        stationGroupName: null,
-        stationPic: null,
-        stationLongitude: null,
-        stationLatitude: null,
-        mno: null,
-        deptId:null
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-      },
-      imageUrl: '',
-      headers: { Authorization: "Bearer " + getToken() },
-      addressUrl: location.protocol+"//"+location.host+ process.env.VUE_APP_BASE_API+"/common/upload"
-    };
-  },
-  created() {
-    this.getList();
-    this.getTreeselect();
-  },
-
-  methods: {
-    /** 查询油站信息列表 */
-    getList() {
-      this.loading = true;
-      this.queryParams.deptId= this.$store.selectDeptId;
-      if(this.queryParams.deptId==null || this.queryParams.deptId==""){
-        this.queryParams.deptId =this.$store.state.user.deptId;
-      }
-      listInfo(this.queryParams).then(response => {
-        this.infoList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    getTreeselect() {
-      treeselect().then(response => {
-        this.deptOptions = response.data;
-      });
-    },
-
-    // 获取当前选中部门的名称
-    selectDepart(val) {
-      this.form.stationGroupName=val.label;
-    },
-
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        deptId: null,
-        deptName: null,
-        deptAddress: null,
-        oilGunNum: null,
-        contacts: null,
-        phone: null,
-        stationGroupId: null,
-        stationGroupName: null,
-        stationPic: null,
-        stationLongitude: null,
-        stationLatitude: null,
-        mno: null,
-        deptId:null
-      };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.stationId)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加油站信息";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const deptId = row.deptId || this.ids
-      getInfo(deptId).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改油站信息";
-      });
-      // this.upload.fileList = [{ name: this.form.fileName, url: this.form.filePath }];
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.deptId != null) {
-            updateInfo(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const stationIds = row.deptId || this.ids;
-      this.$confirm('是否确认删除油站信息', "警告", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      }).then(function() {
-        return delInfo(stationIds);
-      }).then(() => {
-        this.getList();
-        this.msgSuccess("删除成功");
-      })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('是否确认导出所有油站信息数据项?', "警告", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      }).then(function() {
-        return exportInfo(queryParams);
-      }).then(response => {
-        this.download(response.msg);
-      })
-    },
-    // 文件提交处理
-    submitUpload() {
-      this.$refs.upload.submit();
-    },
-// 文件上传中处理
-    handleFileUploadProgress(event, file, fileList) {
-      this.upload.isUploading = true;
-    },
-// 文件上传成功处理++ =
-    handleFileSuccess(response, file, fileList) {
-      this.upload.isUploading = false;
-      let imgurl=location.protocol+"//"+location.host+process.env.VUE_APP_BASE_API+response.fileName;
-      this.form.stationPic = imgurl;
-      this.msgSuccess(response.msg);
-    },
-    handleAvatarSuccess(res, file) {
-      let imgurl=location.protocol+"//"+location.host+process.env.VUE_APP_BASE_API+res.fileName;
-      this.form.stationPic = imgurl;
-    },
-    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;
-    }
-  }
-};
-</script>

+ 192 - 0
src/views/station/configuration/applet.vue

@@ -0,0 +1,192 @@
+<template>
+  <div class="app-container">
+    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="130px">
+      <el-form-item label="油站名称"  prop="stationName" v-show="false">
+        <el-input v-model="ruleForm.stationName" placeholder="请输入油站名称" />
+      </el-form-item>
+      <el-form-item label="首页轮播图"  prop="payMode">
+        <el-upload
+          class="avatar-uploader"
+          :class="[ruleForm.imgFileList.length<=3?'':'uploader-hidden']"
+          :action="addressUrl"
+          :headers="headers"
+          multiple
+          list-type="picture-card"
+          :limit="4"
+          :file-list="ruleForm.imgFileList"
+          accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
+          :before-upload="beforeAvatarUpload"
+          :on-remove="handleRemove"
+          :on-success="handlepaymentSuccess"
+          :auto-upload="true"
+        >
+          <i class="el-icon-plus"></i>
+          <div class="el-upload__tip" slot="tip">只能上传图片文件,单张图片不要太大</div>
+        </el-upload>
+        <el-dialog :visible.sync="dialogVisible" append-to-body>
+          <img width="100%" :src="dialogImageUrl" alt="" />
+        </el-dialog>
+      </el-form-item>
+      <el-form-item label="公告信息" prop="notice" >
+          <textarea cols="40" rows="3" v-model="ruleForm.notice"  placeholder="请输入公告信息"></textarea>
+        </el-form-item>
+      <el-form-item label="班结是否打印" >
+        <el-radio-group v-model="ruleForm.wsPrintFlag">
+          <el-radio
+            v-for="dict in wsPrintFlagOptions"
+            :key="dict.dictValue"
+            :label="dict.dictValue"
+          >{{dict.dictLabel}}</el-radio>
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item label="小票打印模板" >
+        <el-radio-group v-model="ruleForm.printSetting">
+          <el-radio
+            v-for="dict in printSettingOptions"
+            :key="dict.dictValue"
+            :label="dict.dictValue"
+          >{{dict.dictLabel}}</el-radio>
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item label="兑换积分小票打印" >
+        <el-radio-group v-model="ruleForm.integralPrintFlag">
+          <el-radio
+            v-for="dict in integralPrintFlagOptions"
+            :key="dict.dictValue"
+            :label="dict.dictValue"
+          >{{dict.dictLabel}}</el-radio>
+        </el-radio-group>
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button type="primary" @click="submitForm">确 定</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { getToken } from "@/utils/auth";
+import {addPay, updatePay,getStationPay} from "@/api/station/pay";
+import {stationinfo} from "@/api/station/gun";
+export default {
+  name: "Pay",
+  data() {
+    return {
+      // 遮罩层
+      wsPrintFlagOptions:[],
+      printSettingOptions:[],
+      cardEnabledFlagOptions:[],
+      discountSettingOptions:[],
+      isNoOilOptions:[],
+      integralPrintFlagOptions:[],
+      deleteImgFileList: [], //存已被删除了的图片的id
+      dialogImageUrl: '',
+      dialogVisible: false,
+      ruleForm:{
+        imgFileList:[]
+      },
+      queryParams: {
+        stationId: null
+      },
+      query:{
+        deptId: null
+      },
+      // 表单校验
+      rules: {
+      },
+      headers: { Authorization: "Bearer " + getToken() },
+      addressUrl: location.protocol+"//"+location.host+ process.env.VUE_APP_BASE_API+"/common/upload"
+    };
+  },
+  created() {
+    this.look();
+    this.query.deptId =this.$store.selectDeptId;
+    this.getDicts("ws_print_flag").then(response => {
+      this.wsPrintFlagOptions = response.data;
+    });
+    this.getDicts("print_setting_flag").then(response => {
+      this.printSettingOptions = response.data;
+    });
+    this.getDicts("card_enabled_flag").then(response => {
+      this.cardEnabledFlagOptions = response.data;
+    });
+    this.getDicts("discount_setting").then(response => {
+      this.discountSettingOptions = response.data;
+    });
+    this.getDicts("is_flag").then(response => {
+      this.isNoOilOptions = response.data;
+    });
+    this.getDicts("is_flag").then(response => {
+      this.integralPrintFlagOptions = response.data;
+    });
+
+  },
+  mounted(){
+    
+  },
+  methods: {
+    handleRemove(file, fileList) {
+      this.ruleForm.imgFileList = fileList;
+    },
+    beforeAvatarUpload(file) {
+      const isType = file.type === 'image/jpeg' || 'image/png';
+      const isLt5M = file.size / 1024 / 1024 < 5;
+      if (!isType) {
+        this.$message.error('上传头像图片只能是 JPG 或 PNG格式!');
+      }
+      if (!isLt5M) {
+        this.$message.error('上传头像图片大小不能超过 1MB!');
+      }
+      return isLt5M;
+    },
+     //上传成功
+    handlepaymentSuccess(response,file, fileList){
+      console.log(response);
+      console.log(file)
+      console.log(fileList)
+        let imgurl=location.protocol+"//"+location.host+process.env.VUE_APP_BASE_API+response.fileName;
+        this.ruleForm.imgFileList.push({name:file.name,url:imgurl});
+    },
+    /** 进入信息 */
+    look() {
+      getStationPay(this.queryParams).then(response => {
+        console.log("response",response);
+         this.ruleForm = response.data;
+          if(response.data.imgFileList==null){
+            this.ruleForm.imgFileList=[];
+          }
+          if(response.data.stationId==null){
+            this.ruleForm.stationId=this.$store.state.user.deptId;
+          }
+        
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["ruleForm"].validate(valid => {
+        if (valid) {
+          if (this.ruleForm.payId != null) {
+            updatePay(this.ruleForm).then(response => {
+              this.msgSuccess("修改成功");
+              this.look();
+            });
+          } else {
+            addPay(this.ruleForm).then(response => {
+              this.msgSuccess("添加成功");
+              this.look();
+            });
+          }
+        }
+      });  
+    }
+  }
+};
+</script>
+<style lang="scss">
+.uploader-hidden{
+  .el-upload--picture-card{
+    display:none;
+  }
+}
+
+</style>

+ 1 - 1
src/views/station/configuration/index.vue

@@ -12,7 +12,7 @@
 </template>
 <script>
   import tabZujianChild1 from './info.vue'
-  import tabZujianChild2 from '../pay/index.vue'
+  import tabZujianChild2 from './applet.vue'
   import tabZujianChild3 from '../manage/index.vue'
   export default {
     name: 'configuration',

+ 176 - 103
src/views/station/equipment.vue

@@ -12,19 +12,15 @@
           clearable
           placeholder="请选择"
         >
-          <el-option
-            v-for="dict in deviceTypeOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          ></el-option>
+          <el-option label="小票打印机" value="1"></el-option>
+          <el-option label="POS" value="2"></el-option>
         </el-select>
       </el-form-item>
 
-      <el-form-item label="设备序列号" prop="deviceSerialNum">
+      <el-form-item label="密钥" prop="deviceSerialNum">
         <el-input
           v-model="queryForm.deviceSerialNum"
-          placeholder="请输入设备序列号"
+          placeholder="请输入设备密钥"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
@@ -57,44 +53,47 @@
     </el-form>
 
     <el-table :data="equipmentList">
-      <el-table-column
+      <af-table-column
         label="主键自增id"
         v-if="false"
         align="center"
         prop="deviceId"
       />
-      <el-table-column
+      <af-table-column
         label="油站名称"
         align="center"
         prop="stationName"
-        v-if="jiBie === 3"
+        v-if="jiBie !== 2"
       />
-      <el-table-column
-        label="设备编号"
-        align="center"
-        prop="deviceNo"
-      />
-      <el-table-column
-        label="设备序列号"
-        align="center"
-        prop="deviceSerialNum"
-      />
-
-      <el-table-column label="设备厂家" align="center" prop="deviceFactory" />
-      <el-table-column label="绑定油枪号" align="center" prop="gunNo" />
-      <el-table-column
-        label="启动状态"
-        align="center"
-        prop="deviceStatus"
-      >
+      <af-table-column label="设备类型" align="center" prop="deviceType">
+        <template slot-scope="scope">
+          {{
+            scope.row.deviceType == "1"
+              ? "小票打印机"
+              : scope.row.deviceType == "2"
+              ? "POS"
+              : "不明设备"
+          }}
+        </template>
+      </af-table-column>
+      <af-table-column label="设备编号" align="center" prop="deviceNo" />
+      <af-table-column label="设备密钥" align="center" prop="deviceSerialNum">
+        <template slot-scope="scope">
+          {{ scope.row.deviceType == "1" ? scope.row.deviceSerialNum : "无" }}
+        </template>
+      </af-table-column>
+      <af-table-column label="绑定油枪号" align="center" prop="gunNo" />
+      <af-table-column label="设备厂家" align="center" prop="deviceFactory" />
+      <af-table-column label="启动状态" align="center" prop="deviceStatus">
         <template slot-scope="scope">
-          {{scope.row.deviceStatus == "1" ? "开启":"关闭"}}
+          {{ scope.row.deviceStatus == "1" ? "开启" : "关闭" }}
         </template>
-      </el-table-column>
-      <el-table-column
+      </af-table-column>
+      <af-table-column
         label="操作"
         align="center"
         class-name="small-padding fixed-width"
+        width="120px"
       >
         <template slot-scope="scope">
           <el-button
@@ -112,7 +111,7 @@
             >删除</el-button
           >
         </template>
-      </el-table-column>
+      </af-table-column>
     </el-table>
 
     <pagination
@@ -138,48 +137,78 @@
         :rules="rules"
         label-width="100px"
       >
+        <el-form-item label="设备类型" prop="deviceType">
+          <el-select
+            v-model="dialogForm.deviceType"
+            placeholder="请选择设备类型"
+            clearable
+            size="small"
+          >
+            <el-option label="小票打印机" value="1"></el-option>
+            <el-option label="POS" value="2"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="设备名称" prop="deviceName">
+          <el-input
+            v-model="dialogForm.deviceName"
+            placeholder="请输入设备名称"
+          />
+        </el-form-item>
         <el-form-item label="设备编号" prop="deviceNo">
           <el-input
             v-model="dialogForm.deviceNo"
             placeholder="请输入设备编号"
+            @input="deviceNoInput"
           />
         </el-form-item>
-        <el-form-item label="设备名称" prop="deviceName">
+        <el-form-item
+          label="密钥"
+          prop="deviceSerialNum"
+          :required="dialogForm.deviceType == 1"
+          v-show="dialogForm.deviceType == 1"
+        >
           <el-input
-            v-model="dialogForm.deviceName"
-            placeholder="请输入设备名称"
+            v-model="dialogForm.deviceSerialNum"
+            placeholder="请输入设备密钥"
           />
         </el-form-item>
-        <el-form-item label="设备序列号" prop="deviceSerialNum">
+        <el-form-item
+          label="交换机名"
+          prop="posFanoutExchange"
+          :required="dialogForm.deviceType == 2"
+          v-show="false"
+        >
           <el-input
-            v-model="dialogForm.deviceSerialNum"
-            placeholder="请输入设备序列号"
+            v-model="dialogForm.posFanoutExchange"
+            placeholder="请输入交换机名"
           />
         </el-form-item>
-        <el-form-item label="设备类型" prop="deviceType">
-          <el-select
-            v-model="dialogForm.deviceType"
-            placeholder="请选择设备类型"
-            clearable
-            size="small"
-          >
-            <el-option
-              v-for="dict in deviceTypeOptions"
-              :key="dict.dictValue"
-              :label="dict.dictLabel"
-              :value="dict.dictValue"
-            ></el-option>
-          </el-select>
+        <el-form-item
+          label="队列名"
+          prop="posQueue"
+          :required="dialogForm.deviceType==2"
+          v-show="false"
+        >
+          <el-input v-model="dialogForm.posQueue" placeholder="请输入队列名" />
         </el-form-item>
-
         <el-form-item label="绑定油枪号" prop="checkedGunList" required>
           <template v-if="allGunList.length === 0">
             请先在油枪管理里配置油枪
           </template>
           <template v-else>
-            <el-checkbox-group v-model="dialogForm.checkedGunList">
+            <el-checkbox-group v-model="dialogForm.checkedGunList" v-if="dialogForm.deviceType == 2">
+              <el-checkbox
+                v-for="item in posList"
+                :key="item.oilGunId"
+                :label="item.oilGunNo"
+                :value="item.oilGunNo"
+              >
+                {{ item.oilGunNo + "号枪/" + item.oilName }}
+              </el-checkbox>
+            </el-checkbox-group>
+            <el-checkbox-group v-model="dialogForm.checkedGunList" v-if="dialogForm.deviceType == 1">
               <el-checkbox
-                v-for="item in allGunList"
+                v-for="item in printList"
                 :key="item.oilGunId"
                 :label="item.oilGunNo"
                 :value="item.oilGunNo"
@@ -196,12 +225,8 @@
             size="small"
             placeholder="请选择"
           >
-            <el-option
-              v-for="dict in deviceStatusOptions"
-              :key="dict.dictValue"
-              :label="dict.dictLabel"
-              :value="dict.dictValue"
-            ></el-option>
+            <el-option label="在用" value="1"></el-option>
+            <el-option label="停用" value="2"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="设备厂家" prop="deviceFactory">
@@ -265,14 +290,15 @@ export default {
         pageNum: 1,
         pageSize: 10, // 初始值只能比10大
         deviceNo: null,
-        stationId: this.deptId,
-        deviceType: null, // 设备类型 数据字典里取
-        deviceSerialNum: null, // 设备序列号
+        deviceSerialNum: null, // 设备密钥
       },
       // 弹窗表单参数
       dialogForm: {
-        checkedGunList:[]
+        checkedGunList: [],
+        deviceStatus: "1",
+        deviceType: "1",
       },
+      currentList: [],
       // 表单校验
       rules: {
         deviceNo: [
@@ -281,15 +307,13 @@ export default {
         deviceName: [
           { required: true, message: "请输入设备名", trigger: "blur" },
         ],
-        deviceSerialNum: [
-          { required: true, message: "请输入设备序列号", trigger: "blur" },
-        ],
+        // deviceSerialNum: [
+        //   { required: true, message: "请输入设备密钥", trigger: "blur" },
+        // ],
         deviceType: [
           { required: true, message: "请选择设备类型", trigger: "blur" },
         ],
-        checkedGunList: [
-          { validator: validateGunNo, trigger: 'change' }
-        ],
+        checkedGunList: [{ validator: validateGunNo, trigger: "change" }],
         deviceStatus: [
           { required: true, message: "请选择设备状态", trigger: "blur" },
         ],
@@ -300,9 +324,60 @@ export default {
     };
   },
   created() {
+    console.log(this.deptId);
     this.getList();
     this.init();
   },
+  computed: {
+    posList() {
+      const temp = this.allGunList.filter((item) => {
+        let flag = false;
+        this.equipmentList.map((ele) => {
+          if (ele.deviceType == 2) {
+            if (ele.gunNo.split(",").includes(item.oilGunNo)) {
+              flag = true;
+              return;
+            }
+          }
+        });
+        return flag;
+      });
+      const temp2 = this.allGunList.filter((item) => {
+        let flag = true;
+        temp.map((ele) => {
+          if (item.oilGunNo == ele.oilGunNo) {
+            flag = false;
+          }
+        });
+        return flag;
+      });
+      return this.currentList.concat(temp2)
+    },
+    printList() {
+      const temp = this.allGunList.filter((item) => {
+        let flag = false;
+        this.equipmentList.map((ele) => {
+          if (ele.deviceType == 1) {
+            if (ele.gunNo.split(",").includes(item.oilGunNo)) {
+              flag = true;
+              return;
+            }
+          }
+        });
+        return flag;
+      });
+      const temp2 = this.allGunList.filter((item) => {
+        let flag = true;
+        temp.map((ele) => {
+          if (item.oilGunNo == ele.oilGunNo) {
+            flag = false;
+          }
+        });
+        return flag;
+      });
+      return this.currentList.concat(temp2)
+    },
+  },
   methods: {
     init() {
       //字典设备状态
@@ -313,28 +388,33 @@ export default {
       this.getDicts("device_type").then((response) => {
         this.deviceTypeOptions = response.data;
       });
+      listGun({
+        stationId: this.deptId,
+      }).then((response) => {
+        this.allGunList = response.rows;
+        console.log(this.allGunList);
+      });
     },
     /** 查询油站设备管理列表 首页表单 */
     getList() {
       listManage(this.queryForm).then((response) => {
         this.equipmentList = response.rows;
+        console.log("this.equipmentList", this.equipmentList);
         this.total = response.total;
       });
     },
     // 取消按钮
     cancel() {
       this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.dialogForm = {};
     },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryForm.pageNum = 1;
       this.getList();
     },
+    deviceNoInput(value) {
+      this.dialogForm.posQueue = value;
+    },
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
@@ -342,37 +422,30 @@ export default {
     },
     /** 新增按钮操作 */
     handleAdd() {
-      if (this.jiBie === 2) {
-        this.title = "添加油站设备管理";
-        this.open = true;
-        listGun({
-          stationId: this.deptId,
-        }).then((response) => {
-          this.allGunList = response.rows;
-        });
-      } else {
-        this.msgSuccess("请登录对应的账号");
-      }
+      this.currentList = [];
+      this.title = "添加油站设备管理";
+      this.dialogForm = {
+        checkedGunList: [],
+        deviceStatus: "1",
+        deviceType: "1",
+        posFanoutExchange: "posFanoutExchange" + this.deptId,
+      };
+      this.open = true;
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      let checkedGunList
-      if (
-        Object.prototype.toString.call(row.gunNo) ===
-        "[object String]"
-      ) {
+      this.currentList = this.allGunList.filter((ele)=>{
+        return row.gunNo.split(",").includes(ele.oilGunNo)
+      })
+      let checkedGunList;
+      if (Object.prototype.toString.call(row.gunNo) === "[object String]") {
         checkedGunList = [...new Set(row.gunNo.split(","))].filter((ele) => {
           return ele.toString().trim() !== "";
-        }); 
-      }else{
-        checkedGunList = []
+        });
+      } else {
+        checkedGunList = [];
       }
-      this.dialogForm={...row, checkedGunList}
-      listGun({
-        stationId: this.deptId,
-      }).then((response) => {
-        this.allGunList = response.rows;
-      });
+      this.dialogForm = { ...row, checkedGunList };
       this.title = "修改油站设备管理";
       this.open = true;
     },
@@ -381,7 +454,7 @@ export default {
     submitForm() {
       this.$refs["dialogForm"].validate((valid) => {
         if (valid) {
-          this.dialogForm.gunNo = this.dialogForm.checkedGunList.toString()
+          this.dialogForm.gunNo = this.dialogForm.checkedGunList.toString();
           if (this.dialogForm.deviceId != null) {
             updateManage(this.dialogForm).then((response) => {
               this.msgSuccess("修改成功");