Commit bf4c6742 authored by 王纵's avatar 王纵

表格增加数据更新功能

parent 73e66523
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-21 15:44:04
* @LastEditTime: 2024-08-21 17:34:41
* @Version: 1.0.0
* @Description: 动态渲染-附件组件
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -190,6 +190,7 @@ export default {
color: #383F45;
}
.file-info {
margin-top: 6px;
font-family: PingFangSC-Regular;
font-size: 12px;
color: #33333350;
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-20 22:56:42
* @LastEditTime: 2024-08-21 17:36:07
* @Version: 1.0.0
* @Description: 表格渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -93,7 +93,7 @@ import DTitle from '../DTitle';
import DForm from '../DForm';
import DTableTd from './DTableTd.jsx';
import { Checkbox, CheckboxGroup, Popup, Button, Icon, Toast } from 'vant';
import {getTableData, saveTableRecord, deleteTableRecords} from '../../service';
import {getTableData, saveTableRecord, deleteTableRecords, updateTableRecord} from '../../service';
import {getDataSetName, dateFormat} from '../../utils/utils';
import EventBus from '../../utils/eventBus';
......@@ -238,9 +238,19 @@ export default {
}
return val;
},
async saveRecord() {
async saveRecord() { //表格数据保存
const {allValues} = await this.$refs.dformRef.validate();
saveTableRecord(this.tabInfo.createUrl, [{...allValues, ...this.dynamicConfigInfo.queryParams}]).then(() => {
let method = saveTableRecord; // 默认新增
let url = this.tabInfo.createUrl;
const data = [{
...allValues,
...this.dynamicConfigInfo.queryParams
}]
if(allValues._status === 'update') { // 更新
url = this.tabInfo.updateUrl
method = updateTableRecord;
}
method(url, data).then(() => {
this.visible = false;
Toast.success('保存成功!');
this.init();
......@@ -268,17 +278,17 @@ export default {
this.showRecord({}, -1);
break;
case 'query':
console.log('查询')
break;
case 'export':
console.log('导出')
this.refresh();
break;
// case 'export':
// console.log('导出')
// break;
case 'remove':
this.deleteRecords();
break;
case 'save':
console.log('保存')
break;
// case 'save':
// console.log('保存')
// break;
default:
}
}
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-09 10:54:02
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-21 15:38:30
* @LastEditTime: 2024-08-21 17:35:15
* @Version: 1.0.0
* @Description: 页面配置请求
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -82,6 +82,11 @@ export function saveTableRecord(url, params) {
return hlsHttp.post(url, params);
}
// 表格单条数据更新
export function updateTableRecord(url, params) {
return hlsHttp.put(url, params);
}
// 表格删除
export function deleteTableRecords(destroyUrl, dataSetName, params) {
const url = destroyUrl ||
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-16 09:39:36
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-21 17:03:39
* @LastEditTime: 2024-08-21 17:37:33
* @Version: 1.0.0
* @Description: 商机维护详情
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -19,9 +19,14 @@
ref="dynamicRef"
/>
<van-popup v-model="show" style="width: 100%; height: 50%">
<DAttachment
<van-popup
v-model="show"
style="width: 100%; height: 50%; padding: 15px; box-sizing: border-box;"
position="bottom"
closeable
>
<div style="text-align: center;margin-bottom: 15px">附件信息</div>
<DAttachment
:isNew="false"
:attachmentUuid="attachmentRecord.attachmentUuid"
bucketName="spfm-comp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment