diff --git a/application/admin/service/ReceiptOrderDao.php b/application/admin/service/ReceiptOrderDao.php index cc61898..ed1721e 100644 --- a/application/admin/service/ReceiptOrderDao.php +++ b/application/admin/service/ReceiptOrderDao.php @@ -42,12 +42,18 @@ class ReceiptOrderDao */ public function save($param) { + if ($this->checkName($param)) { + return Util::returnArrEr("名称已经存在"); + } try { $data = [ 'name' => $param['name'], "create_id"=>$param['create_id'], "group_id"=>$param['group_id'] ]; + if (isset($param['status'])) { + $data['status'] = $param['status']; + } $receiptOrder = new ReceiptOrder(); if (empty($param['id'])) { $id = $receiptOrder->insertGetId($data); @@ -62,6 +68,32 @@ class ReceiptOrderDao } /** + * 校验名称 + * @param $param + * @return bool + */ + public function checkName($param):bool { + try { + $model = new ReceiptOrder(); + $infoRe = $model->where(["name" => $param['name']])->find(); + if ($infoRe == null) { + return false; + } + $info = $infoRe->toArray(); + if (isset($param['id'])) { + if ($param['id'] != $info['id']) { + return true; + } + }else{ + return true; + } + return false; + } catch (Exception $e) { + return false; + } + } + + /** * 修改状态 * @param $id * @param $status diff --git a/application/admin/view/receipt_order/index.html b/application/admin/view/receipt_order/index.html index b81649c..9286cf6 100755 --- a/application/admin/view/receipt_order/index.html +++ b/application/admin/view/receipt_order/index.html @@ -197,7 +197,7 @@ - + @@ -211,8 +211,8 @@ @@ -274,7 +274,6 @@ editType: false, editData: {}, editOrderShow:false, - editOrderOld:{}, editOrder:{}, orderMainListSearch:{ "receipt_order_id":"", @@ -321,6 +320,9 @@ }, methods: { checkSelect(row,index){ + if (this.editOrder.status != 0) { + return false; + } if (row.receipt_order_id ==0) { return true; } @@ -422,7 +424,7 @@ this.editShow = false; this.getData(1); } else { - this.$message.error(response.msg); + this.$message.error(data.msg); } }).catch(function (error) { this.$message.error("保存失败"); @@ -443,7 +445,7 @@ type: 'success' }); } else { - this.$message.error(response.msg); + this.$message.error(data.msg); } }).catch(function (error) { this.$message.error("保存失败"); @@ -478,7 +480,7 @@ this.orderMainTotal = data.data.total; console.log(this.orderMainList); } else { - this.$message.error(response.msg); + this.$message.error(data.msg); } }).catch(function (error) { console.log(error); @@ -499,7 +501,7 @@ this.getOrderMainData(this.orderMainListSearch.pageNum) this.getData(this.search.pageNum) } else { - this.$message.error(response.msg); + this.$message.error(data.msg); } }).catch(function (error) { console.log(error); @@ -532,7 +534,7 @@ this.getOrderMainData(this.orderMainListSearch.pageNum) this.getData(this.search.pageNum) } else { - this.$message.error(response.msg); + this.$message.error(data.msg); } }).catch(function (error) { console.log(error); @@ -556,7 +558,7 @@ }); this.getData(this.search.pageNum) } else { - this.$message.error(response.msg); + this.$message.error(data.msg); } }).catch(function (error) { console.log(error);