Переглянути джерело

外协商端,外协单列表

ezhizao 1 рік тому
батько
коміт
e85898f21d

+ 1 - 7
.env.development

@@ -7,10 +7,4 @@ VITE_APP_ENV = 'development'
 # 德迈仕数字化平台/开发环境
 
 # 基础接口前缀
-VITE_APP_BASE_API = '/ezhizao-dms-sys'
-
-# 拉取P2系统接口前缀
-VITE_APP_P2_API = '/ezhizao-dms-p2'
-
-# 生产管理系统接口前缀
-VITE_APP_PRODUCTION_API = '/ezhizao-dms-production'
+VITE_APP_BASE_API = '/ezhizao-dms-supplier-api'

+ 1 - 7
.env.production

@@ -5,13 +5,7 @@ VITE_APP_TITLE = 德迈仕数字化平台
 VITE_APP_ENV = 'production'
 
 # 德迈仕数字化平台/生产环境
-VITE_APP_BASE_API = '/ezhizao-dms-sys'
-
-# 拉取P2系统接口前缀
-VITE_APP_P2_API = '/ezhizao-dms-p2'
-
-# 生产管理系统接口前缀
-VITE_APP_PRODUCTION_API = '/ezhizao-dms-production'
+VITE_APP_BASE_API = '/ezhizao-dms-supplier-api'
 
 # 是否在打包时开启压缩,支持 gzip 和 brotli
 VITE_BUILD_COMPRESS = gzip

+ 1 - 27
src/api/business/outsourcedOrder.js

@@ -1,6 +1,6 @@
 import request from '@/utils/request'
 
-const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+const baseUrl = import.meta.env.VITE_APP_BASE_API
 
 // 查询外协单
 export function listOrder(query) {
@@ -18,29 +18,3 @@ export function getOrder(id) {
 		method: 'get'
 	})
 }
-
-// 新增外协单
-export function addOrder(data) {
-	return request({
-		url: baseUrl + '/business/outsource',
-		method: 'post',
-		data: data
-	})
-}
-
-// 修改外协单
-export function updateOrder(data) {
-	return request({
-		url: baseUrl + '/business/outsource',
-		method: 'put',
-		data: data
-	})
-}
-
-// 删除外协单
-export function delOrder(id) {
-	return request({
-		url: baseUrl + '/business/outsource/' + id,
-		method: 'delete'
-	})
-}

+ 45 - 38
src/api/login.js

@@ -3,58 +3,65 @@ import request from '@/utils/request'
 const baseUrl = import.meta.env.VITE_APP_BASE_API
 // 登录方法
 export function login(username, password, code, uuid) {
-  const data = {
-    username,
-    password,
-    code,
-    uuid
-  }
-  return request({
-    url: baseUrl + '/login',
-    headers: {
-      isToken: false
-    },
-    method: 'post',
-    data: data
-  })
+	const data = {
+		username,
+		password,
+		code,
+		uuid
+	}
+	return request({
+		url: baseUrl + '/login',
+		headers: {
+			isToken: false
+		},
+		method: 'post',
+		data: data
+	})
 }
 
 // 注册方法
 export function register(data) {
-  return request({
-    url: baseUrl + '/register',
-    headers: {
-      isToken: false
-    },
-    method: 'post',
-    data: data
-  })
+	return request({
+		url: baseUrl + '/register',
+		headers: {
+			isToken: false
+		},
+		method: 'post',
+		data: data
+	})
+}
+
+export function getSuppliers(data) {
+	return request({
+		url: baseUrl + '/snms/getSupplierListByOrgName/' + data,
+		method: 'get'
+	})
 }
 
 // 获取用户详细信息
 export function getInfo() {
-  return request({
-    url: baseUrl + '/getInfo',
-    method: 'get'
-  })
+	return request({
+		url: baseUrl + '/getInfo',
+		method: 'get'
+	})
 }
 
 // 退出方法
 export function logout() {
-  return request({
-    url: baseUrl + '/logout',
-    method: 'post'
-  })
+	return request({
+		url: baseUrl + '/logout',
+		method: 'post'
+	})
 }
 
 // 获取验证码
 export function getCodeImg() {
-  return request({
-    url: baseUrl + '/captchaImage',
-    headers: {
-      isToken: false
-    },
-    method: 'get',
-    timeout: 20000
-  })
+	return request({
+		url: baseUrl + '/captchaImage',
+		headers: {
+			isToken: false
+		},
+		method: 'get',
+		timeout: 20000
+	})
 }

+ 151 - 203
src/layout/components/Navbar.vue

@@ -1,22 +1,21 @@
 <template>
-  <div class="navbar">
-    <hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
-    <breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!settingsStore.topNav" />
-    <top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" />
-
-    <div class="right-menu">
-      <div style="color: #fff; padding-right: 16px; font-size: 14px">
-        <span>当前厂别:</span>
-        <template v-if="currentTenantName!='超级管理员'">
-             <span style="cursor: pointer"  @click="handleShowTenantDialog">{{ currentTenantName }}</span>
-        </template>
-        <template v-else>
-          <span style="cursor: pointer"  >{{ currentTenantName }}</span>
-        </template>
-        <!-- <span style="cursor: pointer"  @click="handleShowTenantDialog">{{ currentTenantName }}</span> -->
-      </div>
-      <template v-if="appStore.device !== 'mobile'">
-        <!--
+	<div class="navbar">
+		<hamburger
+			id="hamburger-container"
+			:is-active="appStore.sidebar.opened"
+			class="hamburger-container"
+			@toggleClick="toggleSideBar"
+		/>
+		<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!settingsStore.topNav" />
+		<top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" />
+
+		<div class="right-menu">
+			<div style="color: #fff; padding-right: 16px; font-size: 14px">
+				<span>当前厂别:</span>
+				<span style="cursor: pointer">{{ currentTenantName }}</span>
+			</div>
+			<template v-if="appStore.device !== 'mobile'">
+				<!--
         <header-search id="header-search" class="right-menu-item" />
         <el-tooltip content="源码地址" effect="dark" placement="bottom">
           <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
@@ -29,41 +28,30 @@
           <size-select id="size-select" class="right-menu-item hover-effect" />
         </el-tooltip>
         -->
-      </template>
-      <div class="avatar-container">
-        <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
-          <div class="avatar-wrapper">
-            <img :src="userStore.avatar" class="user-avatar" />
-            <el-icon><caret-bottom /></el-icon>
-          </div>
-          <template #dropdown>
-            <el-dropdown-menu>
-              <router-link to="/user/profile">
-                <el-dropdown-item>个人中心</el-dropdown-item>
-              </router-link>
-              <el-dropdown-item command="setLayout">
-                <span>布局设置</span>
-              </el-dropdown-item>
-              <el-dropdown-item divided command="logout">
-                <span>退出登录</span>
-              </el-dropdown-item>
-            </el-dropdown-menu>
-          </template>
-        </el-dropdown>
-      </div>
-    </div>
-
-    <el-dialog title="切换厂别" v-model="showDialog" width="450" top="10vh" center @close="showDialog = false">
-      <el-table :data="tenantList" v-loading="tenantLoading">
-        <el-table-column label="厂别" prop="orgName" header-align="center" />
-        <el-table-column label="选择" prop="createTime" width="50" align="center">
-          <template #default="scope">
-            <el-button link type="success" icon="Check" size="small"  @click="handleChangeTenant(scope.row)" >选择</el-button>
-          </template>
-        </el-table-column>
-      </el-table>
-    </el-dialog>
-  </div>
+			</template>
+			<div class="avatar-container">
+				<el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
+					<div class="avatar-wrapper">
+						<img :src="userStore.avatar" class="user-avatar" />
+						<el-icon><caret-bottom /></el-icon>
+					</div>
+					<template #dropdown>
+						<el-dropdown-menu>
+							<router-link to="/user/profile">
+								<el-dropdown-item>个人中心</el-dropdown-item>
+							</router-link>
+							<el-dropdown-item command="setLayout">
+								<span>布局设置</span>
+							</el-dropdown-item>
+							<el-dropdown-item divided command="logout">
+								<span>退出登录</span>
+							</el-dropdown-item>
+						</el-dropdown-menu>
+					</template>
+				</el-dropdown>
+			</div>
+		</div>
+	</div>
 </template>
 
 <script setup>
@@ -80,7 +68,6 @@ import useAppStore from '@/store/modules/app'
 import useUserStore from '@/store/modules/user'
 import useSettingsStore from '@/store/modules/settings'
 import { setTenant, getTenant } from '@/utils/auth'
-import { listTenant } from '@/api/business/tenant.js'
 import router from '@/router'
 
 const { proxy } = getCurrentInstance()
@@ -89,172 +76,133 @@ const userStore = useUserStore()
 const settingsStore = useSettingsStore()
 
 const tenantLoading = ref(false)
-const showDialog = ref(false)
-const tenantList = ref([])
 const currentTenantName = ref(getTenant().tenantName)
 
 function toggleSideBar() {
-  appStore.toggleSideBar()
+	appStore.toggleSideBar()
 }
 
 function handleCommand(command) {
-  switch (command) {
-    case 'setLayout':
-      setLayout()
-      break
-    case 'logout':
-      logout()
-      break
-    default:
-      break
-  }
+	switch (command) {
+		case 'setLayout':
+			setLayout()
+			break
+		case 'logout':
+			logout()
+			break
+		default:
+			break
+	}
 }
 
 function logout() {
-  ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
-    confirmButtonText: '确定',
-    cancelButtonText: '取消',
-    type: 'warning'
-  })
-    .then(() => {
-      userStore.logOut().then(() => {
-        setTenant({})
-        location.href = '/index'
-      })
-    })
-    .catch(() => {})
+	ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
+		confirmButtonText: '确定',
+		cancelButtonText: '取消',
+		type: 'warning'
+	})
+		.then(() => {
+			userStore.logOut().then(() => {
+				setTenant({})
+				location.href = '/index'
+			})
+		})
+		.catch(() => {})
 }
 
 const emits = defineEmits(['setLayout'])
 function setLayout() {
-  emits('setLayout')
-}
-
-const handleShowTenantDialog = () => {
-  showDialog.value = true
-  loadTenant()
-}
-
-const handleChangeTenant = (row) => {
-  ElMessageBox.confirm('确定切换到该厂别吗?', '提示', {
-    confirmButtonText: '确定',
-    cancelButtonText: '取消',
-    type: 'warning'
-  })
-    .then(() => {
-      // 切换
-      setTenant({ tenantId: row.id, tenantName: row.orgName })
-      currentTenantName.value = row.orgName
-      showDialog.value = false
-      // 更换厂别后,刷新当前路由
-      const { path, query } = router.currentRoute.value
-      router.replace({
-        path: '/redirect' + path,
-        query: query
-      })
-      location.reload()
-    })
-    .catch(() => {})
-}
-
-const loadTenant = () => {
-  tenantLoading.value = true
-  listTenant().then((res) => {
-    if (res.code === 200) {
-      tenantList.value = res.rows
-    }
-    tenantLoading.value = false
-  })
+	emits('setLayout')
 }
 </script>
 
 <style lang="scss" scoped>
 .navbar {
-  height: 50px;
-  overflow: hidden;
-  position: relative;
-  background: #282b33;
-  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
-
-  .hamburger-container {
-    line-height: 46px;
-    height: 100%;
-    float: left;
-    cursor: pointer;
-    transition: background 0.3s;
-    -webkit-tap-highlight-color: transparent;
-    color: #fff;
-
-    &:hover {
-      background: rgba(255, 255, 255, 0.1);
-    }
-  }
-
-  .breadcrumb-container {
-    float: left;
-  }
-
-  .topmenu-container {
-    position: absolute;
-    left: 50px;
-  }
-
-  .errLog-container {
-    display: inline-block;
-    vertical-align: top;
-  }
-
-  .right-menu {
-    float: right;
-    height: 100%;
-    line-height: 50px;
-    display: flex;
-
-    &:focus {
-      outline: none;
-    }
-
-    .right-menu-item {
-      display: inline-block;
-      padding: 0 8px;
-      height: 100%;
-      font-size: 18px;
-      color: #5a5e66;
-      vertical-align: text-bottom;
-
-      &.hover-effect {
-        cursor: pointer;
-        transition: background 0.3s;
-
-        &:hover {
-          background: rgba(0, 0, 0, 0.025);
-        }
-      }
-    }
-
-    .avatar-container {
-      margin-right: 40px;
-
-      .avatar-wrapper {
-        margin-top: 5px;
-        position: relative;
-
-        .user-avatar {
-          cursor: pointer;
-          width: 40px;
-          height: 40px;
-          border-radius: 10px;
-        }
-
-        i {
-          cursor: pointer;
-          position: absolute;
-          right: -20px;
-          top: 25px;
-          font-size: 12px;
-        }
-      }
-    }
-  }
+	height: 50px;
+	overflow: hidden;
+	position: relative;
+	background: #282b33;
+	box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
+
+	.hamburger-container {
+		line-height: 46px;
+		height: 100%;
+		float: left;
+		cursor: pointer;
+		transition: background 0.3s;
+		-webkit-tap-highlight-color: transparent;
+		color: #fff;
+
+		&:hover {
+			background: rgba(255, 255, 255, 0.1);
+		}
+	}
+
+	.breadcrumb-container {
+		float: left;
+	}
+
+	.topmenu-container {
+		position: absolute;
+		left: 50px;
+	}
+
+	.errLog-container {
+		display: inline-block;
+		vertical-align: top;
+	}
+
+	.right-menu {
+		float: right;
+		height: 100%;
+		line-height: 50px;
+		display: flex;
+
+		&:focus {
+			outline: none;
+		}
+
+		.right-menu-item {
+			display: inline-block;
+			padding: 0 8px;
+			height: 100%;
+			font-size: 18px;
+			color: #5a5e66;
+			vertical-align: text-bottom;
+
+			&.hover-effect {
+				cursor: pointer;
+				transition: background 0.3s;
+
+				&:hover {
+					background: rgba(0, 0, 0, 0.025);
+				}
+			}
+		}
+
+		.avatar-container {
+			margin-right: 40px;
+
+			.avatar-wrapper {
+				margin-top: 5px;
+				position: relative;
+
+				.user-avatar {
+					cursor: pointer;
+					width: 40px;
+					height: 40px;
+					border-radius: 10px;
+				}
+
+				i {
+					cursor: pointer;
+					position: absolute;
+					right: -20px;
+					top: 25px;
+					font-size: 12px;
+				}
+			}
+		}
+	}
 }
 </style>

