Former-commit-id: e842d76e86fea09b67353b0116b997e40a1a0ba7
Former-commit-id: c0116a68d7f900cd09ddb24de481ca7eca283896
1.0
wanggang 4 years ago
parent 3b0cfa2da0
commit 4e5fb2e10b

@ -18,9 +18,6 @@
<ItemGroup>
<EmbeddedResource Include="wwwroot\**\*" />
</ItemGroup>
<ItemGroup>
<Content Remove="wwwroot\js\tools.js" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Application\Application.csproj" />
</ItemGroup>

@ -1,19 +0,0 @@
//PubSub
PubSub.subscribes = function (events, action) {
if (!events || !action) {
return;
}
for (var i = 0; i < events.length; i++) {
PubSub.subscribe(events[i], function (m, d) { action(m, d); });
}
}
PubSub.unsubscribes = function (events) {
if (!events) {
return;
}
for (var i = 0; i < events.length; i++) {
PubSub.unsubscribe(events[i]);
}
}
//Axios

@ -6,6 +6,12 @@
<GenerateAssemblyProductAttribute>true</GenerateAssemblyProductAttribute>
<Version>1.1.1.1</Version>
</PropertyGroup>
<ItemGroup>
<Content Remove="wwwroot\js\site.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\js\site.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.1" />
<PackageReference Include="Kveer.XmlRPC" Version="1.1.1" />

@ -10,7 +10,7 @@ namespace Platform.Application.Models.IoTCenter
[Display(Name = "分类")]
[SelectList]
[Required(ErrorMessage = nameof(RequiredAttribute))]
public Guid? CategoryId { get; set; }
public Guid? IoTProductCategoryId { get; set; }
[Display(Name = "序号")]
public int Order { get; set; }

@ -32,7 +32,7 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
public override IQueryable<IoTProduct> Query(PagedListModel<EditPlatformIoTProductModel> model, IQueryable<IoTProduct> query)
{
return query
.WhereIf(model.Query.CategoryId.HasValue, o => o.IoTProductCategoryId == model.Query.CategoryId.Value)
.WhereIf(model.Query.IoTProductCategoryId.HasValue, o => o.IoTProductCategoryId == model.Query.IoTProductCategoryId.Value)
.WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name))
.WhereIf(!string.IsNullOrEmpty(model.Query.Number), o => o.Number.Contains(model.Query.Number))
.WhereIf(!string.IsNullOrEmpty(model.Query.Path), o => o.Path.Contains(model.Query.Path))
@ -46,21 +46,21 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
public override void ToDisplayModel(IoTProduct entity, EditPlatformIoTProductModel model)
{
if (model.CategoryId.HasValue)
if (model.IoTProductCategoryId.HasValue)
{
var name = this._productCategoryRepo.ReadOnlyTable()
.Where(o => o.ParentId != null)
.Where(o => o.Left <= entity.IoTProductCategory.Left && o.Right >= entity.IoTProductCategory.Right).ToList()
.ToList()
.ToTree()
.FirstOrDefault(o => o.Id == model.CategoryId.Value)?.GetDisplayName();
ViewData.Add(model.CategoryId, name);
.FirstOrDefault(o => o.Id == model.IoTProductCategoryId.Value)?.GetDisplayName();
ViewData.Add(model.IoTProductCategoryId, name);
}
}
public override void ToEditModel(IoTProduct entity, EditPlatformIoTProductModel model)
{
ViewData.SelectList(o => model.CategoryId, () => this._ajax.GetIoTProductCategory(model.CategoryId).SelectList());
ViewData.SelectList(o => model.IoTProductCategoryId, () => this._ajax.GetIoTProductCategory(model.IoTProductCategoryId).SelectList());
}
}
}

@ -8,9 +8,11 @@
</PropertyGroup>
<ItemGroup>
<Content Remove="wwwroot\css\site.css" />
<Content Remove="wwwroot\js\site.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\css\site.css" />
<EmbeddedResource Include="wwwroot\js\site.js" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.18" />

