Browse Source

采购索赔

master
zhangli 1 year ago
parent
commit
00b5861d17
  1. 2
      src/components/BasicForm/src/BasicForm.vue
  2. 7
      src/store/modules/user.ts
  3. 81
      src/utils/disposition/tableColumns.ts
  4. 31
      src/views/wms/purchaseclaimRequestMain/index.vue

2
src/components/BasicForm/src/BasicForm.vue

@ -221,6 +221,8 @@ const searchTableSuccess = (formField,searchField, val) => {
/** 打开弹窗 */
const open = async (type: string, row?: any) => {
console.log(props.tableAllSchemas);
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type

7
src/store/modules/user.ts

@ -59,12 +59,7 @@ export const useUserStore = defineStore('admin-user', {
if (!userInfo) {
userInfo = await getInfo()
}
this.userSelfInfo = await getUserProfile()
// userInfo = await getInfo()
console.log(4);
console.log(this.userSelfInfo);
console.log(4);
this.userSelfInfo = await getUserProfile()
this.permissions = userInfo.permissions
this.roles = userInfo.roles
this.user = userInfo.user

81
src/utils/disposition/tableColumns.ts

@ -1,6 +1,8 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index.ts'
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
@ -12,8 +14,7 @@ const queryParams = {
code:'PurchaseClaimRequest'
}
const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsetting = data[0]
const requestsettingData =data?.list[0]||{}
/**
* @returns {Array}
@ -10680,7 +10681,10 @@ export const PurchaseclaimRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
isTable: true,
form:{
component:'Switch',
value:true,
value:requestsettingData.autoCommit,
componentProps:{
disabled:true,
}
}
},
{
@ -10689,7 +10693,14 @@ export const PurchaseclaimRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
isTable: true,
form:{
component:'Switch',
value:requestsettingData.autoAgree,
componentProps:{
disabled:true,
}
}
},
{
label: '自动执行',
@ -10697,7 +10708,14 @@ export const PurchaseclaimRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
isTable: true,
form:{
component:'Switch',
value:requestsettingData.autoExecute,
componentProps:{
disabled:true,
}
}
},
{
label: '跳过任务直接删生成记录',
@ -10705,7 +10723,14 @@ export const PurchaseclaimRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true
isTable: true,
form:{
component:'Switch',
componentProps:{
disabled:true,
value:requestsettingData.available,
}
}
}
]))
// 表单校验
@ -10809,6 +10834,7 @@ export const PurchaseclaimRequestDetail = useCrudSchemas(reactive<CrudSchema[]>(
{
label: '创建者',
field: 'creator',
isTableForm:false
},
{
label: '创建时间',
@ -10817,11 +10843,13 @@ export const PurchaseclaimRequestDetail = useCrudSchemas(reactive<CrudSchema[]>(
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
isTableForm:false
},
{
label: '最后更新者',
field: 'updater',
isTableForm:false
},
{
label: '最后更新时间',
@ -10830,9 +10858,46 @@ export const PurchaseclaimRequestDetail = useCrudSchemas(reactive<CrudSchema[]>(
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
isTableForm:false
},
]))
// 表单校验
export const PurchaseclaimRequestDetailRules = reactive({
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' }
],
altBatch: [
{ required: true, message: '请输入替代批次', trigger: 'blur' }
],
poNumber: [
{ required: true, message: '请输入订单号', trigger: 'change' }
],
poLine: [
{ required: true, message: '请输入订单行', trigger: 'change' }
],
singlePrice: [
{ required: true, message: '请输入单价', trigger: 'change' }
],
amount: [
{ required: true, message: '请输入金额', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'change' }
],
itemCode: [
{ required: true, message: '请输入物品代码', trigger: 'change' }
],
projectCode: [
{ required: true, message: '请输入项目代码', trigger: 'change' }
],
qty: [
{ required: true, message: '请输入数量', trigger: 'change' }
],
uom: [
{ required: true, message: '请输入计量单位', trigger: 'change' }
],
})
/**
* @returns {Array}

31
src/views/wms/purchaseclaimRequestMain/index.vue

@ -1,3 +1,4 @@
<!-- 采购索赔申请管理 -->
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
@ -31,16 +32,21 @@
@success="getList"
:rules="PurchaseclaimRequestMainRules"
:formAllSchemas="PurchaseclaimRequestMain.allSchemas"
:tableAllSchemas="PurchaseclaimRequestDetail.allSchemas"
:tableFormRules="PurchaseclaimRequestDetailRules"
:tableData="tableData"
:apiUpdate="PurchaseclaimRequestMainApi.updatePurchaseclaimRequestMain"
:apiCreate="PurchaseclaimRequestMainApi.createPurchaseclaimRequestMain"
:isBusiness="false"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import * as PurchaseclaimRequestMainApi from '@/api/wms/purchaseclaimRequestMain'
import { PurchaseclaimRequestMain, PurchaseclaimRequestMainRules } from '@/utils/disposition/tableColumns'
import { PurchaseclaimRequestMain, PurchaseclaimRequestMainRules, PurchaseclaimRequestDetail, PurchaseclaimRequestDetailRules } from '@/utils/disposition/tableColumns'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'PurchaseclaimRequestMain' })
@ -185,7 +191,26 @@ const handleExport = async () => {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
PurchaseclaimRequestDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
console.log(PurchaseclaimRequestDetail.allSchemas);
console.log(tableFormKeys);
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
console.log(tableData.value)
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
/** 初始化 **/
onMounted(() => {
getList()

Loading…
Cancel
Save