Browse Source

模版管理

master
songguoqiang 1 year ago
parent
commit
306dc69b6e
  1. 8
      .env.test
  2. 102
      src/views/spc/detectiontemplate/detectionTemplate.data.ts
  3. 60
      src/views/spc/detectiontemplate/index.vue
  4. 4
      src/views/spc/itembasic/itembasic.data.ts

8
.env.test

@ -4,10 +4,10 @@ NODE_ENV=test
VITE_DEV=false
# 请求路径
VITE_BASE_URL='http://dev.ccwin-in.com:26100/api'
VITE_BASE_URL='http://192.168.20.252:26100/api'
# 上传路径
VITE_UPLOAD_URL='http://dev.ccwin-in.com:26100/api/admin-api/infra/file/upload'
VITE_UPLOAD_URL='http://192.168.20.252:26100/api/admin-api/infra/file/upload'
# 接口前缀
VITE_API_BASEPATH=
@ -31,7 +31,7 @@ VITE_BASE_PATH=/
VITE_OUT_DIR=dist-test
# 自定义接口路径
VITE_INTERFACE_URL='http://dev.ccwin-in.com:26101/magic/web/index.html'
VITE_INTERFACE_URL='http://192.168.20.252:26101/magic/web/index.html'
# 积木报表请求路径
VITE_JMREPORT_BASE_URL='http://dev.ccwin-in.com:26101'
VITE_JMREPORT_BASE_URL='http://192.168.20.252:26101'

102
src/views/spc/detectiontemplate/detectionTemplate.data.ts

@ -1,5 +1,7 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ItembasicApi from '@/api/spc/itembasic/index'
import {Itembasic} from '@/views/spc/itembasic/itembasic.data'
// 表单校验
export const DetectionTemplateRules = reactive({
@ -8,35 +10,59 @@ export const DetectionTemplateRules = reactive({
export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料code',
field: 'itemCode',
label: '物料编码',
field: 'itemCode',//传第给后端字段名称
sort: 'custom',
table: {
width: 150,
fixed: 'left'
},
isSearch: true,
isTable:true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料编码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
}
}
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
isSearch: true,
isTable:true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled:true
}
}
},
{
label: '项目名称',
field: 'projectName',
sort: 'custom',
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled:true
}
}
},
{
label: '模版名称',
field: 'name',
sort: 'custom',
isSearch: true
},
// {
// label: '描述',
// field: 'desc',
// sort: 'custom',
// isSearch: false
// },
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// isSearch: false,
// },
// {
// label: '版本号',
// field: 'version',
// sort: 'custom',
// isSearch: true
// },
{
label: '备注',
field: 'remark',
@ -92,24 +118,6 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
isTable:false,
isForm:false
},
// {
// label: '扩展属性',
// field: 'extraProperties',
// sort: 'custom',
// isSearch: true
// },
// {
// label: '并发乐观锁',
// field: 'concurrencyStamp',
// sort: 'custom',
// isSearch: true
// },
// {
// label: '地点ID',
// field: 'siteId',
// sort: 'custom',
// isSearch: true
// },
{
label: '物料类型',
field: 'itemType',
@ -138,3 +146,19 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
}
}
]))
// 表单校验
export const rules = reactive({
itemCode: [
{ required: true, message: '请选择物料编码', trigger: 'blur' }
],
itemName: [
{ required: true, message: '请输入物料名称', trigger: 'blur' }
],
projectName: [
{ required: true, message: '请输入项目名称', trigger: 'blur' }
],
itemType: [
{ required: true, message: '请选择物料类型', trigger: 'change' }
],
})

60
src/views/spc/detectiontemplate/index.vue

@ -41,8 +41,8 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
:rules="DetectionTemplateRules"
@success="formsSuccess"
:rules="rules"
:formAllSchemas="DetectionTemplate.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="DetectionTemplateApi.updateDetectionTemplate"
@ -60,7 +60,7 @@
<script setup lang="ts">
import download from '@/utils/download'
import { DetectionTemplate,DetectionTemplateRules } from './detectionTemplate.data'
import { DetectionTemplate,DetectionTemplateRules,rules } from './detectionTemplate.data'
import * as DetectionTemplateApi from '@/api/spc/detectionTemplate'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
@ -156,14 +156,60 @@ const openForm = (type: string, row?: any) => {
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
const searchTableSuccess = (formField, searchField, val, formRef,type,row) => {
// nextTick(() => {
// const setV = {}
// setV[formField] = val[0][searchField]
// formRef.setValues(setV)
// })
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
row['poLine'] = val[0]['poLine']
row['batch'] = val[0]['toBatch']
row['altBatch'] = val[0]['altBatch']
row['itemCode'] = val[0]['itemCode']
row['itemName'] = val[0]['itemName']
row['itemDesc1'] = val[0]['itemDesc1']
row['itemDesc2'] = val[0]['itemDesc2']
row['projectCode'] = val[0]['projectCode']
row['qty'] = val[0]['qty']
row['uom'] = val[0]['uom']
} else {
//
const setV = {}
setV[formField] = val[0][searchField]
setV['itemName'] = val[0]['name']
setV['projectName'] = val[0]['projectName']
formRef.setValues(setV)
}
})
}
const formsSuccess = async (formType,data) => {
var isHave =DetectionTemplate.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await DetectionTemplateApi.createDetectionTemplate(data)
message.success(t('common.createSuccess'))
} else {
await DetectionTemplateApi.updateDetectionTemplate(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const openDetail = () => {
router.push({ path: '/spc/templateitemdetails' })

4
src/views/spc/itembasic/itembasic.data.ts

@ -124,10 +124,10 @@ export const Itembasic = useCrudSchemas(reactive<CrudSchema[]>([
// 表单校验
export const rules = reactive({
code: [
{ required: true, message: '请输入物料', trigger: 'blur' }
{ required: true, message: '请输入物料编码', trigger: 'blur' }
],
name: [
{ required: true, message: '请输入物料', trigger: 'blur' }
{ required: true, message: '请输入物料名称', trigger: 'blur' }
],
projcetCode: [

Loading…
Cancel
Save