@ -35,24 +35,6 @@
<label style="width:100%;">亮度:<input @change="changeBrightness($event.target.value)" type="range" min="0" step="1" max="254" name="brightness" :value="brightness" style="height:5px;margin:5px auto;-webkit-appearance:none;background: -webkit-linear-gradient(left, #000 0%, #fff 100%);" /></label>
</div>
</a-modal>
<!--<div class="card-body">
<div class="row">
<div class="col-2 align-self-center">
<div class="mh-100" :style="'width:48px;height:48px;border-radius: 10px;background:'+hsl"></div>
</div>
<div class="col-8 align-self-center">
<div class="row" style="height:58px;">
<input @change="changeHue($event.target.value)" type="range" min="0" step="1" max="255" name="hue" :value="hue" style="height:5px;margin:5px auto;-webkit-appearance:none;background: -webkit-linear-gradient(left, #F00 0%, #FF0 16.66%, #0F0 33.33%, #0FF 50%,#00F 66.66%, #F0F 83.33%, #F00 100%);" />
<input @change="changeSaturation($event.target.value)" type="range" min="0" step="1" max="254" name="saturation" :value="saturation" :style="'height:5px;margin:5px auto;-webkit-appearance:none;background: -webkit-linear-gradient(left, #fff 0%, '+color+' 100%);'" />
<input @change="changeBrightness($event.target.value)" type="range" min="0" step="1" max="254" name="brightness" :value="brightness" style="height:5px;margin:5px auto;-webkit-appearance:none;background: -webkit-linear-gradient(left, #000 0%, #fff 100%);" />
</div>
</div>
<div class="col-2 align-self-center text-center">
<img class="pointer" v-if="getDeviceDataValue(device,'状态')==='开'" @click="execApi(device.number,'/Socket/Off')" src="images/on.svg" />
<img class="pointer" v-else="getDeviceDataValue(device,'状态')==='关'" @click="execApi(device.number,'/Socket/On')" src="images/off.svg" />
</div>
</div>
</div>-->
</div>
</template>
<script>

