e1bca1a0 by fanguang Committed by lihua

fix

1 parent 9c0249ab
......@@ -378,6 +378,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => {
return obj
})
loading.value = true
tableInfo.value.loading = true
saveStandardCodeFieldsData(params).then((res: any) => {
if (res.code == proxy.$passCode) {
getFirstPageData();
......@@ -390,6 +391,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => {
type: 'error',
message: res.msg,
})
tableInfo.value.loading = false
}
}).finally(() => loading.value = false)
}
......
......@@ -15,7 +15,8 @@ import { download } from '@/utils/common'
import { getParamsList } from '@/api/modules/dataAsset'
import { getStandardCodeList, saveStandardCode,
updateStandardCode, getStandardCodeDetail,
deleteStandardCode, getStandardCodeStandard, exportStandardCodeData
deleteStandardCode, getStandardCodeStandard, exportStandardCodeData,
getStandardCodeDataList
} from '@/api/modules/dataMetaService'
import {
addDictionary,
......@@ -165,7 +166,7 @@ const formItems: any = ref([
placeholder: '请输入',
field: 'codeName',
default: '',
maxlength: 20,
maxlength: 30,
clearable: true,
required: true
},
......@@ -185,7 +186,7 @@ const formItems: any = ref([
placeholder: '请输入',
field: 'standardName',
default: '',
maxlength: 20,
maxlength: 30,
clearable: true,
required: true
},
......@@ -634,9 +635,10 @@ const getTableData = (params) => {
if (res.code === proxy.$passCode) {
let data = res.data
let list = res.data.records || []
list = list.map(item => {
list = list.map((item,index) => {
item.label = item.codeName
item.value = item.guid
item.index = index
return item
})
tableInfo.value.data = list
......@@ -651,6 +653,7 @@ const getTableData = (params) => {
};
const tableSelectionChange = (val, tId) => {
val.sort((pre, cur) => pre.index - cur.index)
if (drawerInfo.value.visible) {
if (formItems.value.length == 2) {
uploadSelectRowData.value = val
......@@ -774,7 +777,7 @@ const toolBtnClick = (btn, data) => {
if (drawerInfo.value.type == 'edit') {
const editRows = formTableSelectRowData.value.filter(item => item.guid !== undefined)
if (editRows.length) {
formTable.value.tableInfo.loading = true
// formTable.value.tableInfo.loading = true
checkDelete().then((res: any) => {
if (res) {
ElMessageBox.confirm("数据字典有数据, 确定是否继续删除?", "提示", {
......@@ -787,7 +790,7 @@ const toolBtnClick = (btn, data) => {
} else {
removeRows()
}
formTable.value.tableInfo.loading = false
// formTable.value.tableInfo.loading = false
}).catch(xhr => {
ElMessage({
type: 'error',
......@@ -883,6 +886,9 @@ const tableBtnClick = (scope, btn) => {
let data = res.data
currTableData.value = data;
setDetailInfo(type)
checkDelete().then((res:any) => {
formItems.value.find(v => v.field === 'typeCode')['disabled'] = res ? true : false
})
} else {
ElMessage({
type: "error",
......@@ -895,9 +901,30 @@ const tableBtnClick = (scope, btn) => {
formTable.value.tableInfo.loading = false
drawerInfo.value.loading = false;
})
// 代码有数据后不允许编辑代码类型
} else if (type === 'remove') {
const existIndex = formTableData.value.findIndex(s => s.ROWID == row.ROWID)
existIndex > -1 && formTableData.value.splice(existIndex, 1)
let removeRows = () => {
const existIndex = formTableData.value.findIndex(s => s.ROWID == row.ROWID)
existIndex > -1 && formTableData.value.splice(existIndex, 1)
}
if (drawerInfo.value.type == 'edit') {
checkDelete().then((res:any) => {
if (res) {
ElMessageBox.confirm("标准代码有数据, 确定是否继续删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: 'warning',
}).then(() => {
removeRows()
})
} else {
removeRows()
}
})
} else {
removeRows()
}
}
else if (type == "delete") {
currTableData.value = row;
......@@ -917,50 +944,27 @@ const tableBtnClick = (scope, btn) => {
}
const checkDelete = (isBatch: any = false) => {
if (drawerInfo.value.visible) {
return new Promise((resolve, reject) => {
let params: any = {
guid: currTableData.value.guid
}
checkDeleteDictionaryScheme(params).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data
resolve(data)
return new Promise((resolve, reject) => {
let params: any = {
pageIndex: 1,
pageSize: -1,
standardGuid: currTableData.value.guid
}
getStandardCodeDataList(params).then((res: any) => {
if (res.code == proxy.$passCode) {
if (res.data.records.length) {
resolve(res.data)
} else {
reject(res.msg)
resolve(null)
}
}).catch((xhr: any) => {
reject(xhr.msg)
})
})
} else {
return new Promise((resolve, reject) => {
let guids = [currTableData.value.guid]
if (isBatch) {
guids = selectRowData.value
} else {
reject(res.msg)
}
checkDeleteDictionary(guids).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data ?? {}
if (data.used) {
resolve({
used: true,
data: data.used
})
} else {
resolve({
used: false,
data: data.unuse
})
}
} else {
reject(res.msg)
}
}).catch((xhr: any) => {
reject(xhr.msg)
})
}).catch((xhr: any) => {
reject(xhr.msg)
})
}
})
}
const open = (msg, type, isBatch = false) => {
......@@ -1120,11 +1124,16 @@ const loadDrawer = async () => {
item.default = 'Y'
} else if (item.field === 'typeCode') {
item.default = '1'
} else {
} else if (item.field === 'hierarchy') {
item.default = ''
item.visible = false
}
else {
item.default = ''
}
item.disabled = false
})
formInfo.value.formInfo.items = formItems.value
formTableData.value = JSON.parse(JSON.stringify(orginData))
formTable.value.tableInfo.data = formTableData.value
......@@ -1374,11 +1383,7 @@ const scrollTable = (rowInfo) => {
const drawerBtnClick = (btn, info) => {
console.log('btn', btn, info)
console.log('table', formTable.value)
let uniqFieldNameList = Array.from(new Set(formTable.value.tableInfo.data.map(item => item.fieldName)))
if (uniqFieldNameList.length !== formTable.value.tableInfo.data.length) {
ElMessage.error('表结构字段名称需唯一,不允许重名')
return
}
let params = {
standardCodeFields: formTable.value.tableInfo.data.map(item => {
let obj = {
......@@ -1397,6 +1402,22 @@ const drawerBtnClick = (btn, info) => {
params.guid = currTableData.value.guid
}
if (btn.value == 'submit' || btn.value == 'saveAndAdd') {
let uniqFieldNameList = Array.from(new Set(formTable.value.tableInfo.data.map(item => item.fieldName)))
if (uniqFieldNameList.length !== formTable.value.tableInfo.data.length) {
ElMessage.error('表结构字段名称需唯一,不允许重名')
return
}
let standardCodeFields = params.standardCodeFields.map(v => v.fieldName).join()
let codeFieldName = params.codeFieldName
let codeFields = params.codeFields
let fieldValidate = false
if (standardCodeFields.includes(codeFieldName) && codeFields.every(v => standardCodeFields.includes(v))) {
fieldValidate = true
}
if (!fieldValidate) {
ElMessage.error('所选的编码字段和编码名称必须在字段名称中有')
return
}
drawerInfo.value.footer.btns.map((item: any) => item.disabled = true)
saveData(params,btn.value)
} else {
......@@ -1434,6 +1455,7 @@ onBeforeMount(() => {
getStandardCodeList(params).then((res:any) => {
if (res.code === proxy.$passCode) {
let data = res.data
data.records && data.records.forEach((item,index) => item.index = index)
tableInfo.value.data = data.records
tableInfo.value.page.limit = data.pageSize
tableInfo.value.page.curr = data.pageIndex
......@@ -1469,7 +1491,7 @@ onMounted(() => {
<el-button @click="batching('delete')" v-preReClick>批量删除</el-button>
<el-button @click="batching('export')" v-preReClick>批量导入</el-button>
</div>
<el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入代码名称搜索"
<el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入关键字搜索"
:suffix-icon="Search" clearable @change="val => getFirstPageData()" />
</div>
<div class="table_panel_wrap full">
......
......@@ -120,7 +120,7 @@ const uploadInfo = ref({
const dialogInfo: any = ref({
visible: false,
size: 700,
size: 560,
direction: "column",
header: {
title: "新建",
......@@ -265,7 +265,7 @@ const batching = (type) => {
if (type == 'import') {
dialogInfo.value.header.title = '导入数据'
dialogInfo.value.type = 'upload'
dialogInfo.value.size = 640
dialogInfo.value.size = 560
uploadFiles.value = []
// if (tabsActiveName.value == 'field' || tabsActiveName.value == 'naming') {
// uploadSteps.value[0].selectInfo.options = standardSetList.value
......@@ -291,7 +291,7 @@ const batching = (type) => {
if (isfileImport == '2' || isfileImport == '4') {
dialogInfo.value.header.title = '导入数据'
dialogInfo.value.type = 'upload'
dialogInfo.value.size = isfileImport == '4' ? 600 : 500;
dialogInfo.value.size = isfileImport == '4' ? 560 : 560;
uploadFiles.value = []
uploadInfo.value.uploadInfo.steps = uploadSteps.value
const content: any = [uploadInfo.value]
......@@ -516,9 +516,9 @@ onActivated(() => {
</div>
<Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @onUpload="onUpload" @uploadBtnClick="uploadBtnClick"
@cascaderChange="cascaderChange" @selectChange="selectChange">
<div>
<div style="overflow: auto;">
<div class="title" style="color:#333;margin:20px 0 10px">2、导入前请先导入文件的sheet与标准做对应</div>
<el-table :data="uploadSetting">
<el-table :data="uploadSetting" border height="310">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column label="代码名称" prop="standardName"></el-table-column>
<el-table-column label="选择sheet页">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!