Browse Source

[完善]年份

master
邵佳豪 10 months ago
parent
commit
f38f1ba69e
  1. 989
      src/app/home/task/zhi-indicators/dist/zhi-indicators.component.js
  2. 3
      src/app/home/task/zhi-indicators/zhi-indicators.component.html
  3. 2
      src/app/home/task/zhi-indicators/zhi-indicators.component.ts

989
src/app/home/task/zhi-indicators/dist/zhi-indicators.component.js vendored

@ -0,0 +1,989 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
exports.__esModule = true;
exports.ZhiIndicatorsComponent = void 0;
var core_1 = require("@angular/core");
var rxjs_1 = require("rxjs");
var operators_1 = require("rxjs/operators"); // 引入debounceTime、Subject
var edit_or_component_1 = require("./edit-or/edit-or.component");
var allot_person_component_1 = require("../da-subordinate-audit/allot-person/allot-person.component");
var ZhiIndicatorsComponent = /** @class */ (function () {
function ZhiIndicatorsComponent(ngZone, fb, http, toTree, message, modal, viewContainerRef) {
this.ngZone = ngZone;
this.fb = fb;
this.http = http;
this.toTree = toTree;
this.message = message;
this.modal = modal;
this.viewContainerRef = viewContainerRef;
this.valueChange = new rxjs_1.Subject();
this.targetCount = new rxjs_1.Subject();
this.months = [
{ id: 1, name: '1月', isable: true },
{ id: 2, name: '2月', isable: true },
{ id: 3, name: '3月', isable: true },
{ id: 4, name: '4月', isable: true },
{ id: 5, name: '5月', isable: true },
{ id: 6, name: '6月', isable: true },
{ id: 7, name: '7月', isable: true },
{ id: 8, name: '8月', isable: true },
{ id: 9, name: '9月', isable: true },
{ id: 10, name: '10月', isable: true },
{ id: 11, name: '11月', isable: true },
{ id: 12, name: '12月', isable: true },
];
this.selectedYear = 2024;
//投诉举报
this.complaint = {
name: '投诉举报',
allocated: 0,
isExpand: true,
isPopover: false,
isLoading: false,
search1: '',
search1Value: [],
search2: '',
search2Value: [],
searchAll: [],
selectedMenu: 1,
data: [],
nodes: [],
nodes2: [],
isnodes: true,
unitList: []
};
//行政许可
this.permission = {
name: '行政许可',
allocated: 0,
isExpand: true,
isPopover: false,
isLoading: false,
search1: '',
search1Value: [],
search2: '',
search2Value: [],
searchAll: [],
selectedMenu: 1,
data: [],
nodes: [],
nodes2: [],
isnodes: true,
unitList: []
};
// 双随机
this.doubleRandom = {
name: '双随机',
allocated: 0,
allPlanTasks: 0,
isExpand: true,
isPopover: false,
isLoading: false,
search1: '',
search1Value: [],
search2: '',
search2Value: [],
searchAll: [],
selectedMenu: 1,
data: [],
nodes: [],
nodes2: [],
isnodes: true,
unitList: []
};
// 熟悉演练
this.rehearsal = {
name: '熟悉演练',
allocated: 0,
allPlanTasks: 0,
isExpand: true,
isPopover: false,
isLoading: false,
search1: '',
search1Value: [],
search2: '',
search2Value: [],
searchAll: [],
selectedMenu: 1,
data: [],
nodes: [],
nodes2: [],
isnodes: true,
unitList: []
};
this.unitList = [];
this.PageNumber = 1;
this.moreDataLoading = false;
this.iszhanxun = false;
}
ZhiIndicatorsComponent.prototype.saveItem = function () { };
ZhiIndicatorsComponent.prototype.selectMonth = function (item) {
console.log('选择月份');
this.selectedMonth = item.id;
this.initializeData();
this.getTaskList('投诉举报');
this.getTaskList('行政许可');
this.getTaskTarget('双随机');
this.getTaskTarget('熟悉演练');
};
ZhiIndicatorsComponent.prototype.selectYear = function (e) {
console.log('选择年份');
this.selectedYear = e;
this.initializeData();
this.getTaskList('投诉举报');
this.getTaskList('行政许可');
this.getTaskTarget('双随机');
this.getTaskTarget('熟悉演练');
};
ZhiIndicatorsComponent.prototype.initializeData = function () {
this.complaint.isExpand = true;
this.complaint.isPopover = false;
this.complaint.isLoading = false;
this.complaint.search1 = '';
this.complaint.search1Value = [];
this.complaint.search2 = '';
this.complaint.search2Value = [];
this.complaint.selectedMenu = 1;
this.complaint.data = [];
this.permission.isExpand = true;
this.permission.isPopover = false;
this.permission.isLoading = false;
this.permission.search1 = '';
this.permission.search1Value = [];
this.permission.search2 = '';
this.permission.search2Value = [];
this.permission.selectedMenu = 1;
this.permission.data = [];
this.doubleRandom.isExpand = true;
this.doubleRandom.isPopover = false;
this.doubleRandom.isLoading = false;
this.doubleRandom.search1 = '';
this.doubleRandom.search1Value = [];
this.doubleRandom.search2 = '';
this.doubleRandom.search2Value = [];
this.doubleRandom.selectedMenu = 1;
this.doubleRandom.data = [];
this.rehearsal.isExpand = true;
this.rehearsal.isPopover = false;
this.rehearsal.isLoading = false;
this.rehearsal.search1 = '';
this.rehearsal.search1Value = [];
this.rehearsal.search2 = '';
this.rehearsal.search2Value = [];
this.rehearsal.selectedMenu = 1;
this.rehearsal.data = [];
};
ZhiIndicatorsComponent.prototype.log = function (data) {
var arr = [];
data.unitList.forEach(function (item) {
item.checked ? arr.push(item.id) : null;
});
data.search1Value = arr;
};
ZhiIndicatorsComponent.prototype.isPopover = function (data) {
console.log(data);
data.isPopover = !data.isPopover;
data.unitList.forEach(function (element) {
element.checked = false;
});
};
// 弹出 tab
ZhiIndicatorsComponent.prototype.popoverMenuSelect = function (data, type) {
data.selectedMenu = type;
};
ZhiIndicatorsComponent.prototype.expand = function (data) {
data.isExpand = !data.isExpand;
};
//搜索框提交
ZhiIndicatorsComponent.prototype.submitForm = function (data) {
data.unitList = [];
this.PageNumber = 1;
this.getCompanies(data);
};
ZhiIndicatorsComponent.prototype.getCompanies = function (incomingData) {
return __awaiter(this, void 0, void 0, function () {
var params;
var _this = this;
return __generator(this, function (_a) {
params = {
CompanyName: incomingData ? incomingData.search1 : '',
PageNumber: this.PageNumber,
PageSize: 50
};
return [2 /*return*/, new Promise(function (resolve, reject) {
_this.http
.get('/api/Companies', {
params: params
})
.subscribe(function (data) {
_this.moreDataLoading = false;
_this.totalCount = data.totalCount;
data.items.forEach(function (element) {
element.label = element.companyName;
element.value = element.id;
element.parentId = element.organizationId;
element.key = element.id;
element.title = element.companyName;
element.level = 4;
});
_this.unitList = data.items;
// if (incomingData && incomingData.name == '投诉举报') {
// this.complaint.unitList = JSON.parse(JSON.stringify(this.unitList))
// } else if (incomingData && incomingData.name == '行政许可') {
// this.permission.unitList = JSON.parse(JSON.stringify(this.unitList))
// } else if (incomingData && incomingData.name == '双随机') {
// this.doubleRandom.unitList = JSON.parse(JSON.stringify(this.unitList))
// } else if (incomingData && incomingData.name == '熟悉演练') {
// this.rehearsal.unitList = JSON.parse(JSON.stringify(this.unitList))
// } else {
// this.complaint.unitList = JSON.parse(JSON.stringify(this.unitList))
// this.permission.unitList = JSON.parse(JSON.stringify(this.unitList))
// this.doubleRandom.unitList = JSON.parse(JSON.stringify(this.unitList))
// this.rehearsal.unitList = JSON.parse(JSON.stringify(this.unitList))
// }
_this.complaint.unitList = _this.complaint.unitList.concat(JSON.parse(JSON.stringify(data.items)));
_this.complaint.unitList = __spreadArrays(_this.complaint.unitList);
_this.permission.unitList = _this.permission.unitList.concat(JSON.parse(JSON.stringify(data.items)));
_this.permission.unitList = __spreadArrays(_this.permission.unitList);
_this.doubleRandom.unitList = _this.doubleRandom.unitList.concat(JSON.parse(JSON.stringify(data.items)));
_this.doubleRandom.unitList = __spreadArrays(_this.doubleRandom.unitList);
_this.rehearsal.unitList = _this.rehearsal.unitList.concat(JSON.parse(JSON.stringify(data.items)));
_this.rehearsal.unitList = __spreadArrays(_this.rehearsal.unitList);
resolve(data);
});
})];
});
});
};
ZhiIndicatorsComponent.prototype.moreData = function () {
this.moreDataLoading = true;
this.PageNumber += 1;
this.getCompanies();
};
ZhiIndicatorsComponent.prototype.getAllOrganization = function () {
return __awaiter(this, void 0, void 0, function () {
var params;
var _this = this;
return __generator(this, function (_a) {
params = {
ContainsChildren: 'true',
PageNumber: 1,
PageSize: 9999,
code: '0000'
};
return [2 /*return*/, new Promise(function (resolve, reject) {
_this.http
.get('/api/Organizations', {
params: params
})
.subscribe(function (data) {
data.items.forEach(function (element) {
element.key = element.id;
element.title = element.name;
element.selectable = false;
element.disableCheckbox = true;
element.datatype = '机构';
element.level == 'squadron'
? (element.disableCheckbox = false)
: null;
});
_this.allOrList = JSON.parse(JSON.stringify(data.items));
_this.nodes = __spreadArrays(_this.toTree.toTree(JSON.parse(JSON.stringify(data.items))));
_this.complaint.nodes = JSON.parse(JSON.stringify(_this.nodes));
_this.permission.nodes = JSON.parse(JSON.stringify(_this.nodes));
_this.doubleRandom.nodes = JSON.parse(JSON.stringify(_this.nodes));
_this.rehearsal.nodes = JSON.parse(JSON.stringify(_this.nodes));
resolve(data);
});
})];
});
});
};
ZhiIndicatorsComponent.prototype.getUsers = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
var params = {
OrganizationId: _this.OrganizationId,
OrganizationLevel: 'squadron',
ContainsChildren: true,
PageNumber: 1,
PageSize: 9999
};
_this.http
.get('/api/Users', {
params: params
})
.subscribe(function (data) {
console.log('用户列表', data.items);
data.items.forEach(function (element) {
element.key = element.id;
element.title = element.name;
element.parentId = element.organizationId;
});
_this.users = data.items;
resolve(data);
});
})];
});
});
};
ZhiIndicatorsComponent.prototype.editOr = function (incomingData, item) {
var _this = this;
var modal = this.modal.create({
nzTitle: '修改协助机构',
nzContent: edit_or_component_1.EditOrComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 660,
nzMaskClosable: false,
nzComponentParams: {
selectedData: __spreadArrays(item.supervisorIds, item.assistantOrganizationIds),
organizationList: JSON.parse(JSON.stringify(this.allOrList)),
// users: JSON.parse(JSON.stringify(this.users)),
supervisorList: __spreadArrays(JSON.parse(JSON.stringify(this.assitantsupervisorList)), JSON.parse(JSON.stringify(this.mainsupervisorList)))
},
nzOnOk: function () { return __awaiter(_this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!instance.validateForm.valid) return [3 /*break*/, 2];
return [4 /*yield*/, new Promise(function (resolve, reject) {
console.log(instance.nzTreeComponent.getCheckedNodeList());
var supervisorIds = [];
var assistantOrganizationIds = [];
instance.nzTreeComponent.getCheckedNodeList().forEach(function (item) {
item.origin.datatype == '机构'
? assistantOrganizationIds.push(item.key)
: supervisorIds.push(item.key);
});
var body = {
supervisorIds: supervisorIds,
assistantOrganizationIds: assistantOrganizationIds
};
_this.http.patch("/api/PlanTasks/" + item.id, body).subscribe({
next: function (data) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.message.create('success', '修改成功');
incomingData.name == '投诉举报'
? this.getTaskList('投诉举报')
: null;
incomingData.name == '行政许可'
? this.getTaskList('行政许可')
: null;
resolve(data);
return [2 /*return*/];
});
}); },
error: function (err) {
_this.message.create('warning', '修改失败');
reject(err);
}
});
})];
case 1:
_a.sent();
return [3 /*break*/, 3];
case 2:
this.message.create('warning', '请填写完整!');
return [2 /*return*/, false];
case 3: return [2 /*return*/];
}
});
}); }
});
var instance = modal.getContentComponent();
modal.afterOpen.subscribe(function () { return console.log('[afterOpen] emitted!'); });
modal.afterClose.subscribe(function (result) {
return console.log('[afterClose] The result is:', result);
});
};
ZhiIndicatorsComponent.prototype.orcheckbox = function (data, $event, node) {
if ($event) {
data.search2Value.push(node.origin.id);
}
else {
for (var index = 0; index < data.search2Value.length; index++) {
var element = data.search2Value[index];
if (element == node.origin.id) {
data.search2Value.splice(index, 1);
index--;
}
}
}
console.log(data.search2Value);
};
ZhiIndicatorsComponent.prototype.ngOnInit = function () {
var _this = this;
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId;
this.selectedMonth = new Date().getMonth() + 1;
//说明保存防抖
this.valueChange.pipe(operators_1.debounceTime(1000)).subscribe(function (item) {
var body = {
description: item.description
};
return new Promise(function (resolve, reject) {
_this.http.patch("/api/PlanTasks/" + item.id, body).subscribe({
next: function (data) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.message.create('success', '实时保存成功');
resolve(data);
return [2 /*return*/];
});
}); },
error: function (err) {
_this.message.create('warning', '保存失败');
reject(err);
}
});
});
});
//任务额保存防抖
this.targetCount.pipe(operators_1.debounceTime(1000)).subscribe(function (item) {
// console.log(item)
var body = {
targetCount: item.targetCount
};
return new Promise(function (resolve, reject) {
_this.http.patch("/api/TaskTargets/" + item.id, body).subscribe({
next: function (data) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.message.create('success', '修改任务额成功');
resolve(data);
return [2 /*return*/];
});
}); },
error: function (err) {
_this.message.create('warning', '修改任务额失败');
reject(err);
}
});
});
});
// this.getUsers()
this.getCompanies();
this.getAllOrganization();
// Promise.all([this.getCompanies(), this.getAllOrganization()])
// .then((results) => {
// let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))]
// this.nodes = [...this.toTree.toTree(arr)]
// this.complaint.nodes = JSON.parse(JSON.stringify(this.nodes))
// this.permission.nodes = JSON.parse(JSON.stringify(this.nodes))
// this.doubleRandom.nodes = JSON.parse(JSON.stringify(this.nodes))
// this.rehearsal.nodes = JSON.parse(JSON.stringify(this.nodes))
// });
this.getTaskList('投诉举报');
this.getTaskList('行政许可');
this.getTaskTarget('双随机');
this.getTaskTarget('熟悉演练');
//获得主协调查人员
this.getSupervisor('main');
this.getSupervisor('assisted');
var roles = JSON.parse(sessionStorage.getItem('userData')).roles;
var iszhanxun = roles.find(function (item) {
return item.name.indexOf('战训') != -1;
});
if (iszhanxun) {
this.iszhanxun = true;
}
console.log('iszhanxun', iszhanxun);
};
//投诉举报/行政许可 选择单位 确认按钮
ZhiIndicatorsComponent.prototype.selectedUnit = function (data, type) {
var _this = this;
var arr = __spreadArrays(data.search1Value, data.search2Value);
var arrSet = __spreadArrays(new Set(arr));
data.isLoading = true;
var selectedMonth = this.selectedMonth < 10 ? '0' + this.selectedMonth : this.selectedMonth;
var selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01';
this.http
.post("/api/PlanTasks/Many", null, {
params: {
month: selectedTime,
companyIds: arrSet,
taskType: type
}
})
.subscribe({
next: function (item) {
data.isLoading = false;
data.isPopover = false;
_this.message.create('success', '共创建' +
arrSet.length +
'条任务' +
',成功创建' +
item.length +
'条,剩余' +
(arrSet.length - item.length) +
'个单位已被创建');
type == '投诉举报' ? _this.getTaskList('投诉举报', data) : null;
type == '行政许可' ? _this.getTaskList('行政许可', data) : null;
},
error: function (err) {
data.isLoading = false;
_this.message.create('warning', '创建失败');
}
});
};
//双随机/熟悉演练 选择单位 确认按钮
ZhiIndicatorsComponent.prototype.selectedUnit2 = function (data, type) {
var _this = this;
var selectedMonth = this.selectedMonth < 10 ? '0' + this.selectedMonth : this.selectedMonth;
var selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01';
var arr = __spreadArrays(data.search1Value, data.search2Value);
var body = __spreadArrays(new Set(arr));
data.isLoading = true;
this.http
.post("/api/TaskTargets/" + selectedTime, body, {
params: {
taskType: type
}
})
.subscribe({
next: function (item) {
data.isLoading = false;
data.isPopover = false;
_this.message.create('success', '共创建' +
body.length +
'条任务' +
',成功创建' +
item.length +
'条,剩余' +
(body.length - item.length) +
'个单位已被创建');
type == '双随机' ? _this.getTaskTarget('双随机', data) : null;
type == '熟悉演练' ? _this.getTaskTarget('熟悉演练', data) : null;
},
error: function (err) {
data.isLoading = false;
_this.message.create('warning', '创建失败');
}
});
};
ZhiIndicatorsComponent.prototype.getTaskTarget = function (TaskType, carddata) {
return __awaiter(this, void 0, void 0, function () {
var selectedTime, params;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
TaskType == '双随机'
? (this.doubleRandom.isLoading = true)
: (this.rehearsal.isLoading = true);
selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01';
params = {
taskType: TaskType
};
return [4 /*yield*/, new Promise(function (resolve, reject) {
_this.http
.get("/api/TaskTargets/" + selectedTime, {
params: params
})
.subscribe(function (data) {
_this.ngZone.run(function () {
//这里写需要立即渲染的代码
TaskType == '双随机'
? (_this.doubleRandom.isLoading = false)
: (_this.rehearsal.isLoading = false);
console.log(TaskType + '任务指标列表', data);
TaskType == '双随机' ? (_this.doubleRandom.allocated = 0) : null;
TaskType == '熟悉演练' ? (_this.rehearsal.allocated = 0) : null;
TaskType == '双随机' ? (_this.doubleRandom.allPlanTasks = 0) : null;
TaskType == '熟悉演练' ? (_this.rehearsal.allPlanTasks = 0) : null;
TaskType == '双随机' ? (_this.doubleRandom.data = data) : null;
TaskType == '熟悉演练' ? (_this.rehearsal.data = data) : null;
data.forEach(function (element) {
if (element.planTasks) {
if (TaskType == '双随机') {
_this.doubleRandom.allPlanTasks += element.planTasks.length;
}
if (TaskType == '熟悉演练') {
_this.rehearsal.allPlanTasks += element.planTasks.length;
}
element.planTasks.forEach(function (item) {
if (item.approvalStatus == '通过') {
TaskType == '双随机'
? (_this.doubleRandom.allocated += 1)
: null;
TaskType == '熟悉演练'
? (_this.rehearsal.allocated += 1)
: null;
}
});
}
});
});
resolve(data);
});
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
ZhiIndicatorsComponent.prototype.getTaskList = function (TaskType, carddata) {
return __awaiter(this, void 0, void 0, function () {
var selectedTime, params;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
TaskType == '投诉举报'
? (this.complaint.isLoading = true)
: (this.permission.isLoading = true);
selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01';
params = {
Month: selectedTime,
OrganizationId: this.OrganizationId,
TaskType: TaskType,
PageNumber: 1,
PageSize: 99999
};
return [4 /*yield*/, new Promise(function (resolve, reject) {
_this.http
.get('/api/PlanTasks', {
params: params
})
.subscribe(function (data) {
_this.ngZone.run(function () {
//这里写需要立即渲染的代码
console.log(TaskType + '任务列表', data.items);
TaskType == '投诉举报'
? (_this.complaint.isLoading = false)
: (_this.permission.isLoading = false);
TaskType == '投诉举报' ? (_this.complaint.allocated = 0) : null;
TaskType == '行政许可' ? (_this.permission.allocated = 0) : null;
TaskType == '投诉举报' ? (_this.complaint.data = data.items) : null;
TaskType == '行政许可' ? (_this.permission.data = data.items) : null;
data.items.forEach(function (item) {
if (item.approvalStatus == '通过') {
TaskType == '投诉举报' ? (_this.complaint.allocated += 1) : null;
TaskType == '行政许可'
? (_this.permission.allocated += 1)
: null;
}
});
});
resolve(data);
});
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
//修改任务描述
ZhiIndicatorsComponent.prototype.taskDescChange = function (incomingData, item) {
this.valueChange.next(item);
};
//修改任务额
ZhiIndicatorsComponent.prototype.targetCountChange = function (incomingData, item, e) {
this.targetCount.next(item);
};
ZhiIndicatorsComponent.prototype.ngOnDestroy = function () {
// console.log('毁灭了')
// this.doubleRandom.isPopover = false
};
ZhiIndicatorsComponent.prototype.onExpandChange = function (e) {
var node = e.node;
if (node &&
node.getChildren().length === 0 &&
node.isExpanded &&
node.origin.level == 'squadron') {
this.loadNode(node.origin.id).then(function (data) {
node.addChildren(data);
});
}
else {
node.isLoading = false;
}
};
ZhiIndicatorsComponent.prototype.loadNode = function (id) {
var _this = this;
return new Promise(function (resolve) {
var params = {
OrganizationId: id,
PageNumber: 1,
PageSize: 9999
};
_this.http
.get('/api/Companies', {
params: params
})
.subscribe(function (data) {
console.log(data.items);
data.items.forEach(function (element) {
element.key = element.id;
element.title = element.companyName;
element.level = 4;
element.isLeaf = true;
});
resolve(data.items);
});
});
};
ZhiIndicatorsComponent.prototype.getCompaniesByName = function (incomingData) {
return __awaiter(this, void 0, void 0, function () {
var params_1;
var _this = this;
return __generator(this, function (_a) {
// incomingData.search2Value
console.log(incomingData.search2Value);
if (incomingData.search2) {
incomingData.isnodes = false;
params_1 = {
CompanyName: incomingData.search2,
PageNumber: this.PageNumber,
PageSize: 9999
};
return [2 /*return*/, new Promise(function (resolve, reject) {
_this.http
.get('/api/Companies', {
params: params_1
})
.subscribe(function (data) {
_this.moreDataLoading = false;
_this.totalCount = data.totalCount;
data.items.forEach(function (element) {
element.label = element.companyName;
element.value = element.id;
element.parentId = element.organizationId;
element.key = element.id;
element.title = element.companyName;
element.level = 4;
element.isLeaf = true;
incomingData.search2Value.forEach(function (item) {
item == element.id ? (element.isChecked = true) : null;
});
});
if (data.items.length == 0) {
_this.message.create('warning', '没有查询到任何单位');
incomingData.isnodes = true;
return;
}
var allOrList = JSON.parse(JSON.stringify(_this.allOrList));
allOrList.forEach(function (element) {
element.expanded = true;
});
var arr = __spreadArrays(allOrList, data.items);
incomingData.nodes2 = __spreadArrays(_this.toTree.toTree(arr));
resolve(data);
});
})];
}
else {
incomingData.isnodes = true;
}
return [2 /*return*/];
});
});
};
ZhiIndicatorsComponent.prototype.getSupervisor = function (type) {
var _this = this;
var params = {
inspectorType: type
};
this.http
.get('/api/Users/Inspectors', {
params: params
})
.subscribe(function (data) {
console.log('检查员列表', data);
data.forEach(function (element) {
element.parentId = element.organizationId;
element.key = element.id;
element.title = element.name;
element.selectable = false;
element.disableCheckbox = false;
element.datatype = '人员';
});
if (type == 'main') {
_this.mainsupervisorList = data;
}
else {
_this.assitantsupervisorList = data;
}
});
};
ZhiIndicatorsComponent.prototype.allot = function (item, type) {
var _this = this;
console.log(item);
if (this.mainsupervisorList.length == 0 ||
this.assitantsupervisorList.length == 0) {
this.message.create('warning', '请从用户管理添加检查人员');
return;
}
var modal = this.modal.create({
nzTitle: '分配监督检查员',
nzContent: allot_person_component_1.AllotPersonComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 485,
nzMaskClosable: false,
nzComponentParams: {
mainsupervisorList: this.mainsupervisorList,
assitantsupervisorList: this.assitantsupervisorList
},
nzOnOk: function () { return __awaiter(_this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!instance.validateForm.valid) return [3 /*break*/, 2];
return [4 /*yield*/, new Promise(function (resolve, reject) {
var body = {
supervisorIds: [
instance.validateForm.value.main,
instance.validateForm.value.assitant,
]
};
_this.http.patch("/api/PlanTasks/" + item.id, body).subscribe({
next: function (data) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.message.create('success', '分配成功');
this.getTaskTarget(type);
resolve(data);
return [2 /*return*/, true];
});
}); },
error: function (err) {
_this.message.create('warning', '分配失败');
reject(err);
return false;
}
});
})];
case 1:
_a.sent();
return [3 /*break*/, 3];
case 2:
this.message.create('warning', '请填写完整!');
return [2 /*return*/, false];
case 3: return [2 /*return*/];
}
});
}); }
});
var instance = modal.getContentComponent();
modal.afterOpen.subscribe(function () { return console.log('[afterOpen] emitted!'); });
modal.afterClose.subscribe(function (result) {
return console.log('[afterClose] The result is:', result);
});
};
ZhiIndicatorsComponent.prototype.distribute = function (item, type) {
var _this = this;
this.modal.confirm({
nzTitle: "\u786E\u5B9A\u8981\u6D3E\u53D1\u8BE5\u4EFB\u52A1\u5417?",
nzOkText: '确定',
nzOkType: 'default',
nzOnOk: function () {
item.isLoading = true;
_this.http
.post("/api/PlanTasks/Approval/" + item.id, null, {
params: {
approvalStatus: '待检查'
}
})
.subscribe({
next: function (data) {
_this.message.create('success', '已派发');
item.approvalStatus = '待检查';
item.isLoading = false;
item.passed += 1;
type == '投诉举报' ? (_this.complaint.allocated += 1) : null;
type == '行政许可' ? (_this.permission.allocated += 1) : null;
type == '双随机' ? (_this.doubleRandom.allocated += 1) : null;
type == '熟悉演练' ? (_this.rehearsal.allocated += 1) : null;
},
error: function (err) {
_this.message.create('warning', '派发失败');
item.isLoading = false;
}
});
},
nzCancelText: '取消'
});
};
//删除任务
ZhiIndicatorsComponent.prototype.deleteTask = function (item, incomingData) {
var _this = this;
console.log(item);
console.log(incomingData);
this.modal.confirm({
nzTitle: "\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u4EFB\u52A1\u5417?",
nzOkText: '确定',
nzOkType: 'primary',
nzOnOk: function () {
_this.http["delete"]("/api/PlanTasks/" + item.id).subscribe(function (data) {
var originaldata;
if (item.taskType == '投诉举报' || item.taskType == '行政许可') {
_this.getTaskList(item.taskType);
}
if (item.taskType == '双随机' || item.taskType == '熟悉演练') {
_this.getTaskTarget(item.taskType);
}
_this.message.create('success', '删除成功!');
});
},
nzCancelText: '取消',
nzOnCancel: function () { }
});
};
ZhiIndicatorsComponent = __decorate([
core_1.Component({
selector: 'app-zhi-indicators',
templateUrl: './zhi-indicators.component.html',
styleUrls: ['./zhi-indicators.component.scss']
})
], ZhiIndicatorsComponent);
return ZhiIndicatorsComponent;
}());
exports.ZhiIndicatorsComponent = ZhiIndicatorsComponent;

3
src/app/home/task/zhi-indicators/zhi-indicators.component.html

@ -2,9 +2,10 @@
<div class="box">
<div class="timebox">
<nz-select [(ngModel)]="selectedYear" (ngModelChange)="selectYear($event)">
<nz-option [nzValue]="2021" nzLabel="2021年"></nz-option>
<nz-option [nzValue]="2022" nzLabel="2022年"></nz-option>
<nz-option [nzValue]="2023" nzLabel="2023年"></nz-option>
<nz-option [nzValue]="2024" nzLabel="2024年"></nz-option>
<nz-option [nzValue]="2025" nzLabel="2025年"></nz-option>
</nz-select>
<div *ngFor="let item of months" class="monthbtn" (click)="selectMonth(item)"
[ngClass]="{'selectedMonth': item.id == selectedMonth}">

2
src/app/home/task/zhi-indicators/zhi-indicators.component.ts

@ -52,7 +52,7 @@ export class ZhiIndicatorsComponent implements OnInit {
{ id: 12, name: '12月', isable: true },
];
selectedMonth;
selectedYear = 2023;
selectedYear = 2024;
selectedTime;
selectMonth(item) {
console.log('选择月份');

Loading…
Cancel
Save