Bläddra i källkod

pms 本地库存

zhangcl 4 månader sedan
förälder
incheckning
870a311557

+ 68 - 57
src/api/pms/iotlockstock/index.ts

@@ -1,57 +1,68 @@
-import request from '@/config/axios'
-
-// PMS 本地 库存 VO
-export interface IotLockStockVO {
-  id: number // 主键
-  deptId: number // 组织部门id
-  factory: string // 工厂(SAP) 专业公司
-  projectDepartment: string // 库存地点 - SAP 部门 项目部级
-  costCenter: string // 成本中心(SAP) 库存地点 小队
-  pickingListNumber: string // 领料单号
-  materialCode: string // 物料编码
-  materialName: string // 物料名称
-  materialGroupName: string // 物料组
-  materialGroupId: number // 物料组id
-  quantity: number // 数量
-  unitPrice: number // 单价
-  unit: string // 单位
-  storageTime: Date // 入库时间
-  sort: number // 排序
-  status: number // 状态 0启用  1停用
-  processInstanceId: string // 流程实例id
-  auditStatus: number // 审批状态 未提交、审批中、审批通过、审批不通过、已取消
-  remark: string // 备注
-}
-
-// PMS 本地 库存 API
-export const IotLockStockApi = {
-  // 查询PMS 本地 库存分页
-  getIotLockStockPage: async (params: any) => {
-    return await request.get({ url: `/pms/iot-lock-stock/page`, params })
-  },
-
-  // 查询PMS 本地 库存详情
-  getIotLockStock: async (id: number) => {
-    return await request.get({ url: `/pms/iot-lock-stock/get?id=` + id })
-  },
-
-  // 新增PMS 本地 库存
-  createIotLockStock: async (data: IotLockStockVO) => {
-    return await request.post({ url: `/pms/iot-lock-stock/create`, data })
-  },
-
-  // 修改PMS 本地 库存
-  updateIotLockStock: async (data: IotLockStockVO) => {
-    return await request.put({ url: `/pms/iot-lock-stock/update`, data })
-  },
-
-  // 删除PMS 本地 库存
-  deleteIotLockStock: async (id: number) => {
-    return await request.delete({ url: `/pms/iot-lock-stock/delete?id=` + id })
-  },
-
-  // 导出PMS 本地 库存 Excel
-  exportIotLockStock: async (params) => {
-    return await request.download({ url: `/pms/iot-lock-stock/export-excel`, params })
-  },
-}
+import request from '@/config/axios'
+
+// PMS 本地 库存 VO
+export interface IotLockStockVO {
+  id: number // 主键
+  deptId: number // 组织部门id
+  factoryId: number // 工厂id
+  factory: string // 工厂(SAP) 专业公司
+  storageLocationId: number // 库存地点id
+  projectDepartment: string // 库存地点 - SAP 部门 项目部级
+  costCenterId: number // 成本中心id
+  costCenter: string // 成本中心(SAP) 库存地点 小队
+  pickingListNumber: string // 领料单号
+  materialCode: string // 物料编码
+  materialName: string // 物料名称
+  materialGroupName: string // 物料组
+  materialGroupId: number // 物料组id
+  quantity: number // 数量
+  unitPrice: number // 单价
+  unit: string // 单位
+  storageTime: Date // 入库时间
+  storageAreaId: number // 库区id
+  shelvesId: number // 货架id
+  cargoLocationId: number // 货位id
+  sort: number // 排序
+  status: number // 状态 0启用  1停用
+  processInstanceId: string // 流程实例id
+  auditStatus: number // 审批状态 未提交、审批中、审批通过、审批不通过、已取消
+  remark: string // 备注
+}
+
+// PMS 本地 库存 API
+export const IotLockStockApi = {
+  // 查询PMS 本地 库存分页
+  getIotLockStockPage: async (params: any) => {
+    return await request.get({ url: `/pms/iot-lock-stock/page`, params })
+  },
+
+  // 查询PMS 本地 库存详情
+  getIotLockStock: async (id: number) => {
+    return await request.get({ url: `/pms/iot-lock-stock/get?id=` + id })
+  },
+
+  // 新增PMS 本地 库存
+  createIotLockStock: async (data: IotLockStockVO) => {
+    return await request.post({ url: `/pms/iot-lock-stock/create`, data })
+  },
+
+  // 手动新增入库
+  manualWarehouse: async (data: IotLockStockVO[]) => {
+    return await request.post({ url: `/pms/iot-lock-stock/manualWarehouse`, data })
+  },
+
+  // 修改PMS 本地 库存
+  updateIotLockStock: async (data: IotLockStockVO) => {
+    return await request.put({ url: `/pms/iot-lock-stock/update`, data })
+  },
+
+  // 删除PMS 本地 库存
+  deleteIotLockStock: async (id: number) => {
+    return await request.delete({ url: `/pms/iot-lock-stock/delete?id=` + id })
+  },
+
+  // 导出PMS 本地 库存 Excel
+  exportIotLockStock: async (params) => {
+    return await request.download({ url: `/pms/iot-lock-stock/export-excel`, params })
+  },
+}

