主数据修改、数据源、显示字段

This commit is contained in:
hyt 2024-06-14 15:43:44 +08:00
parent bec344f49d
commit 10454298c7
1 changed files with 169 additions and 158 deletions

View File

@ -45,14 +45,14 @@
<!-- 编码--> <!-- 编码-->
<template v-slot:argName="{ row }"> <template v-slot:argName="{ row }">
<div style="width: 100%"> <div style="width: 100%">
{{row.argName}} {{ row.argName }}
</div> </div>
</template> </template>
<template v-slot:argValue="{ row }"> <template v-slot:argValue="{ row }">
<div style="width: 100%"> <div style="width: 100%">
<!-- 若参数类型为1 字符串 否则为2 日期--> <!-- 若参数类型为1 字符串 否则为2 日期-->
<template v-if="row.argType==1"> <template v-if="row.argType==1">
<template v-if="!submitShow">{{row.argValue}}</template> <template v-if="!submitShow">{{ row.argValue }}</template>
<el-input <el-input
v-else v-else
v-model="row.argValue" v-model="row.argValue"
@ -61,9 +61,9 @@
:disabled="!submitShow" :disabled="!submitShow"
></el-input> ></el-input>
</template> </template>
<!-- 日期选择器--> <!-- 日期选择器-->
<template v-else-if="row.argType==2"> <template v-else-if="row.argType==2">
<template v-if="!submitShow">{{row.startDate}}/{{row.endDate}}</template> <template v-if="!submitShow">{{ row.startDate }}/{{ row.endDate }}</template>
<template v-else> <template v-else>
<el-date-picker <el-date-picker
v-model="row.startDate" v-model="row.startDate"
@ -71,7 +71,8 @@
placeholder="选择开始日期" placeholder="选择开始日期"
:disabled="!submitShow" :disabled="!submitShow"
format="yyyy 年 MM 月 dd 日" format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"> value-format="yyyy-MM-dd"
>
</el-date-picker> </el-date-picker>
<el-date-picker <el-date-picker
v-model="row.endDate" v-model="row.endDate"
@ -79,13 +80,14 @@
placeholder="选择结束日期" placeholder="选择结束日期"
:disabled="!submitShow" :disabled="!submitShow"
format="yyyy 年 MM 月 dd 日" format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"> value-format="yyyy-MM-dd"
>
</el-date-picker> </el-date-picker>
</template> </template>
</template> </template>
<!-- 年月--> <!-- 年月-->
<template v-else-if="row.argType==3"> <template v-else-if="row.argType==3">
<template v-if="!submitShow">{{row.argValue}}</template> <template v-if="!submitShow">{{ row.argValue }}</template>
<template v-else> <template v-else>
<el-date-picker <el-date-picker
v-model="row.argValue" v-model="row.argValue"
@ -93,13 +95,14 @@
placeholder="年月" placeholder="年月"
:disabled="!submitShow" :disabled="!submitShow"
format="yyyy 年 MM 月" format="yyyy 年 MM 月"
value-format="yyyy-MM"> value-format="yyyy-MM"
>
</el-date-picker> </el-date-picker>
</template> </template>
</template> </template>
<!-- 年月日--> <!-- 年月日-->
<template v-else-if="row.argType==4"> <template v-else-if="row.argType==4">
<template v-if="!submitShow">{{row.argValue}}</template> <template v-if="!submitShow">{{ row.argValue }}</template>
<template v-else> <template v-else>
<el-date-picker <el-date-picker
v-model="row.argValue" v-model="row.argValue"
@ -107,19 +110,21 @@
placeholder="年月日" placeholder="年月日"
:disabled="!submitShow" :disabled="!submitShow"
format="yyyy 年 MM 月 DD 日" format="yyyy 年 MM 月 DD 日"
value-format="yyyy-MM-DD"> value-format="yyyy-MM-DD"
>
</el-date-picker> </el-date-picker>
</template> </template>
</template> </template>
<!-- 年月日时间--> <!-- 年月日时间-->
<template v-else-if="row.argType==5"> <template v-else-if="row.argType==5">
<template v-if="!submitShow">{{row.argValue}}</template> <template v-if="!submitShow">{{ row.argValue }}</template>
<template v-else> <template v-else>
<el-date-picker <el-date-picker
v-model="row.argValue" v-model="row.argValue"
type="datetime" type="datetime"
placeholder="年月日时间" placeholder="年月日时间"
:disabled="!submitShow"> :disabled="!submitShow"
>
</el-date-picker> </el-date-picker>
</template> </template>
</template> </template>
@ -135,7 +140,7 @@
</template> </template>
<template v-slot:remark="{ row }"> <template v-slot:remark="{ row }">
<div style="width: 100%"> <div style="width: 100%">
<template v-if="!submitShow">{{row.remark}}</template> <template v-if="!submitShow">{{ row.remark }}</template>
<el-input <el-input
v-else v-else
v-model="row.remark" v-model="row.remark"
@ -163,12 +168,13 @@
</template> </template>
<script> <script>
import baseRightDialog from "@/components/base/baseRightDialog"; import baseRightDialog from '@/components/base/baseRightDialog'
import baseNewSelect from "./baseNewSelect.vue" import baseNewSelect from './baseNewSelect.vue'
import baseForm from "@/components/base/baseNewForm"; import baseForm from '@/components/base/baseNewForm'
import baseTable from "@/components/base/baseTable"; import baseTable from '@/components/base/baseTable'
import configData from "./configData"; import configData from './configData'
import { authApi } from "@/api/apis/auth"; import { authApi } from '@/api/apis/auth'
export default { export default {
components: { components: {
baseRightDialog, baseRightDialog,
@ -179,8 +185,8 @@ export default {
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
dialogTitle: "", dialogTitle: '',
dialogType: "", dialogType: '',
formRow: configData.formRow, formRow: configData.formRow,
basicsRules: configData.basicsRules, basicsRules: configData.basicsRules,
vLoading: false, vLoading: false,
@ -191,75 +197,75 @@ export default {
tableVersionColumn: configData.tableVersionColumn, tableVersionColumn: configData.tableVersionColumn,
funData: [], funData: [],
isEdit: false, isEdit: false,
select_dist:{}, select_dist: {},
plugNameOptions:[], plugNameOptions: [],
tableColumn:configData.operationTableColumn,// tableColumn: configData.operationTableColumn,//
tableData:[], tableData: []
}; }
}, },
mounted() { mounted() {
this.initSelect() this.initSelect()
}, },
methods: { methods: {
// //
async initSelect(){ async initSelect() {
let res = await authApi( let res = await authApi(
"pluginService", 'pluginService',
"plugins", 'plugins',
"queryPlugins", 'queryPlugins',
"", '',
{ {
"pluginType": "1" 'pluginType': '1'
} }
); )
if(res.status == 200){ if (res.status == 200) {
console.log(res.attribute) console.log(res.attribute)
res.attribute.forEach(item=>{ res.attribute.forEach(item => {
this.$set(this.select_dist,item.pluginId,item) this.$set(this.select_dist, item.pluginId, item)
}) })
this.formRow[0].elCol[0].options = res.attribute this.formRow[0].elCol[0].options = res.attribute
} }
}, },
// //
selectChangeHandle(val, options){ selectChangeHandle(val, options) {
if(!val){ if (!val) {
this.tableVersionData=[] this.tableVersionData = []
return return
} }
// //
let obj = options.find(item=>{ let obj = options.find(item => {
return item.plugName === val return item.plugName === val
}) })
console.log(obj) console.log(obj)
this.$set(this.$refs.basicsForm.ruleForm,'plugId',obj.plugId) this.$set(this.$refs.basicsForm.ruleForm, 'plugId', obj.plugId)
this.$set(this.$refs.basicsForm.ruleForm,'plugName',obj.plugName) this.$set(this.$refs.basicsForm.ruleForm, 'plugName', obj.plugName)
this.searchInfo(obj.plugId) this.searchInfo(obj.plugId)
}, },
// //
async searchInfo(plugId){ async searchInfo(plugId) {
let params = { let params = {
plugId plugId
}; }
let res = await authApi( let res = await authApi(
"sysPlugArgService", 'sysPlugArgService',
"integrationTaskService", 'integrationTaskService',
"getPlugArgByPlugId", 'getPlugArgByPlugId',
"", '',
params params
); )
console.log(res,'res') console.log(res, 'res')
if(res.status ==200){ if (res.status == 200) {
// //
let arr = [] let arr = []
res.attribute.forEach(item=>{ res.attribute.forEach(item => {
arr.push({ arr.push({
startDate:"", startDate: '',
endDate:"", endDate: '',
remark:"", remark: '',
argValue:"", argValue: '',
argName:item.argName, argName: item.argName,
argCode:item.argCode, argCode: item.argCode,
argType:item.argType, argType: item.argType
}) })
}) })
@ -268,71 +274,71 @@ export default {
}, },
openDialog(type, row) { openDialog(type, row) {
// this.queryProductClassfy(); // this.queryProductClassfy();
this.formRow = configData.formRow; this.formRow = configData.formRow
this.submitShow = true; this.submitShow = true
this.isEdit = false this.isEdit = false
this.funData = [] this.funData = []
// //
if (type == "add") { if (type == 'add') {
this.dialogTitle = "新增"; this.dialogTitle = '新增'
this.dialogType = "add"; this.dialogType = 'add'
} }
// //
if (type == "edit") { if (type == 'edit') {
this.isEdit = true this.isEdit = true
this.dialogTitle = "编辑"; this.dialogTitle = '编辑'
this.dialogType = "edit"; this.dialogType = 'edit'
this.productGetById(row.id); this.productGetById(row.id)
} }
// //
if (type == "show") { if (type == 'show') {
this.funData = Object.assign([],[]) this.funData = Object.assign([], [])
this.submitShow = false; this.submitShow = false
this.formRow = configData.formRowShow; this.formRow = configData.formRowShow
this.dialogTitle = "查看"; this.dialogTitle = '查看'
this.dialogType = "show"; this.dialogType = 'show'
this.productGetById(row.id); this.productGetById(row.id)
} }
this.dialogVisible = true; this.dialogVisible = true
}, },
// //
async productGetById(id) { async productGetById(id) {
let params = { let params = {
id: id, id: id
}; }
let res = await authApi( let res = await authApi(
"sysIntegratedForegroundTaskService", 'sysIntegratedForegroundTaskService',
"integrationTaskService", 'integrationTaskService',
"getIntegratedForegroundTask", 'getIntegratedForegroundTask',
"", '',
params params
); )
if (res.status == "200") { if (res.status == '200') {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.basicsForm.incomingParameters(res.attribute); this.$refs.basicsForm.incomingParameters(res.attribute)
this.tableVersionData=res.attribute.sysIntegratedForegroundTaskDetailEntityList this.tableVersionData = res.attribute.sysIntegratedForegroundTaskDetailEntityList
this.tableVersionData.forEach(item=>{ this.tableVersionData.forEach(item => {
if(item.argType ==2){ if (item.argType == 2) {
// //
this.$set(item,'startDate',item.argValue.split("/")[0]) this.$set(item, 'startDate', item.argValue.split('/')[0])
this.$set(item,'endDate',item.argValue.split("/")[1]) this.$set(item, 'endDate', item.argValue.split('/')[1])
} }
}) })
this.tableData=res.attribute.sysIntegratedForegroundTaskParameterEntities this.tableData = res.attribute.sysIntegratedForegroundTaskParameterEntities
// let result = []; // let result = [];
// this.tableVersionData = Object.assign([], result); // this.tableVersionData = Object.assign([], result);
}); })
} }
}, },
addVersionDialog() { addVersionDialog() {
let obj = { let obj = {
argName:"", argName: '',
argCode:"", argCode: '',
argType:"1", argType: '1',
remark:"", remark: ''
}; }
this.tableVersionData.push(obj); this.tableVersionData.push(obj)
}, },
// //
onFunc(index, row) { onFunc(index, row) {
@ -340,109 +346,114 @@ export default {
this.$delConfirm().then(() => { this.$delConfirm().then(() => {
this.tableVersionData.forEach((item, itemIndex) => { this.tableVersionData.forEach((item, itemIndex) => {
if (item.id === row.id) { if (item.id === row.id) {
this.tableVersionData.splice(itemIndex, 1); this.tableVersionData.splice(itemIndex, 1)
} }
}); })
}); })
} }
}, },
// //
handleDialogClose() { handleDialogClose() {
this.tableVersionData = Object.assign([], []); this.tableVersionData = Object.assign([], [])
this.$refs.basicsForm.resetFields(); this.$refs.basicsForm.resetFields()
this.dialogVisible = false; this.dialogVisible = false
}, },
// //
handleConfirmClick() { handleConfirmClick() {
this.$refs.basicsForm.$refs["ruleForm"].validate((valid) => { this.$refs.basicsForm.$refs['ruleForm'].validate((valid) => {
if (!valid) { if (!valid) {
return; return
} else { } else {
let flag = this.tableVersionData.some((item,index)=>{ let flag = this.tableVersionData.some((item, index) => {
// 2024-12-13/2024-12-14 // 2024-12-13/2024-12-14
if(item.argType ==2){ if (item.argType == 2) {
// //
let startDate = new Date(item.startDate); // if (item.startDate && item.endDate && item.endDate !== 'null' && item.startDate !== 'null') {
let endDate = new Date(item.endDate); // let startDate = new Date(item.startDate) //
if(startDate > endDate){ let endDate = new Date(item.endDate) //
this.$vmNews(`${index+1}行结束时间不能大于开始时间`) if (startDate > endDate) {
return true this.$vmNews(`${index + 1}行结束时间不能大于开始时间`)
return true
}
this.$set(item, 'argValue', item.startDate + '/' + item.endDate)
} else {
this.$set(item, 'argValue', null)
} }
this.$set(item,'argValue',item.startDate + "/" +item.endDate)
} }
}) })
if(flag) return if (flag) return
let params = { let params = {
...this.$refs.basicsForm.ruleForm, ...this.$refs.basicsForm.ruleForm,
sysIntegratedForegroundTaskDetailEntityList: this.tableVersionData, sysIntegratedForegroundTaskDetailEntityList: this.tableVersionData
};
if (this.dialogType == "add") {
this.openLoading("submit");
this.productSaveDto(params);
} }
if (this.dialogType == "edit") { if (this.dialogType == 'add') {
this.openLoading("submit"); this.openLoading('submit')
this.productUpdateDto(params); this.productSaveDto(params)
}
if (this.dialogType == 'edit') {
this.openLoading('submit')
this.productUpdateDto(params)
} }
} }
}); })
}, },
// //
async productSaveDto(params) { async productSaveDto(params) {
let res = await authApi( let res = await authApi(
"sysIntegratedForegroundTaskService", 'sysIntegratedForegroundTaskService',
"integrationTaskService", 'integrationTaskService',
"saveIntegratedForegroundTask", 'saveIntegratedForegroundTask',
"", '',
params params
); )
if (res.status == "200") { if (res.status == '200') {
this.handleDialogClose(); this.handleDialogClose()
this.$vmNews("新增成功", "success"); this.$vmNews('新增成功', 'success')
this.$emit("resetTable"); this.$emit('resetTable')
} }
}, },
// //
async productUpdateDto(params) { async productUpdateDto(params) {
let res = await authApi( let res = await authApi(
"sysIntegratedForegroundTaskService", 'sysIntegratedForegroundTaskService',
"integrationTaskService", 'integrationTaskService',
"updateIntegratedForegroundTask", 'updateIntegratedForegroundTask',
"", '',
params params
); )
if (res.status == "200") { if (res.status == '200') {
this.handleDialogClose(); this.handleDialogClose()
this.$vmNews("更新成功", "success"); this.$vmNews('更新成功', 'success')
this.$emit("resetTable"); this.$emit('resetTable')
} }
}, },
// //
async queryProductClassfy() { async queryProductClassfy() {
let params = { let params = {
tab_name: "sys_product", tab_name: 'sys_product',
column_name: "classify", column_name: 'classify'
};
let res = await authApi(
"generalServiceImpl",
"dictionaryshop",
"selectDictionaryshop",
"",
params
);
if (res.status == "200") {
this.formRow[1].elCol[0].options = res.attribute;
} }
}, let res = await authApi(
}, 'generalServiceImpl',
}; 'dictionaryshop',
'selectDictionaryshop',
'',
params
)
if (res.status == '200') {
this.formRow[1].elCol[0].options = res.attribute
}
}
}
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.small_title{ .small_title {
margin: 10px 0; margin: 10px 0;
font-size: 16px; font-size: 16px;
} }
.dialogList { .dialogList {
padding: 16px 0; padding: 16px 0;
border-top: 1px solid #dcdfe6; border-top: 1px solid #dcdfe6;