Browse Source

更新

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

36
src/components/BasicForm/src/BasicForm.vue

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

36
src/components/Detail/src/TemplateDetails.vue

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

82
src/views/Home/Index.vue

@ -1,11 +1,11 @@
<template> <template>
<el-row :gutter="14" justify="space-between"> <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"> <el-card shadow="never">
<Echart :options="barOptionsData" :height="280" /> <Echart :options="barOptionsData" :height="280" />
</el-card> </el-card>
</el-col> </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"> <el-card shadow="never">
<Echart :options="lineOptionsData" :height="280" /> <Echart :options="lineOptionsData" :height="280" />
</el-card> </el-card>
@ -46,17 +46,16 @@ import * as rescordAPI from '@/api/home/shouye'
defineOptions({ name: 'Home' }) defineOptions({ name: 'Home' })
const { t } = useI18n() const { t } = useI18n()
const tableData = ref([]); const tableData = ref([])
const tableData1 = ref([]); const tableData1 = ref([])
const echartsData = ref(); const echartsData = ref()
const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption
const getWeeklyUserActivity = async () => { const getWeeklyUserActivity = async () => {
const xdata = echartsData.value.days.map((item) => item)
const xdata = echartsData.value.days.map(item=>item); const data = echartsData.value.CHROMATIC_ABERRATION
const data = echartsData.value.CHROMATIC_ABERRATION; const data1 = echartsData.value.DIMENSION //
const data1 = echartsData.value.DIMENSION;// const data2 = echartsData.value.GLOSS //
const data2 = echartsData.value.GLOSS;// const data3 = echartsData.value.PROPERTY //
const data3 = echartsData.value.PROPERTY;//
// const data = [ // const data = [
// { value: 13253, name: 'analysis.monday' }, // { value: 13253, name: 'analysis.monday' },
// { value: 34235, name: 'analysis.tuesday' }, // { value: 34235, name: 'analysis.tuesday' },
@ -96,16 +95,11 @@ const getWeeklyUserActivity = async () => {
set(barOptionsData, 'title', { set(barOptionsData, 'title', {
text: '检测类型导入次数(近7天)', text: '检测类型导入次数(近7天)',
left: 0, left: 0,
textStyle:{ textStyle: {
fontSize:14, fontSize: 14
} }
}) })
set( set(barOptionsData, 'xAxis.data', xdata)
barOptionsData,
'xAxis.data',
xdata
)
set(barOptionsData, 'legend', { set(barOptionsData, 'legend', {
data: ['色差', '尺寸', '光泽桔皮', '性能'], data: ['色差', '尺寸', '光泽桔皮', '性能'],
top: 0, top: 0,
@ -146,24 +140,19 @@ const getWeeklyUserActivity = async () => {
const lineOptionsData = reactive<EChartsOption>(lineOptions) as EChartsOption const lineOptionsData = reactive<EChartsOption>(lineOptions) as EChartsOption
const getWeeklyUserActivity1 = async () => { const getWeeklyUserActivity1 = async () => {
const xdata = echartsData.value.days
const xdata = echartsData.value.days; const data = echartsData.value.CHROMATIC_ABERRATION //
const data = echartsData.value.CHROMATIC_ABERRATION;// const data1 = echartsData.value.DIMENSION //
const data1 = echartsData.value.DIMENSION;// const data2 = echartsData.value.GLOSS //
const data2 = echartsData.value.GLOSS;// const data3 = echartsData.value.PROPERTY //
const data3 = echartsData.value.PROPERTY;//
set(lineOptionsData, 'title', { set(lineOptionsData, 'title', {
text: '检测类型导入次数(近7天)', text: '检测类型导入次数(近7天)',
left: 0, left: 0,
textStyle:{ textStyle: {
fontSize:14, fontSize: 14
} }
}) })
set( set(lineOptionsData, 'xAxis.data', xdata)
lineOptionsData,
'xAxis.data',
xdata
)
set(lineOptionsData, 'legend', { set(lineOptionsData, 'legend', {
data: ['色差', '尺寸', '光泽桔皮', '性能'], data: ['色差', '尺寸', '光泽桔皮', '性能'],
top: 0, top: 0,
@ -172,7 +161,7 @@ const getWeeklyUserActivity1 = async () => {
set(lineOptionsData, 'series', [ set(lineOptionsData, 'series', [
{ {
name: '色差', name: '色差',
data:data, data: data,
smooth: true, smooth: true,
type: 'line', type: 'line',
animationDuration: 2000, animationDuration: 2000,
@ -180,7 +169,7 @@ const getWeeklyUserActivity1 = async () => {
}, },
{ {
name: '尺寸', name: '尺寸',
data:data1, data: data1,
smooth: true, smooth: true,
type: 'line', type: 'line',
animationDuration: 2000, animationDuration: 2000,
@ -188,7 +177,7 @@ const getWeeklyUserActivity1 = async () => {
}, },
{ {
name: '光泽桔皮', name: '光泽桔皮',
data:data2, data: data2,
smooth: true, smooth: true,
type: 'line', type: 'line',
animationDuration: 2000, animationDuration: 2000,
@ -196,7 +185,7 @@ const getWeeklyUserActivity1 = async () => {
}, },
{ {
name: '性能', name: '性能',
data:data3, data: data3,
smooth: true, smooth: true,
type: 'line', type: 'line',
animationDuration: 2000, animationDuration: 2000,
@ -204,20 +193,27 @@ const getWeeklyUserActivity1 = async () => {
} }
]) ])
} }
onMounted(async() => {// const handleResize = () => {
tableData.value = await rescordAPI.getSYFrequency(); window.location.reload()
tableData1.value = await rescordAPI.getSYTime(); }
echartsData.value = await rescordAPI.getSYEchartsData(); onMounted(async () => {
//
tableData.value = await rescordAPI.getSYFrequency()
tableData1.value = await rescordAPI.getSYTime()
echartsData.value = await rescordAPI.getSYEchartsData()
await getWeeklyUserActivity() await getWeeklyUserActivity()
await getWeeklyUserActivity1() await getWeeklyUserActivity1()
window.addEventListener('resize', handleResize)
})
onUnmounted(() => {
window.removeEventListener('resize', handleResize);
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title{ .title {
position: relative; position: relative;
padding-left: 16px; padding-left: 16px;
&::after{ &::after {
content: ''; content: '';
position: absolute; position: absolute;
left: 0px; left: 0px;

6
src/views/board/Index.vue

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

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

@ -1,18 +1,22 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="DetectionTemplate.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="DetectionTemplate.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 allschemas管理列表标题--> <!-- 列表头部 allschemas管理列表标题-->
<TableHead <TableHead
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="DetectionTemplate.allSchemas" :allSchemas="DetectionTemplate.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #itemCode="{row}"> <template #itemCode="{ row }">
<el-button type="primary" link @click="openDetail(row, '模版项管理', row.code)"> <el-button type="primary" link @click="openDetail(row, '模版项管理', row.code)">
<span>{{ row.itemCode }}</span> <span>{{ row.itemCode }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -63,16 +67,17 @@
:apiPage="TemplateItemDetailsApi.getTemplateItemDetailsPage" :apiPage="TemplateItemDetailsApi.getTemplateItemDetailsPage"
:apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails" :apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails"
:Echo="Echo" :Echo="Echo"
width="60%" width="60%"
fromeWhere="detectionTemplateManagement"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
@typeSelectChange="typeSelectChange"
/> />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { DetectionTemplate,rules } from './detectionTemplate.data' import { DetectionTemplate, rules } from './detectionTemplate.data'
import { TemplateItemDetails,TemplateItemDetailsRules} from './templateItemDetails.data' import { TemplateItemDetails, TemplateItemDetailsRules } from './templateItemDetails.data'
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails' import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails'
import * as DetectionTemplateApi from '@/api/spc/detectionTemplate' import * as DetectionTemplateApi from '@/api/spc/detectionTemplate'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -95,12 +100,12 @@ const updataTableColumns = (val) => {
// //
const searchTableParams = ref([ const searchTableParams = ref([
//{ //{
// formField: 'productItemCode', // formField: 'productItemCode',
// searchTableTitle: '', // searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas, // searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage // searchTablePage: ItembasicApi.getItembasicPage
//} //}
]) ])
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
@ -108,8 +113,7 @@ const { tableObject, tableMethods } = useTable({
}) })
// //
const {getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
@ -118,7 +122,7 @@ const HeadButttondata = [
// defaultButtons.defaultExportBtn(null), // // defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), // // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -131,16 +135,22 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
@ -148,14 +158,16 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn(null), // defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), // defaultButtons.mainListDeleteBtn(null) //
] ]
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) 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(() => { // nextTick(() => {
// const setV = {} // const setV = {}
// setV[formField] = val[0][searchField] // 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(() => { // nextTick(() => {
// const setV = {} // const setV = {}
// setV[formField] = val[0][searchField] // setV[formField] = val[0][searchField]
@ -231,27 +243,27 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef,type,row)
}) })
} }
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =DetectionTemplate.allSchemas.formSchema.some(function (item) { 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 (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null
if (formType === 'create') { if (formType === 'create') {
await DetectionTemplateApi.createDetectionTemplate(data) await DetectionTemplateApi.createDetectionTemplate(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await DetectionTemplateApi.updateDetectionTemplate(data) await DetectionTemplateApi.updateDetectionTemplate(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
getList() getList()
} }
/** 详情操作 */ /** 详情操作 */
@ -315,11 +327,22 @@ const searchFormClick = (searchData) => {
} }
getList() // 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 () => { onMounted(async () => {
getList() getList()
//importTemplateData.templateUrl = await DetectionTemplateApi.importTemplate() //importTemplateData.templateUrl = await DetectionTemplateApi.importTemplate()
}) })
</script> </script>

Loading…
Cancel
Save