cz hace 1 año
padre
commit
ad98d18a1d

+ 11 - 0
src/components/testForm/index.vue

@@ -211,6 +211,7 @@
             v-if="i.type == 'picker' && i.itemType == 'datePicker'"
           >
             <van-date-picker
+              v-model="currentDate"
               @confirm="(option) => onConfirmPicker(option, i, index)"
               @cancel="i.showPicker = false"
               :min-date="i.minDate"
@@ -1134,6 +1135,16 @@ const defaultTimeFn = (item, index) => {
 const onSearchData = (item) => {
   item.onSearchData(item.searchKeyword);
 };
+
+const currentDate = ref(["2023", "01", "01"]);
+const initCurrentDate = () => {
+  const date = new Date();
+  const year = date.getFullYear();
+  const month = date.getMonth() + 1;
+  const day = date.getDate();
+  currentDate.value = [year + "", month + "", day + ""];
+};
+initCurrentDate();
 const validateForm = async () => {
   try {
     const flag = await testForm.value.validate();

+ 28 - 2
src/views/JXSK/mes/forward/add.vue

@@ -13,11 +13,12 @@
       :formConfig="formConfig"
       :rules="rules"
       @onSubmit="onSubmit"
+      @otherBtnClick="otherBtnClick"
       ref="formDom"
     >
-      <template #file>
+      <!-- <template #file>
         <div>aa</div>
-      </template>
+      </template> -->
     </testForm>
   </div>
 </template>
@@ -50,6 +51,8 @@ const formOption = reactive({
   scroll: true,
   labelWidth: "62pk",
   submitBtnText: proxy.t("common.submit"),
+  otherBtn: true,
+  otherBtnText: "退回",
   btnConfig: {
     isNeed: false,
     prop: "list",
@@ -105,6 +108,29 @@ const onSubmit = () => {
       );
   }
 };
+
+const otherBtnClick = () => {
+  showConfirmDialog({
+    title: "提示",
+    message: "你确定退回当前任务吗?",
+  })
+    .then(() => {
+      proxy
+        .post("/productionTaskDetail/revokeTask", { id: formData.data.id })
+        .then(
+          (res) => {
+            proxy.$router.push("/main/jxskReceive");
+          },
+          (err) => {
+            return showFailToast(err.message);
+          }
+        );
+    })
+    .catch(() => {
+      return;
+    });
+};
+
 const getDetails = () => {
   proxy.post("/productionTask/detail", { id: route.query.id }).then(
     (res) => {

+ 41 - 2
src/views/JXSK/mes/receive/add.vue

@@ -23,6 +23,7 @@
 <script setup>
 import { ref, reactive, getCurrentInstance, onMounted } from "vue";
 import { showSuccessToast, showFailToast } from "vant";
+import { showConfirmDialog } from "vant";
 import { useRoute } from "vue-router";
 import testForm from "@/components/testForm/index.vue";
 const proxy = getCurrentInstance().proxy;
@@ -83,14 +84,21 @@ const formConfig = reactive([
   {
     type: "input",
     itemType: "text",
-    label: proxy.t("receive.previousProcess"),
+    label: "当前工序",
     prop: "productionProcessesName",
     readonly: true,
   },
   {
     type: "input",
     itemType: "text",
-    label: proxy.t("receive.circulationInto"),
+    label: proxy.t("receive.previousProcess"),
+    prop: "previousProcessesName",
+    readonly: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "流转人",
     prop: "circulationUserName",
     readonly: true,
   },
@@ -98,6 +106,37 @@ const formConfig = reactive([
 
 const onClickLeft = () => history.back();
 const onSubmit = () => {
+  proxy
+    .post("/productionTaskDetail/haveTaskCount", {
+      productionProcessesId: formData.data.productionProcessesId,
+    })
+    .then((res) => {
+      if (res.data && Number(res.data) > 0) {
+        showConfirmDialog({
+          title: "提示",
+          message: "你当前还有进行中的任务尚未提交,确认接收新任务吗?",
+        })
+          .then(() => {
+            showConfirmDialog({
+              title: "提示",
+              message: "你当前还有进行中的任务尚未提交,确认接收新任务吗?",
+            })
+              .then(() => {
+                submitApi();
+              })
+              .catch(() => {
+                return;
+              });
+          })
+          .catch(() => {
+            return;
+          });
+      } else {
+        submitApi();
+      }
+    });
+};
+const submitApi = () => {
   proxy.post("/productionTaskDetail/receive", { id: formData.data.id }).then(
     (res) => {
       setTimeout(() => {

+ 7 - 3
src/views/JXSK/mes/receive/index.vue

@@ -50,18 +50,22 @@ const listData = ref([]);
 
 const listConfig = ref([
   {
-    label: proxy.t('receive.productName'),
+    label: proxy.t("receive.productName"),
     prop: "productName",
   },
 
   {
-    label: proxy.t('receive.productSN'),
+    label: proxy.t("receive.productSN"),
     prop: "productSn",
   },
   {
-    label:proxy.t('receive.previousProcess'),
+    label: "当前工序",
     prop: "productionProcessesName",
   },
+  {
+    label: proxy.t("receive.previousProcess"),
+    prop: "previousProcessesName",
+  },
 ]);
 const onRefresh = () => {
   req.value.pageNum = 1;

+ 12 - 2
src/views/JXSK/mes/task/add.vue

@@ -169,6 +169,16 @@ const formConfig = reactive([
       } else {
         formConfig[index].showPicker = false;
       }
+      if (
+        productionProcessesList.value &&
+        productionProcessesList.value.length > 0
+      ) {
+        let id = productionProcessesList.value[0].id;
+        const index = formConfig.findIndex((x) => x.slotName === id);
+        formConfig.splice(index, productionProcessesList.value.length);
+        productionProcessesList.value = [];
+        productionObj.value = {};
+      }
       getProductionDetails(formData.data.productionPlanId);
     },
   },
@@ -188,7 +198,7 @@ const formConfig = reactive([
   },
   {
     type: "input",
-    itemType: "number",
+    itemType: "digit",
     label: proxy.t("task.taskQuantity"),
     prop: "quantity",
   },
@@ -220,7 +230,7 @@ const getDict = () => {
     .post("/productionPlan/page", {
       pageNum: 1,
       pageSize: 9999,
-      isRemaining: "1",
+      isRemaining: route.query.id ? "" : "1",
     })
     .then((res) => {
       formConfig[0].data = res.data.rows.map((item) => {

+ 16 - 1
src/views/JXSK/salesContract/add.vue

@@ -146,7 +146,7 @@ const formOption = reactive({
       },
       {
         type: "input",
-        itemType: "number",
+        itemType: "digit",
         label: proxy.t("salesContract.quantity"),
         prop: "quantity",
         clearable: true,
@@ -197,6 +197,11 @@ const formConfig = reactive([
       value: "value",
     },
     data: [],
+    isNeedSearch: true, //是否需要关键字过滤数据
+    searchKeyword: "",
+    onSearchData: (keyword) => {
+      getCustomerData(keyword);
+    },
   },
   {
     type: "picker",
@@ -294,6 +299,16 @@ const getProductData = (keyword) => {
   });
 };
 
+const getCustomerData = (keyword) => {
+  proxy.post("/customer/page", { keyword }).then((res) => {
+    customerData.value = res.data.rows.map((x) => ({
+      label: x.name,
+      value: x.id,
+    }));
+    formConfig[0].data = customerData.value;
+  });
+};
+
 const getDetails = (id) => {
   proxy.post("/salesContract/detail", { id }).then((res) => {
     if (res.data && res.data.contractDetailsList.length > 0) {

+ 1 - 1
src/views/MES/produce/plan/add.vue

@@ -90,7 +90,7 @@
           v-model="formData.quantity"
           :label="$t('plan.planQuantity')"
           :placeholder="$t('plan.pleaseEnterThePlanQuantity')"
-          type="number"
+          type="digit"
           :rules="[
             { required: true, message: $t('plan.planQuantityCanNotBeEmpty') },
           ]"

+ 215 - 177
src/views/main.vue

@@ -1,144 +1,182 @@
 <template>
-	<div class="main" id="main">
-		<!-- <KeepAlive>
+  <div class="main" id="main">
+    <!-- <KeepAlive>
 			<router-view />
     	</KeepAlive> -->
-		<router-view v-slot="{ Component, route }">
-			<keep-alive  include="working">
-				<component v-if="!route.meta.link" :is="Component" :key="route.fullPath"/>
-			</keep-alive>
-		</router-view>
-		
-	</div>
-	<van-tabbar v-model="tabType" v-if="routerName != '/main/processDtl'"  @change="onChange" :style="isIos() ? 'height:65px' : ''">
-		<van-tabbar-item to="/main/message" name="message" :badge="msgCount" :style="isIos() ? 'padding-bottom:15px' : ''">
-			{{$t('common.message')}}
-			<template #icon="props">
-				<i class="icon iconfont icon-btn_shengc_gray1 footer-icon" :class="props.active ? 'footer-icon-active' : ''"></i>
-			</template>
-		</van-tabbar-item>
-		<van-tabbar-item to="/main/working"  name="working" :style="isIos() ? 'padding-bottom:15px' : ''">
-			{{$t('common.workbench')}}
-			<template #icon="props">
-				<i class="icon iconfont icon-btn_gongz footer-icon" :class="props.active ? 'footer-icon-active' : ''"></i>
-			</template>
-		</van-tabbar-item>
-		<van-tabbar-item
-			:style="isIos() ? 'padding-bottom:15px' : ''"
-			:to="tenantId == 'smt' ? '/main/xiamenList' : '/main/equipment'"
-			name="equipment"
-			>{{$t('common.things')}}
-			<template #icon="props">
-				<i class="icon iconfont icon-btn_wulw footer-icon" :class="props.active ? 'footer-icon-active' : ''"></i>
-			</template>
-		</van-tabbar-item>
-		<van-tabbar-item icon="setting-o" to="/main/home" :style="isIos() ? 'padding-bottom:15px' : ''" name="home">
-			{{$t('common.mine')}}
-			<template #icon="props">
-				<i class="icon iconfont icon-btn_mine footer-icon" :class="props.active ? 'footer-icon-active' : ''"></i>
-			</template>
-		</van-tabbar-item>
-	</van-tabbar>
+    <router-view v-slot="{ Component, route }">
+      <keep-alive include="working">
+        <component
+          v-if="!route.meta.link"
+          :is="Component"
+          :key="route.fullPath"
+        />
+      </keep-alive>
+    </router-view>
+  </div>
+  <van-tabbar
+    v-model="tabType"
+    v-if="routerName != '/main/processDtl'"
+    @change="onChange"
+    :style="isIos() ? 'height:65px' : ''"
+  >
+    <van-tabbar-item
+      to="/main/message"
+      name="message"
+      :badge="msgCount"
+      :style="isIos() ? 'padding-bottom:15px' : ''"
+    >
+      {{ $t("common.message") }}
+      <template #icon="props">
+        <i
+          class="icon iconfont icon-btn_shengc_gray1 footer-icon"
+          :class="props.active ? 'footer-icon-active' : ''"
+        ></i>
+      </template>
+    </van-tabbar-item>
+    <van-tabbar-item
+      to="/main/working"
+      name="working"
+      :badge="msgCountOne"
+      :style="isIos() ? 'padding-bottom:15px' : ''"
+    >
+      {{ $t("common.workbench") }}
+      <template #icon="props">
+        <i
+          class="icon iconfont icon-btn_gongz footer-icon"
+          :class="props.active ? 'footer-icon-active' : ''"
+        ></i>
+      </template>
+    </van-tabbar-item>
+    <van-tabbar-item
+      :style="isIos() ? 'padding-bottom:15px' : ''"
+      :to="tenantId == 'smt' ? '/main/xiamenList' : '/main/equipment'"
+      name="equipment"
+      >{{ $t("common.things") }}
+      <template #icon="props">
+        <i
+          class="icon iconfont icon-btn_wulw footer-icon"
+          :class="props.active ? 'footer-icon-active' : ''"
+        ></i>
+      </template>
+    </van-tabbar-item>
+    <van-tabbar-item
+      icon="setting-o"
+      to="/main/home"
+      :style="isIos() ? 'padding-bottom:15px' : ''"
+      name="home"
+    >
+      {{ $t("common.mine") }}
+      <template #icon="props">
+        <i
+          class="icon iconfont icon-btn_mine footer-icon"
+          :class="props.active ? 'footer-icon-active' : ''"
+        ></i>
+      </template>
+    </van-tabbar-item>
+  </van-tabbar>
 </template>
 <script setup>
-import { ref, getCurrentInstance, watch,computed } from 'vue'
-import { getUserInfo,getToken } from '@/utils/auth'
-import { useRouter } from 'vue-router'
-import { lang } from '@/lang/cn'
-import * as dd from 'dingtalk-jsapi'
-import '@/assets/icon/iconfont.css'
-import 'vant/lib/index.css'
-import axios from 'axios'
-import { uploadDdRightBtn } from '@/utils/ddAdapter'
-import { showDialog,showNotify } from 'vant'
-import tabTypeStore from '@/store/modules/tabType'
+import { ref, getCurrentInstance, watch, computed } from "vue";
+import { getUserInfo, getToken } from "@/utils/auth";
+import { useRouter } from "vue-router";
+import { lang } from "@/lang/cn";
+import * as dd from "dingtalk-jsapi";
+import "@/assets/icon/iconfont.css";
+import "vant/lib/index.css";
+import axios from "axios";
+import { uploadDdRightBtn } from "@/utils/ddAdapter";
+import { showDialog, showNotify } from "vant";
+import tabTypeStore from "@/store/modules/tabType";
 
 const onChange = (val) => {
-	tabTypeStore().setTabType(val)
+  tabTypeStore().setTabType(val);
 
-	if (val == 'message') {
-		router.push('/main/message')
-	}
-	if (val == 'working') {
-		router.push('/main/working')
-	}
-	if (val == 'equipment') {
-		router.push('/main/equipment')
-	}
-	if (val == 'home') {
-		router.push('/main/home')
-	}
-}
-const tenantId = getUserInfo().tenantId
-const proxy = getCurrentInstance().proxy
+  if (val == "message") {
+    router.push("/main/message");
+  }
+  if (val == "working") {
+    router.push("/main/working");
+  }
+  if (val == "equipment") {
+    router.push("/main/equipment");
+  }
+  if (val == "home") {
+    router.push("/main/home");
+  }
+};
+const tenantId = getUserInfo().tenantId;
+const proxy = getCurrentInstance().proxy;
 const tabType = computed(() => tabTypeStore().tabType);
-const msgCount = ref(0)
+const msgCount = ref(0);
+const msgCountOne = ref(0);
+
 const socketInit = () => {
-	window.ws = new WebSocket(
-		'ws://'+ process.env.VUE_APP_IP + process.env.VUE_APP_WS_API +'/webStock/' +
-			getToken()
-		// 'ws://192.168.1.97:8300/webStock/' + window.localStorage.getItem('token')
-	)
-	//申请一个WebSocket对象,参数是服务端地址,同http协议使用http://开头一样,WebSocket协议的url使用ws://开头,另外安全的WebSocket协议使用wss://开头
-	window.ws.onopen = function () {
-		//当WebSocket创建成功时,触发onopen事件
-		console.log('open')
-	}
-	window.ws.onmessage = function (e) {
-		//当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
-		//在data.value前面插入
-		const res = JSON.parse(e.data)
-		console.log(res)
-		
-		
-		if(res.type == 1) {
-			
-			if(res.list.length > 0) {
-				showDialog({
-					title: res.list[0].title,
-					message: res.list[0].businessData,
-				}).then(() => {
-					proxy.post('/pushInfo/read', {
-						idList: [res.list[0].id],
-					}).then((res) => {
-						if(res.code == 200) {
-							showNotify({ type: 'primary', message: '确认已读' });
-						}
-					})
-				})
-			}
-		}
-		if(res.type == 2) {
-			msgCount.value = res.count * 1
-		}
-		if(res.type == 3) {
-			// ElNotification({
-			// 	title: '提示',
-			// 	message: res.title,
-			// 	position: 'bottom-right',
-			// 	duration:0,
-			// })
-		}
-		
-	}
-	window.ws.onclose = function (e) {
-		//当客户端收到服务端发送的关闭连接请求时,触发onclose事件
-		console.log('close')
-	}
-	window.ws.onerror = function (e) {
-		//如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
-		console.log(e)
-	}
-}
-socketInit()
+  window.ws = new WebSocket(
+    "ws://" +
+      process.env.VUE_APP_IP +
+      process.env.VUE_APP_WS_API +
+      "/webStock/" +
+      getToken()
+    // 'ws://192.168.1.97:8300/webStock/' + window.localStorage.getItem('token')
+  );
+  //申请一个WebSocket对象,参数是服务端地址,同http协议使用http://开头一样,WebSocket协议的url使用ws://开头,另外安全的WebSocket协议使用wss://开头
+  window.ws.onopen = function () {
+    //当WebSocket创建成功时,触发onopen事件
+    console.log("open");
+  };
+  window.ws.onmessage = function (e) {
+    //当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
+    //在data.value前面插入
+    const res = JSON.parse(e.data);
+    console.log(res);
+
+    if (res.type == 1) {
+      if (res.list.length > 0) {
+        showDialog({
+          title: res.list[0].title,
+          message: res.list[0].businessData,
+        }).then(() => {
+          proxy
+            .post("/pushInfo/read", {
+              idList: [res.list[0].id],
+            })
+            .then((res) => {
+              if (res.code == 200) {
+                showNotify({ type: "primary", message: "确认已读" });
+              }
+            });
+        });
+      }
+    }
+    if (res.type == 2) {
+      msgCount.value = res.count * 1;
+    }
+    if (res.type == 3) {
+      // ElNotification({
+      // 	title: '提示',
+      // 	message: res.title,
+      // 	position: 'bottom-right',
+      // 	duration:0,
+      // })
+    }
+  };
+  window.ws.onclose = function (e) {
+    //当客户端收到服务端发送的关闭连接请求时,触发onclose事件
+    console.log("close");
+  };
+  window.ws.onerror = function (e) {
+    //如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
+    console.log(e);
+  };
+};
+socketInit();
 
 //判断是否是ios系统
 const isIos = () => {
-	const u = navigator.userAgent
-	const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) //ios终端
-	return isIOS
-}
-
+  const u = navigator.userAgent;
+  const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
+  return isIOS;
+};
 
 //判断是否为开发环境.如果是开发环境,则同步前后台中文配置表
 // const isDev = process.env.NODE_ENV === 'development'
@@ -156,68 +194,68 @@ const isIos = () => {
 // 		} catch (error) {}
 // 	}
 // }
-const corpId = window.localStorage.getItem('corpId')
-let routerName = ref(null)
+const corpId = window.localStorage.getItem("corpId");
+let routerName = ref(null);
 //监听路由变化
-const router = useRouter()
+const router = useRouter();
 //获取当前path
-routerName.value = router.currentRoute.value.path
+routerName.value = router.currentRoute.value.path;
 watch(router.currentRoute, (to, from) => {
-	routerName.value = to.path
-	console.log('routerName', routerName.value)
-	//滚动条回到顶部
-	document.documentElement.scrollTop = 0
-	if (!corpId) return
-	dd.biz.navigation.setTitle({
-		title: router.currentRoute.value.name,
-		onSuccess: function (result) {},
-		onFail: function (err) {},
-	})
-	//设置右侧按钮
-	proxy.uploadDdRightBtn(function () {}, ' ')
+  routerName.value = to.path;
+  console.log("routerName", routerName.value);
+  //滚动条回到顶部
+  document.documentElement.scrollTop = 0;
+  if (!corpId) return;
+  dd.biz.navigation.setTitle({
+    title: router.currentRoute.value.name,
+    onSuccess: function (result) {},
+    onFail: function (err) {},
+  });
+  //设置右侧按钮
+  proxy.uploadDdRightBtn(function () {}, " ");
 
-	//获取元素的绑定事件
-	setTimeout(() => {
-		if (!corpId) {
-			return
-		}
-		let el = document.getElementsByClassName('van-nav-bar__content')[0]
-		if (el) {
-			//删除el元素
-			el.parentNode.removeChild(el)
-		}
-	}, 10)
-})
+  //获取元素的绑定事件
+  setTimeout(() => {
+    if (!corpId) {
+      return;
+    }
+    let el = document.getElementsByClassName("van-nav-bar__content")[0];
+    if (el) {
+      //删除el元素
+      el.parentNode.removeChild(el);
+    }
+  }, 10);
+});
 </script>
 <style lang="scss">
 .main {
-	position: absolute;
-	top: 0;
-	left: 0;
-	right: 0;
-	bottom: 0;
-	padding-bottom:65px;
-	overflow-y: auto;
-	
-	padding-top:46px;
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  padding-bottom: 65px;
+  overflow-y: auto;
+
+  padding-top: 46px;
 }
-.footer-icon{
-	font-size: 20px;
-	color: #BBBBBB;
+.footer-icon {
+  font-size: 20px;
+  color: #bbbbbb;
 }
-.footer-icon-active{
-	color: #3E7BFA;
+.footer-icon-active {
+  color: #3e7bfa;
 }
-.footer-icon{
-	font-size: 20px;
-	color: #BBBBBB;
+.footer-icon {
+  font-size: 20px;
+  color: #bbbbbb;
 }
-.footer-icon-active{
-	color: #3E7BFA;
+.footer-icon-active {
+  color: #3e7bfa;
 }
 </style>
 <style>
-.van-pull-refresh{
-    flex: 1;
+.van-pull-refresh {
+  flex: 1;
 }
 </style>