Commit dcde98cb authored by Administrator's avatar Administrator

添加添加废证页面

parent f53684f7
......@@ -142,6 +142,18 @@ angular.module('app')
}]
}
})
.state('layout.addFailedCard', {
url: '/addFailedCard',
templateUrl: 'tpl/layout/addFailedCard/addFailedCard.html',
cache:false,
controller:'addFailedCardCtrl',
resolve: {
deps: ['uiLoad',
function( uiLoad ){
return uiLoad.load( ['tpl/layout/addFailedCard/addFailedCard.js'] );
}]
}
})
}
]
......
......@@ -485,22 +485,79 @@ app.service('MessageService', function (ngDialog) {
MessageService.httpRequestFailed(JSON.stringify(errA))
})
},
getprintReceipt:function(startTime, endTime,success){
getFailedType:function(success){
$http({
method: 'GET',
url: "../user/printReceiptList" + urlTimeStamp(),
params:{
startDate:startTime,
endDate:endTime
}
url: "../user/getFailedType" + urlTimeStamp(),
}).then(function successCallback(response) {
console.log(response.data,"-------------response.data------")
success(response.data)
},function(err){
var errA = {Error:true, ReturnCode:err.status, ReturnMsg:"API访问返回错误"}
MessageService.httpRequestFailed(JSON.stringify(errA))
})
}
},
saveFailedCardsID:function(success){
$http({
method: 'GET',
url: "../yingxin/addInValidCardInfo" + urlTimeStamp(),
}).then(function successCallback(response) {
console.log(response.data,"-------------response.data------")
success(response.data)
},function(err){
var errA = {Error:true, ReturnCode:err.status, ReturnMsg:"API访问返回错误"}
MessageService.httpRequestFailed(JSON.stringify(errA))
})
},
getprintReceipt:function(startDate,endDate,success) {
$http({
method: 'GET',
url: "../user/printReceiptList" + urlTimeStamp(),
params: {
startDate:startDate,
endDate:endDate
},
headers: {'Content-Type': 'application/json'},
transformRequest: angular.identity,
responseType:'arraybuffer',
}).then(function successCallback(response) {
if(response.data.Error == true){
MessageService.httpRequestFailed(JSON.stringify(response.data))
}else{
success(response.data)
}
},function(err){
DebugService.debug("$http error:", err)
DebugService.debug("----------------------------------------------")
var errA = {Error:true, ReturnCode:err.status, ReturnMsg:"API访问返回错误"}
MessageService.httpRequestFailed(JSON.stringify(errA))
})
},
getPrintOfficialReceipt:function(startDate,endDate,success) {
$http({
method: 'GET',
url: "../user/printOfficialReceipt" + urlTimeStamp(),
params: {
startDate:startDate,
endDate:endDate
},
headers: {'Content-Type': 'application/json'},
transformRequest: angular.identity,
responseType:'arraybuffer',
}).then(function successCallback(response) {
if(response.data.Error == true){
MessageService.httpRequestFailed(JSON.stringify(response.data))
}else{
success(response.data)
}
},function(err){
DebugService.debug("$http error:", err)
DebugService.debug("----------------------------------------------")
var errA = {Error:true, ReturnCode:err.status, ReturnMsg:"API访问返回错误"}
MessageService.httpRequestFailed(JSON.stringify(errA))
})
},
}
}])
\ No newline at end of file
<!--<div class="row" style="font-size: 1.3em;border-bottom:1px solid #CCCCCC;margin-bottom:10px;padding-top:10px;">-->
<!---->
<!--</div>-->
<!--<div style="padding: 10px;background-color: #fff;border: 1px solid #CCC;border-radius: 10px;">-->
<!---->
<!--</div>-->
<div class="col-md-12">
<p>废证补制</p>
</div>
<div id="cardsDiv">
<form ng-submit="createInputs()">
<span style="font-size:20px;">填写废证数:</span>
<input style="margin-top:20px;height: 30px;" type="text" class="failedcount">
<input type="submit" class="btn btn-primary" value="确定">
<span style="font-size:14px;color: red;" ng-if="errMsglb">{{errMsglb}}</span>
</form>
<form ng-show="showH5==1" ng-submit="saveFailedCards()">
<div style="padding-top:10px;padding-bottom:10px;">请填写废证受理号:</div>
<ul id="cardsUl" style="padding: 0;margin-bottom:10px;">
<li id="0">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="1">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="2">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="3">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="4">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="5">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="6">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="7">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="8">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
<li id="9">
身份证号:<input style="height: 30px;" type="text" placeholder="受理号/身份证号"/>
废证类型:
<select style="height: 30px;border-radius: 4px;">
<option value="{{type.failed_Card_Reason_Id}}" ng-repeat="type in failedTypeList">{{type.failed_Card_Reason}}</option>
</select>
</li>
</ul>
<p style="font-size:14px;color: red;text-align: left;" ng-if="alertLb">{{alertLb}}</p>
<div style="text-align: right;">
<input type="submit" class="btn btn-primary" value="保存">
<input type="button" class="btn btn-danger" ng-click="cancelAddFailed()" value="取消">
</div>
</form>
</div>
app.controller('addFailedCardCtrl', ['$scope', '$rootScope', '$http', '$state', '$filter', '$localStorage', 'HttpService', 'ngDialog', function ($scope, $rootScope, $http, $state, $filter, $localStorage, HttpService, $ngDialog) {
if ($rootScope.loginData.login === false) {
$state.go("signin")
} else {
$state.go("layout.addFailedCard")
}
$scope.failedTypeList =[{failed_Card_Reason_Id:2,failed_Card_Reason:'切废1'},{failed_Card_Reason_Id:1,failed_Card_Reason:"切废"}];
$rootScope.showH5 = 0;
$scope.createInputs = function () {
console.log("---查询废证制证类型---")
// HttpService.getFailedType(function(data) {
// $scope.failedTypeList = data.respData;
// console.log($scope.failedTypeList)
// })
for (var i=0;i<10;i++){
document.getElementById(i).style.display = 'none';
document.getElementById(i).style.marginBottom = '10px';
}
$scope.failedCount = $(".failedcount").val();
console.log($scope.failedCount)
if ($scope.failedCount == '' || parseInt($scope.failedCount) <= 0 || parseInt($scope.failedCount) > 10) {
$scope.errMsglb = "数量应在0和10之间且不能为空!";
} else {
$scope.errMsglb = "";
$rootScope.showH5 = 1;
for (var i = 0; i <$scope.failedCount; i++) {
document.getElementById(i).style.display = 'block';
}
}
}
$rootScope.emptyForm = function(){
for (var i = 0; i < $scope.failedCount; i++) {
document.getElementById(i).getElementsByTagName("input")[0].value = "";
document.getElementById(i).getElementsByTagName("input")[1].value = "";
}
}
$scope.saveFailedCards = function () {
$rootScope.arr = [];
var checkArr = [];
var jsonStr = {};
var valueArr = [];
var checkValueArr = [];
for (var i = 0; i < $scope.failedCount; i++) {
var json = {};
var checkJson = {};
json.acceptNo = $('#' + i + ' input:eq(0)').val();
json.reson = $('#' + i + ' select').val();
valueArr.push(json);
if(checkValueArr.indexOf($('#' + i + ' input:eq(0)').val())==-1){
checkValueArr.push($('#' + i + ' input:eq(0)').val());
}
}
if(checkValueArr.length == $scope.failedCount){
checkJson.list = checkValueArr;
jsonStr.list = valueArr;
jsonStr.workshop = $rootScope.loginData.workshop;
$rootScope.arr.push(jsonStr);
checkArr.push(checkJson);
console.log($rootScope.arr)
var myFailedcount = 0;
for (var i = 0; i < $rootScope.arr.length; i++) {
for (var j = 0; j < $rootScope.arr[i].list.length; j++) {
if ($rootScope.arr[i].list[j].acceptNo.length == 18 || $rootScope.arr[i].list[j].acceptNo.length == 10) {
myFailedcount++;
}
else {
continue;
}
}
}
var str = "";
if (myFailedcount == (checkArr.length * valueArr.length)) {
HttpService.remainderCyclesheetInfo(checkArr, function (data) {
console.log(">>>>>>>>>")
console.log(checkArr)
ngDialog.open({
template: 'dialogs/confirmFailedCardsInfo.html' + urlTimeStamp(),
width: '40%',
cache: false,
controller: ['$scope', '$rootScope', 'HttpService', function ($scope, $rootScope, HttpService,MessageService) {
$scope.dataInfo = data.respData;
console.log($scope.dataInfo)
var count = 0;
for(var i=0;i<$scope.dataInfo.length;i++){
if($scope.dataInfo[i][0]!=0){
count+=1;
}else{
continue;
}
}
$scope.isShowSuccess = 0;
$scope.confirmFailedInfo = function () {
console.log($rootScope.arr)
$(".confirmBtn").attr("disabled", true);
if(count==$scope.dataInfo.length){
HttpService.saveFailedCardsID($rootScope.arr,function(data){
$scope.isShowSuccess = 1;
$scope.AddSuccess = data.respData.string;
$rootScope.emptyForm();
})
}else{
$scope.alertError = "请将您输入有误的受理号修改后再添加!";
}
}
$scope.cancelThisDialog = function(){
$rootScope.showH5 = 0;
$scope.closeThisDialog();
}
}]
})
})
} else {
$scope.alertLb = "请检查您输入的废证受理号和身份证号是否全部正确!";
}
}else{
MessageService.showAlert("废证受理号或身份证号存在空值或重复,请检查后再提交。")
}
}
$scope.cancelAddFailed = function () {
$rootScope.showH5 = 0;
$scope.alertLb = "";
$rootScope.emptyForm();
}
}]);
\ No newline at end of file
......@@ -335,8 +335,6 @@ app.controller('cycleSheetCtrl', ['$scope', '$rootScope', '$http', '$state', '$f
// }
// ]
// $scope.receiptList = [[358, 0, 0, 0, 82, 0, 0, 1, 0, 205, 646, 3, "郑州 辖区", "410101"], [721, 0, 0, 0, 20, 0, 0, 7, 1, 91, 840, 4, "郑州 中原", "410102"],]
$scope.showtable = -1;
$scope.showTable = function (taskID) {
console.log("$scope.-------$scope.showtable----",taskID);
......
......@@ -66,8 +66,10 @@ app.controller('receiptCtrl', ['$scope', '$rootScope', '$http', '$state', '$filt
var date2 = $("#wdate2").val();
HttpService.getprintReceipt(changeDataFormat(date1), changeDataFormat(date2), function (data) {
var blob = new Blob([data], {type: "application/vnd.ms-excel"});
var fileName = $filter('date')(date,"yyyy年MM月dd日交接单") + ".xls";
var a = document.createElement("a");
document.body.appendChild(a);
a.download = fileName;
a.href = URL.createObjectURL(blob);
a.click();
})
......@@ -78,6 +80,7 @@ app.controller('receiptCtrl', ['$scope', '$rootScope', '$http', '$state', '$filt
var date2 = $("#wdate2").val();
HttpService.getPrintOfficialReceipt(changeDataFormat(date1), changeDataFormat(date2), function (data) {
var blob = new Blob([data], {type: "application/vnd.ms-excel"});
var fileName = $filter('date')(date,"yyyy年MM月dd日回执单") + ".xls";
var a = document.createElement("a");
document.body.appendChild(a);
a.href = URL.createObjectURL(blob);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment