Browse Source

嘉兴双拓菜单配置页面创建

cz 1 year ago
parent
commit
09e5394494

+ 10 - 2
src/components/testForm/index.vue

@@ -357,7 +357,12 @@
       </div>
       <div style="margin: 16px" v-show="!formOption.hiddenSubmitBtn">
         <van-button round block type="primary" native-type="submit">
-          提交
+          {{ formOption.submitBtnText || "提交" }}
+        </van-button>
+      </div>
+      <div style="margin: 16px" v-show="formOption.otherBtn">
+        <van-button round block type="warning" @click="handleOtherBtnClick">
+          {{ formOption.otherBtnText || "其他" }}
         </van-button>
       </div>
     </van-form>
@@ -411,6 +416,9 @@ const emit = defineEmits(["update:modelValue"]);
 const onSubmit = () => {
   emit("onSubmit");
 };
+const handleOtherBtnClick = () => {
+  emit("otherBtnClick");
+};
 
 // 获取验证规则
 const getRules = (prop) => {
@@ -865,7 +873,7 @@ watch(
   padding: 0 15px;
 }
 ._title {
-  font-size: 18px;
+  font-size: 14px;
   font-weight: 700;
 }
 </style>

+ 40 - 16
src/router/jxskRouter.js

@@ -1,20 +1,44 @@
 export function jxskRouter() {
   const jxskRouter = [{
-    path: "jxskSalesContract",
-    name: "jxsk_销售合同",
-    component: () => import("../views/JXSK/salesContract/index.vue"),
-  }, {
-    path: "jxskSalesContractAdd",
-    name: "jxsk_销售合同添加",
-    component: () => import("../views/JXSK/salesContract/add.vue"),
-  }, {
-    path: "jxskTask",
-    name: "jxsk_生产任务",
-    component: () => import("../views/JXSK/mes/task/index.vue"),
-  }, {
-    path: "jxskTaskAdd",
-    name: "jxsk_生产任务添加",
-    component: () => import("../views/JXSK/mes/task/add.vue"),
-  }];
+      path: "jxskSalesContract",
+      name: "jxsk_销售合同",
+      component: () => import("../views/JXSK/salesContract/index.vue"),
+    },
+    {
+      path: "jxskSalesContractAdd",
+      name: "jxsk_销售合同添加",
+      component: () => import("../views/JXSK/salesContract/add.vue"),
+    },
+    {
+      path: "jxskTask",
+      name: "jxsk_生产任务",
+      component: () => import("../views/JXSK/mes/task/index.vue"),
+    },
+    {
+      path: "jxskTaskAdd",
+      name: "jxsk_生产任务添加",
+      component: () => import("../views/JXSK/mes/task/add.vue"),
+    },
+    {
+      path: "jxskForward",
+      name: "jxsk_任务流转",
+      component: () => import("../views/JXSK/mes/forward/index.vue"),
+    },
+    {
+      path: "jxskForwardAdd",
+      name: "jxsk_任务流转添加",
+      component: () => import("../views/JXSK/mes/forward/add.vue"),
+    },
+    {
+      path: "jxskReceive",
+      name: "jxsk_任务接收",
+      component: () => import("../views/JXSK/mes/receive/index.vue"),
+    },
+    {
+      path: "jxskReceiveAdd",
+      name: "jxsk_任务接收添加",
+      component: () => import("../views/JXSK/mes/receive/add.vue"),
+    }
+  ];
   return jxskRouter;
 }

+ 202 - 0
src/views/JXSK/mes/forward/add.vue

