Former-commit-id: 3c4d8ffa6e9433d706e22a51de97336c29610b25
Former-commit-id: 8169dffcf5fdb8c2ced295119d36448af0711175
1.0
wanggang 4 years ago
parent 6292c4dc45
commit beadcd5325

@ -44,9 +44,9 @@ namespace IoTNode
services.AddTransient<IEmailSender, EmptyEmailSender>();
if (Env.IsDevelopment())
{
//services.AddHostedService(o => o.GetService<SerialPortService>());
//services.AddHostedService(o => o.GetService<OnvifService>());
//services.AddHostedService(o => o.GetService<FBeeService>());
services.AddHostedService(o => o.GetService<SerialPortService>());
services.AddHostedService(o => o.GetService<OnvifService>());
services.AddHostedService(o => o.GetService<FBeeService>());
services.AddHostedService(o => o.GetService<LCDAUE800DService>());
}
else

@ -1,11 +1,4 @@
@inject IHostEnvironment env
@if (!Context.Request.Path.ToString().StartsWith("/Home"))
{
Layout = null;
@Html.Raw(System.IO.File.ReadAllText(System.IO.Path.Combine(env.ContentRootPath, "wwwroot", "index.html")))
}
else
{
@{
HideBread = true;
<router-view></router-view>
@section scripts{

@ -93,7 +93,7 @@
<img class="logo" src="@Url.Content2(organImage)" />
<form method="get" action="@Url.Action("ChangeOrgan","Account",new{area=""})">
<span class="brand-text font-weight-light">
<input type="hidden" name="ReturnUrl" value="@Url.Action("Index","Home",new{area=""})/" />
<input type="hidden" name="ReturnUrl" value="@Url.Content("~/")" />
@Html.DropDownList("UserCurrentOrganNumber", list, new { @class = "organ submit", style = "height:30px;width:160px;font-size:15px;background-color:#343a40;color: rgba(255,255,255,.8);font-size:14px;" })
</span>
</form>

@ -1,4 +1,10 @@
function urlContent2(baseUrl,path) {
if (!String.prototype.endsWith) {
String.prototype.endsWith = function (endStr) {
var d = this.length - endStr.length;
return (d >= 0 && this.lastIndexOf(endStr) == d);
};
}
function urlContent2(baseUrl, path) {
if (!path.startsWith("/dfs/")) {
return baseUrl + path;
}
@ -96,34 +102,39 @@ $(function () {
}
});
});
//delete confrim
//query
$(function () {
$("th button.delete,td button.delete").click(function () {
$("button.action.query").click(function () {
var form = $(this).parents("form");
layer.confirm("确认删除?", {
title: '警告',
icon: 3,
btn: ['确认', '取消'],
btnAlign: 'c'
}, function () {
form.submit();
}, function () {
});
return false;
form.attr('action', $(this).attr('data-action'));
form.attr('method', 'get');
form[0].submit();
});
$("button.confirm").click(function () {
});
//delete confrim
$(function () {
$("button.action.confirm").click(function () {
var form = $(this).parents("form");
var list = form.find('tbody input:checked[name]');
form.attr('action', $(this).attr('data-action'));
var msg = "确认" + $(this).text() + "?";
layer.confirm(msg, {
title: '警告',
icon: 3,
btn: ['确认', '取消'],
btnAlign: 'c'
}, function () {
form.submit();
}, function () {
});
form.attr('method', 'post');
var msg = "确认" + $(this).text() + "";
if (!list.length) {
Swal.fire('没有选中任何记录!');
}
else {
Swal.fire({
text: msg,
confirmButtonText: '确定',
cancelButtonText: '取消',
showCancelButton: true
}).then(function (value) {
if (value.isConfirmed) {
form[0].submit();
}
});
}
return false;
});
});
@ -138,13 +149,57 @@ function InitControls() {
$.datetimepicker.setLocale('zh');
$('.edit-date').datetimepicker({ timepicker: false, format: 'Y-m-d' });
$('.edit-datetime').datetimepicker({ format: 'Y-m-d H:i' });
$('.edit-time').datetimepicker({ datepicker: false, format: 'H:i' });
}
//
$(".edit-multiSelect").treeMultiselect({ enableSelectAll: true, searchable: true, selectAllText: "全选", unselectAllText: "反选" });
$(".edit-multiSelect").each(function () {
$(this).treeMultiselect({ enableSelectAll: true, searchable: true, selectAllText: "全选", unselectAllText: "反选" });
});
//
$('select.search').select2({
theme: "bootstrap4",
language: "zh-CN"
$('select.select2bs4').each(function () {
var allow = $(this).attr('data-allow-input') === 'true';
$(this).select2({
tags: allow,
theme: "bootstrap4",
language: "zh-CN",
placeholder: '请选择',
allowClear: true
}).change(function () {
$(this).valid();
});;
});
$('select.select2bs4.search').each(function () {
var url = $(this).attr('data-search-url');
$(this).select2({
theme: "bootstrap4",
language: "zh-CN",
placeholder: '请选择',
allowClear: true,
minimumInputLength: 2,
ajax: {
url: url,
data: function (params) {
var query = {
search: params.term,
type: 'public'
}
return query;
},
dataType: 'json',
processResults: function (data) {
return {
results: Enumerable.from(data).select(function (o) { return { id: o.value, text: o.text }; }).toArray()
};
}
}
});
});
//
$('select[data-remote-target]').each(function () {
var sourceId = $(this).attr('data-remote-source');
var targetId = $(this).attr('data-remote-target');
var url = $(this).attr('data-remote-url');
change(sourceId, targetId, url);
});
//
$('input.cron').each(function () {
@ -192,7 +247,7 @@ function InitEditor(K) {
var emtpyImage = $(this).attr('data-emptyImage');
var baseUrl = $(this).attr('data-baseUrl');
var isRequired = $(this).attr('data-val-required') !== undefined;
var editor = K.editor({
var editor = KindEditor.editor({
allowImageUpload: true,
formatUploadUrl: false,
uploadJson: uploadUrl
@ -200,13 +255,13 @@ function InitEditor(K) {
KindEditor(btn_id).click(function () {
editor.loadPlugin('insertfile', function () {
editor.plugin.fileDialog({
fileUrl: K('#' + id).val(),
fileUrl: $('#' + id).val(),
clickFn: function (url, title) {
$('#' + id).attr('value', url);
if (isRequired) {
$('#' + id).parents('form').validate().element('#' + id);
}
$(image_id).attr('src', urlContent2(baseUrl,url));
$(image_id).attr('src', urlContent2(baseUrl, url));
$(image_id).parent('a').attr('href', urlContent2(baseUrl, url));
editor.hideDialog();
}
@ -228,7 +283,7 @@ function InitEditor(K) {
var uploadUrl = $(this).attr('data-uploadUrl');
var baseUrl = $(this).attr('data-baseUrl');
var isRequired = $(this).attr('data-val-required') !== undefined;
var editor = K.editor({
var editor = KindEditor.editor({
allowImageUpload: true,
formatUploadUrl: false,
uploadJson: uploadUrl
@ -236,7 +291,7 @@ function InitEditor(K) {
KindEditor(btn_id).click(function () {
editor.loadPlugin('insertfile', function () {
editor.plugin.fileDialog({
fileUrl: K('#' + id).val(),
fileUrl: $('#' + id).val(),
clickFn: function (url, title) {
$('#' + id).attr('value', url);
if (isRequired) {
@ -257,7 +312,7 @@ function InitEditor(K) {
var id = '#file_' + $(this).attr('id');
var btn_id = '#' + $(this).attr('id');
var uploadUrl = $(this).attr('data-action');
var editor = K.editor({
var editor = KindEditor.editor({
allowFileManager: false,
allowImageUpload: true,
formatUploadUrl: false,
@ -267,9 +322,9 @@ function InitEditor(K) {
editor.loadPlugin('image', function () {
editor.plugin.imageDialog({
showRemote: false,
imageUrl: K(id).val(),
imageUrl: $(id).val(),
clickFn: function (url, title, width, height, border, align) {
K('id').val(url);
$('id').val(url);
editor.hideDialog();
location.reload();
}
@ -277,12 +332,11 @@ function InitEditor(K) {
});
});
});
}
KindEditor.ready(function (K) {
InitEditor(K);
});
$(function(){
$(function () {
$("button.list-export").click(function () {
var form = $(this).parents("form");
form.attr('target', '_blank');
@ -296,6 +350,11 @@ $(function(){
$(function () {
InitControls();
});
$('body').on('change', 'select.submit', function () {
$(this).parents('form').submit();
});
$('body').on('click', '.cmd', function () {
$.getJSON($(this).attr('href'), function (response) {
console.log(response);
@ -305,15 +364,34 @@ $('body').on('click', '.cmd', function () {
});
return false;
});
function change(sourceId, targetId, url) {
if (document.getElementById(targetId)) {
$('#' + sourceId).change(function () {
var id = $(this).find(':selected').val();
update(url, id, '#' + targetId);
});
}
if (document.getElementById('Query_' + targetId)) {
$('#Query_' + sourceId).change(function () {
var id = $(this).find(':selected').val();
update(url, id, '#Query_' + targetId);
});
}
}
function update(url, parent, targetId) {
$(targetId).find('option').not('[value=""]').remove();
if (!document.querySelector(targetId)) {
return;
}
$(targetId).find('option').not('[value=""]').remove().change();
if (url !== null) {
url += '?parentId=' + encodeURI(parent);
url = URI(url).addSearch("parentId", parent);
$('#loadingToast:hidden ').show();
$.getJSON(url, function (data) {
$.each(data, function (i, v) {
$(targetId).append('<option value="' + v.value + '">' + v.text + '</option>');
});
}).always(function () {
$('#loadingToast:visible').hide();
});
}
}
@ -321,7 +399,4 @@ function reset() {
$('form').removeData('validator');
$('form').removeData('unobtrusiveValidation');
$.validator.unobtrusive.parse('form');
}
$('body').on('change', 'select.submit', function () {
$(this).parents('form').submit();
});
}
Loading…
Cancel
Save