Explorar o código

修改设备管理菜单路径与工艺下的sop新增删除操作新增 检查系统问题

pm hai 10 meses
pai
achega
0edf91b890

+ 6 - 6
src/router/index.js

@@ -204,14 +204,14 @@ export const dynamicRoutes = [
   },
   // 工艺详情
   {
-    path: '/system/technology/technologyDetail',
+    path: '/mes/dv/technology/technologyDetail',
     component: Layout,
     hidden: true,
     permissions: ['iscs:machinery:list'],
     children: [
       {
         path: 'CraftDetail',
-        component: () => import('@/views/system/technology/technologyDetail/CraftDetail.vue'),
+        component: () => import('@/views/mes/dv/technology/technologyDetail/CraftDetail'),
         name: 'CraftDetail',
         meta: { title: '工艺详情' }
       }
@@ -219,14 +219,14 @@ export const dynamicRoutes = [
   },
   // 设备详情
   {
-    path: '/system/technology/technologyDetail',
+    path: '/mes/dv/technology/technologyDetail',
     component: Layout,
     hidden: true,
     permissions: ['iscs:machinery:list'],
     children: [
       {
         path: 'DeviceDetail',
-        component: () => import('@/views/system/technology/technologyDetail/DeviceDetail.vue'),
+        component: () => import('@/views/mes/dv/technology/technologyDetail/DeviceDetail'),
         name: 'DeviceDetail',
         meta: { title: '设备详情' }
       }
@@ -247,14 +247,14 @@ export const dynamicRoutes = [
     ]
   },
   {
-    path: '/system/technology/technologyList/index',
+    path: '/mes/dv/technology/technologyList/index',
     component: Layout,
     hidden: true,
     permissions: ['iscs:machinery:list'],
     children: [
       {
         path: 'MapData',
-        component: () => import('@/views/system/technology/technologyList/MapData'),
+        component: () => import('@/views/mes/dv/technology/technologyList/MapData'),
         name: 'MapData',
         meta: { title: '设置隔离点', activeMenu: '/system/technology/technologyList/MapData' }
       }

+ 196 - 163
src/views/system/technology/technologyDetail/CraftDetail.vue → src/views/mes/dv/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="['iscs:machinery:remove']"
+          >批量删除
+          </el-button
+          >
+        </el-col>
         <!-- <el-col :span="1.5">
           <el-button
             v-no-more-click
@@ -136,35 +136,31 @@
     <div class="sopList" v-if="this.tabPosition == 'sopList'">
       <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="handleAddSopList"-->
-<!--            v-hasPermi="['iscs:machinery:add']"-->
-<!--          >新增-->
-<!--          </el-button>-->
+          <el-button
+            v-no-more-click
+            type="primary"
+            plain
+            icon="el-icon-plus"
+            size="mini"
+            @click="handleAddSopList"
+            v-hasPermi="['iscs:machinery: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="handleSopDelete"
+            v-hasPermi="['iscs:machinery:remove']"
+          >批量删除
+          </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:machinery:remove']"-->
-<!--          >批量删除-->
-<!--          </el-button-->
-<!--          >-->
-
-<!--        <right-toolbar-->
-<!--          :showSearch.sync="showSearch"-->
-<!--          @queryTable="getList"-->
-<!--        ></right-toolbar>-->
       </el-row>
 
       <el-table
@@ -174,7 +170,7 @@
         row-key="machineryId"
         :default-expand-all="isExpandAll"
         :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
-        @selection-change="handleSelectionChange"
+        @selection-change="handleSelectionSopChange"
       >
         <el-table-column type="selection" width="55" align="center"/>
 
@@ -192,15 +188,15 @@
           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:machinery:edit']"-->
-<!--            >编辑-->
-<!--            </el-button>-->
+            <el-button
+              v-no-more-click
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleSopUpdate(scope.row)"
+              v-hasPermi="['iscs:machinery:edit']"
+            >编辑
+            </el-button>
             <!-- <el-button
                 v-no-more-click
                 size="mini"
@@ -216,7 +212,7 @@
               size="mini"
               type="text"
               icon="el-icon-delete"
-              @click="handleDelete(scope.row)"
+              @click="handleSopDelete(scope.row)"
               v-hasPermi="['iscs:machinery:remove']"
             >删除
             </el-button>
@@ -239,7 +235,7 @@
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
-    <!-- 添加或修改设备对话框 -->
+    <!-- 添加或修改设备列表对话框 -->
     <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">-->
@@ -282,9 +278,10 @@
         <el-form-item label="岗位" prop="workstationId">
           <treeselect
             v-model="form.workstationId"
-            :options="marsOptions"
+            :options="formMarsOptions"
             :normalizer="Marsnormalizer"
             placeholder="请选择岗位"
+            disabled
           />
         </el-form-item>
         <el-form-item label="所属电柜" prop="lotoId">
@@ -292,6 +289,7 @@
             style="width: 300px"
             v-model="form.lotoId"
             placeholder="请选择所属电柜"
+            disabled
           >
             <el-option
               v-for="dict in LotoOptions"
@@ -301,13 +299,6 @@
             />
           </el-select>
         </el-form-item>
-        <!--        <el-form-item label="设备类型" prop="machineryType">-->
-        <!--          <el-input-->
-        <!--            v-model="form.machineryType"-->
-        <!--            placeholder="请输入设备类型"-->
-        <!--          />-->
-        <!--        </el-form-item>-->
-
         <el-form-item label="设备图" prop="machineryImg">
           <ImageUploadSingle
             :limit="1"
@@ -327,30 +318,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="titlesop" :visible.sync="openSop" width="470px" append-to-body>
+      <el-form ref="sopform" :model="sopform" :rules="rules" label-width="100px">
+        <el-form-item label="所属岗位" prop="workstationId" >
+          <treeselect v-model="sopform.workstationId" :options="marsOptions"  :normalizer="Marsnormalizer" placeholder="选择岗位" disabled/>
+        </el-form-item>
+        <el-form-item label="设备/工艺" prop="machineryId" >
+          <treeselect v-model="sopform.machineryId" :options="machineryOptions"  :normalizer="normalizer" placeholder="选择设备/工艺" disabled/>
+        </el-form-item>
+        <el-form-item label="SOP类型" prop="sopType">
+          <el-select v-model="sopform.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="submitSopForm">确 定</el-button>
+        <el-button v-no-more-click @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -367,8 +358,13 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 import { genCode } from '@/api/system/autocode/rule'
 import { listMarsDept } from '@/api/system/marsdept'
 import { listLoto } from '@/api/mes/lotoStation/lotoStation'
-import MapData from '@/views/system/technology/technologyDetail/MapData.vue'
-import { getIsMarsSopPage } from '@/api/mes/sop/sopindex'
+import MapData from '@/views/mes/dv/technology/technologyDetail/MapData.vue'
+import {
+  addinsertIsMarsSop,
+  deleteIsMarsSopByMarsSopIds,
+  getIsMarsSopPage, selectIsMarsSopById,
+  updateIsMarsSop
+} from '@/api/mes/sop/sopindex'
 import Tinymce from '@/components/tinymce/example/Index.vue'
 import { delMachinery } from '@/api/mes/dv/machinery'
 export default {
@@ -392,12 +388,15 @@ export default {
       deptList: [],
       // mars树选项
       marsOptions: [],
+      // 新增设备时 岗位树结构
+      formMarsOptions:[],
       //工艺树
       machineryOptions: [],
       // 电柜
       lotoOptions: [],
       // 弹出层标题
       title: '',
+      titlesop:'',
       // 是否显示弹出层
       open: false,
       openSop:false,//新增sop列表
@@ -416,15 +415,19 @@ export default {
       LotoOptions: [], //电柜绑定
       // 表单参数
       form: {
-        machineryType: '设备',
-        machineryId: undefined,
 
       },
+      sopform:{
+
+      },
+      ids:null,//设备列表多选
+      sopids:null,//sop列表多选
       SopList: [],//sopLisT
       queryParamsSop: {
         current: 1,
         size: 10,
         machineryId: undefined,
+        machineryType:undefined,
       },
       machineryId:null,//
       // 表单校验
@@ -444,23 +447,7 @@ export default {
   },
 
   watch: {
-    'form.workstationId': function(newVal, oldVal) {
-      if (newVal) {
-        const data = {
-          pasge: 1,
-          size: -1,
-          workstationId: this.form.workstationId
-        }
-        listLoto(data).then((response) => {
-          this.LotoOptions = response.data.records.map((item) => {
-            return {
-              value: item.lotoId,
-              label: item.lotoName
-            }
-          })
-        })
-      }
-    },
+
     // 监听 tabPosition 的变化
     tabPosition(newVal) {
       if (newVal === 'craftInformation') {
@@ -472,6 +459,8 @@ export default {
   created() {
     this.getList()
     this.getOtherList()
+    this.getTechnologyAllData()
+
     this.form.machineryId = this.$route.query.machineryId
     this.machineryId = this.$route.query.machineryId
   },
@@ -479,37 +468,41 @@ export default {
     /** 查询部门列表 */
     getList() {
       this.loading = true
-      listTechnology(this.queryParams).then((response) => {
+        const data={
+        ...this.queryParams,
+          parentId: this.$route.query.machineryId,
+          machineryType:'设备'
+        }
+      listTechnology(data).then((response) => {
         debugger;
-        const filterData = response.data.records.filter(item => {
-          return item.parentId == this.machineryId
-        })
+        const filterData = response.data.records
         this.total1=response.data.total
         this.deptList = filterData
-        const data=response.data.records.filter((item) =>item.machineryType=='工艺')
-        this.machineryOptions = this.handleTree(
-          data,
-          'machineryId',
-          'parentId'
-        )
-
         this.loading = false
       })
 
     },
-    getOtherList(){
-      const data = {
+
+    // 获取sop新增选设备工艺的回显数据
+    getTechnologyAllData(){
+      const data={
+        current: 1,
+        size: -1,
+      }
+      listTechnology(data).then((response) => {
+        this.machineryOptions = response.data.records
+        this.loading = false
+      })
+      const data1 = {
         pasge: 1,
         size: -1
       }
-      listMarsDept(data).then((response) => {
-        this.marsOptions = this.handleTree(
-          response.data.records,
-          'workstationId',
-          'parentId'
-        )
+      listMarsDept(data1).then((response) => {
+        this.marsOptions = response.data.records
+        // 下面数据是给新增设备的时候回显数据
+        this.formMarsOptions = this.handleTree(response.data.records,"workstationId","parentId")
       })
-      listLoto(data).then((response) => {
+      listLoto(data1).then((response) => {
         this.LotoOptions = response.data.records.map((item) => {
           return {
             value: item.lotoId,
@@ -518,6 +511,8 @@ export default {
         })
       });
 
+    },
+    getOtherList(){
       this.queryParamsSop.machineryId=this.$route.query.machineryId
       getIsMarsSopPage(this.queryParamsSop).then(response => {
         debugger;
@@ -538,16 +533,6 @@ export default {
       }
     },
     /** 转换mars岗位数据结构 */
-    // 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
@@ -558,15 +543,7 @@ export default {
         children: node.children
       }
     },
-    // 地图预览
-    look(row) {
-      console.log(row, 'row预览')
-      const data = row.lotoId
-      this.$router.push(
-        `/system/technology/technologyList/index/MapData?lotoId=${data}&machineryId=${row.machineryId}`
-      )
-      // this.dialogVisibleMap = true; // 显示地图预览弹框
-    },
+
     // 取消按钮
     cancel() {
       this.open = false
@@ -583,6 +560,7 @@ export default {
       }
       this.autoGenFlag = false
       this.resetForm('form')
+      this.resetForm('sopform')
     },
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
@@ -621,24 +599,37 @@ export default {
         this.refreshTable = true
       })
     },
+    callback(openType) {
+      getTechnologyInfo(this.$route.query.machineryId).then((response) => {
+        console.log(response, '工艺新增sop');
+        this.sopform.workstationId = response.data.workstationId;
+        this.sopform.machineryId = response.data.machineryId;
+        this.form.workstationId = response.data.workstationId;
+        this.form.lotoId = response.data.lotoId;
+        this.form.machineryType = '设备';
+        console.log(this.form, '工艺新增sop-id--设备的回显');
+
+        // 根据 openType 打开不同的弹窗
+        if (openType === 'device') {
+          this.open = true;
+          this.title = '添加设备';
+        } else if (openType === 'sop') {
+          this.openSop = true;
+          this.titlesop = '添加SOP';
+        }
+      });
+    },
     /** 新增按钮操作 */
-    handleAdd(row) {
-      this.reset()
-      if (row != null && row.machineryId) {
-        this.form.parentId = row.machineryId
-      } else {
-        this.form.parentId = this.$route.query.machineryId
-      }
-      this.form.machineryType='设备'
-      this.open = true
-      this.title = '添加设备'
+    handleAdd() {
+      this.reset();
+      this.form.parentId = this.$route.query.machineryId;
+      this.callback('device');
+    },
+    /** 新增sop按钮操作 */
+    handleAddSopList() {
+      this.reset();
+      this.callback('sop');
     },
-    // handleAddSopList() {
-    //   console.log('新增sop')
-    //   this.reset()
-    //   this.openSop = true
-    //   this.title = '添加sop'
-    // },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset()
@@ -649,7 +640,14 @@ export default {
         this.title = '修改设备'
       })
     },
-
+    handleSopUpdate(row) {
+      this.reset()
+      selectIsMarsSopById(row.sopId).then(response => {
+        this.sopform = response.data
+        this.openSop = true
+        this.titlesop = '修改SOP'
+      })
+    },
     /** 提交按钮 */
     submitForm: function() {
       this.$refs['form'].validate((valid) => {
@@ -670,6 +668,26 @@ export default {
         }
       })
     },
+    // sop新增
+    submitSopForm: function() {
+      this.$refs['sopform'].validate((valid) => {
+        if (valid) {
+          if (this.sopform.sopId != undefined) {
+            updateIsMarsSop(this.sopform).then(response => {
+              this.$modal.msgSuccess('修改成功')
+              this.openSop = false
+              this.getOtherList()
+            })
+          } else {
+            addinsertIsMarsSop(this.sopform).then(response => {
+              this.$modal.msgSuccess('新增成功')
+              this.openSop = false
+              this.getOtherList()
+            })
+          }
+        }
+      })
+    },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.machineryId)
@@ -677,6 +695,12 @@ export default {
       this.single = selection.length !== 1
       this.multiple = !selection.length
     },
+    // sop列表多选
+    handleSelectionSopChange(selection) {
+      this.sopids = selection.map((item) => item.sopId)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
     /** 删除按钮操作 */
     handleDelete(row) {
       const machineryIds = row.machineryId || this.ids;
@@ -687,6 +711,15 @@ export default {
         this.$modal.msgSuccess("删除成功");
       }).catch(() => {});
 
+    },
+    handleSopDelete(row){
+      const sopIds = row.sopId || this.sopids;
+      this.$modal.confirm('确认删除数据项?').then(function() {
+        return deleteIsMarsSopByMarsSopIds(sopIds);
+      }).then(() => {
+        this.getOtherList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
     }
   }
 }

+ 1 - 1
src/views/system/technology/technologyDetail/DeviceDetail.vue → src/views/mes/dv/technology/technologyDetail/DeviceDetail.vue

@@ -117,7 +117,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import { genCode } from "@/api/system/autocode/rule";
 import { listMarsDept } from "@/api/system/marsdept";
 import { listLoto } from "@/api/mes/lotoStation/lotoStation";
-import MapData from '@/views/system/technology/technologyDetail/MapData.vue'
+import MapData from '@/views/mes/dv/technology/technologyDetail/MapData.vue'
 import Tinymce from '@/components/tinymce/example/Index.vue'
 export default {
   name: "Dept",

+ 0 - 0
src/views/system/technology/technologyDetail/MapData.vue → src/views/mes/dv/technology/technologyDetail/MapData.vue


+ 0 - 0
src/views/system/technology/technologyList/MapData.vue → src/views/mes/dv/technology/technologyList/MapData.vue


+ 12 - 16
src/views/system/technology/technologyList/index.vue → src/views/mes/dv/technology/technologyList/index.vue

@@ -94,7 +94,7 @@
               size="mini"
               :disabled="multiple"
               @click="handleDelete"
-              v-hasPermi="['mes:hw:information:batchremove']"
+              v-hasPermi="['iscs:machinery:remove']"
             >批量删除
             </el-button>
           </el-col>
@@ -675,7 +675,7 @@ export default {
       console.log(row, 'row预览')
       const data = row.lotoId
       this.$router.push(
-        `/system/technology/technologyList/index/MapData?lotoId=${data}&machineryId=${row.machineryId}`
+        `/mes/dv/technology/technologyList/index/MapData?lotoId=${data}&machineryId=${row.machineryId}`
       )
       // this.dialogVisibleMap = true; // 显示地图预览弹框
     },
@@ -777,10 +777,10 @@ export default {
     handleLook(row) {
       // 工艺详情
       if (this.tabPosition == "craft") {
-        this.$router.push("/system/technology/technologyDetail/CraftDetail?machineryId=" + row.machineryId);
+        this.$router.push("/mes/dv/technology/technologyDetail/CraftDetail?machineryId=" + row.machineryId);
       } else {
         // 设备详情
-        this.$router.push("/system/technology/technologyDetail/DeviceDetail?machineryId=" + row.machineryId);
+        this.$router.push("/mes/dv/technology/technologyDetail/DeviceDetail?machineryId=" + row.machineryId);
       }
     },
 
@@ -809,24 +809,20 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.id)
+      this.ids = selection.map((item) => item.machineryId)
       this.codes = selection.map((item) => item.machineryCode)
       this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      this.$modal
-        .confirm('是否确认删除名称为"' + row.machineryName + '"的数据项?')
-        .then(function() {
-          return delTechnology(row.machineryId)
-        })
-        .then(() => {
-          this.getList()
-          this.$modal.msgSuccess('删除成功')
-        })
-        .catch(() => {
-        })
+      const machineryIds = row.machineryId || this.ids;
+      this.$modal.confirm('确认删除数据项?').then(function() {
+        return delTechnology(machineryIds);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
     }
   }
 }

+ 204 - 133
src/views/mes/material/collectionmanagement/index.vue

@@ -8,13 +8,20 @@
       v-show="showSearch"
       label-width="100px"
     >
-      <el-form-item label="物资编码" prop="materialsCode">
-        <el-input
-          v-model="queryParams.materialsCode"
-          placeholder="请输入物资编码"
+      <el-form-item label="物资柜" prop="loanFromId">
+        <el-select
+          style="width: 215px"
+          v-model="queryParams.loanFromId"
+          placeholder="请选择物资柜"
           clearable
-          @keyup.enter.native="handleQuery"
-        />
+        >
+          <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="materialsName">
         <el-input
@@ -24,6 +31,15 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="物资类型" prop="materialsTypeId">
+        <treeselect
+          style="width: 215px"
+          v-model="queryParams.materialsTypeId"
+          :options="machinerytypeOptions"
+          :normalizer="normalizer"
+          placeholder="请选择物资类型"
+        />
+      </el-form-item>
       <el-form-item label="领取人" prop="loanUserName">
         <el-input
           v-model="queryParams.loanUserName"
@@ -32,39 +48,76 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="是否需要归还" prop="restitutionRequired">
-        <el-select
-          v-model="queryParams.restitutionRequired"
-          placeholder="是否需要归还"
+      <el-form-item label="领取时间" prop="">
+        <el-date-picker
+          style="width: 215px"
+          :default-time="['00:00:00', '23:59:59']"
+          v-model="loanTime"
+          type="datetimerange"
+          :picker-options="pickerOptions"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          align="right"
         >
-          <el-option value="1" label="是"></el-option>
-          <el-option value="2" label="否"></el-option>
-        </el-select>
+        </el-date-picker>
       </el-form-item>
-      <el-form-item label="领取柜" prop="loanFormName">
-        <el-select v-model="queryParams.loanFromId" placeholder="请选择领取柜">
-          <el-option
-            v-for="dict in cabinets"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          />
-        </el-select>
+      <el-form-item label="归还人" prop="restitutionUserName">
+        <el-input
+          v-model="queryParams.restitutionUserName"
+          placeholder="请输入归还人"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
       </el-form-item>
-
-      <el-form-item label="归还柜" prop="restitutionToName">
-        <el-select
-          v-model="queryParams.restitutionToId"
-          placeholder="请选择归还柜"
+      <el-form-item label="归还时间" prop="">
+        <el-date-picker
+          style="width: 215px"
+          :default-time="['00:00:00', '23:59:59']"
+          v-model="restitutionTime"
+          type="datetimerange"
+          :picker-options="pickerOptions"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          align="right"
         >
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="状态">
           <el-option
-            v-for="dict in cabinets"
+            v-for="dict in dict.type.record_of_collection"
             :key="dict.value"
             :label="dict.label"
             :value="dict.value"
           />
         </el-select>
       </el-form-item>
+<!--      <el-form-item label="领取柜" prop="loanFormName">-->
+<!--        <el-select v-model="queryParams.loanFromId" 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="restitutionToName">-->
+<!--        <el-select-->
+<!--          v-model="queryParams.restitutionToId"-->
+<!--          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
@@ -85,25 +138,6 @@
       </el-form-item>
     </el-form>
 
-    <!-- <el-row :gutter="10" class="mb8">
-      <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:mat:coll:batchremove']"
-          >批量删除
-        </el-button>
-      </el-col>
-
-      <right-toolbar
-        :showSearch.sync="showSearch"
-        @queryTable="getList"
-      ></right-toolbar>
-    </el-row> -->
 
     <el-table
       v-loading="loading"
@@ -111,51 +145,70 @@
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="物资编码" align="center" prop="materialsCode">
-        <template slot-scope="scope">
-          <el-button
-            v-no-more-click
-            type="text"
-            @click="handleView(scope.row)"
-            v-hasPermi="['mes:mat:coll:query']"
-            >{{ scope.row.materialsCode }}
-          </el-button>
-        </template>
+      <el-table-column label="物资编号" align="center" prop="materialsId">
       </el-table-column>
       <el-table-column label="物资名称" align="center" prop="materialsName" />
-      <el-table-column label="领取柜" align="center" prop="loanFromName" />
-
+      <el-table-column label="物资类型" align="center" prop="materialsTypeName" />
       <el-table-column
-        label="是否需要归还"
+        label="物资图片"
         align="center"
-        prop="restitutionRequired"
+        prop="materialsTypePicture"
       >
         <template slot-scope="scope">
-          <el-tag type="primary" v-if="scope.row.restitutionRequired == 1"
-            >是</el-tag
-          >
-          <el-tag type="danger" v-else>否</el-tag>
+          <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" prop="restitutionToName" />
       <el-table-column label="领取人" align="center" prop="loanUserName">
       </el-table-column>
+      <el-table-column label="领取时间" align="center" prop="loanTime" />
       <el-table-column label="归还人" align="center" prop="restitutionUserName">
       </el-table-column>
-      <!-- <el-table-column label="创建时间" align="center" prop="createTime">
-      </el-table-column> -->
-      <el-table-column label="领取时间" align="center" prop="loanTime" />
+<!--      实际归还时间-->
       <el-table-column
-        label="理应归还时间"
+        label="归还时间"
         align="center"
-        prop="restitutionTime"
+        prop="actualRestitutionTime"
       />
       <el-table-column
-        label="实际归还时间"
+        label="借出时长"
         align="center"
-        prop="actualRestitutionTime"
+        prop="loanDuration"
       />
-
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag
+            :options="dict.type.record_of_collection"
+            :value="scope.row.status"
+          />
+        </template>
+      </el-table-column>
+<!--      <el-table-column label="领取柜" align="center" prop="loanFromName" />-->
+<!--      <el-table-column-->
+<!--        label="是否需要归还"-->
+<!--        align="center"-->
+<!--        prop="restitutionRequired"-->
+<!--      >-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-tag type="primary" v-if="scope.row.restitutionRequired == 1"-->
+<!--            >是</el-tag-->
+<!--          >-->
+<!--          <el-tag type="danger" v-else>否</el-tag>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+<!--      <el-table-column label="归还柜" align="center" prop="restitutionToName" />-->
+      <!-- <el-table-column label="创建时间" align="center" prop="createTime">
+      </el-table-column> -->
+<!--      <el-table-column-->
+<!--        label="理应归还时间"-->
+<!--        align="center"-->
+<!--        prop="restitutionTime"-->
+<!--      />-->
       <!-- <el-table-column
         label="操作"
         align="center"
@@ -188,11 +241,14 @@
 import { listLoan } from "@/api/mes/loan/loan";
 import { getIsMaterialsCabinets } from "@/api/mes/material/information";
 import { genCode } from "@/api/system/autocode/rule";
-
+import Template from '@/views/print/printtemplate/list.vue'
+import { listType } from '@/api/mes/material/typeindex'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 export default {
   name: "Team",
-
-  dicts: ["sys_yes_no"],
+  components: { Treeselect, Template },
+  dicts: ["sys_yes_no","record_of_collection"],
   data() {
     return {
       //自动生成编码
@@ -213,25 +269,33 @@ export default {
       total: 0,
       // 班组表格数据
       teamList: [],
+      cabinets:null,//物资柜子数据
       // 弹出层标题
       title: "",
       // 是否显示弹出层
       open: false,
       // 查询参数
-
       queryParams: {
         current: 1,
         size: 10,
         materialsName: null,
         materialsCode: null,
-        loanUserName: null,
+        loanUserName: null,//领取人姓名
+        loanTimeStart: null,//领取开始时间
+        loanTimeEnd: null,//领取结束时间
+        restitutionUserName: null,//归还人姓名
+        restitutionTimeStart:null,//归还开始时间
+        restitutionTimeEnd:null,//归还结束时间
         restitutionRequired: null, //是否需要归还
-        restitutionUserName: null,
         restitutionToName: null, //归还柜
         restitutionToId: null, //归还柜id
         loanFormName: null, //领取柜
         loanFromId: null, //领取柜id
+        status: null,
+
       },
+      loanTime:null,//领取时间回显
+      restitutionTime:null,//归还时间回显
       // 查询参数
       queryParamsCabinets: {
         current: 1,
@@ -271,18 +335,41 @@ export default {
       value2: "",
       // 表单参数
       form: {},
+      machinerytypeOptions:[],
     };
   },
   created() {
     this.getList();
-  },
-  mounted() {
+    this.getTreeselect()
     this.materialsCabinets();
   },
   methods: {
+    // 格式化日期查询数据
+    formatDate(date) {
+      if (date && date instanceof Date && !isNaN(date)) {
+        // 使用本地时间
+        const year = date.getFullYear();
+        const month = String(date.getMonth() + 1).padStart(2, '0');
+        const day = String(date.getDate()).padStart(2, '0');
+        const hours = String(date.getHours()).padStart(2, '0');
+        const minutes = String(date.getMinutes()).padStart(2, '0');
+        const seconds = String(date.getSeconds()).padStart(2, '0');
+        return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+      }
+      return null;
+    },
     /** 查询班组列表 */
     getList() {
       this.loading = true;
+      if (Array.isArray(this.loanTime) && this.loanTime.length === 2) {
+        console.log()
+        this.queryParams.loanTimeStart = this.formatDate(this.loanTime[0])
+        this.queryParams.loanTimeEnd = this.formatDate(this.loanTime[1])
+      }
+      if (Array.isArray(this.restitutionTime) && this.restitutionTime.length === 2) {
+        this.queryParams.restitutionTimeStart = this.formatDate(this.restitutionTime[0])
+        this.queryParams.restitutionTimeEnd = this.formatDate(this.restitutionTime[1])
+      }
       listLoan(this.queryParams).then((response) => {
         // console.log(response, "领取管理列表");
         this.teamList = response.data.records;
@@ -301,13 +388,6 @@ export default {
           }));
         }
       });
-    }, //图片上传成功
-    handleImgUplaoded(imgUrl) {
-      this.form.sipUrl = imgUrl;
-    },
-    //图片移除
-    handleImgRemoved(imgUrl) {
-      this.form.sipUrl = null;
     },
     // 取消按钮
     cancel() {
@@ -342,61 +422,52 @@ export default {
       this.queryParams.restitutionToId = null; //归还柜id
       this.queryParams.loanFormName = null; //领取柜
       this.queryParams.loanFromId = null; //领取柜id
+      this.queryParams.loanTimeStart = null;
+      this.queryParams.loanTimeEnd = null;
+      this.loanTime = null;
+      this.restitutionTime = null;
+      this.queryParams.restitutionTimeEnd = null;
+      this.queryParams.restitutionTimeStart = null;
+      this.queryParams.restitutionUserName=null;
+      this.queryParams.status=null;
       this.resetForm("queryForm");
       this.handleQuery();
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.materialsLoanId);
-      this.codes = selection.map((item) => item.materialsCode);
-
+      this.codes = selection.map((item) => item.materialsName);
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "新增物资类型";
-      this.optType = "add";
-    },
 
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          if (this.form.teamId != null) {
-            updateTeam(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addTeam(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
+    /** 查询物资类型下拉树结构 */
+    getTreeselect() {
+      const data = {
+        current: 1,
+        size: 99999
+      }
+
+      listType(data).then((response) => {
+        this.machinerytypeOptions = this.handleTree(
+          response.data.records,
+          'materialsTypeId',
+          'parentId',
+          'children'
+        )
+      })
+    },
+    /** 转换数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.materialsTypeId,
+        label: node.materialsTypeName,
+        children: node.children
+      }
     },
-    /** 删除按钮操作 */
-    // handleDelete(row) {
-    //   const teamIds = row.materialsLoanId || this.ids;
-    //   const materialsCodes = row.materialsCode || this.codes;
-    //   console.log(teamIds, "teamIds");
-    //   this.$modal
-    //     .confirm('是否确认删除物资编码为"' + materialsCodes + '"的数据项?')
-    //     .then(function () {
-    //       return deleteLoan(teamIds);
-    //     })
-    //     .then(() => {
-    //       this.getList();
-    //       this.$modal.msgSuccess("删除成功");
-    //     })
-    //     .catch(() => {});
-    // },
     /** 导出按钮操作 */
     handleExport() {
       this.download(

+ 310 - 289
src/views/mes/material/materialinformation/index.vue

@@ -8,32 +8,28 @@
       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="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 label="物资名称" prop="materialsName">
+        <el-input
+          v-model="queryParams.materialsName"
+          placeholder="请输入物资名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
       <el-form-item label="物资类型" prop="materialsTypeId">
         <treeselect
           style="width: 200px"
@@ -43,6 +39,14 @@
           placeholder="请选择物资类型"
         />
       </el-form-item>
+      <el-form-item label="RFID" prop="materialsRfid">
+        <el-input
+          v-model="queryParams.materialsRfid"
+          placeholder="请输入RFID"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
       <el-form-item label="供应商" prop="supplier">
         <el-input
           v-model="queryParams.supplier"
@@ -51,8 +55,10 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="有效期" prop="">
+      <el-form-item  label="有效期" prop="">
         <el-date-picker
+          style="width: 215px"
+          :default-time="['00:00:00', '23:59:59']"
           v-model="createTime"
           type="datetimerange"
           :picker-options="pickerOptions"
@@ -63,20 +69,16 @@
         >
         </el-date-picker>
       </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 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>
         <el-button
@@ -85,14 +87,16 @@
           icon="el-icon-search"
           size="mini"
           @click="handleQuery"
-          >搜索</el-button
+        >搜索
+        </el-button
         >
         <el-button
           v-no-more-click
           icon="el-icon-refresh"
           size="mini"
           @click="resetQuery"
-          >重置</el-button
+        >重置
+        </el-button
         >
       </el-form-item>
     </el-form>
@@ -107,7 +111,7 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['iscs:materials:add']"
-          >新增
+        >新增
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -120,7 +124,7 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['iscs:materials:remove']"
-          >批量删除
+        >批量删除
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -132,7 +136,8 @@
           size="mini"
           @click="handleImport"
           v-hasPermi="['iscs:materials:import']"
-          >导入</el-button
+        >导入
+        </el-button
         >
       </el-col>
       <right-toolbar
@@ -146,19 +151,35 @@
       :data="materialsList"
       @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="materialsName" />
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="物资编号" align="center" prop="materialsId">
+      </el-table-column>
+      <el-table-column label="物资名称" align="center" prop="materialsName"/>
       <el-table-column
         label="物资类型"
         align="center"
         prop="materialsTypeName"
       />
-      <el-table-column label="物资RFID" align="center" prop="materialsRfid" />
-      <el-table-column label="所属柜" align="center" prop="cabinetName" />
+      <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="RFID" align="center" prop="materialsRfid"/>
       <el-table-column label="供应商" align="center" prop="supplier">
       </el-table-column>
+      <!--      <el-table-column label="所属柜" align="center" prop="cabinetName" />-->
       <el-table-column label="有效期" align="center" prop="expirationDate">
         <template slot-scope="scope">
           {{ scope.row.expirationDate }}
@@ -166,12 +187,12 @@
       </el-table-column>
       <el-table-column label="状态" align="center" prop="loanState">
         <template slot-scope="scope">
-          <span>{{ scope.row.loanState == 0 ? "借出" : "柜中" }}</span>
+          <dict-tag
+            :options="dict.type.material_status"
+            :value="scope.row.loanState"
+          />
         </template>
       </el-table-column>
-
-<!--      <el-table-column label="创建时间" align="center" prop="createTime">-->
-<!--      </el-table-column>-->
       <el-table-column
         label="操作"
         align="center"
@@ -185,7 +206,7 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['iscs:materials:edit']"
-            >编辑
+          >编辑
           </el-button>
           <el-button
             v-no-more-click
@@ -194,7 +215,7 @@
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['iscs:materials:remove']"
-            >删除
+          >删除
           </el-button>
         </template>
       </el-table-column>
@@ -237,7 +258,7 @@
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="物资RFID" prop="materialsRfid">
+            <el-form-item label="RFID" prop="materialsRfid">
               <el-input
                 v-model="form.materialsRfid"
                 placeholder="请输入物资RFID(纯数字)"
@@ -247,7 +268,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="所属柜" prop="materialsCabinetId">
+            <el-form-item label="物资柜" prop="materialsCabinetId">
               <el-select
                 style="width: 348px"
                 v-model="form.materialsCabinetId"
@@ -264,7 +285,6 @@
           </el-col>
         </el-row>
         <el-row>
-
           <el-col :span="12">
             <el-form-item label="供应商" prop="supplier">
               <el-input
@@ -283,47 +303,47 @@
               </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-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>
 
@@ -335,10 +355,12 @@
           type="primary"
           @click="cancel"
           v-if="optType == 'view'"
-          >返回</el-button
+        >返回
+        </el-button
         >
         <el-button v-no-more-click type="primary" @click="submitForm" v-else
-          >确 定</el-button
+        >确 定
+        </el-button
         >
         <el-button v-no-more-click @click="cancel">取 消</el-button>
       </div>
@@ -351,7 +373,6 @@
       width="400px"
       append-to-body
     >
-<!--      -->
       <el-upload
         ref="upload"
         :limit="1"
@@ -368,7 +389,7 @@
         <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
         <div class="el-upload__tip text-center" slot="tip">
           <div class="el-upload__tip" slot="tip">
-            <el-checkbox v-model="upload.updateSupport" />
+            <el-checkbox v-model="upload.updateSupport"/>
             是否更新已经存在的用户数据
           </div>
           <span>仅允许导入xls、xlsx格式文件。</span>
@@ -377,16 +398,19 @@
             :underline="false"
             style="font-size: 12px; vertical-align: baseline"
             @click="importTemplate"
-            >下载模板</el-link
+          >下载模板
+          </el-link
           >
         </div>
       </el-upload>
       <div slot="footer" class="dialog-footer">
         <el-button v-no-more-click type="primary" @click="submitFileForm"
-          >确 定</el-button
+        >确 定
+        </el-button
         >
         <el-button v-no-more-click @click="upload.open = false"
-          >取 消</el-button
+        >取 消
+        </el-button
         >
       </div>
     </el-dialog>
@@ -400,21 +424,22 @@ import {
   updateMaterials,
   deleteMaterials,
   selectMaterialsById,
-  getIsMaterialsCabinets,
-} from "@/api/mes/material/information";
-import { listType } from "@/api/mes/material/typeindex";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { genCode } from "@/api/system/autocode/rule";
-import Template from "@/views/print/printtemplate/list.vue";
-import { getToken } from "@/utils/auth";
+  getIsMaterialsCabinets
+} from '@/api/mes/material/information'
+import { listType } from '@/api/mes/material/typeindex'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { genCode } from '@/api/system/autocode/rule'
+import Template from '@/views/print/printtemplate/list.vue'
+import { getToken } from '@/utils/auth'
+
 export default {
-  name: "Team",
+  name: 'Team',
   components: {
     Template,
-    Treeselect,
+    Treeselect
   },
-  dicts: ["material_status"],
+  dicts: ['material_status'],
   data() {
     return {
       //自动生成编码
@@ -436,77 +461,78 @@ export default {
       // 班组表格数据
       materialsList: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
 
       // 查询参数
-      createTime: "",
+      createTime: '',
       queryParams: {
         current: 1,
         size: 10,
         materialsCode: null,
         materialsName: null,
+        materialsRfid:null,
         loanState: null,
         materialsCabinetId: null,
         materialsTypeId: null,
-        startExpirationDate: "",
-        endExpirationDate: "",
+        startExpirationDate: '',
+        endExpirationDate: '',
         supplier: null,
-        expirationDate: null,
+        expirationDate: null
       },
 
       // 查询参数
       queryParamsCabinets: {
         current: 1,
-        size: -1,
+        size: -1
       },
       pickerOptions: {
         shortcuts: [
           {
-            text: "最近一周",
+            text: '最近一周',
             onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
-              picker.$emit("pick", [start, end]);
-            },
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
+              picker.$emit('pick', [start, end])
+            }
           },
           {
-            text: "最近一个月",
+            text: '最近一个月',
             onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
-              picker.$emit("pick", [start, end]);
-            },
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
+              picker.$emit('pick', [start, end])
+            }
           },
           {
-            text: "最近三个月",
+            text: '最近三个月',
             onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
-              picker.$emit("pick", [start, end]);
-            },
-          },
-        ],
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
+              picker.$emit('pick', [start, end])
+            }
+          }
+        ]
       },
       // 用户导入参数
       upload: {
         // 是否显示弹出层(用户导入)
         open: false,
         // 弹出层标题(用户导入)
-        title: "",
+        title: '',
         // 是否禁用上传
         isUploading: false,
         // 是否更新已经存在的用户数据
         updateSupport: 0,
         // 设置上传的请求头部
-        headers: { Authorization: "Bearer " + getToken() },
+        headers: { Authorization: 'Bearer ' + getToken() },
         // 上传的地址
         // url: process.env.VUE_APP_BASE_API + "/iscs/materials/importMaterials",
-        url:process.env.VUE_APP_BASE_API + "/common/upload",
+        url: process.env.VUE_APP_BASE_API + '/common/upload'
       },
 
       // 表单参数
@@ -514,146 +540,141 @@ export default {
       cabinets: [], //物资所属柜
       // 表单校验
       rules: {
-        materialsCode: [
-          { required: true, message: "物资编码不能为空", trigger: "blur" },
-        ],
         materialsName: [
-          { required: true, message: "物资名称不能为空", trigger: "blur" },
+          { required: true, message: '物资名称不能为空', trigger: 'blur' }
         ],
-        materialsTypeId:[
-          { required: true, message: "物资类型不能为空", trigger: "blur" },
+        materialsTypeId: [
+          { required: true, message: '物资类型不能为空', trigger: 'blur' }
         ]
       },
 
-      machinerytypeOptions: [],
-    };
+      machinerytypeOptions: []
+    }
   },
   created() {
-    this.getList();
-    this.getTreeselect();
+    this.getList()
+    this.getTreeselect()
   },
   mounted() {
-    this.materialsCabinets();
+    this.materialsCabinets()
   },
   methods: {
-    formatDateserviceLife(dateString) {
-      const date = new Date(dateString);
-      const year = date.getFullYear();
-      const month = String(date.getMonth() + 1).padStart(2, "0");
-      const day = String(date.getDate()).padStart(2, "0");
-      return `${year}-${month}-${day}`;
-    },
+
     /** 转换数据结构 */
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children;
+        delete node.children
       }
       return {
         id: node.materialsTypeId,
         label: node.materialsTypeName,
-        children: node.children,
-      };
+        children: node.children
+      }
     },
     /** 查询物资类型下拉树结构 */
     getTreeselect() {
       const data = {
         current: 1,
-        size: 99999,
-      };
+        size: 99999
+      }
 
       listType(data).then((response) => {
         this.machinerytypeOptions = this.handleTree(
           response.data.records,
-          "materialsTypeId",
-          "parentId",
-          "children"
-        );
-      });
+          'materialsTypeId',
+          'parentId',
+          'children'
+        )
+      })
     },
     // 格式化日期查询数据
     formatDate(date) {
       if (date && date instanceof Date && !isNaN(date)) {
         // 使用本地时间
-        return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
-          2,
-          "0"
-        )}-${String(date.getDate()).padStart(2, "0")}`;
+        const year = date.getFullYear();
+        const month = String(date.getMonth() + 1).padStart(2, '0');
+        const day = String(date.getDate()).padStart(2, '0');
+        const hours = String(date.getHours()).padStart(2, '0');
+        const minutes = String(date.getMinutes()).padStart(2, '0');
+        const seconds = String(date.getSeconds()).padStart(2, '0');
+        return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
       }
       return null;
     },
     /** 查询物资信息列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       // 格式化日期并更新 queryParams
-      console.log(this.createTime,'this.createTime')
+      console.log(this.createTime, 'this.createTime')
       if (Array.isArray(this.createTime) && this.createTime.length === 2) {
-        this.queryParams.startExpirationDate = this.formatDate(this.createTime[0]);
-        this.queryParams.endExpirationDate = 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) => {
-        console.log(response, "获取物资信息allList ");
-        this.materialsList = response.data.records;
-        this.total = response.data.total;
+        console.log(response, '获取物资信息allList ')
+        this.materialsList = response.data.records
+        this.total = response.data.total
         this.machinerytypeList = this.handleTree(
           response.data.records,
-          "materialsTypeId",
-          "parentId",
-          "children"
-        );
-        this.loading = false;
-      });
+          'materialsTypeId',
+          'parentId',
+          'children'
+        )
+        this.loading = false
+      })
     },
     //图片上传成功
     handleImgUplaoded(imgUrl) {
-      this.form.sipUrl = imgUrl;
+      this.form.sipUrl = imgUrl
     },
     //图片移除
     handleImgRemoved(imgUrl) {
-      this.form.sipUrl = null;
+      this.form.sipUrl = null
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
       this.form = {
-        materialsName: "",
-        createTime: "",
-        materialsTypeId: "",
-        materialsCabinetId: "",
-        expirationDate: "",
-        supplier:""
-      };
-      this.resetForm("form");
-      this.autoGenFlag = false;
+        materialsName: '',
+        createTime: '',
+        materialsTypeId: '',
+        materialsCabinetId: '',
+        expirationDate: '',
+        supplier: '',
+      }
+      this.resetForm('form')
+      this.autoGenFlag = false
     },
     /** 搜索按钮操作 */
     handleQuery() {
-
-      this.getList();
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.createTime = "";
-      this.queryParams.materialsCode = null;
-      this.queryParams.materialsName = null;
-      this.queryParams.loanState = null;
-      this.queryParams.materialsCabinetId = null;
-      this.queryParams.materialsTypeId = null;
-      this.queryParams.startTime = "";
-      this.queryParams.endTime = "";
-      this.resetForm("queryForm");
-      this.handleQuery();
+      this.createTime = ''
+      this.queryParams.materialsCode = null
+      this.queryParams.materialsName = null
+      this.queryParams.loanState = null
+      this.queryParams.materialsCabinetId = null
+      this.queryParams.materialsTypeId = null
+      this.queryParams.startExpirationDate = null
+      this.queryParams.endExpirationDate = null
+      this.queryParams.materialsRfid = null
+      this.queryParams.supplier = null
+      this.resetForm('queryForm')
+      this.handleQuery()
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.materialsId);
-      this.codes = selection.map((item) => item.materialsName);
-      this.single = selection.length !== 1;
-      this.multiple = !selection.length;
+      this.ids = selection.map((item) => item.materialsId)
+      this.codes = selection.map((item) => item.materialsName)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
     },
 
     // 物资所属柜
@@ -663,140 +684,140 @@ export default {
           // 提取 cabinetId 和 cabinetName
           this.cabinets = response.data.records.map((item) => ({
             value: item.cabinetId,
-            label: item.cabinetName,
-          }));
+            label: item.cabinetName
+          }))
         }
-      });
+      })
     },
 
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "新增物资信息";
-      this.optType = "add";
-      this.form.materialsTypeId = undefined;
+      this.reset()
+      this.open = true
+      this.title = '新增物资信息'
+      this.optType = 'add'
+      this.form.materialsTypeId = undefined
     },
 
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
+      this.reset()
       selectMaterialsById(row.materialsId).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "编辑物资信息";
-        this.optType = "edit";
-      });
+        this.form = response.data
+        this.open = true
+        this.title = '编辑物资信息'
+        this.optType = 'edit'
+      })
     },
     // 导入按钮操作
 
     /** 导入按钮操作 */
     handleImport() {
-      this.upload.title = "物资导入";
-      this.upload.open = true;
+      this.upload.title = '物资导入'
+      this.upload.open = true
     },
     /** 下载模板操作 */
     importTemplate() {
       this.download(
-        "iscs/materials/importTemplate",
+        'iscs/materials/importTemplate',
         {},
         `md_item_template${new Date().getTime()}.xlsx`
-      );
+      )
     },
     // 文件上传中处理
     handleFileUploadProgress(event, file, fileList) {
-      this.upload.isUploading = true;
+      this.upload.isUploading = true
     },
     // 文件上传成功处理
     handleFileSuccess(response, file, fileList) {
-      this.upload.open = false;
-      this.upload.isUploading = false;
-      this.$refs.upload.clearFiles();
+      this.upload.open = false
+      this.upload.isUploading = false
+      this.$refs.upload.clearFiles()
       this.$alert(
-        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-          response.msg +
-          "</div>",
-        "导入结果",
+        '<div style=\'overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;\'>' +
+        response.msg +
+        '</div>',
+        '导入结果',
         { dangerouslyUseHTMLString: true }
-      );
-      this.getList();
+      )
+      this.getList()
     },
     // 提交上传文件
     submitFileForm() {
-      this.$refs.upload.submit();
+      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'); // 补零
+      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}`;
+      return `${year}-${month}-${day}`
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate((valid) => {
+      this.$refs['form'].validate((valid) => {
         if (valid) {
           if (this.form.materialsId != null) {
             updateMaterials(this.form).then((response) => {
-              console.log(response, "修改返回");
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+              console.log(response, '修改返回')
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
           } else {
-            this.form.expirationDate=this.formatDateExpirationDate(this.form.expirationDate)
-            console.log(this.form,'新增参数');
+            this.form.expirationDate = this.formatDateExpirationDate(this.form.expirationDate)
+            console.log(this.form, '新增参数')
             addMaterials(this.form).then((response) => {
-              console.log(response, "新增返回");
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+              console.log(response, '新增返回')
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const materialsIds = row.materialsId || this.ids;
-      const materialsCodes = row.materialsName || this.codes;
+      const materialsIds = row.materialsId || this.ids
+      const materialsCodes = row.materialsName || this.codes
       this.$modal
         .confirm('是否确认删除编号为"' + materialsCodes + '"的数据项?')
-        .then(function () {
-          return deleteMaterials(materialsIds);
+        .then(function() {
+          return deleteMaterials(materialsIds)
         })
         .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {
         })
-        .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
       this.download(
-        "cal/team/export",
+        'cal/team/export',
         {
-          ...this.queryParams,
+          ...this.queryParams
         },
         `team_${new Date().getTime()}.xlsx`
-      );
+      )
     },
 
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
       if (autoGenFlag) {
-        genCode("MATERIALS_CODE").then((response) => {
-          this.form.materialsCode = response;
-        });
+        genCode('MATERIALS_CODE').then((response) => {
+          this.form.materialsCode = response
+        })
       } else {
-        this.form.materialsCode = null;
+        this.form.materialsCode = null
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
 <style lang="scss" src="@/assets/styles/dialog-title.scss" scoped>
 .el-input-width {

+ 1 - 1
src/views/mes/material/typeofmaterial/index.vue

@@ -169,9 +169,9 @@
             @click="handleAdd(scope.row)"
             >新增</el-button
           >
+<!--           v-if="scope.row.parentId != 0"-->
           <el-button
             v-no-more-click
-            v-if="scope.row.parentId != 0"
             size="mini"
             type="text"
             icon="el-icon-delete"