==================================js====================
var areas;
$(document).ready(function () {
var table;
var prorow;
$.get("ISysData/Area", function (d) {
areas = d;
//数据列表
table = $("#table-list").uTable({
url: "IProject",
buttons: [
{
text: "新增", style: "btn-primary", click: function () {
EditDetail();
}
}
],
click:function(r)
{
prorow = r;
},
heads: [{ key: "CityID", conver: "ConverArea", name: "地区" },
{ key: "EngineeringType", name: "工程类型" },
{ key: "Name", name: "工程名称" },
{ key: "Address", name: "工程地址" },
{ key: "StartTime", conver: "ConverTime", name: "开工时间" },
{ key: "BuildGeneral", name: "施工单位" },
{ html: '<a href="javascript:" class="read EQ-btn" data-id="{{ID}}" >查看</a> <a href="javascript:" class="edit" data-id="{{ID}}" >修改</a> <a href="javascript:" class="view" data-id="{{ID}}" >见证</a> <a href="javascript:" class="completed" data-id="{{ID}}" >竣工</a>', name: "操作" }
]
});
});
//编辑
$("#table-list").on("click", ".edit", function () {
var id = $(this).attr("data-id");
EditDetail(id);
});
//只读查看
$("#table-list").on("click", ".read", function () {
var id = $(this).attr("data-id");
EditDetail(id,true);
});
//展示编辑内容
function EditDetail(id, disabled) {
///展示详细编辑页面(复杂的编辑页面使用这种方式,小的编辑页面还是使用弹出框的方式)
$.layout.detail("VProject/Edit", function () {
//联动数据
var items = [
{ title: "", width: 177, name: "CityID", param: { key: "CityID", text: "CityName" } },
{ title: "县/县级市:", width: 177, name: "DistrictID", pid: "CityID", param: { key: "DistrictID", text: "DistrictName" } }
];
//企业数据表单
$.get("/IProject/Get",{id:id}, function (d) {
var areaapp = $("#selarea").cascade({
data: d.Area,
items: items,
afterCreate: function () {
$("#edit-form").Form({
data: d.Comp,
disabled: disabled,
success: function () {
$.layout.back();//回到列表
table.refresh();//刷新列表
},
afterCreate: function (bo) {
areaapp.refresh();
if (bo)
{
$("#selarea-child-1").find("option[value=" + bo.DistrictID + "]").attr("selected", true);
}
}
});
}
});
});
});
}
//工程详细操作
$("#table-list").on("click", ".view", function () {
var id = $(this).attr("data-id");
ViewDetail(id);
});
//竣工操作
$("#table-list").on("click", ".completed", function () {
var id = $(this).attr("data-id");
doCompleted(id);
});
//竣工逻辑
function doCompleted(id)
{
$.msg.confirm("确定该项目已竣工吗?", function () {
//竣工逻辑
});
}
//===============================================展示详细见证内容===============================================================================
//展示详细见证内容
function ViewDetail(id) {
$.layout.detail("VProject/Detail", function () {
$("#projinfo").detail({
data:prorow
});
$("#projectTab").utab({
click: function (i) {
switch (i) {
case 1:
ChangeUserList();
break;
case 2:
CompletedList();
break;
default:
}
}
});
//见证登记人员信息
var regutable = $("#table-user-list").uTable({
url: "IProject/QueryRegUsers?pid=" + id,
buttons: [
{
text: "新增", style: "btn-primary EQ-btn", click: function () {
RegUserEdit();
}
}
],
page: {
enable:false
},
heads: [
{
key: "Name", name: "姓名" },
{ key: "Address", name: "所属机构" },
{ key: "Duties", name: "岗位" },
{ key: "Remarks", name: "说明" },
{ html: '<a href="javascript:" class="atta" data-id="{{AuthAtta}}" ><i class="icon-search"></i></a>', name: "见证员授权书" },
{ html: '<a href="javascript:" class="view" data-id="{{ID}}" ><i class="icon-search"></i></a>', name: "见证记录" },
{ html: '<a href="javascript:" class="edit EQ-btn" data-id="{{ID}}" >编辑</a> <a href="javascript:" class="del EQ-btn" data-id="{{ID}}" >删除</a> <a href="javascript:" class="change EQ-btn" data-id="{{ID}}" >变更</a>', name: "操作" }
]
});
//编辑按钮
$("#table-user-list").on("click", ".edit", function () {
var cid = $(this).attr("data-id");
RegUserEdit(cid);
});
//变更按钮
$("#table-user-list").on("click", ".change", function () {
var cid = $(this).attr("data-id");
ChengUserEdit(cid);
});
//编辑见证人员注册
function RegUserEdit(cid) {
$("#modaltemplatebox").modal({
title: "编辑见证",
url: "VProject/RegUserEdit",
buttons: [
{
text: "确定", click: function () {
$("#edit-form").submit();
}
},
{ text: "关闭", click: function () { /*逻辑处理*/$(this).close(); } }
],
afterCreate: function () {
$("#div_upload").CQUpload({
fhidid: "FileID",
ahidid: "AuthAtta",
name:"FileName"
});
$("#edit-form").Form({
url: cid ? "IProject/GetRegUser?id=" + cid : "",
success: function () {
regutable.refresh();//刷新列表
$("#modaltemplatebox").close();
}
});
}
});
}
//编辑见证人员变更
function ChengUserEdit(cid) {
$("#modaltemplatebox").modal({
title: "变更见证人员",
url: "VProject/CheUserEdit",
buttons: [
{
text: "确定", click: function () {
$("#edit-form").submit();
}
},
{ text: "关闭", click: function () { /*逻辑处理*/$(this).close(); } }
],
afterCreate: function () {
$("#edit-form").Form({
url: cid ? "IProject/GetRegUser?id=" + cid : "",
success: function () {
regutable.refresh();//刷新列表
$("#modaltemplatebox").close();
}
});
}
});
}
//人员变更
var chutable;
function ChangeUserList() {
chutable = $("#table-ch-user-list").uTable({
url: "IExample?id=" + id,
heads: [
{ key: "Name", name: "变更类型" },
{ key: "Address", name: "姓名" },
{ key: "Address", name: "岗位" },
{ key: "Address", name: "所属机构" },
{ key: "Address", name: "变更时间" },
{ key: "Address", name: "身份证号" },
{ key: "Address", name: "变更理由" },
{ html: '<a href="javascript:" class="view" data-id="{{ID}}" ><i class="icon-search"></i></a>', name: "变更表格扫描件" }
]
});
}
//竣工登记列表
function CompletedList() {
var completedtable = $("#table-complete-list").uTable({
url: "IExample?id=" + id,
buttons: [
{
text: "竣工", style: "EQ-btn btn-primary", click: function () {
//标记竣工逻辑
doCompleted(id);
}
}
],
heads: [
{ key: "Name", name: "试验项目" },
{ key: "Address", name: "见证员" },
{ key: "Address", name: "取样员" },
{ key: "Address", name: "见证取样时间" },
{ key: "Address", name: "应试验组/次数" },
{ key: "Address", name: "见证试验组/次数" },
{ key: "Address", name: "不合格次数" }
]
});
}
});
}
});
///转换地区
function ConverArea(d){
var name;
for (var i in areas) {
var a = areas[i];
if (a.CityID == d)
{
name = a.CityName;
break;
}
}
return name;
}
//转换时间
function ConverTime(d)
{
return d.substring(0,10);
}
==================================API I控制器====================
using NNCQ.Domain;
using NNCQ.Domain.Common;
using NNCQ.IBLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NNCQ.SqlService;
using System.Data.SqlClient;
namespace NNCQ.Web.Controllers.Api
{
/// <summary>
/// 见证工程数据接口
/// </summary>
public class IProjectController : BaseController
{
private readonly IDBHelper<Project> _ProService;
private readonly IDBHelper<SysCity> _CityService;
private readonly IDBHelper<SysDistrict> _DisService;
private readonly IDBHelper<ProRPerson> _PrpService;
public IProjectController(IDBHelper<Project> ProService,
IDBHelper<SysCity> CityService,
IDBHelper<SysDistrict> DisService,
IDBHelper<ProRPerson> PrpService)
{
_ProService = ProService;
_CityService = CityService;
_DisService = DisService;
_PrpService = PrpService;
}
// GET: IProject
/// <summary>
/// 见证工程列表
/// </summary>
/// <returns></returns>
public ActionResult Index(int index,int size)
{
int count = 0;
string where = "";
var list = _ProService.Query(index,size,"*", "nncq_Project", where, "SortCode desc", out count);
return Table(list, count);
}
/// <summary>
/// 获取项目详细
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public ActionResult Get(Guid? id)
{
Project bo = null;
if (id != null)
{
bo = _ProService.Get(id.Value);
}
var citys = _CityService.Query("select * from nncq_SysCity where ProvinceID=20 order by SortCode");
var dists = _DisService.Query("select * from nncq_SysDistrict where CityID>=218 and CityID<= 231 order by SortCode");
return JsonData(new { Comp = bo, Area = new { CityID = citys, DistrictID = dists } });
}
/// <summary>
/// 编辑见证工程
/// </summary>
/// <param name="bean"></param>
/// <returns></returns>
public ActionResult Save(Project bean)
{
var bo = _ProService.Get(bean.ID);
if (bo == null)
{
_ProService.Insert(bean);
}
else {
bo.Name = bean.Name;
bo.Address = bean.Address;
bo.CityID = bean.CityID;
bo.DistrictID = bean.DistrictID;
bo.AcceptanceUnit = bean.AcceptanceUnit;
bo.ActualDuration = bean.ActualDuration;
bo.BiddingSuper = bean.BiddingSuper;
bo.BuildGeneral = bean.BuildGeneral;
bo.BuildGeneralLeader = bean.BuildGeneralLeader;
bo.BuildGeneralQFR = bean.BuildGeneralQFR;
bo.BuildLabour = bean.BuildLabour;
bo.BuildLabourLeader = bean.BuildLabourLeader;
bo.BuildLabourQFR = bean.BuildLabourQFR;
bo.BuildPro = bean.BuildPro;
bo.BuildProLeader = bean.BuildProLeader;
bo.BuildProQFR = bean.BuildProQFR;
bo.ChartReviewUnit = bean.ChartReviewUnit;
bo.CompletionTime = bean.CompletionTime;
bo.ConstructionArea = bean.ConstructionArea;
bo.ConstructionLeader = bean.ConstructionLeader;
bo.ConstructionMode = bean.ConstructionMode;
bo.ConstructionNo = bean.ConstructionNo;
bo.ConstructionQFR = bean.ConstructionQFR;
bo.ConstructionUnit = bean.ConstructionUnit;
bo.ContractNo = bean.ContractNo;
bo.ContractPrice = bean.ContractPrice;
bo.ControlLeader = bean.ControlLeader;
bo.ControlQFR = bean.ControlQFR;
bo.ControlUnit = bean.ControlUnit;
bo.DesignLeader = bean.DesignLeader;
bo.DesignQFR = bean.DesignQFR;
bo.DesignUnit = bean.DesignUnit;
bo.EngineeringType = bean.EngineeringType;
bo.FinalAcceptance = bean.FinalAcceptance;
bo.FinalAcceptanceTime = bean.FinalAcceptanceTime;
bo.LicenseIssuance = bean.LicenseIssuance;
bo.PlanDuration = bean.PlanDuration;
bo.ProContracMode = bean.ProContracMode;
bo.QualityAssessment = bean.QualityAssessment;
bo.QualitySuper = bean.QualitySuper;
bo.ReconnaLeader = bean.ReconnaLeader;
bo.ReconnaQFR = bean.ReconnaQFR;
bo.ReconnaUnit = bean.ReconnaUnit;
bo.Remarks = bean.Remarks;
bo.SafetyEvaluation = bean.SafetyEvaluation;
bo.SecuritySuper = bean.SecuritySuper;
bo.SettlementPrice = bean.SettlementPrice;
bo.SpeedProgress = bean.SpeedProgress;
bo.StartTime = bean.StartTime;
bo.TestingIns = bean.TestingIns;
bo.TestingInsLeader = bean.TestingInsLeader;
bo.TestingInsQFR = bean.TestingInsQFR;
_ProService.Update(bo);
}
return Success();
}
/// <summary>
/// 获取登记见证信息
/// </summary>
/// <returns></returns>
public ActionResult GetRegUser(Guid id)
{
return JsonData(null);
}
/// <summary>
/// 注册见证人员信息
/// </summary>
/// <param name="bean"></param>
/// <returns></returns>
public ActionResult SaveRegUser(ProRPerson bean)
{
var bo = _PrpService.Get(bean.ID);
if (bo != null)
{
bo.AuthAtta = bean.AuthAtta;
bo.PSID = bean.PSID;
bo.Remarks = bean.Remarks;
_PrpService.Update(bo);
}
else {
_PrpService.Insert(bean);
}
return Success();
}
/// <summary>
/// 获取见证人员登记信息
/// </summary>
/// <param name="pid"></param>
/// <returns></returns>
public ActionResult QueryRegUsers(Guid pid)
{
var sql = "select wp.Name,wp.Duties,prp.Remarks,prp.AuthAtta from nncq_ProRPerson as prp" +
" left join nncq_WitnPerson as wp on prp.PSID = wp.ID " +
" where prp.POID=@POID";
var param = new SqlParameter[] {
new SqlParameter("@POID",pid)
};
var table = SqlDBHelper.Query(sql, param);
return Table(table);
}
}
}
===================================编辑页 Edit.cshtml======================
<form id="edit-form" action="IProject/Save" method="post" fm-form="ajax" >
<table class="table table-bordered" >
<tr>
<td colspan="3" width="15%" ><label>工程名称</label></td>
<td colspan="5" ><input type="text" fm-len="2,100,请输入2-100个字!" class="form-control" name="Name" placeholder="工程名称" /></td>
</tr>
<tr>
<td colspan="3"><label>所属地市</label></td>
<td colspan="5"><div id="selarea" ></div></td>
</tr>
<tr>
<td colspan="3" ><label>工程地址</label></td>
<td colspan="5"><input type="text" name="Address" fm-len="2,200,请输入2-200个字!" class="form-control" placeholder="工程地址" /></td>
</tr>
<tr>
<td colspan="3" ><label>工程简介</label></td>
<td colspan="5"><input type="text" name="Introduction" class="form-control" placeholder="工程简介" /></td>
</tr>
<tr>
<td colspan="3" ><label>合同编号</label></td>
<td width="20%" ><input name="ContractNo" fm-null="请输入合同编号!" type="text" class="form-control" placeholder="合同编号"/></td>
<td colspan="2" width="30%" ><label>施工许可证号或开工报告批准文号</label></td>
<td colspan="2"><input name="ConstructionNo" type="text" fm-null="施工许可证号或开工报告批准文号!" class="form-control" placeholder="施工许可证号或开工报告批准文号" /></td>
</tr>
<tr>
<td colspan="3" rowspan="2" ><label>工程规模</label></td>
<td ><label>工程类型</label></td>
<td colspan="2"><label>建筑面积(M)</label></td>
<td colspan="2"><label>工程进度</label></td>
</tr>
<tr>
<td>
<select name="EngineeringType" class="form-control">
<option value="房建施工" >房建施工</option>
<option value="修缮施工">修缮施工</option>
</select></td>
<td colspan="2"><input name="ConstructionArea" type="text" fm-reg="\d+(\.\d\d)?,请输入建筑面积!" class="form-control" placeholder="建筑面积" /></td>
<td colspan="2"><input name="SpeedProgress" type="text" class="form-control" placeholder="工程进度" /></td>
</tr>
<tr>
<td colspan="3" ><label>合同价</label></td>
<td><input name="ContractPrice" type="text" fm-reg="\d+(\.\d\d)?,请输入合同价!" class="form-control" placeholder="合同价" /></td>
<td colspan="2"><label>结算价</label></td>
<td colspan="2"><input name="SettlementPrice" fm-nreg="\d+(\.\d\d)?,请输入结算价!" type="text" class="form-control" placeholder="结算价" /></td>
</tr>
<tr>
<td colspan="3"><label>工程承包方式</label></td>
<td colspan="5">
<select name="ProContracMode" class="form-control" >
<option>施工总承包</option>
<option>专业承包</option>
</select></td>
</tr>
<tr>
<td colspan="3"><label>施工组织方式</label></td>
<td colspan="5"><input name="ConstructionMode" type="text" class="form-control" placeholder="施工组织方式" /></td>
</tr>
<tr>
<td colspan="3"><label>开工时间</label></td>
<td><input name="StartTime" type="text" οnfοcus="WdatePicker()" class="form-control calendar" placeholder="开工时间" /></td>
<td colspan="2"><label>竣工时间</label></td>
<td colspan="2"><input name="CompletionTime" οnfοcus="WdatePicker()" type="text" class="form-control calendar" placeholder="竣工时间" /></td>
</tr>
<tr>
<td colspan="3"><label>计划工期</label></td>
<td><input name="PlanDuration" type="text" class="form-control" placeholder="计划工期" /></td>
<td colspan="2"><label>实际工期</label></td>
<td colspan="2"><input name="ActualDuration" type="text" class="form-control" placeholder="实际工期" /></td>
</tr>
<tr>
<td colspan="3"><label>质量评定</label></td>
<td><input name="QualityAssessment" type="text" class="form-control" placeholder="质量评定" /></td>
<td colspan="2"><label>安全评价</label></td>
<td colspan="2"><input name="SafetyEvaluation" type="text" class="form-control" placeholder="安全评价" /></td>
</tr>
<tr>
<td colspan="3"><label>建设单位</label></td>
<td><input name="ConstructionUnit" fm-len="2,200,请输入2-200个字!" type="text" class="form-control" placeholder="建设单位" /></td>
<td width="10%" ><label>项目负责人</label></td>
<td ><input name="ConstructionLeader" fm-null="请输入项目负责人!" type="text" class="form-control" placeholder="项目负责人" /></td>
<td width="10%"><label>注册执业资格</label></td>
<td><input name="ConstructionQFR" type="text" class="form-control" placeholder="注册执业资格" /></td>
</tr>
<tr>
<td rowspan="7" width="3%" ><label>参建单位</label></td>
<td colspan="2" ><label>勘察单位</label></td>
<td><input name="ReconnaUnit" type="text" class="form-control" placeholder="勘察单位" /></td>
<td><label>项目负责人</label></td>
<td><input name="ReconnaLeader" type="text" class="form-control" placeholder="项目负责人" /></td>
<td><label>注册执业资格</label></td>
<td><input name="ReconnaQFR" type="text" class="form-control" placeholder="注册执业资格" /></td>
</tr>
<tr>
<td colspan="2"><label>设计单位</label></td>
<td><input name="DesignUnit" type="text" class="form-control" placeholder="设计单位" /></td>
<td><label>项目负责人</label></td>
<td><input name="DesignLeader" type="text" class="form-control" placeholder="项目负责人" /></td>
<td><label>注册执业资格</label></td>
<td><input name="DesignQFR" type="text" class="form-control" placeholder="注册执业资格" /></td>
</tr>
<tr>
<td colspan="2"><label>监理单位</label></td>
<td><input name="ControlUnit" type="text" class="form-control" placeholder="监理单位" /></td>
<td><label>项目负责人</label></td>
<td><input name="ControlLeader" type="text" class="form-control" placeholder="项目负责人" /></td>
<td><label>注册执业资格</label></td>
<td><input name="ControlQFR" type="text" class="form-control" placeholder="注册执业资格" /></td>
</tr>
<tr>
<td rowspan="3" ><label>施工单位</label></td>
<td><label>总承包</label></td>
<td><input name="BuildGeneral" type="text" class="form-control" placeholder="总承包" /></td>
<td><label>项目负责人</label></td>
<td><input name="BuildGeneralLeader" type="text" class="form-control" placeholder="项目负责人" /></td>
<td><label>注册执业资格</label></td>
<td><input name="BuildGeneralQFR" type="text" class="form-control" placeholder="注册执业资格" /></td>
</tr>
<tr>
<td><label>专业承包</label></td>
<td><input name="BuildPro" type="text" class="form-control" placeholder="专业承包" /></td>
<td><label>项目负责人</label></td>
<td><input name="BuildProLeader" type="text" class="form-control" placeholder="项目负责人" /></td>
<td><label>注册执业资格</label></td>
<td><input name="BuildProQFR" type="text" class="form-control" placeholder="注册执业资格" /></td>
</tr>
<tr>
<td><label>劳务分包</label></td>
<td><input name="BuildLabour" type="text" class="form-control" placeholder="劳务分包" /></td>
<td><label>项目负责人</label></td>
<td><input name="BuildLabourLeader" type="text" class="form-control" placeholder="项目负责人" /></td>
<td><label>注册执业资格</label></td>
<td><input name="BuildLabourQFR" type="text" class="form-control" placeholder="注册执业资格" /></td>
</tr>
<tr>
<td colspan="2"><label>试验检测机构</label></td>
<td><input name="TestingIns" type="text" class="form-control" placeholder="试验检测机构" /></td>
<td><label>项目负责人</label></td>
<td><input name="TestingInsLeader" type="text" class="form-control" placeholder="项目负责人" /></td>
<td><label>注册执业资格</label></td>
<td><input name="TestingInsQFR" type="text" class="form-control" placeholder="注册执业资格" /></td>
</tr>
<tr>
<td rowspan="5"><label>主管部门</label></td>
<td colspan="2"><label>图审单位</label></td>
<td colspan="5" ><input name="ChartReviewUnit" type="text" class="form-control" placeholder="图审单位" /></td>
</tr>
<tr>
<td colspan="2"><label>招投标监督部门</label></td>
<td colspan="5"><input name="BiddingSuper" type="text" class="form-control" placeholder="招投标监督部门" /></td>
</tr>
<tr>
<td colspan="2"><label>质量监督部门</label></td>
<td colspan="5"><input name="QualitySuper" type="text" class="form-control" placeholder="质量监督部门" /></td>
</tr>
<tr>
<td colspan="2"><label>安全监督部门</label></td>
<td colspan="5"><input name="SecuritySuper" type="text" class="form-control" placeholder="安全监督部门" /></td>
</tr>
<tr>
<td colspan="2"><label>施工许可证发放部门</label></td>
<td colspan="5"><input name="LicenseIssuance" type="text" class="form-control" placeholder="施工许可证发放部门" /></td>
</tr>
<tr>
<td rowspan="3"><label>竣工验收情况</label></td>
<td colspan="2"><label>竣工验收时间</label></td>
<td colspan="5"><input name="FinalAcceptanceTime" οnfοcus="WdatePicker()" type="text" class="form-control calendar" placeholder="竣工验收时间" /></td>
</tr>
<tr>
<td colspan="2"><label>参加验收单位及人员</label></td>
<td colspan="5"><input name="AcceptanceUnit" type="text" class="form-control" placeholder="参加验收单位及人员" /></td>
</tr>
<tr>
<td colspan="2"><label>竣工验收结论</label></td>
<td colspan="5"><input name="FinalAcceptance" type="text" class="form-control" placeholder="竣工验收结论" /></td>
</tr>
<tr>
<td colspan="3"><label>备注</label></td>
<td colspan="5" ><textarea name="Remarks" rows="5" class="form-control" placeholder="备注" ></textarea></td>
</tr>
</table>
<input type="hidden" name="ID" />
<div class="form-btns">
<button type="submit" class="btn btn-primary">确定</button>
</div>
</form>