+ 109 - 195
src/router/index.js

@@ -26,206 +26,120 @@ import Layout from '@/layout'
 
 // 公共路由
 export const constantRoutes = [
-  {
-    path: '/redirect',
-    component: Layout,
-    hidden: true,
-    children: [
-      {
-        path: '/redirect/:path(.*)',
-        component: () => import('@/views/redirect/index.vue')
-      }
-    ]
-  },
-  {
-    path: '/login',
-    component: () => import('@/views/login'),
-    hidden: true
-  },
-  {
-    path: '/register',
-    component: () => import('@/views/register'),
-    hidden: true
-  },
-  {
-    path: '/:pathMatch(.*)*',
-    component: () => import('@/views/error/404'),
-    hidden: true
-  },
-  {
-    path: '/401',
-    component: () => import('@/views/error/401'),
-    hidden: true
-  },
-  {
-    path: '',
-    component: Layout,
-    redirect: '/index',
-    children: [
-      {
-        path: '/index',
-        component: () => import('@/views/index'),
-        name: 'Index',
-        meta: {
-          title: '首页',
-          icon: 'dashboard',
-          affix: true
-        }
-      }
-    ]
-  },
-  {
-    path: '/user',
-    component: Layout,
-    hidden: true,
-    redirect: 'noredirect',
-    children: [
-      {
-        path: 'profile',
-        component: () => import('@/views/system/user/profile/index'),
-        name: 'Profile',
-        meta: {
-          title: '个人中心',
-          icon: 'user'
-        }
-      }
-    ]
-  }
+	{
+		path: '/redirect',
+		component: Layout,
+		hidden: true,
+		children: [
+			{
+				path: '/redirect/:path(.*)',
+				component: () => import('@/views/redirect/index.vue')
+			}
+		]
+	},
+	{
+		path: '/login',
+		component: () => import('@/views/login'),
+		hidden: true
+	},
+	{
+		path: '/register',
+		component: () => import('@/views/register'),
+		hidden: true
+	},
+	{
+		path: '/:pathMatch(.*)*',
+		component: () => import('@/views/error/404'),
+		hidden: true
+	},
+	{
+		path: '/401',
+		component: () => import('@/views/error/401'),
+		hidden: true
+	},
+	{
+		path: '',
+		component: Layout,
+		redirect: '/index',
+		children: [
+			{
+				path: '/index',
+				component: () => import('@/views/index'),
+				name: 'Index',
+				meta: {
+					title: '首页',
+					icon: 'dashboard',
+					affix: true
+				}
+			}
+		]
+	},
+	{
+		path: '/outsourcedOrder',
+		component: Layout,
+		//permissions: ['business:outsourcedOrder:query'],
+		children: [
+			{
+				path: 'outsourcedOrder/index',
+				component: () => import('@/views/business/outsourcedOrder/index'),
+				name: 'OutsourcedOrder',
+				meta: {
+					title: '外协订单',
+					icon: 'documentation'
+				}
+			}
+		]
+	},
+	{
+		path: '/outsourcedOrderDetails',
+		component: Layout,
+		//permissions: ['business:outsourcedOrderDetails:query'],
+		children: [
+			{
+				path: 'outsourcedOrderDetails/index',
+				component: () => import('@/views/business/outsourcedOrderDetails/index'),
+				name: 'OutsourcedOrderDetails',
+				meta: {
+					title: '外协订单明细',
+					icon: 'list'
+				}
+			}
+		]
+	},
+	{
+		path: '/user',
+		component: Layout,
+		hidden: true,
+		redirect: 'noredirect',
+		children: [
+			{
+				path: 'profile',
+				component: () => import('@/views/system/user/profile/index'),
+				name: 'Profile',
+				meta: {
+					title: '个人中心',
+					icon: 'user'
+				}
+			}
+		]
+	}
 ]
 
 // 动态路由,基于用户权限动态去加载
-export const dynamicRoutes = [
-  {
-    path: '/system/user-auth',
-    component: Layout,
-    hidden: true,
-    permissions: ['system:user:edit'],
-    children: [
-      {
-        path: 'role/:userId(\\d+)',
-        component: () => import('@/views/system/user/authRole'),
-        name: 'AuthRole',
-        meta: {
-          title: '分配角色',
-          activeMenu: '/system/user'
-        }
-      }
-    ]
-  },
-  {
-    path: '/system/role-auth',
-    component: Layout,
-    hidden: true,
-    permissions: ['system:role:edit'],
-    children: [
-      {
-        path: 'user/:roleId(\\d+)',
-        component: () => import('@/views/system/role/authUser'),
-        name: 'AuthUser',
-        meta: {
-          title: '分配用户',
-          activeMenu: '/system/role'
-        }
-      }
-    ]
-  },
-  {
-    path: '/system/dict-data',
-    component: Layout,
-    hidden: true,
-    permissions: ['system:dict:list'],
-    children: [
-      {
-        path: 'index/:dictId(\\d+)',
-        component: () => import('@/views/system/dict/data'),
-        name: 'Data',
-        meta: {
-          title: '字典数据',
-          activeMenu: '/system/dict'
-        }
-      }
-    ]
-  },
-  {
-    path: '/monitor/job-log',
-    component: Layout,
-    hidden: true,
-    permissions: ['monitor:job:list'],
-    children: [
-      {
-        path: 'index/:jobId(\\d+)',
-        component: () => import('@/views/monitor/job/log'),
-        name: 'JobLog',
-        meta: {
-          title: '调度日志',
-          activeMenu: '/monitor/job'
-        }
-      }
-    ]
-  },
-  {
-    path: '/tool/gen-edit',
-    component: Layout,
-    hidden: true,
-    permissions: ['tool:gen:edit'],
-    children: [
-      {
-        path: 'index/:tableId(\\d+)',
-        component: () => import('@/views/tool/gen/editTable'),
-        name: 'GenEdit',
-        meta: {
-          title: '修改生成配置',
-          activeMenu: '/tool/gen'
-        }
-      }
-    ]
-  },
-  {
-    path: '/reviseBath',
-    component: Layout,
-    hidden: true,
-    permissions: ['business:productionPlan:query'],
-    children: [
-      {
-        path: 'lotFormParticulars/:lotCode(.*)',
-        component: () => import('@/views/business/reviseBath/lotFormParticulars'),
-        name: 'LotProductionPlan',
-        meta: {
-          title: '批次详情'
-        }
-      }
-    ]
-  },
-  {
-    path: '/Production',
-    component: Layout,
-    hidden: true,
-    permissions: ['business:productionPlan:query'],
-    children: [
-      {
-        path: 'lot/:productionPlanNo(.*)/:lineNumber(.*)',
-        component: () => import('@/views/business/lot/index'),
-        name: 'lotInfo',
-        meta: {
-          title: '计划查询'
-        }
-      }
-    ]
-  }
-]
+export const dynamicRoutes = []
 
 const router = createRouter({
-  history: createWebHistory(),
-  routes: constantRoutes,
-  scrollBehavior(to, from, savedPosition) {
-    if (savedPosition) {
-      return savedPosition
-    } else {
-      return {
-        top: 0
-      }
-    }
-  }
+	history: createWebHistory(),
+	routes: constantRoutes,
+	scrollBehavior(to, from, savedPosition) {
+		if (savedPosition) {
+			return savedPosition
+		} else {
+			return {
+				top: 0
+			}
+		}
+	}
 })
 
 export default router

+ 82 - 71
src/store/modules/user.js

@@ -1,79 +1,90 @@
-import { login, logout, getInfo } from '@/api/login'
+import { login, logout, getSuppliers, getInfo } from '@/api/login'
 import { getToken, setToken, removeToken, setTenant } from '@/utils/auth'
 import defAva from '@/assets/images/profile.jpg'
 
 const useUserStore = defineStore('user', {
-  state: () => ({
-    token: getToken(),
-    user: {},
-    name: '',
-    avatar: '',
-    roles: [],
-    permissions: []
-  }),
-  actions: {
-    // 登录
-    login(userInfo) {
-      const username = userInfo.username.trim()
-      const password = userInfo.password
-      const code = userInfo.code
-      const uuid = userInfo.uuid
-      return new Promise((resolve, reject) => {
-        login(username, password, code, uuid)
-          .then((res) => {
-            console.log(res)
-            setToken(res.token)
-            setTenant({ tenantId: res.tenant_id, tenantName: res.tenant_name })
-            this.token = res.token
-            resolve()
-          })
-          .catch((error) => {
-            reject(error)
-          })
-      })
-    },
-    // 获取用户信息
-    getInfo() {
-      return new Promise((resolve, reject) => {
-        getInfo()
-          .then((res) => {
-            const user = res.user
-            const avatar = user.avatar == '' || user.avatar == null ? defAva : import.meta.env.VITE_APP_BASE_API + user.avatar
+	state: () => ({
+		token: getToken(),
+		user: {},
+		name: '',
+		avatar: '',
+		roles: [],
+		permissions: []
+	}),
+	actions: {
+		// 登录
+		login(userInfo) {
+			const username = userInfo.username.trim()
+			const password = userInfo.password
+			const code = userInfo.code
+			const uuid = userInfo.uuid
+			return new Promise((resolve, reject) => {
+				login(username, password, code, uuid)
+					.then((res) => {
+						console.log(res)
+						setToken(res.token)
+						this.token = res.token
+						resolve()
+					})
+					.catch((error) => {
+						reject(error)
+					})
+			})
+		},
+		getSuppliers(data) {
+			return new Promise((resolve, reject) => {
+				getSuppliers(data)
+					.then((res) => {
+						resolve(res)
+					})
+					.catch((error) => {
+						reject(error)
+					})
+			})
+		},
+		// 获取用户信息
+		getInfo() {
+			return new Promise((resolve, reject) => {
+				getInfo()
+					.then((res) => {
+						const user = res.user
+						const avatar =
+							user.avatar == '' || user.avatar == null ? defAva : import.meta.env.VITE_APP_BASE_API + user.avatar
 
-            if (res.roles && res.roles.length > 0) {
-              // 验证返回的roles是否是一个非空数组
-              this.roles = res.roles
-              this.permissions = res.permissions
-            } else {
-              this.roles = ['ROLE_DEFAULT']
-            }
-            this.user = user
-            this.name = user.userName
-            this.avatar = avatar
-            resolve(res)
-          })
-          .catch((error) => {
-            reject(error)
-          })
-      })
-    },
-    // 退出系统
-    logOut() {
-      return new Promise((resolve, reject) => {
-        logout(this.token)
-          .then(() => {
-            this.token = ''
-            this.roles = []
-            this.permissions = []
-            removeToken()
-            resolve()
-          })
-          .catch((error) => {
-            reject(error)
-          })
-      })
-    }
-  }
+						if (res.roles && res.roles.length > 0) {
+							// 验证返回的roles是否是一个非空数组
+							this.roles = res.roles
+							this.permissions = res.permissions
+						} else {
+							this.roles = ['ROLE_DEFAULT']
+						}
+						this.user = user
+						this.name = user.userName
+						this.avatar = avatar
+						resolve(res)
+					})
+					.catch((error) => {
+						reject(error)
+					})
+			})
+		},
+		// 退出系统
+		logOut() {
+			return new Promise((resolve, reject) => {
+				logout(this.token)
+					.then(() => {
+						this.token = ''
+						this.roles = []
+						this.permissions = []
+						removeToken()
+						resolve()
+					})
+					.catch((error) => {
+						reject(error)
+					})
+			})
+		}
+	}
 })
 
 export default useUserStore

+ 0 - 163
src/views/business/outsource/DialogProcesses.vue

