Wayne 4 месяцев назад
Родитель
Сommit
7da385fb5a

+ 48 - 56
projects/src/main/webapp/vmodules/subject/subInfo/tz/cb.jsp

@@ -917,78 +917,70 @@
                     }
                 });*/
             },
+            getStatusName: function (status) {
+                const statusMap = {
+                    '0': '暂存',
+                    '1': '项目前期',
+                    '6': '待开工',
+                    '7': '施工中',
+                    '8': '暂停施工',
+                    'A': '已竣工'
+                };
+                return statusMap[status] || '未知状态';
+            },
+            adjustFrozenRowHeight: function () {
+                $(".layui-table-body tr").each(function (index, val) {
+                    const fixedRow = $(".layui-table-fixed .layui-table-body table tr")[index];
+                    $(fixedRow).height($(val).height());
+                });
+            },
             loadTable: function () {
-                for (var i = 0; i < this.dataList.length; i++) {
-                    var tem = this.dataList[i];
-                    switch (tem.status) {
-                        case '0':
-                            tem.statusName = '暂存';
-                            break;
-                        case '1':
-                            tem.statusName = '项目前期';
-                            break;
-                        case '6':
-                            tem.statusName = '待开工';
-                            break;
-                        case '7':
-                            tem.statusName = '施工中';
-                            break;
-                        /* case '9':
-                            tem.statusName = '年度竣工';
-                            break; */
-                        case '8':
-                            tem.statusName = '暂停施工';
-                            break;
-                        case 'A':
-                            tem.statusName = '已竣工';
-                            break;
-                    }
-                }
-                var self = this;
+                // 状态名称映射
+                this.dataList.forEach(item => {
+                    item.statusName = this.getStatusName(item.status);
+                });
+
+                const self = this;
                 layui.table.render({
-                    elem: '#table1', // 指定原始表格元素选择器(推荐id选择器)
+                    elem: '#table1',
                     even: true,
                     autoSort: false,
                     initSort: self.sort,
-                    cols: [[ // 设置表头
-                        {type: 'numbers', fixed: 'left', align: 'center', width: 44, title: '序号'},
-                        {field: 'subName', fixed: 'left', title: '项目名称', width: 200, templet: '#subName'},
-                        {field: 'subjectName', fixed: 'left', title: '项目所在地', width: 200},
+                    cols: [[
+                        {type: 'numbers', align: 'center', minwidth: 44, title: '序号'},
+                        {field: 'subName', title: '项目名称', minwidth: 200, templet: '#subName'},
+                        {field: 'subjectName', title: '项目所在地', minwidth: 200},
                         {
-                            field: 'amtTotal', fixed: 'left', title: '项目建设内容(亿元)', width: 200, templet: function (d) {
-                                return (d.amtTotal / 10000).toFixed(2) + "亿元";
-                            }
+                            field: 'amtTotal',
+                            title: '项目建设内容(亿元)',
+                            minwidth: 200,
+                            templet: d => (d.amtTotal / 10000).toFixed(2) + "亿元"
                         },
-                        {field: 'progress', fixed: 'left', title: '进展情况', width: 200},
-                        {field: 'remark', fixed: 'left', title: '备注', width: 200},
-                        {title: '操作', width: 225, toolbar: '#toolBar', fixed: 'right'},
+                        {field: 'progress', title: '进展情况', minwidth: 200},
+                        {field: 'remark', title: '备注', minwidth: 200},
+                        {title: '操作', minwidth: 225, toolbar: '#toolBar', fixed: 'right'},
                     ]],
                     fixed: true,
-                    height: window.screen.availHeight - 450,
+                    height: $(window).height() - $('#table1').offset().top - 50,
                     data: self.dataList,
-                    done: function (res, curr, count) {
-                        res.data.forEach(function (item, index) {
-                            $(".layui-table-body  tr").resize(function () {
-                                $(".layui-table-body  tr").each(function (index, val) {
-                                    $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
-                                });
-                            });
-                            //初始化高度,使得冻结行表体高度一致
-                            $(".layui-table-body  tr").each(function (index, val) {
-                                $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
-                            });
-                        });
+                    done: function () {
+                        self.adjustFrozenRowHeight();
                     }
                 });
-                layui.table.on('tool(' + this.tableName + ')', function (obj) {
-                    var event = obj.event;
-                    self[event].call(this, obj);
+
+                layui.table.on('tool(' + this.tableName + ')', obj => {
+                    const { event } = obj;
+                    if (typeof self[event] === 'function') {
+                        self[event](obj);
+                    } else {
+                        console.warn(`未定义的事件: ${event}`);
+                    }
                 });
+
                 layui.table.on('sort(' + this.tableName + ')', function (obj) {
                     self.sort = obj;
                     self.getData();
-                    return;
-                })
+                });
             },
             toBack: function (obj) {
                 layer.open({

+ 11 - 11
projects/src/main/webapp/vmodules/subject/subInfo/tz/new.jsp

@@ -1217,32 +1217,32 @@
                     autoSort: false,
                     initSort: self.sort,
                     cols: [[ // 设置表头
-                        {type: 'numbers', fixed: 'left', align: 'center', width: 44, title: '序号'},
-                        {field: 'subName', fixed: 'left', title: '项目名称', width: 200, templet: '#subName'},
+                        {type: 'numbers',  align: 'center', minwidth: 44, title: '序号'},
+                        {field: 'subName',  title: '项目名称', minwidth: 200, templet: '#subName'},
 /*                        {
                             field: 'abc',
                             type: 'string',
                             title: 'ABC',
-                            fixed: 'left',
+
                             align: 'center',
                             width: 60,
                             templet: "#abcSpan"
                         },*/
-                        // {field: 'offsetLight', title: '偏离状态', fixed: 'left', minWidth: 150, templet: '#offsetLight'},
+                        // {field: 'offsetLight', title: '偏离状态',  minWidth: 150, templet: '#offsetLight'},
                         // {field: 'statusName', title: '项目进度', width: 200},
                         // {field: 'amtTotal', title: '投资金额', minWidth: 250, templet: '#amt', sort:"amtTotal"},
                         // {field: 'offset', title: '偏离度-%', width: 100},
                         // {field: 'fileId', title: '现场影像', width: 150, templet:'#imageDiv'},
-                        // {field: 'subName', fixed: 'left', title: '项目名称', width: 200, templet: '#subName'},
-                        {field: 'subjectName', title: '项目所在地', width: 200},
+                        // {field: 'subName',  title: '项目名称', width: 200, templet: '#subName'},
+                        {field: 'subjectName', title: '项目所在地', minwidth: 200},
                         {
-                            field: 'amtTotal', title: '项目建设内容(亿元)', width: 200, templet: function (d) {
+                            field: 'amtTotal', title: '项目建设内容(亿元)', minwidth: 200, templet: function (d) {
                                 return (d.amtTotal / 10000).toFixed(2) + "亿元";
                             }
                         },
-                        {field: 'preProceNum', title: '预计开工时间', width: 160, templet: '#date'},
-                          {field: 'xmbaStatus', title: '前期手续办理情况', width: 160, templet: '#preInfo'},
-                        {field: 'remark', title: '备注', width: 245, templet: '#remark'},
+                        {field: 'preProceNum', title: '预计开工时间', minwidth: 160, templet: '#date'},
+                          {field: 'xmbaStatus', title: '前期手续办理情况', minwidth: 160, templet: '#preInfo'},
+                        {field: 'remark', title: '备注', minwidth: 245, templet: '#remark'},
                         // {field: 'indusKindName', title: '所属行业', width: 115},
                         // {field: 'zjly', title: '资金来源', width: 115, templet: '#zjly'},
                         // {field: 'mainName', title: '日常责任监管单位', width: 115},
@@ -1264,7 +1264,7 @@
                                 return "";
                             }
                         },*/
-                        {title: '操作', width: 225, toolbar: '#toolBar', fixed: 'right'},
+                        {title: '操作', minwidth: 225, toolbar: '#toolBar', fixed: 'right'},
                     ]],
                     fixed: true,
                     height: window.screen.availHeight - 450,