Browse Source

【edi前端】页面更改+缺陷+组件暂存

web
安虹睿 3 weeks ago
parent
commit
8f541f4305
  1. 4
      Web/src/components/apiEditPop/index.vue
  2. 998
      Web/src/components/ediTtablePage/index_oldExport.vue
  3. 689
      Web/src/components/tablePage/index_oldExport.vue
  4. 95
      Web/src/utils/common/apiTableColumns.js
  5. 37
      Web/src/views/dashboard/index.vue
  6. 72
      Web/src/views/dashboard/menuItem.vue
  7. 6
      Web/src/views/system/org/components/editDialog.vue
  8. 7
      Web/src/views/system/org/index.vue
  9. 2
      Web/src/views/system/role/components/editDialog.vue
  10. 5
      Web/src/views/system/role/index.vue
  11. 9
      Web/src/views/system/user/index.vue

4
Web/src/components/apiEditPop/index.vue

@ -47,8 +47,8 @@
v-model="formData[getItemConfig(item,'prop')]"
style="width:100%"
type="datetime"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
:format="item.format || 'YYYY-MM-DD HH:mm:ss'"
:value-format="item.valueFormat || 'YYYY-MM-DD HH:mm:ss'"
:clearable="!getItemConfig(item,'noClear')"
:disabled="getItemConfig(item,'disabled')"
/>

998
Web/src/components/ediTtablePage/index_oldExport.vue

@ -0,0 +1,998 @@
<template>
<div class="app-container" v-loading="state.loading">
<!-- 查询头部 -->
<el-card class="search-container" v-if="!(props.hideSearch && props.hideSetColums)">
<el-form :inline="true" v-if="!props.hideSearch">
<el-form-item
v-auth="props.apiName + state.searchBtnOptions['search'].auth"
v-for="(item,index) in props.searchOptions"
:key="index"
:label="item.label">
<!-- 文本 -->
<el-input
v-if="item.type == 'input'"
v-model="props.searchFilter[item.prop]"
:placeholder="item.label"
:clearable="!item.noClear"
/>
<!-- 数字 -->
<el-input-number
v-if="item.type == 'number'"
v-model="props.searchFilter[item.prop]"
:min="item.min"
:max="item.max"
/>
<!-- 时间区域 -->
<el-date-picker
v-if="item.type == 'datetimerange'"
v-model="props.searchFilter[item.prop]"
type="datetimerange"
start-placeholder="起始时间"
end-placeholder="结束时间"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
style="width:370px"
/>
<!-- 选择框 -->
<el-select
v-if="item.type == 'select'"
v-model="props.searchFilter[item.prop]"
:filterable="!item.noSearch"
placeholder="请选择"
style="width: 240px"
:clearable="!item.noClear"
>
<el-option
v-for="(op,op_index) in item.options"
:key="op_index"
:label="op.label"
:value="op.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<div style="margin-right:10px" v-for="(btn,btn_key) in props.searchButtons" :key="btn_key">
<!-- 导出 -->
<!-- <el-dropdown
v-auth="(props.authName || props.apiName) + state.searchBtnOptions[btn].auth"
:hide-on-click="false"
v-if="state.searchBtnOptions[btn].auth == ':export'"
>
<el-button
:icon="state.searchBtnOptions[btn].icon"
:type="state.searchBtnOptions[btn].type">
{{state.searchBtnOptions[btn].label}}
<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="exportHandle()">按条件导出当前页</el-dropdown-item>
<el-dropdown-item divided @click="exportHandle(true)">按条件导出全部</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown> -->
<!-- 其他按钮 -->
<el-button
:icon="state.searchBtnOptions[btn].icon"
v-auth="(props.authName || props.apiName) + state.searchBtnOptions[btn].auth"
:type="state.searchBtnOptions[btn].type"
@click="searchBtnHandle(btn)"
>{{state.searchBtnOptions[btn].label}}</el-button>
</div>
</el-form-item>
</el-form>
<!-- 右侧按钮(保存页面) -->
<div>
<el-button
v-for="(btn,btn_key) in state.searchRightBtn"
:key="btn_key"
:icon="btn.icon"
v-auth="btn.sAuth || props.apiName + btn.auth"
:type="btn.type"
@click="searchRightBtnHandle(btn)"
style="margin-right: 10px"
>{{btn.label}}</el-button>
<!-- 字段设置 -->
<setColumsPop
style="margin-left: auto;"
:localTableColumnsName="state.localTableColumnsName"
:initTableColums="state.initTableColums"
:tableColumns="getTableColumns()"
v-if="!props.hideSetColums"
></setColumsPop>
</div>
</el-card>
<!-- 头部详情 -->
<el-card v-loading="state.detailLoading" class="headerInfo-container" v-if="!props.hideHeaderInfo">
<el-descriptions label-width="120" :title="`当前页【第${getIndexById()}行】数据信息`" :border="true" :column="5" v-if="state.headerInfoData && state.headerInfoData.length > 0">
<el-descriptions-item
v-for="(item,index) in state.headerInfoData"
:key="index"
:label="item.label">
{{item.value}}
</el-descriptions-item>
</el-descriptions>
<el-empty v-else description="暂无数据" class="headerInfoEmpty"/>
</el-card>
<!-- 列表 -->
<el-card class="paged-table-container">
<elTable
ref="table_Ref"
:columnWidth="props.columnWidth"
:columnHeaderAlign="props.columnHeaderAlign"
:columnAlign="props.columnAlign"
:tableData="state.tableData"
:tableColumns="getTableColumns()"
@sortChange="sortChange"
:leftOperation="props.leftOperation"
@leftOperationHadel="leftOperationHadel"
:rightOperation="getRightOperation()"
@rightOperationHadel="rightOperationHadel"
:multipleTable="props.multipleTable"
@tableSelectionHandle="tableSelectionHandle"
@editItemFocusHandle="(item,scope,event)=>{getItemDetail(item.type,scope.row,'focus')}"
@editItemChangeHandle="editItemChangeHandle"
@cell-click="(row,column,cell,event)=>{getItemDetail('cell',row,'cellClick')}"
@editItemClearHandle="(item,scope)=>{getItemDetail(item.type,scope.row,'clear')}"
:getEditItemDisabled="getEditItemDisabled"
:selectableDisabled="selectableDisabled"
:tableRowClassName="tableRowClassName"
:showTableIndex="props.showTableIndex"
></elTable>
<!-- :tableFormRules="state.tableFormRulesData" -->
<elPager
v-loading="state.pageLoading"
style="margin-top: 15px;float:right"
:pager="state.pager"
@size-change="pageSizeChange"
@current-change="pageCurrentChange"
></elPager>
</el-card>
<!-- 导入弹窗 -->
<importPop
ref="importPopRef"
:apiName="props.apiName"
@success="importSuccess"
/>
<!-- 编辑弹窗 -->
<apiEditPop
ref="apiEditPopRef"
:apiName="props.apiName"
@submitEditForm="submitEditForm"
:formRules="props.apiEditFormRules"
/>
</div>
</template>
<script setup>
defineOptions({ name: 'ediTtablePage' })
import store from '@/stores'
import apiTableColumns from '@/utils/common/apiTableColumns'
import { reactive, ref, onMounted,computed } from 'vue'
import {
getCommonPaged,
getCommonDeatailPaged,
postCommonExport,
postCommonCreate,
putCommonUpdate,
deleteCommonApi,
getCommonCustominvoke,
getCommonDetailById,
postCommonConfirmMany,
postCommonUpdateMany
} from '@/api/common/index'
import { ElMessageBox, ElMessage,ElTable, ElTableColumn } from 'element-plus'
import elTable from '@/components/elTable/index.vue'
import elPager from '@/components/elPager/index.vue'
import setColumsPop from '@/components/setColumsPop/index.vue'
import { getPageParamsForFilter,getLocalTableColumnsName } from '@/utils/common/index'
import { downloadByData } from '@/utils/download'
import importPop from '@/components/importPop/index.vue'
import apiEditPop from '@/components/apiEditPop/index.vue'
import { formatDate } from '@/utils/formatTime'
import apiServeNames from '@/utils/common/apiServeNames'
import { useRoute } from 'vue-router'
const route = useRoute()
const userStore = store.userStore()
const userInfo = userStore.state
const auths = store.permissionStore()
const state = reactive({
loading:false,
detailLoading:false,
pageLoading:false,
searchBtnOptions:{
search:{icon:'Search',auth:':page',label:'查询',type:null},
create:{icon:'Plus',auth:':create',label:'新增',type:'primary'},
import:{icon:'BottomRight',auth:':import',label:'导入',type:'warning'},
export:{icon:'TopRight',auth:':export',label:'导出',type:'success'},
custominvoke:{icon:'Position',auth:':custominvoke',label:'手动开关',type:'primary'},
outputMany:{icon:'Position',auth:':outputMany',label:'手动传出',type:'primary'},
},
searchRightBtn:[{name:'pageSave',icon:'Check',auth:':pageSave',label:'保存页面',type:'warning'}],
tableData:[],
// table
sortFilter:{
sortBy:undefined,
isAscending:undefined
},
pager:{
page: 1,
pageSize: 10,
total: 1,
},
tableSelectList:[],
leaveSaveTip:'此操作将重新渲染页面,检测有数据【未保存】,操作后将【清空未保存数据】,是否确定继续?',
//
headerInfoData:[],
currentDetailId:null,//id
//
stage_tableData:[],
//
stage_indexs:[],
//
initTableColums:[],
localTableColumnsName:null,
//tabel
tableFormRulesData:null,
})
const props = defineProps({
// api
apiName: {
type: String,
default: null
},
// colum
detailColumName:{
type: String,
default: null
},
// api detailApigetdetailpageApigetdatapaged
apiType: {
type: String,
default: null
},
//
hideSearch:{
type: Boolean,
default: false
},
//
multipleTable:{
type: Boolean,
default: false
},
//
showTableIndex:{
type: Boolean,
default: true
},
//
leftOperation:{
type: Object,
default: null
},
//
rightOperation:{
type: [Object,String],
default: null
},
// api
showApiRightOperation:{
type: Object,
default: null
},
// readState=true
// 使,=
apiRightHideConfig:{
type: Object,
default: {
apiUpdate:{prop:'readState',ruleValue:true},
apiDelete:{prop:'readState',ruleValue:true},
}
},
// table
tableColumns: {
type: Object,
default: null
},
//
searchOptions: {
type: Object,
default: []
},
//
searchButtons: {
type: Object,
default: ['search','export']
},
// tablefilter
searchFilter: {
type: Object,
default: {}
},
//
columnWidth:{
type: Number,
default: 120
},
//
columnHeaderAlign:{
type: String,
default: 'center'
},
//
columnAlign:{
type: String,
default: 'center'
},
//
apiEditFormRules:{
type: Object,
default: null
},
// table
tableFormRules:{
type: Object,
default: null
},
//
hideHeaderInfo:{
type: Boolean,
default: false
},
// /readState=true
// 使,=
editDisabledConfig:{
type: Object,
default: [
{prop:'readState',ruleValue:true},
// {prop:'releaseEdition',ruleValue:'2024121901'},
]
},
//
hideSetColums:{
type: Boolean,
default: false
}
})
// noFilter
function getTableColumns(noFilter){
if(noFilter){
return props.tableColumns || apiTableColumns[props.apiName]
}else{
state.localTableColumnsName = getLocalTableColumnsName(useRoute().name)
if(props.apiType == 'detailApi'){
state.localTableColumnsName = getLocalTableColumnsName(props.apiName+'Detail')
}
let _local = JSON.parse(localStorage.getItem(state.localTableColumnsName))
state.initTableColums = props.tableColumns || apiTableColumns[props.apiName]
let _list = _local && _local != null && _local != undefined ? _local : JSON.parse(JSON.stringify(state.initTableColums))
return _list
}
// return props.tableColumns || apiTableColumns[props.apiName]
}
const emits = defineEmits([
'leftOperationHadel',
'rightOperationHadel',
'tableSelectionHandle'
])
// table
function tableSelectionHandle (val){
state.tableSelectList = val
emits('tableSelectionHandle',val)
}
//
function leftOperationHadel(btn,scope) {
emits('leftOperationHadel',btn,scope)
}
//
function getRightOperation() {
// api
if(typeof props.rightOperation == 'object' && !props.showApiRightOperation){
return props.rightOperation
}
// api
else if(
(typeof props.rightOperation == 'object' && props.showApiRightOperation)
|| typeof props.rightOperation == 'string'
){
// api
let _apiArr = props.showApiRightOperation || props.rightOperation.split(',')
let _config = {
apiUpdate:{label:'编辑',type:'warning'},
apiDelete:{label:'删除',type:'danger'},
}
let _btns = []
if(_apiArr && _apiArr.length > 0){
_apiArr.forEach(item => {
_btns.push({
label:_config[item].label,
name:item,
link:true,
type:_config[item].type,
auth:props.apiName+':'+item,
hide:(row,scope) => {return row[props.apiRightHideConfig[item].prop] == props.apiRightHideConfig[item].ruleValue}
})
});
}
// api
if(typeof props.rightOperation == 'object'){
_btns = [..._btns,...props.rightOperation]
}
return _btns
}
}
//
const apiEditPopRef = ref()
function rightOperationHadel(btn,scope) {
//
if(btn.name == 'apiUpdate'){
let _tableColums = props.tableColumns || apiTableColumns[props.apiName]
let _list = _tableColums.filter(item => !item.noEdit)
apiEditPopRef.value.open(_list,scope.row)
}
//
if(btn.name == 'apiDelete'){
ElMessageBox.confirm(`是否确定删除?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
state.loading = true
deleteCommonApi(props.apiName,scope.row.uId)
.then(res=>{
ElMessage.success('操作成功!')
getTableData(1);
})
.catch(err=>{ElMessage.error('操作失败!')})
.finally(()=>{state.loading = false})
})
}
emits('rightOperationHadel',btn,scope)
}
//
const submitEditForm = async (type,formData,formConfig) => {
apiEditPopRef.value.validate((valid) => {
if(valid){
//
if(type == 'create'){
if(formData.hasOwnProperty('createUser')){formData.createUser = userInfo.realName}
if(formData.hasOwnProperty('createByUser')){formData.createByUser = userInfo.realName}
if(formData.hasOwnProperty('createTime')){formData.createTime = formatDate(new Date(), "YYYY-mm-dd HH:MM:SS")}
apiEditPopRef.value.changeLoading(true)
postCommonCreate(props.apiName,formData)
.then(res=>{
apiEditPopRef.value.close()
ElMessage.success('操作成功!')
getTableData(1);
})
.catch(err=>{ElMessage.error('操作失败!')})
.finally(()=>{apiEditPopRef.value.changeLoading(false)})
}else{
//
if(
(formData.hasOwnProperty('updateByUser') && formData.hasOwnProperty('updateTime'))
|| (formData.hasOwnProperty('updateUser') && formData.hasOwnProperty('updateTime'))
){
if(formData.hasOwnProperty('updateByUser')){formData.updateByUser = userInfo.realName}
if(formData.hasOwnProperty('updateUser')){formData.updateUser = userInfo.realName}
if(formData.hasOwnProperty('updateTime')){formData.updateTime = formatDate(new Date(), "YYYY-mm-dd HH:MM:SS")}
}else{
//
let _notChange=['taskconifgure']
if(_notChange.indexOf(props.apiName) < 0){
formData.remark= `修改信息:${userInfo.realName} ${formatDate(new Date(), "YYYY-mm-dd HH:MM:SS")}`
}
}
apiEditPopRef.value.changeLoading(true)
putCommonUpdate(props.apiName,formData)
.then(res=>{
apiEditPopRef.value.close()
ElMessage.success('操作成功!')
getTableData(1);
})
.catch(err=>{ElMessage.error('操作失败!')})
.finally(()=>{apiEditPopRef.value.changeLoading(false)})
}
}
})
}
//
function getPageParams(pageSize){
let _filters = []
if(props.hideSearch){
_filters = props.searchFilter
}else{
for(let i in props.searchFilter){
let _item = props.searchOptions.filter(item=>item.prop == i)
let _type = (_item && _item.length > 0) ? _item[0].type : null
if((props.searchFilter[i] || props.searchFilter[i] == 0) && props.searchFilter[i] != ""){
//
if(_type == 'datetimerange'){
_filters.push(
{
logic: "And",
column: i,
action: '>=',
value: props.searchFilter[i][0]
}
)
_filters.push(
{
logic: "And",
column: i,
action: '<=',
value: props.searchFilter[i][1]
}
)
}else{
let _action = 'like'
let _EqualTypes = ['tagFilter','filter','number','select']//
if(_EqualTypes.indexOf(_type) >= 0){
_action = '=='
}
_filters.push(
{
logic: "And",
column: i,
action: _action,
value: props.searchFilter[i]
}
)
}
}
}
}
let _pageParams = getPageParamsForFilter({
pageNumber:state.pager.page,
pageSize:pageSize || state.pager.pageSize,
sortBy:state.sortFilter.sortBy,
isAscending:state.sortFilter.isAscending,
condition:{
filters:_filters
}
})
return _pageParams
}
//
function getTableData(page,callback) {
state.stage_indexs = []
state.currentDetailId = null
state.headerInfoData = []
state.tableSelectList = []
if(props.apiType == 'detailApi'){
state.loading = true
if(!page)page = state.pager.page
if(page)state.pager.page = page
getCommonDeatailPaged(props.apiName,getPageParams())
.then((resp) => {
state.headerInfoData = []
state.tableData = resp.data.data
state.stage_tableData = JSON.parse(JSON.stringify(resp.data.data))
state.pager.total = resp.data.totalCount
if(callback)callback(resp)
})
.catch(err=>{ElMessage.error('数据获取失败!')})
.finally(() => (state.loading = false))
}else{
state.loading = true
if(!page)page = state.pager.page
if(page)state.pager.page = page
getCommonPaged(props.apiName,getPageParams())
.then((resp) => {
state.headerInfoData = []
state.tableData = resp.data.data
state.stage_tableData = JSON.parse(JSON.stringify(resp.data.data))
state.pager.total = resp.data.totalCount
if(callback)callback(resp)
})
.catch(err=>{ElMessage.error('数据获取失败!')})
.finally(() => (state.loading = false))
}
}
//
function exportHandle(isAll){
state.loading = true
//
getTableData(1,(res=>{
let _params = getPageParams()
if(isAll){_params = getPageParams(res.data.totalCount)}
postCommonExport(props.apiName,_params)
.then((res) => {
let _str = isAll ? '全部' : '当页'
downloadByData(res.data,route.meta.title+`.xlsx`)
})
.catch(err=>{ElMessage.error('操作失败!')})
.finally(() => (state.loading = false))
}))
}
const importPopRef = ref()
//
function searchBtnHandle(btn){
//
if(btn == 'search'){
beforClearEdit().then(() => {
getTableData()
})
}
//
else if (btn == 'create'){
beforClearEdit().then(() => {
let _tableColums = props.tableColumns || apiTableColumns[props.apiName]
let _list = _tableColums.filter(item => !item.noEdit)
apiEditPopRef.value.open(_list)
})
}
//
else if (btn == 'import'){
beforClearEdit().then(() => {
importPopRef.value.open()
})
}
//
else if (btn == 'export'){
exportHandle()
}
//
else if (btn == 'custominvoke'){
beforClearEdit().then(() => {
state.loading = true
let _data = {
taskName:apiServeNames[props.apiName].taskName,
client:'Chery'
}
getCommonCustominvoke(_data)
.then((res) => {
ElMessage.success('操作成功!')
getTableData(1)//
})
.finally(() => (state.loading = false))
})
}
//
else if (btn == 'outputMany'){
let _idEditData = checkPageEditList()
if(_idEditData && _idEditData.length > 0){
return ElMessage.warning('当前有未保存修改项,请先保存页面')
}
if(!state.tableSelectList || state.tableSelectList.length <= 0 ){
return ElMessage.warning('未选中任何数据')
}
ElMessageBox.confirm('是否确定手动传出?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
state.loading = true
postCommonConfirmMany(props.apiName,state.tableSelectList)
.then(res=>{
ElMessage.success('操作成功!')
getTableData(1)
})
.finally(()=>{state.loading = false})
})
}
}
const table_Ref = ref(null)
//
function searchRightBtnHandle(btn){
//
if(btn.name == 'pageSave'){
// table_Ref.value.tableForm_Ref.validate((valid)=>{
// if(valid){
let _idEditData = checkPageEditList()
if(!_idEditData || _idEditData.length <= 0)return ElMessage.warning('暂无数据修改')
//
// [feedbackResults]=1[ventureType],[ventureSpecific],[measures]
let _indexs = []
_idEditData.forEach(item=>{
if(item.feedbackResults == '1' && (
!item.ventureType || item.ventureType == '' ||
!item.ventureSpecific || item.ventureSpecific == '' ||
!item.measures || item.measures == ''
)){
_indexs.push(getIndexById(item.id))
}
})
if(_indexs && _indexs.length > 0){
return ElMessage.error(`修改数据中【第${_indexs}行】数据中,【反馈结果】为异常,但【风险类型】或【具体风险】或【应对措施】为空,请修改后重新提交!`)
}
ElMessageBox.confirm('是否确定提交更改?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
state.loading = true
postCommonUpdateMany(props.apiName,_idEditData)
.then(res=>{
ElMessage.success('操作成功!')
getTableData(1)
})
.finally(()=>{state.loading = false})
})
// }
// })
}
}
//
function sortChange(data) {
beforClearEdit().then(() => {
const { prop, order } = data;
if (!prop || !order) {
state.sortFilter.sortBy = undefined;
state.sortFilter.isAscending = undefined;
getTableData(1);
return;
}
state.sortFilter.sortBy = prop;
state.sortFilter.isAscending = (order == "ascending");
getTableData(1);
})
}
//
function importSuccess(response,importDate){
getTableData()
}
// size-change
function pageSizeChange(pageSize,returnSize){
state.pageLoading=true
let _oldSize = state.pager.pageSize
state.pager.pageSize = pageSize
beforClearEdit()
.then(res => {
getTableData(1)
state.pageLoading=false
})
.catch(res=>{
state.pager.pageSize = _oldSize
state.pageLoading=false
})
}
// current-change
function pageCurrentChange(page){
beforClearEdit().then(res => {
getTableData(page)
})
}
//
function getIndexById(id){
let _id = id || state.currentDetailId
for(let i=0;i<state.stage_tableData.length;i++){
if(state.stage_tableData[i].id == _id){
return i + 1
}
}
}
//
function checkDisableByRowRule(row,item){
let hasDisable = false
// editDisabledConfig
for(let i = 0;i<props.editDisabledConfig.length;i++){
if(row[props.editDisabledConfig[i].prop] == props.editDisabledConfig[i].ruleValue){
hasDisable = true
break
}
}
//
//
//
if(!hasDisable && row.feedbackResults == '0' && item.prop != 'feedbackResults'){
hasDisable = true
}
return hasDisable
}
//
function checkDisableCheckByRowRule(row){
// editDisabledConfig
let hasDisable = false
// editDisabledConfig
for(let i = 0;i<props.editDisabledConfig.length;i++){
if(row[props.editDisabledConfig[i].prop] == props.editDisabledConfig[i].ruleValue){
hasDisable = true
break
}
}
return hasDisable
}
//
function getEditItemDisabled(item,row,index){
//
let _auth = auths.hasPermission(props.apiName+':pageSave')
if(item.disabled || !_auth){
return true
}
//
if(state.tableSelectList && state.tableSelectList.length > 0){
return true
}
//
return checkDisableByRowRule(row,item)
}
// table
function selectableDisabled(row,index){
//
let _auth = auths.hasPermission(props.apiName+':outputMany')
//
let _idEditData = checkPageEditList()
//
let checkRow = checkDisableCheckByRowRule(row)
return _auth && (!_idEditData || _idEditData.length <= 0) && !checkRow
}
// Focus todo:
function getItemDetail(type,row,eventType) {
if(!row.id){return ElMessage.error('该数据无id')}
// id
if(row.id == state.currentDetailId){return}
let _focuseExt = ['input','numberInput']
// focus_focuseExtcell
if(eventType == 'focus' && _focuseExt.indexOf(type) >= 0){return}
console.log(type,row,eventType)
console.log('------------')
state.currentDetailId = row.id
state.detailLoading = true
getCommonDetailById(props.apiName,row.id)
.then((res) => {
state.headerInfoData = []
let _colums = apiTableColumns[props.detailColumName]
_colums.forEach(item=>{
state.headerInfoData.push({
label:item.title,
value:res.data[item.prop],
prop:item.prop
})
})
})
.finally(() => (state.detailLoading = false))
}
// change
function editItemChangeHandle(item,scope,data) {
if(state.stage_indexs.indexOf(scope.$index) < 0){
state.stage_indexs.push(scope.$index)
}
//
//
if(item.prop == "feedbackResults"){
//
if(scope.row.feedbackResults == '0'){
//
scope.row.ventureType = ""
scope.row.ventureSpecific = ""
scope.row.measures = ""
// ()
// prop
let _tableColums = props.tableColumns || apiTableColumns[props.apiName]
for(let prop in scope.row){
let _item = _tableColums.filter(item=>item.prop == prop)
if(_item && _item.length > 0 && _item[0].relevProp){
let _relevProp = _item[0].relevProp
let _list = state.headerInfoData.filter(item=>item.prop == _relevProp)
if(_list && _list.length>0){
scope.row[prop] = _list[0].value
}
}
}
}
}
}
//
function beforClearEdit(){
return new Promise((resolve, reject) => {
let _idEditData = checkPageEditList()
if(!_idEditData || _idEditData.length <= 0){
resolve()
}else{
ElMessageBox.confirm(state.leaveSaveTip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
resolve()
}).catch(()=>{
reject()
})
}
})
}
//
function checkPageEditList(){
if(!state.stage_indexs || state.stage_indexs.length<=0){
return false
}
else{
let _changeArr = []
state.stage_indexs.forEach(item=>{
if(JSON.stringify(state.stage_tableData[item]) != JSON.stringify(state.tableData[item])){
_changeArr.push(state.tableData[item])
}
})
return _changeArr
}
}
//
function tableRowClassName(data){
if(data.row.id && (data.row.id == state.currentDetailId)){return 'current-select-tableRow'}
else{return 'normal-tableRow'}
}
// apiTableColumnstable
function getTableFormRules(){
if(props.tableFormRules) {
state.tableFormRulesData = props.tableFormRules
}else{
state.tableFormRulesData = {}
apiTableColumns[props.apiName].forEach(item=>{
if(item.required){
state.tableFormRulesData[item.prop] = [{ required: true, message: '必填项', trigger: 'change' }]
}
})
}
}
onMounted(() => {
// getTableFormRules()
getTableData()
})
</script>
<style scoped lang="scss">
::v-deep .search-container{
.el-card__body{
width: 100%;
display: flex;
justify-content: space-between;
}
}
::v-deep .headerInfo-container{
margin-top:10px;
.el-card__body{
padding-bottom: 10px !important;
min-height:66px
}
}
::v-deep .headerInfoEmpty{
height:195px;
.el-empty__image{
width:90px !important
}
}
::v-deep .el-descriptions__body{
max-height: 165px;
overflow: auto;
}
</style>

689
Web/src/components/tablePage/index_oldExport.vue

@ -0,0 +1,689 @@
<template>
<div class="app-container" v-loading="state.loading">
<el-card class="search-container" v-if="!(props.hideSearch && props.hideSetColums)">
<el-form :inline="true" v-if="!props.hideSearch">
<el-form-item
v-auth="(props.authName || props.apiName) + state.searchBtnOptions['search'].auth"
v-for="(item,index) in props.searchOptions"
:key="index"
:label="item.label">
<!-- 文本 -->
<el-input
v-if="item.type == 'input' && !item.hide"
v-model="props.searchFilter[item.prop]"
:placeholder="item.label"
:clearable="!item.noClear"
/>
<!-- 数字 -->
<el-input-number
v-if="item.type == 'number' && !item.hide"
v-model="props.searchFilter[item.prop]"
:min="item.min"
:max="item.max"
/>
<!-- 时间区域 -->
<el-date-picker
v-if="item.type == 'datetimerange' && !item.hide"
v-model="props.searchFilter[item.prop]"
type="datetimerange"
start-placeholder="起始时间"
end-placeholder="结束时间"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
style="width:370px"
/>
<!-- 选择框 -->
<el-select
v-if="item.type == 'select' && !item.hide"
v-model="props.searchFilter[item.prop]"
:filterable="!item.noSearch"
placeholder="请选择"
style="width: 240px"
:clearable="!item.noClear"
>
<el-option
v-for="(op,op_index) in item.options"
:key="op_index"
:label="op.label"
:value="op.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<div style="margin-right:10px" v-for="(btn,btn_key) in props.searchButtons" :key="btn_key">
<!-- 导出 -->
<!-- <el-dropdown
v-auth="(props.authName || props.apiName) + state.searchBtnOptions[btn].auth"
:hide-on-click="false"
v-if="state.searchBtnOptions[btn].auth == ':export'"
>
<el-button
:icon="state.searchBtnOptions[btn].icon"
:type="state.searchBtnOptions[btn].type">
{{state.searchBtnOptions[btn].label}}
<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="exportHandle()">按条件导出当前页</el-dropdown-item>
<el-dropdown-item divided @click="exportHandle(true)">按条件导出全部</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown> -->
<!-- 其他按钮 -->
<el-button
:icon="state.searchBtnOptions[btn].icon"
v-auth="(props.authName || props.apiName) + state.searchBtnOptions[btn].auth"
:type="state.searchBtnOptions[btn].type"
@click="searchBtnHandle(btn)"
>{{state.searchBtnOptions[btn].label}}</el-button>
</div>
</el-form-item>
</el-form>
<!-- 字段设置 -->
<setColumsPop
style="margin-left: auto;"
v-if="!props.hideSetColums && state.innerTableColumns"
:localTableColumnsName="state.localTableColumnsName"
:initTableColums="state.initTableColums"
:tableColumns="state.innerTableColumns"
></setColumsPop>
</el-card>
<el-card class="paged-table-container">
<elTable
v-if="state.innerTableColumns"
:specialLocalColumnName="props.specialLocalColumnName"
:columnWidth="props.columnWidth"
:columnHeaderAlign="props.columnHeaderAlign"
:columnAlign="props.columnAlign"
:tableData="state.tableData"
:tableColumns="state.innerTableColumns"
@sortChange="sortChange"
:leftOperation="props.leftOperation"
@leftOperationHadel="leftOperationHadel"
:leftOperationColumnWidth="props.leftOperationColumnWidth"
:rightOperation="getRightOperation()"
@rightOperationHadel="rightOperationHadel"
:multipleTable="props.multipleTable"
@tableSelectionHandle="tableSelectionHandle"
:tableRowClassName="props.tableRowClassName"
:tableCellClassName="props.tableCellClassName"
></elTable>
<elPager
style="margin-top: 15px;float:right"
:pager="state.pager"
@pageSizeChange="pageSizeChange"
@pageCurrentChange="pageCurrentChange"
></elPager>
</el-card>
<!-- 导入弹窗 -->
<importPop
ref="importPopRef"
:apiName="props.apiName"
@success="importSuccess"
/>
<!-- 编辑弹窗 -->
<apiEditPop
ref="apiEditPopRef"
:apiName="props.apiName"
@submitEditForm="submitEditForm"
:formRules="props.apiEditFormRules"
/>
</div>
</template>
<script setup>
defineOptions({ name: 'tablePage' })
import store from '@/stores'
import apiTableColumns from '@/utils/common/apiTableColumns'
import { reactive, ref, onMounted,computed,defineExpose } from 'vue'
import {
getCommonPost,
getCommonPaged,
getCommonDeatailPaged,
postCommonExport,
postCommonCreate,
putCommonUpdate,
deleteCommonApi,
getCommonCustominvoke
} from '@/api/common/index'
import { ElMessageBox, ElMessage,ElTable, ElTableColumn } from 'element-plus'
import elTable from '@/components/elTable/index.vue'
import elPager from '@/components/elPager/index.vue'
import setColumsPop from '@/components/setColumsPop/index.vue'
import { getPageParamsForFilter,getLocalTableColumnsName } from '@/utils/common/index'
import { downloadByData } from '@/utils/download'
import importPop from '@/components/importPop/index.vue'
import apiEditPop from '@/components/apiEditPop/index.vue'
import { formatDate } from '@/utils/formatTime'
import apiServeNames from '@/utils/common/apiServeNames'
import { useRoute } from 'vue-router'
const route = useRoute()
const userStore = store.userStore()
const userInfo = userStore.state
const state = reactive({
loading:false,
searchBtnOptions:{
search:{icon:'Search',auth:':page',label:'查询',type:null},
create:{icon:'Plus',auth:':create',label:'新增',type:'primary'},
import:{icon:'BottomRight',auth:':import',label:'导入',type:'warning'},
export:{icon:'TopRight',auth:':export',label:'导出',type:'success'},
custominvoke:{icon:'Position',auth:':custominvoke',label:'手动开关',type:'primary'},
},
innerTableColumns:null,
tableData:[],
// table
sortFilter:{
sortBy:undefined,
isAscending:undefined
},
pager:{
page: 1,
pageSize: 10,
total: 1,
},
tableSelectList:[],
initTableColums:[],//
localTableColumnsName:null
})
const props = defineProps({
// api
apiName: {
type: String,
default: null
},
// api
specialPageApi:{
type: String,
default: null
},
// columnapiName
specialColumnName:{
type: String,
default: null
},
// columnapiName
specialLocalColumnName:{
type: String,
default: null
},
// 使apiName
authName:{
type: String,
default: null
},
// api detailApigetdetailpageApigetdatapaged
apiType: {
type: String,
default: null
},
//
hideSearch:{
type: Boolean,
default: false
},
// class
tableRowClassName:{
type: Function,
default: null
},
// class
tableCellClassName:{
type: Function,
default: null
},
//
multipleTable:{
type: Boolean,
default: false
},
//
leftOperation:{
type: Object,
default: null
},
//
leftOperationColumnWidth:{
type: Number,
default: 120
},
//
rightOperation:{
type: [Object,String],
default: null
},
// api
showApiRightOperation:{
type: Object,
default: null
},
// writeState=true
// 使,=
apiRightHideConfig:{
type: Object,
default: {
apiUpdate:{prop:'writeState',ruleValue:true},
apiDelete:{prop:'writeState',ruleValue:true},
}
},
// table
tableColumns: {
type: Object,
default: null
},
//
searchOptions: {
type: Object,
default: []
},
//
searchButtons: {
type: Object,
default: ['search','export']
},
// tablefilter
searchFilter: {
type: Object,
default: {}
},
// tablefiltercolum
// infoSearchFilterOptions:{ TableName:{action:'=='}},
searchFilterOptions: {
type: Object,
default: {}
},
//
columnWidth:{
type: Number,
default: 120
},
//
columnHeaderAlign:{
type: String,
default: 'center'
},
//
columnAlign:{
type: String,
default: 'center'
},
//
apiEditFormRules:{
type: Object,
default: null
},
//
hideSetColums:{
type: Boolean,
default: false
}
})
// noFilter
function getTableColumns(noFilter){
if(noFilter){
return props.tableColumns || apiTableColumns[props.apiName]
}else{
// location
let _localColumName = props.specialLocalColumnName || useRoute().name
state.localTableColumnsName = getLocalTableColumnsName(_localColumName)
let _local = JSON.parse(localStorage.getItem(state.localTableColumnsName))
//
let _apiColums = props.specialColumnName || props.apiName
state.initTableColums = props.tableColumns || apiTableColumns[_apiColums]
let _list = (_local && _local != null && _local != undefined) ? _local : JSON.parse(JSON.stringify(state.initTableColums))
state.innerTableColumns = _list
return _list
}
}
const emits = defineEmits([
'leftOperationHadel',
'rightOperationHadel',
'tableSelectionHandle'
])
// table
function tableSelectionHandle (val){
state.tableSelectList = val
emits('tableSelectionHandle',val)
}
//
function leftOperationHadel(btn,scope) {
emits('leftOperationHadel',btn,scope)
}
//
function getRightOperation() {
// api
if(typeof props.rightOperation == 'object' && !props.showApiRightOperation){
return props.rightOperation
}
// api
else if(
(typeof props.rightOperation == 'object' && props.showApiRightOperation)
|| typeof props.rightOperation == 'string'
){
// api
let _apiArr = props.showApiRightOperation || props.rightOperation.split(',')
let _config = {
apiUpdate:{label:'编辑',type:'warning'},
apiDelete:{label:'删除',type:'danger'},
}
let _btns = []
if(_apiArr && _apiArr.length > 0){
_apiArr.forEach(item => {
_btns.push({
label:_config[item].label,
name:item,
link:true,
type:_config[item].type,
auth:(props.authName || props.apiName)+':'+item,
hide:(row,scope) => {return row[props.apiRightHideConfig[item].prop] == props.apiRightHideConfig[item].ruleValue}
})
});
}
// api
if(typeof props.rightOperation == 'object'){
_btns = [..._btns,...props.rightOperation]
}
return _btns
}
}
//
const apiEditPopRef = ref()
function rightOperationHadel(btn,scope) {
//
if(btn.name == 'apiUpdate'){
let _tableColums = props.tableColumns || apiTableColumns[props.apiName]
let _list = _tableColums.filter(item => !item.noEdit)
apiEditPopRef.value.open(_list,scope.row)
}
//
if(btn.name == 'apiDelete'){
ElMessageBox.confirm(`是否确定删除?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
state.loading = true
deleteCommonApi(props.apiName,scope.row.uId)
.then(res=>{
ElMessage.success('操作成功!')
getTableData(1);
})
.finally(()=>{state.loading = false})
})
}
emits('rightOperationHadel',btn,scope)
}
//
const submitEditForm = async (type,formData,formConfig) => {
apiEditPopRef.value.validate((valid) => {
if(valid){
//
if(type == 'create'){
if(formData.hasOwnProperty('createUser')){formData.createUser = userInfo.realName}
if(formData.hasOwnProperty('createByUser')){formData.createByUser = userInfo.realName}
if(formData.hasOwnProperty('createTime')){formData.createTime = formatDate(new Date(), "YYYY-mm-dd HH:MM:SS")}
apiEditPopRef.value.changeLoading(true)
postCommonCreate(props.apiName,formData)
.then(res=>{
apiEditPopRef.value.close()
ElMessage.success('操作成功!')
getTableData(1);
})
.catch(err=>{ElMessage.error('操作失败!')})
.finally(()=>{apiEditPopRef.value.changeLoading(false)})
}else{
//
if(
(formData.hasOwnProperty('updateByUser') && formData.hasOwnProperty('updateTime'))
|| (formData.hasOwnProperty('updateUser') && formData.hasOwnProperty('updateTime'))
){
if(formData.hasOwnProperty('updateByUser')){formData.updateByUser = userInfo.realName}
if(formData.hasOwnProperty('updateUser')){formData.updateUser = userInfo.realName}
if(formData.hasOwnProperty('updateTime')){formData.updateTime = formatDate(new Date(), "YYYY-mm-dd HH:MM:SS")}
}else{
//
let _notChange=['taskconifgure','customlog']
if(_notChange.indexOf(props.apiName) < 0){
formData.remark= `修改信息:${userInfo.realName} ${formatDate(new Date(), "YYYY-mm-dd HH:MM:SS")}`
}
}
apiEditPopRef.value.changeLoading(true)
putCommonUpdate(props.apiName,formData)
.then(res=>{
apiEditPopRef.value.close()
ElMessage.success('操作成功!')
getTableData(1);
})
.catch(err=>{ElMessage.error('操作失败!')})
.finally(()=>{apiEditPopRef.value.changeLoading(false)})
}
}
})
}
//
function getPageParams(pageSize){
let _filters = []
if(props.hideSearch){
_filters = props.searchFilter
}else{
function __getAction (prop,action){
if(props.searchFilterOptions && props.searchFilterOptions[prop] && props.searchFilterOptions[prop].action){
return props.searchFilterOptions[prop].action
}else{
return action
}
}
for(let i in props.searchFilter){
let _item = props.searchOptions.filter(item=>item.prop == i)
let _type = (_item && _item.length > 0) ? _item[0].type : null
if((props.searchFilter[i] || props.searchFilter[i] == 0) && props.searchFilter[i] != ""){
//
if(_type == 'datetimerange'){
_filters.push(
{
logic: "And",
column: i,
action: __getAction(i,'>='),
value: props.searchFilter[i][0]
}
)
_filters.push(
{
logic: "And",
column: i,
action: __getAction(i,'<='),
value: props.searchFilter[i][1]
}
)
}else{
let _action = 'like'
let _EqualTypes = ['tagFilter','filter','number','select']//
if(_EqualTypes.indexOf(_type) >= 0){
_action = '=='
}
_filters.push(
{
logic: "And",
column: i,
action: __getAction(i,_action),
value: props.searchFilter[i]
}
)
}
}
}
}
let _pageParams = getPageParamsForFilter({
pageNumber:state.pager.page,
pageSize:pageSize || state.pager.pageSize,
sortBy:state.sortFilter.sortBy,
isAscending:state.sortFilter.isAscending,
condition:{
filters:_filters
}
})
return _pageParams
}
//
function getTableData(page,callback) {
state.loading = true
if(!page)page = state.pager.page
if(page)state.pager.page = page
if(props.apiType == 'detailApi'){
getCommonDeatailPaged(props.apiName,getPageParams())
.then((resp) => {
state.tableData = resp.data.data
state.pager.total = resp.data.totalCount
if(callback)callback(resp)
})
.catch(err=>{ElMessage.error('数据获取失败!')})
.finally(() => (state.loading = false))
}else if(props.specialPageApi){
getCommonPost(props.specialPageApi,getPageParams())
.then((resp) => {
state.tableData = resp.data.data
state.pager.total = resp.data.totalCount
if(callback)callback(resp)
})
.catch(err=>{ElMessage.error('数据获取失败!')})
.finally(() => (state.loading = false))
}
else{
getCommonPaged(props.apiName,getPageParams())
.then((resp) => {
state.tableData = resp.data.data
state.pager.total = resp.data.totalCount
if(callback)callback(resp)
})
.catch(err=>{ElMessage.error('数据获取失败!')})
.finally(() => (state.loading = false))
}
}
//
function exportHandle(isAll){
state.loading = true
//
getTableData(1,(res=>{
let _params = getPageParams()
if(isAll){_params = getPageParams(res.data.totalCount)}
postCommonExport(props.apiName,_params)
.then((res) => {
let _str = isAll ? '全部' : '当页'
downloadByData(res.data,route.meta.title+`.xlsx`)
})
.catch(err=>{ElMessage.error('操作失败!')})
.finally(() => (state.loading = false))
}))
}
const importPopRef = ref()
//
function searchBtnHandle(btn){
//
if(btn == 'search'){
getTableData(1)
}
//
else if (btn == 'create'){
let _tableColums = props.tableColumns || apiTableColumns[props.apiName]
let _list = _tableColums.filter(item => !item.noEdit)
apiEditPopRef.value.open(_list)
}
//
else if (btn == 'import'){
importPopRef.value.open()
}
//
else if (btn == 'export'){
exportHandle()
}
//
else if (btn == 'custominvoke'){
ElMessageBox.confirm('是否确定操作手动开关?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
state.loading = true
let _data = {
taskName:apiServeNames[props.apiName].taskName,
client:'Chery'
}
getCommonCustominvoke(_data)
.then((res) => {
ElMessage.success('操作成功!')
getTableData(1)//
})
.finally(() => (state.loading = false))
})
}
}
//
function sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
state.sortFilter.sortBy = undefined;
state.sortFilter.isAscending = undefined;
getTableData(1);
return;
}
state.sortFilter.sortBy = prop;
state.sortFilter.isAscending = (order == "ascending");
getTableData(1);
}
// todo
function importSuccess(response,importDate){
getTableData()
}
// size-change
function pageSizeChange(pageSize){
state.pager.pageSize = pageSize
getTableData(1)
}
// current-change
function pageCurrentChange(page){
getTableData(page)
}
onMounted(() => {
getTableColumns()
getTableData()
})
defineExpose({
state,
getTableData
});
</script>
<style scoped lang="scss">
::v-deep .search-container {
.el-card__body{
display:flex;
justify-content: space-between;
}
}
</style>

