Переглянути джерело

新增黑名单管理与部分分页测试问题

pm 10 місяців тому
батько
коміт
542d54af96

+ 2 - 0
public/index.html

@@ -2,9 +2,11 @@
 <html>
   <head>
     <meta charset="utf-8">
+
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta name="renderer" content="webkit">
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+
     <link rel="icon" href="favicon.ico">
     <link rel="stylesheet" type="text/css" media="print" href="<%= BASE_URL %>print-lock.css">
     <title><%= webpackConfig.name %></title>

+ 4 - 2
src/api/login.js

@@ -8,10 +8,12 @@ export function login(username, password, code, uuid) {
     code,
     uuid
   }
+  // /login
   return request({
     url: '/login',
     headers: {
-      isToken: false
+      isToken: false,
+
     },
     method: 'post',
     data: data
@@ -56,4 +58,4 @@ export function getCodeImg() {
     method: 'get',
     timeout: 20000
   })
-}
+}

+ 54 - 0
src/api/mes/blacklist/index.js

@@ -0,0 +1,54 @@
+import request from '@/utils/request'
+
+// 查询黑名单列表
+export function listBlacklist(query) {
+  return request({
+    url: '/iscs/blacklist/getIsBlacklistPage',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询黑名单详细
+export function getBlacklistInfo(deptId) {
+  return request({
+    url: '/iscs/blacklist/selectIsBlacklistById?recordId=' + deptId,
+    method: 'get'
+  })
+}
+
+
+// 新增黑名单
+export function addBlacklist(data) {
+  return request({
+    url: '/iscs/blacklist/insertIsBlacklist',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改黑名单
+export function updateBlacklist(data) {
+  return request({
+    url: '/iscs/blacklist/updateIsBlacklist',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除黑名单
+export function delBlacklist(deptId) {
+  return request({
+    url: '/iscs/blacklist/deleteIsBlacklistByRecordIds?recordIds=' + deptId,
+    method: 'post'
+  })
+}
+// 白名单列表
+export function listWhitelist(query) {
+  return request({
+    url: '/iscs/blacklist/getWhiteUserPage',
+    method: 'get',
+    params: query
+  })
+}

+ 1 - 1
src/components/ImageUpload/index.vue

@@ -61,7 +61,7 @@ export default {
     // 文件类型, 例如['png', 'jpg', 'jpeg']
     fileType: {
       type: Array,
-      default: () => ["png", "jpg", "jpeg"],
+      default: () => ["png", "jpg", "jpeg",'mp4'],
     },
     // 是否显示提示
     isShowTip: {

+ 2 - 0
src/main.js

@@ -69,6 +69,8 @@ Vue.component('FileUpload', FileUpload)
 Vue.component('ImageUpload', ImageUpload)
 Vue.component('ImageUploadSingle', ImageUploadSingle)
 Vue.component('ImagePreview', ImagePreview)
+
+
 // 解决el-radio报错
 Vue.directive('removeAriaHidden', {
   bind(el, binding) {

+ 1 - 0
src/router/index.js

@@ -157,6 +157,7 @@ export const dynamicRoutes = [
         meta: { title: '作业管理-新建作业票', activeMenu: '/mes/job/jobm/NewMarsJob' }
 
       },
+
       {
         path: 'NewOperationsEdit',
         component: () => import('@/views/mes/job/jobm/NewOperations'),

+ 58 - 47
src/utils/request.js

@@ -3,24 +3,28 @@ import { Notification, MessageBox, Message, Loading } from 'element-ui'
 import store from '@/store'
 import { getToken } from '@/utils/auth'
 import errorCode from '@/utils/errorCode'
-import { tansParams, blobValidate } from "@/utils/ruoyi";
+import { tansParams, blobValidate } from '@/utils/ruoyi'
 import cache from '@/plugins/cache'
 import { saveAs } from 'file-saver'
 
-let downloadLoadingInstance;
+let downloadLoadingInstance
 // 是否显示重新登录
-export let isRelogin = { show: false };
+export let isRelogin = { show: false }
 
 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 // 创建axios实例
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
   baseURL: process.env.VUE_APP_BASE_API,
+  headers: {
+    'module': 'iphone'
+  },
   // 超时
   timeout: 30000
 })
 
 // request拦截器
+
 service.interceptors.request.use(config => {
   // 是否需要设置 token
   const isToken = (config.headers || {}).isToken === false
@@ -28,13 +32,14 @@ service.interceptors.request.use(config => {
   const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
   if (getToken() && !isToken) {
     config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
+
   }
   // get请求映射params参数
   if (config.method === 'get' && config.params) {
-    let url = config.url + '?' + tansParams(config.params);
-    url = url.slice(0, -1);
-    config.params = {};
-    config.url = url;
+    let url = config.url + '?' + tansParams(config.params)
+    url = url.slice(0, -1)
+    config.params = {}
+    config.url = url
   }
   if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
     const requestObj = {
@@ -46,12 +51,12 @@ service.interceptors.request.use(config => {
     if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
       cache.session.setJSON('sessionObj', requestObj)
     } else {
-      const s_url = sessionObj.url;                  // 请求地址
-      const s_data = sessionObj.data;                // 请求数据
-      const s_time = sessionObj.time;                // 请求时间
-      const interval = 1000;                         // 间隔时间(ms),小于此时间视为重复提交
+      const s_url = sessionObj.url                  // 请求地址
+      const s_data = sessionObj.data                // 请求数据
+      const s_time = sessionObj.time                // 请求时间
+      const interval = 1000                         // 间隔时间(ms),小于此时间视为重复提交
       if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
-        const message = '数据正在处理,请勿重复提交';
+        const message = '数据正在处理,请勿重复提交'
         console.warn(`[${s_url}]: ` + message)
         return Promise.reject(new Error(message))
       } else {
@@ -61,37 +66,39 @@ service.interceptors.request.use(config => {
   }
   return config
 }, error => {
-    console.log(error)
-    Promise.reject(error)
+  console.log(error)
+  Promise.reject(error)
 })
 
 // 响应拦截器
 service.interceptors.response.use(res => {
     // 未设置状态码则默认成功状态
-    const code = res.data.code || 200;
+    const code = res.data.code || 200
+    // var userAgent = navigator.userAgent;
+    // console.log(userAgent,'userAgent');
     // 获取错误信息
     const msg = errorCode[code] || res.data.msg || errorCode['default']
     // 二进制数据则直接返回
-    if(res.request.responseType ===  'blob' || res.request.responseType ===  'arraybuffer'){
+    if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
       return res.data
     }
     if (code === 401) {
       if (!isRelogin.show) {
-        isRelogin.show = true;
+        isRelogin.show = true
         MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
-          confirmButtonText: '重新登录',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }
-      ).then(() => {
-        isRelogin.show = false;
-        store.dispatch('LogOut').then(() => {
-          location.href = '/index';
+            confirmButtonText: '重新登录',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }
+        ).then(() => {
+          isRelogin.show = false
+          store.dispatch('LogOut').then(() => {
+            location.href = '/index'
+          })
+        }).catch(() => {
+          isRelogin.show = false
         })
-      }).catch(() => {
-        isRelogin.show = false;
-      });
-    }
+      }
       return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
     } else if (code === 500) {
       Message({
@@ -110,15 +117,13 @@ service.interceptors.response.use(res => {
   },
   error => {
     console.log('err' + error)
-    let { message } = error;
-    if (message == "Network Error") {
-      message = "后端接口连接异常";
-    }
-    else if (message.includes("timeout")) {
-      message = "系统接口请求超时";
-    }
-    else if (message.includes("Request failed with status code")) {
-      message = "系统接口" + message.substr(message.length - 3) + "异常";
+    let { message } = error
+    if (message == 'Network Error') {
+      message = '后端接口连接异常'
+    } else if (message.includes('timeout')) {
+      message = '系统接口请求超时'
+    } else if (message.includes('Request failed with status code')) {
+      message = '系统接口' + message.substr(message.length - 3) + '异常'
     }
     Message({
       message: message,
@@ -131,27 +136,33 @@ service.interceptors.response.use(res => {
 
 // 通用下载方法
 export function download(url, params, filename) {
-  downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
+  downloadLoadingInstance = Loading.service({
+    text: '正在下载数据,请稍候',
+    spinner: 'el-icon-loading',
+    background: 'rgba(0, 0, 0, 0.7)'
+  })
   return service.post(url, params, {
-    transformRequest: [(params) => { return tansParams(params) }],
+    transformRequest: [(params) => {
+      return tansParams(params)
+    }],
     headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
     responseType: 'blob'
-  }).then(async (data) => {
-    const isLogin = await blobValidate(data);
+  }).then(async(data) => {
+    const isLogin = await blobValidate(data)
     if (isLogin) {
       const blob = new Blob([data])
       saveAs(blob, filename)
     } else {
-      const resText = await data.text();
-      const rspObj = JSON.parse(resText);
+      const resText = await data.text()
+      const rspObj = JSON.parse(resText)
       const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
-      Message.error(errMsg);
+      Message.error(errMsg)
     }
-    downloadLoadingInstance.close();
+    downloadLoadingInstance.close()
   }).catch((r) => {
     console.error(r)
     Message.error('下载文件出现错误,请联系管理员!')
-    downloadLoadingInstance.close();
+    downloadLoadingInstance.close()
   })
 }
 

+ 465 - 0
src/views/mes/blacklist/index.vue

@@ -0,0 +1,465 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="100px"
+    >
+      <el-row>
+        <el-form-item label="工号" prop="userName">
+          <el-input
+            v-model="queryParams.userName"
+            placeholder="请输入工号"
+            clearable
+            @lotoup.enter.native="handleQuery"
+          />
+        </el-form-item>
+        <el-form-item label="姓名" prop="nickName">
+          <el-input
+            v-model="queryParams.nickName"
+            placeholder="请输入姓名"
+            clearable
+            @lotoup.enter.native="handleQuery"
+          />
+        </el-form-item>
+
+        <el-form-item style="margin-left: 20px">
+          <el-button v-no-more-click
+                     type="primary"
+                     icon="el-icon-search"
+                     size="mini"
+                     @click="handleQuery"
+          >搜索
+          </el-button>
+          <el-button v-no-more-click icon="el-icon-refresh" size="mini" @click="resetQuery"
+          >重置
+          </el-button>
+        </el-form-item>
+      </el-row>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button v-no-more-click
+                   type="primary"
+                   plain
+                   icon="el-icon-plus"
+                   size="mini"
+                   @click="handleAdd"
+                   v-hasPermi="['iscs:blacklist:add']"
+        >新增
+        </el-button>
+      </el-col>
+
+      <el-col :span="1.5">
+        <el-button v-no-more-click
+                   type="danger"
+                   plain
+                   icon="el-icon-delete"
+                   size="mini"
+                   :disabled="multiple"
+                   @click="handleDelete"
+                   v-hasPermi="['iscs:blacklist:remove']"
+        >批量删除
+        </el-button>
+      </el-col>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
+    </el-row>
+
+    <el-table
+      v-loading="loading"
+      :data="repairList"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column
+        label="用户编号"
+        width="180px"
+        align="center"
+        prop="userId"
+      />
+      <el-table-column
+        label="工号"
+        align="center"
+        prop="userName"
+      />
+      <el-table-column
+        label="姓名"
+        align="center"
+        prop="nickName"
+      />
+      <el-table-column
+        label="创建时间"
+        align="center"
+        prop="createTime"
+      />
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button v-no-more-click
+                     size="mini"
+                     type="text"
+                     icon="el-icon-delete"
+                     @click="handleDelete(scope.row)"
+                     v-hasPermi="['iscs:blacklist:remove']"
+          >删除
+          </el-button>
+
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.current"
+      :limit.sync="queryParams.size"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改设备维修单对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
+      <div>
+        <el-row :gutter="20">
+          <el-col :span="10">
+            <!-- 穿梭框左边 -->
+            <el-input v-model="searchQueryLeft" placeholder="请输入姓名" @input="searchQueryLeftInput" style="margin-bottom: 5px"></el-input>
+            <el-table
+              ref="multipleTable"
+              :data="tableData1"
+              height="500"
+              tooltip-effect="dark"
+              style="width: 100%"
+              @select="checkLeft"
+              @select-all="checkAll"
+              class="el-table-dialog"
+              row-key="id"
+            >
+              <el-table-column
+                type="selection"
+                width="55"
+                align="center"
+              ></el-table-column>
+              <el-table-column label="用户编号" align="center">
+                <template slot-scope="{ row }">
+                  <span>{{ row.userId }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="姓名" align="center">
+                <template slot-scope="{ row }">
+                  <span>{{ row.nickName }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="登录名" align="center">
+                <template slot-scope="{ row }">
+                  <span>{{ row.userName }}</span>
+                </template>
+              </el-table-column>
+            </el-table>
+            <pagination v-show="totalLeft>0" :total="totalLeft" :page.sync="currentLeft" :limit.sync="sizeLeft" @pagination="getOtherList"/>
+          </el-col>
+          <el-col :span="4" class="el-btn-dialog">
+            <el-button
+              @click="right"
+              type="primary"
+              :disabled="nowSelectData.length ? false : true"
+              icon="el-icon-arrow-right"
+            >加入右侧</el-button
+            >
+            <el-button
+              @click="left"
+              type="primary"
+              :disabled="nowSelectRightData.length ? false : true"
+              icon="el-icon-arrow-left"
+              style="margin-left: 0;margin-top: 10px;"
+            >加入左侧</el-button
+            >
+          </el-col>
+          <el-col :span="10">
+            <!-- 穿梭框右边 -->
+            <el-table
+              ref="multipleTable"
+              :data="tableData2"
+              height="500"
+              tooltip-effect="dark"
+              style="width: 100%"
+              @select="checkRight"
+              @select-all="checkRightAll"
+              row-key="id"
+              class="el-table-dialog"
+            >
+              <el-table-column
+                type="selection"
+                width="55"
+                align="center"
+              ></el-table-column>
+              <el-table-column label="用户编号" align="center">
+                <template slot-scope="{ row }">
+                  <span>{{ row.userId }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="类型" align="center">
+                <template slot-scope="{ row }">
+                  <span>{{ row.nickName }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="登录名" align="center">
+                <template slot-scope="{ row }">
+                  <span>{{ row.userName }}</span>
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-col>
+        </el-row>
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button v-no-more-click type="primary" @click="submitForm">确 定</el-button>
+        <el-button v-no-more-click @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listBlacklist, addBlacklist, delBlacklist,listWhitelist } from '@/api/mes/blacklist/index'
+export default {
+  name: 'lock',
+  dicts: ['hardware_status'],
+  data() {
+    return {
+      autoGenFlag: false,
+      optType: undefined,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 设备维修单表格数据
+      repairList: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      createTime: '',
+      queryParams: {
+        current: 1,
+        size: 10,
+        nickName: undefined,
+        userName: undefined,
+      },
+      // 表单参数
+      form: {},
+      // 日期选择
+      tableData1: [],
+      tableData2: [],
+      nowSelectData: [], // 左边选中列表数据
+      nowSelectRightData: [], // 右边选中列表数据
+      searchQueryLeft:'',//左边查询
+      searchQueryRight:'',//右边查询
+      currentLeft: 1,
+      sizeLeft: 10,
+      totalLeft:0
+    }
+  },
+
+  created() {
+    this.getList()
+    this.getOtherList()
+  },
+  methods: {
+    /** 查询设备维修单列表 */
+    getList() {
+      this.loading = true
+      // 锁定站数据
+      listBlacklist(this.queryParams).then((response) => {
+        console.log(response, '锁定站')
+        this.repairList = response.data.records
+        this.total = response.data.total
+        this.loading = false
+      })
+    },
+    getOtherList() {
+      const data = {
+        ...this.queryParams,
+        current: this.currentLeft,
+        size: this.sizeLeft,
+      }
+      listWhitelist(data).then((respone) => {
+        console.log(respone,'白名单')
+        this.tableData1 = respone.data.records
+        this.totalLeft = respone.data.total
+      })
+    },
+
+    searchQueryLeftInput(value){
+      console.log(value,'查询的接口')
+      this.queryParams.nickName = value
+      this.getOtherList()
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        nickName: null,
+        userId: null,
+      }
+
+      this.autoGenFlag = false
+      this.resetForm('form')
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.current = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams.nickName = ''
+      this.queryParams.userId = ''
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.recordId)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.tableData2=[]
+      this.tableData1=[]
+      this.reset()
+      this.getOtherList()
+      this.open = true
+      this.title = '新增黑名单'
+    },
+
+    /** 提交按钮 */
+    submitForm() {
+      const data=this.tableData2.map((item) => {
+        return {
+          userId: item.userId,
+          module:'2'
+        }
+      })
+
+      addBlacklist(data).then((response) => {
+        this.$modal.msgSuccess('新增成功')
+        this.open = false
+        this.getList()
+      })
+    },
+    // -------穿梭框功能的方法
+    // 左边全选事件
+    checkAll(row) {
+      this.nowSelectData = row;
+    },
+    // 右边全选事件
+    checkRightAll(row) {
+      this.nowSelectRightData = row;
+    },
+    // 左边选中事件
+    checkLeft(row) {
+      this.nowSelectData = row;
+    },
+    // 右边选中事件
+    checkRight(row) {
+      this.nowSelectRightData = row;
+    },
+    // 点击去右边
+    right() {
+      this.tableData2 = this.tableData2.concat(this.nowSelectData);
+      this.handleRemoveTabList(this.nowSelectData, this.tableData1);
+      // 按钮禁用
+      this.nowSelectData = [];
+    },
+    // 点击去左边
+    left() {
+      this.tableData1 = this.tableData1.concat(this.nowSelectRightData);
+      this.handleRemoveTabList(this.nowSelectRightData, this.tableData2);
+      // 按钮禁用
+      this.nowSelectRightData = [];
+    },
+    // 方法
+    handleRemoveTabList(isNeedArr, originalArr) {
+      if (isNeedArr.length && originalArr.length) {
+        for (let i = 0; i < isNeedArr.length; i++) {
+          for (let k = 0; k < originalArr.length; k++) {
+            // 注意,nickName为唯一值,如果不为唯一值那么会出错
+            if (isNeedArr[i]["nickName"] === originalArr[k]["nickName"]) {
+              console.log("-----------1111");
+              originalArr.splice(k, 1);
+            }
+          }
+        }
+      }
+    },
+    // -------穿梭框功能的方法结束
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const repairIds = row.recordId || this.ids
+      this.$modal
+        .confirm('是否确认的数据项?')
+        .then(function() {
+          return delBlacklist(repairIds)
+        })
+        .then(() => {
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {
+        })
+    }
+  },
+
+
+}
+
+</script>
+<style scoped lang="scss">
+::v-deep .el-table-dialog {
+  border: 1px solid #e8e6e6;
+  thead {
+    // color: black;
+    th {
+      background-color: #f4f4f4;
+      .cell {
+        font-weight: bold;
+      }
+    }
+    th:last-child {
+      text-align: center;
+    }
+  }
+}
+.imgstatus {
+  position: relative;
+  top: 1px;
+  left: 0px;
+}
+
+
+</style>

+ 5 - 7
src/views/mes/hw/lotoStation/index.vue

@@ -163,7 +163,7 @@
     <pagination
       v-show="total > 0"
       :total="total"
-      :page.sync="queryParams.pages"
+      :page.sync="queryParams.current"
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
@@ -265,7 +265,7 @@ export default {
       // 查询参数
       createTime: "",
       queryParams: {
-        pages: 1,
+        current: 1,
         size: 10,
         lotoCode: null,
         lotoName: null,
@@ -348,8 +348,6 @@ export default {
         this.total = response.data.total;
         this.loading = false;
       });
-
-
     },
     getOtherList(){
       const data={
@@ -402,8 +400,9 @@ export default {
     reset() {
       this.form = {
         lotoName: null,
-        lotoCode: null,
-
+        workstationId: null,
+        orderNum: null,
+        map:null
       };
 
       this.autoGenFlag = false;
@@ -416,7 +415,6 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.queryParams.lotoCode = "";
       this.queryParams.lotoName = "";
       this.queryParams.lotoId = "";
       this.resetForm("queryForm");

+ 394 - 0
src/views/mes/job/jobm/LockDetail.vue

@@ -0,0 +1,394 @@
+<template>
+  <div class="mapdata">
+    <div id="container" ref="container" style="width:300px"></div>
+  </div>
+
+</template>
+
+<script>
+import Konva from 'konva'
+import { getLotoMapInfo, getLotoInfo } from '@/api/mes/lotoStation/lotoStation'
+import { getTechnologyInfo } from '@/api/system/machinery'
+export default {
+  name: 'KonvaExample',
+  props: {
+    machineryId: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      stage: null,
+      layer: null,
+      selectedStates: [], // 用于存储每个元素的选中状态
+      selectedText: [], // 用于存储未选中的元素文本
+      rects: [], // 白色r        ect合集
+      texts: [], // 白色text合集
+      redrects: [], // 红色rect合集
+      redtexts: [], // 白色text合集
+      value: '',
+      form: {},//拿到单个数据
+      orignData: null,//原始数据
+      pointIdList: [],//选中的隔离点
+      selectPoints: []//回显之前选中的隔离点
+    }
+  },
+  watch: {
+    "machineryId":{
+      handler(newValue){
+        if(newValue){
+          console.log(this.machineryId, 'Mapdata拿到的父组件machineryId')
+          this.getLoToInfo()
+        }
+      },
+      immediate: true
+    }
+  },
+  mounted() {
+    this.$nextTick(() => {
+      if(this.machineryId){
+        this.getLoToInfo()
+        const machineryId = this.machineryId
+        console.log(machineryId,'Mapdata拿到的父组件传递数据')
+      }
+    })
+  },
+
+  methods: {
+    getLoToInfo() {
+      const machineryId = this.machineryId
+      getTechnologyInfo(machineryId).then((response) => {
+        const lotoId = response.data.lotoId
+        const sopId = ''
+        const ticketId = ''
+        getLotoInfo(lotoId).then((response) => {
+          console.log(response, '电柜信息')
+          this.form = response.data
+        })
+        getLotoMapInfo(lotoId, sopId, ticketId).then(response => {
+          console.log(response, '电柜预览接口调用')
+          this.form.map = response.data
+
+          if (response.data) {
+            try {
+              this.value = JSON.stringify(response.data, null, 4)
+              this.orignData = this.value
+            } catch (err) {
+            }
+          }
+          this.initKonva()
+        })
+      });
+
+      //   设备工艺详情
+      getTechnologyInfo(this.machineryId).then(response => {
+        console.log(response, '设备/工艺详情')
+        this.selectPoints = response.data.pointIdList
+      })
+    },
+
+    // 校验字符串是否为有效的 JSON
+    isJson(str) {
+      try {
+        JSON.parse(str)
+        return true
+      } catch (e) {
+        return false
+      }
+    },
+    initKonva() {
+      // 创建舞台
+      this.stage = new Konva.Stage({
+        container: this.$refs.container, // 容器元素
+        width: 450,
+        height: 500
+      });
+
+      // 创建底图图层
+      this.bgLayer = new Konva.Layer();
+// // 绘制无限网格
+//       this.drawGrid(20, 20, '#e0e0e0'); // 每个单元格50x50,浅灰色网格
+      // 创建底图
+      const bgImage = new Image();
+      bgImage.src = require('@/assets/images/table.png');
+      bgImage.onload = () => {
+        const knovaImage = new Konva.Image({
+          x: 20,
+          y: -15,
+          image: bgImage,
+          width: 300,
+          height: 450,
+          draggable: false
+        });
+        this.bgLayer.add(knovaImage);
+        this.bgLayer.draw(); // 绘制底图图层
+      };
+
+      // 将底图图层添加到舞台
+      this.stage.add(this.bgLayer);
+
+      // 创建点位图层
+      this.layer = new Konva.Layer();
+
+      // 将点位图层添加到舞台
+      this.stage.add(this.layer);
+
+      // 禁止舞台拖拽
+      this.stage.draggable(false);
+
+      // 渲染数据
+      const imageSrc = require('@/assets/images/localSetIcon.jpg'); // 图片路径
+      this.renderGrid(imageSrc, 6, 3, 450, 100, 120, 100, 50, 50, 60, 25);
+    },
+
+    // 绘制无限网格
+    // drawGrid(cellWidth, cellHeight, gridColor) {
+    //   const width = 1200
+    //   const height = 860
+    //
+    //   // 绘制竖线
+    //   for (let i = 0; i <= width; i += cellWidth) {
+    //     const verticalLine = new Konva.Line({
+    //       points: [i, 0, i, height],
+    //       stroke: gridColor,
+    //       strokeWidth: 1
+    //     })
+    //     this.layer.add(verticalLine)
+    //   }
+    //
+    //   // 绘制横线
+    //   for (let j = 0; j <= height; j += cellHeight) {
+    //     const horizontalLine = new Konva.Line({
+    //       points: [0, j, width, j],
+    //       stroke: gridColor,
+    //       strokeWidth: 1
+    //     })
+    //     this.layer.add(horizontalLine)
+    //   }
+    //
+    //   this.layer.draw()
+    // },
+
+    renderGrid(imageSrc) {
+      this.selectedStates = [] // 用数组来存储选中状态
+      this.rects = {}
+      this.texts = {}
+      this.bgrects = {}
+      this.redrects = {}
+      this.redtexts = {}
+      this.selectedText = []
+      this.pointIdList = [] // 初始化选中的点ID列表
+
+      const positions = JSON.parse(this.value)
+
+      positions.forEach((pos, index) => {
+
+        let colOffset = 0;
+
+        // 计算当前元素在组中的位置
+        const groupSize = 3;
+        const groupIndex = Math.floor(index / groupSize);
+        const positionInGroup = index % groupSize;
+        //   每一行第二个和第三个增加col
+        if (positionInGroup === 1) {
+          colOffset = 3;
+        } else if (positionInGroup === 2) {
+          colOffset = 6;
+        }
+        // 根据索引调整行偏移量
+        if (groupIndex == 0) {
+          // 第一组(索引0,1,2)
+          pos.row += 0.1;
+
+        } else if (groupIndex == 1) {
+          // 第二组(索引3,4,5)
+          pos.row += 0.7;
+        } else if (groupIndex == 2) {
+          // 第三组及之后(索引6,7,8...)
+          pos.row += 1.3;
+        }else if (groupIndex == 3) {
+          // 第四组及之后(索引9,10,11...)
+          pos.row += 1.9;
+        }else{
+          pos.row += 2.2;
+        }
+
+        // console.log(pos.col,pos.row,'横纵坐标')
+        const x = (pos.col + colOffset) * 11;  // 每个单元格宽度为50
+        const y = pos.row * 25;                // 每个单元格高度为50             // 每个单元格高度为50
+        const labelText = pos.pointName // 对应的文字
+
+        const point = new Image()
+        point.src = pos.pointIcon
+        point.onload = () => {
+          const knovaImage = new Konva.Image({
+            x: x+1,
+            y: y+3,
+            image: point,
+            width: 35,
+            height: 35,
+            draggable: false
+          })
+
+
+          // 底部白色背景
+          const bgrect = new Konva.Rect({
+            x: x - 6,
+            y: y - 5,
+            width: 45,
+            height: 58,
+            cornerRadius: 5,
+            stroke: 'white',
+            strokeWidth: 2,
+            fill: 'white'
+          })
+          this.layer.add(bgrect)
+          this.bgrects[labelText] = bgrect // 用文字作为键存储
+
+          // 普通矩形
+          const rect = new Konva.Rect({
+            x: x-4,
+            y: y-2,
+            width: 42,
+            height: 54,
+            cornerRadius: 5,
+            stroke: 'red',
+            strokeWidth: 2,
+            fill: 'white'
+          })
+          this.layer.add(rect)
+          this.rects[labelText] = rect // 用文字作为键存储
+          // 先加底部白色 再添加图片
+          this.layer.add(knovaImage)
+
+
+          // 普通文字
+          const text = new Konva.Text({
+            x: x + 4,
+            y: y + 34,
+            fontSize: 14,
+            text: labelText,
+            fontFamily: 'Calibri',
+            fill: 'red'
+          })
+          this.layer.add(text)
+          this.texts[labelText] = text // 用文字作为键存储
+
+          // 覆盖层(表示选中状态)
+          const redrect = new Konva.Rect({
+            x: x - 6,
+            y: y - 4,
+            width: 45,
+            height: 58,
+            cornerRadius: 5,
+            fill: 'rgba(97, 97, 97, 0.5)', // 半透明灰色
+            visible: false, // 初始状态隐藏
+            listening: false
+          })
+          this.layer.add(redrect)
+          this.redrects[labelText] = redrect // 用文字作为键存储
+
+          // 创建对号文本
+          const redtext = new Konva.Text({
+            x: x - 2 + 26 / 2, // 水平居中
+            y: y + 38 / 2, // 垂直居中
+            fontSize: 13, // 根据需要调整字体大小
+            text: '✔',
+            fontFamily: 'Arial',
+            fill: 'white',
+            align: 'center',
+            verticalAlign: 'middle',
+            visible: false, // 初始隐藏状态
+            listening: false
+          })
+          this.layer.add(redtext)
+          this.redtexts[labelText] = redtext // 用文字作为键存储
+
+          // 检查 selectPoints 是否存在并且不为空
+          if (Array.isArray(this.selectPoints) && this.selectPoints.length > 0) {
+            if (this.selectPoints.includes(pos.pointId)) {
+              // 设置选中状态
+              this.redrects[labelText].visible(true)
+              this.redtexts[labelText].visible(true)
+              this.pointIdList.push(pos.pointId) // 添加ID
+            }
+          }
+
+          this.layer.draw()
+          // const positions = [{
+          //   row: 2,
+          //   col: 9,
+          //   pointId: '11',
+          //   pointName: 'E-11',
+          //   state: false,
+          //   pointIcon: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/11/27/point_20241127152959A071.png',
+          //   pointPicture: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/10/31/AB54CB1D-40BC-409d-BFFD-F55664CF3F01_20241031171608A034.png',
+          //
+          // }, {
+          //   row: 2,
+          //   col: 11,
+          //   pointId: '12',
+          //   pointName: 'E-12',
+          //   state: false,
+          //   pointIcon: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/11/27/point_20241127152952A070.png',
+          //   pointPicture: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/10/31/AB54CB1D-40BC-409d-BFFD-F55664CF3F01_20241031171627A036.png',
+          // }, {
+          //   row: 2,
+          //   col: 13,
+          //   pointId: '13',
+          //   pointName: 'E-13',
+          //   state: false,
+          //   pointIcon: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/11/27/point_20241127152946A069.png',
+          //   pointPicture: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/10/31/AB54CB1D-40BC-409d-BFFD-F55664CF3F01_20241031171651A038.png',
+          // },{
+          //   row: 4,
+          //   col: 9,
+          //   pointId: '7',
+          //   pointName: 'E-7',
+          //   state: true,
+          //   pointIcon: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/11/27/point_20241127152959A071.png',
+          //   pointPicture: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/10/31/AB54CB1D-40BC-409d-BFFD-F55664CF3F01_20241031171608A034.png',
+          //
+          // }, {
+          //   row: 4,
+          //   col: 11,
+          //   pointId: '8',
+          //   pointName: 'E-8',
+          //   state: true,
+          //   pointIcon: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/11/27/point_20241127152952A070.png',
+          //   pointPicture: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/10/31/AB54CB1D-40BC-409d-BFFD-F55664CF3F01_20241031171627A036.png',
+          // }, {
+          //   row: 4,
+          //   col: 13,
+          //   pointId: '9',
+          //   pointName: 'E-9',
+          //   state: true,
+          //   pointIcon: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/11/27/point_20241127152946A069.png',
+          //   pointPicture: 'http://36.133.174.236:9091/prod-api/profile/upload/2024/10/31/AB54CB1D-40BC-409d-BFFD-F55664CF3F01_20241031171651A038.png',
+          // }]
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+#container {
+  width: 100%;
+  height: 100%;
+}
+
+.mapdata {
+  width: 100%;
+  height: 100%;
+  display: flex;
+}
+
+.left {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+}
+</style>

+ 257 - 184
src/views/mes/job/jobm/NewMarsJob.vue

@@ -77,31 +77,30 @@
     >
       <h3 style="margin-left: 20px">{{ this.marsSopTitle }} SOP</h3>
       <span style="margin-left: 20px">选择 工艺/设备</span>
-<!--      :data="marsSopPage"-->
+      <!--      :data="marsSopPage"-->
       <el-table
         style="width: 50%; margin: 20px"
         :header-cell-style="{ background: '#004d8c', color: '#FFFFFF' }"
         :data="technologyList"
         highlight-current-row
         @current-change="handleSelectionChange"
-        >
-<!--        <el-table-column type="selection" width="55" align="center"/>-->
-
-<!--        <el-table-column-->
-<!--          label="sop名称"-->
-<!--          align="center"-->
-<!--          prop="sopName"-->
-<!--        ></el-table-column>-->
+      >
+        <!--        <el-table-column type="selection" width="55" align="center"/>-->
+        <!--        <el-table-column-->
+        <!--          label="sop名称"-->
+        <!--          align="center"-->
+        <!--          prop="sopName"-->
+        <!--        ></el-table-column>-->
         <el-table-column
           label="设备/工艺名称"
           align="center"
           prop="machineryName"
         ></el-table-column>
-<!--        <el-table-column-->
-<!--          label="所属岗位"-->
-<!--          align="center"-->
-<!--          prop="workstationName"-->
-<!--        ></el-table-column>-->
+        <!--        <el-table-column-->
+        <!--          label="所属岗位"-->
+        <!--          align="center"-->
+        <!--          prop="workstationName"-->
+        <!--        ></el-table-column>-->
       </el-table>
       <h2 style="margin-left: 20px">sop类型</h2>
       <el-radio-group
@@ -110,7 +109,7 @@
         style="display: flex; flex-direction: column; align-items: flex-start"
         @change="handleSopchange"
       >
-<!-- v-for="(option, index) in filteredSopTypes"-->
+        <!-- v-for="(option, index) in filteredSopTypes"-->
         <el-radio
           v-for="item in sopTypeOption"
           :key="item.value"
@@ -149,10 +148,15 @@
           <el-card class="box-card" style="margin: 10px">
             <div slot="header" class="clearfix">
               <span>锁定站信息</span>
+              <i class="el-icon-search" style="float: right; padding: 3px 0;cursor: pointer;color:#189eff;"
+                 @click="goLockDetail"
+              ></i>
             </div>
             <el-row>
               <el-col :span="9">
-                <el-table :data="selectPointList" :show-header="false">
+                <el-table :data="selectPointList" :show-header="false" height="200" @row-click="handleChangeTable"
+                          v-if="tableVisible"
+                >
                   <el-table-column
                     prop="pointName"
                     label=""
@@ -162,10 +166,13 @@
                     label=""
                   ></el-table-column>
                 </el-table>
+                <span v-if="!tableVisible" style="color:#53a3ef;cursor: pointer" @click="handleChangeTable"
+                >锁定站</span>
+                <img src="@/assets/images/sopbgimg.png" style="width: 200px;height: 130px;margin-top: 10px"/>
               </el-col>
               <el-col :span="8">
                 <MapData
-                  style="width: 300px; height: 320px; margin-left: 15%"
+                  style="width: 300px; height: 320px; margin-left: 18%"
                   :machineryId="this.machineryId"
                 ></MapData>
               </el-col>
@@ -357,20 +364,20 @@
                     }}</span>
                 </template>
               </el-table-column>
-<!--              <el-table-column label="操作" width="80">-->
-<!--                <template slot-scope="scope">-->
-<!--                  <el-button-->
-<!--                    v-no-more-click-->
-<!--                    @click.native.prevent="-->
-<!--                      deleteRow(scope.$index, AllUserTable)-->
-<!--                    "-->
-<!--                    type="text"-->
-<!--                    size="small"-->
-<!--                  >-->
-<!--                    移除-->
-<!--                  </el-button>-->
-<!--                </template>-->
-<!--              </el-table-column>-->
+              <!--              <el-table-column label="操作" width="80">-->
+              <!--                <template slot-scope="scope">-->
+              <!--                  <el-button-->
+              <!--                    v-no-more-click-->
+              <!--                    @click.native.prevent="-->
+              <!--                      deleteRow(scope.$index, AllUserTable)-->
+              <!--                    "-->
+              <!--                    type="text"-->
+              <!--                    size="small"-->
+              <!--                  >-->
+              <!--                    移除-->
+              <!--                  </el-button>-->
+              <!--                </template>-->
+              <!--              </el-table-column>-->
             </el-table>
           </el-col>
           <!--         内部共锁人-->
@@ -387,7 +394,7 @@
       color: 'white',
     }"
             >
-              <el-table-column type="selection" width="55" align="center" />
+              <el-table-column type="selection" width="55" align="center"/>
               <el-table-column prop="userId" label="内部人员Id"></el-table-column>
               <el-table-column prop="nickName" label="姓名">
                 <template slot-scope="scope">
@@ -422,7 +429,7 @@
       color: 'white',
     }"
             >
-              <el-table-column type="selection" width="55" align="center" />
+              <el-table-column type="selection" width="55" align="center"/>
               <el-table-column prop="userId" label="外部人员Id"></el-table-column>
               <el-table-column prop="nickName" label="姓名">
                 <template slot-scope="scope">
@@ -622,40 +629,94 @@
         <el-button v-no-more-click @click="cancel">关 闭</el-button>
       </div>
     </el-dialog>
-<!--    第八步查看影响作业票-->
-    <el-dialog :visible.sync="EightDetailvisible" title="受影响作业票" width="650px" append-to-body>
 
-            <el-table :data="AffectedTickets">
-              <el-table-column label="作业票编号" prop="ticketId"  >
-              </el-table-column>
-              <el-table-column label="作业票名称" prop="ticketName" width="220" >
-              </el-table-column>
+    <!--    第八步查看影响作业票-->
+    <el-dialog :visible.sync="EightDetailvisible" title="受影响作业票" width="650px" append-to-body>
 
-              <el-table-column label="作业票状态" prop="ticketStatus">
-                <template slot-scope="scope">
-                  <dict-tag
-                    :options="dict.type.ticket_status"
-                    :value="scope.row.ticketStatus"
-                  />
-                </template>
-              </el-table-column>
-              <el-table-column
-                label="作业票类型"
-                prop="ticketType"
-              >
-                <template slot-scope="scope">
-                  <dict-tag
-                    :options="dict.type.sop_type"
-                    :value="scope.row.ticketType"
-                  />
-                </template>
-              </el-table-column>
-            </el-table>
+      <el-table :data="AffectedTickets">
+        <el-table-column label="作业票编号" prop="ticketId">
+        </el-table-column>
+        <el-table-column label="作业票名称" prop="ticketName" width="220">
+        </el-table-column>
+
+        <el-table-column label="作业票状态" prop="ticketStatus">
+          <template slot-scope="scope">
+            <dict-tag
+              :options="dict.type.ticket_status"
+              :value="scope.row.ticketStatus"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="作业票类型"
+          prop="ticketType"
+        >
+          <template slot-scope="scope">
+            <dict-tag
+              :options="dict.type.sop_type"
+              :value="scope.row.ticketType"
+            />
+          </template>
+        </el-table-column>
+      </el-table>
 
       <div slot="footer" class="dialog-footer">
         <el-button v-no-more-click @click="cancel">关 闭</el-button>
       </div>
     </el-dialog>
+
+    <!--    锁定站放大按钮呈现diaolog-->
+    <el-dialog :visible.sync="LockDetailvisible" title="锁定站信息" height="500px" width="1200px" append-to-body>
+<!--      这里为了没有地图数据而设置的-->
+<!--      <el-row>-->
+<!--        <el-col :span="8">-->
+<!--          <div style="padding: 10px">-->
+<!--            <el-table :data="selectPointList" :show-header="false" style="width: 200px;height: 175px;margin-left: 15%">-->
+<!--              <el-table-column-->
+<!--                prop="pointName"-->
+<!--                label=""-->
+<!--              ></el-table-column>-->
+<!--              <el-table-column-->
+<!--                prop="remark"-->
+<!--                label=""-->
+<!--              ></el-table-column>-->
+<!--            </el-table>-->
+<!--          </div>-->
+<!--        </el-col>-->
+<!--        <el-col :span="8">-->
+<!--          <LockDetail-->
+<!--            style=" margin-left: 5%"-->
+<!--            :machineryId="this.machineryId"-->
+<!--          ></LockDetail>-->
+<!--        </el-col>-->
+<!--        <el-col :span="8">-->
+<!--          <div style="padding: 10px"></div>-->
+<!--        </el-col>-->
+<!--      </el-row>-->
+
+            <el-row>
+              <el-col :span="8">
+                <LockDetail
+                  style="width: 300px; height: 520px; margin-left: 5%"
+                  :machineryId="this.machineryId"
+                ></LockDetail>
+                <el-table :data="selectPointList" :show-header="false"  style="width: 200px;height: 175px;margin-left: 15%">
+                  <el-table-column
+                    prop="pointName"
+                    label=""
+                  ></el-table-column>
+                  <el-table-column
+                    prop="remark"
+                    label=""
+                  ></el-table-column>
+                </el-table>
+              </el-col>
+              <el-col :span="16">
+                <img src="@/assets/images/sopbgimg.png" style="width: 100%;height:100%;"/>
+              </el-col>
+            </el-row>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -680,18 +741,19 @@ import MapData from '@/views/mes/job/jobm/Mapdata.vue'
 import { getUserList } from '@/api/mes/workCard'
 import { getJobPlayTicketInfo } from '@/api/mes/jobplay/jobplay'
 import { getLotoInfo, getLotoMapInfo } from '@/api/mes/lotoStation/lotoStation'
+import LockDetail from '@/views/mes/job/jobm/LockDetail.vue'
 
 export default {
   name: 'NewSop',
-  components: { Template, MapData },
-  dicts: ['sop_type', 'ticket_status','ticket_user_type'],
+  components: { Template, MapData, LockDetail },
+  dicts: ['sop_type', 'ticket_status', 'ticket_user_type'],
   data() {
     return {
       tabPosition: 'first',
       selectedOption: '',
-      selectedRow:null,//设备工艺 单选表格
+      selectedRow: null,//设备工艺 单选表格
       marsSopPage: [], //岗位对应sop列表--现在准备存放设备工艺 而不是选设备工艺的sop
-      technologyList:[],//设备工艺表格数据
+      technologyList: [],//设备工艺表格数据
       marsSopTitle: '', //岗位后 对应展示sop
       marsDeptList: [],
       listLockerOption: [], //上锁人下拉数据
@@ -704,8 +766,8 @@ export default {
       openColocker: false, //添加内外部人员
       outsideTableData: [], //外部人员表格
       insideTableData: [], //内部人员表格
-      insideTableDataOrign:[],//内部原始数据
-      outsideTableDataOrign:[],//外部原始数据
+      insideTableDataOrign: [],//内部原始数据
+      outsideTableDataOrign: [],//外部原始数据
       selectedInsideRows: [], // 存储选中的内部人员的 userId
       selectedOutsideRows: [], // 存储选中的外部人员的 userId
       insideSearchQuery: '', // 内部搜索条件
@@ -729,20 +791,21 @@ export default {
       COCOTicketListPage: [], //CCO岗位的作业票
       scaleFactor: 1, // 缩放比例,初始值为1
       EightDetailvisible: false,//第八步受影响作业票
-      AffectedTickets:[],//第八步查看详情信息表格
+      AffectedTickets: [],//第八步查看详情信息表格
       sopTypeOption: [],
-      sopId:null,
-      workstationId:null,//岗位Id
+      sopId: null,
+      workstationId: null,//岗位Id
       rules: {
         locker: [
           { required: true, message: '上锁人不能为空', trigger: 'change' }
-        ],
-      }
+        ]
+      },
+      tableVisible: true,//表格显示
+      LockDetailvisible: false//锁定站详情
     }
 
   },
   computed: {
-
     // filteredSopTypes() {
     //   const sopTypesInMarsSopPage = this.marsSopPage.map(
     //     (item) => item.sopType
@@ -752,34 +815,46 @@ export default {
     //   )
     // },
     isStepFourExecuted() {
-      const stepFour = this.EightStepForm.find((step) => step.stepIndex == "4");
-      return stepFour && stepFour.stepStatus === '1';
-    },
+      const stepFour = this.EightStepForm.find((step) => step.stepIndex == '4')
+      return stepFour && stepFour.stepStatus === '1'
+    }
   },
-  watch:{
-    'tabPosition': function (val, oldVal) {
-      if (val =='first') {
+  watch: {
+    'tabPosition': function(val, oldVal) {
+      if (val == 'first') {
         this.getList()
       }
     },
-    'dialogForm.locker': function (val) {
+    'dialogForm.locker': function(val) {
       if (val) {
         this.handlelockerChage(val)
         console.log('我制定了')
       }
-    },
+    }
   },
 
   mounted() {
     this.getList()
   },
   methods: {
+    // 锁定站信息部分表格收缩
+    handleChangeTable() {
+      this.tableVisible = !this.tableVisible
+    },
+    // 锁定站进入详细页面
+    goLockDetail() {
+      // this.$router.push({
+      //   name:'LockDetail',params: { machineryId: this.machineryId }
+      // },)
+      this.LockDetailvisible = true
+    },
+    // 内部人员搜索
     filterInsideTable() {
-      const query = this.insideSearchQuery.trim().toLowerCase();
+      const query = this.insideSearchQuery.trim().toLowerCase()
       const filteredData = this.insideTableDataOrign.filter(item =>
         item.nickName.toLowerCase().includes(query)
-      );
-      this.insideTableData = filteredData;
+      )
+      this.insideTableData = filteredData
 
       // 如果输入框为空或null,回显选中状态
       if (!this.insideSearchQuery) {
@@ -788,31 +863,31 @@ export default {
 
           const matchingUser = this.AllUserTable.find(u =>
             u.userId == user.userId
-          );
+          )
 
-          console.log('Matching User:', matchingUser); // 输出匹配结果
+          console.log('Matching User:', matchingUser) // 输出匹配结果
           if (matchingUser) {
             this.$nextTick(() => {
-              console.log(`Selecting user: ${user.nickName}`);
-              this.$refs.insideTable.toggleRowSelection(user, true);
-            });
+              console.log(`Selecting user: ${user.nickName}`)
+              this.$refs.insideTable.toggleRowSelection(user, true)
+            })
           } else {
             this.$nextTick(() => {
-              console.log(`Deselecting user: ${user.nickName}`);
-              this.$refs.insideTable.toggleRowSelection(user, false);
-            });
+              console.log(`Deselecting user: ${user.nickName}`)
+              this.$refs.insideTable.toggleRowSelection(user, false)
+            })
           }
-        });
+        })
       }
     },
 
-      // 外部人员搜索
+    // 外部人员搜索
     filterOutsideTable() {
-      const query = this.outsideSearchQuery.trim().toLowerCase();
+      const query = this.outsideSearchQuery.trim().toLowerCase()
       const filteredData = this.outsideTableDataOrign.filter(item =>
         item.nickName.toLowerCase().includes(query)
-      );
-      this.outsideTableData = filteredData;
+      )
+      this.outsideTableData = filteredData
 
       // 如果输入框为空或null,回显选中状态
       if (!this.outsideSearchQuery) {
@@ -821,21 +896,21 @@ export default {
 
           const matchingUser = this.AllUserTable.find(u =>
             u.userId == user.userId
-          );
+          )
 
-          console.log('Matching User:', matchingUser); // 输出匹配结果
+          console.log('Matching User:', matchingUser) // 输出匹配结果
           if (matchingUser) {
             this.$nextTick(() => {
-              console.log(`Selecting user: ${user.nickName}`);
-              this.$refs.outsideTable.toggleRowSelection(user, true);
-            });
+              console.log(`Selecting user: ${user.nickName}`)
+              this.$refs.outsideTable.toggleRowSelection(user, true)
+            })
           } else {
             this.$nextTick(() => {
-              console.log(`Deselecting user: ${user.nickName}`);
-              this.$refs.outsideTable.toggleRowSelection(user, false);
-            });
+              console.log(`Deselecting user: ${user.nickName}`)
+              this.$refs.outsideTable.toggleRowSelection(user, false)
+            })
           }
-        });
+        })
       }
     },
     handleTicketClick(data) {
@@ -885,7 +960,7 @@ export default {
       const data1 = {
         pages: 1,
         size: -1,
-        machineryType: '工艺',
+        machineryType: '工艺'
       }
       listTechnology(data1).then((res) => {
         console.log(res, 'technologyList')
@@ -898,12 +973,12 @@ export default {
     },
     // sop类型 el-radio
     handleSopchange(data) {
-      const sopType=this.sopTypeOption.find((item)=>item.label==data)
-      const data1={
+      const sopType = this.sopTypeOption.find((item) => item.label == data)
+      const data1 = {
         pages: 1,
         size: -1,
-        machineryId:this.machineryId,
-        sopType:sopType.value
+        machineryId: this.machineryId,
+        sopType: sopType.value
       }
       getIsMarsSopPage(data1).then((res) => {
         console.log(res, 'SopPage')
@@ -916,16 +991,16 @@ export default {
       console.log(val)
       this.tabPosition = val
       this.marsSopTitle = workstationName
-      this.workstationId=workstationId
+      this.workstationId = workstationId
       if (workstationId) {
         const data = {
           pages: 1,
           size: -1,
           workstationId: workstationId,
-          machineryType: '工艺',
+          machineryType: '工艺'
         }
         listTechnology(data).then((res) => {
-          console.log(res,'设备工艺---列表')
+          console.log(res, '设备工艺---列表')
           this.technologyList = res.data.records
         })
         // getIsMarsSopPage(data).then((res) => {
@@ -934,10 +1009,10 @@ export default {
         // })
       }
       if (val == 'third') {
-        this.selectedOption=''
-        this.sopTypeOption=[]
-        console.log(this.sopId,'this.sopId')
-        if(this.sopId){
+        this.selectedOption = ''
+        this.sopTypeOption = []
+        console.log(this.sopId, 'this.sopId')
+        if (this.sopId) {
 
           const data = {
             sopId: this.sopId
@@ -982,8 +1057,8 @@ export default {
       })
       selectSopTypeByMachineryId(selection.machineryId).then((res) => {
         console.log(res, 'SopTypeByMachineryId')
-        this.sopTypeOption=res.data.map((item) =>{
-          return{
+        this.sopTypeOption = res.data.map((item) => {
+          return {
             label: item.dictLabel,
             value: item.dictValue
           }
@@ -993,33 +1068,33 @@ export default {
     // 添加内部人员
     addInside(row) {
       if (row.stepIndex == '3') {
-        this.dialogForm.locker=''
-        this.AllUserTable=[]
-        this.newticketUserDTOList=[]
+        this.dialogForm.locker = ''
+        this.AllUserTable = []
+        this.newticketUserDTOList = []
         this.open = true
 
-        const roleId=this.dict.type.ticket_user_type.find((item)=>item.label=='jtlocker')//利用字典值来记录上锁人 共锁人 方便如果修改了值 直接系统更改
+        const roleId = this.dict.type.ticket_user_type.find((item) => item.label == 'jtlocker')//利用字典值来记录上锁人 共锁人 方便如果修改了值 直接系统更改
         const query1 = {
           pageSize: 10000,
           pageNum: 1,
-          workstationId:this.workstationId,
-          roleId:roleId.value,
-          unitId:9
+          workstationId: this.workstationId,
+          roleId: roleId.value,
+          unitId: 9
         }
         // 上锁人赋值  上锁人 共锁人都要遵循 属于当前工艺 当前作业负责人或者执行人的角色属性
         getUserList(query1).then((res) => {
           // 上锁人下拉数据
           this.listLockerOption = res.rows.map((item) => ({
-              label: item.nickName,
-              value: item.userId
-            }))
+            label: item.nickName,
+            value: item.userId
+          }))
         })
-        const roleIdColocker=this.dict.type.ticket_user_type.find((item)=>item.label=='jtcolocker')//利用字典值来记录上锁人 共锁人 方便如果修改了值 直接系统更改
+        const roleIdColocker = this.dict.type.ticket_user_type.find((item) => item.label == 'jtcolocker')//利用字典值来记录上锁人 共锁人 方便如果修改了值 直接系统更改
         const query = {
           pageSize: 10000,
           pageNum: 1,
-          workstationId:this.workstationId,
-          roleId:roleIdColocker.value,
+          workstationId: this.workstationId,
+          roleId: roleIdColocker.value
         }
         // 共锁人赋值
         getUserList(query).then((res) => {
@@ -1029,45 +1104,43 @@ export default {
           this.outsideTableData = res.rows.filter((item) => item.unitId != '9')
 
           // 获取已分配人员数据
-            getJobTicketInfo(this.ticketId).then((res) => {
-              const assignedUsers = res.data.jobTicketUserList || [];
-              console.log(assignedUsers, '已分配人员');
-              this.dialogForm.locker = assignedUsers
-                .filter(item => item.userRole == 'jtlocker')
-                .map(item => item.userName);
-              const newUser=res.data.jobTicketUserList.filter((item) =>item.userRole == 'jtlocker')
-              this.newticketUserDTOList=[...this.newticketUserDTOList,...newUser];
-              // 更新内部和外部用户的选中状态
-              this.$nextTick(() => {
-                // 手动选中内部人员
-                this.insideTableData.forEach((user) => {
-                  const isAssigned = assignedUsers.some(
-                    (assigned) =>
-                      assigned.userId == user.userId && assigned.userType == '0'&&assigned.userRole!=='jtlocker'
-                  );
-                  if (isAssigned) {
-                    this.$refs.insideTable.toggleRowSelection(user, true);
-
-                  }
-                });
-
-                // 手动选中外部人员
-                this.outsideTableData.forEach((user) => {
-                  const isAssigned = assignedUsers.some(
-                    (assigned) =>
-                      assigned.userId == user.userId && assigned.userType == '1'&&assigned.userRole!=='jtlocker'
-                  );
-                  if (isAssigned) {
-                    this.$refs.outsideTable.toggleRowSelection(user, true);
-
-                  }
-                });
-                this.insideTableDataOrign = [...this.insideTableData];
-                this.outsideTableDataOrign = [...this.outsideTableData];
-              });
-            });
+          getJobTicketInfo(this.ticketId).then((res) => {
+            const assignedUsers = res.data.jobTicketUserList || []
+            console.log(assignedUsers, '已分配人员')
+            this.dialogForm.locker = assignedUsers
+              .filter(item => item.userRole == 'jtlocker')
+              .map(item => item.userName)
+            const newUser = res.data.jobTicketUserList.filter((item) => item.userRole == 'jtlocker')
+            this.newticketUserDTOList = [...this.newticketUserDTOList, ...newUser]
+            // 更新内部和外部用户的选中状态
+            this.$nextTick(() => {
+              // 手动选中内部人员
+              this.insideTableData.forEach((user) => {
+                const isAssigned = assignedUsers.some(
+                  (assigned) =>
+                    assigned.userId == user.userId && assigned.userType == '0' && assigned.userRole !== 'jtlocker'
+                )
+                if (isAssigned) {
+                  this.$refs.insideTable.toggleRowSelection(user, true)
+
+                }
+              })
 
+              // 手动选中外部人员
+              this.outsideTableData.forEach((user) => {
+                const isAssigned = assignedUsers.some(
+                  (assigned) =>
+                    assigned.userId == user.userId && assigned.userType == '1' && assigned.userRole !== 'jtlocker'
+                )
+                if (isAssigned) {
+                  this.$refs.outsideTable.toggleRowSelection(user, true)
 
+                }
+              })
+              this.insideTableDataOrign = [...this.insideTableData]
+              this.outsideTableDataOrign = [...this.outsideTableData]
+            })
+          })
 
         })
 
@@ -1092,12 +1165,12 @@ export default {
       console.log(val, '上锁人chage')
       if (val) {
         // 操作选中角色发生变化
-        this.newticketUserDTOList=[]
+        this.newticketUserDTOList = []
         this.$set(this.dialogForm, this.dialogForm.locker, val)
       } else {
         this.$set(this.dialogForm, this.dialogForm.locker, val)
       }
-      this.$forceUpdate();
+      this.$forceUpdate()
       const user = this.listLockerOption.find((item) => item.value == val)
 
       if (user && this.dialogForm.locker !== '') {
@@ -1118,15 +1191,15 @@ export default {
         }
       }
     },
-    handlelockerClear(){
+    handlelockerClear() {
       this.newticketUserDTOList = []
-      console.log(this.newticketUserDTOList, '清除后的用户');
+      console.log(this.newticketUserDTOList, '清除后的用户')
     },
     InSelectionChange(selection) {
       // 移除未选中的内部用户
       this.AllUserTable = this.AllUserTable.filter((user) =>
         user.userType !== 0 || selection.some((item) => item.userId === user.userId)
-      );
+      )
 
       // 添加新的内部用户
       selection.forEach((item) => {
@@ -1136,18 +1209,18 @@ export default {
             userId: item.userId,
             userType: 0,
             userRole: 'jtcolocker'
-          });
+          })
         }
-      });
+      })
 
-      console.log(this.AllUserTable, '内部人员');
+      console.log(this.AllUserTable, '内部人员')
     },
 
     OutSelectionChange(selection) {
       // 移除未选中的外部用户
       this.AllUserTable = this.AllUserTable.filter((user) =>
         user.userType !== 1 || selection.some((item) => item.userId === user.userId)
-      );
+      )
 
       // 添加新的外部用户
       selection.forEach((item) => {
@@ -1157,11 +1230,11 @@ export default {
             userId: item.userId,
             userType: 1,
             userRole: 'jtcolocker'
-          });
+          })
         }
-      });
+      })
 
-      console.log(this.AllUserTable, '外部人员');
+      console.log(this.AllUserTable, '外部人员')
     },
     confirmAddUser() {
 
@@ -1206,7 +1279,7 @@ export default {
     cancel() {
       this.open = false
       this.FiveDetailvisible = false
-      this.EightDetailvisible=false
+      this.EightDetailvisible = false
     },
     // 作业票结束
     finshJobticket() {
@@ -1254,10 +1327,10 @@ export default {
         })
       } else if (row.stepIndex == '8') {
         let ticketId = this.ticketId
-        this.EightDetailvisible=true
+        this.EightDetailvisible = true
         getStepEight(ticketId).then((res) => {
           console.log(res, '第八步查看作业票数据')
-          this.AffectedTickets=res.data
+          this.AffectedTickets = res.data
         })
       }
     }

+ 4 - 1
src/views/mes/material/lockers/index.vue

@@ -73,6 +73,7 @@
         >批量删除
         </el-button>
       </el-col>
+
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
@@ -196,6 +197,7 @@
             style="width: 348px"
           />
         </el-form-item>
+
       </el-form>
 
       <div slot="footer" class="dialog-footer">
@@ -225,6 +227,7 @@ import {
   deleteMaterialsCabinet,
   selectMaterialsCabinetById
 } from '@/api/mes/material/lockers.js'
+
 import {
   listWorkarea
 } from '@/api/mes/wa/workarea'
@@ -237,7 +240,7 @@ import { genCode } from '@/api/system/autocode/rule'
 export default {
   name: 'Team',
   components: {
-    Treeselect
+    Treeselect,UploadFile
   },
   dicts: ['material_status'],
   data() {

+ 155 - 119
src/views/mes/material/materialinformation/index.vue

@@ -8,42 +8,50 @@
       v-show="showSearch"
       label-width="100px"
     >
-      <el-form-item label="物资编码" prop="materialsCode">
-        <el-input
-          v-model="queryParams.materialsCode"
-          placeholder="请输入物资编码"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="物资名称" prop="materialsName">
-        <el-input
-          v-model="queryParams.materialsName"
-          placeholder="请输入物资名称"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="物资状态" prop="loanState">
-        <el-select v-model="queryParams.loanState" placeholder="状态">
-          <el-option
-            v-for="dict in dict.type.material_status"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          />
-        </el-select>
-      </el-form-item>
+<!--      <el-form-item label="物资编码" prop="materialsCode">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.materialsCode"-->
+<!--          placeholder="请输入物资编码"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="物资名称" prop="materialsName">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.materialsName"-->
+<!--          placeholder="请输入物资名称"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="状态" prop="loanState">-->
+<!--        <el-select v-model="queryParams.loanState" placeholder="状态">-->
+<!--          <el-option-->
+<!--            v-for="dict in dict.type.material_status"-->
+<!--            :key="dict.value"-->
+<!--            :label="dict.label"-->
+<!--            :value="dict.value"-->
+<!--          />-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
       <el-form-item label="物资类型" prop="materialsTypeId">
         <treeselect
-          style="width: 318px"
+          style="width: 200px"
           v-model="queryParams.materialsTypeId"
           :options="machinerytypeOptions"
           :normalizer="normalizer"
           placeholder="请选择物资类型"
         />
       </el-form-item>
-      <el-form-item label="启用时间" prop="createTime">
+      <el-form-item label="供应商" prop="supplier">
+        <el-input
+          v-model="queryParams.supplier"
+          placeholder="请输入供应商"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="有效期" prop="">
         <el-date-picker
           v-model="createTime"
           type="datetimerange"
@@ -55,20 +63,20 @@
         >
         </el-date-picker>
       </el-form-item>
-      <el-form-item label="所属柜" prop="materialsCabinetId">
-        <el-select
-          style="width: 348px"
-          v-model="queryParams.materialsCabinetId"
-          placeholder="请选择所属柜"
-        >
-          <el-option
-            v-for="dict in cabinets"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          />
-        </el-select>
-      </el-form-item>
+<!--      <el-form-item label="所属柜" prop="materialsCabinetId">-->
+<!--        <el-select-->
+<!--          style="width: 215px"-->
+<!--          v-model="queryParams.materialsCabinetId"-->
+<!--          placeholder="请选择所属柜"-->
+<!--        >-->
+<!--          <el-option-->
+<!--            v-for="dict in cabinets"-->
+<!--            :key="dict.value"-->
+<!--            :label="dict.label"-->
+<!--            :value="dict.value"-->
+<!--          />-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
 
       <el-form-item>
         <el-button
@@ -98,7 +106,7 @@
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['mes:mat:info:add']"
+          v-hasPermi="['iscs:materials:add']"
           >新增
         </el-button>
       </el-col>
@@ -111,7 +119,7 @@
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['mes:mat:info:batchremove']"
+          v-hasPermi="['iscs:materials:remove']"
           >批量删除
         </el-button>
       </el-col>
@@ -139,8 +147,8 @@
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="物资编码" align="center" prop="materialsCode">
-      </el-table-column>
+<!--      <el-table-column label="物资编码" align="center" prop="materialsCode">-->
+<!--      </el-table-column>-->
       <el-table-column label="物资名称" align="center" prop="materialsName" />
       <el-table-column
         label="物资类型"
@@ -149,20 +157,21 @@
       />
       <el-table-column label="物资RFID" align="center" prop="materialsRfid" />
       <el-table-column label="所属柜" align="center" prop="cabinetName" />
-      <el-table-column label="可用寿命" align="center" prop="serviceLife">
+      <el-table-column label="供应商" align="center" prop="supplier">
+      </el-table-column>
+      <el-table-column label="有效期" align="center" prop="expirationDate">
         <template slot-scope="scope">
-<!--          {{ formatDateserviceLife(scope.row.serviceLife) }}-->
-          {{ scope.row.serviceLife }}
-
+          {{ scope.row.expirationDate }}
         </template>
       </el-table-column>
-      <el-table-column label="物资状态" align="center" prop="loanState">
+      <el-table-column label="状态" align="center" prop="loanState">
         <template slot-scope="scope">
           <span>{{ scope.row.loanState == 0 ? "借出" : "柜中" }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="创建时间" align="center" prop="createTime">
-      </el-table-column>
+
+<!--      <el-table-column label="创建时间" align="center" prop="createTime">-->
+<!--      </el-table-column>-->
       <el-table-column
         label="操作"
         align="center"
@@ -175,7 +184,7 @@
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['mes:mat:info:edit']"
+            v-hasPermi="['iscs:materials:edit']"
             >编辑
           </el-button>
           <el-button
@@ -184,7 +193,7 @@
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            v-hasPermi="['mes:mat:info:remove']"
+            v-hasPermi="['iscs:materials:remove']"
             >删除
           </el-button>
         </template>
@@ -193,7 +202,7 @@
     <pagination
       v-show="total > 0"
       :total="total"
-      :page.sync="queryParams.pages"
+      :page.sync="queryParams.current"
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
@@ -206,20 +215,13 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="110px">
         <el-row>
           <el-col :span="12">
-            <el-form-item label="物资编码" prop="materialsCode">
+            <el-form-item label="物资名称" prop="materialsName">
               <el-input
-                v-model="form.materialsCode"
-                placeholder="请输入物资编码"
-                style="width: 200px; margin-right: 10px"
+                v-model="form.materialsName"
+                placeholder="请输入物资名称"
               />
-              <el-switch
-                v-model="autoGenFlag"
-                active-color="#13ce66"
-                active-text="自动生成"
-                @change="handleAutoGenChange(autoGenFlag)"
-              >
-              </el-switch>
             </el-form-item>
+
           </el-col>
           <el-col :span="12">
             <el-form-item label="物资类型" prop="materialsTypeId">
@@ -235,10 +237,12 @@
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="物资名称" prop="materialsName">
+            <el-form-item label="物资RFID" prop="materialsRfid">
               <el-input
-                v-model="form.materialsName"
-                placeholder="请输入物资名称"
+                v-model="form.materialsRfid"
+                placeholder="请输入物资RFID(纯数字)"
+                maxlength="128"
+                oninput="value=value.replace(/[^\d.]/g,'')"
               />
             </el-form-item>
           </el-col>
@@ -260,53 +264,69 @@
           </el-col>
         </el-row>
         <el-row>
+
           <el-col :span="12">
-            <el-form-item label="启用日期" prop="startTime">
-              <el-input v-model="form.startTime" placeholder="" disabled />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="物资剩余次数" prop="availableTimes">
+            <el-form-item label="供应商" prop="supplier">
               <el-input
-                v-model="form.availableTimes"
-                placeholder="请输入物资剩余次数"
+                v-model="form.supplier"
+                placeholder="请输入供应商"
               />
             </el-form-item>
           </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="可用次数" prop="serviceTimes">
-              <el-input v-model="form.serviceTimes" placeholder="" disabled />
-            </el-form-item>
-          </el-col>
           <el-col :span="12">
-            <el-form-item label="可用寿命" prop="serviceLife">
-              <!--              <el-input-->
-              <!--                v-model="form.serviceLife"-->
-              <!--                placeholder="请输入可用寿命"-->
-              <!--              />-->
+            <el-form-item label="有效期" prop="expirationDate">
               <el-date-picker
-                v-model="form.serviceLife"
+                v-model="form.expirationDate"
                 type="date"
                 placeholder="选择日期"
               >
               </el-date-picker>
             </el-form-item>
           </el-col>
+<!--            <el-form-item label="可用寿命" prop="serviceLife">-->
+<!--           -->
+<!--              <el-date-picker-->
+<!--                v-model="form.serviceLife"-->
+<!--                type="date"-->
+<!--                placeholder="选择日期"-->
+<!--              >-->
+<!--              </el-date-picker>-->
+<!--            </el-form-item>-->
+            <!--            <el-form-item label="可用次数" prop="serviceTimes">-->
+            <!--              <el-input v-model="form.serviceTimes" placeholder="" disabled />-->
+            <!--            </el-form-item>-->
+            <!--        <el-row>-->
+            <!--          <el-col :span="12">-->
+            <!--            <el-form-item label="启用日期" prop="startTime">-->
+            <!--              <el-input v-model="form.startTime" placeholder="" disabled />-->
+            <!--            </el-form-item>-->
+            <!--          </el-col>-->
+            <!--          <el-col :span="12">-->
+            <!--            <el-form-item label="物资剩余次数" prop="availableTimes">-->
+            <!--              <el-input-->
+            <!--                v-model="form.availableTimes"-->
+            <!--                placeholder="请输入物资剩余次数"-->
+            <!--              />-->
+            <!--            </el-form-item>-->
+            <!--          </el-col>-->
+            <!--        </el-row>-->
+            <!--            <el-form-item label="物资编码" prop="materialsCode">-->
+            <!--              <el-input-->
+            <!--                v-model="form.materialsCode"-->
+            <!--                placeholder="请输入物资编码"-->
+            <!--                style="width: 200px; margin-right: 10px"-->
+            <!--              />-->
+            <!--              <el-switch-->
+            <!--                v-model="autoGenFlag"-->
+            <!--                active-color="#13ce66"-->
+            <!--                active-text="自动生成"-->
+            <!--                @change="handleAutoGenChange(autoGenFlag)"-->
+            <!--              >-->
+            <!--              </el-switch>-->
+            <!--            </el-form-item>-->
+
         </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="物资RFID" prop="materialsRfid">
-              <el-input
-                v-model="form.materialsRfid"
-                placeholder="请输入物资RFID(纯数字)"
-                maxlength="128"
-                oninput="value=value.replace(/[^\d.]/g,'')"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
+
       </el-form>
 
       <div slot="footer" class="dialog-footer">
@@ -331,6 +351,7 @@
       width="400px"
       append-to-body
     >
+<!--      -->
       <el-upload
         ref="upload"
         :limit="1"
@@ -422,15 +443,17 @@ export default {
       // 查询参数
       createTime: "",
       queryParams: {
-        pages: 1,
+        current: 1,
         size: 10,
         materialsCode: null,
         materialsName: null,
         loanState: null,
         materialsCabinetId: null,
         materialsTypeId: null,
-        startTime: "",
-        endTime: "",
+        startExpirationDate: "",
+        endExpirationDate: "",
+        supplier: null,
+        expirationDate: null,
       },
 
       // 查询参数
@@ -482,7 +505,8 @@ export default {
         // 设置上传的请求头部
         headers: { Authorization: "Bearer " + getToken() },
         // 上传的地址
-        url: process.env.VUE_APP_BASE_API + "/iscs/materials/importMaterials",
+        // url: process.env.VUE_APP_BASE_API + "/iscs/materials/importMaterials",
+        url:process.env.VUE_APP_BASE_API + "/common/upload",
       },
 
       // 表单参数
@@ -496,6 +520,9 @@ export default {
         materialsName: [
           { required: true, message: "物资名称不能为空", trigger: "blur" },
         ],
+        materialsTypeId:[
+          { required: true, message: "物资类型不能为空", trigger: "blur" },
+        ]
       },
 
       machinerytypeOptions: [],
@@ -558,9 +585,10 @@ export default {
     getList() {
       this.loading = true;
       // 格式化日期并更新 queryParams
+      console.log(this.createTime,'this.createTime')
       if (Array.isArray(this.createTime) && this.createTime.length === 2) {
-        this.queryParams.startTime = this.formatDate(this.createTime[0]);
-        this.queryParams.endTime = this.formatDate(this.createTime[1]);
+        this.queryParams.startExpirationDate = this.formatDate(this.createTime[0]);
+        this.queryParams.endExpirationDate = this.formatDate(this.createTime[1]);
       }
 
       listMaterials(this.queryParams).then((response) => {
@@ -592,19 +620,19 @@ export default {
     // 表单重置
     reset() {
       this.form = {
-        materialsCode: "",
         materialsName: "",
-        loanState: "",
         createTime: "",
         materialsTypeId: "",
         materialsCabinetId: "",
+        expirationDate: "",
+        supplier:""
       };
       this.resetForm("form");
       this.autoGenFlag = false;
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
+
       this.getList();
     },
     /** 重置按钮操作 */
@@ -623,7 +651,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.materialsId);
-      this.codes = selection.map((item) => item.materialsCode);
+      this.codes = selection.map((item) => item.materialsName);
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },
@@ -661,11 +689,7 @@ export default {
       });
     },
     // 导入按钮操作
-    /** 导入按钮操作 */
-    handleImport() {
-      this.upload.title = "物资信息导入";
-      this.upload.open = true;
-    },
+
     /** 导入按钮操作 */
     handleImport() {
       this.upload.title = "物资导入";
@@ -701,6 +725,16 @@ export default {
     submitFileForm() {
       this.$refs.upload.submit();
     },
+    // 有效期参数转换时间类型
+    formatDateExpirationDate(dateString) {
+      const date = new Date(dateString);
+
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1,并且补零
+      const day = String(date.getDate()).padStart(2, '0'); // 补零
+
+      return `${year}-${month}-${day}`;
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate((valid) => {
@@ -713,6 +747,8 @@ export default {
               this.getList();
             });
           } else {
+            this.form.expirationDate=this.formatDateExpirationDate(this.form.expirationDate)
+            console.log(this.form,'新增参数');
             addMaterials(this.form).then((response) => {
               console.log(response, "新增返回");
               this.$modal.msgSuccess("新增成功");
@@ -726,7 +762,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const materialsIds = row.materialsId || this.ids;
-      const materialsCodes = row.materialsCode || this.codes;
+      const materialsCodes = row.materialsName || this.codes;
       this.$modal
         .confirm('是否确认删除编号为"' + materialsCodes + '"的数据项?')
         .then(function () {

+ 76 - 3
src/views/mes/material/typeofmaterial/index.vue

@@ -82,13 +82,13 @@
         prop="materialsTypeName"
         :show-overflow-tooltip="true"
       />
-      <el-table-column label="状态" align="center" prop="status">
+      <el-table-column label="状态" align="center" prop="status"  >
         <template slot-scope="scope">
           <el-tag v-if="scope.row.status == 'y'">启用</el-tag>
           <el-tag v-else type="danger">禁用</el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="出借时长" align="center" prop="loanDuration">
+      <el-table-column label="出借时长" align="center" prop="loanDuration" >
         <template slot-scope="scope">
           <span>{{ formattedTime(scope.row.loanDuration) }}</span>
         </template>
@@ -103,6 +103,38 @@
           <span>{{ formattedTime(scope.row.timeoutAlarm) }}</span>
         </template>
       </el-table-column>
+      <el-table-column
+        label="物资类型图标"
+        align="center"
+        prop="materialsTypeIcon"
+
+      >
+        <template slot-scope="scope">
+          <img
+            v-if="scope.row.materialsTypeIcon"
+            :src="scope.row.materialsTypeIcon"
+            alt=""
+            style="width: 50px; height: 50px"
+          />
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        label="物资类型缩略图"
+        align="center"
+        prop="materialsTypePicture"
+
+      >
+        <template slot-scope="scope">
+          <img
+            v-if="scope.row.materialsTypePicture"
+            :src="scope.row.materialsTypePicture"
+            alt=""
+            style="width: 50px; height: 50px"
+          />
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
       <el-table-column
         label="是否需要归还"
         align="center"
@@ -267,7 +299,7 @@
             </div>
           </div>
         </el-form-item>
-       
+
         <el-form-item label="状态" prop="status">
           <el-radio-group v-model="form.status">
             <el-radio :label="'y'">启用</el-radio>
@@ -282,6 +314,31 @@
             style="width: 420px"
           />
         </el-form-item>
+        <el-row>
+          <el-col :span="10">
+            <el-form-item label="物资缩略图" prop="materialsTypePicture">
+              <ImageUploadSingle
+                :limit="1"
+                :value="form.materialsTypePicture"
+                :fileSize="5"
+                @onUploaded="handleImgUplaoded"
+                @onRemoved="handleImgRemoved"
+
+              ></ImageUploadSingle>
+            </el-form-item>
+          </el-col>
+          <el-col :span="10">
+            <el-form-item label="物资类型图标" prop="materialsTypeIcon">
+              <ImageUploadSingle
+                :limit="1"
+                :value="form.materialsTypeIcon"
+                :fileSize="5"
+                @onUploaded="handleIconUplaoded"
+                @onRemoved="handleIconRemoved"
+              ></ImageUploadSingle>
+            </el-form-item>
+          </el-col>
+        </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button v-no-more-click type="primary" @click="submitForm"
@@ -607,6 +664,22 @@ this.$forceUpdate();
         })
         .catch(() => {});
     },
+    //图片上传成功
+    handleImgUplaoded(imgUrl) {
+      this.form.materialsTypePicture = imgUrl[0].url
+    },
+    //图片移除
+    handleImgRemoved(imgUrl) {
+      this.form.materialsTypePicture = null
+    },
+    //图标上传成功
+    handleIconUplaoded(imgUrl) {
+      this.form.materialsTypeIcon = imgUrl[0].url
+    },
+    // 图标移除
+    handleIconRemoved(imgUrl) {
+      this.form.materialsTypeIcon = null
+    },
   },
 };
 </script>

+ 23 - 15
src/views/mes/md/segregationpoint/index.vue

@@ -367,7 +367,7 @@
 <!--            </el-form-item>-->
 <!--          </el-col>-->
           <el-col :span="11">
-            <el-form-item label="锁定站" prop="lockTypeName">
+            <el-form-item label="锁定站" prop="lotoId">
               <el-select
                 style="width: 300px"
                 v-model="form.lotoId"
@@ -405,6 +405,13 @@
 <!--              />-->
 <!--            </el-form-item>-->
 
+          <el-col :span="11">
+            <el-form-item label="岗位" prop="workstationId" >
+              <treeselect style="width: 300px" v-model="form.workstationId" :options="deptOptions" :normalizer="normalizer" placeholder="选择岗位"/>
+            </el-form-item>
+
+
+          </el-col>
           <el-col :span="11">
             <el-form-item label="能量源" prop="powerType">
               <el-select
@@ -422,15 +429,6 @@
             </el-form-item>
 
           </el-col>
-          <el-col :span="11">
-            <el-form-item label="作用" prop="remark">
-              <el-input
-                style="width: 300px"
-                v-model="form.remark"
-                placeholder="请输入作用"
-              />
-            </el-form-item>
-          </el-col>
 <!--          <el-col :span="11">-->
 <!--            <el-form-item label="挂锁类型" prop="lockTypeId">-->
 <!--              <treeselect-->
@@ -444,7 +442,7 @@
 <!--          </el-col>-->
         </el-row>
 
-<!--        <el-row>-->
+        <el-row>
 <!--          <el-col :span="11">-->
 <!--           <el-form-item label="锁具机构名称" prop="lockTypeName">-->
 <!--              <el-input-->
@@ -454,7 +452,14 @@
 <!--              />-->
 <!--            </el-form-item>-->
 <!--          </el-col>-->
-<!--          <el-col :span="12">-->
+          <el-col :span="12">
+            <el-form-item label="作用" prop="remark">
+              <el-input
+                style="width: 300px"
+                v-model="form.remark"
+                placeholder="请输入作用"
+              />
+            </el-form-item>
 <!--            <el-form-item label="锁具机构类型" prop="locksetTypeId">-->
 <!--              <treeselect-->
 <!--                style="width: 300px"-->
@@ -464,9 +469,9 @@
 <!--                placeholder="选择锁具机构类型"-->
 <!--              />-->
 <!--            </el-form-item>-->
-<!--          </el-col>-->
-<!--         -->
-<!--        </el-row>-->
+          </el-col>
+
+        </el-row>
         <el-row>
           <el-col :span="8">
             <el-form-item label="隔离点图标" prop="pointIcon">
@@ -650,6 +655,9 @@ export default {
         workareaId: [
           { required: true, message: '作业区域不能为空', trigger: 'blur' }
         ],
+        lotoId:[
+          { required: true, message: '锁定站不能为空', trigger: 'blur' }
+        ],
         pointType: [
           { required: true, message: '隔离点类型不能为空', trigger: 'blur' }
         ],

+ 2 - 2
src/views/mes/sop/sopm/index.vue

@@ -125,7 +125,7 @@
     <pagination
       v-show="total > 0"
       :total="total"
-      :page.sync="queryParams.pages"
+      :page.sync="queryParams.current"
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
@@ -294,7 +294,7 @@ export default {
       refreshTable: true,
       // 查询参数
       queryParams: {
-        pages:1,
+        current:1,
         size:10,
         sopName: undefined,
         sopCode: undefined

+ 5 - 3
src/views/system/mars/index.vue

@@ -231,11 +231,11 @@ export default {
       refreshTable: true,
       // 查询参数
       queryParams: {
-        pages:1,
+        current:1,
         size:-1,
         workstationName: undefined,
-        workstationCode: undefined,
-        userId:undefined
+        status: undefined,
+        userId:undefined,//勿删
       },
       // 表单参数
       form: {},
@@ -342,6 +342,8 @@ watch: {
     /** 重置按钮操作 */
     resetQuery() {
       this.queryParams.userId = undefined
+      this.queryParams.unitName= ''
+      this.queryParams.status = undefined
       this.resetForm('queryForm')
       this.handleQuery()
       this.$router.push('/user/mars')

+ 87 - 94
src/views/system/technology/technologyDetail/CraftDetail.vue

@@ -28,20 +28,20 @@
           </el-button>
 
         </el-col>
-        <el-col :span="1.5">
-          <el-button
-            v-no-more-click
-            type="danger"
-            plain
-            icon="el-icon-delete"
-            size="mini"
-            :disabled="multiple"
-            @click="handleDelete"
-            v-hasPermi="['mes:hw:information:batchremove']"
-          >批量删除
-          </el-button
-          >
-        </el-col>
+<!--        <el-col :span="1.5">-->
+<!--          <el-button-->
+<!--            v-no-more-click-->
+<!--            type="danger"-->
+<!--            plain-->
+<!--            icon="el-icon-delete"-->
+<!--            size="mini"-->
+<!--            :disabled="multiple"-->
+<!--            @click="handleDelete"-->
+<!--            v-hasPermi="['mes:hw:information:batchremove']"-->
+<!--          >批量删除-->
+<!--          </el-button-->
+<!--          >-->
+<!--        </el-col>-->
         <!-- <el-col :span="1.5">
           <el-button
             v-no-more-click
@@ -160,7 +160,7 @@
 <!--          >批量删除-->
 <!--          </el-button-->
 <!--          >-->
-        </el-col>
+
 <!--        <right-toolbar-->
 <!--          :showSearch.sync="showSearch"-->
 <!--          @queryTable="getList"-->
@@ -228,28 +228,28 @@
     <pagination
       v-show="total1 > 0&&tabPosition=='deviceList'"
       :total="total1"
-      :page.sync="queryParams.pages"
+      :page.sync="queryParams.current"
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
     <pagination
       v-show="total2 > 0&&tabPosition=='sopList'"
       :total="total2"
-      :page.sync="queryParams.pages"
+      :page.sync="queryParams.current"
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
-    <!-- 添加或修改部门对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="450px" append-to-body>
+    <!-- 添加或修改设备对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="460px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-        <el-form-item label="所属工艺" prop="parentId">
-          <treeselect
-            v-model="form.parentId"
-            :options="machineryOptions"
-            :normalizer="normalizer"
-            placeholder="选择上级"
-          />
-        </el-form-item>
+<!--        <el-form-item label="所属工艺" prop="parentId">-->
+<!--          <treeselect-->
+<!--            v-model="form.parentId"-->
+<!--            :options="machineryOptions"-->
+<!--            :normalizer="normalizer"-->
+<!--            placeholder="选择上级"-->
+<!--          />-->
+<!--        </el-form-item>-->
 
         <el-form-item label="设备名称" prop="machineryName">
           <el-input
@@ -258,7 +258,7 @@
           />
         </el-form-item>
         <el-row>
-          <el-col :span="18">
+          <el-col :span="17">
             <el-form-item label="设备编号" prop="machineryCode">
               <el-input
                 v-model="form.machineryCode"
@@ -266,7 +266,7 @@
               />
             </el-form-item>
           </el-col>
-          <el-col :span="6">
+          <el-col :span="7">
             <el-form-item label-width="30">
               <el-switch
                 v-model="autoGenFlag"
@@ -327,30 +327,30 @@
       </div>
     </el-dialog>
     <!-- 添加或修改sopLise对话框 -->
-    <el-dialog :title="title" :visible.sync="openSop" width="470px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
-        <el-form-item label="所属岗位" prop="workstationId" >
-          <treeselect v-model="form.workstationId" :options="marsOptions"  :normalizer="Marsnormalizer" placeholder="选择岗位"/>
-        </el-form-item>
-        <el-form-item label="设备/工艺" prop="machineryId" >
-          <treeselect v-model="form.machineryId" :options="machineryOptions"  :normalizer="machinerynormalizer" placeholder="选择设备/工艺"/>
-        </el-form-item>
-        <el-form-item label="SOP类型" prop="sopType">
-          <el-select v-model="form.sopType"  placeholder="请选择SOP类型" clearable>
-            <el-option
-              v-for="dict in dict.type.sop_type"
-              :key="dict.value"
-              :label="dict.label"
-              :value="dict.value"
-            />
-          </el-select>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button v-no-more-click type="primary" @click="submitForm">确 定</el-button>
-        <el-button v-no-more-click @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
+<!--    <el-dialog :title="title" :visible.sync="openSop" width="470px" append-to-body>-->
+<!--      <el-form ref="form" :model="form" :rules="rules" label-width="100px">-->
+<!--        <el-form-item label="所属岗位" prop="workstationId" >-->
+<!--          <treeselect v-model="form.workstationId" :options="marsOptions"  :normalizer="Marsnormalizer" placeholder="选择岗位"/>-->
+<!--        </el-form-item>-->
+<!--        <el-form-item label="设备/工艺" prop="machineryId" >-->
+<!--          <treeselect v-model="form.machineryId" :options="machineryOptions"  :normalizer="machinerynormalizer" placeholder="选择设备/工艺"/>-->
+<!--        </el-form-item>-->
+<!--        <el-form-item label="SOP类型" prop="sopType">-->
+<!--          <el-select v-model="form.sopType"  placeholder="请选择SOP类型" clearable>-->
+<!--            <el-option-->
+<!--              v-for="dict in dict.type.sop_type"-->
+<!--              :key="dict.value"-->
+<!--              :label="dict.label"-->
+<!--              :value="dict.value"-->
+<!--            />-->
+<!--          </el-select>-->
+<!--        </el-form-item>-->
+<!--      </el-form>-->
+<!--      <div slot="footer" class="dialog-footer">-->
+<!--        <el-button v-no-more-click type="primary" @click="submitForm">确 定</el-button>-->
+<!--        <el-button v-no-more-click @click="cancel">取 消</el-button>-->
+<!--      </div>-->
+<!--    </el-dialog>-->
   </div>
 </template>
 
@@ -407,7 +407,7 @@ export default {
       refreshTable: true,
       // 查询参数
       queryParams: {
-        pages: 1,
+        current: 1,
         size: 10,
         machineryName: undefined,
         machineryCode: undefined,
@@ -418,9 +418,15 @@ export default {
       form: {
         machineryType: '设备',
         machineryId: undefined,
+
       },
       SopList: [],//sopLisT
-
+      queryParamsSop: {
+        current: 1,
+        size: 10,
+        machineryId: undefined,
+      },
+      machineryId:null,//
       // 表单校验
       rules: {
         machineryCode: [
@@ -436,11 +442,7 @@ export default {
       }
     }
   },
-  created() {
-    this.getList()
-    this.getOtherList()
-    this.form.machineryId = this.$route.query.machineryId
-  },
+
   watch: {
     'form.workstationId': function(newVal, oldVal) {
       if (newVal) {
@@ -467,30 +469,30 @@ export default {
       }
     }
   },
+  created() {
+    this.getList()
+    this.getOtherList()
+    this.form.machineryId = this.$route.query.machineryId
+    this.machineryId = this.$route.query.machineryId
+  },
   methods: {
     /** 查询部门列表 */
     getList() {
       this.loading = true
       listTechnology(this.queryParams).then((response) => {
-
         debugger;
         const filterData = response.data.records.filter(item => {
-          return item.parentId == this.$route.query.machineryId
+          return item.parentId == this.machineryId
         })
-        this.total1=filterData.length
-
-        this.deptList = this.handleTree(
-          filterData,
-          'machineryId',
-          'parentId'
-        )
+        this.total1=response.data.total
+        this.deptList = filterData
         const data=response.data.records.filter((item) =>item.machineryType=='工艺')
         this.machineryOptions = this.handleTree(
           data,
           'machineryId',
           'parentId'
         )
-        console.log(this.deptList, '设备列表')
+
         this.loading = false
       })
 
@@ -516,8 +518,8 @@ export default {
         })
       });
 
-      this.queryParams.machineryId=this.$route.query.machineryId
-      getIsMarsSopPage(this.queryParams).then(response => {
+      this.queryParamsSop.machineryId=this.$route.query.machineryId
+      getIsMarsSopPage(this.queryParamsSop).then(response => {
         debugger;
         this.SopList = response.data.records
         this.total2=response.data.total
@@ -536,16 +538,16 @@ export default {
       }
     },
     /** 转换mars岗位数据结构 */
-    machinerynormalizer(node) {
-      if (node.children && !node.children.length) {
-        delete node.children
-      }
-      return {
-        id: node.machineryId,
-        label: node.machineryName,
-        children: node.children
-      }
-    },
+    // machinerynormalizer(node) {
+    //   if (node.children && !node.children.length) {
+    //     delete node.children
+    //   }
+    //   return {
+    //     id: node.machineryId,
+    //     label: node.machineryName,
+    //     children: node.children
+    //   }
+    // },
     normalizer(node) {
       if (node.children && !node.children.length) {
         delete node.children
@@ -576,7 +578,8 @@ export default {
       this.form = {
         machineryId: undefined,
         parentId: undefined,
-        machineryName: undefined
+        machineryName: undefined,
+        machineryCode: undefined,
       }
       this.autoGenFlag = false
       this.resetForm('form')
@@ -683,17 +686,7 @@ export default {
         this.getList();
         this.$modal.msgSuccess("删除成功");
       }).catch(() => {});
-      // this.$modal
-      //   .confirm('是否确认删除名称为"' + row.machineryName + '"的数据项?')
-      //   .then(function() {
-      //     return delTechnology(row.machineryId)
-      //   })
-      //   .then(() => {
-      //     this.getList()
-      //     this.$modal.msgSuccess('删除成功')
-      //   })
-      //   .catch(() => {
-      //   })
+
     }
   }
 }

+ 5 - 5
src/views/system/technology/technologyDetail/MapData.vue

@@ -25,10 +25,10 @@
                      style="float: left; height: 33px; line-height: 2px"
           >保存
           </el-button>
-          <el-button v-no-more-click @click="close" type="primary" icon="el-icon-close"
-                     style="float: left; height: 33px; line-height: 2px;"
-          >关闭
-          </el-button>
+<!--          <el-button v-no-more-click @click="close" type="primary" icon="el-icon-close"-->
+<!--                     style="float: left; height: 33px; line-height: 2px;"-->
+<!--          >关闭-->
+<!--          </el-button>-->
 <!--          <el-button v-no-more-click @click="reset" type="primary" icon="el-icon-refresh"-->
 <!--                     style="float: left; height: 33px; line-height: 2px;"-->
 <!--          >重置-->
@@ -151,7 +151,7 @@ export default {
           console.log(this.form, formData, 'map')
           saveMachineryPoints(formData).then(response => {
             console.log(response, '修改设备/工艺地图')
-            this.$router.push('/technology/technologyList')
+            // this.$router.push('/technology/technologyList')
             this.$message({
               type: 'success',
               message: '保存成功!'

+ 34 - 32
src/views/system/technology/technologyList/index.vue

@@ -192,14 +192,14 @@
         <pagination
           v-show="total1 > 0&&tabPosition=='craft'"
           :total="total1"
-          :page.sync="queryParams.pages"
+          :page.sync="queryParams.current"
           :limit.sync="queryParams.size"
           @pagination="getList"
         />
         <pagination
           v-show="total2 > 0&&tabPosition=='device'"
           :total="total2"
-          :page.sync="queryParams.pages"
+          :page.sync="queryParams.current"
           :limit.sync="queryParams.size"
           @pagination="getList"
         />
@@ -346,10 +346,11 @@ export default {
       refreshTable: true,
       // 查询参数
       queryParams: {
-        pages: 1,
-        size: -1,
+        current: 1,
+        size: 10,
         machineryName: undefined,
         machineryCode: undefined,
+        machineryType: undefined,
         workstationName:undefined,
         workstationId:undefined,
       },
@@ -414,35 +415,36 @@ export default {
     /** 查询部门列表 */
     getList() {
       this.loading = true
-      listTechnology(this.queryParams).then((response) => {
-        debugger;
-        let filteredData;
-        if (this.tabPosition == 'craft') {
-          filteredData = this.filterByMachineryType(response.data.records, '工艺');
-          console.log(filteredData, '工艺列表---a');
-          this.total1=filteredData.length;
-        } else {
-          filteredData = this.filterByMachineryType(response.data.records, '设备');
-          console.log(filteredData, '设备列表---v');
-          this.total2=filteredData.length;
-        }
-
-        this.deptList = this.handleTree(
-          filteredData,
-          'machineryId',
-          'parentId'
-        );
-
-
-        // 设备新增的下拉
-        this.machineryOptions = this.handleTree(
-          response.data.records,
-          'machineryId',
-          'parentId'
-        )
+      if (this.tabPosition == 'craft') {
+        this.queryParams.machineryType='工艺'
+        listTechnology(this.queryParams).then((response) => {
+          this.deptList=response.data.records
+          this.total1=response.data.total;
+          // 设备新增的下拉
+          this.machineryOptions = this.handleTree(
+            response.data.records,
+            'machineryId',
+            'parentId'
+          )
+
+          this.loading = false
+        })
+      } else {
+        this.queryParams.machineryType='设备'
+        listTechnology(this.queryParams).then((response) => {
+          this.deptList=response.data.records
+          this.total2=response.data.total;
+          // 设备新增的下拉
+          this.machineryOptions = this.handleTree(
+            response.data.records,
+            'machineryId',
+            'parentId'
+          )
+
+          this.loading = false
+        })
 
-        this.loading = false
-      })
+      }
 
     },
     getOtherList(){

+ 3 - 2
src/views/system/unit/index.vue

@@ -125,7 +125,7 @@
     <pagination
       v-show="total > 0"
       :total="total"
-      :page.sync="queryParams.pages"
+      :page.sync="queryParams.current"
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
@@ -206,11 +206,12 @@ export default {
       refreshTable: true,
       // 查询参数
       queryParams: {
-        pages:1,
+        current:1,
         size:10,
         unitName: undefined,
         userId:undefined,
         unitId:undefined,
+        status:undefined,
       },
       // 表单参数
       form: {},

+ 163 - 42
src/views/system/user/index.vue

@@ -60,7 +60,7 @@
             <treeselect style="width:240px" v-model="queryParams.unitId" :options="UnitOptions" :normalizer="Unitnormalizer" :show-count="true" placeholder="请选择单位" />
           </el-form-item>
           <el-form-item label="角色" prop="roleId">
-            <el-select style="width:240px" v-model="queryParams.roleId"  clearable placeholder="请选择角色">
+            <el-select style="width:240px" v-model="queryParams.roleId"  clearable placeholder="请选择角色" >
               <el-option
                 v-for="item in roleOptions"
                 :key="item.roleId"
@@ -71,14 +71,8 @@
           </el-form-item>
 <!--          这里查询的是玛氏岗位-->
           <el-form-item label="岗位" prop="workstationId">
-            <el-select style="width: 240px" v-model="queryParams.workstationId" clearable placeholder="请选择岗位">
-              <el-option
-                v-for="item in MarsWordStationOptions"
-                :key="item.workstationId"
-                :label="item.workstationName"
-                :value="item.workstationId"
-              ></el-option>
-            </el-select>
+
+            <treeselect style="width:240px " v-model="queryParams.workstationId" :options="marsOptions"  :normalizer="Marsnormalizer" placeholder="选择岗位" @change="handleWorkstationChange"/>
           </el-form-item>
           <el-form-item label="状态" prop="status">
             <el-select
@@ -311,26 +305,25 @@
           <el-col :span="12">
 <!--            玛氏岗位-->
             <el-form-item label="岗位" prop="workstationIds">
-              <el-select v-model="form.workstationIds" clearable multiple placeholder="请选择岗位">
-                <el-option
-                  v-for="item in MarsWordStationOptions"
-                  :key="item.workstationId"
-                  :label="item.workstationName"
-                  :value="item.workstationId"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-<!--            <el-form-item label="岗位">-->
-<!--              <el-select v-model="form.postIds" multiple placeholder="请选择岗位">-->
+<!--              <el-select v-model="form.workstationIds" clearable multiple placeholder="请选择岗位">-->
 <!--                <el-option-->
-<!--                  v-for="item in postOptions"-->
-<!--                  :key="item.postId"-->
-<!--                  :label="item.postName"-->
-<!--                  :value="item.postId"-->
-<!--                  :disabled="item.status == 1"-->
+<!--                  v-for="item in MarsWordStationOptions"-->
+<!--                  :key="item.workstationId"-->
+<!--                  :label="item.workstationName"-->
+<!--                  :value="item.workstationId"-->
 <!--                ></el-option>-->
 <!--              </el-select>-->
-<!--            </el-form-item>-->
+              <el-select size="small" v-model="form.workstationIds" placeholder="请选择" :popper-append-to-body="false" multiple clearable
+                         @remove-tag="removeTag" @clear="clearAll">
+                <el-option :value="selectTreeValue" class="setstyle" disabled>
+                  <el-input class="setinput" size="mini" placeholder="输入关键字进行过滤" clearable v-model="filterText"></el-input>
+                  <el-tree :data="MarsWordStationOptions" default-expand-all show-checkbox node-key="id" ref="treeRef" highlight-current
+                           :filter-node-method="filterNode" :props="defaultProps" @check-change="handleCheckChange"></el-tree>
+                </el-option>
+              </el-select>
+
+            </el-form-item>
+
           </el-col>
           <el-col :span="12">
             <el-form-item label="角色" prop="roleIds">
@@ -432,6 +425,8 @@ export default {
       title: "",
       // 部门树选项
       deptOptions: undefined,
+      // mars树选项
+      marsOptions: [],
       // 单位树选项
       UnitOptions:undefined,
       // 是否显示弹出层
@@ -447,7 +442,9 @@ export default {
       // 角色选项
       roleOptions: [],
       // 表单参数
-      form: {},
+      form: {
+        workstationIds: []
+      },
       defaultProps: {
         children: "children",
         label: "label"
@@ -476,6 +473,10 @@ export default {
         status: undefined,
         deptId: undefined,
         workstationId: undefined,
+        roleId: undefined,
+        userId: undefined,
+        nickName: undefined,
+        unitId: undefined,
       },
       // 列信息
       columns: [
@@ -525,9 +526,11 @@ export default {
         ]
       },
       MarsWordStationOptions:[],//玛氏岗位下拉
+      orignMarsWorkstation:[],//玛氏岗位编辑回显
       selectTreeValue: [],//玛氏
+      selectTreeArrIds:[],//玛氏
       filterText: '',//玛氏
-      treeData: [],//玛氏
+
     };
   },
   watch: {
@@ -576,11 +579,78 @@ export default {
         pages:1
       }
       listMarsDept(data).then(response => {
-        this.MarsWordStationOptions = response.data.records;//初始化数据
+        this.marsOptions = this.handleTree(response.data.records,"workstationId","parentId")
+        this.MarsWordStationOptions = response.data.records;//给新增里的岗位
+        this.orignMarsWorkstation=response.data.records;//给编辑回显文字
+        this.$set(this, 'MarsWordStationOptions', this.transformDataToTree(response.data.records))
+      })
+
+    },
+    //mars新增岗位数据转换
+    transformDataToTree(data) {
+      // 创建一个映射,用于快速查找节点
+      const map = {};
+      const tree = [];
+
+      // 遍历数据,将每个节点放入映射中,并只保留 id 和 label 字段
+      data.forEach(node => {
+        map[node.workstationId] = {
+          id: node.workstationId,
+          label: node.workstationName,
+          children: []
+        };
+      });
+
+      // 再次遍历数据,构建树形结构
+      data.forEach(node => {
+        if (node.parentId !== null && map[node.parentId]) {
+          map[node.parentId].children.push(map[node.workstationId]);
+        } else {
+          tree.push(map[node.workstationId]);
+        }
+      });
 
-        // this.$set(this, 'treeData', this.transformDataToTree(response.data.records));
+      return tree;
+    },
+    // mars岗位移除Tag
+    removeTag(value) {
+      // 从 selectTreeValue 中删除该标签
+      this.selectTreeValue = this.selectTreeValue.filter(item => item.id !== value.id);
+
+      // 获取当前选中的节点列表
+      let setList = this.$refs.treeRef.getCheckedNodes();
+
+      // 过滤掉要取消选中的节点(通过比较 id 或其他标识符)
+      setList = setList.filter(node => node.label !== value).map(item => {return item.id});
+
+      this.$refs.treeRef.setCheckedKeys(setList,true)
+    },
+
+    // mars岗位全部删除
+    clearAll() {
+      this.selectTreeValue = []
+      this.form.workstationIds = []
+      this.$nextTick(() => {
+        this.$refs.treeRef.setCheckedNodes([])
       })
     },
+    // mars岗位新增
+    handleCheckChange() {
+      // getCheckedNodes方法接收两个 boolean 类型的参数: 1. 是否只是叶子节点,默认值为 false 2. 是否包含半选节点,默认值为 false
+      let dataList = this.$refs.treeRef.getCheckedNodes(true)
+      this.selectTreeValue = []
+      this.form.workstationIds = []
+      this.selectTreeArrIds=[]
+      dataList.forEach((item) => {
+        this.selectTreeValue.push({ id: item.id, label: item.label })
+        this.form.workstationIds.push(item.label)
+        this.selectTreeArrIds.push(item.id)
+      })
+    },
+
+    handleWorkstationChange(value) {
+      this.queryParams.workstationId = value;
+    },
     // 筛选节点
     filterNode(value, data) {
       if (!value) return true;
@@ -680,6 +750,7 @@ export default {
         this.UnitOptions = this.handleTree(response.data.records, "unitId");
       })
     },
+    // 单位树
     Unitnormalizer(node){
       if (node.children && !node.children.length) {
         delete node.children;
@@ -690,6 +761,17 @@ export default {
         children: node.children
       };
     },
+    /** 转换mars岗位数据结构 */
+    Marsnormalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.workstationId,
+        label: node.workstationName,
+        children: node.children
+      }
+    },
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
@@ -701,6 +783,12 @@ export default {
         this.title = "添加用户";
         this.form.password = this.initPassword;
       });
+      this.$nextTick(() => {
+        this.$refs.treeRef.setCheckedKeys([]); // 清空选中的节点
+        this.selectTreeValue = [];  // 清空已选中的值
+        this.form.workstationIds = []; // 清空工作站 IDs
+        this.selectTreeArrIds = []; // 清空工作站 ID 数组
+      });
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -715,9 +803,22 @@ export default {
         this.roleOptions = response.roles;
         this.form.postIds = response.postIds;
         this.form.roleIds = response.roleIds;
-        this.form.workstationIds=response.workstationIds
+        // 岗位回显
+        let workstationNames = [];
+        response.workstationIds.forEach(id => {
+          const foundItem = this.orignMarsWorkstation.find(item => item.workstationId == id);
+          console.log(foundItem, 'foundItem');
+          if (foundItem) {
+            workstationNames.push(foundItem.workstationName);
+            console.log(workstationNames);
+          }
+        });
+        // console.log(workstationNames);
+        this.form.workstationIds=workstationNames
+        this.$nextTick(() => {
+          this.$refs.treeRef.setCheckedKeys(response.workstationIds, true);
+        });
         this.form.unitIds=response.unitIds;
-
         this.title = "修改用户";
         this.form.password = "";
       });
@@ -741,29 +842,49 @@ export default {
       const userId = row.userId;
       this.$router.push("/system/user-auth/role/" + userId);
     },
+    // 扁平数据
+    flattenArray(arr) {
+      return arr.reduce((acc, val) => {
+        return acc.concat(Array.isArray(val) ? this.flattenArray(val) : val);
+      }, []);
+    },
+    // 检查新增单位的时候是字符串还是多位数组 始终保持一维数组就行
+    ensureOneDimensionalArray(value) {
+      if (typeof value === 'string') {
+        // 如果是字符串,转换为数组
+        return [value];
+      } else if (Array.isArray(value)) {
+        // 如果是数组,递归展平数组
+        return this.flattenArray(value);
+      } else {
+        // 如果是其他类型,返回空数组或根据需要处理
+        return [];
+      }
+    },
     /** 提交按钮 */
     submitForm: function() {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.userId != undefined) {
 
-            if (!Array.isArray(this.form.unitIds)) {
-              this.form.unitIds = [this.form.unitIds]; // 如果不是数组,转换为数组
-            } else {
-              // 确保数组中的每个元素都是独立的
-              this.form.unitIds = this.form.unitIds.flat();
+            this.form.unitIds = this.ensureOneDimensionalArray(this.form.unitIds);
+            const data={
+              ...this.form,
+              workstationIds: this.selectTreeArrIds
             }
-            updateUser(this.form).then(response => {
+            updateUser(data).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
             });
           } else {
             // 文字转换
-            this.form.unitIds=[this.form.unitIds]
-            console.log(this.form.workstationIds,'新增参数')
-
-            addUser(this.form).then(response => {
+            this.form.unitIds = this.ensureOneDimensionalArray(this.form.unitIds);
+            const data={
+              ...this.form,
+              workstationIds: this.selectTreeArrIds
+            }
+            addUser(data).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();