@@ -0,0 +1,202 @@
+<template>
+  <div class="form" style="padding-bottom: 60px">
+    <van-nav-bar
+      title="任务流转"
+      left-text="返回"
+      left-arrow
+      @click-left="onClickLeft"
+    >
+    </van-nav-bar>
+    <testForm
+      v-model="formData.data"
+      :formOption="formOption"
+      :formConfig="formConfig"
+      :rules="rules"
+      @onSubmit="onSubmit"
+      ref="formDom"
+    >
+      <template #file>
+        <div>aa</div>
+      </template>
+    </testForm>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, getCurrentInstance, onMounted } from "vue";
+import { showSuccessToast, showFailToast } from "vant";
+import { useRoute } from "vue-router";
+import testForm from "@/components/testForm/index.vue";
+const proxy = getCurrentInstance().proxy;
+const route = useRoute();
+const formDom = ref(null);
+const formData = reactive({
+  data: {
+    list: [],
+  },
+});
+const rules = {
+  warehouseName: [{ required: true, message: "仓库名称不能为空" }],
+  productName: [{ required: true, message: "物品名称不能为空" }],
+  quantity: [{ required: true, message: "入库数量不能为空" }],
+};
+const formOption = reactive({
+  readonly: false, //用于控制整个表单是否只读
+  disabled: false,
+  labelAlign: "top",
+  scroll: true,
+  labelWidth: "62pk",
+  submitBtnText: "提交",
+  btnConfig: {
+    isNeed: false,
+    prop: "list",
+    plain: true,
+    listTitle: "",
+    listConfig: [],
+    clickFn: () => {},
+  },
+});
+const formConfig = ref([]);
+const getDict = () => {
+  proxy.get("/system/user/list?pageNum=1&pageSize=9999").then((res) => {
+    formConfig.value[6].data = res.rows.map((item) => {
+      return {
+        label: item.userName,
+        value: item.userId,
+      };
+    });
+  });
+};
+
+const onClickLeft = () => history.back();
+const onSubmit = () => {
+  proxy.post("/productionTask/add", formData.data).then(
+    (res) => {
+      setTimeout(() => {
+        showSuccessToast("添加成功");
+        proxy.$router.push("/main/task");
+      }, 500);
+    },
+    (err) => {
+      return showFailToast(err.message);
+    }
+  );
+};
+const getDetails = () => {
+  proxy.post("/productionTask/detail", { id: route.query.id }).then(
+    (res) => {
+      console.log(res, "ada");
+    },
+    (err) => {
+      return showFailToast(err.message);
+    }
+  );
+};
+const configData = [
+  [
+    {
+      type: "input",
+      itemType: "text",
+      label: "产品名称",
+      prop: "reamlke",
+      readonly: true,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      label: "产品SN",
+      prop: "reamlke",
+      readonly: true,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      label: "当前工序",
+      prop: "reamlke",
+      readonly: true,
+    },
+    {
+      type: "slot",
+      label: "工序图纸",
+      slotName: "file",
+    },
+    {
+      type: "title",
+      title: "任务流转",
+    },
+    {
+      type: "input",
+      itemType: "text",
+      label: "目标工序",
+      prop: "reamlke",
+      readonly: true,
+    },
+    {
+      type: "picker",
+      label: "负责人",
+      prop: "warehouseId",
+      itemType: "onePicker",
+      showPicker: false,
+      fieldNames: {
+        text: "label",
+        value: "value",
+      },
+      data: [],
+    },
+  ],
+  [
+    {
+      type: "input",
+      itemType: "text",
+      label: "产品名称",
+      prop: "reamlke",
+      readonly: true,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      label: "产品SN",
+      prop: "reamlke",
+      readonly: true,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      label: "当前工序",
+      prop: "reamlke",
+      readonly: true,
+    },
+    {
+      type: "slot",
+      label: "工序图纸",
+      slotName: "file",
+    },
+  ],
+];
+onMounted(() => {
+  if (route.query.type === "10") {
+    formConfig.value = configData[0];
+    formOption.submitBtnText = "提交";
+    getDict();
+  } else {
+    formConfig.value = configData[0];
+    formOption.submitBtnText = "提交入库";
+  }
+});
+</script>
+<style lang="scss" scoped>
+.row {
+  display: flex;
+  padding: 5px 10px 0 10px;
+  justify-content: space-between;
+  align-items: center;
+  .title {
+    flex: 1;
+  }
+  .delete {
+    width: 20px;
+    cursor: pointer;
+    text-align: center;
+  }
+}
+</style>

+ 120 - 0
src/views/JXSK/mes/forward/index.vue