@ -174,7 +174,7 @@
export default {
data() {
return {
url: config.baseUrl + '/Home/GetOrgan',
url: config.service('platform/Home/GetOrgan'),
model: {
organ: null,
building: null,
@ -268,7 +268,7 @@
this.model.building = null;
}
else {
var url = config.baseUrl + '/Home/GetBuilding/' + id;
var url = config.service('platform/Home/GetBuilding/' + id);
axios.get(url).then(function (response) {
parent.model.building = response.data;
});

@ -58,7 +58,7 @@
export default {
data: function () {
return {
url: config.baseUrl + 'Site/Layout',
url: config.service('platform/Site/Layout'),
viewPath:'/components/views/areas/'
}
},

@ -76,6 +76,7 @@
<script src="lib/element-ui/index.min.js"></script>
<script src="lib/element-ui/locale/zh-CN.min.js"></script>
<script src="lib/ant-design-vue/antd.min.js"></script>
<script src="js/config.js"></script>
<script src="js/app.js"></script>
<script src="js/main.js"></script>
<script src="js/site.js"></script>

@ -91,7 +91,7 @@ function getIoTDataDescription(device, name) {
//调用API
function execApi(number, method, query) {
loading.show();
axios.post(config.baseUrl + '/platform/api/v1/api/execApi', { connectionId, number, method, query })
axios.post(config.service('platform') + 'api/v1/api/execApi', { connectionId, number, method, query })
.then(function (response) {
})
.catch(function (error) {
@ -104,7 +104,7 @@ function execApi(number, method, query) {
//调用场景
function execScene(id) {
loading.show();
axios.post('/platform/api/v1/api/execScene', { id, connectionId })
axios.post(config.service('platform') + 'api/v1/api/execScene', { id, connectionId })
.then(function (response) {
console.log(response);
})

@ -1,6 +1,15 @@
var config = {
baseUrl: '',
url: function (path) {
return this.baseUrl + path;
/*
* 1.前端目录通过document.location.origin和document.currentScript属性取得
* 2.网关地址跨域时需要填写具体地址并设置crossDomain为true
*/
const config = {
crossDomain: false,
path: document.currentScript.src.substring(document.location.origin.length, document.currentScript.src.length - 'js/config.js'.length),
file: function (file) {
return this.path + file;
},
gateway: 'http://example_gateway_host/',
service: function (service) {
return (this.crossDomain ? this.gateway : '/') + service + '/';
}
};

@ -1,12 +1,4 @@
//配置:
var config = {
baseUrl: '',
url: function (path) {
return this.baseUrl + path;
}
};
//添加通用组件:
//添加通用组件:
addVueComponents({
prefix: "/components/views/shared/",
list: [
@ -36,7 +28,7 @@ addVueComponents({
//message:
var connectionId;
var connection = new signalR.HubConnectionBuilder().withUrl(config.url('hub?group=page')).build();
var connection = new signalR.HubConnectionBuilder().withUrl(config.service('platform/hub?group=page')).build();
connection.onclose(function () {
console.log('connect closed');
connect();

@ -0,0 +1,402 @@
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;
}
return path;
}
//agree with
jQuery.validator.addMethod("mustbetrue", function (value, element) {
return element.checked;
});
jQuery.validator.unobtrusive.adapters.addBool("mustbetrue");
function clearSelectList() {
for (var i = 0; i < arguments.length; i++) {
$(arguments[i]).find('option').not('[value=""]').remove();
}
}
//radio list
$.validator.unobtrusive.adapters.addBool("radio", "required");
function updateSelectList(url, id) {
$.getJSON(url, function (data) {
$.each(data, function (i, v) {
$(id).append('<option value="' + v.value + '">' + v.text + '</option>');
});
});
}
//scroll to top
(function ($) {
$.fn.backTop = function () {
var backBtn = this;
var position = 200;
var speed = 900;
$(document).scroll(function () {
var pos = $(window).scrollTop();
if (pos >= position) {
backBtn.fadeIn(speed);
} else {
backBtn.fadeOut(speed);
}
});
backBtn.click(function () {
$("html, body").animate({ scrollTop: 0 }, 500);
});
};
}(jQuery));
//ajax cache
$(function () {
$.ajaxSetup({
cache: false
});
$('.fancybox').fancybox();
});
//paged
$(function () {
$('.pagination #PageSize').change(function () {
var pageSize = $(this).find(':selected').val();
var url = new URI(window.location.href);
window.location.href = url.removeQuery("PageIndex").setQuery("PageSize", pageSize).removeQuery("PageIndex").setQuery("PageIndex", 1);
});
});
//delete select
$(function () {
$('th :checkbox').change(function () {
if ($(this).is(':checked')) {
$(this).parents('table').find(':checkbox').not(':checked').prop("checked", true);
}
else {
$(this).parents('table').find(':checkbox').filter(':checked').prop("checked", false);
}
});
$('td :checkbox').change(function () {
var parent = $(this).parents('table').find('th :checkbox');
var children = $(this).parents('table').find('td :checkbox');
if ($(this).is(':checked')) {
if (parent.not(':checked')) {
if (children.not(':checked').length === 0) {
parent.prop("indeterminate", false);
parent.prop("checked", true);
}
else {
parent.prop("indeterminate", true);
}
}
}
else {
if (parent.is(':checked')) {
if (children.filter(':checked').length === 0) {
parent.prop("indeterminate", false);
parent.prop("checked", false);
}
else {
parent.prop("indeterminate", true);
}
}
}
});
});
//query
$(function () {
$("button.action.query").click(function () {
var form = $(this).parents("form");
form.attr('action', $(this).attr('data-action'));
form.attr('method', 'get');
form[0].submit();
});
});
//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'));
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;
});
});
//image box
$(function () {
$('.fancybox').fancybox();
});
//edit date datetime
function InitControls() {
//
if ($.datetimepicker) {
$.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").each(function () {
$(this).treeMultiselect({ enableSelectAll: true, searchable: true, selectAllText: "全选", unselectAllText: "反选" });
});
//
$('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 () {
var cron = $(this).jqCron({
lang: 'cn',
enabled_year: true,
enabled_minute: true,
multiple_dom: true,
multiple_month: true,
multiple_mins: true,
multiple_dow: true,
multiple_time_hours: true,
multiple_time_minutes: true,
default_value: $(this).val().substr(2),
bind_method: {
set: function ($element, value) {
$element.val('0 ' + value);
}
},
no_reset_button: false
}).jqCronGetInstance();
if ($(this).hasClass('disable')) {
cron.disable();
}
});
}
function InitEditor(K) {
//edit editor
$('.edit-editor').each(function () {
var name = $(this).attr('name');
var uploadUrl = $(this).attr('data-uploadUrl');
KindEditor.create('textarea[name="' + name + '"]', {
allowImageUpload: true,
uploadJson: uploadUrl,
formatUploadUrl: false
});
});
//edit image file
$('.edit-image').each(function () {
var id = $(this).attr('id');
var btn_id = '#btn_' + id;
var image_id = '#image_' + id;
var rest_id = '#rest_' + id;
var uploadUrl = $(this).attr('data-uploadUrl');
var emtpyImage = $(this).attr('data-emptyImage');
var baseUrl = $(this).attr('data-baseUrl');
var isRequired = $(this).attr('data-val-required') !== undefined;
var editor = KindEditor.editor({
allowImageUpload: true,
formatUploadUrl: false,
uploadJson: uploadUrl
});
KindEditor(btn_id).click(function () {
editor.loadPlugin('insertfile', function () {
editor.plugin.fileDialog({
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).parent('a').attr('href', urlContent2(baseUrl, url));
editor.hideDialog();
}
});
});
});
$('#' + id).attr("style", "visibility:hidden; position: absolute;");
$(rest_id).click(function () {
$('#' + id).attr('value', '');
$(image_id).attr('src', emtpyImage);
$(image_id).parent('a').attr('href', emtpyImage);
});
});
$('.edit-file').each(function () {
var id = $(this).attr('id');
var btn_id = '#btn_' + id;
var image_id = '#image_' + id;
var rest_id = '#rest_' + id;
var uploadUrl = $(this).attr('data-uploadUrl');
var baseUrl = $(this).attr('data-baseUrl');
var isRequired = $(this).attr('data-val-required') !== undefined;
var editor = KindEditor.editor({
allowImageUpload: true,
formatUploadUrl: false,
uploadJson: uploadUrl
});
KindEditor(btn_id).click(function () {
editor.loadPlugin('insertfile', function () {
editor.plugin.fileDialog({
fileUrl: $('#' + id).val(),
clickFn: function (url, title) {
$('#' + id).attr('value', url);
if (isRequired) {
$('#' + id).parents('form').validate().element('#' + id);
}
$(image_id).text(url);
editor.hideDialog();
}
});
});
});
$(rest_id).click(function () {
$('#' + id).attr('value', '');
$(image_id).text('');
});
});
$('.list-import').each(function () {
var id = '#file_' + $(this).attr('id');
var btn_id = '#' + $(this).attr('id');
var uploadUrl = $(this).attr('data-action');
var editor = KindEditor.editor({
allowFileManager: false,
allowImageUpload: true,
formatUploadUrl: false,
uploadJson: uploadUrl
});
KindEditor(btn_id).click(function () {
editor.loadPlugin('image', function () {
editor.plugin.imageDialog({
showRemote: false,
imageUrl: $(id).val(),
clickFn: function (url, title, width, height, border, align) {
$('id').val(url);
editor.hideDialog();
location.reload();
}
});
});
});
});
}
KindEditor.ready(function (K) {
InitEditor(K);
});
$(function () {
$("button.list-export").click(function () {
var form = $(this).parents("form");
form.attr('target', '_blank');
form.attr('action', $(this).attr('data-action'));
form.submit();
form.removeAttr('target');
return false;
});
});
$(function () {
InitControls();
});
$('body').on('change', 'select.organ.submit', function () {
$(this).parents('form').submit();
});
$('body').on('click', '.cmd', function () {
$.getJSON($(this).attr('href'), function (response) {
console.log(response);
}).fail(function (jqxhr, textStatus, error) {
var err = textStatus + ", " + error;
alert(err);
});
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) {
if (!document.querySelector(targetId)) {
return;
}
$(targetId).find('option').not('[value=""]').remove().change();
if (url !== null) {
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();
});
}
}
function reset() {
$('form').removeData('validator');
$('form').removeData('unobtrusiveValidation');
$.validator.unobtrusive.parse('form');
}

@ -5,7 +5,7 @@ services:
command: bash -c "chmod +x ./objs/srs && ./objs/srs -c ./conf/srs.development.conf"
website:
volumes:
- ../../../../projects/WebMVC/wwwroot:/root/nginx/html/desktop
- ../../../../projects/Platform/wwwroot:/root/nginx/html/desktop
- ../../../../projects/WebSPA/wwwroot:/root/nginx/html/mobile
gateway:
volumes:

Loading…
Cancel
Save