@@ -1,163 +0,0 @@
-<template>
-	<el-dialog title="添加工序" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
-		<el-form ref="dialogForm" :model="queryParams" :inline="true" style="padding-top: 16px">
-			<el-form-item label="工序名称:" prop="processAlias" label-width="104">
-				<el-input
-					v-model.trim="queryParams.productDescription"
-					type="text"
-					@keydown.enter.prevent
-					style="width: 160px"
-					placeholder="请输入关键字"
-					:clearable="true"
-					@keyup.enter="handleSearch"
-				/>
-			</el-form-item>
-			<el-form-item label-width="20px">
-				<el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
-			</el-form-item>
-		</el-form>
-
-		<el-table
-			ref="dialogTable"
-			:data="productList"
-			size="small"
-			v-loading="loading"
-			border
-			height="370px"
-			@selection-change="handleSelectionChange"
-		>
-			<el-table-column type="selection" width="40" align="center" />
-			<el-table-column label="序号" width="56" align="center" prop="processStepNumber" />
-			<el-table-column label="工序名称" align="center" prop="lotCode" width="96" />
-		</el-table>
-		<!-- 分页 -->
-		<pagination
-			v-show="total > 0"
-			:total="total"
-			v-model:page="queryParams.pageNum"
-			v-model:limit="queryParams.pageSize"
-			@pagination="getList"
-		/>
-		<template #footer>
-			<div class="dialog-footer">
-				<el-button type="primary" icon="Check" :disabled="selections.length === 0" @click="handleMultipleSelected">
-					确 定
-				</el-button>
-				<el-button type="danger" icon="Close" @click="close">取 消</el-button>
-			</div>
-		</template>
-	</el-dialog>
-</template>
-<script setup>
-/**
- * 需要多选,确定后带回至发货明细中,并且会组合成一个英文逗号分割的字符串
- * 逻辑
- * 0、数据来源:根据当前明细对应的daywork_id,找到这个daywork尚未完成的工序。
- * 		思路:
- * 		1)先找到这个daywork对应的daywork_item,查找status >= 4,并且是外协的那一条记录
- * 		2)这条记录中,记录了process_id,这个工序就是外协之前完成的工序,需要到当前daywork对应的标准工艺中查询所有工序
- *    3)将未完成的工序找出来,可以根据process_id对应的工序的【工序序号】,比这个序号大的,就是未完成的工序。
- * 		4)这里要注意的是:废品回用、单批单改的工艺,不是标准工艺,要从另外一个表中获得。需要将工序查询分在2个私有方法中实现。避免混淆。
- *
- * 1、发货明细每条都对应一个从表,记录该外协产品需要外协的工序,这个从表是不在前端展示的,但要保存到数据库中
- * 2、选择的工序,在对应的发货明细中,以英文逗号分割的形式存储在当前明细的processNames字段中,
- *    在form页面中的ref=【dialogProcessesRef】的对话框:multiple-selected="handleMultipleSelectedProcesses"
- *    中查看
- * 3、后端 BizOutsourcedOrderController,要保存的数据:
- * 	 【biz_outsourced_order】
- *   【biz_outsourced_order_detail】
- *   【biz_outsourced_order_detail_process】
- * 4、外协单做完后,需要做外协报工,这个部分的功能是给外协商使用,是一个新的前端工程,需要用到的数据:
- * 	 【biz_outsourced_order】
- *   【biz_outsourced_order_detail】
- *   【biz_outsourced_order_detail_process】
- * 		外协商要看到,是什么产品,什么工序,多少数量
- */
-import { listForOutsource } from '@/api/business/daywork'
-const { proxy } = getCurrentInstance()
-/** 字典数组区 */
-const { process_status } = proxy.useDict('process_status')
-/** 工序变量 */
-const total = ref(0)
-const props = defineProps({
-	multipleSelected: {
-		type: Function,
-		default: null
-	},
-	supplierId: {
-		type: String,
-		default: ''
-	}
-})
-
-const { multipleSelected, supplierId } = toRefs(props)
-const productList = ref([])
-const visible = ref(false)
-const loading = ref(false)
-const queryParams = ref({
-	existingDayworkIds: [],
-	deptCode: '170000',
-	// 是否看所有产品【0:看全部产品,1:只看该外协商配置的产品】
-	isSupplierProducts: 0,
-	supplierId: '',
-	productDescription: '',
-	pageNum: 1,
-	pageSize: 10
-})
-const selections = ref([])
-
-/**
- * 对话框打开 事件
- */
-function open(existingDayworkIds) {
-	visible.value = true
-	queryParams.value.existingDayworkIds = existingDayworkIds
-	getList()
-}
-
-/**
- * 对话框关闭 事件
- */
-function close() {
-	proxy.$refs.dialogForm.resetFields()
-	proxy.$refs.dialogTable.clearSelection()
-	queryParams.value.pageNum = 1
-	visible.value = false
-}
-
-/**
- * 加载数据
- */
-function getList() {
-	loading.value = true
-	queryParams.value.supplierId = props.supplierId
-	listForOutsource(queryParams.value).then((res) => {
-		productList.value = res.rows
-		total.value = res.total
-		loading.value = false
-	})
-}
-
-/**
- * 列表checkbox列选择 事件
- */
-function handleSelectionChange(selection) {
-	selections.value = selection
-}
-
-/**  搜索 事件 */
-function handleSearch() {
-	getList()
-}
-/** 多选事件 */
-function handleMultipleSelected() {
-	if (multipleSelected.value) {
-		multipleSelected.value(selections.value)
-	}
-	close()
-}
-
-defineExpose({
-	open
-})
-</script>

+ 0 - 155
src/views/business/outsource/DialogProducts.vue

@@ -1,155 +0,0 @@
-<template>
-	<el-dialog title="添加产品" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
-		<el-form ref="dialogForm" :model="queryParams" :inline="true" style="padding-top: 16px">
-			<el-form-item label="产品描述:" prop="productDescription" label-width="104">
-				<el-input
-					v-model.trim="queryParams.productDescription"
-					type="text"
-					@keydown.enter.prevent
-					style="width: 160px"
-					placeholder="请输入关键字"
-					:clearable="true"
-					@keyup.enter="handleSearch"
-				/>
-			</el-form-item>
-			<el-form-item
-				v-if="supplierId !== '' && supplierId !== '0'"
-				label="只看外协商配置的产品:"
-				prop="isSupplierProducts"
-			>
-				<el-switch
-					v-model="queryParams.isSupplierProducts"
-					active-text="是"
-					:active-value="1"
-					inactive-text="否"
-					:inactive-value="0"
-				/>
-			</el-form-item>
-			<el-form-item label-width="20px">
-				<el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
-			</el-form-item>
-		</el-form>
-
-		<el-table
-			ref="dialogTable"
-			:data="productList"
-			size="small"
-			v-loading="loading"
-			border
-			height="370px"
-			@selection-change="handleSelectionChange"
-		>
-			<el-table-column type="selection" width="40" align="center" />
-			<el-table-column type="index" label="行号" width="50" align="center" />
-			<el-table-column label="批次号" align="center" prop="lotCode" width="96" />
-			<el-table-column label="料号" align="center" prop="productCode" width="96" />
-			<el-table-column label="产品描述" align="center" prop="productDescription" />
-			<el-table-column label="箱号" align="center" prop="originalCarrier" width="220" />
-		</el-table>
-		<!-- 分页 -->
-		<pagination
-			v-show="total > 0"
-			:total="total"
-			v-model:page="queryParams.pageNum"
-			v-model:limit="queryParams.pageSize"
-			@pagination="getList"
-		/>
-		<template #footer>
-			<div class="dialog-footer">
-				<el-button type="primary" icon="Check" :disabled="selections.length === 0" @click="handleMultipleSelected">
-					确 定
-				</el-button>
-				<el-button type="danger" icon="Close" @click="close">取 消</el-button>
-			</div>
-		</template>
-	</el-dialog>
-</template>
-<script setup>
-import { listForOutsource } from '@/api/business/daywork'
-const { proxy } = getCurrentInstance()
-/** 字典数组区 */
-const { process_status } = proxy.useDict('process_status')
-/** 工序变量 */
-const total = ref(0)
-const props = defineProps({
-	multipleSelected: {
-		type: Function,
-		default: null
-	},
-	supplierId: {
-		type: String,
-		default: ''
-	}
-})
-
-const { multipleSelected, supplierId } = toRefs(props)
-const productList = ref([])
-const visible = ref(false)
-const loading = ref(false)
-const queryParams = ref({
-	existingDayworkIds: [],
-	deptCode: '170000',
-	// 是否看所有产品【0:看全部产品,1:只看该外协商配置的产品】
-	isSupplierProducts: 0,
-	supplierId: '',
-	productDescription: '',
-	pageNum: 1,
-	pageSize: 10
-})
-const selections = ref([])
-
-/**
- * 对话框打开 事件
- */
-function open(existingDayworkIds) {
-	visible.value = true
-	queryParams.value.existingDayworkIds = existingDayworkIds
-	getList()
-}
-
-/**
- * 对话框关闭 事件
- */
-function close() {
-	proxy.$refs.dialogForm.resetFields()
-	proxy.$refs.dialogTable.clearSelection()
-	queryParams.value.pageNum = 1
-	visible.value = false
-}
-
-/**
- * 加载数据
- */
-function getList() {
-	loading.value = true
-	queryParams.value.supplierId = props.supplierId
-	listForOutsource(queryParams.value).then((res) => {
-		productList.value = res.rows
-		total.value = res.total
-		loading.value = false
-	})
-}
-
-/**
- * 列表checkbox列选择 事件
- */
-function handleSelectionChange(selection) {
-	selections.value = selection
-}
-
-/**  搜索 事件 */
-function handleSearch() {
-	getList()
-}
-/** 多选事件 */
-function handleMultipleSelected() {
-	if (multipleSelected.value) {
-		multipleSelected.value(selections.value)
-	}
-	close()
-}
-
-defineExpose({
-	open
-})
-</script>

+ 0 - 132
src/views/business/outsource/DialogSuppliers.vue

@@ -1,132 +0,0 @@
-<template>
-	<el-dialog title="添加外协商" v-model="visible" width="600px" height="400px" @close="close" append-to-body draggable>
-		<el-form ref="dialogForm" class="master-container" :model="queryParams" :inline="true" style="align-items: center">
-			<div style="display: flex">
-				<el-form-item label="外协商名称:" prop="name">
-					<el-input
-						v-model.trim="queryParams.name"
-						type="text"
-						@keydown.enter.prevent
-						style="width: 120px"
-						placeholder="请输入关键字"
-						:clearable="true"
-						@keyup.enter="handleSearch"
-					/>
-				</el-form-item>
-				<el-form-item label="助记码:" prop="name">
-					<el-input
-						v-model.trim="queryParams.mnemonicCode"
-						type="text"
-						@keydown.enter.prevent
-						style="width: 120px"
-						placeholder="请输入关键字"
-						:clearable="true"
-						@keyup.enter="handleSearch"
-					/>
-				</el-form-item>
-				<el-form-item>
-					<el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
-				</el-form-item>
-			</div>
-		</el-form>
-
-		<el-table ref="dialogTable" :data="dataList" size="small" v-loading="loading" border height="370px">
-			<el-table-column type="index" label="行号" width="50" align="center" />
-			<el-table-column label="外协商名称" align="center" prop="name" />
-			<el-table-column label="助记码" align="center" prop="mnemonicCode" width="120" />
-			<el-table-column label="操作" width="64" align="center">
-				<template #default="scope">
-					<el-button type="success" icon="finished" circle @click="handleSingleSelected(scope.row)" />
-				</template>
-			</el-table-column>
-		</el-table>
-		<!-- 分页 -->
-		<pagination
-			v-show="total > 0"
-			:total="total"
-			v-model:page="queryParams.pageNum"
-			v-model:limit="queryParams.pageSize"
-			@pagination="getList"
-		/>
-	</el-dialog>
-</template>
-<script setup>
-import { list } from '@/api/business/supplier'
-const { proxy } = getCurrentInstance()
-/** 字典数组区 */
-const { process_status } = proxy.useDict('process_status')
-/** 工序变量 */
-const total = ref(0)
-const props = defineProps({
-	singleSelected: {
-		type: Function,
-		default: null
-	}
-})
-
-const { singleSelected } = toRefs(props)
-const dataList = ref([])
-const visible = ref(false)
-const loading = ref(false)
-const queryParams = ref({
-	name: '',
-	pageNum: 1,
-	pageSize: 10
-})
-const selections = ref([])
-
-/**
- * 对话框打开 事件
- */
-function open() {
-	visible.value = true
-	getList()
-}
-
-/**
- * 对话框关闭 事件
- */
-function close() {
-	proxy.$refs.dialogForm.resetFields()
-	proxy.$refs.dialogTable.clearSelection()
-	queryParams.value.pageNum = 1
-	visible.value = false
-}
-
-/**
- * 加载数据
- */
-function getList() {
-	loading.value = true
-	queryParams.value.supplierId = props.supplierId
-	list(queryParams.value).then((res) => {
-		dataList.value = res.rows
-		total.value = res.total
-		loading.value = false
-	})
-}
-
-/**
- * 列表checkbox列选择 事件
- */
-function handleSelectionChange(selection) {
-	selections.value = selection
-}
-
-/**  搜索 事件 */
-function handleSearch() {
-	getList()
-}
-
-/** 单选事件 */
-function handleSingleSelected(row) {
-	if (singleSelected.value) {
-		singleSelected.value(row)
-	}
-	close()
-}
-
-defineExpose({
-	open
-})
-</script>

+ 0 - 392
src/views/business/outsource/form.vue

