Browse Source

更新

master
songguoqiang 12 months ago
parent
commit
446b357e27
  1. 36
      src/components/BasicForm/src/BasicForm.vue
  2. 38
      src/components/Detail/src/TemplateDetails.vue
  3. 82
      src/views/Home/Index.vue
  4. 6
      src/views/board/Index.vue
  5. 143
      src/views/spc/detectiontemplate/index.vue

36
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 {

38
src/components/Detail/src/TemplateDetails.vue

@ -70,6 +70,9 @@
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
:width="width"
:fromeWhere="fromeWhere"
:isDetail="true"
@typeSelectChange="typeSelectChange"
/>
</div>
</template>
@ -152,16 +155,22 @@ const props = defineProps({
required: false,
default: null
},
width:{
width: {
type: String,
required: false,
default: ''
},
// detectionTemplateManagement
fromeWhere: {
type: String,
required: false,
default: ''
}
})
const tableColumns = ref(TemplateItemDetails.allSchemas.tableColumns)
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
console.log('tableColumns',tableColumns.value)
console.log('tableColumns', tableColumns.value)
if (row) {
isShowDrawer.value = true
templateId.value = row.id
@ -280,15 +289,11 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const rowRef = ref()
const openForm = (type: string, row?: any) => {
if(type=='update'){
if(type=='update'){
TemplateItemDetails.allSchemas.formSchema[3].componentProps.disabled=true;
}else{
TemplateItemDetails.allSchemas.formSchema[3].componentProps.disabled=false;
}
console.log(row)
TemplateItemDetails.allSchemas.formSchema.forEach(item=>{
if(item.component == 'UploadFile'){
if(row[item.field]){
@ -303,7 +308,7 @@ const openForm = (type: string, row?: any) => {
}
})
}
basicFormRef.value.open(type, row)
}
@ -368,6 +373,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 () => {

82
src/views/Home/Index.vue

@ -1,11 +1,11 @@
<template>
<el-row :gutter="14" justify="space-between">
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24" class="mb-14px">
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24" class="mb-14px">
<el-card shadow="never">
<Echart :options="barOptionsData" :height="280" />
</el-card>
</el-col>
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24" class="mb-14px">
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24" class="mb-14px">
<el-card shadow="never">
<Echart :options="lineOptionsData" :height="280" />
</el-card>
@ -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' },
@ -96,16 +95,11 @@ const getWeeklyUserActivity = async () => {
set(barOptionsData, 'title', {
text: '检测类型导入次数(近7天)',
left: 0,
textStyle:{
fontSize:14,
textStyle: {
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,
textStyle: {
fontSize: 14
}
})
set(
lineOptionsData,
'xAxis.data',
xdata
)
set(lineOptionsData, 'xAxis.data', xdata)
set(lineOptionsData, 'legend', {
data: ['色差', '尺寸', '光泽桔皮', '性能'],
top: 0,
@ -172,7 +161,7 @@ const getWeeklyUserActivity1 = async () => {
set(lineOptionsData, 'series', [
{
name: '色差',
data:data,
data: data,
smooth: true,
type: 'line',
animationDuration: 2000,
@ -180,7 +169,7 @@ const getWeeklyUserActivity1 = async () => {
},
{
name: '尺寸',
data:data1,
data: data1,
smooth: true,
type: 'line',
animationDuration: 2000,
@ -188,7 +177,7 @@ const getWeeklyUserActivity1 = async () => {
},
{
name: '光泽桔皮',
data:data2,
data: data2,
smooth: true,
type: 'line',
animationDuration: 2000,
@ -196,7 +185,7 @@ const getWeeklyUserActivity1 = async () => {
},
{
name: '性能',
data:data3,
data: data3,
smooth: true,
type: 'line',
animationDuration: 2000,
@ -204,20 +193,27 @@ 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>
.title{
.title {
position: relative;
padding-left: 16px;
&::after{
&::after {
content: '';
position: absolute;
left: 0px;

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>

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

@ -1,18 +1,22 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="DetectionTemplate.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="DetectionTemplate.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 allschemas管理列表标题-->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DetectionTemplate.allSchemas"
/>
<!-- 列表头部 allschemas管理列表标题-->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DetectionTemplate.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #itemCode="{row}">
<template #itemCode="{ row }">
<el-button type="primary" link @click="openDetail(row, '模版项管理', row.code)">
<span>{{ row.itemCode }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
@ -42,7 +46,7 @@
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="rules"
:rules="rules"
:formAllSchemas="DetectionTemplate.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="DetectionTemplateApi.updateDetectionTemplate"
@ -63,16 +67,17 @@
:apiPage="TemplateItemDetailsApi.getTemplateItemDetailsPage"
:apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails"
:Echo="Echo"
width="60%"
width="60%"
fromeWhere="detectionTemplateManagement"
@searchTableSuccessDetail="searchTableSuccessDetail"
@typeSelectChange="typeSelectChange"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { DetectionTemplate,rules } from './detectionTemplate.data'
import { TemplateItemDetails,TemplateItemDetailsRules} from './templateItemDetails.data'
import { DetectionTemplate, rules } from './detectionTemplate.data'
import { TemplateItemDetails, TemplateItemDetailsRules } from './templateItemDetails.data'
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails'
import * as DetectionTemplateApi from '@/api/spc/detectionTemplate'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -95,12 +100,12 @@ const updataTableColumns = (val) => {
//
const searchTableParams = ref([
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
])
const { tableObject, tableMethods } = useTable({
@ -108,8 +113,7 @@ const { tableObject, tableMethods } = useTable({
})
//
const {getList, setSearchParams } = tableMethods
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
@ -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)
}
}
@ -167,7 +179,7 @@ const openForm = (type: string, row?: any) => {
}
//
const searchTableSuccess = (formField, searchField, val, formRef,type,row) => {
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
// nextTick(() => {
// const setV = {}
// setV[formField] = val[0][searchField]
@ -200,7 +212,7 @@ const searchTableSuccess = (formField, searchField, val, formRef,type,row) => {
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef,type,row) => {
const searchTableSuccessDetail = (formField, searchField, val, formRef, type, row) => {
// nextTick(() => {
// const setV = {}
// setV[formField] = val[0][searchField]
@ -231,27 +243,27 @@ 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';
});
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 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()
}
/** 详情操作 */
@ -315,11 +327,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