@@ -0,0 +1,120 @@
+<template>
+  <div style="padding-bottom: 60px">
+    <van-nav-bar
+      title="任务流转"
+      left-text=""
+      left-arrow
+      @click-left="onClickLeft"
+      @click-right="onClickRight"
+    >
+      <!-- <template #right> 添加 </template> -->
+    </van-nav-bar>
+    <van-search
+      v-model="req.keyword"
+      placeholder="请输入搜索关键词"
+      @search="onRefresh"
+    />
+
+    <van-pull-refresh v-model="loading" @refresh="onRefresh">
+      <div class="list">
+        <van-list
+          v-model:loading="loading"
+          :finished="finished"
+          finished-text="没有更多了"
+          @load="onLoad"
+          style="margin-bottom: 60px"
+        >
+          <commonList
+            :data="listData"
+            :config="listConfig"
+            :showMore="true"
+            @onClick="toDtl"
+          ></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({
+  pageNum: 1,
+  keyword: null,
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+
+const listConfig = ref([
+  {
+    label: "产品名称",
+    prop: "productName",
+  },
+
+  {
+    label: "产品SN",
+    prop: "quantity",
+  },
+  {
+    label: "当前工序",
+    prop: "dueDate",
+  },
+]);
+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("jxskForwardAdd");
+};
+
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "jxskForwardAdd",
+    query: {
+      id: row.id,
+      type: "20",
+    },
+  });
+};
+
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/productionTask/page", req.value)
+    .then((res) => {
+      res.data.rows = [{ aa: "sss" }];
+      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/JXSK/mes/receive/add.vue

@@ -0,0 +1,138 @@
+<template>
+  <div class="form" style="padding-bottom: 60px">
+    <van-nav-bar
+      title="任务接收"
+      left-text="返回"
+      left-arrow
+      @click-left="onClickLeft"
+    >
+    </van-nav-bar>
+    <testForm
+      v-model="formData.data"
+      :formOption="formOption"
+      :formConfig="formConfig"
+      :rules="rules"
+      @onSubmit="onSubmit"
+      @otherBtnClick="otherBtnClick"
+      ref="formDom"
+    >
+      <template #file>
+        <div>aa</div>
+      </template>
+    </testForm>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, getCurrentInstance, onMounted } from "vue";
+import { showSuccessToast, showFailToast } from "vant";
+import { useRoute } from "vue-router";
+import testForm from "@/components/testForm/index.vue";
+const proxy = getCurrentInstance().proxy;
+const route = useRoute();
+const formDom = ref(null);
+const formData = reactive({
+  data: {
+    list: [],
+  },
+});
+const rules = {
+  warehouseName: [{ required: true, message: "仓库名称不能为空" }],
+  productName: [{ required: true, message: "物品名称不能为空" }],
+  quantity: [{ required: true, message: "入库数量不能为空" }],
+};
+const formOption = reactive({
+  readonly: false, //用于控制整个表单是否只读
+  disabled: false,
+  labelAlign: "top",
+  scroll: true,
+  labelWidth: "62pk",
+  otherBtn: true,
+  otherBtnText: "退回",
+  btnConfig: {
+    isNeed: false,
+    prop: "list",
+    plain: true,
+    listTitle: "",
+    listConfig: [],
+    clickFn: () => {},
+  },
+});
+const formConfig = reactive([
+  {
+    type: "input",
+    itemType: "text",
+    label: "产品名称",
+    prop: "reamlke",
+    readonly: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "产品SN",
+    prop: "reamlke",
+    readonly: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "前道工序",
+    prop: "reamlke",
+    readonly: true,
+  },
+  {
+    type: "slot",
+    label: "工序图纸",
+    slotName: "file",
+  },
+]);
+
+const onClickLeft = () => history.back();
+const onSubmit = () => {
+  proxy.post("/productionTask/add", formData.data).then(
+    (res) => {
+      setTimeout(() => {
+        showSuccessToast("添加成功");
+        proxy.$router.push("/main/task");
+      }, 500);
+    },
+    (err) => {
+      return showFailToast(err.message);
+    }
+  );
+};
+const otherBtnClick = () => {
+  console.log("aa");
+};
+const getDetails = () => {
+  proxy.post("/productionTask/detail", { id: route.query.id }).then(
+    (res) => {
+      console.log(res, "ada");
+    },
+    (err) => {
+      return showFailToast(err.message);
+    }
+  );
+};
+onMounted(() => {
+  if (route.query.id) {
+    getDetails();
+  }
+});
+</script>
+<style lang="scss" scoped>
+.row {
+  display: flex;
+  padding: 5px 10px 0 10px;
+  justify-content: space-between;
+  align-items: center;
+  .title {
+    flex: 1;
+  }
+  .delete {
+    width: 20px;
+    cursor: pointer;
+    text-align: center;
+  }
+}
+</style>

+ 127 - 0
src/views/JXSK/mes/receive/index.vue

@@ -0,0 +1,127 @@
+<template>
+  <div style="padding-bottom: 60px">
+    <van-nav-bar
+      title="任务接收"
+      left-text=""
+      left-arrow
+      @click-left="onClickLeft"
+      @click-right="onClickRight"
+    >
+      <!-- <template #right> 添加 </template> -->
+    </van-nav-bar>
+    <van-search
+      v-model="req.keyword"
+      placeholder="请输入搜索关键词"
+      @search="onRefresh"
+    />
+
+    <van-pull-refresh v-model="loading" @refresh="onRefresh">
+      <div class="list">
+        <van-list
+          v-model:loading="loading"
+          :finished="finished"
+          finished-text="没有更多了"
+          @load="onLoad"
+          style="margin-bottom: 60px"
+        >
+          <commonList
+            :data="listData"
+            :config="listConfig"
+            :showMore="true"
+            @onClick="toDtl"
+          ></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({
+  pageNum: 1,
+  keyword: null,
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+
+const listConfig = ref([
+  {
+    label: "任务编码",
+    prop: "code",
+  },
+  {
+    label: "产品名称",
+    prop: "productName",
+  },
+
+  {
+    label: "任务数量",
+    prop: "quantity",
+  },
+  {
+    label: "完成期限",
+    prop: "dueDate",
+  },
+  {
+    label: "负责人",
+    prop: "personLiableName",
+  },
+]);
+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("/main/jxskTaskAdd");
+};
+
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "jxskReceiveAdd",
+    query: {
+      id: row.id,
+    },
+  });
+};
+
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/productionTask/page", req.value)
+    .then((res) => {
+      res.data.rows = [{}];
+      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>