@@ -1,392 +0,0 @@
-<template>
-	<el-drawer title="外协单信息" :with-header="false" v-model="visible" direction="rtl" size="100%">
-		<div class="form-container column-container">
-			<div class="form-btns-container">
-				<span class="title-label">
-					<el-icon><Document /></el-icon>
-					<span>外协单信息</span>
-				</span>
-				<el-button-group>
-					<el-button v-if="editStatus" type="primary" icon="Finished" @click="submitForm"> 保存 </el-button>
-					<el-button v-else type="warning" size="small" icon="Edit" @click="editStatus = true">编辑</el-button>
-					<el-button v-if="form.id && editStatus" type="info" size="small" icon="Close" @click="editStatus = false">
-						取消编辑
-					</el-button>
-					<el-button v-if="form.id" type="success" size="small" @click="getForm">
-						<i class="fa fa-refresh" aria-hidden="true" /> 刷新
-					</el-button>
-				</el-button-group>
-
-				<div class="close-btn" @click="cancel">
-					<i class="fa fa-times" aria-hidden="true" />
-					<!-- <span>关闭</span> -->
-				</div>
-			</div>
-			<el-form ref="formRef" class="master-container" :model="form" :rules="rules" label-width="120px">
-				<el-row :gutter="20">
-					<el-col :span="6">
-						<el-form-item label="单据号" prop="formCode">
-							<el-input v-if="editStatus" v-model="form.formCode" disabled placeholder="系统自动生成" />
-							<span v-else>{{ form.formCode }}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="6">
-						<el-form-item label="表单日期" prop="formDate">
-							<el-date-picker
-								v-if="editStatus"
-								clearable
-								v-model="form.formDate"
-								type="date"
-								value-format="YYYY-MM-DD"
-								placeholder="请选择表单日期"
-								style="width: 100%"
-							>
-							</el-date-picker>
-							<span v-else>{{ parseTime(form.formDate, '{y}-{m}-{d}') }}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="6">
-						<el-form-item label="外协商名称" prop="supplierName">
-							<el-input v-if="editStatus" v-model="form.supplierName" readonly placeholder="请输入外协商名称">
-								<template #append>
-									<el-button icon="Search" @click="handleShowDialogSuppliers" />
-								</template>
-							</el-input>
-							<span v-else>{{ form.supplierName }}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="6">
-						<el-form-item label="送货方式" prop="deliveryMethod">
-							<el-select v-if="editStatus" v-model="form.deliveryMethod" placeholder="请选择">
-								<el-option v-for="dict in deliveryMethod" :key="dict.value" :label="dict.label" :value="dict.value" />
-							</el-select>
-							<span v-else>{{ form.deliveryMethod }}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="6">
-						<el-form-item label="运费单价" prop="freightPrice">
-							<el-input-number
-								v-if="editStatus"
-								v-model="form.freightPrice"
-								:min="0"
-								:precision="2"
-								controls-position="right"
-							/>
-							<span v-else>{{ form.freightPrice }}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="6">
-						<el-form-item label="运费总价" prop="freightAmount">
-							<el-input-number
-								v-if="editStatus"
-								v-model="form.freightAmount"
-								:min="0"
-								:precision="2"
-								controls-position="right"
-							/>
-							<span v-else>{{ form.freightAmount }}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="6">
-						<el-form-item label="带箱方式:" prop="packagingMethod">
-							<el-select v-if="editStatus" v-model="form.packagingMethod" placeholder="请选择">
-								<el-option v-for="dict in packagingMethod" :key="dict.value" :label="dict.label" :value="dict.value" />
-							</el-select>
-							<span v-else>{{ form.packagingMethod }}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="6">
-						<el-form-item label="结算方式:" prop="settlementType">
-							<el-select v-if="editStatus" v-model="form.settlementType" disabled placeholder="请选择">
-								<el-option v-for="dict in settlementType" :key="dict.value" :label="dict.label" :value="dict.value" />
-							</el-select>
-							<span v-else>{{ form.settlementType }}</span>
-						</el-form-item>
-					</el-col>
-					<el-col :span="6">
-						<el-form-item label="备注" prop="remark">
-							<el-input v-if="editStatus" v-model="form.remark" placeholder="请输入备注" />
-							<span v-else>{{ form.remark }}</span>
-						</el-form-item>
-					</el-col>
-				</el-row>
-			</el-form>
-			<!-- 渲染数据区 -->
-			<div class="form-details-btns-container">
-				<el-button type="primary" icon="Plus" @click="handleShowDialogProducts" v-hasPermi="['business:outsource:add']">
-					添加外协产品明细
-				</el-button>
-			</div>
-			<div class="el-table-container">
-				<div class="el-table-inner-container">
-					<el-table v-loading="loading" :data="form.details" size="small" border height="100%">
-						<el-table-column label="行号" type="index" align="center" width="48" />
-						<el-table-column label="批次号" align="center" prop="lotCode" width="104" />
-						<el-table-column label="产品描述" align="center" prop="productDescription" width="320" />
-						<el-table-column
-							:label="form.packagingMethod === '0' ? '箱号' : '原箱号'"
-							align="center"
-							prop="originalCarrier"
-							width="320"
-						/>
-						<el-table-column
-							v-if="form.packagingMethod === '1'"
-							label="新箱号"
-							align="center"
-							prop="new_carrier"
-							width="320"
-						>
-							<template #default="scope">
-								<el-input v-if="editStatus" v-model="scope.row.newCarrier" readonly placeholder="请选择新箱号">
-									<template #append>
-										<el-button icon="Search" @click="handleShowDialogOutsourceCarriers" />
-									</template>
-								</el-input>
-								<span v-else>{{ scope.row.newCarrier }}</span>
-							</template>
-						</el-table-column>
-						<el-table-column label="外协工序" align="center" prop="new_carrier" width="320">
-							<template #default="scope">
-								<el-input v-if="editStatus" v-model="scope.row.processNames" readonly placeholder="请选择工序">
-									<template #append>
-										<el-button icon="Search" @click="handleShowDialogProcesses(scope.row)" />
-									</template>
-								</el-input>
-								<span v-else>{{ scope.row.processNames }}</span>
-							</template>
-						</el-table-column>
-						<el-table-column label="备注" align="center" prop="remark">
-							<template #default="scope">
-								<el-input v-if="editStatus" v-model="scope.row.remark" placeholder="备注" />
-								<span v-else>{{ scope.row.processNames }}</span>
-							</template>
-						</el-table-column>
-						<el-table-column
-							v-if="editStatus"
-							label="操作"
-							align="center"
-							class-name="small-padding fixed-width"
-							width="64"
-						>
-							<template #default="scope">
-								<el-button
-									circle
-									type="danger"
-									icon="Delete"
-									@click="handleDelete(scope.$index)"
-									v-hasPermi="['business:outsource:remove']"
-								/>
-							</template>
-						</el-table-column>
-					</el-table>
-				</div>
-			</div>
-		</div>
-		<!-- 外协商选择 -->
-		<dialog-suppliers ref="dialogSuppliersRef" :single-selected="handleSingleSelectedSupplier" />
-		<!-- 产品选择 -->
-		<dialog-products
-			ref="dialogProductsRef"
-			:supplier-id="form.supplierId"
-			:multiple-selected="handleMultipleSelectedProducts"
-		/>
-		<!-- 工序选择 -->
-		<dialog-processes ref="dialogProcessesRef" :multiple-selected="handleMultipleSelectedProcesses" />
-	</el-drawer>
-</template>
-<script setup>
-import { getOrder, addOrder, updateOrder } from '@/api/business/outsourcedOrder'
-import dialogSuppliers from './DialogSuppliers'
-import dialogProducts from './DialogProducts'
-import dialogProcesses from './DialogProcesses'
-const { proxy } = getCurrentInstance()
-/** 父组件传参 */
-const props = defineProps({
-	getList: {
-		type: Function,
-		default: () => {}
-	},
-	deliveryMethod: {
-		type: Array,
-		default: []
-	},
-	settlementType: {
-		type: Array,
-		default: []
-	},
-	packagingMethod: {
-		type: Array,
-		default: []
-	}
-})
-const { getList, deliveryMethod, packagingMethod } = toRefs(props)
-/** 字典数组区 */
-/** 表单抽屉 页变量 */
-
-const loading = ref(false)
-const multiple = ref(true)
-const visible = ref(false)
-const editStatus = ref(false)
-const isFullscreen = ref(false)
-const webHost = import.meta.env.VITE_APP_BASE_API
-const form = ref({})
-// const formatDetails = ref([])
-const currentDetail = ref({})
-const rules = {
-	supplierName: [{ required: true, message: '外协商名称不能为空', trigger: 'blur' }]
-}
-
-/***********************  方法区  ****************************/
-/** 打开抽屉 */
-function open(id) {
-	reset()
-	visible.value = true
-	if (id) {
-		getOrder(id).then((response) => {
-			form.value = response.data
-			form.value.detail = []
-			editStatus.value = false
-		})
-	} else {
-		editStatus.value = true
-	}
-}
-
-/** 查询表单信息  */
-function getForm() {
-	loading.value = true
-	getOrder(form.value.id).then((response) => {
-		loading.value = false
-		form.value = response.data
-	})
-}
-
-/** 取消按钮 */
-function cancel() {
-	visible.value = false
-	reset()
-}
-
-const handleDelete = (index) => {
-	form.value.details.splice(index, 1)
-}
-
-/** 表单重置 */
-function reset() {
-	form.value = {
-		id: null,
-		tenantId: null,
-		formCode: null,
-		formDate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
-		supplierId: '0',
-		supplierName: '',
-		deliveryMethod: '0',
-		freightPrice: 0.0,
-		freightAmount: 0.0,
-		packagingMethod: '0',
-		remark: null,
-		details: []
-	}
-	proxy.resetForm('formRef')
-}
-/** 提交按钮 */
-function submitForm() {
-	proxy.$refs['formRef'].validate((valid) => {
-		if (valid) {
-			if (form.value.id != null) {
-				updateOrder(form.value).then((response) => {
-					proxy.$modal.msgSuccess('修改成功')
-					visible.value = false
-					getList.value()
-				})
-			} else {
-				addOrder(form.value).then((response) => {
-					proxy.$modal.msgSuccess('新增成功')
-					visible.value = false
-					getList.value()
-				})
-			}
-		}
-	})
-}
-/***************************** 外协商对话框相关 *****************************/
-// 打开外协商选择对话框
-const handleShowDialogSuppliers = () => {
-	proxy.$refs.dialogSuppliersRef.open()
-}
-// 外协商选择带回
-const handleSingleSelectedSupplier = (data) => {
-	console.log(data)
-	form.value.supplierId = data.id
-	form.value.supplierName = data.name
-	form.value.deliveryMethod = data.deliveryMethod
-	form.value.settlementType = data.settlementType
-}
-
-/***************************** 产品对话框相关 *****************************/
-// 打开产品选择对话框
-const handleShowDialogProducts = () => {
-	const dayworkIds = form.value.details.map((item) => item.dayworkId)
-	console.log(dayworkIds)
-	proxy.$refs.dialogProductsRef.open(dayworkIds)
-}
-// 产品选择带回
-const handleMultipleSelectedProducts = (selection) => {
-	selection.forEach((item) => {
-		const newDetail = {
-			lotId: item.lotId,
-			lotCode: item.lotCode,
-			dayworkId: item.id,
-			productId: item.productId,
-			productDescription: item.productDescription,
-			technologicalProcessId: item.technologicalProcessId,
-			technologyVersion: item.technologyVersion,
-			originalCarrier: item.originalCarrier,
-			originalCarrierCount: item.originalCarrier.split(',').length,
-			newCarrier: '',
-			newCarrierCount: 0,
-			processNames: '',
-			remark: item.remark,
-			processes: []
-		}
-		console.log(newDetail)
-		form.value.details.push(newDetail)
-	})
-}
-
-/***************************** 外协箱子对话框相关 *****************************/
-// 打开外协箱子选择对话框
-const handleShowDialogOutsourceCarriers = () => {}
-// 产品选择带回
-const handleMultipleSelectedOutsourceCarriers = (selection) => {
-	selection.forEach((item) => {
-		const newDetail = {}
-		form.value.details.push(newDetail)
-	})
-}
-
-/***************************** 外协工序对话框相关 *****************************/
-// 打开外协工序选择对话框
-const handleShowDialogProcesses = (row) => {
-	currentDetail.value = row
-	proxy.$refs.dialogProcessesRef.open()
-}
-// 工序选择带回
-const handleMultipleSelectedProcesses = (selection) => {
-	const processNames = selection.map((item) => item.processAlias)
-	currentDetail.value.processNames = processNames
-	selection.forEach((item) => {
-		const newProcess = {
-			processId: item.processId,
-			processAlias: item.processAlias,
-			processStepNumber: item.processStepNumber
-		}
-		currentDetail.value.processes.push(newProcess)
-	})
-}
-
-/** 暴露给父组件的方法 */
-defineExpose({
-	open
-})
-</script>

+ 183 - 0
src/views/business/outsourcedOrder/form.vue