+ 50 - 0
src/router/modules/remaining.ts

@@ -165,6 +165,56 @@ const remainingRouter: AppRouteRecordRaw[] = [
     ]
   },
 
+  {
+    path: '/iotpms/iotlockstock',
+    component: Layout,
+    name: 'PmsLockStockCenter',
+    meta: {
+      hidden: true
+    },
+    children: [
+      {
+        path: 'lockstock',
+        component: () => import('@/views/pms/iotlockstock/index.vue'),
+        name: 'IotLockStock',
+        meta: {
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:menu',
+          title: '本地库存',
+          activeMenu: '/lockstock/index'
+        }
+      },
+      {
+        path: 'lockstock/add',
+        component: () => import('@/views/pms/iotlockstock/IotAddToStock.vue'),
+        name: 'LockStockAdd',
+        meta: {
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:add',
+          title: '添加入库',
+          activeMenu: '/lockstock/add'
+        }
+      },
+      {
+        path: 'lockstock/edit/:id(\\d+)',
+        component: () => import('@/views/pms/iotlockstock/IotAddToStock.vue'),
+        name: 'LockStockEdit',
+        meta: {
+          noCache: true,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:edit',
+          title: '修改入库',
+          activeMenu: '/lockstock/edit'
+        }
+      }
+    ]
+  },
+
   {
     path: '/iotpms/iotmaintain',
     component: Layout,

+ 232 - 0
src/views/pms/iotlockstock/IotAddToStock.vue

@@ -0,0 +1,232 @@
+<template>
+  <ContentWrap>
+    <ContentWrap>
+      <!-- 搜索工作栏 -->
+      <el-form
+        class="-mb-15px"
+        ref="queryFormRef"
+        :inline="true"
+        label-width="68px"
+      >
+        <el-form-item>
+          <el-button @click="handleView" type="warning"
+            ><Icon icon="ep:plus" class="mr-5px" /> 新增物料</el-button
+          >
+        </el-form-item>
+      </el-form>
+    </ContentWrap>
+
+    <!-- 列表 -->
+    <ContentWrap>
+      <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+        <el-table-column label="物料编码" align="center" prop="materialCode" />
+        <el-table-column label="物料名称" align="center" prop="materialName" />
+        <el-table-column label="单位" align="center" prop="unit" />
+        <el-table-column label="单价" align="center" prop="unitPrice" />
+        <el-table-column label="数量" align="center" prop="quantity">
+          <template #default="scope">
+            <el-input v-model="scope.row.quantity" />
+          </template>
+        </el-table-column>
+        <el-table-column label="备注" align="center" prop="remark">
+          <template #default="scope">
+            <el-input v-model="scope.row.remark" />
+          </template>
+        </el-table-column>
+        <el-table-column label="物料来源" align="center" prop="type" />
+        <el-table-column label="操作" align="center" min-width="120px">
+          <template #default="scope">
+            <div style="display: flex; justify-content: center; align-items: center; width: 100%">
+              <div>
+                <Icon style="vertical-align: middle; color: #ea3434" icon="ep:zoom-out" />
+                <el-button
+                  style="vertical-align: middle"
+                  link
+                  type="danger"
+                  @click="handleDelete(scope.row.code)"
+                >
+                  移除
+                </el-button>
+              </div>
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
+    </ContentWrap>
+
+    <!-- 表单弹窗:添加/修改 -->
+    <StockMaterialDrawer
+      ref="showDrawer"
+      :model-value="drawerVisible"
+      @update:model-value="(val) => (drawerVisible = val)"
+      @add="handleChildSubmit"
+    />
+  </ContentWrap>
+  <ContentWrap>
+    <el-form>
+      <el-form-item style="float: right">
+        <el-button @click="submitForm" type="primary" :disabled="formLoading">保 存</el-button>
+        <el-button @click="close">取 消</el-button>
+      </el-form-item>
+    </el-form>
+  </ContentWrap>
+</template>
+<script setup lang="ts">
+
+import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
+import { IotLockStockApi, IotLockStockVO } from '@/api/pms/iotlockstock'
+import DeviceList from '@/views/pms/failure/DeviceList.vue'
+import * as UserApi from '@/api/system/user'
+import { useUserStore } from '@/store/modules/user'
+import StockMaterialDrawer from '@/views/pms/iotlockstock/StockMaterialDrawer.vue'
+import { ref } from 'vue'
+import { IotMaintainMaterialVO } from '@/api/pms/maintain/material'
+import { useTagsViewStore } from '@/store/modules/tagsView'
+import {CACHE_KEY, useCache} from "@/hooks/web/useCache";
+
+/** 手工入库 表单 */
+defineOptions({ name: 'IotAddToStock' })
+
+const { t } = useI18n() // 国际化
+const message = useMessage() // 消息弹窗
+const { delView } = useTagsViewStore() // 视图操作
+const { currentRoute, push } = useRouter()
+const deptUsers = ref<UserApi.UserVO[]>([]) // 用户列表
+const dialogTitle = ref('') // 弹窗的标题
+const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
+const formType = ref('') // 表单的类型:create - 新增;update - 修改
+const deviceLabel = ref('') // 表单的类型:create - 新增;update - 修改
+const drawerVisible = ref<boolean>(false)
+const showDrawer = ref()
+const list = ref<IotLockStockVO[]>([]) // 入库物料的数据
+const { params, name } = useRoute() // 查询参数
+const id = params.id
+const formData = ref({
+})
+
+const formRules = reactive({
+})
+
+const formRef = ref() // 表单 Ref
+const deviceChoose = (row) => {
+  deviceLabel.value = row.deviceName
+}
+const close = () => {
+  delView(unref(currentRoute))
+  push({ name: 'IotLockStock', params:{}})
+}
+const handleView = () => {
+  drawerVisible.value = true
+  showDrawer.value.openDrawer()
+}
+const selectChoose = (formData) => {
+  console.log('接收到的数据:', JSON.stringify(formData))
+  list.value.push(formData)
+}
+const handleChildSubmit = (formData) => {
+  const modified = removeOnesFromKeys(formData)
+  list.value.push(modified)
+}
+
+const removeOnesFromKeys = (obj: Record<string, any>) => {
+  return Object.keys(obj).reduce(
+    (acc, key) => {
+      const newKey = key.replace(/1/g, '') // 替换所有 1
+      acc[newKey] = obj[key]
+      return acc
+    },
+    {} as Record<string, any>
+  )
+}
+/** 提交表单 */
+const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
+const submitForm = async () => {
+  // 校验表单
+  if (list.value.length > 0) {
+    const nullList = list.value.filter((item) => item.quantity===null)
+    if (nullList.length > 0) {
+      message.error('请填写数量')
+      return
+    }
+  }
+
+  // 提交请求
+  formLoading.value = true
+  try {
+    const data = {
+    }
+    if (formType.value === 'create') {
+      await IotLockStockApi.manualWarehouse(list.value)
+      message.success(t('common.createSuccess'))
+      close()
+    } else {
+      await IotMaintainApi.updateIotMaintain(data)
+      message.success(t('common.updateSuccess'))
+      close()
+    }
+    // 发送操作成功的事件
+    emit('success')
+  } finally {
+    formLoading.value = false
+  }
+}
+
+/** 重置表单 */
+const resetForm = () => {
+  formData.value = {
+    id: undefined,
+    failureCode: undefined,
+    failureName: undefined,
+    deviceId: undefined,
+    status: undefined,
+    ifStop: undefined,
+    failureTime: undefined,
+    failureInfluence: undefined,
+    failureSystem: undefined,
+    description: undefined,
+    pic: undefined,
+    solution: undefined,
+    maintainStartTime: undefined,
+    maintainEndTime: undefined,
+    remark: undefined,
+    deviceName: undefined,
+    processInstanceId: undefined,
+    auditStatus: undefined,
+    deptId: undefined
+  }
+  formRef.value?.resetFields()
+}
+onMounted(async () => {
+  const deptId = useUserStore().getUser.deptId
+  deptUsers.value = await UserApi.getDeptUsersByDeptId(deptId)
+  if (id){
+    formType.value = 'update'
+    const iotMaintain = await IotMaintainApi.getIotMaintain(id);
+    deviceLabel.value = iotMaintain.deviceName
+    formData.value = iotMaintain
+    formData.value.status = undefined
+  } else {
+    formData.value.type = 'in'
+    formType.value = 'create';
+    const { wsCache } = useCache()
+    const userInfo = wsCache.get(CACHE_KEY.USER)
+    formData.value.maintainPerson = userInfo.user.id;
+  }
+})
+const handleDelete = async (id: number) => {
+  try {
+    const index = list.value.findIndex((item) => item.code === id)
+    debugger
+    if (index !== -1) {
+      // 通过 splice 删除元素
+      list.value.splice(index, 1)
+    }
+  } catch {}
+}
+</script>
+<style scoped>
+.base-expandable-content {
+  overflow: hidden; /* 隐藏溢出的内容 */
+  transition: max-height 0.3s ease; /* 平滑过渡效果 */
+}
+</style>

+ 171 - 0
src/views/pms/iotlockstock/SelectMaterial.vue

@@ -0,0 +1,171 @@
+<template>
+  <Dialog v-model="dialogVisible" title="选择物料" style="width: 1100px; max-height: 800px">
+    <ContentWrap>
+      <el-form
+        class="-mb-15px"
+        :model="queryParams"
+        ref="queryFormRef"
+        :inline="true"
+        label-width="68px"
+      >
+        <el-form-item label="物料名称" prop="name">
+          <el-input
+            v-model="queryParams.name"
+            placeholder="请输入物料名称"
+            clearable
+            @keyup.enter="handleQuery"
+            class="!w-240px"
+          />
+        </el-form-item>
+        <el-form-item label="物料编码" prop="code">
+          <el-input
+            v-model="queryParams.code"
+            placeholder="请输入物料编码"
+            clearable
+            @keyup.enter="handleQuery"
+            class="!w-240px"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
+          <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
+        </el-form-item>
+      </el-form>
+    </ContentWrap>
+    <ContentWrap>
+      <el-table
+        v-loading="loading"
+        :data="list"
+        :stripe="true"
+        :show-overflow-tooltip="true"
+        @row-click="handleRowClick"
+      >
+        <el-table-column width="60" label="选择">
+          <template #default="{ row }">
+            <el-radio
+              :model-value="selectedRow?.id"
+              :label="row.id"
+              @click.stop="selectRow(row)"
+              class="no-label-radio"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="物料编码"
+          align="center"
+          prop="code"
+          :show-overflow-tooltip="true"
+        />
+        <el-table-column
+          label="物料名称"
+          align="center"
+          prop="name"
+          :show-overflow-tooltip="true"
+        />
+        <el-table-column label="规格型号" align="center" prop="model" width="120" />
+        <el-table-column label="单位" align="center" prop="unit" width="120" />
+        <el-table-column label="状态" key="status">
+          <template #default="scope">
+            <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="创建时间"
+          align="center"
+          prop="createTime"
+          :formatter="dateFormatter"
+          width="180"
+        />
+      </el-table>
+      <!-- 分页 -->
+      <Pagination
+        :total="total"
+        v-model:page="queryParams.pageNo"
+        v-model:limit="queryParams.pageSize"
+        @pagination="getList"
+      />
+    </ContentWrap>
+  </Dialog>
+</template>
+
+<script setup lang="ts">
+import { DictDataVO } from '@/api/system/dict/dict.data'
+import { dateFormatter } from '@/utils/formatTime'
+import * as DictTypeApi from '@/api/system/dict/dict.type'
+import { checkPermi } from '@/utils/permission'
+import * as MaterialApi from '@/api/pms/material'
+import {DICT_TYPE} from "@/utils/dict";
+
+const emit = defineEmits(['choose']) // 定义 success 事件,用于操作成功后的回调
+const dialogVisible = ref(false) // 弹窗的是否展示
+const loading = ref(true) // 列表的加载中
+const queryFormRef = ref() // 搜索的表单
+const list = ref<DictDataVO[]>([]) // 列表的数据
+const dictTypeList = ref<DictTypeApi.DictTypeVO[]>() // 字典类型的列表
+const total = ref(0) // 列表的总页数
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  label: '',
+  name: undefined,
+  code: undefined,
+  status: undefined,
+})
+
+const selectedRow = ref(null)
+
+// 处理单选逻辑
+const selectRow = (row) => {
+  selectedRow.value = selectedRow.value?.id === row.id ? null : row
+  emit('choose', row)
+  dialogVisible.value = false
+}
+
+// 点击整行选中
+const handleRowClick = (row) => {
+  selectRow(row)
+}
+const open = async (type: string, id?: number) => {
+  dialogVisible.value = true
+  await getList()
+}
+defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+const getList = async () => {
+  loading.value = true
+  try {
+    const data = await MaterialApi.getMaterialPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+const choose = (row: DictDataVO) => {
+  emit('choose', row)
+  dialogVisible.value = false
+}
+/** 重置按钮操作 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+/** 初始化 **/
+// onMounted(async () => {
+//   // 查询字典(精简)列表
+//   dictTypeList.value = await DictTypeApi.getSimpleDictTypeList()
+// })
+</script>
+<style lang="scss">
+.no-label-radio .el-radio__label {
+  display: none;
+}
+.no-label-radio .el-radio__inner {
+  margin-right: 0;
+}
+</style>

+ 153 - 0
src/views/pms/iotlockstock/StockMaterialDrawer.vue

@@ -0,0 +1,153 @@
+<template>
+  <el-drawer
+    title="新增物料"
+    :append-to-body="true"
+    :model-value="modelValue"
+    @update:model-value="$emit('update:modelValue', $event)"
+    :show-close="false"
+    direction="rtl"
+    :size="computedSize"
+    :before-close="handleClose"
+  >
+    <el-form
+      ref="drawerRef"
+      :model="drawerFormData"
+      :rules="formRules"
+      label-width="100px"
+      v-loading="formLoading"
+    >
+      <el-form-item label="物料主数据" prop="materialCode" style="margin-bottom: 30px">
+        <el-select
+          v-model="drawerFormData.materialCode"
+          :model-value="materialLabel"
+          placeholder="请输入物料主数据"
+          @click="openForm"
+        />
+      </el-form-item>
+      <el-form-item label="数量" prop="quantity1" style="margin-bottom: 30px">
+        <el-input v-model="drawerFormData.quantity1" type="number" placeholder="请输入数量" />
+      </el-form-item>
+      <el-form-item label="单位" prop="unit1" style="margin-bottom: 30px">
+        <el-input v-model="drawerFormData.unit1" placeholder="请输入单位" disabled/>
+      </el-form-item>
+      <el-form-item label="单价" prop="price1" style="margin-bottom: 30px">
+        <el-input v-model="drawerFormData.unitPrice1" placeholder="请输入单价" />
+      </el-form-item>
+      <el-form-item label="备注" prop="remark1" style="margin-bottom: 30px">
+        <el-input v-model="drawerFormData.remark1" type="textarea" placeholder="请输入备注" />
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
+      <el-button @click="handleClose">取 消</el-button>
+    </template>
+  </el-drawer>
+  <MaterialSelect ref="materialFormRef" @choose="materialChoose" />
+</template>
+<script setup lang="ts">
+import { defineEmits, defineOptions, ref, watch } from 'vue'
+import { ElMessage } from 'element-plus'
+import * as PmsMaterialApi from '@/api/pms/material'
+import {CommonStatusEnum} from "@/utils/constants";
+import MaterialSelect from './SelectMaterial.vue'
+
+const drawerVisible = ref<boolean>(false)
+const emit = defineEmits(['update:modelValue', 'add'])
+const materialLabel = ref('') // 表单的类型:create - 新增;update - 修改
+defineOptions({
+  name: 'StockMaterialDrawer'
+})
+const materialChoose = (row) => {
+  drawerFormData.value.materialCode = row.code
+  drawerFormData.value.materialName = row.name
+  drawerFormData.value.unit1 = row.unit
+  materialLabel.value = row.name
+}
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  createTime: [],
+  bomId: '',
+  name: '',
+  code: ''
+})
+const drawerFormData = ref({
+  id: undefined,
+  materialCode: undefined,
+  materialName: undefined,
+  unit1: undefined,
+  unitPrice1: undefined,
+  type: undefined,
+  quantity1: undefined,
+  totalCount: undefined,
+  sapCode: undefined,
+  status1: undefined,
+  remark1: undefined
+})
+const resetDrawerForm = () => {
+  drawerFormData.value = {
+    id: undefined,
+    materialCode: undefined,
+    materialName: undefined,
+    unit1: undefined,
+    unitPrice1: undefined,
+    type: undefined,
+    quantity: undefined,
+    totalCount: undefined,
+    sapCode: undefined,
+    status: undefined,
+    remark1: undefined
+  }
+  drawerRef.value?.resetFields()
+}
+const formRules = reactive({
+  materialCode: [{ required: true, message: '物料编码不能为空', trigger: 'blur' }],
+  materialName: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
+  quantity1: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
+})
+const materialFormRef = ref()
+const openForm = () => {
+  materialFormRef.value.open()
+}
+const windowWidth = ref(window.innerWidth)
+// 动态计算百分比
+const computedSize = computed(() => {
+  return windowWidth.value > 800 ? '40%' : '60%'
+})
+
+const loading = ref(false)
+const total = ref(0) // 列表的总页数
+const materials = ref([])
+
+const props = defineProps({
+  modelValue: Boolean
+})
+
+// 打开抽屉
+const openDrawer = () => {
+  drawerVisible.value = true
+  resetDrawerForm()
+  materialLabel.value = undefined
+}
+
+// 关闭抽屉
+const closeDrawer = () => {
+  drawerVisible.value = false
+}
+
+// 关闭抽屉
+const handleClose = () => {
+  emit('update:modelValue', false)
+}
+const drawerRef = ref()
+const submitForm= async ()=> {
+  await drawerRef.value.validate()
+  drawerFormData.value.type = '1'
+  emit('add', drawerFormData.value);
+  emit('update:modelValue', false)
+}
+
+defineExpose({ openDrawer, closeDrawer }) // 暴露方法给父组件
+</script>
+
+<style lang="scss" scoped></style>

