Skip to content

Commit e4ccc33

Browse files
committed
完善文档
1 parent b472d7a commit e4ccc33

File tree

4 files changed

+180
-102
lines changed

4 files changed

+180
-102
lines changed

Vol.Vue/src/extension/order/SellOrder.js

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ let extension = {
9898
},//扩展的按钮
9999
methods: {
100100
//扩展方法使用示例,根据需要实行下面的方法
101-
getServiceDate () {
101+
getServiceDate() {
102102
this.http.post("/api/SellOrder/getServiceDate", {}, '正在调用后台数据').then(date => {
103103
this.$message.error("从后台获取的服务器时间是:" + date);
104104
})
105105
},
106-
mounted () {
106+
mounted() {
107107

108108
// this.$Notice.success({ title: '执行mounted方法' });
109109
},
110110
//方式1,通过select选择触发显示与隐藏
111-
onInit () {
111+
onInit() {
112112
//获取订单类型select配置,当前订单类型select改变值时,动态设置Remark,SellNo两个字段是否显示
113113
var orderTypeOption = this.getFormOption("OrderType");
114114
orderTypeOption.onChange = (val) => {
@@ -159,7 +159,7 @@ let extension = {
159159
this.tableMaxHeight = 300;
160160
this.$Notice.success({ title: 'create方法执行时,你可以此处编写业务逻辑' });
161161
},
162-
onInited () {
162+
onInited() {
163163
//设置主表求字段,后台需要实现SummaryExpress方法
164164
this.columns.forEach(x => {
165165
if (x.field == 'Qty') {
@@ -174,25 +174,25 @@ let extension = {
174174
})
175175
// this.$Notice.success({ title: 'create方法执行后', desc: '你可以SellOrder.js中编写业务逻辑,其他方法同样适用' });
176176
},
177-
searchBefore (param) { //查询ViewGird表数据前,param查询参数
177+
searchBefore(param) { //查询ViewGird表数据前,param查询参数
178178
//你可以指定param查询的参数,处如果返回false,则不会执行查询
179179
// this.$Notice.success({ title: this.table.cnName + ',查询前' });
180180
// console.log("扩展的"this.detailOptions.cnName + '触发loadDetailTableBefore');
181181
return true;
182182
},
183-
searchAfter (result) { //查询ViewGird表数据后param查询参数,result回返查询的结果
183+
searchAfter(result) { //查询ViewGird表数据后param查询参数,result回返查询的结果
184184
this.$Notice.success({ title: this.table.cnName + ',查询结果', desc: '返回的对象:' + JSON.stringify(result) });
185185
return true;
186186
},
187-
searchDetailBefore (param) {//查询从表表数据前,param查询参数
187+
searchDetailBefore(param) {//查询从表表数据前,param查询参数
188188
// this.$Notice.success({ title: this.detailOptions.cnName + '查询前' });
189189
return true;
190190
},
191-
searchDetailAfter (data) {//查询从表后param查询参数,result回返查询的结果
191+
searchDetailAfter(data) {//查询从表后param查询参数,result回返查询的结果
192192
this.$Notice.success({ title: this.detailOptions.cnName + ',查询结果', desc: '返回的对象:' + JSON.stringify(data) });
193193
return true;
194194
},
195-
delBefore (ids, rows) { //查询界面的表删除前 ids为删除的id数组,rows删除的行
195+
delBefore(ids, rows) { //查询界面的表删除前 ids为删除的id数组,rows删除的行
196196
let auditStatus = rows.some(x => { return x.AuditStatus > 0 });
197197
if (auditStatus) {
198198
this.$message.error('只能删除未审核的数据')
@@ -201,14 +201,14 @@ let extension = {
201201
this.$Notice.success({ title: '删除前,选择的Id:' + ids.join(',') });
202202
return true;
203203
},
204-
delAfter (result) {//查询界面的表删除后
204+
delAfter(result) {//查询界面的表删除后
205205
return true;
206206
},
207-
delDetailRow (rows) { //弹出框删除明细表的行数据(只是对table操作,并没有操作后台)
207+
delDetailRow(rows) { //弹出框删除明细表的行数据(只是对table操作,并没有操作后台)
208208
console.log(rows)
209209
return true;
210210
},
211-
addBefore (formData) { //新建保存前formData为对象,包括明细表
211+
addBefore(formData) { //新建保存前formData为对象,包括明细表
212212
//formData格式:
213213
// {
214214
// mainData: { 主表字段1: 'x1', 主表字段2: 'x2' },
@@ -223,7 +223,7 @@ let extension = {
223223
this.$Notice.success({ title: this.detailOptions.cnName + '新建前:', desc: '提前的数据:' + JSON.stringify(formData) });
224224
return true;
225225
},
226-
async addBeforeAsync (formData) {
226+
async addBeforeAsync(formData) {
227227
//2020.12.06增加新建前异步方法同步处理
228228
//功能同上,区别在于此处可以做一些异步请求处理,全:
229229
// var _result = await this.http.post("/api/SellOrder/getPageData", {}, true).then(result => {
@@ -233,11 +233,11 @@ let extension = {
233233
// console.log("2、异步请求,同步处理结果:" + JSON.stringify(_result))
234234
return true;
235235
},
236-
addAfter (result) {//新建保存后result返回的状态及表单对象
236+
addAfter(result) {//新建保存后result返回的状态及表单对象
237237
this.$Notice.success({ title: this.detailOptions.cnName + '新建完成后:', desc: '返回的数据' + JSON.stringify(result) });
238238
return true;
239239
},
240-
updateBefore (formData) { //编辑保存前formData为对象,包括明细表、删除行的Id
240+
updateBefore(formData) { //编辑保存前formData为对象,包括明细表、删除行的Id
241241
//formData格式:(自己调试出输看)
242242
// {
243243
// mainData: { 主表字段1: 'x1', 主表字段2: 'x2' },
@@ -255,7 +255,7 @@ let extension = {
255255
console.log(this.$refs.modelFooter.text)
256256
return true;
257257
},
258-
async updateBeforeAsync (formData) {
258+
async updateBeforeAsync(formData) {
259259
//2020.12.06增加修改前异步方法同步处理
260260
//功能同上,区别在于此处可以做一些异步请求处理,全:
261261
var _result = await this.http.post("/api/SellOrder/getPageData", {}, true).then(result => {
@@ -265,54 +265,71 @@ let extension = {
265265
console.log("2、异步请求,同步处理结果:" + JSON.stringify(_result))
266266
return true;
267267
},
268-
updateAfter (result) {//编辑保存后result返回的状态及表单对象
268+
updateAfter(result) {//编辑保存后result返回的状态及表单对象
269269
this.$Notice.success({ title: this.detailOptions.cnName + '编辑完成后:', desc: '返回的数据' + JSON.stringify(result) });
270270
return true;
271271
},
272-
auditBefore (ids, rows) {//审核前
272+
auditBefore(ids, rows) {//审核前
273273
if (rows.length > 2) {//每次最多只能审核2条数据
274274
this.$message.error('最多只能选择两条数据');
275275
return false;
276276
}
277277
return true;
278278
},
279-
auditAfter (result, rows) {// 审核后
279+
auditAfter(result, rows) {// 审核后
280280
if (result.status) {
281281
result.message = "审核成功。。。。。" + result.message;
282282
}
283283
return true;
284284
},
285-
resetAddFormBefore () { //重置新建表单前的内容
285+
resetAddFormBefore() { //重置新建表单前的内容
286286
return true;
287287
},
288-
resetAddFormAfter () { //重置新建表单后的内容
288+
resetAddFormAfter() { //重置新建表单后的内容
289289
//如果某些字段不需要重置,则可以重新赋值
290290
this.editFormFileds.Remark = '新建重置默认值66666';
291291
//给明细表添加默认一行
292292
this.$refs.detail.rowData.push({ Remark: "新建666666" });
293293
return true;
294294
},
295-
resetUpdateFormBefore () { //重置编辑表单前的内容
295+
resetUpdateFormBefore() { //重置编辑表单前的内容
296296
//this.editFormFileds当前值
297297
console.log(this.editFormFileds)
298298
//当前明细表的行
299299
console.log(this.$refs.detail.rowData)
300300
return true;
301301
},
302-
resetUpdateFormAfter () { //重置编辑表单后的内容
302+
resetUpdateFormAfter() { //重置编辑表单后的内容
303303
//如果某些字段不需要重置,则可以重新赋值
304304
this.editFormFileds.Remark = '编辑重置默认值66666';
305305
//给明细表添加默认一行
306306
this.$refs.detail.rowData.push({ Remark: "编辑666666" });
307307
return true;
308308
},
309-
importAfter (data) { //导入excel后刷新table表格数据
309+
importAfter(data) { //导入excel后刷新table表格数据
310310
this.search(); //刷新table
311311
},
312-
modelOpenBefore (row) { //点击编辑/新建按钮弹出框前,可以在此处写逻辑,如,从后台获取数据
312+
modelOpenBefore(row) { //点击编辑/新建按钮弹出框前,可以在此处写逻辑,如,从后台获取数据
313313

314314
},
315-
getFormOption (field) {
315+
async modelOpenBeforeAsync(row) { //点击编辑/新建按钮弹出框前,可以在此处写逻辑,如,从后台获取数据
316+
//2021.01.10
317+
if(row){
318+
console.log("编辑操作")
319+
}else{
320+
console.log("新建操作")
321+
}
322+
//打开弹出框前,http请求同步执行
323+
// var _result = await this.http.post("url", {}, true).then(result => {
324+
325+
// _result = result;
326+
// })
327+
// console.log(result);
328+
//返回false不会弹出框
329+
//this.$message.error("不能打开弹出框 ");
330+
return true;
331+
},
332+
getFormOption(field) {
316333
let option;
317334
this.editFormOptions.forEach(x => {
318335
x.forEach(item => {
@@ -325,7 +342,7 @@ let extension = {
325342
},
326343

327344
//方式2,通过打开弹出框时触发显示与隐藏
328-
modelOpenAfter (row) { //编辑或新建时,根据不同的情况控制字段是否显示
345+
modelOpenAfter(row) { //编辑或新建时,根据不同的情况控制字段是否显示
329346
// this.editFormOptions.forEach(x => {
330347
// x.forEach(item => {
331348
// if (item.field == "Remark" || item.field == "SellNo") {
@@ -336,7 +353,7 @@ let extension = {
336353
// })
337354
// })
338355
},
339-
rowClick ({ row, column, event }) { //查询界面table点击行选中当前行
356+
rowClick({ row, column, event }) { //查询界面table点击行选中当前行
340357
this.$refs.table.$refs.table.toggleRowSelection(row);
341358
},
342359
// detailRowClick ({ row, column, event }) {

Vol.Vue/src/views/appmanager/App_TransactionAvgPrice.vue

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,76 @@
55
*业务请在@/extension/appmanager/App_TransactionAvgPrice.js此处编写
66
-->
77
<template>
8-
<div>
9-
<view-grid :columns="columns"
10-
:detail="detail"
11-
:editFormFileds="editFormFileds"
12-
:editFormOptions="editFormOptions"
13-
:searchFormFileds="searchFormFileds"
14-
:searchFormOptions="searchFormOptions"
15-
:table="table"
16-
:extend="extend">
17-
</view-grid>
18-
</div>
8+
<div>
9+
<view-grid
10+
ref="grid"
11+
:columns="columns"
12+
:detail="detail"
13+
:editFormFields="editFormFields"
14+
:editFormFileds="editFormFields"
15+
:editFormOptions="editFormOptions"
16+
:searchFormFields="searchFormFields"
17+
:searchFormFileds="searchFormFields"
18+
:searchFormOptions="searchFormOptions"
19+
:table="table"
20+
:extend="extend">
21+
</view-grid>
22+
</div>
1923
</template>
2024

2125
<script>
22-
import extend from "@/extension/appmanager/App_TransactionAvgPrice.js";
23-
import ViewGrid from "@/components/basic/ViewGrid.vue";
24-
var vueParam = {
25-
components: {
26-
ViewGrid
27-
},
28-
data () {
29-
return {
30-
table: {
31-
key: 'Id',
32-
footer: "Foots",
33-
cnName: '自动绑定下拉框',
34-
name: 'App_TransactionAvgPrice',
35-
url: "/App_TransactionAvgPrice/",
36-
sortName: "Id"
37-
},
38-
extend: extend,
39-
editFormFileds: { "Variety": [], "AgeRange": "", "City": "", "AvgPrice": "", "Date": "", "IsTop": "", "Creator": "", "CreateDate": "", "Modifier": "", "ModifyDate": "" },
40-
editFormOptions: [[{ "dataKey": "pz", "data": [], "title": "品种", "required": true, "field": "Variety", "colSize": 12, "type": "checkbox" }],
41-
[{ "dataKey": "age", "data": [], "title": "月龄", "required": true, "field": "AgeRange", "colSize": 12, "type": "select" }],
42-
[{ "dataKey": "city", "data": [], "title": "城市", "required": true, "field": "City", "colSize": 12, "type": "select" }],
43-
[{ "title": "价格", "required": true, "field": "AvgPrice", "colSize": 12, "type": "decimal" }],
44-
[{ "title": "日期", "required": true, "field": "Date", "colSize": 12, "type": "date" }],
45-
[{ "dataKey": "enable", "data": [], "title": "测试", "required": true, "field": "IsTop", "colSize": 12, "type": "select" }],
46-
[{ "title": "创建人", "field": "Creator", "disabled": true },
47-
{ "title": "创建时间", "field": "CreateDate", "disabled": true }],
48-
[{ "title": "修改人", "field": "Modifier", "disabled": true },
49-
{ "title": "修改时间", "field": "ModifyDate", "disabled": true }]],
50-
searchFormFileds: { "AgeRange": "", "Variety": "", "City": "", "Date": "", "IsTop": "", "Enable": [] },
51-
searchFormOptions: [[{ "dataKey": "age", "data": [], "title": "月龄", "field": "AgeRange", "type": "select" }, { "dataKey": "pz", "data": [], "title": "品种", "field": "Variety", "type": "select" }, { "dataKey": "city", "data": [], "title": "城市", "field": "City", "type": "select" }], [{ "title": "成交日期", "field": "Date", "type": "datetime" }, { "dataKey": "enable", "data": [], "title": "测试", "field": "IsTop", "type": "select" }, { "dataKey": "enable", "data": [], "title": "远程", "field": "Enable", "type": "selectList" }]],
52-
columns: [{ field: 'Id', title: '主键ID', type: 'int', width: 90, hidden: true, readonly: true, require: true, align: 'left' },
53-
{ field: 'AgeRange', title: '年龄', type: 'string', bind: { key: 'age', data: [] }, width: 90, require: true, align: 'left', sortable: true },
54-
{ field: 'Variety', title: '种类', type: 'string', bind: { key: 'pz', data: [] }, width: 90, require: true, align: 'left' },
55-
{ field: 'City', title: '城市', type: 'string', bind: { key: 'city', data: [] }, width: 90, require: true, align: 'left' },
56-
{ field: 'AvgPrice', title: '从格', type: 'decimal', link: true, width: 80, require: true, align: 'left' },
57-
{ field: 'Date', title: '日期', type: 'datetime', width: 90, require: true, align: 'left', sortable: true },
58-
{ field: 'IsTop', title: '测试', type: 'int', bind: { key: 'enable', data: [] }, width: 90, require: true, align: 'left' },
59-
{ field: 'Enable', title: '远程', type: 'byte', bind: { key: 'enable', data: [] }, width: 90, hidden: true, align: 'left' },
60-
{ field: 'CreateID', title: '创建人Id', type: 'int', width: 90, hidden: true, align: 'left' },
61-
{ field: 'Creator', title: '创建人', type: 'string', width: 130, readonly: true, align: 'left' },
62-
{ field: 'CreateDate', title: '创建时间', type: 'datetime', width: 90, readonly: true, align: 'left', sortable: true },
63-
{ field: 'ModifyID', title: '修改人ID', type: 'int', width: 90, hidden: true, align: 'left' },
64-
{ field: 'Modifier', title: '修改人', type: 'string', width: 130, readonly: true, align: 'left' },
65-
{ field: 'ModifyDate', title: '修改时间', type: 'datetime', width: 90, readonly: true, align: 'left', sortable: true }],
66-
detail: {
67-
cnName: "#detailCnName",
68-
columns: [],
69-
sortName: "",
70-
key: ""
71-
}
26+
import extend from "@/extension/appmanager/App_TransactionAvgPrice.js";
27+
import ViewGrid from "@/components/basic/ViewGrid.vue";
28+
var vueParam = {
29+
components: {
30+
ViewGrid
31+
},
32+
data() {
33+
return {
34+
table: {
35+
key: 'Id',
36+
footer: "Foots",
37+
cnName: '自动绑定下拉框',
38+
name: 'App_TransactionAvgPrice',
39+
url: "/App_TransactionAvgPrice/",
40+
sortName: "Id"
41+
},
42+
extend: extend,
43+
editFormFields: {"Variety":[],"AgeRange":"","City":"","AvgPrice":"","Date":"","IsTop":"","Creator":"","CreateDate":"","Modifier":"","ModifyDate":""},
44+
editFormOptions: [[{"dataKey":"pz","data":[],"title":"品种","required":true,"field":"Variety","colSize":12,"type":"checkbox"}],
45+
[{"dataKey":"age","data":[],"title":"月龄","required":true,"field":"AgeRange","colSize":12,"type":"select"}],
46+
[{"dataKey":"city","data":[],"title":"城市","required":true,"field":"City","colSize":12,"type":"select"}],
47+
[{"title":"均价","required":true,"field":"AvgPrice","colSize":12,"type":"decimal"}],
48+
[{"title":"日期","required":true,"field":"Date","colSize":12,"type":"date"}],
49+
[{"dataKey":"top","data":[],"title":"价格","required":true,"field":"IsTop","colSize":12,"type":"select"}],
50+
[{"title":"创建人","field":"Creator","disabled":true},
51+
{"title":"创建时间","field":"CreateDate","disabled":true}],
52+
[{"title":"修改人","field":"Modifier","disabled":true},
53+
{"title":"修改时间","field":"ModifyDate","disabled":true}]],
54+
searchFormFields: {"Variety":"","AgeRange":"","City":"","Date":"","IsTop":"","Enable":""},
55+
searchFormOptions: [[{"dataKey":"pz","data":[],"title":"品种","field":"Variety","type":"select"},{"dataKey":"age","data":[],"title":"月龄","field":"AgeRange","type":"select"},{"dataKey":"city","data":[],"title":"城市","field":"City","type":"select"}],[{"title":"日期","field":"Date","type":"datetime"},{"dataKey":"top","data":[],"title":"价格","field":"IsTop","type":"select"},{"dataKey":"enable","data":[],"title":"启用","field":"Enable","type":"select"}]],
56+
columns: [{field:'Id',title:'主键ID',type:'int',width:90,hidden:true,readonly:true,require:true,align:'left'},
57+
{field:'Variety',title:'品种',type:'string',bind:{ key:'pz',data:[]},sort:true,width:90,require:true,align:'left',sortable:true},
58+
{field:'AgeRange',title:'月龄',type:'string',bind:{ key:'age',data:[]},sort:true,width:90,require:true,align:'left'},
59+
{field:'City',title:'城市',type:'string',bind:{ key:'city',data:[]},sort:true,width:90,require:true,align:'left'},
60+
{field:'AvgPrice',title:'均价',type:'decimal',link:true,sort:true,width:80,require:true,align:'left'},
61+
{field:'Date',title:'日期',type:'datetime',sort:true,width:90,require:true,align:'left',sortable:true},
62+
{field:'IsTop',title:'价格',type:'int',bind:{ key:'top',data:[]},sort:true,width:90,require:true,align:'left'},
63+
{field:'Enable',title:'启用',type:'sbyte',bind:{ key:'enable',data:[]},sort:true,width:90,hidden:true,align:'left'},
64+
{field:'CreateID',title:'创建人Id',type:'int',width:90,hidden:true,align:'left'},
65+
{field:'Creator',title:'创建人',type:'string',width:130,readonly:true,align:'left'},
66+
{field:'CreateDate',title:'创建时间',type:'datetime',sort:true,width:90,readonly:true,align:'left',sortable:true},
67+
{field:'ModifyID',title:'修改人ID',type:'int',width:90,hidden:true,align:'left'},
68+
{field:'Modifier',title:'修改人',type:'string',width:130,readonly:true,align:'left'},
69+
{field:'ModifyDate',title:'修改时间',type:'datetime',width:90,readonly:true,align:'left',sortable:true}],
70+
detail: {
71+
cnName:"#detailCnName",
72+
columns: [],
73+
sortName: "",
74+
key:""
75+
}
76+
};
77+
}
7278
};
73-
}
74-
};
75-
export default vueParam;
79+
export default vueParam;
7680
</script>

0 commit comments

Comments
 (0)