95
Web/src/utils/common/apiTableColumns.js

@ -108,22 +108,22 @@ const apiTableColumns = {
{prop:'releaseEdition',title:'需求发布版次',width:150},
{prop:'materialCode',title:'零件号'},
{prop:'plantId',title:'工厂代码',width:120},
{prop:'feedbackResults',title:'反馈结果',type:'filterSelect',options:EnumList.feedbackResults,required:true},
{prop:'feedbackResults',title:'反馈结果',type:'filterSelect',options:EnumList.feedbackResults,required:true,noClear:true},
{prop:'ventureType',title:'风险类型',type:'filterSelect',options:EnumList.ventureType},
{prop:'ventureSpecific',title:'具体风险',type:'input'},
{prop:'measures',title:'应对措施',type:'input'},
{prop:'quantityMeet1',title:'满足数量1',type:'numberInput'},
{prop:'quantityMeet2',title:'满足数量2',type:'numberInput'},
{prop:'quantityMeet3',title:'满足数量3',type:'numberInput'},
{prop:'quantityMeet4',title:'满足数量4',type:'numberInput'},
{prop:'quantityMeet5',title:'满足数量5',type:'numberInput'},
{prop:'quantityMeet6',title:'满足数量6',type:'numberInput'},
{prop:'quantityMeet7',title:'满足数量7',type:'numberInput'},
{prop:'quantityMeet8',title:'满足数量8',type:'numberInput'},
{prop:'quantityMeet9',title:'满足数量9',type:'numberInput'},
{prop:'quantityMeet10',title:'满足数量10',type:'numberInput'},
{prop:'quantityMeet11',title:'满足数量11',type:'numberInput'},
{prop:'quantityMeet12',title:'满足数量12',type:'numberInput'},
{prop:'quantityMeet1',title:'满足数量1',type:'numberInput',relevProp:'quantityDemand1'},
{prop:'quantityMeet2',title:'满足数量2',type:'numberInput',relevProp:'quantityDemand2'},
{prop:'quantityMeet3',title:'满足数量3',type:'numberInput',relevProp:'quantityDemand3'},
{prop:'quantityMeet4',title:'满足数量4',type:'numberInput',relevProp:'quantityDemand4'},
{prop:'quantityMeet5',title:'满足数量5',type:'numberInput',relevProp:'quantityDemand5'},
{prop:'quantityMeet6',title:'满足数量6',type:'numberInput',relevProp:'quantityDemand6'},
{prop:'quantityMeet7',title:'满足数量7',type:'numberInput',relevProp:'quantityDemand7'},
{prop:'quantityMeet8',title:'满足数量8',type:'numberInput',relevProp:'quantityDemand8'},
{prop:'quantityMeet9',title:'满足数量9',type:'numberInput',relevProp:'quantityDemand9'},
{prop:'quantityMeet10',title:'满足数量10',type:'numberInput',relevProp:'quantityDemand10'},
{prop:'quantityMeet11',title:'满足数量11',type:'numberInput',relevProp:'quantityDemand11'},
{prop:'quantityMeet12',title:'满足数量12',type:'numberInput',relevProp:'quantityDemand12'},
{prop:'startMonth',title:'起始月份'},
{prop:'creationTime',title:'创建时间',width:180},
],
@ -213,42 +213,43 @@ const apiTableColumns = {
{prop:'releaseEdition',title:'需求发布版次',width:150},
{prop:'materialCode',title:'零件号'},
{prop:'plantId',title:'工厂代码',width:120},
{prop:'feedbackResults',title:'反馈结果',type:'filterSelect',options:EnumList.feedbackResults,required:true},
{prop:'feedbackResults',title:'反馈结果',type:'filterSelect',options:EnumList.feedbackResults,required:true,noClear:true},
{prop:'ventureType',title:'风险类型',type:'filterSelect',options:EnumList.ventureType},
{prop:'ventureSpecific',title:'具体风险',type:'input'},
{prop:'measures',title:'应对措施',type:'input'},
{prop:'quantityMeet1',title:'满足数量1',type:'numberInput'},
{prop:'quantityMeet2',title:'满足数量2',type:'numberInput'},
{prop:'quantityMeet3',title:'满足数量3',type:'numberInput'},
{prop:'quantityMeet4',title:'满足数量4',type:'numberInput'},
{prop:'quantityMeet5',title:'满足数量5',type:'numberInput'},
{prop:'quantityMeet6',title:'满足数量6',type:'numberInput'},
{prop:'quantityMeet7',title:'满足数量7',type:'numberInput'},
{prop:'quantityMeet8',title:'满足数量8',type:'numberInput'},
{prop:'quantityMeet9',title:'满足数量9',type:'numberInput'},
{prop:'quantityMeet10',title:'需求数量10',type:'numberInput'},
{prop:'quantityMeet11',title:'需求数量11',type:'numberInput'},
{prop:'quantityMeet12',title:'需求数量12',type:'numberInput'},
{prop:'quantityMeet13',title:'需求数量13',type:'numberInput'},
{prop:'quantityMeet14',title:'需求数量14',type:'numberInput'},
{prop:'quantityMeet15',title:'需求数量15',type:'numberInput'},
{prop:'quantityMeet16',title:'需求数量16',type:'numberInput'},
{prop:'quantityMeet17',title:'需求数量17',type:'numberInput'},
{prop:'quantityMeet18',title:'需求数量18',type:'numberInput'},
{prop:'quantityMeet19',title:'需求数量19',type:'numberInput'},
{prop:'quantityMeet20',title:'需求数量20',type:'numberInput'},
{prop:'quantityMeet21',title:'需求数量21',type:'numberInput'},
{prop:'quantityMeet22',title:'需求数量22',type:'numberInput'},
{prop:'quantityMeet23',title:'需求数量23',type:'numberInput'},
{prop:'quantityMeet24',title:'需求数量24',type:'numberInput'},
{prop:'quantityMeet25',title:'需求数量25',type:'numberInput'},
{prop:'quantityMeet26',title:'需求数量26',type:'numberInput'},
{prop:'quantityMeet27',title:'需求数量27',type:'numberInput'},
{prop:'quantityMeet28',title:'需求数量28',type:'numberInput'},
{prop:'quantityMeet29',title:'需求数量29',type:'numberInput'},
{prop:'quantityMeet30',title:'需求数量30',type:'numberInput'},
{prop:'quantityMeet31',title:'需求数量31',type:'numberInput'},
{prop:'quantityMeet1',title:'满足数量1',type:'numberInput',relevProp:'quantityDemand1'},
{prop:'quantityMeet2',title:'满足数量2',type:'numberInput',relevProp:'quantityDemand2'},
{prop:'quantityMeet3',title:'满足数量3',type:'numberInput',relevProp:'quantityDemand3'},
{prop:'quantityMeet4',title:'满足数量4',type:'numberInput',relevProp:'quantityDemand4'},
{prop:'quantityMeet5',title:'满足数量5',type:'numberInput',relevProp:'quantityDemand5'},
{prop:'quantityMeet6',title:'满足数量6',type:'numberInput',relevProp:'quantityDemand6'},
{prop:'quantityMeet7',title:'满足数量7',type:'numberInput',relevProp:'quantityDemand7'},
{prop:'quantityMeet8',title:'满足数量8',type:'numberInput',relevProp:'quantityDemand8'},
{prop:'quantityMeet9',title:'满足数量9',type:'numberInput',relevProp:'quantityDemand9'},
{prop:'quantityMeet10',title:'需求数量10',type:'numberInput',relevProp:'quantityDemand10'},
{prop:'quantityMeet11',title:'需求数量11',type:'numberInput',relevProp:'quantityDemand11'},
{prop:'quantityMeet12',title:'需求数量12',type:'numberInput',relevProp:'quantityDemand12'},
{prop:'quantityMeet13',title:'需求数量13',type:'numberInput',relevProp:'quantityDemand13'},
{prop:'quantityMeet14',title:'需求数量14',type:'numberInput',relevProp:'quantityDemand14'},
{prop:'quantityMeet15',title:'需求数量15',type:'numberInput',relevProp:'quantityDemand15'},
{prop:'quantityMeet16',title:'需求数量16',type:'numberInput',relevProp:'quantityDemand16'},
{prop:'quantityMeet17',title:'需求数量17',type:'numberInput',relevProp:'quantityDemand17'},
{prop:'quantityMeet18',title:'需求数量18',type:'numberInput',relevProp:'quantityDemand18'},
{prop:'quantityMeet19',title:'需求数量19',type:'numberInput',relevProp:'quantityDemand19'},
{prop:'quantityMeet20',title:'需求数量20',type:'numberInput',relevProp:'quantityDemand20'},
{prop:'quantityMeet21',title:'需求数量21',type:'numberInput',relevProp:'quantityDemand21'},
{prop:'quantityMeet22',title:'需求数量22',type:'numberInput',relevProp:'quantityDemand22'},
{prop:'quantityMeet23',title:'需求数量23',type:'numberInput',relevProp:'quantityDemand23'},
{prop:'quantityMeet24',title:'需求数量24',type:'numberInput',relevProp:'quantityDemand24'},
{prop:'quantityMeet25',title:'需求数量25',type:'numberInput',relevProp:'quantityDemand25'},
{prop:'quantityMeet26',title:'需求数量26',type:'numberInput',relevProp:'quantityDemand26'},
{prop:'quantityMeet27',title:'需求数量27',type:'numberInput',relevProp:'quantityDemand27'},
{prop:'quantityMeet28',title:'需求数量28',type:'numberInput',relevProp:'quantityDemand28'},
{prop:'quantityMeet29',title:'需求数量29',type:'numberInput',relevProp:'quantityDemand29'},
{prop:'quantityMeet30',title:'需求数量30',type:'numberInput',relevProp:'quantityDemand30'},
{prop:'quantityMeet31',title:'需求数量31',type:'numberInput',relevProp:'quantityDemand31'},
{prop:'startDate',title:'起始日期',width:180},
{prop:'creationTime',title:'创建时间',width:180},
],
// 日物料需求计划风险确认-明细
cherysuppliercondateDetail:[
@ -349,11 +350,11 @@ const apiTableColumns = {
{prop:'supplierCode',title:'供应商代码',width:120},
{prop:'purchaseOrder',title:'采购订单号',width:120},
{prop:'serialNumber',title:'行项目号',width:120},
{prop:'feedbackResults',title:'反馈结果',type:'filterSelect',options:EnumList.feedbackResults,required:true},
{prop:'feedbackResults',title:'反馈结果',type:'filterSelect',options:EnumList.feedbackResults,required:true,noClear:true},
{prop:'ventureType',title:'风险类型',type:'filterSelect',options:EnumList.ventureType},
{prop:'ventureSpecific',title:'具体风险',type:'input'},
{prop:'measures',title:'应对措施',type:'input'},
{prop:'quantityMeet',title:'满足数量',type:'numberInput'},
{prop:'quantityMeet',title:'满足数量',type:'numberInput',relevProp:'quantityDemand'},
{prop:'creationTime',title:'创建时间',width:180},
],
// 采购订单风险确认-明细

37
Web/src/views/dashboard/index.vue

@ -1,28 +1,39 @@
<template>
<div class="dashboard-container">
<div class="dashboard-text">name: {{ name }}</div>
<div class="homeMenuPage">
<menu-Item
v-for="(item,index) in treeData"
:key="index"
:item="item"
></menu-Item>
</div>
</template>
<script setup>
defineOptions({ name: 'dashboardIndex' })
import { getCurrentMenu } from '@/api/system/userApi'
import store from '@/stores'
import { computed } from 'vue'
import menuItem from './menuItem.vue'
import { onMounted,computed,ref } from 'vue'
import { asyncRoutes } from '@/router/index'
const userStore = store.userStore()
const name = computed(() => userStore.state.name)
// const name = computed(() => userStore.state.name)
let loading = ref(false)
let treeData = asyncRoutes
const defaultProps = ref({
children: 'children',
label: 'menuName',
})
onMounted(() => {
})
</script>
<style lang="scss" scoped>
.dashboard {
&-container {
margin: 30px;
}
&-text {
font-size: 30px;
line-height: 46px;
}
.homeMenuPage{
width:100%;
overflow:auto
}
</style>

72
Web/src/views/dashboard/menuItem.vue

@ -0,0 +1,72 @@
<template>
<div :class="[(!props.item.children || props.item.children.length <= 0) ? 'childBlock':'menuBlock clearfix']">
<div class="firstTitle" v-if="props.item.children && props.item.children.length > 0">{{props.item.meta.title}}</div>
<router-link v-else class="itemTitle" :to="props.item.path">
{{props.item.meta.title}}</router-link>
<div v-if="props.item.children && props.item.children.length > 0" class="isNestBolck">
<menu-Item
v-for="child in props.item.children"
:key="child.path"
:item="child"
/>
</div>
</div>
</template>
<script setup>
defineOptions({ name: 'menuItem' })
import menuItem from './menuItem.vue'
import { onMounted,ref } from 'vue'
const props = defineProps({
//
item:{
type: Object,
default: null
},
})
onMounted(() => {
console.log(props.item)
})
</script>
<style lang="scss" scoped>
.clearfix{
zoom:1;
}
.clearfix:after{
clear:both;
display:block;
visibility:hidden;
height:0;
line-height:0;
content:'';
}
.menuBlock{
margin-bottom:16px;
border-bottom:#e5e5e5 solid 1px;
box-shadow:#f2f2f2 1px 3px 5px;
padding:20px 20px 0;
.childBlock{
.itemTitle{
float:left;
margin-bottom:13px;
margin-right:30px;
color:#555;
&:hover{
color:var(--el-color-primary)
}
}
}
.firstTitle{
border-left: var(--el-color-primary) solid 5px;
padding-left:15px;
margin-bottom:20px;
color:#333;
font-weight:bold
}
}
</style>

6
Web/src/views/system/org/components/editDialog.vue

@ -13,7 +13,7 @@
<el-row>
<el-col :span="12">
<el-form-item label="父级" prop="parentId">
<OrgCascader v-model="state.parentIds" :checkStrictly="true" />
<OrgCascader v-if="state.isShowDialog" ref="parentIdRef" v-model="state.parentIds" :checkStrictly="true" />
</el-form-item>
</el-col>
</el-row>
@ -108,6 +108,7 @@ const state = reactive({
})
const elFormRef = ref()
const userSelectRef = ref()
const parentIdRef = ref()
const rules = {
orgName: [{ required: true, message: '请输入机构名称!', trigger: 'blur' }],
@ -125,6 +126,7 @@ function openDialog(id) {
state.parentIds = [res.data.parentId]
}
userSelectRef.value?.setDefaultValue(res.data.principalUserId)
parentIdRef.value?.setDefaultValue(res.data.parentId)
})
.finally(() => (state.loading = false))
} else {
@ -158,7 +160,7 @@ function submit() {
elFormRef.value.validate((valid) => {
if (valid) {
state.loading = true
state.form.parentId = state.parentIds && state.parentIds.length > 0 ? state.parentIds[0] : '0'
state.form.parentId = state.parentIds && state.parentIds.length > 0 ? state.parentIds[state.parentIds.length - 1] : '0'
if (state.form.id) {
updateOrg(state.form)
.then(() => {

7
Web/src/views/system/org/index.vue

@ -2,12 +2,12 @@
<div class="app-container" v-loading="state.loading">
<el-card class="search-container">
<el-form :inline="true">
<el-form-item label="机构名称">
<el-input v-model="state.queryParams.name" placeholder="机构名称" clearable />
<el-form-item label="机构名称/编码">
<el-input v-model="state.queryParams.name" placeholder="机构名称/编码" clearable />
</el-form-item>
<el-form-item>
<el-button @click="handleQuery" icon="Search" v-auth="'orgIndex:page'">查询</el-button>
<el-button type="primary" @click="() => orgEditDialogRef.openDialog()" v-auth="'orgIndex:add'">新增</el-button>
<el-button type="primary" @click="() => {orgEditDialogRef.openDialog()}" v-auth="'orgIndex:add'">新增</el-button>
</el-form-item>
</el-form>
</el-card>
@ -42,6 +42,7 @@
</template>
<script setup>
// orgManage
defineOptions({ name: 'orgIndex' })
import { reactive, onMounted, ref } from 'vue'
import { getTreeList, deleteOrg } from '@/api/system/orgApi'

2
Web/src/views/system/role/components/editDialog.vue

@ -1,5 +1,5 @@
<template>
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="850px">
<el-dialog top="5vh" v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="850px">
<template #header>
<div>
<el-icon class="el-custom-dialog-icon">

5
Web/src/views/system/role/index.vue

@ -2,8 +2,8 @@
<div class="app-container" v-loading="state.loading">
<el-card class="search-container">
<el-form :inline="true">
<el-form-item label="角色名称">
<el-input v-model="state.queryParams.name" placeholder="角色名称" clearable />
<el-form-item label="角色名称/编码">
<el-input v-model="state.queryParams.name" placeholder="角色名称/编码" clearable />
</el-form-item>
<el-form-item>
<el-button @click="handleQuery" icon="Search" v-auth="'roleIndex:page'">查询</el-button>
@ -77,6 +77,7 @@
</div>
</template>
<script setup>
// rolemanage
defineOptions({ name: 'roleIndex' })
import { reactive, ref, onMounted } from 'vue'
import RoleEditDialog from './components/editDialog.vue'

9
Web/src/views/system/user/index.vue

@ -21,8 +21,8 @@
<div class="app-container-main">
<el-card class="search-container">
<el-form :inline="true">
<el-form-item label="用户名">
<el-input v-model="state.queryParams.userName" placeholder="用户名/姓名" clearable />
<el-form-item label="姓名/账号">
<el-input v-model="state.queryParams.userName" placeholder="姓名/账号" clearable />
</el-form-item>
<el-form-item>
<el-button @click="handleQuery" icon="Search" v-auth="'userIndex:page'">查询</el-button>
@ -35,7 +35,7 @@
新增
</el-button>
</el-form-item>
<el-form-item>
<!-- <el-form-item>
<el-button
icon="Download"
type="primary"
@ -57,7 +57,7 @@
</el-form-item>
<el-form-item>
<el-link type="primary" :href="templateUrl" v-auth="'userIndex:import'" download>用户信息导入模板</el-link>
</el-form-item>
</el-form-item> -->
</el-form>
</el-card>
<el-card class="paged-table-container">
@ -131,6 +131,7 @@
</template>
<script setup>
// usermanage
defineOptions({ name: 'userIndex' })
import { reactive, onMounted, ref, watch } from 'vue'
import OrgTree from '@/views/system/components/orgTree.vue'

Loading…
Cancel
Save