+ 18 - 160
src/views/pms/iotlockstock/index.vue

@@ -8,46 +8,28 @@
       :inline="true"
       label-width="68px"
     >
-      <el-form-item label="组织部门id" prop="deptId">
-        <el-input
-          v-model="queryParams.deptId"
-          placeholder="请输入组织部门id"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="工厂(SAP) 专业公司" prop="factory">
+      <el-form-item label="工厂" prop="factory">
         <el-input
           v-model="queryParams.factory"
-          placeholder="请输入工厂(SAP) 专业公司"
+          placeholder="请输入工厂"
           clearable
           @keyup.enter="handleQuery"
           class="!w-240px"
         />
       </el-form-item>
-      <el-form-item label="库存地点 - SAP 部门 项目部级" prop="projectDepartment">
+      <el-form-item label="库存地点" prop="projectDepartment">
         <el-input
           v-model="queryParams.projectDepartment"
-          placeholder="请输入库存地点 - SAP 部门 项目部级"
+          placeholder="请输入库存地点"
           clearable
           @keyup.enter="handleQuery"
           class="!w-240px"
         />
       </el-form-item>
-      <el-form-item label="成本中心(SAP) 库存地点 小队" prop="costCenter">
+      <el-form-item label="成本中心" prop="costCenter">
         <el-input
           v-model="queryParams.costCenter"
-          placeholder="请输入成本中心(SAP) 库存地点 小队"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="领料单号" prop="pickingListNumber">
-        <el-input
-          v-model="queryParams.pickingListNumber"
-          placeholder="请输入领料单号"
+          placeholder="请输入成本中心"
           clearable
           @keyup.enter="handleQuery"
           class="!w-240px"
@@ -71,51 +53,6 @@
           class="!w-240px"
         />
       </el-form-item>
-      <el-form-item label="物料组" prop="materialGroupName">
-        <el-input
-          v-model="queryParams.materialGroupName"
-          placeholder="请输入物料组"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="物料组id" prop="materialGroupId">
-        <el-input
-          v-model="queryParams.materialGroupId"
-          placeholder="请输入物料组id"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="数量" prop="quantity">
-        <el-input
-          v-model="queryParams.quantity"
-          placeholder="请输入数量"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="单价" prop="unitPrice">
-        <el-input
-          v-model="queryParams.unitPrice"
-          placeholder="请输入单价"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="单位" prop="unit">
-        <el-input
-          v-model="queryParams.unit"
-          placeholder="请输入单位"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
       <el-form-item label="入库时间" prop="storageTime">
         <el-date-picker
           v-model="queryParams.storageTime"
@@ -127,64 +64,6 @@
           class="!w-220px"
         />
       </el-form-item>
-      <el-form-item label="排序" prop="sort">
-        <el-input
-          v-model="queryParams.sort"
-          placeholder="请输入排序"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="状态 0启用  1停用" prop="status">
-        <el-select
-          v-model="queryParams.status"
-          placeholder="请选择状态 0启用  1停用"
-          clearable
-          class="!w-240px"
-        >
-          <el-option label="请选择字典生成" value="" />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="流程实例id" prop="processInstanceId">
-        <el-input
-          v-model="queryParams.processInstanceId"
-          placeholder="请输入流程实例id"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="审批状态 未提交、审批中、审批通过、审批不通过、已取消" prop="auditStatus">
-        <el-select
-          v-model="queryParams.auditStatus"
-          placeholder="请选择审批状态 未提交、审批中、审批通过、审批不通过、已取消"
-          clearable
-          class="!w-240px"
-        >
-          <el-option label="请选择字典生成" value="" />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="备注" prop="remark">
-        <el-input
-          v-model="queryParams.remark"
-          placeholder="请输入备注"
-          clearable
-          @keyup.enter="handleQuery"
-          class="!w-240px"
-        />
-      </el-form-item>
-      <el-form-item label="创建时间" prop="createTime">
-        <el-date-picker
-          v-model="queryParams.createTime"
-          value-format="YYYY-MM-DD HH:mm:ss"
-          type="daterange"
-          start-placeholder="开始日期"
-          end-placeholder="结束日期"
-          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
-          class="!w-220px"
-        />
-      </el-form-item>
       <el-form-item>
         <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
         <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
@@ -194,7 +73,7 @@
           @click="openForm('create')"
           v-hasPermi="['pms:iot-lock-stock:create']"
         >
-          <Icon icon="ep:plus" class="mr-5px" /> 新增
+          <Icon icon="ep:plus" class="mr-5px" /> 手工入库
         </el-button>
         <el-button
           type="success"
@@ -212,18 +91,12 @@
   <!-- 列表 -->
   <ContentWrap>
     <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
-      <el-table-column label="主键" align="center" prop="id" />
-      <el-table-column label="组织部门id" align="center" prop="deptId" />
-      <el-table-column label="工厂(SAP) 专业公司" align="center" prop="factory" />
-      <el-table-column label="库存地点 - SAP 部门 项目部级" align="center" prop="projectDepartment" />
-      <el-table-column label="成本中心(SAP) 库存地点 小队" align="center" prop="costCenter" />
-      <el-table-column label="领料单号" align="center" prop="pickingListNumber" />
+      <el-table-column label="工厂" align="center" prop="factory" />
+      <el-table-column label="成本中心" align="center" prop="costCenter" />
       <el-table-column label="物料编码" align="center" prop="materialCode" />
       <el-table-column label="物料名称" align="center" prop="materialName" />
-      <el-table-column label="物料组" align="center" prop="materialGroupName" />
-      <el-table-column label="物料组id" align="center" prop="materialGroupId" />
-      <el-table-column label="数量" align="center" prop="quantity" />
-      <el-table-column label="单价" align="center" prop="unitPrice" />
+      <el-table-column label="数量" align="center" prop="quantity" :formatter="erpPriceTableColumnFormatter" />
+      <el-table-column label="单价" align="center" prop="unitPrice" :formatter="erpPriceTableColumnFormatter" />
       <el-table-column label="单位" align="center" prop="unit" />
       <el-table-column
         label="入库时间"