@@ -0,0 +1,183 @@
+<template>
+	<el-drawer title="外协单信息" :with-header="false" v-model="visible" direction="rtl" size="100%">
+		<div class="form-container column-container">
+			<div class="form-btns-container">
+				<span class="title-label">
+					<el-icon><Document /></el-icon>
+					<span>外协单信息</span>
+				</span>
+				<div class="close-btn" @click="cancel">
+					<i class="fa fa-times" aria-hidden="true" />
+					<!-- <span>关闭</span> -->
+				</div>
+			</div>
+			<el-form ref="formRef" class="master-container" v-loading="loading" label-width="120px">
+				<el-row :gutter="20">
+					<el-col :span="6">
+						<el-form-item label="单据号" prop="formCode">
+							<el-input v-model="form.formCode" disabled placeholder="系统自动生成" />
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="表单日期" prop="formDate">
+							<el-date-picker
+								readonly
+								v-model="form.formDate"
+								type="date"
+								value-format="YYYY-MM-DD"
+								placeholder="请选择表单日期"
+								style="width: 100%"
+							>
+							</el-date-picker>
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="外协商名称" prop="supplierName">
+							<el-input v-model="form.supplierName" readonly placeholder="请输入外协商名称">
+								<template #append>
+									<el-button icon="Search" @click="handleShowDialogSuppliers" />
+								</template>
+							</el-input>
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="送货方式" prop="deliveryMethod">
+							<el-select v-model="form.deliveryMethod" placeholder="请选择" readonly>
+								<el-option v-for="dict in deliveryMethod" :key="dict.value" :label="dict.label" :value="dict.value" />
+							</el-select>
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="运费单价" prop="freightPrice">
+							<el-input-number v-model="form.freightPrice" :min="0" :precision="2" controls-position="right" readonly />
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="运费总价" prop="freightAmount">
+							<el-input-number
+								v-model="form.freightAmount"
+								:min="0"
+								:precision="2"
+								controls-position="right"
+								readonly
+							/>
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="带箱方式:" prop="packagingMethod">
+							<el-select v-model="form.packagingMethod" placeholder="请选择" readonly>
+								<el-option v-for="dict in packagingMethod" :key="dict.value" :label="dict.label" :value="dict.value" />
+							</el-select>
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="结算方式:" prop="settlementType">
+							<el-select v-model="form.settlementType" placeholder="请选择" readonly>
+								<el-option v-for="dict in settlementType" :key="dict.value" :label="dict.label" :value="dict.value" />
+							</el-select>
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="备注" prop="remark">
+							<el-input v-model="form.remark" placeholder="请输入备注" readonly />
+						</el-form-item>
+					</el-col>
+				</el-row>
+			</el-form>
+			<!-- 渲染数据区 -->
+			<div class="el-table-container">
+				<div class="el-table-inner-container">
+					<el-table v-loading="loading" :data="form.details" size="small" border height="100%">
+						<el-table-column label="行号" type="index" align="center" width="48" />
+						<el-table-column label="批次号" align="center" prop="lotCode" width="104" />
+						<el-table-column label="产品描述" align="center" prop="productDescription" width="320" />
+						<el-table-column
+							:label="form.packagingMethod === '0' ? '箱号' : '原箱号'"
+							align="center"
+							prop="originalCarrier"
+							width="320"
+						/>
+						<el-table-column
+							v-if="form.packagingMethod === '1'"
+							label="新箱号"
+							align="center"
+							prop="new_carrier"
+							width="320"
+						/>
+						<el-table-column label="外协工序" align="center" prop="processNames" width="320" />
+						<el-table-column label="备注" align="center" prop="remark" />
+					</el-table>
+				</div>
+			</div>
+		</div>
+	</el-drawer>
+</template>
+<script setup>
+import { getOrder } from '@/api/business/outsourcedOrder'
+const { proxy } = getCurrentInstance()
+/** 父组件传参 */
+const props = defineProps({
+	deliveryMethod: {
+		type: Array,
+		default: []
+	},
+	settlementType: {
+		type: Array,
+		default: []
+	},
+	packagingMethod: {
+		type: Array,
+		default: []
+	}
+})
+const { deliveryMethod, packagingMethod, settlementType } = toRefs(props)
+/** 字典数组区 */
+/** 表单抽屉 页变量 */
+
+const loading = ref(false)
+const visible = ref(false)
+const webHost = import.meta.env.VITE_APP_BASE_API
+const form = ref({})
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+function open(id) {
+	reset()
+	loading.value = true
+	visible.value = true
+	getOrder(id).then((response) => {
+		form.value = response.data
+		loading.value = false
+	})
+}
+
+/** 取消按钮 */
+function cancel() {
+	visible.value = false
+	reset()
+}
+
+/** 表单重置 */
+function reset() {
+	form.value = {
+		id: null,
+		tenantId: '0',
+		formCode: '',
+		formDate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
+		supplierId: '0',
+		supplierName: '',
+		deliveryMethod: '0',
+		freightPrice: 0.0,
+		freightAmount: 0.0,
+		packagingMethod: '0',
+		remark: '',
+		details: []
+	}
+	proxy.resetForm('formRef')
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+	open
+})
+</script>

+ 7 - 95
src/views/business/outsource/index.vue → src/views/business/outsourcedOrder/index.vue

@@ -22,15 +22,6 @@
 				>
 				</el-date-picker>
 			</el-form-item>
-			<el-form-item label="外协商名称:" prop="supplierName">
-				<el-input
-					v-model="queryParams.supplierName"
-					placeholder="请输入关键字"
-					style="width: 144px"
-					clearable
-					@keyup.enter="handleQuery"
-				/>
-			</el-form-item>
 			<el-form-item label="送货方式:" prop="deliveryMethod">
 				<el-select v-model="queryParams.deliveryMethod" style="width: 144px" clearable placeholder="请选择">
 					<el-option v-for="dict in delivery_method" :key="dict.value" :label="dict.label" :value="dict.value" />
@@ -47,39 +38,10 @@
 			</el-form-item>
 		</el-form>
 
-		<!-- 功能按钮区 -->
-		<div class="list-btns-container">
-			<el-button type="primary" icon="Plus" @click="handleAdd" v-hasPermi="['business:outsource:add']">
-				新增
-			</el-button>
-			<el-button
-				type="danger"
-				icon="Delete"
-				:disabled="multiple"
-				@click="handleDelete"
-				v-hasPermi="['business:outsource:remove']"
-			>
-				删除
-			</el-button>
-			<!--
-			<el-button type="warning" icon="Download" @click="handleExport" v-hasPermi="['business:outsource:export']">
-				导出
-			</el-button>
-			<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
-			-->
-		</div>
-
 		<!-- 渲染数据区 -->
 		<div class="el-table-container">
 			<div class="el-table-inner-container">
-				<el-table
-					v-loading="loading"
-					:data="orderList"
-					size="small"
-					border
-					height="100%"
-					@selection-change="handleSelectionChange"
-				>
+				<el-table v-loading="loading" :data="orderList" size="small" border height="100%">
 					<el-table-column type="selection" width="48" align="center" />
 					<el-table-column label="外协单号" align="center" prop="formCode" width="120" />
 					<el-table-column label="外协日期" align="center" prop="formDate" width="120">
@@ -87,7 +49,6 @@
 							{{ parseTime(scope.row.formDate, '{y}-{m}-{d}') }}
 						</template>
 					</el-table-column>
-					<el-table-column label="外协商名称" align="center" prop="supplierName" width="320" />
 					<el-table-column label="结算方式" align="center" prop="settlementType" width="120">
 						<template #default="scope">
 							<dict-tag :options="settlement_type" :value="scope.row.settlementType" />
@@ -106,24 +67,7 @@
 					<el-table-column label="备注" align="center" prop="remark" />
 					<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="144">
 						<template #default="scope">
-							<el-button
-								link
-								type="warning"
-								icon="Edit"
-								@click="handleUpdate(scope.row)"
-								v-hasPermi="['business:outsource:edit']"
-							>
-								编辑
-							</el-button>
-							<el-button
-								link
-								type="danger"
-								icon="Delete"
-								@click="handleDelete(scope.row)"
-								v-hasPermi="['business:outsource:remove']"
-							>
-								删除
-							</el-button>
+							<el-button link type="warning" icon="View" @click="handleShowFormDialog(scope.row)"> 查看 </el-button>
 						</template>
 					</el-table-column>
 				</el-table>
@@ -142,7 +86,6 @@
 		<!-- 表单 -->
 		<order-form
 			ref="orderRef"
-			:get-list="getList"
 			:delivery-method="delivery_method"
 			:settlement-type="settlement_type"
 			:packaging-method="packaging_method"
@@ -151,8 +94,7 @@
 </template>
 
 <script setup name="Order">
-import { listOrder, delOrder } from '@/api/business/outsourcedOrder'
-import orderForm from './form'
+import { listOrder } from '@/api/business/outsourcedOrder'
 const { proxy } = getCurrentInstance()
 /** 字典数组区 */
 const { delivery_method } = proxy.useDict('delivery_method')
@@ -171,11 +113,9 @@ const queryParams = ref({
 	pageSize: 10,
 	formCode: null,
 	formDate: null,
-	supplierName: null,
+	productDescription: null,
 	deliveryMethod: null,
-	packagingMethod: null,
-	freightPrice: null,
-	freightAmount: null
+	packagingMethod: null
 })
 
 /***********************  方法区  ****************************/
@@ -203,37 +143,9 @@ function resetQuery() {
 	handleQuery()
 }
 
-// 多选框选中数据
-function handleSelectionChange(selection) {
-	ids.value = selection.map((item) => item.id)
-	single.value = selection.length != 1
-	multiple.value = !selection.length
-}
-
-/** 新增按钮操作 */
-function handleAdd() {
-	proxy.$refs.orderRef.open()
-}
-
 /** 修改按钮操作 */
-function handleUpdate(row) {
-	const id = row.id || ids.value
-	proxy.$refs.orderRef.open(id)
-}
-
-/** 删除按钮操作 */
-function handleDelete(row) {
-	const _ids = row.id || ids.value
-	proxy.$modal
-		.confirm('是否确认删除选中的数据项?')
-		.then(function () {
-			return delOrder(_ids)
-		})
-		.then(() => {
-			getList()
-			proxy.$modal.msgSuccess('删除成功!')
-		})
-		.catch(() => {})
+function handleShowFormDialog(row) {
+	proxy.$refs.orderRef.open(row.id)
 }
 
 /** 导出按钮操作 */

+ 0 - 0
src/views/business/daywork/form.vue → src/views/business/outsourcedOrderDetails/form.vue


+ 0 - 0
src/views/business/daywork/index.vue → src/views/business/outsourcedOrderDetails/index.vue


+ 0 - 268
src/views/dialog/InstructionChoiceDialog.vue

@@ -1,268 +0,0 @@
-<template>
-  <el-dialog :title="`添加${label}项目`" v-model="visible" width="800px" height="400px" @close="close" append-to-body
-    draggable>
-    <!-- <div slot="title" class="dialog-title-container">
-      <span class="title-label"><i class="el-icon-document" /> 检查指导项目选择</span>
-      <i class="el-icon-close" @click="close" />
-    </div> -->
-    <div v-if="multiple" class="form-btns-container" style="display: inline-block; line-height: 36px;">
-      <el-button type="success" size="small" @click="handleMultipleSelected">
-        <i class="fa fa-floppy-o" aria-hidden="true" /> 确定选择
-      </el-button>
-    </div>
-    <div class="dialog-list-container" style="height: 450px;">
-      <el-row :gutter="2" style="height: 100%;" class="twins-row">
-        <el-col :span="8" style="height: 100%;">
-          <div class="page-container list-container">
-            <div class="list-btns-container" style="padding-bottom: 12px; line-height: 30px;">
-              <span class="title-label"><i class="el-icon-document" /> {{ label }}项目类别</span>
-              <el-form class="dialog-title-search-container" size="small" :inline="true" style="line-height: 30px;"
-                @submit.native.prevent>
-                <el-form-item label="搜索:" style="margin-bottom: 0;">
-                  <el-input v-model.trim="categoryQuery.keyword" size="small" type="text" placeholder="关键字"
-                    :clearable="true" style="width: 90px;" @keydown.enter="handleCategorySearch" />
-                </el-form-item>
-                <!-- <el-form-item style="margin-bottom: 0;">
-                  <el-button type="success" icon="Search" @click="handleCategorySearch">搜索</el-button>
-                </el-form-item> -->
-              </el-form>
-            </div>
-            <div class="el-table-container">
-              <el-tree ref="categoryTable" v-loading="categoryLoading" :data="categories"
-                :props="{ label: 'name', children: 'children' }" :expand-on-click-node="false" default-expand-all
-                node-key="id" highlight-current @node-click="handleCurrentCategoryChange">
-                <template #default="{ node, data }">
-                  <div style="display: flex; width: 100%; justify-content: space-between">
-                    <span>
-                      <span v-if="data.parentId === '0'" style="display: inline-block; width: 20px">{{
-    getNodeIndex(data) }}. </span>
-                      <span>{{ node.label }}</span>
-                    </span>
-                  </div>
-                </template>
-              </el-tree>
-            </div>
-          </div>
-        </el-col>
-        <el-col :span="16" style="height: 100%;">
-          <div class="page-container list-container">
-            <div class="list-btns-container" style="padding-bottom: 12px;">
-              <span class="title-label"><i class="el-icon-document" /> {{ label }}项目</span>
-              <el-form class="dialog-title-search-container" size="small" :inline="true" style="line-height: 30px;"
-                @submit.native.prevent>
-                <el-form-item label="搜索:" style="margin-bottom: 0;">
-                  <el-input v-model.trim="query.keyword" size="small" type="text" placeholder="关键字" :clearable="true"
-                    style="width: 90px;" />
-                </el-form-item>
-                <el-form-item style="margin-bottom: 0;">
-                  <el-button type="success" icon="Search" @click="handleInstructionSearch">搜索</el-button>
-                  <el-button type="primary" icon="Delete" plain @click="searchReset">清空</el-button>
-                </el-form-item>
-              </el-form>
-            </div>
-            <div class="el-table-container" :style="{ bottom: instructionTotal > 0 ? '35px' : '0' }">
-              <el-table ref="employeeTable" v-loading="instructionLoading" row-key="id"
-                :data="currentCategory ? instructionList : []" size="small" border height="100%"
-                header-row-class-name="list-header-row" row-class-name="list-row"
-                @selection-change="handleSelectionChange"
-                @row-dblclick="(row) => multiple ? selectionRow(row) : handleSimpleSelected(row)">
-                <el-table-column v-if="multiple" type="selection" width="40" align="center"
-                  :selectable="selectableHandler" :reserve-selection="true" />
-                <el-table-column type="index" label="序号" width="40" align="center" />
-                <el-table-column prop="standard" label="检查标准" align="center" />
-                <el-table-column prop="equipment" label="检查设备" width="200" align="center" />
-                <el-table-column v-if="!multiple" label="操作" width="40" align="center">
-                  <template #default="scope">
-                    <el-button :disabled="!selectableHandler(scope.row, scope.$index)" type="success" size="small"
-                      icon="el-icon-finished" circle @click="handleSimpleSelected(scope.row)" />
-                  </template>
-                </el-table-column>
-              </el-table>
-            </div>
-            <pagination v-show="instructionTotal > 0" :total="instructionTotal" v-model:page="query.pageNum"
-              v-model:limit="query.pageSize" @pagination="loadInstruction" style="position: absolute; bottom: 0;" />
-          </div>
-        </el-col>
-      </el-row>
-    </div>
-  </el-dialog>
-</template>
-<script setup>
-import { ref, toRefs } from 'vue'
-import { listCategory, list } from '@/api/business/inspectionInstruction'
-const { proxy } = getCurrentInstance()
-const props = defineProps({
-  width: {
-    type: String,
-    default: '1000px'
-  },
-  multiple: {
-    type: Boolean,
-    default: () => false
-  },
-  simpleSelected: {
-    type: Function,
-    default: null
-  },
-  multipleSelected: {
-    type: Function,
-    default: null
-  },
-  selectableHandler: {
-    type: Function,
-    default: () => () => { return true }
-  },
-  label: {
-    type: String,
-    default: () => ''
-  },
-  type: {
-    type: Number,
-    default: () => 2
-  }
-})
-const { width, multiple, simpleSelected, multipleSelected, selectableHandler, label } = toRefs(props)
-const visible = ref(false)
-const query = ref({
-  type: props.type,
-  categoryId: '0',
-  keyword: '',
-  pageSize: 20,
-  pageNum: 1
-})
-const categoryQuery = ref({
-  keyword: ''
-})
-const categories = ref([])
-const instructionList = ref([])
-const categoryLoading = ref(false)
-const instructionLoading = ref(false)
-const instructionTotal = ref(0)
-
-const currentCategory = ref(null)
-const selected = ref([])
-
-function close() {
-  visible.value = false
-}
-
-function open() {
-  visible.value = true
-  loadCategory()
-}
-
-function handleMultipleSelected() {
-  if (multipleSelected.value) {
-    multipleSelected.value(selected.value)
-  }
-  close()
-}
-function loadCategory() {
-  categoryLoading.value = true
-  listCategory({ ...categoryQuery.value, type: props.type }).then((res) => {
-    categoryLoading.value = false
-    categories.value = res.rows
-    if (categories.value.length > 0) {
-      currentCategory.value = categories.value[0]
-      nextTick(() => {
-        proxy.$refs.categoryTable.setCurrentKey(currentCategory.value.id)
-        handleCurrentCategoryChange(currentCategory.value)
-      })
-    } else {
-      currentCategory.value = {}
-      instructionList.value = []
-    }
-  })
-}
-
-function handleCategorySearch() {
-  loadCategory()
-}
-
-function loadInstruction() {
-  instructionLoading.value = true
-  query.value.categoryId = currentCategory.value.id
-  list(query.value).then((res) => {
-    instructionLoading.value = false
-    instructionList.value = res.rows
-    instructionTotal.value = res.total
-  })
-}
-function handleSimpleSelected(row) {
-  if (simpleSelected) {
-    simpleSelected(row)
-  }
-  close()
-}
-
-function handleInstructionSearch() {
-  loadInstruction()
-}
-
-function getNodeIndex(data) {
-  const index = categories.value.findIndex((item) => item.id === data.id)
-  return index + 1
-}
-
-function searchReset() {
-  query.value = {
-    type: props.type,
-    categoryId: currentCategory.value.id,
-    pageSize: 20,
-    pageNum: 1
-  }
-  loadInstruction()
-}
-
-function handleSelectionChange(selection) {
-  selected.value = selection
-}
-
-function handleCurrentCategoryChange(row) {
-  if (row) {
-    currentCategory.value = row
-  } else {
-    currentCategory.value = {}
-    if (categories.value.length > 0) {
-      currentCategory.value = categories.value[0]
-    }
-  }
-  if (currentCategory.value.id) {
-    loadInstruction()
-  } else {
-    instructionList.value = []
-    instructionTotal.value = 0
-  }
-}
-
-defineExpose({
-  open,
-})
-</script>
-<style lang="css">
-.twins-row .el-table-container {
-  position: absolute;
-  top: 50px;
-  bottom: 5px;
-  left: 0px;
-  right: 0px;
-}
-
-.twins-row .el-table-container-pages {
-  position: absolute;
-  top: 50px;
-  bottom: 35px;
-  left: 0px;
-  right: 0px;
-}
-
-.twins-row .title-label {
-  line-height: 35px;
-}
-
-.twins-row .list-container {
-  display: flex;
-  flex-direction: column;
-  height: 100%
-}
-</style>

+ 0 - 168
src/views/dialog/equipment.vue

@@ -1,168 +0,0 @@
-<template>
-  <el-dialog title="设备选择" v-model="visible" :width="width" @close="close" append-to-body draggable>
-    <template #header>
-      <span style="color: #fff">设备选择</span>
-    </template>
-    <el-form ref="dialogForm" class="list-search-container" :model="queryParams" :inline="true">
-      <el-form-item label="设备编码:">
-        <el-input placeholder="请输入设备编码" clearable @keydown.enter.prevent @keyup.enter="handleSearch" v-model.trim="queryParams.equipmentCode" style="width: 200px;" />
-      </el-form-item>
-      <el-form-item label="设备名称:">
-        <el-input placeholder="请输入设备名称" clearable @keydown.enter.prevent @keyup.enter="handleSearch" v-model.trim="queryParams.equipmentName" style="width: 200px;"/>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
-      </el-form-item>
-    </el-form>
-    <div class="page-container column-container">
-      <el-table ref="dialogTable" :data="list" height="460px" row-key="id" @selection-change="handleSelectionChange" align="center">
-        <el-table-column v-if="multiple" type="selection" width="40" :reserve-selection="true" :selectable="selectable" align="center" />
-        <el-table-column label="行号" type="index" width="50" align="center" />
-        <el-table-column label="设备编码" prop="equipmentCode" align="center" />
-        <el-table-column label="设备名称" prop="equipmentName" align="center" />
-        <el-table-column label="设备状态" prop="equipmentStatusCode" width="120" align="center">
-          <template #default="scope">
-            <dict-tag :options="equipment_status" :value="scope.row.equipmentStatusCode" />
-          </template>
-        </el-table-column>
-        <el-table-column v-if="!multiple" label="操作" width="120" align="center">
-          <template #default="scope">
-            <el-button type="success" icon="finished" circle @click="handleSingleSelected(scope.row)" />
-          </template>
-        </el-table-column>
-      </el-table>
-      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
-    </div>
-    <template #footer>
-      <el-button v-if="multiple" type="primary" :disabled="selections.length === 0" icon="Check" @click="handleMultipleSelected">
-        确定
-      </el-button>
-      <el-button icon="Close" @click="close">取 消</el-button>
-    </template>
-  </el-dialog>
-</template>
-<script setup>
-import { ref } from '@vue/reactivity'
-import { detailList } from '@/api/business/equipment'
-const { proxy } = getCurrentInstance()
-/**字典数组区 */
-const { equipment_status } = proxy.useDict('equipment_status')
-/**设备弹窗变量 */
-const total = ref(0)
-const props = defineProps({
-  width: {
-    type: String,
-    default: '900px'
-  },
-  multiple: {
-    type: Boolean,
-    default: false
-  },
-  singleSelected: {
-    type: Function,
-    default: null
-  },
-  multipleSelected: {
-    type: Function,
-    default: null
-  }
-})
-const { singleSelected, multipleSelected } = toRefs(props)
-const list = ref([])
-const detailRow = ref({})
-const selections = ref([])
-const visible = ref(false)
-const equipmentCodeIds = ref([])
-/**查询对象 */
-const data = reactive({
-  queryParams: {
-    name: '',
-    pageSize: 10,
-    pageNum: 1
-  }
-})
-const { queryParams } = toRefs(data)
-/***********************  方法区  ****************************/
-/**
- * 对话框打开 事件
- */
-function open(row) {
-  equipmentCodeIds.value = []
-  visible.value = true
-  if (row) {
-    detailRow.value = row
-    equipmentCodeIds.value = detailRow.value.equipmentCodeIds
-    queryParams.value.usageDeptId = row.deptId
-  }
-  getList()
-}
-
-/**
- * 对话框关闭 事件
- */
-function close() {
-  proxy.$refs.dialogForm.resetFields()
-  proxy.$refs.dialogTable.clearSelection()
-  handleSearch('clear')
-  visible.value = false
-}
-
-/**
- * 加载数据
- */
-function getList() {
-  detailList(queryParams.value).then((res) => {
-    list.value = res.rows
-    total.value = res.total
-  })
-}
-/**判断多选框状态 */
-function selectable(row) {
-  if (equipmentCodeIds.value) {
-    return !equipmentCodeIds.value.includes(row.equipmentCode)
-  } else {
-    return true
-  }
-}
-/**
- * 列表checkbox列选择 事件
- */
-function handleSelectionChange(selection) {
-  selections.value = selection
-}
-
-/**  搜索 事件 */
-function handleSearch(type) {
-  if (type && type === 'clear') {
-    queryParams.value = {
-      subject: '',
-      name: '',
-      total: 0,
-      pageSize: 10,
-      pageNum: 1
-    }
-  }
-  getList()
-}
-
-/** 单选事件 */
-function handleSingleSelected(row) {
-  console.log(singleSelected.value)
-  if (singleSelected.value) {
-    singleSelected.value(row)
-  }
-  close()
-}
-
-/** 多选事件 */
-function handleMultipleSelected() {
-  if (multipleSelected.value) {
-    multipleSelected.value(selections.value)
-  }
-  close()
-}
-
-defineExpose({
-  open
-})
-</script>

+ 0 - 208
src/views/dialog/person.vue

@@ -1,208 +0,0 @@
-<template>
-  <el-dialog title="员工选择" v-model="visible" :width="width" @close="close" append-to-body draggable>
-    <el-form ref="dialogForm" class="list-search-container" :inline="true" :model="queryParams" >
-      <el-form-item label="员工编码:" prop="userName">
-        <el-input v-model.trim="queryParams.userName" type="text" placeholder="请输入员工编码" @keydown.enter.prevent @keyup.enter="handleSearch" style="width: 180px" clearable />
-      </el-form-item>
-      <el-form-item label="员工姓名:" prop="nickName">
-        <el-input v-model.trim="queryParams.nickName" type="text" placeholder="请输入员工姓名" @keydown.enter.prevent @keyup.enter="handleSearch" style="width: 180px" clearable />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
-      </el-form-item>
-    </el-form>
-    <el-table ref="dialogTable" :data="list" :row-key="getRowKey" v-loading="personLoading" height="440px" @selection-change="handleSelectionChange" align="center">
-      <el-table-column v-if="multiple" type="selection" width="40" align="center" :reserve-selection="true" :selectable="handleSelected" />
-      <el-table-column type="index" label="行号" width="50" align="center" />
-      <el-table-column label="员工编码" prop="userName" width="100" align="center" />
-      <el-table-column label="员工姓名" prop="nickName" width="100" align="center" />
-      <el-table-column label="手机号码" prop="phoneNumber" width="150" align="center" />
-      <el-table-column label="性别" prop="sex" width="60" align="center" />
-      <el-table-column label="使用单位" prop="usageCompanyName" width="220" align="center" />
-      <el-table-column label="备注" prop="remark" align="center" />
-      <el-table-column v-if="!multiple" label="操作" width="50" align="center">
-        <template #default="scope">
-          <el-button type="success" icon="finished" circle @click="handleSingleSelected(scope.row)" />
-        </template>
-      </el-table-column>
-    </el-table>
-    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
-    <template #footer>
-      <div class="dialog-footer">
-        <el-button v-if="multiple" type="primary" :disabled="selections.length === 0" icon="Check" @click="handleMultipleSelected">
-          确定
-        </el-button>
-        <el-button icon="Close" @click="close">取 消</el-button>
-      </div>
-    </template>
-  </el-dialog>
-</template>
-<script setup>
-import { ref } from '@vue/reactivity'
-import { listEmployee } from '@/api/system/user'
-import { listUser,listByLikeNickNameOrUserName, getUsersByDeptId, getUsersItemByDeptId } from '@/api/system/user'
-
-
-const { proxy } = getCurrentInstance()
-const total = ref(0)
-const props = defineProps({
-  width: {
-    type: String,
-    default: '1000px'
-  },
-  multiple: {
-    type: Boolean,
-    default: false
-  },
-  selected: {
-    type: Array,
-    defalut: []
-  },
-  singleSelected: {
-    type: Function,
-    default: null
-  },
-  multipleSelected: {
-    type: Function,
-    default: null
-  }
-})
-const { singleSelected, multipleSelected, selected } = toRefs(props)
-const list = ref([])
-const userIds = ref([])
-const personLoading = ref(false)
-const visible = ref(false)
-const identifying = ref(false)
-const data = reactive({
-  queryParams: {
-    nickName: '',
-    userName: '',
-    pageSize: 10,
-    pageNum: 1
-  }
-})
-const selections = ref([])
-const { queryParams } = toRefs(data)
-/**
- * 对话框打开 事件
- */
-function open(userInfo) {
-  //部门管理新增
-  if (userInfo.identifying) {
-    identifying.value = userInfo.identifying
-    //queryParams.value.deptId = userInfo.deptId;
-  } else {
-    queryParams.value.deptId = userInfo.deptId
-  }
-  if (userInfo.userIds) {
-    userIds.value = userInfo.userIds
-  }
-  visible.value = true
-  getList()
-}
-/** 获取行 id */
-function getRowKey(row) {
-  return row.userId
-}
-
-/**
- * 对话框关闭 事件
- */
-function close() {
-  proxy.$refs.dialogForm.resetFields()
-  proxy.$refs.dialogTable.clearSelection()
-  queryParams.value.pageNum = 1
-  visible.value = false
-}
-
-/**
- * 加载数据
- */
-function getList() {
-  personLoading.value = true
-  console.log(identifying.value)
-  //如果identifying为true,则是部门管理添加员工弹窗数据;如果为false,则是在资源分配添加员工弹窗
-  if (identifying.value) {
-    listByLikeNickNameOrUserName(queryParams.value).then(response => {
-    if (response.code == 200) {
-      list.value = response.rows
-      total.value = response.total
-      personLoading.value = false
-    }
-  })
-  } else {
-  listUser(queryParams.value).then((response) => {
-    if (response.code == 200) {
-      list.value = response.rows
-      total.value = response.total
-      personLoading.value = false
-    }
-  })
-  }
-}
-
-/**
- * 列表checkbox列选择 事件
- */
-function handleSelectionChange(selection) {
-  selections.value = selection
-}
-
-function handleSelected(row) {
-  return !userIds.value.includes(row.userName)
-}
-
-/**  搜索 事件 */
-function handleSearch(type) {
-  if (type && type === 'clear') {
-    queryParams.value = {
-      subject: '',
-      nickName: '',
-      userName: '',
-      total: 0,
-      pageSize: 10,
-      pageNum: 1
-    }
-  }
-  else {
-  if (identifying.value) {
-    listByLikeNickNameOrUserName(queryParams.value).then(response => {
-    if (response.code == 200) {
-      list.value = response.rows
-      total.value = response.total
-      personLoading.value = false
-    }
-  })
-  } else {
-  listUser(queryParams.value).then((response) => {
-    if (response.code == 200) {
-      list.value = response.rows
-      total.value = response.total
-      personLoading.value = false
-    }
-  })
-  }
-}
-
-}
-
-/** 单选事件 */
-function handleSingleSelected(row) {
-  if (singleSelected.value) {
-    singleSelected.value(row)
-  }
-  close()
-}
-
-/** 多选事件 */
-function handleMultipleSelected() {
-  if (multipleSelected.value) {
-    multipleSelected.value(selections.value)
-  }
-  close()
-}
-
-defineExpose({
-  open
-})
-</script>

+ 83 - 159
src/views/index.vue

@@ -1,8 +1,8 @@
 <template>
-  <div class="page-container column-container">
-    <el-row :gutter="24">
-      <el-col :span="8">
-        <!-- <div class="dashboard-total-item">
+	<div class="page-container column-container">
+		<el-row :gutter="24">
+			<el-col :span="8">
+				<!-- <div class="dashboard-total-item">
           <img :src="totalIcon2" />
           <div class="dashboard-total-item-label">
             <span>员工总数</span>
@@ -13,9 +13,9 @@
           </div>
           <div class="number-label">{{ totalCompanies }} 人</div>
         </div> -->
-      </el-col>
-      <el-col :span="8">
-        <!-- <div class="dashboard-total-item">
+			</el-col>
+			<el-col :span="8">
+				<!-- <div class="dashboard-total-item">
           <img :src="totalIcon3" />
           <div class="dashboard-total-item-label">
             <span>设备总数</span>
@@ -26,101 +26,25 @@
           </div>
           <div class="number-label">{{ identityTotal }} 台</div>
         </div> -->
-      </el-col>
-    </el-row>
-    <div class="statistic-container">
-      <el-row :gutter="16">
-        <el-col :span="12">
-          <div class="item-statistic-container" id="information-statistic"></div>
-        </el-col>
-        <el-col :span="12">
-          <div class="item-statistic-container" id="appointment-statistic"></div>
-        </el-col>
-      </el-row>
-    </div>
-  </div>
+			</el-col>
+		</el-row>
+		<div class="statistic-container">
+			<el-row :gutter="16">
+				<el-col :span="12">
+					<div class="item-statistic-container" id="information-statistic"></div>
+				</el-col>
+				<el-col :span="12">
+					<div class="item-statistic-container" id="appointment-statistic"></div>
+				</el-col>
+			</el-row>
+		</div>
+	</div>
 </template>
 <script setup>
 import totalIcon2 from '@/assets/images/dashboard-total-icon-2.png'
 import totalIcon3 from '@/assets/images/dashboard-total-icon-3.png'
 import { parseTime } from '@/utils/tools.js'
 
-import {
-  getProductionPlanDetailSubDetails,
-  getProcessDetailsByTechnicalProcessId,
-  getSubDetailProcessEquipments
-} from '@/api/business/productionTask'
-
-import { index } from '@/api/business/production'
-
-//import { getDashboardStatistics } from '@/api/ss/visitor/general.js'
-//import { getTenant } from '@/utils/auth'
-
-import * as echarts from 'echarts'
-const statisticOption = reactive({
-  title: {
-    text: '企业与标识每日注册统计',
-    left: 8
-  },
-  tooltip: {
-    trigger: 'axis'
-  },
-  legend: {
-    data: ['企业', '标识']
-  },
-  grid: {
-    left: '16px',
-    right: '48px',
-    bottom: '48px',
-    containLabel: true
-  },
-  xAxis: {
-    type: 'category',
-    boundaryGap: false,
-    // x 坐标轴对应的值
-    data: []
-  },
-  yAxis: {
-    type: 'value'
-  },
-  // 缩放
-  dataZoom: [
-    {
-      type: 'slider',
-      xAxisIndex: 0,
-      filterMode: 'none'
-    },
-    {
-      type: 'slider',
-      yAxisIndex: 0,
-      filterMode: 'none'
-    },
-    {
-      type: 'inside',
-      xAxisIndex: 0,
-      filterMode: 'none'
-    },
-    {
-      type: 'inside',
-      yAxisIndex: 0,
-      filterMode: 'none'
-    }
-  ],
-  // y 坐标轴对应的值
-  series: [
-    {
-      name: '企业',
-      type: 'line',
-      data: [11, 0, 0, 22, 38, 32, 20, 12, 0, 0, 14, 9, 17, 18, 35, 0, 0, 16, 20, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
-    },
-    {
-      name: '标识',
-      type: 'line',
-      data: [173, 101, 120, 240, 182, 123, 255, 198, 156, 110, 155, 121, 120, 128, 209, 127, 140, 205, 142, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
-    }
-  ]
-})
-
 let totalCompanies = ref(0)
 let monthTotalCompanies = ref(0)
 let identityTotal = ref(0)
@@ -130,98 +54,98 @@ let currentMonth = ref('')
 let statisticDom, statistic
 
 onMounted(() => {
-  currentMonth.value = parseTime(new Date(), '{y}-{m}')
-  //statisticDom = document.getElementById('information-statistic')
-  //statistic = echarts.init(statisticDom)
-  //getCurrentMonthDayArr()
+	currentMonth.value = parseTime(new Date(), '{y}-{m}')
+	//statisticDom = document.getElementById('information-statistic')
+	//statistic = echarts.init(statisticDom)
+	//getCurrentMonthDayArr()
 })
 
 const getCurrentMonthDayArr = (dateStr) => {
-  // 获取当前日期
-  var currentDate = dateStr ? new Date(dateStr) : new Date()
-  // 获取当前月份
-  var currentMonth = currentDate.getMonth()
-  // 获取下个月的第一天
-  var nextMonth = new Date(currentDate.getFullYear(), currentMonth + 1, 1)
-  // 设置日期为当前月份的最后一天
-  nextMonth.setDate(nextMonth.getDate() - 1)
-  // 根据当前月最后一天的日期,判断每个月有多少天
-  var days = nextMonth.getDate()
+	// 获取当前日期
+	var currentDate = dateStr ? new Date(dateStr) : new Date()
+	// 获取当前月份
+	var currentMonth = currentDate.getMonth()
+	// 获取下个月的第一天
+	var nextMonth = new Date(currentDate.getFullYear(), currentMonth + 1, 1)
+	// 设置日期为当前月份的最后一天
+	nextMonth.setDate(nextMonth.getDate() - 1)
+	// 根据当前月最后一天的日期,判断每个月有多少天
+	var days = nextMonth.getDate()
 
-  // 创建一个空数组来存储日期
-  const dateArray = []
-  // 循环遍历天数
-  for (var day = 1; day <= days; ++day) {
-    // 使用padStart函数将日期补齐到两位数,不足的地方用0填充
-    var formattedDay = String(day).padStart(2, '0')
-    // 将格式化后的日期添加到数组中
-    dateArray.push(formattedDay)
-  }
-  statisticOption.xAxis.data = dateArray
-  totalCompanies.value = 523
-  monthTotalCompanies.value = 276
-  identityTotal.value = 5133
-  identityMonthTotal.value = 3015
+	// 创建一个空数组来存储日期
+	const dateArray = []
+	// 循环遍历天数
+	for (var day = 1; day <= days; ++day) {
+		// 使用padStart函数将日期补齐到两位数,不足的地方用0填充
+		var formattedDay = String(day).padStart(2, '0')
+		// 将格式化后的日期添加到数组中
+		dateArray.push(formattedDay)
+	}
+	statisticOption.xAxis.data = dateArray
+	totalCompanies.value = 523
+	monthTotalCompanies.value = 276
+	identityTotal.value = 5133
+	identityMonthTotal.value = 3015
 
-  statisticOption && statistic.setOption(statisticOption)
+	statisticOption && statistic.setOption(statisticOption)
 }
 const handleChangeMonth = (val) => {
-  getCurrentMonthDayArr(val)
+	getCurrentMonthDayArr(val)
 }
 </script>
 
 <style scoped>
 .dashboard-total-item {
-  display: flex;
-  align-items: center;
-  padding: 0 24px;
-  height: 152px;
-  background-color: #fff;
-  font-size: 16px;
-  justify-content: space-between;
+	display: flex;
+	align-items: center;
+	padding: 0 24px;
+	height: 152px;
+	background-color: #fff;
+	font-size: 16px;
+	justify-content: space-between;
 }
 .dashboard-total-item > .dashboard-total-item-label {
-  flex: 1;
-  display: flex;
-  flex-direction: column;
-  line-height: 32px;
-  padding: 0 16px;
+	flex: 1;
+	display: flex;
+	flex-direction: column;
+	line-height: 32px;
+	padding: 0 16px;
 }
 .dashboard-total-item > .dashboard-total-item-label > span:first-child {
-  font-weight: bold;
-  font-size: 18px;
+	font-weight: bold;
+	font-size: 18px;
 }
 .dashboard-total-item > .dashboard-total-item-label > span:last-child {
-  color: #6b6b6b;
+	color: #6b6b6b;
 }
 .dashboard-total-item > .dashboard-total-item-label > span:last-child > span:first-child {
-  margin-right: 8px;
+	margin-right: 8px;
 }
 .dashboard-total-item > .dashboard-total-item-label > span:last-child > span:last-child {
-  color: #4367df;
+	color: #4367df;
 }
 .dashboard-total-item > .number-label {
-  font-size: 40px;
-  margin-left: 16px;
-  font-weight: bold;
-  color: #5a6ac3;
+	font-size: 40px;
+	margin-left: 16px;
+	font-weight: bold;
+	color: #5a6ac3;
 }
 .statistic-container {
-  position: relative;
-  margin-top: 24px;
-  background-color: #fff;
-  padding-top: 16px;
-  padding-right: 12px;
-  padding-bottom: 8px;
-  padding-left: 4px;
+	position: relative;
+	margin-top: 24px;
+	background-color: #fff;
+	padding-top: 16px;
+	padding-right: 12px;
+	padding-bottom: 8px;
+	padding-left: 4px;
 }
 .statistic-container > .month-picker {
-  position: absolute;
-  top: 16px;
-  left: 240px;
-  line-height: 24px;
+	position: absolute;
+	top: 16px;
+	left: 240px;
+	line-height: 24px;
 }
 .item-statistic-container {
-  height: 560px;
+	height: 560px;
 }
 </style>

+ 239 - 174
src/views/login.vue

@@ -1,27 +1,50 @@
 <template>
-  <div class="login">
-    <div class="login-l">
-      <div><span>德迈仕</span>数字化平台</div>
-    </div>
-    <div class="login-r">
-      <img class="logo" referrerpolicy="no-referrer" src="@/assets/logo/logo.png" />
-      <span class="title">欢迎使用德迈仕数字化平台</span>
-      <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
-        <el-form-item prop="username">
-          <el-input v-model.trim="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
-            <template #prefix>
-              <svg-icon icon-class="user" class="el-input__icon input-icon" />
-            </template>
-          </el-input>
-        </el-form-item>
-        <el-form-item prop="password">
-          <el-input v-model.trim="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码" show-password @keyup.enter="handleLogin">
-            <template #prefix>
-              <svg-icon icon-class="password" class="el-input__icon input-icon" />
-            </template>
-          </el-input>
-        </el-form-item>
-        <!-- <el-form-item prop="code" v-if="captchaEnabled">
+	<div class="login">
+		<div class="login-l">
+			<div><span>德迈仕</span>数字化平台</div>
+		</div>
+		<div class="login-r">
+			<img class="logo" referrerpolicy="no-referrer" src="@/assets/logo/logo.png" />
+			<span class="title">欢迎使用德迈仕数字化平台</span>
+			<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
+				<el-form-item prop="supplierId">
+					<el-select
+						class="supplier-select"
+						v-model="loginForm.supplierId"
+						filterable
+						remote
+						size="large"
+						placeholder="输入公司名-选择公司"
+						:remote-method="remoteMethod"
+						:loading="loading"
+						@change="handleSupplierChange"
+					>
+						<el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.id" />
+					</el-select>
+				</el-form-item>
+				<el-form-item prop="username">
+					<el-input v-model.trim="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
+						<template #prefix>
+							<svg-icon icon-class="user" class="el-input__icon input-icon" />
+						</template>
+					</el-input>
+				</el-form-item>
+				<el-form-item prop="password">
+					<el-input
+						v-model.trim="loginForm.password"
+						type="password"
+						size="large"
+						auto-complete="off"
+						placeholder="密码"
+						show-password
+						@keyup.enter="handleLogin"
+					>
+						<template #prefix>
+							<svg-icon icon-class="password" class="el-input__icon input-icon" />
+						</template>
+					</el-input>
+				</el-form-item>
+				<!-- <el-form-item prop="code" v-if="captchaEnabled">
           <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter="handleLogin">
             <template #prefix>
               <svg-icon icon-class="validCode" class="el-input__icon input-icon" />
@@ -31,52 +54,71 @@
             <img :src="codeUrl" @click="getCode" class="login-code-img" />
           </div>
         </el-form-item> -->
-        <div class="tool">
-          <el-checkbox v-model="loginForm.rememberMe">5天自动登录</el-checkbox>
-          <span style="font-size: 14px">忘记密码</span>
-        </div>
-        <el-form-item style="width: 100%">
-          <el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
-            <span v-if="!loading">立即登录</span>
-            <span v-else>登 录 中...</span>
-          </el-button>
-          <!--
+				<div class="tool">
+					<el-checkbox v-model="loginForm.rememberMe">5天自动登录</el-checkbox>
+					<span style="font-size: 14px">忘记密码</span>
+				</div>
+				<el-form-item style="width: 100%">
+					<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
+						<span v-if="!loading">立即登录</span>
+						<span v-else>登 录 中...</span>
+					</el-button>
+					<!--
           <div style="float: right;" v-if="register">
             <router-link class="link-type" :to="'/register'">立即注册</router-link>
           </div>
           -->
-        </el-form-item>
-      </el-form>
-      <!--  底部  -->
-      <div class="login-footer">
-        <span>Copyright © 2023-2033 <a href="http://www.cdms-china.com/" target="_blank">www.cdms-china.com</a> All Rights Reserved.</span>
-      </div>
-    </div>
-  </div>
+				</el-form-item>
+			</el-form>
+			<!--  底部  -->
+			<div class="login-footer">
+				<span
+					>Copyright © 2023-2033 <a href="http://www.cdms-china.com/" target="_blank">www.cdms-china.com</a> All Rights
+					Reserved.</span
+				>
+			</div>
+		</div>
+	</div>
 </template>
 
 <script setup>
 // import { getCodeImg } from '@/api/login'
 import Cookies from 'js-cookie'
+import { setTenant } from '@/utils/auth'
 import { encrypt, decrypt } from '@/utils/jsencrypt'
 import useUserStore from '@/store/modules/user'
 import { listEmployee } from '@/api/system/user'
 const userStore = useUserStore()
 const router = useRouter()
 const { proxy } = getCurrentInstance()
+const supplierOptions = ref([])
 
 const loginForm = ref({
-  username: '',
-  password: '',
-  rememberMe: false,
-  code: '',
-  uuid: ''
+	supplierId: '0',
+	supplierName: '',
+	username: '',
+	password: '',
+	rememberMe: false,
+	code: '',
+	uuid: ''
 })
 
 const loginRules = {
-  username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
-  password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
-  code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
+	supplierId: [
+		{ required: true, trigger: 'blur', message: '请输入公司名' },
+		{
+			validator: (rule, value, callback) => {
+				if (value === '0') {
+					callback(new Error('请输入公司名'))
+				} else {
+					callback()
+				}
+			}
+		}
+	],
+	username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
+	password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
+	code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
 }
 
 const loading = ref(false)
@@ -87,40 +129,60 @@ const loading = ref(false)
 // const register = ref(true)
 const redirect = ref(undefined)
 
+function remoteMethod(query) {
+	if (query) {
+		loading.value = true
+		userStore.getSuppliers(query).then((res) => {
+			supplierOptions.value = res.data
+			loading.value = false
+		})
+	} else {
+		supplierOptions.value = []
+	}
+}
+
+function handleSupplierChange(val) {
+	console.log(val)
+	if (supplierOptions.value.length > 0) {
+		const supplier = supplierOptions.value.find((item) => item.id === val)
+		setTenant({ tenantId: val, tenantName: supplier.name })
+	}
+}
+
 function handleLogin() {
-  proxy.$refs.loginRef.validate((valid) => {
-    if (valid) {
-      loading.value = true
-      // 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
-      if (loginForm.value.rememberMe) {
-        Cookies.set('username', loginForm.value.username, { expires: 30 })
-        Cookies.set('password', encrypt(loginForm.value.password), { expires: 30 })
-        Cookies.set('rememberMe', loginForm.value.rememberMe, { expires: 30 })
-      } else {
-        // 否则移除
-        Cookies.remove('username')
-        Cookies.remove('password')
-        Cookies.remove('rememberMe')
-      }
-      // listEmployee({ userName: loginForm.value.username }).then(res =>{})
-      // 调用action的登录方法
-
-      userStore
-        .login(loginForm.value)
-        .then(() => {
-          router.push({ path: redirect.value || '/' })
-        })
-        .catch(() => {
-          loading.value = false
-          /*
+	proxy.$refs.loginRef.validate((valid) => {
+		if (valid) {
+			loading.value = true
+			// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
+			if (loginForm.value.rememberMe) {
+				Cookies.set('username', loginForm.value.username, { expires: 30 })
+				Cookies.set('password', encrypt(loginForm.value.password), { expires: 30 })
+				Cookies.set('rememberMe', loginForm.value.rememberMe, { expires: 30 })
+			} else {
+				// 否则移除
+				Cookies.remove('username')
+				Cookies.remove('password')
+				Cookies.remove('rememberMe')
+			}
+			// listEmployee({ userName: loginForm.value.username }).then(res =>{})
+			// 调用action的登录方法
+
+			userStore
+				.login(loginForm.value)
+				.then(() => {
+					router.push({ path: redirect.value || '/' })
+				})
+				.catch(() => {
+					loading.value = false
+					/*
           // 重新获取验证码
           if (captchaEnabled.value) {
             getCode()
           }
           */
-        })
-    }
-  })
+				})
+		}
+	})
 }
 
 /*
@@ -136,14 +198,14 @@ function getCode() {
 */
 
 function getCookie() {
-  const username = Cookies.get('username')
-  const password = Cookies.get('password')
-  const rememberMe = Cookies.get('rememberMe')
-  loginForm.value = {
-    username: username === undefined ? loginForm.value.username : username,
-    password: password === undefined ? loginForm.value.password : decrypt(password),
-    rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
-  }
+	const username = Cookies.get('username')
+	const password = Cookies.get('password')
+	const rememberMe = Cookies.get('rememberMe')
+	loginForm.value = {
+		username: username === undefined ? loginForm.value.username : username,
+		password: password === undefined ? loginForm.value.password : decrypt(password),
+		rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
+	}
 }
 
 // getCode()
