|
@@ -26,25 +26,14 @@ $(function () {
|
|
|
});
|
|
|
//保存按钮点击事件
|
|
|
$("#btn_save").click(function (t) {
|
|
|
- var data = $('#add_drug_table').bootstrapTable('getData', true);
|
|
|
+ var data = $('#tb_table').bootstrapTable('getData', true);
|
|
|
if (data.length > 0) {
|
|
|
var ypInPlans = [];
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
- if (data[i].amount == 0 || data[i].amount == null) {
|
|
|
- return errorMesageSimaple('含有请领数量为0的药品');
|
|
|
+ if (data[i].newOutAmt == 0 || data[i].newOutAmt == null) {
|
|
|
+ return warningMesageSimaple('含有退药数量为0的记录');
|
|
|
}
|
|
|
}
|
|
|
- for (let i = 0; i < data.length; i++) {
|
|
|
- let ypInPlan = {
|
|
|
- planSeri: i + 1,
|
|
|
- chargeCode: data[i].code,
|
|
|
- serial: data[i].serial,
|
|
|
- groupNo: data[i].groupNo,
|
|
|
- groupYk: data[i].groupYk,
|
|
|
- amount: data[i].amount
|
|
|
- };
|
|
|
- ypInPlans.push(ypInPlan);
|
|
|
- }
|
|
|
saveDrugApply(ypInPlans);
|
|
|
}
|
|
|
});
|
|
@@ -81,8 +70,8 @@ $(function () {
|
|
|
var rows = $table.bootstrapTable('getSelections');
|
|
|
for (let i = 0; i < rows.length; i++) {
|
|
|
$table.bootstrapTable('remove', {
|
|
|
- field: "no", //列名
|
|
|
- values: rows[i].no //值数组
|
|
|
+ field: "id", //列名
|
|
|
+ values: rows[i].id //值数组
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -95,7 +84,7 @@ $(function () {
|
|
|
function saveDrugApply(data) {
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
- url: '/thmz/saveDrugApply',
|
|
|
+ url: '/thmz/saveDrugReturn',
|
|
|
contentType: "application/json;charset=UTF-8",
|
|
|
dataType: "json",
|
|
|
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
|
|
@@ -106,7 +95,6 @@ function saveDrugApply(data) {
|
|
|
return;
|
|
|
}
|
|
|
if (res.code == 0) {
|
|
|
- $("#editModal").modal("hide");
|
|
|
$('#tb_table').bootstrapTable('refresh');
|
|
|
successMesage(res);
|
|
|
} else {
|
|
@@ -236,15 +224,17 @@ function initTbTable() {
|
|
|
* @param {td 元素} $element
|
|
|
*/
|
|
|
onClickCell: function(field, value, row, $element) {
|
|
|
- if(field == 'outAmt'){
|
|
|
+ if(field == 'newOutAmt'){
|
|
|
$element.attr('contenteditable', true);
|
|
|
$element.html(null);
|
|
|
$element.focus();
|
|
|
$element.blur(function() {
|
|
|
- var index = $element.parent().data('index');
|
|
|
+ let index = $element.parent().data('index');
|
|
|
var tdValue = $element.html();
|
|
|
+ tdValue = tdValue.replaceAll(" ","");
|
|
|
+ tdValue = tdValue.replaceAll("<br>","");
|
|
|
saveData(index, field, tdValue);
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
responseHandler: function (res) {
|
|
@@ -335,7 +325,7 @@ function initAddDrugTable() {
|
|
|
formatter: function (value, row, index) {
|
|
|
var str = '<button type="button" class="registration-no-color-foot-button" title="选择" onclick="addData(\'' + row.outDate + '\',\''
|
|
|
+ row.chargeCode + '\',\'' + row.name + '\',\'' + row.specification+ '\',\'' + row.groupNoOutName+ '\',\'' + row.outAmt+ '\',\''
|
|
|
- + row.effDate+ '\',\'' + row.drawNo+ '\',\'' + row.inDrawNo+ '\')"><i class="glyphicon glyphicon-plus"></i></button>';
|
|
|
+ + row.effDate+ '\',\'' + row.drawNo+ '\',\'' + row.inDrawNo+ '\',\'' + row.outSeri+ '\')"><i class="glyphicon glyphicon-plus"></i></button>';
|
|
|
return str;
|
|
|
}
|
|
|
}, {
|
|
@@ -446,28 +436,6 @@ function initAddDrugTable() {
|
|
|
"total": ress.total,//总页数
|
|
|
"rows": ress.data //数据
|
|
|
};
|
|
|
- },
|
|
|
- /**
|
|
|
- * @param {点击列的 field 名称} field
|
|
|
- * @param {点击列的 value 值} value
|
|
|
- * @param {点击列的整行数据} row
|
|
|
- * @param {td 元素} $element
|
|
|
- */
|
|
|
- onClickCell: function (field, value, row, $element) {
|
|
|
- if (field == 'amount') {
|
|
|
- $element.attr('contenteditable', true);
|
|
|
- $element.html(null);
|
|
|
- $element.focus();
|
|
|
- $element.blur(function () {
|
|
|
- var index = $element.parent().data('index');
|
|
|
- var tdValue = $element.html();
|
|
|
- if (parseFloat(tdValue).toString() != "NaN") {
|
|
|
- saveCellData($('#add_drug_table'), index, field, tdValue);
|
|
|
- } else {
|
|
|
- $element.html(null);
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -477,8 +445,17 @@ function initAddDrugTable() {
|
|
|
* @param field
|
|
|
* @param values
|
|
|
*/
|
|
|
-function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,effDate,drawNo,inDrawNo) {
|
|
|
+function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,effDate,drawNo,inDrawNo,outSeri) {
|
|
|
+ var tableData = $table.bootstrapTable('getData');
|
|
|
+ for (let i = 0; i < tableData.length; i++) {
|
|
|
+ let data = tableData[i];
|
|
|
+ if(drawNo === data.drawNo && outSeri === data.outSeri){
|
|
|
+ warningMesageSimaple("请勿重复添加");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
let row= {
|
|
|
+ id:new Date().getTime()+"",
|
|
|
outDate: outDate,
|
|
|
chargeCode: chargeCode,
|
|
|
name: name,
|
|
@@ -487,6 +464,7 @@ function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,eff
|
|
|
outAmt: outAmt,
|
|
|
effDate: effDate,
|
|
|
drawNo: drawNo,
|
|
|
+ outSeri:outSeri,
|
|
|
inDrawNo: inDrawNo
|
|
|
};
|
|
|
$table.bootstrapTable('prepend', row);
|