@@ -232,18 +105,6 @@
         :formatter="dateFormatter"
         width="180px"
       />
-      <el-table-column label="排序" align="center" prop="sort" />
-      <el-table-column label="状态 0启用  1停用" align="center" prop="status" />
-      <el-table-column label="流程实例id" align="center" prop="processInstanceId" />
-      <el-table-column label="审批状态 未提交、审批中、审批通过、审批不通过、已取消" align="center" prop="auditStatus" />
-      <el-table-column label="备注" align="center" prop="remark" />
-      <el-table-column
-        label="创建时间"
-        align="center"
-        prop="createTime"
-        :formatter="dateFormatter"
-        width="180px"
-      />
       <el-table-column label="操作" align="center" min-width="120px">
         <template #default="scope">
           <el-button
@@ -254,14 +115,6 @@
           >
             编辑
           </el-button>
-          <el-button
-            link
-            type="danger"
-            @click="handleDelete(scope.row.id)"
-            v-hasPermi="['pms:iot-lock-stock:delete']"
-          >
-            删除
-          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -283,6 +136,8 @@ import { dateFormatter } from '@/utils/formatTime'
 import download from '@/utils/download'
 import { IotLockStockApi, IotLockStockVO } from '@/api/pms/iotlockstock'
 import IotLockStockForm from './IotLockStockForm.vue'
+import {erpPriceTableColumnFormatter} from "@/utils";
+import {DICT_TYPE} from "@/utils/dict";
 
 /** PMS 本地 库存 列表 */
 defineOptions({ name: 'IotLockStock' })
@@ -290,6 +145,8 @@ defineOptions({ name: 'IotLockStock' })
 const message = useMessage() // 消息弹窗
 const { t } = useI18n() // 国际化
 
+const { push } = useRouter() // 路由跳转
+
 const loading = ref(true) // 列表的加载中
 const list = ref<IotLockStockVO[]>([]) // 列表的数据
 const total = ref(0) // 列表的总页数
@@ -346,7 +203,8 @@ const resetQuery = () => {
 /** 添加/修改操作 */
 const formRef = ref()
 const openForm = (type: string, id?: number) => {
-  formRef.value.open(type, id)
+  // formRef.value.open(type, id)
+  push({ name: 'LockStockAdd', params:{} })
 }
 
 /** 删除按钮操作 */
@@ -381,4 +239,4 @@ const handleExport = async () => {
 onMounted(() => {
   getList()
 })
-</script>
+</script>