@@ -152,101 +214,104 @@ getCookie()
 
 <style lang="scss" scoped>
 .login {
-  position: relative;
-  display: flex;
-  height: 100%;
-  background-size: cover;
-
-  .login-l {
-    display: flex;
-    flex-direction: column;
-    flex: 3;
-    background: url('../assets/images/login-bg.jpg') no-repeat center center/cover #efefef;
-    align-items: center;
-
-    div {
-      color: #fff;
-    }
-    div:first-child {
-      padding-top: 120px;
-      font-size: 48px;
-      font-weight: bold;
-      letter-spacing: 4px;
-
-      span {
-        color: #00fff6;
-      }
-    }
-  }
-  .login-r {
-    position: relative;
-    display: flex;
-    flex-direction: column;
-    flex: 2;
-    justify-content: center;
-    align-items: center;
-
-    .logo {
-      width: 120px;
-    }
+	position: relative;
+	display: flex;
+	height: 100%;
+	background-size: cover;
 
-    .title {
-      color: #333;
-      font-size: 20px;
-      font-family: 微软雅黑;
-      text-align: center;
-      margin-top: 16px;
-      letter-spacing: 2px;
-    }
+	.login-l {
+		display: flex;
+		flex-direction: column;
+		flex: 3;
+		background: url('../assets/images/login-bg.jpg') no-repeat center center/cover #efefef;
+		align-items: center;
 
-    .login-form {
-      width: 400px;
-      padding-top: 40px;
-      .el-input {
-        height: 48px;
-        input {
-          height: 40px;
-        }
-      }
-    }
+		div {
+			color: #fff;
+		}
+		div:first-child {
+			padding-top: 120px;
+			font-size: 48px;
+			font-weight: bold;
+			letter-spacing: 4px;
 
-    .tool {
-      display: flex;
-      margin-bottom: 25px;
-      align-items: center;
-      justify-content: space-between;
+			span {
+				color: #00fff6;
+			}
+		}
+	}
+	.login-r {
+		position: relative;
+		display: flex;
+		flex-direction: column;
+		flex: 2;
+		justify-content: center;
+		align-items: center;
 
-      span {
-        color: #409eff;
-        cursor: pointer;
-      }
-    }
+		.logo {
+			width: 120px;
+		}
 
-    button {
-      height: 48px;
-      letter-spacing: 2px;
-    }
+		.title {
+			color: #333;
+			font-size: 20px;
+			font-family: 微软雅黑;
+			text-align: center;
+			margin-top: 16px;
+			letter-spacing: 2px;
+		}
 
-    .warning-text {
-      font-size: 14px;
-      text-align: center;
-      color: #333;
+		.login-form {
+			--el-component-size-large: 48px;
 
-      a {
-        color: #409eff;
-        text-decoration: none;
-      }
-    }
-    .login-footer {
-      position: fixed;
-      bottom: 0;
-      width: 100%;
-      text-align: center;
-      color: #333;
-      font-family: Arial;
-      font-size: 12px;
-      letter-spacing: 1px;
-    }
-  }
+			width: 400px;
+			padding-top: 40px;
+
+			.el-select {
+				width: 100%;
+			}
+			.el-input {
+				height: 48px;
+			}
+		}
+
+		.tool {
+			display: flex;
+			margin-bottom: 25px;
+			align-items: center;
+			justify-content: space-between;
+
+			span {
+				color: #409eff;
+				cursor: pointer;
+			}
+		}
+
+		button {
+			height: 48px;
+			letter-spacing: 2px;
+		}
+
+		.warning-text {
+			font-size: 14px;
+			text-align: center;
+			color: #333;
+
+			a {
+				color: #409eff;
+				text-decoration: none;
+			}
+		}
+		.login-footer {
+			position: fixed;
+			bottom: 0;
+			width: 100%;
+			text-align: center;
+			color: #333;
+			font-family: Arial;
+			font-size: 12px;
+			letter-spacing: 1px;
+		}
+	}
 }
 </style>

+ 51 - 63
vite.config.js

@@ -4,67 +4,55 @@ import createVitePlugins from './vite/plugins'
 
 // https://vitejs.dev/config/
 export default defineConfig(({ mode, command }) => {
-  const env = loadEnv(mode, process.cwd())
-  const { VITE_APP_ENV } = env
-  return {
-    // 部署生产环境和开发环境下的URL。
-    // 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
-    // 例如 https://www.ezhizao.cn/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ezhizao.cn/admin/,则设置 baseUrl 为 /admin/。
-    base: VITE_APP_ENV === 'production' ? '/' : '/',
-    plugins: createVitePlugins(env, command === 'build'),
-    resolve: {
-      // https://cn.vitejs.dev/config/#resolve-alias
-      alias: {
-        // 设置路径
-        '~': path.resolve(__dirname, './'),
-        // 设置别名
-        '@': path.resolve(__dirname, './src')
-      },
-      // https://cn.vitejs.dev/config/#resolve-extensions
-      extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
-    },
-    // vite 相关配置
-    server: {
-      port: 81,
-      host: true,
-      open: true,
-      proxy: {
-        // https://cn.vitejs.dev/config/#server-proxy
-        '/ezhizao-dms-sys': {
-          target: 'http://localhost:8080',
-          changeOrigin: true,
-          rewrite: (p) => p.replace(/^\/ezhizao-dms-sys/, '')
-        },
-        // 生产管理配置示例
-        '/ezhizao-dms-production': {
-          target: 'http://localhost:8081',
-          changeOrigin: true,
-          rewrite: (p) => p.replace(/^\/ezhizao-dms-production/, '')
-        },
-        // 生产报工配置
-        '/ezhizao-dms-p2': {
-          target: 'http://localhost:8098',
-          changeOrigin: true,
-          rewrite: (p) => p.replace(/^\/ezhizao-dms-p2/, '')
-        }
-      }
-    },
-    //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
-    css: {
-      postcss: {
-        plugins: [
-          {
-            postcssPlugin: 'internal:charset-removal',
-            AtRule: {
-              charset: (atRule) => {
-                if (atRule.name === 'charset') {
-                  atRule.remove()
-                }
-              }
-            }
-          }
-        ]
-      }
-    }
-  }
+	const env = loadEnv(mode, process.cwd())
+	const { VITE_APP_ENV } = env
+	return {
+		// 部署生产环境和开发环境下的URL。
+		// 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
+		// 例如 https://www.ezhizao.cn/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ezhizao.cn/admin/,则设置 baseUrl 为 /admin/。
+		base: VITE_APP_ENV === 'production' ? '/' : '/',
+		plugins: createVitePlugins(env, command === 'build'),
+		resolve: {
+			// https://cn.vitejs.dev/config/#resolve-alias
+			alias: {
+				// 设置路径
+				'~': path.resolve(__dirname, './'),
+				// 设置别名
+				'@': path.resolve(__dirname, './src')
+			},
+			// https://cn.vitejs.dev/config/#resolve-extensions
+			extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
+		},
+		// vite 相关配置
+		server: {
+			port: 81,
+			host: true,
+			open: true,
+			proxy: {
+				// https://cn.vitejs.dev/config/#server-proxy
+				'/ezhizao-dms-supplier-api': {
+					target: 'http://localhost:8081',
+					changeOrigin: true,
+					rewrite: (p) => p.replace(/^\/ezhizao-dms-supplier-api/, '')
+				}
+			}
+		},
+		//fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
+		css: {
+			postcss: {
+				plugins: [
+					{
+						postcssPlugin: 'internal:charset-removal',
+						AtRule: {
+							charset: (atRule) => {
+								if (atRule.name === 'charset') {
+									atRule.remove()
+								}
+							}
+						}
+					}
+				]
+			}
+		}
+	}
 })