| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- @using ContractService.Configuration
- @using ContractService.Authorization
- @using ContractService.Views.Shared.Modals
- @using ContractService.Views.Shared.Query
- @using ContractService.Views.Shared.SearchForm
- @using ContractService.Views.Shared.Table
- @using IwbZero.Runtime.Session
- @{
- ViewBag.Title = "合同信息";
- string activeMenu = PermissionNames.PagesCaseContractMgContractMg; //The menu item will be active for this page.
- ViewBag.ActiveMenu = activeMenu;
- string contractState = ViewBag.State;
- var searchList = new List<SearchItem>();
- var fields = new List<FieldItem>()
- {
- new FieldItem("caseName", "项目名称"),
- new FieldItem("code", "合同编号"),
- new FieldItem("name", "合同名称"),
- new FieldItem("contractState", "合同状态", "ContractStateFormatter"),
- };
- if (AbpSession.AccountType == AccountTypeDefinition.System || AbpSession.AccountType == AccountTypeDefinition.Lawyer)
- {
- searchList.AddRange(new List<SearchItem>()
- {
- new SearchItem("companyName", "企业名称")
- });
- fields.AddRange(new List<FieldItem>()
- {
- new FieldItem("companyName", "企业名称")
- });
- }
- else
- {
- fields.AddRange(new List<FieldItem>()
- {
- new FieldItem("startDateTime", "启动时间", "DateFormatter"),
- new FieldItem("endDateTime", "关闭时间", "DateFormatter"),
- new FieldItem("stateLastChangeTime", "状态变更时间", "DateTimeFormatter"),
- new FieldItem("stateLastChangeCause", "状态变更原由"),
- });
- }
- searchList.AddRange(new List<SearchItem>()
- {
- new SearchItem("caseName", "项目名称"),
- new SearchItem("code", "合同编号"),
- new SearchItem("name", "合同名称"),
- new SearchItem("contractState", "合同状态", FieldType.I).SetSelectItem(contractState),
- new SearchItem("startDateTime", "启动时间", FieldType.Dn),
- });
- if (AbpSession.AccountType == AccountTypeDefinition.System)
- {
- searchList.Add(new SearchItem("hasLawFirm", "分配律所").SetSelectItem(new List<SelectListItem>()
- {
- new SelectListItem(){Text = @"全部",Value = ""},
- new SelectListItem(){Text = @"未分配",Value = "0"},
- new SelectListItem(){Text = @"已分配",Value = "1"},
- }));
- fields.Add(new FieldItem("lawFirmName", "律所名称", "LawFirmNameFormatter"));
- }
- fields.Add(new FieldItem("", "操作", "ActionsFormatter"));
- var searchForm = new SearchFormViewModel(searchList);
- var table = new TableViewModel(IwbConsts.ApiAppUrl + "LegalContract/GetAll", "", searchForm)
- .SetFields(fields);
- // var inputs = new List<Input>()
- //{
- // new InputHide("id"),
- // new Input("code", "合同编号").SetNotRequired(),
- // new Input("name", "合同名称").SetNotRequired(),
- // new Input("caseNo", "项目信息").SetNotRequired(),
- // };
- // var modalBody = new ModalBodyViewModel().AddInputs(inputs);
- // var modal = new ModalViewModel("合同信息").SetBody(modalBody);
- var modal_lawFirm = new ModalViewModel("分配律所", "", new ModalBodyViewModel(new List<Input>()
- {
- new InputHide("id"),
- new AjaxSelect("lawFirmNo", "律所信息", "LawFirm", "contract", "query_lawFirm", "lawFirmNo")
- }, "form-lawFirm"), "modal-lawFirm", 0, "");
- var body_lawyer = new ModalBodyViewModel(new List<Input>()
- {
- new AjaxSelect("lawyerNo", "关联律师", "Lawyer", "", "query_lawyer").SetSearchClear("lawyerNo"),
- }, "form-lawyer");
- body_lawyer.AddInput((bool)ViewBag.IsLawFirmMaster ? new Input("lawyerMaster", "负责人").SetSelectOptions("<option value=\"0\" selected>辅助律师</option><option value=\"1\">主律师</option>") : new InputHide("lawyerMaster"));
- var modal_lawyer = new ModalViewModel("添加律师", "", body_lawyer, "modal-lawyer", 0, "");
- }
- @section css{
- }
- @Html.Partial("Table/_Table", table)
- @section modal{
- <!--Modal Start-->
- @*@Html.Partial("Modals/_Modal", modal)*@
- <div class="modal fade " id="modal-lawyers" aria-modal="true">
- <div class="modal-dialog modal-dialog-centered modal-lg" style="margin-top: 15px;">
- <div class="modal-content">
- <div class="modal-header" style="cursor: move;">
- <h4 class="modal-title">分配律师 <button class="btn btn-iwb btn-sm ml-2" onclick="AddLawyer()">添加律师</button></h4>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- </div>
- <div class="modal-body">
- <form id="form-lawyers" class="iwb-dynamic-box">
- <div class="row box-label">
- <div class="col-md-9"><label>律师姓名</label></div>
- <div class="col-md-2"><label>主律师</label></div>
- <div class="col-md-1"><label>操作</label></div>
- </div>
- <div class="box-body"></div>
- </form>
- </div>
- @Html.Partial("Modals/_ModalFooter", "0")
- </div>
- </div>
- </div>
- @Html.Partial("Modals/_Modal", modal_lawFirm)
- @Html.Partial("Modals/_Modal", modal_lawyer)
- @Html.Partial("Query/_LawFirm", new QuerySearchModel("query_lawFirm", "lawFirmNo").SetOriginField("id").SetAjaxSelectName("name"))
- @if (AbpSession.AccountType == AccountTypeDefinition.Lawyer)
- {
- @Html.Partial("Query/_LawyerWithLaw", new QuerySearchModel("query_lawyer", "lawyerNo|lawyer_no").SetOriginField("id").SetAjaxSelectName("name").SetSearchFun("SetLawyerQueryFun()"))
- }
- <!--Modal End-->
- }
- @section scripts
- {
- <script type="text/javascript">
- var $table;
- $(function() {
- $table = LoadTable();
- var funs = window.iwbfuns || { none: function() { console.log("No type"); } };
- funs["btnCreate"] = function() { BtnCreate({ data: { id: "" } }); }
- funs["btnUpdate"] = function() { BtnUpdate({ disabled: "" }); };
- });
- function GoDetail(id) {
- window.location.href = '@Url.Action("ContractDetail")' + '/' + id;
- }
- </script>
- <script id="LawFirm-Script">
- function SetLawFirm(id, name) {
- OpenModal({
- url: abp.appUrl + "LegalContract/SetLawFirm",
- modal: "modal-lawFirm",
- shownBefore: function () {
- $.iwbAjax4({
- url: abp.appUrl + "LegalContract/CheckContractHasLawFirm?no=" + id,
- success: function (res) {
- if (res) {
- abp.message.error("当前合同已分配!").done(function () {
- $("#modal-lawFirm").modal("hide");
- });
- }
- }
- });
- },
- save: function (opt) {
- var lawFirmNo = $("#modal-lawFirm #lawFirmNo").val();
- var lawFirmName = $("#modal-lawFirm #lawFirmNo option[value='" + lawFirmNo + "']").text();
- abp.message.confirm(
- '确认将合同<span class="text-danger">【{0}】</span>分配给律所<span class="text-danger">【{1}】</span>吗?分配后将无法更改!'
- .format(name, lawFirmName),
- "确认律所",
- function (isConfirmed) {
- if (isConfirmed) {
- $.iwbAjax1({
- url: opt.url,
- data: { id: id, lawFirmNo: lawFirmNo },
- success: function () {
- RefreshTable();
- $("#modal-lawFirm").modal("hide");
- }
- });
- }
- },
- true);
- }
- });
- }
- </script>
- @if (AbpSession.AccountType == AccountTypeDefinition.Lawyer)
- {
- <script id="Lawyer-Script">
- function SetLawyerQueryFun() {
- return { "KeyField": "lawFirmNo", "KeyWords": '@(AbpSession.GetClaimValue(IwbConsts.UserCompanyLawFirmClaimType))' }
- }
- //添加辅助律师
- function SetLawyer(id,caseNo) {
- OpenModal({
- data: { lawyerMaster: 0 },
- url: abp.appUrl + "LegalContract/SetLawyer",
- modal: "modal-lawyers",
- shownBefore: function () {
- $('#modal-lawyer #lawyerNo').data('column-key', caseNo);
- $.iwbAjax4({
- url: abp.appUrl + "LegalContract/GetContractLawyers?no=" + id,
- success: function(res) {
- $('#form-lawyers .box-body').empty();
- if (res && res.length) {
- res.forEach(function(v) {
- LawyerFormatter(v.no, v.name, v.isMaster);
- });
- } else {
- $('#form-lawyers .box-body')
- .html('<label class="empty text-danger">暂未分配辅助律师</label>');
- }
- }
- });
- },
- dataFun: function() {
- var data = {};
- data.id = id;
- data.list = [];
- data.master = $('#modal-lawyers input[name="master"]').val();
- $('#modal-lawyers input[name="lawyer"]').each(function() {
- var v = $(this).val();
- if (v) {
- data.list.push(v);
- }
- });
- return data;
- }
- @if ((bool) ViewBag.IsLawFirmMaster)
- {
- <text>
- , save: function (opt) {
- var data = opt.data;
- if (!data) {
- data = opt.dataFun.call();
- }
- if (!data.master) {
- abp.message.warn("请设置一名主律师!");
- return;
- }
- $.iwbAjax1({
- url: opt.url,
- data: data,
- success: function() {
- $('#modal-lawyers').modal('hide');
- }
- });
- }
- </text>
- }
- });
- }
- //添加辅助律师
- function AddLawyer() {
- OpenModal({
- modal: "modal-lawyer",
- data: { lawyerMaster: 0 },
- save: function() {
- var v = $('#modal-lawyer #lawyerNo').val(),
- n = $('#modal-lawyer #lawyerNo option[value="' + v + '"]').text(),
- m = $('#modal-lawyer #lawyerMaster').val();
- if (!v) {
- abp.message.warn("请选择一名律师!");
- return;
- } else if ($('#modal-lawyers input[value="' + v + '"]').length) {
- abp.message.warn("律师已关联,请勿重复添加!");
- return;
- }
- if (m == "1" && $('#modal-lawyers input[name="master"]').length) {
- abp.message.warn("已有主律师,请勿重复添加!");
- return;
- }
- LawyerFormatter(v, n, m == "1");
- $('#modal-lawyer').modal('hide');
- }
- });
- }
- //辅助律师显示格式化
- function LawyerFormatter(v, n, m) {
- var str =
- '<div class="row group"><input name="{2}" type="hidden" value="{0}" /><div class="col-md-9"><input type="text" class="form-control form-control-sm disabled" value="{1}" disabled="" /></div><div class="col-md-2"><input type="text" class="form-control form-control-sm disabled" value="{3}" disabled="" /></div><div class="col-md-1"><button type="button" class="btn btn-sm btn-danger" onclick="DeleteGroup(this);">删除</button></div></div>'
- .format(v, n, m ? "master" : "lawyer", m ? "主律师" : "辅助律师");
- $('#modal-lawyers .box-body .empty').remove();
- $('#form-lawyers .box-body').append(str);
- }
- function DeleteGroup(that) {
- var $that = $(that).closest('.group');
- $that.remove();
- //$that.fadeOut(500, function () {
- // $that.remove();
- //});
- }
- </script>
- }
- <!--格式化-->
- <script id="formatter-script" type="text/javascript">
- function TypeFormatter(v) {
- var name = $('#hid-type option[value="' + v + '"]').text();
- switch (v) {
- case 0:
- return '<span class="label sm label-danger">' + name + '</span>';
- default:
- return '<span class="label sm label-info">' + name + '</span>';
- }
- }
- function ContractStateFormatter(v) {
- var name = $('#hid-contract-state option[value="' + v + '"]').text();
- return name;
- }
- function LawFirmNameFormatter(v) {
- if (v) {
- return v;
- } else {
- return '<span class="text-danger">未分配</span>';
- }
- }
- function ActionsFormatter(v, r) {
- var str = '', id = r.id;
- @if (IsGranted(PermissionNames.PagesCaseContractMgContractMgSetLawFirm) && AbpSession.AccountType == AccountTypeDefinition.System)
- {
- <text>
- if (!r.lawFirmName) {
- str += '<span class="table-action" onclick="SetLawFirm(\'{1}\',\'{2}\')">{0} 分配律所</span>'.format(tableActionIcon, id,r.name);
- }
- </text>
- }
- @if (((bool) ViewBag.IsLawFirmMaster || IsGranted(PermissionNames.PagesCaseContractMgContractMgSetLawyer)) && AbpSession.AccountType == AccountTypeDefinition.Lawyer)
- {
- <text>
- if (r.isMaster) {
- str += '<span class="table-action" onclick="SetLawyer(\'{1}\',\'{2}\')">{0} 分配律师</span>'.format(tableActionIcon, id,r.caseNo);
- }
- </text>
- }
- @if (IsGranted(PermissionNames.PagesCaseContractMgContractMgQuery))
- {
- <text>
- str += '<span class="table-action" onclick="GoDetail(\'{1}\')">{0} 合同详情</span>'.format(tableActionIcon,id);
- </text>
- }
- if (!str) {
- str += '<span class="table-action" >{0} 暂无操作</span>'.format(tableActionIcon);
- }
- return str;
- }
- </script>
- }
- <section style="display: none">
- <select id="hid-contract-state">
- @Html.Raw(contractState)
- </select>
- <select id="hid-type">
- <option value=""></option>
- </select>
- @*@Html.DropDownList("hid-type", type)*@
- </section>
|