فهرست منبع

新增设备/工艺表单 新增岗位表单 用户绑定岗位

pm 10 ماه پیش
والد
کامیت
341fabba92

+ 53 - 0
src/api/system/marsdept.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询玛氏岗位列表
+export function listMarsDept(query) {
+  return request({
+    url: '/iscs/workstation/getIsWorkstationPage',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询玛氏岗位列表(排除节点)
+export function listMarsDeptExcludeChild(deptId) {
+  return request({
+    url: '/system/dept/list/exclude/' + deptId,
+    method: 'get'
+  })
+}
+
+// 查询玛氏岗位详细
+export function getMarsDept(deptId) {
+  return request({
+    url: '/iscs/workstation/selectIsWorkstationById?workstationId=' + deptId,
+    method: 'get'
+  })
+}
+
+
+// 新增玛氏岗位
+export function addMarsDept(data) {
+  return request({
+    url: '/iscs/workstation/insertIsWorkstation',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改玛氏岗位
+export function updateMarsDept(data) {
+  return request({
+    url: '/iscs/workstation/updateIsWorkstation',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除玛氏岗位
+export function delMarsDept(deptId) {
+  return request({
+    url: '/iscs/workstation/deleteIsWorkstationByWorkstationIds?workstationIds=' + deptId,
+    method: 'post'
+  })
+}

+ 46 - 0
src/api/system/technology.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+// 查询设备工艺列表
+export function listTechnology(query) {
+  return request({
+    url: '/iscs/technology/getIsDeviceTechnologyPage',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询设备工艺详细
+export function getTechnologyInfo(deptId) {
+  return request({
+    url: '/iscs/technology/selectIsDeviceTechnologyById?technologyId=' + deptId,
+    method: 'get'
+  })
+}
+
+
+// 新增设备工艺
+export function addTechnology(data) {
+  return request({
+    url: '/iscs/technology/insertIsDeviceTechnology',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改设备工艺
+export function updateTechnology(data) {
+  return request({
+    url: '/iscs/technology/updateIsDeviceTechnology',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除设备工艺
+export function delTechnology(deptId) {
+  return request({
+    url: '/iscs/technology/deleteIsDeviceTechnologyByTechnologyIds?technologyIds=' + deptId,
+    method: 'post'
+  })
+}

+ 328 - 0
src/views/system/mars/index.vue

@@ -0,0 +1,328 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+      <el-form-item label="部门名称" prop="deptName">
+        <el-input
+          v-model="queryParams.deptName"
+          placeholder="请输入部门名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="部门状态" clearable>
+          <el-option
+            v-for="dict in dict.type.sys_normal_disable"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <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-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="['system:mars:add']"
+        >新增
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button v-no-more-click
+                   type="info"
+                   plain
+                   icon="el-icon-sort"
+                   size="mini"
+                   @click="toggleExpandAll"
+        >展开/折叠
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table
+      v-if="refreshTable"
+      v-loading="loading"
+      :data="deptList"
+      row-key="workstationId"
+      :default-expand-all="isExpandAll"
+      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+    >
+      <el-table-column prop="workstationCode" label="岗位编码" width="260"></el-table-column>
+      <el-table-column prop="workstationName" label="岗位名称" width="260"></el-table-column>
+      <el-table-column prop="workstationType" label="岗位类型" width="260"></el-table-column>
+
+      <el-table-column label="创建时间" align="center" prop="createTime" width="200">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button v-no-more-click
+                     size="mini"
+                     type="text"
+                     icon="el-icon-edit"
+                     @click="handleUpdate(scope.row)"
+                     v-hasPermi="['system:mars:edit']"
+          >修改
+          </el-button>
+          <el-button v-no-more-click
+                     size="mini"
+                     type="text"
+                     icon="el-icon-plus"
+                     @click="handleAdd(scope.row)"
+                     v-hasPermi="['system:mars:add']"
+          >新增
+          </el-button>
+          <el-button v-no-more-click
+                     v-if="scope.row.parentId != 0"
+                     size="mini"
+                     type="text"
+                     icon="el-icon-delete"
+                     @click="handleDelete(scope.row)"
+                     v-hasPermi="['system:mars:remove']"
+          >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 添加或修改部门对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+
+        <el-form-item label="上级" prop="parentId" v-if="form.parentId !== 0">
+          <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级"/>
+        </el-form-item>
+
+        <el-form-item label="岗位名称" prop="workstationName">
+          <el-input v-model="form.workstationName" placeholder="请输入岗位名称"/>
+        </el-form-item>
+        <el-row>
+          <el-col :span="18">
+            <el-form-item label="岗位编号" prop="workstationCode">
+              <el-input
+                v-model="form.workstationCode"
+                placeholder="请输入岗位编号"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label-width="30">
+              <el-switch
+                v-model="autoGenFlag"
+                active-color="#13ce66"
+                active-text="自动生成"
+                @change="handleAutoGenChange(autoGenFlag)"
+              >
+              </el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="岗位类型" prop="workstationType">
+          <el-input v-model="form.workstationType" placeholder="请输入岗位类型" maxlength="20"/>
+        </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>
+
+<script>
+import {
+  listMarsDept,
+  listMarsDeptExcludeChild,
+  getMarsDept,
+  addMarsDept,
+  updateMarsDept,
+  delMarsDept
+} from '@/api/system/marsdept'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { genCode } from '@/api/system/autocode/rule'
+
+export default {
+  name: 'Dept',
+  dicts: ['sys_normal_disable'],
+  components: { Treeselect },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      //自动生成编码
+      autoGenFlag: false,
+      // 显示搜索条件
+      showSearch: true,
+      // 表格树数据
+      deptList: [],
+      // 部门树选项
+      deptOptions: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 是否展开,默认全部展开
+      isExpandAll: true,
+      // 重新渲染表格状态
+      refreshTable: true,
+      // 查询参数
+      queryParams: {
+        pages:1,
+        size:-1,
+        deptName: undefined,
+        status: undefined
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        parentId: [
+          { required: true, message: '上级部门不能为空', trigger: 'blur' }
+        ],
+        workstationName: [
+          { required: true, message: '部门名称不能为空', trigger: 'blur' }
+        ],
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /** 查询部门列表 */
+    getList() {
+      this.loading = true
+      listMarsDept(this.queryParams).then(response => {
+        debugger;
+        this.deptList = this.handleTree(response.data.records,"workstationId","parentId")
+        console.log(this.deptList,'岗位列表')
+        this.loading = false
+      })
+    },
+    /** 转换部门数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.workstationId,
+        label: node.workstationName,
+        children: node.children
+      }
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        workstationId: undefined,
+        parentId: undefined,
+        workstationName: undefined,
+      }
+      this.autoGenFlag = false;
+      this.resetForm('form')
+    },
+    //自动生成编码
+    handleAutoGenChange(autoGenFlag) {
+      if (autoGenFlag) {
+        genCode("MARS_WORKSTATION").then((response) => {
+          console.log(response,'玛氏编码');
+          this.form.workstationCode = response;
+        });
+      } else {
+        this.form.workstationCode = null;
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    /** 新增按钮操作 */
+    handleAdd(row) {
+      this.reset()
+      if (row != null && row.workstationId) {
+        this.form.parentId = row.workstationId;
+      } else {
+        this.form.parentId = 0;
+      }
+      this.open = true
+      this.title = '添加部门'
+      listMarsDept(this.queryParams).then(response => {
+        this.deptOptions = this.handleTree(response.data.records,"workstationId","parentId")
+      })
+    },
+    /** 展开/折叠操作 */
+    toggleExpandAll() {
+      this.refreshTable = false
+      this.isExpandAll = !this.isExpandAll
+      this.$nextTick(() => {
+        this.refreshTable = true
+      })
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      getMarsDept(row.workstationId).then(response => {
+        this.form = response.data
+        this.open = true
+        this.title = '修改部门'
+      })
+      listMarsDeptExcludeChild(row.workstationId).then(response => {
+        this.deptOptions = this.handleTree(response.data.records,"workstationId","parentId")
+      })
+    },
+    /** 提交按钮 */
+    submitForm: function() {
+      this.$refs['form'].validate(valid => {
+        if (valid) {
+          if (this.form.workstationId != undefined) {
+            updateMarsDept(this.form).then(response => {
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
+          } else {
+            addMarsDept(this.form).then(response => {
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
+          }
+        }
+      })
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      this.$modal.confirm('是否确认删除名称为"' + row.workstationName + '"的数据项?').then(function() {
+        return delMarsDept(row.workstationId)
+      }).then(() => {
+        this.getList()
+        this.$modal.msgSuccess('删除成功')
+      }).catch(() => {
+      })
+    }
+  }
+}
+</script>

+ 344 - 0
src/views/system/technology/technologyList/index.vue

@@ -0,0 +1,344 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+      <el-form-item label="设备/工艺编号" prop="technologyCode">
+        <el-input
+          v-model="queryParams.technologyCode"
+          placeholder="请输入设备/工艺编号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="设备/工艺名称" prop="technologyName">
+        <el-input
+          v-model="queryParams.technologyName"
+          placeholder="请输入部门名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item>
+        <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-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:technology:add']"
+        >新增
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button v-no-more-click
+                   type="info"
+                   plain
+                   icon="el-icon-sort"
+                   size="mini"
+                   @click="toggleExpandAll"
+        >展开/折叠
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table
+      v-if="refreshTable"
+      v-loading="loading"
+      :data="deptList"
+      row-key="workstationId"
+      :default-expand-all="isExpandAll"
+      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+    >
+      <el-table-column prop="technologyCode" label="设备/工艺编码" width="260"></el-table-column>
+      <el-table-column prop="technologyName" label="设备/工艺名称" width="260"></el-table-column>
+      <el-table-column prop="technologyType" label="设备/工艺类型" width="260"></el-table-column>
+      <el-table-column prop="workstationName" label="所属岗位" width="260"></el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime" width="200">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button v-no-more-click
+                     size="mini"
+                     type="text"
+                     icon="el-icon-edit"
+                     @click="handleUpdate(scope.row)"
+                     v-hasPermi="['iscs:technology:edit']"
+          >修改
+          </el-button>
+          <el-button v-no-more-click
+                     size="mini"
+                     type="text"
+                     icon="el-icon-plus"
+                     @click="handleAdd(scope.row)"
+                     v-hasPermi="['iscs:technology:add']"
+          >新增
+          </el-button>
+          <el-button v-no-more-click
+                     v-if="scope.row.parentId != 0"
+                     size="mini"
+                     type="text"
+                     icon="el-icon-delete"
+                     @click="handleDelete(scope.row)"
+                     v-hasPermi="['iscs:technology:remove']"
+          >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 添加或修改部门对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="110px">
+
+        <el-form-item label="上级" prop="parentId" >
+          <treeselect v-model="form.parentId" :options="technologyOptions" :normalizer="normalizer" placeholder="选择上级"/>
+        </el-form-item>
+
+        <el-form-item label="设备/工艺名称" prop="technologyName">
+          <el-input v-model="form.technologyName" placeholder="请输入设备/工艺名称"/>
+        </el-form-item>
+        <el-row>
+          <el-col :span="18">
+            <el-form-item label="设备/工艺编号" prop="workstationCode">
+              <el-input
+                v-model="form.technologyCode"
+                placeholder="请输入设备/工艺编号"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label-width="30">
+              <el-switch
+                v-model="autoGenFlag"
+                active-color="#13ce66"
+                active-text="自动生成"
+                @change="handleAutoGenChange(autoGenFlag)"
+              >
+              </el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="设备/工艺类型" prop="technologyType">
+          <el-input v-model="form.technologyType" placeholder="请输入设备/工艺类型" maxlength="20"/>
+        </el-form-item>
+        <el-form-item label="所属mars岗位" prop="workstationId" >
+        <treeselect v-model="form.workstationId" :options="marsOptions" :normalizer="Marsnormalizer" placeholder="选择mars岗位"/>
+        </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>
+
+<script>
+import {
+  listTechnology, addTechnology, updateTechnology, delTechnology, getTechnologyInfo
+} from '@/api/system/technology'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { genCode } from '@/api/system/autocode/rule'
+import { listMarsDept } from '@/api/system/marsdept'
+
+export default {
+  name: 'Dept',
+  dicts: ['sys_normal_disable'],
+  components: { Treeselect },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      //自动生成编码
+      autoGenFlag: false,
+      // 显示搜索条件
+      showSearch: true,
+      // 表格树数据
+      deptList: [],
+      // mars树选项
+      marsOptions: [],
+      //工艺树
+      technologyOptions:[],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 是否展开,默认全部展开
+      isExpandAll: true,
+      // 重新渲染表格状态
+      refreshTable: true,
+      // 查询参数
+      queryParams: {
+        pages:1,
+        size:-1,
+        technologyName: undefined,
+        technologyCode: undefined
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        technologyCode: [
+          { required: true, message: '设备/工艺编码不能为空', trigger: 'blur' }
+        ],
+        technologyName: [
+          { required: true, message: '设备/工艺名称不能为空', trigger: 'blur' }
+        ],
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /** 查询部门列表 */
+    getList() {
+      this.loading = true
+      listTechnology(this.queryParams).then(response => {
+        debugger;
+        this.deptList = this.handleTree(response.data.records,"technologyId","parentId")
+        this.technologyOptions = this.handleTree(response.data.records,"technologyId","parentId")
+        console.log(this.deptList,'设备/工艺列表')
+        this.loading = false
+      })
+      const data={
+        pasge:1,
+        size:-1
+      }
+      listMarsDept(data).then(response => {
+        this.marsOptions = this.handleTree(response.data.records,"workstationId","parentId")
+      })
+    },
+    /** 转换部门数据结构 */
+    Marsnormalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.workstationId,
+        label: node.workstationName,
+        children: node.children
+      }
+    },
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.technologyId,
+        label: node.technologyName,
+        children: node.children
+      }
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        technologyId: undefined,
+        parentId: undefined,
+        technologyName: undefined,
+      }
+      this.autoGenFlag = false;
+      this.resetForm('form')
+    },
+    //自动生成编码
+    handleAutoGenChange(autoGenFlag) {
+      if (autoGenFlag) {
+        genCode("TECHNOLOGY_CODE").then((response) => {
+          console.log(response,'设备工艺编码');
+          this.form.technologyCode = response;
+        });
+      } else {
+        this.form.technologyCode = null;
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+
+    /** 展开/折叠操作 */
+    toggleExpandAll() {
+      this.refreshTable = false
+      this.isExpandAll = !this.isExpandAll
+      this.$nextTick(() => {
+        this.refreshTable = true
+      })
+    },
+    /** 新增按钮操作 */
+    handleAdd(row) {
+      this.reset()
+      if (row != null && row.technologyId) {
+        this.form.parentId = row.technologyId;
+      } else {
+        this.form.parentId = 0;
+      }
+      this.open = true
+      this.title = '添加部门'
+
+
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      getTechnologyInfo(row.technologyId).then(response => {
+        this.form = response.data
+        this.open = true
+        this.title = '修改部门'
+
+      })
+    },
+    /** 提交按钮 */
+    submitForm: function() {
+      this.$refs['form'].validate(valid => {
+        if (valid) {
+          if (this.form.technologyId != undefined) {
+            updateTechnology(this.form).then(response => {
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
+          } else {
+            addTechnology(this.form).then(response => {
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
+          }
+        }
+      })
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      this.$modal.confirm('是否确认删除名称为"' + row.technologyName + '"的数据项?').then(function() {
+        return delTechnology(row.technologyId)
+      }).then(() => {
+        this.getList()
+        this.$modal.msgSuccess('删除成功')
+      }).catch(() => {
+      })
+    }
+  }
+}
+</script>

+ 143 - 2
src/views/system/user/index.vue

@@ -294,6 +294,20 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="玛氏岗位" prop="workstationId">
+              <el-select size="small" v-model="form.workstationIds" placeholder="请选择" :popper-append-to-body="false" multiple clearable
+                         @remove-tag="removeTag" >
+                <el-option :value="selectTreeValue" class="setstyle" disabled>
+                  <el-input class="setinput" size="mini" placeholder="输入关键字进行过滤" clearable v-model="filterText"></el-input>
+                  <el-tree :data="treeData" check-strictly default-expand-all show-checkbox node-key="id" ref="treeRef" highlight-current
+                           :filter-node-method="MardfilterNode" :props="defaultProps" @check-change="handleCheckChange"></el-tree>
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-row>
           <el-col :span="24">
             <el-form-item label="备注">
@@ -342,6 +356,7 @@
 
 <script>
 import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
+import {listMarsDept} from "@/api/system/marsdept"
 import { getToken } from "@/utils/auth";
 import { treeselect } from "@/api/system/dept";
 import Treeselect from "@riophae/vue-treeselect";
@@ -450,13 +465,20 @@ export default {
             trigger: "blur"
           }
         ]
-      }
+      },
+      MarsWordStationOptions:[],//玛氏岗位下拉
+      selectTreeValue: [],//玛氏
+      filterText: '',//玛氏
+      treeData: [],//玛氏
     };
   },
   watch: {
     // 根据名称筛选部门树
     deptName(val) {
       this.$refs.tree.filter(val);
+    },
+    filterText(val) {
+      this.$refs.treeRef.filter(val)
     }
   },
   created() {
@@ -476,6 +498,101 @@ export default {
           this.loading = false;
         }
       );
+      const data={
+        size:-1,
+        pages:1
+      }
+      listMarsDept(data).then(response => {
+        this.MarsWordStationOptions = response.data.records;//初始化数据
+        this.$set(this, 'treeData', this.transformDataToTree(response.data.records));
+      })
+    },
+    // 树形结构
+    transformDataToTree(data) {
+      const map = {};
+
+      // 将所有节点放入 map 中,方便查找
+      data.forEach(node => {
+        map[node.workstationId] = { id: node.workstationId, label: node.workstationName, children: [] };
+      });
+
+      // 构建树形结构
+      const roots = [];
+      data.forEach(node => {
+        if (node.parentId == 0 || node.parentId == null) {
+          roots.push(map[node.workstationId]);
+        } else {
+          if (map[node.parentId]) {
+            map[node.parentId].children.push(map[node.workstationId]);
+          }
+        }
+      });
+
+      return roots;
+    },
+    // 新增节点回显
+    addTag(node) {
+      this.selectTreeValue.push({ id: node.id, label: node.label });
+      this.form.workstationIds.push(node.label);
+
+      // 更新树的选中状态
+      this.$nextTick(() => {
+        this.$refs.treeRef.setCheckedNodes(this.selectTreeValue.map(item => ({ id: item.id, label: item.label })));
+      });
+    },
+
+    // 移除Tag
+    removeTag(nodeLabel) {
+      // 删除 selectTreeValue 中对应的节点
+      const indexValue = this.selectTreeValue.findIndex(item => item.label === nodeLabel);
+      if (indexValue !== -1) {
+        const removedNode = this.selectTreeValue[indexValue];
+        this.selectTreeValue.splice(indexValue, 1);
+
+        // 更新树的选中状态(取消选中节点)
+        this.$nextTick(() => {
+          this.$refs.treeRef.setChecked(removedNode.id, false);
+        });
+      }
+
+      // 删除 form.workstationIds 中的对应节点
+      const indexForm = this.form.workstationIds.findIndex(item => item === nodeLabel);
+      if (indexForm !== -1) {
+        this.form.workstationIds.splice(indexForm, 1);
+      }
+    },
+
+    // 编辑回显选中节点
+    editTag(workstationIds) {
+      console.log(workstationIds,'workstationIds')
+      const workstationNames = workstationIds.map(workstationId => {
+        const record = this.MarsWordStationOptions.find(record => record.workstationId === workstationId);
+        return record ? { id: record.workstationId, label: record.workstationName } : null;
+      }).filter(node => node !== null);
+
+      // 更新到 form
+      this.form.workstationIds = workstationNames.map(node => node.label);
+
+      // 同步树选中状态
+      this.selectTreeValue = workstationNames;
+      this.$nextTick(() => {
+        this.$refs.treeRef.setCheckedNodes(workstationNames);
+      });
+    },
+    // 节点选中
+    handleCheckChange(data, checked, indeterminate) {
+      if (checked) {
+        this.addTag(data); // 调用 addTag 方法
+      } else {
+        this.removeTag(data.label); // 调用 removeTag 方法
+
+      }
+    },
+
+    // 玛氏筛选节点
+    MardfilterNode(value, data){
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
     },
     /** 查询部门下拉树结构 */
     getTreeselect() {
@@ -575,14 +692,18 @@ export default {
     handleUpdate(row) {
       this.reset();
       this.getTreeselect();
+
       const userId = row.userId || this.ids;
       getUser(userId).then(response => {
+        this.open = true;
         this.form = response.data;
         this.postOptions = response.posts;
         this.roleOptions = response.roles;
         this.form.postIds = response.postIds;
         this.form.roleIds = response.roleIds;
-        this.open = true;
+        //查找并转换
+        this.editTag(response.workstationIds)
+
         this.title = "修改用户";
         this.form.password = "";
       });
@@ -617,6 +738,13 @@ export default {
               this.getList();
             });
           } else {
+            // 文字转换
+            const workstationIds = this.form.workstationIds.map(deviceName => {
+              const record = this.MarsWordStationOptions.find(record => record.workstationName == deviceName);
+              return record ? record.workstationId : null;
+            }).filter(id => id !== null);
+            this.form.workstationIds=workstationIds
+            console.log(this.form,'新增参数')
             addUser(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
@@ -671,3 +799,16 @@ export default {
   }
 };
 </script>
+<style lang="scss" scoped>
+.container {
+  padding: 20px;
+}
+
+.setstyle {
+  height: auto;
+  padding: 0 !important;
+  .setinput {
+    padding: 6px;
+  }
+}
+</style>