123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- define(function (require) {
- return function (context) {
- var $grid1, $form, $dlg;
- // 输入搜索文本后点击回车按钮查询列表
- function enterQueryGrid1(e) {
- if (e.keyCode === 13) {
- //如果按下回车键,就发出确认
- var tmp = $(this).val();
- $form.formSet({queryProperties: tmp});
- queryGrid1();
- }
- }
- function queryGrid1() {
- var obj = $form.formGet();
- obj.verId = context.verId;
- obj.appId = context.appId;
- obj.guid = '700cbc18ab1049e19b88d8fd29410bb6';
- $grid1.reload({
- url: api('/sys/sysAppFile/query'),// /term/hd/verCheck /sys/sysAppFile/query
- mtype: 'POST',
- queryParams: obj
- }, true);
- }
- function saveFile(file) {
- $.yvan.ajax({
- url: api('/sys/sysAppFile/insert'),
- data: {
- verId: context.verId,
- appId: context.appId,
- fileName: file.fileName,
- ext: file.ext,
- filePath: file.filePath,
- md5: file.md5,
- size: file.size
- },
- method: 'post',
- success: function (data) {
- if (close) {
- $.yvan.msg('操作成功');
- }
- if ($.type(context.confirm) === 'function') {
- context.confirm();
- }
- }
- });
- }
- //编辑
- function editRow1(obj) {
- var row = $grid1.rowData();
- if (!row) {
- $.yvan.msg('选择一行数据');
- return;
- }
- var dlg = require('/app/sys/app/dialogAppFileInfo.js')({
- isEdit: true,
- fileId: row.fileId,
- verId: row.verId,
- appId: row.appId,
- confirm: function () {
- $grid1.reload();
- }
- });
- $.yvan.showDialog(obj, dlg);
- }
- //删除
- function deleteRow1() {
- var row = $grid1.rowData();
- if (!row) {
- $.yvan.msg('请先选择一行数据');
- return;
- }
- $.yvan.confirm('确定删除 [' + row.fileName + "] ?", {
- yes: function (index) {
- $.yvan.ajax({
- url: api('/sys/sysAppFile/delete'),
- data: {
- fileId: row.fileId,
- },
- method: 'post',
- success: function (data) {
- $.yvan.msg(data.msg);
- $grid1.reload();
- }
- });
- }
- });
- }
- // 搜索按钮
- var queryToolbarTitle = '应用程序管理';// 自行替换此参数
- var queryToolbar = {
- xtype: 'toolbar', title: queryToolbarTitle, items: [
- {
- text: '查询', iconCls: 'fa fa-search', onClick: function () {
- queryGrid1();
- }
- }, {
- text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
- $form.formClear();
- queryGrid1();
- }
- }, {
- text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
- $dlg.window('close');
- }
- }
- ]
- };
- // 搜索条件
- var queryForm = {
- onRender: function () {
- $form = $(this);
- },
- xtype: 'form',
- items: [[
- {
- xtype: 'textbox',
- label: '检索条件',
- name: 'queryProperties',
- prompt: '文件名称/文件路径/文件版本/MD5',
- labelWidth: 'auto',
- events: {keydown: enterQueryGrid1}
- }
- ]]
- };
- // 列表1增删改查按钮
- var gridToolbarTitle1 = '程序文件列表';// 自行替换此参数
- var gridToolbar1 = {
- xtype: 'toolbar', title: gridToolbarTitle1, items: [
- {
- name: 'file',
- text: '文件上传',
- iconCls: 'fa fa-cloud-upload',
- // accept: 'image/jpeg,image/png',
- accept: {
- title: 'file',
- // extensions: 'jpg,mp4,pdf,png,ppt,doc,xls,docx,xlsx,pptx',
- // mimeTypes: 'image/jpeg,video/mp4,application/pdf,image/png,application/vnd.ms-powerpoint,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation'
- extensions: '*',
- mimeTypes: '*/*'
- },
- onClick: function () {
- var _data = $form.formGet();
- //onsole.log(_data.appFileType);
- if (_data.appFileType == 0) {
- $.yvan.msg('请先选择文件类型');
- return;
- }
- $.yvan.showUploadWindow($(this), {
- url: fileUrl('/file/appUpload'), //上传路径
- param: JSON.stringify({busiId: context.verId, busiType: _data.fileType}),
- uploadSuccess: function (file) {
- //已弃用
- },
- success: function (data) {
- //上传一个文件,成功之后的回调.
- //如果有多个文件会回调多次
- saveFile(data.data);
- }
- });
- }
- }, {
- text: '编辑', iconCls: 'fa fa-pencil-square-o', onClick: function () {
- editRow1(this);
- }
- }, {
- text: '删除', iconCls: 'fa fa-trash-o fa-lg', onClick: function () {
- deleteRow1();
- }
- },
- ]
- };
- //界面
- return {
- xtype: 'dialog',
- dialogId: 'dialog3',
- title: '版本文件信息',
- width: '100%',
- height: '100%',
- onOpen: function () {
- $dlg = $(this);
- debugger
- $form.formSet({
- "verId": context.verId,
- "appId": context.appId,
- "fileType": 11,
- "appFileType": 1
- });
- },
- north: {
- height: 90,
- split: true,
- border: false,
- items: [
- queryToolbar,
- queryForm
- ]
- },
- center: {
- width: "100%",
- border: false,
- split: true,
- items: {
- onRender: function () {
- $grid1 = $(this);
- queryGrid1();
- },
- xtype: 'grid',
- toolbar: gridToolbar1,
- pagination: false,
- autoSizeColumns: true,
- //idField: 'fileId',
- title: '应用程序列表',
- columns: [[
- {field: 'fileId', hidden: true},
- {field: 'verId', hidden: true},
- {field: 'appId', hidden: true},
- {field: 'filePath', title: '文件相对路径'},
- {field: 'fileName', title: '文件名称'},
- {field: 'fileMd5', title: '文件MD5'},
- {
- field: 'fileSize', width: 100, title: '大小(KB)', align: 'right', formatter: function (value, row, index) {
- return Math.round(row.rowData.fileSize / 1024);
- }
- },
- {field: 'fileUrl', title: '文件下载地址'},
- {field: 'timeCreate', title: '新增时间', formatter: 'ts'}
- ]]
- }
- }
- };
- };
- });
|