Prechádzať zdrojové kódy

feat: ✨ 完成合同明细,完成公共代码的封装

@sun-chaoqun 1 rok pred
rodič
commit
aa6c40aa3c

+ 9 - 9
src/api/role/index.ts

@@ -1,20 +1,20 @@
 import $http from '../index'
 
 // 获取列表
-export const User_Power_List = (params: any) => $http.post('/api/user/Power/List', params)
+export const User_Power_List = (params: any) => $http.post('/testapi/user/Power/List', params)
 // 权限系统列表
-export const User_Sys_List = (params: any) => $http.post('/api/user/Power/Sys_List', params)
+export const User_Sys_List = (params: any) => $http.post('/testapi/user/Power/Sys_List', params)
 // 弹框菜单
-export const Menu_List = (params: any): any => $http.post('/api/user/Menu/List', params)
+export const Menu_List = (params: any): any => $http.post('/testapi/user/Menu/List', params)
 // 左侧菜单栏
-export const Menu_User_List = (params: any) => $http.post('/api/user/Menu/User_List', params)
+export const Menu_User_List = (params: any) => $http.post('/testapi/user/Menu/User_List', params)
 // 添加角色名
-export const User_Power_Add = (params: any): any => $http.post('/api/user/Power/Add', params)
+export const User_Power_Add = (params: any): any => $http.post('/testapi/user/Power/Add', params)
 // 编辑角色名
-export const User_Power_Edit = (params: any): any => $http.post('/api/user/Power/Edit', params)
+export const User_Power_Edit = (params: any): any => $http.post('/testapi/user/Power/Edit', params)
 // 删除角色名
-export const User_Power_Del = (params: any): any => $http.post('/api/user/Power/Del', params)
+export const User_Power_Del = (params: any): any => $http.post('/testapi/user/Power/Del', params)
 // 编辑菜单
-export const User_Power_Edit_Menu = (params: any): any => $http.post('/api/user/Power/Edit_Menu', params)
+export const User_Power_Edit_Menu = (params: any): any => $http.post('/testapi/user/Power/Edit_Menu', params)
 // 获取用户权限
-export const User_Power_Get = (params: any): any => $http.post('/api/user/Power/Get', params)
+export const User_Power_Get = (params: any): any => $http.post('/testapi/user/Power/Get', params)

+ 12 - 10
src/api/storehouse/index.ts

@@ -125,20 +125,22 @@ export const Storehouse_Device_Check = (params: any) => $http.post('/api/storage
  */
 // 客户列表
 export const Storehouse_VerifyContract_Customer_List = (params: any) =>
-  $http.post('/api/storage/VerifyContract/Customer_List', params)
+  $http.post('/testapi/storage/VerifyContract/Customer_List', params)
 // 添加客户
 export const Storehouse_VerifyContract_Add_Customer = (params: any) =>
-  $http.post('/api/storage/VerifyContract/Add_Customer', params)
+  $http.post('/testapi/storage/VerifyContract/Add_Customer', params)
 // 编辑客户
 export const Storehouse_VerifyContract_Update_Customer = (params: any) =>
-  $http.post('/api/storage/VerifyContract/Update_Customer', params)
+  $http.post('/testapi/storage/VerifyContract/Update_Customer', params)
 // 明细列表
-export const Storehouse_VerifyContract_List = (params: any) => $http.post('/api/storage/VerifyContract/List', params)
+export const Storehouse_VerifyContract_List = (params: any) =>
+  $http.post('/testapi/storage/VerifyContract/List', params)
 // 添加
-export const Storehouse_VerifyContract_Add = (params: any) => $http.post('/api/storage/VerifyContract/Add', params)
+export const Storehouse_VerifyContract_Add = (params: any) => $http.post('/testapi/storage/VerifyContract/Add', params)
 // 编辑
-export const Storehouse_VerifyContract_Edit = (params: any) => $http.post('/api/storage/VerifyContract/Edit', params)
-// 编辑
-export const Storehouse_VerifyContract_Get = (params: any) => $http.post('/api/storage/VerifyContract/Get', params)
-// 编辑
-export const Storehouse_VerifyContract_Del = (params: any) => $http.post('/api/storage/VerifyContract/Del', params)
+export const Storehouse_VerifyContract_Edit = (params: any) =>
+  $http.post('/testapi/storage/VerifyContract/Edit', params)
+// 获取详情
+export const Storehouse_VerifyContract_Get = (params: any) => $http.post('/testapi/storage/VerifyContract/Get', params)
+// 删除
+export const Storehouse_VerifyContract_Del = (params: any) => $http.post('/testapi/storage/VerifyContract/Del', params)

+ 10 - 2
src/assets/iconfont.css

@@ -1,7 +1,7 @@
 @font-face {
   font-family: 'iconfont'; /* Project id 3967191 */
-  src: url('iconfont.woff2?t=1683771119671') format('woff2'), url('iconfont.woff?t=1683771119671') format('woff'),
-    url('iconfont.ttf?t=1683771119671') format('truetype');
+  src: url('iconfont.woff2?t=1684374473281') format('woff2'), url('iconfont.woff?t=1684374473281') format('woff'),
+    url('iconfont.ttf?t=1684374473281') format('truetype');
 }
 
 .iconfont {
@@ -12,6 +12,14 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-hetong7:before {
+  content: '\ue675';
+}
+
+.icon-hetong11:before {
+  content: '\ue679';
+}
+
 .icon-jichuguanli:before {
   content: '\ue651';
 }

BIN
src/assets/iconfont.ttf


BIN
src/assets/iconfont.woff


BIN
src/assets/iconfont.woff2


+ 5 - 4
src/hooks/useTablePublic.ts

@@ -29,13 +29,14 @@ export interface OvertimeUserInfoIn {
 export interface ContractFormType {
   T_uuid: string
   T_number: string
-  T_customer: string
   T_product: any
   T_money: string
-  T_discount: string
-  T_start_date: string
-  T_end_date: string
+  T_discount?: string
+  T_customer?: string
+  T_start_date?: string
+  T_end_date?: string
   T_date: string
+  T_project?: string
   T_remark: string
   T_pdf: string
   T_submit: string

+ 3 - 4
src/layouts/Header/Breadcrumb.vue

@@ -10,15 +10,12 @@ const router = useRouter()
 const globalStore = GlobalStore()
 
 const breadcrumbList: any = computed(() => {
-  // return route.matched.reduce((all: any, next: any) => {
-  //   return all.some((item: any) => item['path'] == next['path']) ? all : [...all, next]
-  // }, [])
   const { path, name } = route
   const BreadcrumbList = getExtraBreadcrumb(name as string)
   if (BreadcrumbList) return BreadcrumbList
   return globalStore.GET_AllBreadcrumbList[path]
 })
-// console.log(globalStore.GET_AllBreadcrumbList, route)
+// console.log(globalStore.GET_AllBreadcrumbList)
 /**
  * 获取额外的面包屑
  * @param name 路由名称
@@ -35,6 +32,8 @@ const getExtraBreadcrumb = (name: string) => {
       return getBreadcrumb('/saleOutStock', 'ue7e8', '/outStock')
     case 'OutStockDetail':
       return getBreadcrumb('/outStockDetail', 'ue72c', '/outStock')
+    case 'VerifyContractDetail':
+      return getBreadcrumb('/verifyContractDetail', 'ue679', '/verifyContract')
   }
 }
 /**

+ 1 - 9
src/router/modules/staticRouter.ts

@@ -33,7 +33,7 @@ export const staticRouter: RouteRecordRaw[] = [
         },
         children: [
           {
-            path: '/contractDetail/:id/:type',
+            path: '/contractDetail/:id/:type?/:verify?',
             name: 'ContractDetail',
             component: () => import('@/views/storehouse/sales/ContractDetail.vue'),
             meta: {
@@ -41,14 +41,6 @@ export const staticRouter: RouteRecordRaw[] = [
             }
           },
           {
-            path: '/verifyContract',
-            name: 'VerifyContract',
-            component: () => import('@/views/storehouse/sales/VerifyContract.vue'),
-            meta: {
-              title: '验证合同'
-            }
-          },
-          {
             path: '/verifyContractDetail/:id',
             name: 'VerifyContractDetail',
             component: () => import('@/views/storehouse/sales/VerifyContractDetail.vue'),

+ 5 - 0
src/styles/element.scss

@@ -38,6 +38,11 @@ img {
   color: #909399;
   font-weight: 600;
 }
+.el-menu-item,
+.el-sub-menu__title {
+  font-weight: 600;
+  letter-spacing: 1px;
+}
 
 .el-popper.is-customized {
   /* Set padding to ensure the height is 32px */

+ 4 - 2
src/utils/common.ts

@@ -52,7 +52,7 @@ const path = {
   records: ['/records'],
   outStock: ['/outStock'],
   inventory: ['/device', '/inStorage'],
-  sales: ['/contract', '/contractSale'],
+  sales: ['/contract', '/contractSale', '/verifyContract'],
   salarys: ['/salaryCount', '/salaryMy'],
   project: ['/projectFinance', '/project', '/myProject'],
   workAttendance: ['/leave', '/myLeave', '/myOvertime', '/overtime', '/recordsFinance'],
@@ -200,7 +200,9 @@ export const icons: iconsType = {
   ue6db: '\ue6db',
   ue614: '\ue614',
   ue609: '\ue609',
-  ue651: '\ue651'
+  ue651: '\ue651',
+  ue675: '\ue675',
+  ue679: '\ue679'
 }
 export function debounce<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void {
   let timerId: number | undefined

+ 2 - 6
src/views/storehouse/sales/Contract.vue

@@ -25,11 +25,10 @@ const columns: ColumnProps[] = [
   { prop: 'operation', label: '操作', width: 260, fixed: 'right' }
 ]
 
-const openContractFormDrawer = (type: string, row?: any) => ContractFormRef.value?.openDrawer(type, row)
+const searchHandle = () => TableRef.value?.searchTable()
 const updateOnTableList = () => TableRef.value?.getTableList()
-// 审核
+const openContractFormDrawer = (type: string, row?: any) => ContractFormRef.value?.openDrawer(type, row)
 const processContract = (id: string) => router.push({ name: 'ContractDetail', params: { id, type: fnMd5('contract') } })
-// 删除
 const UserDelete = (row: any) => {
   ElMessageBox.confirm('您确定要删除该销售合同吗?', '警告', {
     confirmButtonText: '确定',
@@ -49,8 +48,6 @@ const UserDelete = (row: any) => {
       ElMessage.warning('取消成功!')
     })
 }
-
-// 搜索
 const options = reactive([
   { name: '已通过', id: 1 },
   { name: '未通过', id: 2 },
@@ -61,7 +58,6 @@ const initParam = reactive({
   T_name: '',
   T_state: ''
 })
-const searchHandle = () => TableRef.value?.searchTable()
 </script>
 
 <template>

+ 74 - 17
src/views/storehouse/sales/ContractDetail.vue

@@ -1,11 +1,12 @@
 <script setup lang="ts">
-import { ref, onMounted, onUnmounted } from 'vue'
+import { shallowRef, ref, onMounted, onUnmounted } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
 import { GlobalStore } from '@/stores/index'
 import { fnMd5 } from '@/utils/common'
 import { ElMessage } from 'element-plus'
 import Drawer from '@/components/Drawer/index.vue'
 import ImageCom from '@/components/Image/index.vue'
+import { ColumnProps } from '@/components/TableBase/interface/index'
 import { Storehouse_Contract_Get, Storehouse_Contract_Approval } from '@/api/storehouse/index'
 
 interface InfoType {
@@ -21,8 +22,12 @@ interface InfoType {
   T_pdf: string
   T_remark: string
   T_submit: string
-  T_submit_name: string
   T_type: number
+  T_discount: number
+  T_start_date: string
+  T_end_date: string
+  T_submit_name: string
+  T_project: string
   T_no_recoveries_money: number
   T_no_invoice_money: number
 }
@@ -30,6 +35,7 @@ interface InfoType {
 const route = useRoute()
 const router = useRouter()
 const isSale = ref(false)
+const isVerify = ref(true)
 const tableSnData = ref<any[]>([])
 const tableData = ref<any[]>([])
 const invoiceTableData = ref<any[]>([])
@@ -37,25 +43,43 @@ const recoveriesTableData = ref<any[]>([])
 const info = ref<InfoType | undefined>()
 const globalStore = GlobalStore()
 const drawerSnRef = ref<InstanceType<typeof Drawer> | null>(null)
-const headerCellStyle = ref({
+const headerCellStyle = shallowRef({
   background: '#909399',
   height: '50px',
   color: '#fff'
 })
 
-const columns = [
+let columns: ColumnProps[] = [
   { type: 'index', label: '序号', width: 80, align: 'center ' },
   { label: '产品图片', prop: 'T_product_img', align: 'center ', name: 'T_product_img' },
   { label: '产品名称', prop: 'T_product_name', align: 'center ' },
   { label: '产品分类', prop: 'T_product_class_name', align: 'center ' },
   { label: '产品型号', prop: 'T_product_model', align: 'center ', name: 'T_product_model' },
   { label: '产品规格', prop: 'T_product_spec', align: 'center ' },
-  { label: '是否关联SN', prop: 'T_product_relation_sn', align: 'center ', width: 120, name: 'T_product_relation_sn' },
+  {
+    label: '是否关联SN',
+    prop: 'T_product_relation_sn',
+    align: 'center ',
+    width: 120,
+    name: 'T_product_relation_sn'
+  },
   { label: '数量', prop: 'T_product_total', align: 'center ' },
   { label: '已出库数量', prop: 'T_product_out', align: 'center ' },
   { prop: 'operation', label: '操作', width: 100, fixed: 'right', align: 'center ' }
 ]
 
+const VerifyColumns: ColumnProps[] = [
+  { type: 'index', label: '序号', width: 80, align: 'center ' },
+  { label: '产品图片', prop: 'T_product_img', align: 'center ', name: 'T_product_img' },
+  { label: '产品名称', prop: 'T_product_name', align: 'center ' },
+  { label: '产品分类', prop: 'T_product_class_name', align: 'center ' },
+  { label: '产品型号', prop: 'T_product_model', align: 'center ', name: 'T_product_model' },
+  { label: '产品规格', prop: 'T_product_spec', align: 'center ' },
+  { label: '数量', prop: 'T_product_total', align: 'center ' },
+  { label: '单价', prop: 'T_price', align: 'center ' },
+  { label: '总价', prop: 'total', align: 'center ' }
+]
+
 const columnsRecoveries = [
   { type: 'index', label: '序号', width: 80, align: 'center ' },
   { label: '回款时间', prop: 'T_date', align: 'center ' },
@@ -81,6 +105,12 @@ const getStorehouseContractGet = async () => {
     tableData.value = T_Product
     invoiceTableData.value = T_invoice
     recoveriesTableData.value = T_recoveries
+    if (!isVerify.value && T_Product) {
+      tableData.value = T_Product.map((item: any) => {
+        item.total = item.T_product_total * item.T_price
+        return item
+      })
+    }
   }
 }
 const previewPdf = (str: string) => window.open(str)
@@ -124,10 +154,11 @@ const previewSn = (devicelist: string[]) => {
 
 onMounted(() => {
   const { params } = route
-  if (params.type === fnMd5('contract')) {
-    isSale.value = true
-  }
   getStorehouseContractGet()
+  params.verify && (isVerify.value = false)
+  params.type === fnMd5('contract') && (isSale.value = true)
+
+  columns = isVerify.value ? columns : VerifyColumns
 })
 onUnmounted(() => {
   isSale.value = false
@@ -137,7 +168,7 @@ onUnmounted(() => {
   <div class="contract-detail">
     <div class="info">
       <h1>
-        详情 - <span>{{ getState(info?.T_State!, 'T_State') }}</span>
+        详情<span v-if="isVerify"> - {{ getState(info?.T_State!, 'T_State') }}</span>
       </h1>
       <el-divider />
       <div class="content">
@@ -147,7 +178,7 @@ onUnmounted(() => {
             ><span>{{ info?.T_number! }}</span></el-col
           >
         </el-row>
-        <el-row>
+        <el-row v-if="isVerify">
           <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>客户名称</span></el-col>
           <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
             ><span>{{ info?.T_customer! }}</span></el-col
@@ -189,7 +220,7 @@ onUnmounted(() => {
             </el-table>
           </el-col>
         </el-row>
-        <el-row>
+        <el-row v-if="isVerify">
           <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>业务日期</span></el-col>
           <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
             <span>{{ info?.T_date! }}</span></el-col
@@ -202,15 +233,39 @@ onUnmounted(() => {
             <el-text type="danger">{{ info?.T_money! }}¥</el-text>
           </el-col>
         </el-row>
+        <el-row v-if="!isVerify">
+          <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>优惠金额</span></el-col>
+          <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
+            <el-text type="danger">{{ info?.T_discount! }}¥</el-text>
+          </el-col>
+        </el-row>
+        <el-row v-if="!isVerify">
+          <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>签订时间</span></el-col>
+          <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
+            <span>{{ info?.T_date! }}</span></el-col
+          >
+        </el-row>
+        <el-row v-if="!isVerify">
+          <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>起始时间</span></el-col>
+          <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
+            <span>{{ info?.T_start_date! }}</span></el-col
+          >
+        </el-row>
+        <el-row v-if="!isVerify">
+          <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>终止时间</span></el-col>
+          <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
+            <span>{{ info?.T_end_date! }}</span></el-col
+          >
+        </el-row>
 
         <el-row>
           <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>项目</span></el-col>
           <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
-            <span>{{ info?.T_money }}</span>
+            <span>{{ info?.T_project }}</span>
           </el-col>
         </el-row>
 
-        <el-row>
+        <el-row v-if="isVerify">
           <!-- 1-未出库 2-已部分出库 3-已全部出库 -->
           <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>出库状态</span></el-col>
           <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
@@ -218,8 +273,10 @@ onUnmounted(() => {
           >
         </el-row>
 
-        <el-row>
-          <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>经办人</span></el-col>
+        <el-row v-if="isVerify">
+          <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"
+            ><span v-if="isVerify">经办人</span><span v-else>合同负责人</span></el-col
+          >
           <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
             ><span>{{ info?.T_submit_name! }}</span></el-col
           >
@@ -255,7 +312,7 @@ onUnmounted(() => {
           </el-col>
         </el-row>
 
-        <el-row>
+        <el-row v-if="isVerify">
           <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>未回款金额</span></el-col>
           <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
             <el-text type="danger">{{ info?.T_no_recoveries_money! }}¥</el-text>
@@ -270,7 +327,7 @@ onUnmounted(() => {
             </el-table>
           </el-col>
         </el-row>
-        <el-row>
+        <el-row v-if="isVerify">
           <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>未开票金额</span></el-col>
           <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"
             ><el-text type="danger">{{ info?.T_no_invoice_money! }}¥</el-text></el-col

+ 3 - 12
src/views/storehouse/sales/ContractSale.vue

@@ -3,7 +3,6 @@ import { GlobalStore } from '@/stores/index'
 import { ref, reactive, nextTick } from 'vue'
 import ContractForm from './ContractForm.vue'
 import { useRouter } from 'vue-router'
-import { fnMd5 } from '@/utils/common'
 import { ElMessageBox, ElMessage } from 'element-plus'
 import TableBase from '@/components/TableBase/index.vue'
 import { Edit, Delete, View } from '@element-plus/icons-vue'
@@ -24,13 +23,10 @@ const columns: ColumnProps[] = [
   { prop: 'operation', label: '操作', width: 260, fixed: 'right' }
 ]
 
-const openContractFormDrawer = (type: string, row?: any) => ContractFormRef.value?.openDrawer(type, row)
+const searchHandle = () => TableRef.value?.searchTable()
 const updateOnTableList = () => TableRef.value?.getTableList()
-// 审核
-const processContract = (id: string) => {
-  router.push({ name: 'ContractDetail', params: { id, type: fnMd5('contractSale') } })
-}
-// 删除
+const openContractFormDrawer = (type: string, row?: any) => ContractFormRef.value?.openDrawer(type, row)
+const processContract = (id: string) => router.push({ name: 'ContractDetail', params: { id } })
 const UserDelete = (row: any) => {
   ElMessageBox.confirm('您确定要删除该销售合同吗?', '警告', {
     confirmButtonText: '确定',
@@ -50,8 +46,6 @@ const UserDelete = (row: any) => {
       ElMessage.warning('取消成功!')
     })
 }
-
-// 搜索
 const options = reactive([
   { name: '已通过', id: 1 },
   { name: '未通过', id: 2 },
@@ -62,9 +56,6 @@ const initParam = reactive({
   T_name: '',
   T_state: ''
 })
-const searchHandle = () => {
-  TableRef.value?.searchTable()
-}
 </script>
 
 <template>

+ 32 - 22
src/views/storehouse/sales/VerifyContractDetail.vue

@@ -1,13 +1,13 @@
 <script setup lang="ts">
-import { GlobalStore } from '@/stores/index'
-import { ref, reactive, onMounted } from 'vue'
 import VerifyForm from './VerifyForm.vue'
+import { GlobalStore } from '@/stores/index'
 import { useRouter, useRoute } from 'vue-router'
-
+import { ElMessageBox, ElMessage } from 'element-plus'
+import { ref, reactive, onMounted, nextTick } from 'vue'
 import TableBase from '@/components/TableBase/index.vue'
 import { Edit, Delete, View } from '@element-plus/icons-vue'
 import type { ColumnProps } from '@/components/TableBase/interface/index'
-import { Storehouse_VerifyContract_List } from '@/api/storehouse/index'
+import { Storehouse_VerifyContract_List, Storehouse_VerifyContract_Del } from '@/api/storehouse/index'
 
 const customer_id = ref('')
 const route = useRoute()
@@ -20,7 +20,7 @@ const columns: ColumnProps[] = [
   { type: 'index', label: '序号', width: 80 },
   { prop: 'T_number', label: '合同编号' },
   { prop: 'T_date', label: '签订时间' },
-  { prop: 'T_money', label: '金额' },
+  { prop: 'T_discount', label: '金额' },
   { prop: 'T_start_date', label: '起始时间' },
   { prop: 'T_end_date', label: '终止时间' },
   { prop: 'T_verify_state', label: '是否过期', name: 'T_verify_state' },
@@ -32,12 +32,32 @@ const initParam = reactive({
 })
 const openContract = (type: string, row?: any) => VerifyFormRef.value?.openDrawer(type, row)
 const updateOnTableList = () => TableRef.value?.getTableList()
-const processContract = (id: string) => router.push({ name: 'VerifyContractDetail', params: { id } })
+const verifyDetail = (id: string) => router.push({ name: 'ContractDetail', params: { id, verify: 'verify' } })
+const verifyDelete = (number: number) => {
+  ElMessageBox.confirm('您确定要删除该合同明细吗?', '警告', {
+    confirmButtonText: '确定',
+    cancelButtonText: '取消',
+    type: 'warning'
+  })
+    .then(async () => {
+      const res: any = await Storehouse_VerifyContract_Del({
+        User_tokey: globalStore.GET_User_tokey,
+        T_number: number
+      })
+      if (res.Code === 200) {
+        ElMessage.success('删除成功!')
+        nextTick(() => {
+          TableRef.value?.getTableList()
+        })
+      }
+    })
+    .catch(() => {
+      ElMessage.warning('取消成功!')
+    })
+}
 onMounted(() => {
   const { params } = route
   customer_id.value = params.id as string
-  // initParam.T_customer_id = customer_id.value
-  console.log(initParam)
 })
 </script>
 
@@ -47,7 +67,7 @@ onMounted(() => {
       <template #table-header>
         <el-row :gutter="20" style="margin-bottom: 0" class="input-suffix">
           <el-col :xl="6" :md="8">
-            <h3 class="inline-flex">合同明细</h3>
+            <h3>合同明细</h3>
           </el-col>
           <el-col :xl="6" :md="4" :offset="12" class="btn"
             ><el-button type="primary" @click="openContract('new')">添加</el-button>
@@ -58,17 +78,13 @@ onMounted(() => {
       <template #T_verify_state="{ row }">
         <el-tag v-if="row.T_verify_state === 1" type="warning" effect="dark"> 未签约 </el-tag>
         <el-tag v-else-if="row.T_verify_state === 2" type="info" effect="dark"> 已作废 </el-tag>
-        <el-tag v-else-if="row.T_verify_state === 3" type="danger" effect="dark"> 已签约 </el-tag>
+        <el-tag v-else-if="row.T_verify_state === 3" type="success" effect="dark"> 已签约 </el-tag>
         <el-tag v-else type="danger" effect="dark"> 即将到期 </el-tag>
       </template>
       <template #right="{ row }">
         <el-button link type="primary" size="small" :icon="Edit" @click="openContract('edit', row)">编辑</el-button>
-        <el-button link type="success" size="small" :icon="View" @click="processContract(row.T_customer_id)"
-          >明细</el-button
-        >
-        <el-button link type="danger" size="small" :icon="Delete" @click="processContract(row.T_customer_id)"
-          >删除</el-button
-        >
+        <el-button link type="success" size="small" :icon="View" @click="verifyDetail(row.T_number)">详情</el-button>
+        <el-button link type="danger" size="small" :icon="Delete" @click="verifyDelete(row.T_number)">删除</el-button>
       </template>
     </TableBase>
     <VerifyForm ref="VerifyFormRef" @onTableList="updateOnTableList" :verify_customer_id="customer_id" />
@@ -86,16 +102,10 @@ onMounted(() => {
   }
   .input-suffix {
     width: 100%;
-    .inline-flex {
-      white-space: nowrap;
-    }
     .btn {
       display: flex;
       justify-content: end;
     }
-    .w-50 {
-      flex: 0 0 50%;
-    }
   }
 }
 </style>

+ 30 - 38
src/views/storehouse/sales/VerifyForm.vue

@@ -10,11 +10,11 @@ import {
 } from '@/hooks/useTablePublic'
 import {
   Storehouse_Contract_Get,
-  Storehouse_Contract_Add,
-  Storehouse_Contract_Edit,
+  Storehouse_VerifyContract_Add,
+  Storehouse_VerifyContract_Edit,
   Storehouse_Contract_Gen_Number
 } from '@/api/storehouse/index'
-
+import { validate_float } from '@/views/salary/salary/relus'
 import { ElMessage } from 'element-plus'
 import TableDetail from './TableDetail.vue'
 import { GlobalStore } from '@/stores/index'
@@ -55,13 +55,13 @@ const validate_T_product = (rule: any, value: any, callback: any) => {
 
 const rules = reactive<FormRules>({
   T_number: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
-  T_customer: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
-  T_type: [{ required: true, message: '请选择合同类型', trigger: 'blur' }],
   T_product: [{ validator: validate_T_product, trigger: 'blur' }],
-  T_money: [{ required: true, message: '请输入合同金额', trigger: 'blur' }],
+  T_discount: [{ required: true, validator: validate_float(), trigger: 'blur' }],
+  T_money: [{ required: true, validator: validate_float(), trigger: 'blur' }],
   T_date: [{ required: true, message: '请选择签订时间', trigger: 'blur' }],
-  T_submit: [{ required: true, message: '请选择合同负责人', trigger: 'change' }],
-  T_submit_name: [{ required: true, message: '请输入项目名称', trigger: 'blur' }]
+  T_start_date: [{ required: true, message: '请选择起始时间', trigger: 'blur' }],
+  T_end_date: [{ required: true, message: '请选择终止时间', trigger: 'blur' }],
+  T_submit: [{ required: true, message: '请选择合同负责人', trigger: 'change' }]
 })
 
 const callbackDrawer = (done: () => void) => {
@@ -72,15 +72,15 @@ const callbackDrawer = (done: () => void) => {
 // 父级方法
 const emit = defineEmits<{ (event: 'onTableList'): void }>()
 
-const form = reactive<ContractFormType>({
+const form = ref<ContractFormType>({
   T_uuid: '',
   T_number: '',
-  T_customer: '',
   T_product: '',
   T_money: '',
   T_discount: '',
   T_date: '',
   T_remark: '',
+  T_project: '',
   T_pdf: '',
   T_submit: '',
   T_recoveries: '',
@@ -101,21 +101,16 @@ const openDrawer = (type: string, row?: any) => {
 }
 // edit data echo
 const editDataEcho = async (row: any) => {
-  form.T_uuid = row.T_submit
-  form.T_pdf = row.T_pdf
-  form.T_date = row.T_date
-  form.T_money = row.T_money
-  form.T_submit = row.T_submit_name
-  form.T_number = row.T_number
-  form.T_customer = row.T_customer
-
+  form.value = { ...row }
   const res: any = await Storehouse_Contract_Get({
     User_tokey,
     T_number: row.T_number
   })
   if (res.Code === 200) {
-    const { T_Product, T_invoice, T_recoveries, T_remark } = res.Data
-    form.T_remark = T_remark
+    const { T_Product, T_invoice, T_recoveries, T_remark, T_submit_name, T_submit } = res.Data
+    form.value.T_remark = T_remark
+    form.value.T_submit = T_submit_name
+    form.value.T_uuid = T_submit
     T_Product &&
       (tableData.value = T_Product.map((item: any) => {
         item.Id = item.T_product_id
@@ -136,13 +131,12 @@ const editDataEcho = async (row: any) => {
 }
 
 const blurHandle = () => {
-  // form.T_product
-  form.T_product = []
+  form.value.T_product = []
   tableData.value = tableData.value.map(item => {
     if (!item.count) {
-      form.T_product.push(undefined)
+      form.value.T_product.push(undefined)
     } else {
-      form.T_product.push(`${item.Id},${item.count}|`)
+      form.value.T_product.push(`${item.Id},${item.count}|`)
       item.T_total = item.count * item.T_price
     }
     return item
@@ -154,7 +148,6 @@ const deleteProduct = (row: any) => {
   // 设置产品的选中
   drawerProductRef.value?.selectTableChange(row)
 }
-
 const getMontageStr = (arr: any[], value1: string, value2: string): string => {
   let str = ''
   arr.forEach(item => {
@@ -162,17 +155,16 @@ const getMontageStr = (arr: any[], value1: string, value2: string): string => {
   })
   return str
 }
-
 const getFomrParams = () => {
   const recoveriesData = RecoveriesRef.value?.getMoneyDeatil()
   const invoiceData = InvoiceRef.value?.getMoneyDeatil()
-  if (recoveriesData?.length) form.T_recoveries = getMontageStr(recoveriesData, 'T_date', 'T_money')
-  if (invoiceData?.length) form.T_invoice = getMontageStr(invoiceData, 'T_date', 'T_money')
+  if (recoveriesData?.length) form.value.T_recoveries = getMontageStr(recoveriesData, 'T_date', 'T_money')
+  if (invoiceData?.length) form.value.T_invoice = getMontageStr(invoiceData, 'T_date', 'T_money')
   const product = getMontageStr(tableData.value, 'Id', 'count')
   const params = {
-    ...form,
+    ...form.value,
     User_tokey,
-    T_submit: form.T_uuid,
+    T_submit: form.value.T_uuid,
     T_product: product
   }
   return params
@@ -185,9 +177,9 @@ const AddContract = (formEl: FormInstance | undefined) => {
       let res: any = {}
       const params = getFomrParams()
       if (isNew.value) {
-        res = await Storehouse_Contract_Add({ ...params, T_customer_id: props.verify_customer_id })
+        res = await Storehouse_VerifyContract_Add({  ...params, T_customer_id: props.verify_customer_id })
       } else {
-        res = await Storehouse_Contract_Edit({ ...params, T_customer_id: props.verify_customer_id })
+        res = await Storehouse_VerifyContract_Edit({ ...params, T_customer_id: props.verify_customer_id })
       }
       if (res.Code === 200) {
         ElMessage.success(`${isNew.value ? '添加' : '修改'}合同成功!!`)
@@ -237,7 +229,7 @@ const getContractNumber = async () => {
   })
   if (res.Code === 200) {
     contractNumberLoading.value = false
-    form.T_number = res.Data
+    form.value.T_number = res.Data
   }
 }
 
@@ -264,7 +256,7 @@ const getSummaries = (param: any) => {
         }
       }, 0)
       if (index === 8) {
-        form.T_money = sums[index]
+        form.value.T_money = sums[index]
       }
     } else {
       sums[index] = ''
@@ -279,8 +271,8 @@ const getSummaries = (param: any) => {
  */
 const selectApprover = () => receiveUserdialog.value?.openDrawer()
 const getReceiveInfo = ({ T_uuid, T_name }: { T_uuid: string; T_name: string }) => {
-  form.T_submit = T_name
-  form.T_uuid = T_uuid
+  form.value.T_submit = T_name
+  form.value.T_uuid = T_uuid
 }
 const closeCancle = () => {
   resetForm(ruleFormRef.value)
@@ -399,8 +391,8 @@ defineExpose({
         <el-form-item label="合同负责人:" :label-width="formLabelWidth" prop="T_submit">
           <el-input v-model="form.T_submit" placeholder="请选择合同负责人" class="w-50" @focus="selectApprover" />
         </el-form-item>
-        <el-form-item label="项目:" :label-width="formLabelWidth" prop="T_submit_name">
-          <el-input v-model="form.T_submit_name" placeholder="请输入项目名称" class="w-50" />
+        <el-form-item label="项目:" :label-width="formLabelWidth" prop="T_project">
+          <el-input v-model="form.T_project" placeholder="请输入项目名称" class="w-50" />
         </el-form-item>
         <el-form-item label="合同备注:" :label-width="formLabelWidth" prop="T_remark">
           <el-input