- @if (PS.Config.Company == CompanyEnum.广发商贸)
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
diff --git a/YLErpWeb/Views/margin_template_v2/margin_template_v2ClientList.cshtml b/YLErpWeb/Views/margin_template_v2/margin_template_v2ClientList.cshtml
index 161fb33e..7e0e4226 100644
--- a/YLErpWeb/Views/margin_template_v2/margin_template_v2ClientList.cshtml
+++ b/YLErpWeb/Views/margin_template_v2/margin_template_v2ClientList.cshtml
@@ -50,6 +50,8 @@
name: 'RuleType', label: '预付金规则', index: 'RuleType', width: 150, formatter: ruleTypeFormat
}, {
name: 'TradeTypes', label: '适用结构', index: 'TradeTypes', width: 460
+ }, {
+ name: 'BookScopeName', label: '适用簿记账户', index: 'BookScopeName', width: 240
}];
function showToolName(cellValue, options, rowObject) {
@@ -197,4 +199,4 @@
-@Html.Raw(JqGridSimple.OutTable())
\ No newline at end of file
+@Html.Raw(JqGridSimple.OutTable())
diff --git a/YLErpWeb/Views/margin_template_v2/margin_template_v2DefaultList.cshtml b/YLErpWeb/Views/margin_template_v2/margin_template_v2DefaultList.cshtml
index 2e841f0c..9f183439 100644
--- a/YLErpWeb/Views/margin_template_v2/margin_template_v2DefaultList.cshtml
+++ b/YLErpWeb/Views/margin_template_v2/margin_template_v2DefaultList.cshtml
@@ -49,6 +49,8 @@
name: 'RuleType', label: '预付金规则', index: 'RuleType', width: 150, formatter: ruleTypeFormat
}, {
name: 'TradeTypes', label: '适用结构', index: 'TradeTypes', width: 460
+ }, {
+ name: 'BookScopeName', label: '适用簿记账户', index: 'BookScopeName', width: 240
}, {
name: 'BuySellTypeName', label: '适用买卖方向', index: 'BuySellTypeName', width: 150
}, {
@@ -201,4 +203,4 @@
-@Html.Raw(JqGridSimple.OutTable())
\ No newline at end of file
+@Html.Raw(JqGridSimple.OutTable())
diff --git a/YLErpWeb/wwwroot/Scripts/app/client/clientMarginTemplateEdit.js b/YLErpWeb/wwwroot/Scripts/app/client/clientMarginTemplateEdit.js
index ae0bf1b1..ee9aaac4 100644
--- a/YLErpWeb/wwwroot/Scripts/app/client/clientMarginTemplateEdit.js
+++ b/YLErpWeb/wwwroot/Scripts/app/client/clientMarginTemplateEdit.js
@@ -1,6 +1,4 @@
-const consClients = ylotc.clients;
-
-//定价格式化(来自配置)
+//定价格式化(来自配置)
const inputFormatPercent = Object.freeze({ precision: 2, append: '%' });
const inputFormatPercentNegative = Object.freeze({ precision: 2, append: '%', negative: true });
const inputFormatNegative = Object.freeze({ precision: 2, negative: true });
@@ -26,10 +24,9 @@ const vue = new Vue({
clientMarginTemplate: page.clientMarginTemplate,
marginTemplates: page.marginTemplates,
marginTemplate: page.marginTemplate,
- clientLevels: [],
clientNames: [],
- isClientLevelDisabled: false,
- isClientNameDisabled: false,
+ //新增模式的客户多选(编辑模式仍为单条绑定,走 clientMarginTemplate.ClientId)
+ selectedClientIds: [],
isAdd: page.isAdd
},
created: function () {
@@ -116,10 +113,6 @@ const vue = new Vue({
amountBase: '期初全价 × 券面总额'
};
},
- //changeClient(yldata) {
- // let client = yldata || { id: 0 };
- // this.clientMarginTemplate.ClientId = client.id;
- //},
changeMarginTemplate() {
this.marginTemplates.forEach(x => {
if (this.clientMarginTemplate.MarginTemplateId === x.id) {
@@ -127,15 +120,54 @@ const vue = new Vue({
$('#suitableType').prop('title', this.marginTemplate.TradeTypes);
}
});
-
+
},
+ //新增=多选:按选中客户逐条调用原有单条保存接口(后端不变,每条走完整互斥校验);
+ //编辑=单条,保持原行为。逐条收集成败,结束统一汇总——部分失败时列表刷新已成功部分,弹窗留在
+ //当前内容上供修正重试(已成功的客户重试会因同天同结构互斥校验失败,不会重复入库)
saveMarginTemplateV2() {
var thisObj = this;
- main.post("/client_margin_template/saveClientMarginTemplate", { clientMarginTemplate: thisObj.clientMarginTemplate }).done(function (resp) {
- try {
- window.parent.reloadmargin_template();
- (parent || window).layer.closeAll();
- } catch (e) { }
+ var ids = this.isAdd ? (this.selectedClientIds || []) : [this.clientMarginTemplate.ClientId];
+ if (!ids.length) {
+ main.message("请至少选择一个客户");
+ return;
+ }
+ if (!this.clientMarginTemplate.MarginTemplateId) {
+ main.message("请选择有效的预付金模板");
+ return;
+ }
+ var okCount = 0;
+ var fails = [];
+ var chain = Promise.resolve();
+ ids.forEach(function (clientId) {
+ chain = chain.then(function () {
+ //深拷贝:逐条改写 ClientId/id,绝不污染 Vue 表单对象(部分失败时弹窗保持打开)
+ var payload = _.cloneDeep(thisObj.clientMarginTemplate);
+ payload.ClientId = clientId;
+ payload.id = thisObj.isAdd ? 0 : thisObj.clientMarginTemplate.id;
+ //alertFn 置空:单条失败不逐个弹窗,由循环结束后统一汇总
+ return main.post("/client_margin_template/saveClientMarginTemplate",
+ { clientMarginTemplate: payload },
+ { alertFn: function () { }, suppressError: true }
+ ).then(function () {
+ okCount++;
+ }, function (resp) {
+ fails.push({ id: clientId, msg: (resp && (resp.msg || resp.errmsg)) || "保存失败" });
+ });
+ });
+ });
+ chain.then(function () {
+ try { window.parent.reloadmargin_template(); } catch (e) { }
+ if (!fails.length) {
+ try { (parent || window).layer.closeAll(); } catch (e) { }
+ return;
+ }
+ var nameOf = function (cid) {
+ var c = thisObj.clientNames.find(function (x) { return String(x.Value) === String(cid); });
+ return c ? c.Text : cid;
+ };
+ var detail = fails.map(function (f) { return nameOf(f.id) + ":" + f.msg; }).join("
");
+ main.alert("成功 " + okCount + " 条,失败 " + fails.length + " 条:
" + detail);
});
},
showTemplateDetail(detail) {
@@ -146,28 +178,6 @@ const vue = new Vue({
vueDetail.ruleType = vue.marginTemplate.RuleType;
$("#myModal").modal("show");
},
- SetClientLevelDropDown() {
- $.ajax({
- type: "get",
- url: "/client_margin_template/GetAllClientLevels",
- success: function (data) {
- if (data.obj) {
- for (var i = 0; i < data.obj.length; i++) {
- vue.clientLevels.push(data.obj[i]);
- }
-
- if (vue.isAdd) {
- vue.clientMarginTemplate.ClientLevel = data.obj[0].Value;
- }
-
-
- }
- },
- error: function (msg) {
- alert("error:" + msg);
- }
- });
- },
SetClientNameDropDown() {
$.ajax({
type: "get",
@@ -179,6 +189,14 @@ const vue = new Vue({
vue.clientNames.push(data.obj[i]);
}
}
+ //选项就位后再初始化/刷新 chosen(多选客户),并同步"有选中即隐藏搜索框"行为
+ Vue.nextTick(function () {
+ SetAceDropDown();
+ $('.chosen-select').trigger('chosen:updated');
+ $('select.chosen-select[multiple]').each(function () {
+ refreshChosenSearchField(this);
+ });
+ });
},
error: function (msg) {
alert("error:" + msg);
@@ -187,58 +205,11 @@ const vue = new Vue({
}
},
mounted() {
- if (page.isGFSM) {
- if (this.isAdd) {
- this.isClientNameDisabled = true;
- }
- else {
- if (this.clientMarginTemplate.ClientId == "0") this.isClientNameDisabled = true;
- if (this.clientMarginTemplate.ClientLevel == "") this.isClientLevelDisabled = true;
- }
-
- this.SetClientLevelDropDown();
-
- }
this.SetClientNameDropDown();
if (this.marginTemplate.TradeTypes != null && this.marginTemplate.TradeTypes != 'undefined') {
$('#suitableType').prop('title', this.marginTemplate.TradeTypes);
}
-
- },
- watch: {
- 'clientMarginTemplate.ClientLevel': {
- handler(newVal, oldVal) {
- if (newVal == '') {
- this.isClientLevelDisabled = true;
- this.isClientNameDisabled = false;
- if (this.clientMarginTemplate.ClientId == '0') {
- if (this.clientNames.length > 0) {
- this.clientMarginTemplate.ClientId = this.clientNames[0].Value;
- }
- }
-
- }
-
- },
- immediate: false
- },
- 'clientMarginTemplate.ClientId': {
- handler(newVal, oldVal) {
- if (newVal == '0') {
- this.isClientNameDisabled = true;
- this.isClientLevelDisabled = false;
- if (this.clientMarginTemplate.ClientLevel == '') {
- if (this.clientLevels.length > 0) {
- this.clientMarginTemplate.ClientLevel = this.clientLevels[0].Value;
- }
- }
-
- }
-
- },
- immediate: false
- }
},
components: {
'vue-datepicker': FastVue.vueDatePicker(),
@@ -246,6 +217,17 @@ const vue = new Vue({
}
});
+//多选 chosen:已有选中项后隐藏搜索框(与 marginTemplateV2*Edit.js 同款行为)——
+//空框没有输入内容却占一行,放不下时还会换行留白;全部取消后恢复占位提示。
+//须为顶层函数:SetClientNameDropDown 的 nextTick 回调也会调用
+function refreshChosenSearchField(select) {
+ var $sel = $(select);
+ var $container = $sel.next('.chosen-container-multi');
+ if ($container.length === 0) return;
+ var noneSelected = $sel.find('option:selected').length === 0;
+ $container.find('li.search-field').toggle(noneSelected);
+}
+
$(function () {
$(".datepicker").change(function () {
var dateVal = $(this).val();
@@ -269,33 +251,15 @@ $(function () {
$(this).datepicker("setDate", dateVal);
});
+ //勾选变化走原 select 的 jQuery change 委托(chosen trigger_form_field_change),在此统一刷新搜索框
+ $(document).on('change chosen:updated', 'select.chosen-select[multiple]', function () {
+ refreshChosenSearchField(this);
+ });
+
SetAceDropDown();
-
- var width = 152;
- for (var i = 0; i < consClients.length; i++) {
- let ele = document.createElement('span')
- ele.innerText = consClients[i].Name;
- ele.style.fontSize = '14px';
- document.documentElement.append(ele);
- var charLength = ele.offsetWidth + 28;//滚动条
- document.documentElement.removeChild(ele);
- if (charLength > width) {
- width = charLength
- }
- }
-
- //if (!page.isGFSM) {
- // let autoClient = FastVue.autocomplete(document.getElementById('ClientId'), {
- // nameField: 'Name', valueField: 'id', searchField: ['Name', 'PinYin'], width: width,
- // lookup: consClients, onSelect: vue.changeClient
- // });
- // let clientId = page.clientMarginTemplate.ClientId;
- // let client = clientId ? consClients.find(x => x.id === clientId) : null;
- // !client && page.isAdd && (client = consClients[0]);
- // autoClient.setData(client);
- // vue.changeClient(client);
- //}
-
+ $('select.chosen-select[multiple]').each(function () {
+ refreshChosenSearchField(this);
+ });
});
var vueDetail = new Vue({
diff --git a/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2DefaultEdit.js b/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2DefaultEdit.js
index 34699cb4..8fb25572 100644
--- a/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2DefaultEdit.js
+++ b/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2DefaultEdit.js
@@ -631,15 +631,16 @@ $(function () {
if (!isNaN(idx)) vue.onUnderlyingTypeChange(idx);
});
- //多选 chosen:可选项已全部选中时隐藏搜索框——没有剩余项可选,空搜索框只会把控件撑高一截;
- //取消勾选后自动恢复。勾选变化会触发原 select 的 jQuery change(trigger_form_field_change),
+ //多选 chosen:已有选中项后隐藏搜索框——空框没有输入内容却占一行,放不下时还会换行留白
+ //(本页多选均为点选场景,无需键盘过滤);全部取消后恢复,显示"请选择…"占位。
+ //勾选变化会触发原 select 的 jQuery change(trigger_form_field_change),
//加载重建/增删区块后的 refreshChosen 会触发 chosen:updated,两处都走这里的委托统一刷新
function refreshChosenSearchField(select) {
var $sel = $(select);
var $container = $sel.next('.chosen-container-multi');
if ($container.length === 0) return;
- var allSelected = $sel.find('option').length > 0 && $sel.find('option:not(:selected)').length === 0;
- $container.find('li.search-field').toggle(!allSelected);
+ var noneSelected = $sel.find('option:selected').length === 0;
+ $container.find('li.search-field').toggle(noneSelected);
}
$(document).on('change chosen:updated', 'select.chosen-select[multiple]', function () {
refreshChosenSearchField(this);
diff --git a/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2Edit.js b/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2Edit.js
index f725c624..90a3d144 100644
--- a/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2Edit.js
+++ b/YLErpWeb/wwwroot/Scripts/app/marginTemplate/marginTemplateV2Edit.js
@@ -599,15 +599,16 @@ $(function () {
if (!isNaN(idx)) vue.onUnderlyingTypeChange(idx);
});
- //多选 chosen:可选项已全部选中时隐藏搜索框——没有剩余项可选,空搜索框只会把控件撑高一截;
- //取消勾选后自动恢复。勾选变化会触发原 select 的 jQuery change(trigger_form_field_change),
+ //多选 chosen:已有选中项后隐藏搜索框——空框没有输入内容却占一行,放不下时还会换行留白
+ //(本页多选均为点选场景,无需键盘过滤);全部取消后恢复,显示"请选择…"占位。
+ //勾选变化会触发原 select 的 jQuery change(trigger_form_field_change),
//加载重建/增删区块后的 refreshChosen 会触发 chosen:updated,两处都走这里的委托统一刷新
function refreshChosenSearchField(select) {
var $sel = $(select);
var $container = $sel.next('.chosen-container-multi');
if ($container.length === 0) return;
- var allSelected = $sel.find('option').length > 0 && $sel.find('option:not(:selected)').length === 0;
- $container.find('li.search-field').toggle(!allSelected);
+ var noneSelected = $sel.find('option:selected').length === 0;
+ $container.find('li.search-field').toggle(noneSelected);
}
$(document).on('change chosen:updated', 'select.chosen-select[multiple]', function () {
refreshChosenSearchField(this);
diff --git a/YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css b/YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css
index 424ff76d..d3e8dbd1 100644
--- a/YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css
+++ b/YLErpWeb/wwwroot/Style/Css/margin_template_v2Edit.css
@@ -137,10 +137,13 @@ p {
width: 4px;
}
-/*多选 chosen 的隐藏搜索框:全局 input[type=text] 152px 会把它撑宽到与已选标签挤不下而换行,
- 在控件底部留出一截空行;限制宽度使 标签+搜索框 保持单行*/
-.form-layout .chosen-container-multi .chosen-choices li.search-field input {
- max-width: 70px;
+/*多选 chosen:有选中项后由页面 JS 隐藏搜索框(见 marginTemplateV2*Edit.js 的 refreshChosenSearchField),
+ 空态时搜索框独占控件全宽,负责展示"请选择…"占位*/
+
+/*期限档位表操作列:delBtn 的 20px 左边距在 fixed 布局的窄列里会把"- 删除区块"挤成竖排*/
+.border.detail td .delBtn {
+ margin-left: 0;
+ white-space: nowrap;
}
/*区块标题(新模板信息/选择模板规则/参数组N):左色条 + 加粗,与表单正文分层*/
@@ -160,3 +163,9 @@ p {
.border.detail table {
table-layout: fixed;
}
+
+/*标的资产类型多选(期限档位表单元格内):chosen 初始化取原生 select 的固有宽度(约 150px),
+ 窄容器放不下第二个已选标签,导致标签逐行竖排;单元格空间充足,容器撑满即可横向排列*/
+.border.detail .chosen-container-multi {
+ width: 100% !important;
+}