Browse Source

检测模板管理

master
zhang_li 12 months ago
parent
commit
945bd726e3
  1. 34
      src/components/BasicForm/src/BasicForm.vue
  2. 50
      src/components/Detail/src/TemplateDetails.vue
  3. 62
      src/views/Home/Index.vue
  4. 6
      src/views/board/Index.vue
  5. 63
      src/views/spc/detectiontemplate/index.vue

34
src/components/BasicForm/src/BasicForm.vue

@ -7,7 +7,22 @@
:schema="formSchema"
:is-col="true"
@opensearchTable="opensearchTable"
>
<template #type="formSchema" v-if="fromeWhere == 'detectionTemplateManagement'&&isDetail">
<el-select
v-model="formSchema.type"
placeholder="选择数据类型"
@change="typeSelectChange('type', $event)"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.DETECT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
</Form>
<div class="table" v-if="isBusiness && formType == 'create'">
<TableForm ref="tableFormRef"
class="w-[100%]"
@ -35,6 +50,7 @@ import { SearchTable } from '@/components/SearchTable';
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ButtonBase from '@/components/XButton/src/ButtonBase.vue'
import TableForm from '@/components/TableForm/src/TableForm.vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const props = defineProps({
// rules
@ -113,6 +129,18 @@ const props = defineProps({
required: false,
default: ''
},
// detectionTemplateManagement
fromeWhere: {
type: String,
required: false,
default: ''
},
//
isDetail: {
type: Boolean,
required: false,
default: false
},
})
const { t } = useI18n() //
@ -158,7 +186,6 @@ const searchTableSuccess = (formField,searchField, val, type, row) => {
}
/** 打开弹窗 */
const open = async (type: string, row?: any, masterParmas?: any) => {
dialogVisible.value = true
@ -268,6 +295,7 @@ const emit = defineEmits([
'searchTableSuccess',
'opensearchTable',
'submitForm',
'typeSelectChange'
])
//
const formSelectChange = (field, val) => {
@ -312,6 +340,10 @@ const inpuFocus = (headerItem, row, index) => {
headerItem.tableForm.searchCondition
)
}
//
const typeSelectChange = (field, val) => {
emit('typeSelectChange', field, val,formRef.value)
}
</script>
<style lang="scss" scoped>
.table {

50
src/components/Detail/src/TemplateDetails.vue

@ -70,6 +70,9 @@
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
:width="width"
:fromeWhere="fromeWhere"
:isDetail="true"
@typeSelectChange="typeSelectChange"
/>
</div>
</template>
@ -157,6 +160,12 @@ const props = defineProps({
required: false,
default: ''
},
// detectionTemplateManagement
fromeWhere: {
type: String,
required: false,
default: ''
}
})
const tableColumns = ref(TemplateItemDetails.allSchemas.tableColumns)
@ -280,20 +289,36 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const rowRef = ref()
const openForm = (type: string, row?: any) => {
if (type == 'update') {
console.log(row)
TemplateItemDetails.allSchemas.formSchema.forEach(item=>{
rowRef.value = row
TemplateItemDetails.allSchemas.formSchema.forEach((item) => {
if (item.component == 'UploadFile') {
if (row[item.field]) {
item.componentProps.modelValue = [{
item.componentProps.modelValue = [
{
name: row[item.field],
url:row[item.field],
}]
url: row[item.field]
}
]
} else {
item.componentProps.modelValue = []
}
}
})
if (row.type == 'NO_NUMBER') {
TemplateItemDetails.allSchemas.formSchema[5].componentProps.disabled = true
TemplateItemDetails.allSchemas.formSchema[6].componentProps.disabled = true
} else {
TemplateItemDetails.allSchemas.formSchema[5].componentProps.disabled= false
TemplateItemDetails.allSchemas.formSchema[6].componentProps.disabled= false
}
} else {
TemplateItemDetails.allSchemas.formSchema.forEach((item) => {
if (item.component == 'UploadFile') {
item.componentProps.modelValue = []
}
})
}
@ -362,6 +387,19 @@ const searchFormClick = (searchData) => {
}
getList() //
}
//
const emit = defineEmits(['typeSelectChange'])
//
const typeSelectChange = (field, val, formRef) => {
const setV = {}
setV['upLimit'] = 0
setV['downLimit'] = 0
// formRef.value.setValues(setV)
nextTick(() => {
formRef.setValues(setV)
})
emit('typeSelectChange', field, val, formRef)
}
/** 初始化 **/
onMounted(async () => {

62
src/views/Home/Index.vue

@ -46,17 +46,16 @@ import * as rescordAPI from '@/api/home/shouye'
defineOptions({ name: 'Home' })
const { t } = useI18n()
const tableData = ref([]);
const tableData1 = ref([]);
const echartsData = ref();
const tableData = ref([])
const tableData1 = ref([])
const echartsData = ref()
const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption
const getWeeklyUserActivity = async () => {
const xdata = echartsData.value.days.map(item=>item);
const data = echartsData.value.CHROMATIC_ABERRATION;
const data1 = echartsData.value.DIMENSION;//
const data2 = echartsData.value.GLOSS;//
const data3 = echartsData.value.PROPERTY;//
const xdata = echartsData.value.days.map((item) => item)
const data = echartsData.value.CHROMATIC_ABERRATION
const data1 = echartsData.value.DIMENSION //
const data2 = echartsData.value.GLOSS //
const data3 = echartsData.value.PROPERTY //
// const data = [
// { value: 13253, name: 'analysis.monday' },
// { value: 34235, name: 'analysis.tuesday' },
@ -97,15 +96,10 @@ const getWeeklyUserActivity = async () => {
text: '检测类型导入次数(近7天)',
left: 0,
textStyle: {
fontSize:14,
fontSize: 14
}
})
set(
barOptionsData,
'xAxis.data',
xdata
)
set(barOptionsData, 'xAxis.data', xdata)
set(barOptionsData, 'legend', {
data: ['色差', '尺寸', '光泽桔皮', '性能'],
top: 0,
@ -146,24 +140,19 @@ const getWeeklyUserActivity = async () => {
const lineOptionsData = reactive<EChartsOption>(lineOptions) as EChartsOption
const getWeeklyUserActivity1 = async () => {
const xdata = echartsData.value.days;
const data = echartsData.value.CHROMATIC_ABERRATION;//
const data1 = echartsData.value.DIMENSION;//
const data2 = echartsData.value.GLOSS;//
const data3 = echartsData.value.PROPERTY;//
const xdata = echartsData.value.days
const data = echartsData.value.CHROMATIC_ABERRATION //
const data1 = echartsData.value.DIMENSION //
const data2 = echartsData.value.GLOSS //
const data3 = echartsData.value.PROPERTY //
set(lineOptionsData, 'title', {
text: '检测类型导入次数(近7天)',
left: 0,
textStyle: {
fontSize:14,
fontSize: 14
}
})
set(
lineOptionsData,
'xAxis.data',
xdata
)
set(lineOptionsData, 'xAxis.data', xdata)
set(lineOptionsData, 'legend', {
data: ['色差', '尺寸', '光泽桔皮', '性能'],
top: 0,
@ -204,13 +193,20 @@ const getWeeklyUserActivity1 = async () => {
}
])
}
onMounted(async() => {//
tableData.value = await rescordAPI.getSYFrequency();
tableData1.value = await rescordAPI.getSYTime();
echartsData.value = await rescordAPI.getSYEchartsData();
const handleResize = () => {
window.location.reload()
}
onMounted(async () => {
//
tableData.value = await rescordAPI.getSYFrequency()
tableData1.value = await rescordAPI.getSYTime()
echartsData.value = await rescordAPI.getSYEchartsData()
await getWeeklyUserActivity()
await getWeeklyUserActivity1()
window.addEventListener('resize', handleResize)
})
onUnmounted(() => {
window.removeEventListener('resize', handleResize);
})
</script>
<style lang="scss" scoped>

6
src/views/board/Index.vue

@ -349,6 +349,9 @@ function getPreviousDate(numOfDays) {
var day = date.getDate()
return year + '年' + month + '月' + day+ '日'
}
const handleResize= () =>{
window.location.reload()
}
const date = ref()
onMounted(async () => {
date.value = getPreviousDate(7) + ' - ' + getPreviousDate(1)
@ -374,7 +377,9 @@ onMounted(async () => {
getNoStandardData()
}
}, 15000)
window.addEventListener('resize', handleResize);
})
onUnmounted(() => {
if (standardDataTime.value) {
clearInterval(standardDataTime.value)
@ -385,6 +390,7 @@ onUnmounted(() => {
if (lineTime.value) {
clearInterval(lineTime.value)
}
window.removeEventListener('resize', handleResize);
})
</script>
<style lang="scss" scoped>

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

@ -1,7 +1,11 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="DetectionTemplate.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="DetectionTemplate.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 allschemas管理列表标题-->
@ -64,9 +68,10 @@
:apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails"
:Echo="Echo"
width="60%"
fromeWhere="detectionTemplateManagement"
@searchTableSuccessDetail="searchTableSuccessDetail"
@typeSelectChange="typeSelectChange"
/>
</template>
<script setup lang="ts">
@ -110,7 +115,6 @@ const { tableObject, tableMethods } = useTable({
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
@ -118,7 +122,7 @@ const HeadButttondata = [
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -131,16 +135,22 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
@ -148,14 +158,16 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), //
defaultButtons.mainListDeleteBtn(null) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
@ -232,16 +244,16 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef,type,row)
const formsSuccess = async (formType, data) => {
var isHave = DetectionTemplate.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
return item.field === 'activeTime' || item.field === 'expireTime'
})
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
return
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
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'))
@ -314,11 +326,22 @@ const searchFormClick = (searchData) => {
}
getList() //
}
//
const typeSelectChange = (field, val,formRef) => {
if (field == 'type') {
console.log(formRef)
if (val == 'NO_NUMBER') {
TemplateItemDetails.allSchemas.formSchema[5].componentProps.disabled = true
TemplateItemDetails.allSchemas.formSchema[6].componentProps.disabled = true
} else {
TemplateItemDetails.allSchemas.formSchema[5].componentProps.disabled= false
TemplateItemDetails.allSchemas.formSchema[6].componentProps.disabled= false
}
}
}
/** 初始化 **/
onMounted(async () => {
getList()
//importTemplateData.templateUrl = await DetectionTemplateApi.importTemplate()
})
</script>

Loading…
Cancel
Save