Procházet zdrojové kódy

设备管理、库存快照

cz před 1 rokem
rodič
revize
3b4f60727a

+ 26 - 5
src/router/index.js

@@ -26,11 +26,12 @@ const routes = [{
 		name: 'main',
 		component: main,
 		redirect: '/main/working',
-		children: [{
-				path: 'equipment',
-				name: '设备列表',
-				component: () => import('../views/equipment/index.vue')
-			},
+		children: [
+			// {
+			// 	path: 'equipment',
+			// 	name: '设备列表',
+			// 	component: () => import('../views/equipment/index.vue')
+			// },
 			{
 				path: 'working',
 				name: '工作台',
@@ -382,6 +383,26 @@ const routes = [{
 				component: () => import('../views/purchase-sales/inventory-management/inventoryQuery/index.vue')
 			},
 			{
+				path: 'snapshot',
+				name: '库存快照',
+				component: () => import('../views/purchase-sales/inventory-management/snapshot/index.vue')
+			},
+			{
+				path: 'snapshotDetails',
+				name: '快照明细',
+				component: () => import('../views/purchase-sales/inventory-management/snapshot/details.vue')
+			},
+			{
+				path: 'equipment',
+				name: '设备管理',
+				component: () => import('../views/MES/equipment/index.vue')
+			},
+			{
+				path: 'equipmentAdd',
+				name: '设备管理编辑',
+				component: () => import('../views/MES/equipment/add.vue')
+			},
+			{
 				path: 'outInList',
 				name: '出入库流水',
 				component: () => import('../views/purchase-sales/inventory-management/outInList/index.vue')

+ 140 - 0
src/views/MES/equipment/add.vue

@@ -0,0 +1,140 @@
+<template>
+  <div class="form">
+    <van-nav-bar :title="'设备管理'" :left-text="$t('common.back')" left-arrow @click-left="onClickLeft">
+    </van-nav-bar>
+
+    <testForm v-model="formData.data" :formOption="formOption" :formConfig="formConfig" :rules="rules" @onSubmit="onSubmit" ref="formDom"></testForm>
+  </div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted, reactive } from "vue";
+import { showSuccessToast, showToast } from "vant";
+import { useRoute } from "vue-router";
+import { getUserInfo } from "@/utils/auth";
+import testForm from "@/components/testForm/index.vue";
+const proxy = getCurrentInstance().proxy;
+const route = useRoute();
+const show = ref(false);
+const typeModal = ref(false);
+const unitModal = ref(false);
+const classification = ref([]);
+const formData = reactive({
+  data: {},
+});
+const formDom = ref(null);
+const formOption = reactive({
+  readonly: false, //用于控制整个表单是否只读
+  disabled: false,
+  labelAlign: "top",
+  scroll: true,
+  labelWidth: "62pk",
+  // hiddenSubmitBtn: true,
+});
+const formConfig = reactive([
+  {
+    type: "input",
+    itemType: "text",
+    label: "设备编码",
+    prop: "deviceCode",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "设备名称",
+    prop: "deviceName",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "规格型号",
+    prop: "deviceSpec",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "制造商",
+    prop: "makerName",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "制造商电话",
+    prop: "makerPhone",
+    clearable: true,
+  },
+  {
+    type: "picker",
+    label: "出厂日期",
+    prop: "deviceDeliveryTime",
+    itemType: "datePicker",
+    showPicker: false,
+    split: "-",
+  },
+  {
+    type: "input",
+    itemType: "textarea",
+    label: "备注",
+    prop: "remark",
+  },
+]);
+const rules = {
+  deviceCode: [{ required: true, message: "请输入设备编码" }],
+  deviceName: [{ required: true, message: "请输入设备名称" }],
+};
+const unitList = ref([]);
+
+const getUserList = () => {
+  proxy.get("/system/user/list?pageNum=1&pageSize=10000", {}).then((res) => {
+    formConfig[3].data = res.rows;
+  });
+};
+const getWorkshopList = () => {
+  proxy
+    .post("/workshop/page", {
+      pageNum: 1,
+      pageSize: 10000,
+    })
+    .then((res) => {
+      formConfig[0].data = res.data.rows;
+    });
+};
+// getUserList();
+// getWorkshopList();
+const fileList = ref([]);
+const onOversize = () => {
+  showToast("文件大小不能超过 5MB");
+};
+const onClickLeft = () => history.back();
+const onSubmit = () => {
+  proxy.post("/tdaDevice/" + route.query.type, formData.data).then(() => {
+    showSuccessToast("操作成功");
+    setTimeout(() => {
+      history.back();
+    }, 500);
+  });
+};
+const treeToList = (arr) => {
+  let res = []; // 用于存储递归结果(扁平数据)
+  // 递归函数
+  let fn = (source) => {
+    source.forEach((el) => {
+      res.push(el);
+      el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归
+    });
+  };
+  fn(arr);
+  return res;
+};
+onMounted(() => {
+  if (route.query.id) {
+    proxy.post("/tdaDevice/detail", { id: route.query.id }).then((res) => {
+      formData.data = res.data;
+    });
+  }
+});
+</script>

+ 124 - 0
src/views/MES/equipment/index.vue

@@ -0,0 +1,124 @@
+<template>
+  <div style="padding-bottom: 60px">
+    <van-nav-bar :title="'设备管理'" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
+      <template #right> {{$t('common.add')}} </template>
+    </van-nav-bar>
+    <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
+
+    <van-pull-refresh v-model="loading" @refresh="onRefresh">
+      <div class="list">
+        <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="onLoad" style="margin-bottom: 60px">
+          <commonList :data="listData" :config="listConfig" @onClick="toDtl" :showMore="false"></commonList>
+        </van-list>
+      </div>
+    </van-pull-refresh>
+  </div>
+</template>
+<script setup>
+import { ref, getCurrentInstance, onMounted } from "vue";
+import commonList from "@/components/common-list.vue";
+import { useRoute } from "vue-router";
+const loading = ref(false);
+const router = useRoute();
+const req = ref({
+  total: 3,
+  pageNum: 1,
+  pageSize: 10,
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+
+const listConfig = ref([
+  {
+    label: "业务公司",
+    prop: "companyName",
+  },
+  {
+    label: "设备编码",
+    prop: "deviceCode",
+  },
+  {
+    label: "设备名称",
+    prop: "deviceName",
+  },
+  {
+    label: "规格型号",
+    prop: "deviceSpec",
+  },
+  {
+    label: "制造商",
+    prop: "makerName",
+  },
+  {
+    label: "制造商电话",
+    prop: "makerPhone",
+  },
+  {
+    label: "出厂日期",
+    prop: "deviceDeliveryTime",
+  },
+  {
+    label: "备注",
+    prop: "remark",
+  },
+]);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const onLoad = () => {
+  getList();
+};
+
+const onClickLeft = () => proxy.$router.push("/main/working");
+
+const onClickRight = () => {
+  proxy.$router.push({
+    path: "/main/equipmentAdd",
+    query: {
+      type: "add",
+    },
+  });
+};
+proxy.uploadDdRightBtn(onClickRight, proxy.t("common.add"));
+
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "/main/equipmentAdd",
+    query: {
+      id: row.id,
+      type: "edit",
+    },
+  });
+};
+
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/tdaDevice/page", req.value)
+    .then((res) => {
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch((err) => {
+      loading.value = false;
+    });
+};
+
+getList();
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>

+ 138 - 0
src/views/purchase-sales/inventory-management/snapshot/details.vue

@@ -0,0 +1,138 @@
+<template>
+  <van-nav-bar :title="'快照明细'" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
+    <!-- <template #right> {{ $t("common.add") }} </template> -->
+  </van-nav-bar>
+  <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" style="margin-bottom: 60px">
+        <commonList :data="listData" :showMore="false" :config="listConfig">
+          <template #productDefinition="{ row }">
+            <div>
+              <span v-if="row.productDefinition == 1">产品</span>
+              <span v-if="row.productDefinition == 2">物料</span>
+            </div>
+          </template>
+          <template #size="{ row }">
+            <div v-if="row.productLength && row.productWidth && row.productHeight">
+              <span>{{ row.productLength }}</span>*
+              <span>{{ row.productWidth }}</span>*
+              <span>{{ row.productHeight }}</span>
+            </div>
+            <div v-else></div>
+          </template>
+
+        </commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance, onMounted } from "vue";
+import commonList from "@/components/common-list.vue";
+import { showSuccessToast, showFailToast } from "vant";
+import { useRoute } from "vue-router";
+
+const proxy = getCurrentInstance().proxy;
+const route = useRoute();
+const onClickLeft = () => proxy.$router.push("/main/working");
+const req = ref({
+  pageNum: 1,
+  keyword: null,
+});
+const finished = ref(false);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const loading = ref(false);
+const listData = ref([]);
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/stockSnapshotDetails/page", req.value)
+    .then((res) => {
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch(() => {
+      loading.value = false;
+    });
+};
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "/main/inventoryCountAdd",
+    query: {
+      id: row.id,
+    },
+  });
+};
+const onClickRight = () => {
+  return;
+  proxy.$router.push({
+    path: "/main/inventoryCountAdd",
+    query: {},
+  });
+};
+const listConfig = ref([
+  {
+    label: "业务公司",
+    prop: "companyName",
+  },
+  {
+    label: "仓库名称",
+    prop: "warehouseName",
+  },
+  {
+    type: "slot",
+    label: "物品类型",
+    slotName: "productDefinition",
+  },
+  {
+    label: "所属分类",
+    prop: "productClassifyName",
+  },
+  {
+    label: "物品编码",
+    prop: "productCustomCode",
+  },
+  {
+    label: "物品名称",
+    prop: "productName",
+  },
+  {
+    type: "slot",
+    label: "尺寸 (cm)",
+    slotName: "size",
+  },
+  {
+    label: "颜色",
+    prop: "productColor",
+  },
+  {
+    label: "库存数量",
+    prop: "quantity",
+  },
+]);
+
+onMounted(() => {
+  if (route.query) {
+    req.value.snapshotId = route.query.id;
+    getList();
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>

+ 86 - 0
src/views/purchase-sales/inventory-management/snapshot/index.vue

@@ -0,0 +1,86 @@
+<template>
+  <van-nav-bar :title="'库存快照'" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
+    <!-- <template #right> {{ $t("common.add") }} </template> -->
+  </van-nav-bar>
+  <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="getList" style="margin-bottom: 60px">
+        <commonList :data="listData" @onClick="toDtl" :config="listConfig">
+          <template #inventoryResult="{ row }">
+            <div>
+              <span v-if="row.result == 0">正常</span>
+              <span style="color: #d9001b" v-else>异常</span>
+            </div>
+          </template>
+        </commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import commonList from "@/components/common-list.vue";
+
+const proxy = getCurrentInstance().proxy;
+const onClickLeft = () => proxy.$router.push("/main/working");
+const req = ref({
+  pageNum: 1,
+  keyword: null,
+  dataType: "1",
+});
+const finished = ref(false);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const loading = ref(false);
+const listData = ref([]);
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/stockSnapshot/page", req.value)
+    .then((res) => {
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch(() => {
+      loading.value = false;
+    });
+};
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "/main/snapshotDetails",
+    query: {
+      id: row.id,
+    },
+  });
+};
+const onClickRight = () => {
+  return;
+  proxy.$router.push({
+    path: "/main/inventoryCountAdd",
+    query: {},
+  });
+};
+const listConfig = ref([
+  {
+    label: "快照时间",
+    prop: "snapshotTime",
+  },
+]);
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>