qzyReal пре 2 година
родитељ
комит
06cee45978

+ 0 - 27
sp-admin/sa-frame/menu-list.js

@@ -676,33 +676,6 @@ var menuList = [{
 			},
 		]
 	},
-	// {
-	// 	id: 'tb-entity',
-	// 	name: '开票主体',
-	// 	icon: 'el-icon-folder-opened',
-	// 	parent: true,
-	// 	childList: [
-	// 		{id: 'tb-entity-list', name: '开票主体列表', url: 'sa-view/tb-entity/tb-entity-list.html'},
-	// 	]
-	// },
-	// {
-	// 	id: 'tb-invoice-order',
-	// 	name: '开票订单',
-	// 	icon: 'el-icon-folder-opened',
-	// 	parent: true,
-	// 	childList: [
-	// 		{id: 'tb-invoice-order-list', name: '开票订单列表', url: 'sa-view/tb-invoice-order/tb-invoice-order-list.html'},
-	// 	]
-	// },
-	// {
-	// 	id: 'tb-invoice-info',
-	// 	name: '开票信息',
-	// 	icon: 'el-icon-folder-opened',
-	// 	parent: true,
-	// 	childList: [
-	// 		{id: 'tb-invoice-info-list', name: '开票信息列表', url: 'sa-view/tb-invoice-info/tb-invoice-info-list.html'},
-	// 	]
-	// },
 	{
 		id: 'tb-invoice-info',
 		name: '开票管理',

+ 194 - 178
sp-admin/sa-view/tb-business/tb-car-disincle-info.html

@@ -1,195 +1,211 @@
 <!DOCTYPE html>
 <html>
-<head>
-    <title>入境登记-详情</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <meta name="viewport"
-          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
-    <!-- 所有的 css js 资源 -->
-    <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
-    <link rel="stylesheet" href="../../static/sa.css">
-    <script src="../../static/kj/vue.min.js"></script>
-    <script src="../../static/kj/element-ui/index.js"></script>
-    <script src="../../static/kj/httpVueLoader.js"></script>
-    <script src="../../static/kj/jquery.min.js"></script>
-    <script src="../../static/kj/layer/layer.js"></script>
-    <script src="../../static/sa.js"></script>
-    <script src="../../static/sa.js"></script>
-    <script src="../../static/kj/upload-util.js"></script>
-    <style type="text/css">
-        .c-panel .c-label {
-            width: 8em;
-        }
-    </style>
-</head>
-<body>
-<div class="vue-box sbot" style="display: none;" :style="'display: block;'">
-    <!-- ------- 内容部分 ------- -->
-    <div class="s-body">
-        <div class="c-panel">
-            <el-form v-if="m">
-                <el-row>
-                    <el-collapse value='1'>
-                        <el-collapse-item name="1">
-                            <div slot="title">
-                                基础资料
-                            </div>
-                            <div>
-                                <el-row>
-                                    <el-col span="12">
-                                        <sa-info name="客户名称" br v-if="m.customerName">{{m.customerName}}
-                                        </sa-info>
-                                        <sa-info name="业务项目" br>{{m.goodsName}}</sa-info>
-                                        <sa-info name="作业时间" br>{{m.operateTime}}</sa-info>
-                                        <sa-info name="业务费用" br>{{m.itemPrice}}(元)</sa-info>
-										<sa-info name="支付时间" br>{{m.payTime}}</sa-info>
-                                    </el-col>
-                                    <el-col span="12">
-                                        <sa-info name="货主" br>{{m.owner}}</sa-info>
-                                        <sa-info name="业务编号" br>{{m.no}}</sa-info>
-                                        <sa-info name="录入时间" br>{{m.createTime}}</sa-info>
-                                        <sa-info name="录入人" br>{{m.createBy}}</sa-info>
-                                        <sa-info type="enum" style="margin-top: 0px;" name="支付状态" :value="m.payStatus"
-                                                 :jv="{1: '未支付', 2: '已支付未确认', 3: '已支付'}" br></sa-info>
-                                    </el-col>
-                                </el-row>
-                            </div>
-                        </el-collapse-item>
-                    </el-collapse>
+	<head>
+		<title>入境登记-详情</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<meta name="viewport"
+			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+		<script src="../../static/sa.js"></script>
+		<script src="../../static/kj/upload-util.js"></script>
+		<style type="text/css">
+			.c-panel .c-label {
+				width: 8em;
+			}
+		</style>
+	</head>
+	<body>
+		<div class="vue-box sbot" style="display: none;" :style="'display: block;'">
+			<!-- ------- 内容部分 ------- -->
+			<div class="s-body">
+				<div class="c-panel">
+					<el-form v-if="m">
+						<el-row>
+							<el-collapse value='1'>
+								<el-collapse-item name="1">
+									<div slot="title">
+										基础资料
+									</div>
+									<div>
+										<el-row>
+											<el-col span="12">
+												<sa-info name="客户名称" br v-if="m.customerName">{{m.customerName}}
+												</sa-info>
+												<sa-info name="业务项目" br>{{m.goodsName}}</sa-info>
+												<sa-info name="作业时间" br>{{m.operateTime}}</sa-info>
+												<sa-info name="业务费用" br>{{m.itemPrice}}(元)</sa-info>
+												<sa-info name="支付时间" br>{{m.payTime}}</sa-info>
+												<sa-info name="补录人" br v-if="m.supplementBy">{{m.supplementBy}}
+												</sa-info>
+												<sa-info name="补录时间" br v-if="m.supplementTime">{{m.supplementTime}}
+												</sa-info>
+												<sa-info name="补录原因" br v-if="m.supplementReason">{{m.supplementReason}}
+												</sa-info>
+												<sa-info type="enum" style="margin-top: 0px;" name="OA流程"
+													:value="m.sendOa" :jv="{0: '未发起', 1: '已发起'}" br
+													v-if="m.supplementTime">
+												</sa-info>
 
-                </el-row>
-                <el-row>
-                    <el-collapse value='1'>
-                        <el-collapse-item name="1">
-                            <div slot="title">
-                                车辆信息
-                            </div>
-                            <el-table :data="m.cars" style="width: 100%">
-                                <sa-td name="车牌号" prop="carNo"></sa-td>
-                                <sa-td name="类型" prop="carType"></sa-td>
-                                <sa-td name="载重(kg)" prop="netWeight"></sa-td>
-                                <sa-td name="规格(米)" prop="carSize"></sa-td>
-                                <sa-td width="130" name="支付状态" prop="payType">
-                                </sa-td>
-                                <sa-td width="120" name="车辆状态" prop="isLock" type="enum"
-                                       :jv="{1: '锁定[#ff0000]', 0: '正常[#005500]'}">
-                                </sa-td>
+											</el-col>
+											<el-col span="12">
+												<sa-info name="货主" br>{{m.owner}}</sa-info>
+												<sa-info name="业务编号" br>{{m.no}}</sa-info>
+												<sa-info name="录入时间" br>{{m.createTime}}</sa-info>
+												<sa-info name="录入人" br>{{m.createBy}}</sa-info>
+												<sa-info type="enum" style="margin-top: 0px;" name="支付状态"
+													:value="m.payStatus" :jv="{1: '未支付', 2: '已支付未确认', 3: '已支付'}" br>
+												</sa-info>
+												<sa-info name="发起人" br v-if="m.sendBy">{{m.sendBy}}</sa-info>
+												<sa-info name="发起时间" br v-if="m.sendTime">{{m.sendTime}}</sa-info>
+												<sa-info name="审批结果" br v-if="m.oaResult">{{m.oaResult}}</sa-info>
+												<sa-info name="审批意见" br v-if="m.oaContent">{{m.oaContent}}</sa-info>
+											</el-col>
+										</el-row>
+									</div>
+								</el-collapse-item>
+							</el-collapse>
 
-                                <el-table-column label="停车费">
-                                    <template slot-scope="s">
-                                        <label v-if="s.row.money">{{s.row.money}}</label>
-                                        <label v-else>-</label>
-                                    </template>
-                                </el-table-column>
-                                <sa-td name="入场时间" prop="realInTime" width=180></sa-td>
-                                <sa-td name="离场时间" prop="realOutTime" width=180></sa-td>
-                            </el-table>
-                        </el-collapse-item>
-                    </el-collapse>
-                </el-row>
-                <el-row>
-                    <el-collapse value='1'>
-                        <el-collapse-item name="1">
-                            <div slot="title">
-                                具体业务项
-                                <label
-                                        style="color: red; font-weight: bold;margin-left: 20px;">合计:({{m.itemPrice}}元)</label>
-                            </div>
-                            <el-table :data="tableData" style="width: 100%">
-                                <el-table-column prop="itemTypeName" label="收费项" width="180">
-                                </el-table-column>
-                                <el-table-column prop="itemName" label="收费明细" width="180">
-                                </el-table-column>
-                                <el-table-column prop="itemPrice" label="单价">
-                                </el-table-column>
-                                <el-table-column prop="unit" label="计费标准">
-                                </el-table-column>
-                                <el-table-column prop="num" label="数量">
-                                </el-table-column>
-                                <el-table-column prop="total" label="合计">
-                                </el-table-column>
-                                <sa-td width="120" name="支付状态" prop="payStatus" type="enum"
-                                       :jv="{0: '未支付[#ff0000]', 1: '已支付[#005500]'}">
-                                </sa-td>
-                                <el-table-column prop="payTime" label="支付时间" width="150">
-                                </el-table-column>
-                                <el-table-column prop="remark" label="备注" width="150">
-                                </el-table-column>
-                                <!-- <sa-td type="img-list" name="凭据" prop="ticket"></sa-td>
+						</el-row>
+						<el-row>
+							<el-collapse value='1'>
+								<el-collapse-item name="1">
+									<div slot="title">
+										车辆信息
+									</div>
+									<el-table :data="m.cars" style="width: 100%">
+										<sa-td name="车牌号" prop="carNo"></sa-td>
+										<sa-td name="类型" prop="carType"></sa-td>
+										<sa-td name="载重(kg)" prop="netWeight"></sa-td>
+										<sa-td name="规格(米)" prop="carSize"></sa-td>
+										<sa-td width="130" name="支付状态" prop="payType">
+										</sa-td>
+										<sa-td width="120" name="车辆状态" prop="isLock" type="enum"
+											:jv="{1: '锁定[#ff0000]', 0: '正常[#005500]'}">
+										</sa-td>
+
+										<el-table-column label="停车费">
+											<template slot-scope="s">
+												<label v-if="s.row.money">{{s.row.money}}</label>
+												<label v-else>-</label>
+											</template>
+										</el-table-column>
+										<sa-td name="入场时间" prop="realInTime" width=180></sa-td>
+										<sa-td name="离场时间" prop="realOutTime" width=180></sa-td>
+									</el-table>
+								</el-collapse-item>
+							</el-collapse>
+						</el-row>
+						<el-row>
+							<el-collapse value='1'>
+								<el-collapse-item name="1">
+									<div slot="title">
+										具体业务项
+										<label
+											style="color: red; font-weight: bold;margin-left: 20px;">合计:({{m.itemPrice}}元)</label>
+									</div>
+									<el-table :data="tableData" style="width: 100%">
+										<el-table-column prop="itemTypeName" label="收费项" width="180">
+										</el-table-column>
+										<el-table-column prop="itemName" label="收费明细" width="180">
+										</el-table-column>
+										<el-table-column prop="itemPrice" label="单价">
+										</el-table-column>
+										<el-table-column prop="unit" label="计费标准">
+										</el-table-column>
+										<el-table-column prop="num" label="数量">
+										</el-table-column>
+										<el-table-column prop="total" label="合计">
+										</el-table-column>
+										<sa-td width="120" name="支付状态" prop="payStatus" type="enum"
+											:jv="{0: '未支付[#ff0000]', 1: '已支付[#005500]'}">
+										</sa-td>
+										<el-table-column prop="payTime" label="支付时间" width="150">
+										</el-table-column>
+										<el-table-column prop="remark" label="备注" width="150">
+										</el-table-column>
+										<!-- <sa-td type="img-list" name="凭据" prop="ticket"></sa-td>
                                 <el-table-column label="其他凭据">
                                     <template slot-scope="s">
                                         <el-button class="c-btn" type="primary" @click="uploadFn(s.row)">上传
                                         </el-button>
                                     </template>
                                 </el-table-column> -->
-                            </el-table>
-                        </el-collapse-item>
-                    </el-collapse>
-                </el-row>
-            </el-form>
-        </div>
-    </div>
-    <!-- ------- 底部按钮 ------- -->
-    <div class="s-foot">
-        <!-- <el-button class="c-btn" type="success" icon="el-icon" @click="print()">打印单据</el-button> -->
-        <el-button type="success" @click="sa.closeCurrIframe()">关闭</el-button>
-    </div>
+									</el-table>
+								</el-collapse-item>
+							</el-collapse>
+						</el-row>
+					</el-form>
+				</div>
+			</div>
+			<!-- ------- 底部按钮 ------- -->
+			<div class="s-foot">
+				<!-- <el-button class="c-btn" type="success" icon="el-icon" @click="print()">打印单据</el-button> -->
+				<el-button type="success" @click="sa.closeCurrIframe()">关闭</el-button>
+			</div>
 
-    <el-dialog title="上传凭据" :visible.sync="upload.visible" width="400">
-        <el-form>
-            <sa-item type="img-list" name="凭据图片" v-model="upload.form.ticket" br></sa-item>
-        </el-form>
-        <span slot="footer" class="dialog-footer">
+			<el-dialog title="上传凭据" :visible.sync="upload.visible" width="400">
+				<el-form>
+					<sa-item type="img-list" name="凭据图片" v-model="upload.form.ticket" br></sa-item>
+				</el-form>
+				<span slot="footer" class="dialog-footer">
 					<el-button @click="upload.visible=false">取 消</el-button>
 					<el-button type="primary" @click="ok()">确 定</el-button>
 				</span>
-    </el-dialog>
+			</el-dialog>
 
-</div>
-<script>
-    var app = new Vue({
-        components: {
-            "sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
-            "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
-            "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
-        },
-        el: '.vue-box',
-        data: {
-            id: sa.p('id', 0), // 获取数据ID
-            m: null,
-            tableData: [],
-            upload: {
-                visible: false,
-                form: {
-                    id: '',
-                    ticket: ''
-                }
-            }
-        },
-        methods: {
-            print: function() {
-                sa.showIframe('打印收费单据', 'print.html?id=' + this.id, '1000px', '100%');
-            },
-            uploadFn(data) {
-                Object.assign(this.upload, {
-                    visible: true,
-                    form: data
-                })
-            },
-            ok() {
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
+				},
+				el: '.vue-box',
+				data: {
+					id: sa.p('id', 0), // 获取数据ID
+					m: null,
+					tableData: [],
+					upload: {
+						visible: false,
+						form: {
+							id: '',
+							ticket: ''
+						}
+					}
+				},
+				methods: {
+					print: function() {
+						sa.showIframe('打印收费单据', 'print.html?id=' + this.id, '1000px', '100%');
+					},
+					uploadFn(data) {
+						Object.assign(this.upload, {
+							visible: true,
+							form: data
+						})
+					},
+					ok() {
 
-            },
-            getInfo() {
-                sa.ajax('/TbBusiness/getOtherBusinessById?id=' + this.id, function(res) {
-                    this.m = res.data;
-                    this.tableData = res.data.items;
-                }.bind(this))
-            }
-        },
-        mounted: function() {
-            this.getInfo()
-        }
-    })
-</script>
-</body>
+					},
+					getInfo() {
+						sa.ajax('/TbBusiness/getOtherBusinessById?id=' + this.id, function(res) {
+							this.m = res.data;
+							this.tableData = res.data.items;
+						}.bind(this))
+					}
+				},
+				mounted: function() {
+					this.getInfo()
+				}
+			})
+		</script>
+	</body>
 </html>

+ 772 - 0
sp-admin/sa-view/tb-business/tb-car-supplement-select.html

@@ -0,0 +1,772 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>入境登记-添加/修改</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <meta name="viewport"
+          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+    <!-- 所有的 css js 资源 -->
+    <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+    <link rel="stylesheet" href="../../static/sa.css">
+    <script src="../../static/kj/vue.min.js"></script>
+    <script src="../../static/kj/element-ui/index.js"></script>
+    <script src="../../static/kj/httpVueLoader.js"></script>
+    <script src="../../static/kj/jquery.min.js"></script>
+    <script src="../../static/kj/layer/layer.js"></script>
+    <script src="../../static/sa.js"></script>
+    <script src="../../static/kj/upload-util.js"></script>
+    <style type="text/css">
+        .c-panel .el-form .c-label {
+            width: 7em !important;
+        }
+
+        .c-panel .el-form .c-panel .el-form {
+            width: 180px;
+        }
+
+        .item-num .el-input__inner {
+            width: 130px;
+        }
+
+        .xj {
+            display: inline;
+            color: red;
+            margin-left: 9px;
+            font-weight: bold;
+        }
+
+        .hj {
+            color: red;
+            margin-left: 9px;
+            font-weight: bold;
+
+        }
+    </style>
+</head>
+<body>
+<div class="vue-box sbot" style="display: none;" :style="'display: block;'">
+    <!-- ------- 内容部分 ------- -->
+    <div class="s-body">
+        <div class="c-panel">
+            <div class="c-title">数据添加</div>
+            <el-form v-if="m" label-position="left">
+                <el-row>
+                    <el-card class="box-card">
+                        <div slot="header" class="clearfix">
+                            <span>基本资料</span>
+                        </div>
+                        <div>
+                            <el-row>
+                                <el-col span=8>
+                                    <div class="c-item">
+                                        <label class="c-label"><span style="color: red;">*</span>业务项目:</label>
+                                        <el-select v-model="m.goodsId" placeholder="请选择" @change="goodsChange">
+                                            <el-option v-for="item in goodsList" :key="item.id"
+                                                       :label="item.name" :value="item.id">
+                                            </el-option>
+                                        </el-select>
+                                    </div>
+                                    <div class="c-item" v-if="goods.needDeclare==1">
+                                        <label class="c-label">
+                                            <span style="color: red;">*</span>
+                                            申报单号:</label>
+                                        <el-input v-model="m.declareNo" placeholder="选择申报单"
+                                                  :readonly="goods.needDeclare==1" clearable>
+                                        </el-input>
+                                        <div style="cursor: pointer;color: blue;display: inline;"
+                                             @click="handlerDeclare">
+                                            <i class="el-icon-folder-add"></i>
+                                        </div>
+                                    </div>
+                                </el-col>
+                                <el-col span=8>
+                                    <div class="c-item" v-if="goods.needCustomer">
+                                        <label class="c-label"><span style="color: red;">*</span>客户:</label>
+                                        <el-select
+                                                :disabled="goods.needDeclare||m.declareNo||currentCustomerId!='1'"
+                                                v-model="m.customerId" placeholder="请选择">
+                                            <el-option v-for="item in customerList" :key="item.id"
+                                                       :label="item.name" :value="item.id">
+                                            </el-option>
+                                        </el-select>
+                                    </div>
+                                    <div class="c-item" v-if="goods.needOwner==1">
+                                        <label class="c-label">
+                                            <span style="color: red;">*</span>
+                                            货主:</label>
+                                        <el-input v-model="m.owner" placeholder="填写货主" clearable>
+                                        </el-input>
+                                    </div>
+                                </el-col>
+                                <el-col span=8>
+                                    <div class="c-item">
+                                        <label class="c-label">作业人员:</label>
+                                        <el-input v-model="m.operator" placeholder="作业人员" clearable>
+                                        </el-input>
+                                    </div>
+                                    <div class="c-item">
+                                        <label class="c-label"><span style="color: red;"
+                                                                     v-if="goods.needOperateTime==1">*</span>作业时间:</label>
+                                        <el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
+                                                        v-model="m.operateTime"></el-date-picker>
+                                    </div>
+                                </el-col>
+                            </el-row>
+                        </div>
+                    </el-card>
+                </el-row>
+                <el-row>
+                    <el-card class="box-card">
+                        <div slot="header" class="clearfix">
+                            <span>车辆</span>
+                            <el-button style="float: right;" 
+							icon="el-icon-plus" type="primary"
+                                       @click="showAddModal" v-if="goods.mulCar==1||car.list.length==0">添加
+                            </el-button>
+                        </div>
+                        <el-table :data="car.list">
+                            <el-table-column type="index" width="50" label="序号">
+                            </el-table-column>
+                            <el-table-column prop="carNo" label="车牌号">
+                            </el-table-column>
+                            <el-table-column prop="carSize" label="规格(米)">
+                            </el-table-column>
+                            <el-table-column prop="carType" label="类型">
+                            </el-table-column>
+                            <el-table-column prop="netWeight" label="载重(kg)">
+                            </el-table-column>
+                            <el-table-column label="操作">
+                                <template slot-scope="s">
+                                    <el-button class="c-btn" type="info" @click="editFn(s.row)">修改</el-button>
+                                    <el-button class="c-btn" type="danger" @click="deleteFn(s.row)">删除
+                                    </el-button>
+                                </template>
+                            </el-table-column>
+                        </el-table>
+                    </el-card>
+                </el-row>
+                <el-row>
+                    <el-card class="box-card">
+                        <div slot="header" class="clearfix">
+                            <span>收费项</span>
+                        </div>
+                        <div>
+                            <el-form-item v-for="(type,index) in itemTypeList">
+                                <el-row justify="center">
+                                    <el-col span="9">
+                                        <label style="color: red;"
+                                               v-if="type.need==1">*</label><label>{{type.name}}:</label>
+                                        <el-select v-model="type.itemId" style="width: 120px;"
+                                                   @change="itemChange(type)" placeholder="请选择">
+                                            <el-option v-for="item in type.items" :key="item.id"
+                                                       :label="item.itemName" :value="item.id">
+                                            </el-option>
+                                        </el-select>
+                                    </el-col>
+                                    <el-col span="7">
+                                        <el-input-number style="margin-left: 60px;" class="item-num"
+                                                         v-model="type.num" :min="1" :max="10" size="mini"
+                                                         :disabled="type.inc==0"></el-input-number>
+                                        <div class="xj" v-if="type.itemId">
+                                            {{type.price*type.num}}元
+                                            <label @click="cleanItem(type)"
+                                                   style="margin-left: 5px;cursor: pointer">(<i
+                                                    class="el-icon-delete"></i>)</label>
+                                        </div>
+                                    </el-col>
+                                    <el-col span="8">
+                                        <label class="c-label">
+                                            备注:</label>
+                                        <el-input v-model="type.remark" placeholder="请输入备注" clearable>
+                                        </el-input>
+                                    </el-col>
+                                </el-row>
+                                <el-divider></el-divider>
+                            </el-form-item>
+                            <div class="hj" v-if="totalPrice>0">
+                                合计费用:{{totalPrice}}<label>元</label>
+                            </div>
+                        </div>
+                    </el-card>
+                </el-row>
+            </el-form>
+        </div>
+    </div>
+    <!-- ------- 底部按钮 ------- -->
+    <div class="s-foot">
+        <el-button type="primary" @click="ok()">确定</el-button>
+        <el-button @click="closeFn()">取消</el-button>
+    </div>
+    <el-dialog title="车辆录入" :visible.sync="car.visible" width="400">
+				<span>
+					<el-form label-position="left">
+						<div class="c-item">
+							<label class="c-label"><span style="color: red;">*</span>车牌号:</label>
+							<el-autocomplete v-model="car.form.carNo" placeholder="请输入车牌号" value-key='carNo'
+                                             :fetch-suggestions="queryCarAsync">
+							</el-autocomplete>
+						</div>
+						<div class="c-item">
+							<label class="c-label">车辆类型:</label>
+							<el-select v-model="car.form.carType" placeholder="请选择" @change="carTypeChange">
+								<el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
+								</el-option>
+							</el-select>
+						</div>
+						<div class="c-item">
+							<label class="c-label">
+								<span style="color: red;" v-if="goods.needCarSize==1">*</span>
+								规格(米):</label>
+							<el-input-number class="item-num" v-model="car.form.carSize" :min="1" :max="50">
+							</el-input-number>
+						</div>
+						<div class="c-item" v-if="car.form.carType&&car.form.carType.indexOf('空')==-1">
+							<label class="c-label">
+								<span style="color: red;" v-if="goods.needCarSize==1">*</span>
+								载重(kg):</label>
+							<el-input-number class="item-num" v-model="car.form.netWeight" :min="1" :max="999999">
+							</el-input-number>
+						</div>
+					</el-form>
+				</span>
+        <span slot="footer" class="dialog-footer">
+					<el-button @click="car.visible = false">取 消</el-button>
+					<el-button type="primary" @click="confirmAdd">确 定</el-button>
+				</span>
+    </el-dialog>
+    <el-dialog title="申报单" :visible.sync="declare.visible" width="90%">
+        <div class="delect-search">
+            申报人:
+            <el-input style="width: 140px;" v-model="declare.p.declarePeople" placeholder="申报人">
+            </el-input>
+            <el-button type="primary" @click="getDeclareList">搜索</el-button>
+            <el-button type="info" @click="resetDclare">重置</el-button>
+        </div>
+        <el-card class="box-card" style="margin-top: 20px;">
+            <div slot="header">
+                <span>列表</span>
+            </div>
+            <el-table :data="declare.list" ref="declareTable">
+                <el-table-column type="selection">
+                </el-table-column>
+                <el-table-column prop="declarePeople" label="申报人">
+                </el-table-column>
+                <el-table-column prop="customerName" label="申报公司" width=200>
+                </el-table-column>
+                <el-table-column prop="sendUnit" label="货主" width=200>
+                </el-table-column>
+                <el-table-column prop="createTime" width="140" label="申报时间">
+                </el-table-column>
+                <el-table-column prop="declareNo" width="180" label="申报单号">
+                </el-table-column>
+                <el-table-column prop="goodsName" label="产品学名">
+                </el-table-column>
+                <el-table-column prop="carNo" label="越南车牌">
+                </el-table-column>
+                <el-table-column prop="grossWeight" label="毛重(kg)">
+                </el-table-column>
+            </el-table>
+            <div class="block">
+                <el-pagination layout="prev, pager, next" @current-change="getDeclareList"
+                               :page-size="declare.p.pageSize" :total="declare.p.dataCount"
+                               :current-page="declare.p.pageNo">
+                </el-pagination>
+            </div>
+        </el-card>
+        <span slot="footer" class="dialog-footer">
+					<el-button @click="declare.visible = false">取 消</el-button>
+					<el-button type="primary" @click="confirmSelectDeclare">确 定</el-button>
+				</span>
+    </el-dialog>
+</div>
+<script>
+    var app = new Vue({
+        components: {
+            "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
+            "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')
+        },
+        el: '.vue-box',
+        data: {
+            m: {
+                id: sa.p('id', ''), // 主键
+                customerId: '', // 客户id
+                customerName: '', // 客户名称
+                operateTime: '',
+                no: '', // 编号
+                goodsId: '',
+                goodsName: '', // 商品
+            }, // 实体对象
+            customerList: [],
+            carList: [],
+            currentCustomerId: 1,
+            itemTypeList: [],
+            filterTypeList: [],
+            goodsList: [],
+            tableData: [],
+            car: {
+                visible: false,
+                list: [],
+                form: {
+                    carNo: '',
+                    carType: '',
+                    netWeight: '',
+                    carSize: ''
+                }
+            },
+            declare: {
+                visible: false,
+                list: [],
+                p: {
+                    pageNo: 1,
+                    pageSize: 8,
+                    dataCount: 0,
+                    declarePeople: '',
+                    production: '',
+                    declareNo: '1'
+                }
+            },
+            goods: {
+                id: '',
+                name: '',
+                needWeight: 1,
+                needCarSize: 1,
+                needDeclare: 1,
+                needOperateTime: 1,
+				mulCar:0
+            },
+            carTypeList: [],
+            intiItems: []
+        },
+        computed: {
+            totalPrice() {
+                let itemList = this.itemTypeList.filter(obj => obj.itemId);
+                let price = 0;
+                for (let i in itemList) {
+                    let type = itemList[i];
+                    let num = type.num;
+                    let items = type.items;
+                    for (let j in items) {
+                        let item = items[j];
+                        if (item.id == type.itemId) {
+                            price += num * item.price;
+                            break;
+                        }
+                    }
+                }
+                return price;
+            }
+        },
+        methods: {
+            resetDclare() {
+                this.declare.p.pageNo = 1;
+                this.declare.p.pageSize = 8;
+                this.declare.p.production = '';
+                this.declare.p.declarePeople = '';
+                this.getDeclareList();
+            },
+            handlerDeclare() {
+                this.declare.visible = true;
+                this.getDeclareList();
+            },
+            getDeclareList() {
+                let currentCustomerId = this.currentCustomerId;
+                if (currentCustomerId != '1') {
+                    this.declare.p.customerId = this.currentCustomerId;
+                }
+                let declareNo = this.m.declareNo;
+                if (declareNo) {
+                    this.declare.p.declareNo = declareNo;
+                }
+                sa.ajax('/TbDeclare/getNotBindList', sa.removeNull(this.declare.p), function(resp) {
+                    let list = resp.data;
+                    this.declare.list = list;
+                    this.declare.p.pageNo = resp.pageNo;
+                    this.declare.p.dataCount = resp.dataCount;
+                    list.forEach(row => {
+                        if (row.declareNo == this.m.declareNo) {
+                            this.$nextTick(() => {
+                                this.$refs['declareTable'].toggleRowSelection(row, true)
+                            })
+                        }
+                    })
+                }.bind(this))
+            },
+            confirmSelectDeclare() {
+                // 获取选中元素的id列表
+                let selection = this.$refs['declareTable'].selection;
+                let declareNo = sa.getArrayField(selection, 'declareNo');
+                if (selection.length == 0) {
+                    return sa.msg('请至少选择一条数据')
+                }
+                if (selection.length > 1) {
+                    return sa.msg('只能选择一条数据')
+                }
+                let declare = selection[0];
+                let oldNo = this.m.declareNo;
+                if (oldNo && oldNo !== declare.declareNo) {
+                    this.car.list = [];
+                }
+                if (oldNo !== declare.declareNo) {
+                    this.m.declareNo = declare.declareNo;
+                    this.m.customerId = declare.customerId;
+                    this.m.customerName = declare.customerName;
+                    this.m.owner = declare.sendUnit;
+                    let carNo = declare.carNo;
+                    let grossWeight = declare.grossWeight;
+                    let carList = this.car.list;
+                    let exit = carList.filter(obj => obj.carNo == carNo).pop();
+                    if (!exit) {
+                        let car = {
+                            carNo: carNo,
+                            netWeight: grossWeight,
+                            carType: '载重'
+                        }
+                        this.car.list.push(car)
+                    }
+                    this.m.cardNo = declare.carNo;
+                    this.m.chinaCarNo = declare.chinaCarNo;
+                    this.m.netWeight = declare.grossWeight;
+                    let chinaCarNo = declare.chinaCarNo;
+                    if (chinaCarNo) {
+                        let list = [];
+                        chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
+                            let exit = carList.filter(obj => obj.carNo == carNo).pop();
+                            if (!exit) {
+                                let car = {
+                                    carNo: carNo,
+                                    carType: '空车'
+                                }
+                                this.car.list.push(car)
+                            }
+                        })
+                    }
+                    this.filterItems();
+                }
+                this.declare.visible = false;
+            },
+            cleanItem(type) {
+                type.itemId = '';
+                type.itemName = '';
+                type.price = '';
+            },
+            itemChange(type) {
+                let itemId = type.itemId;
+                let item = type.items.filter(obj => obj.id == itemId).pop();
+                if (item) {
+                    type.inc = item.inc;
+                    type.price = item.price;
+                }
+				this.validBefore();
+            },
+            confirmAdd() {
+                let list = this.car.list;
+                let weightCar = list.filter(car => car.carType && car.carType.indexOf('空') == -1).pop();
+                let carNo = this.car.form.carNo;
+                let netWeight = this.car.form.netWeight;
+                let goods = this.goods;
+                let form = this.car.form;
+                let carType = form.carType;
+                if (!carNo) {
+                    sa.error('请录入车牌号')
+                    return false;
+                }
+                if (!form.carSize && goods.needCarSize == 1) {
+                    sa.error('请填入车辆规格')
+                    return false;
+                }
+                if (carType.indexOf('空') !== -1) {
+                    netWeight = 0;
+                }
+
+                let index = list.map(obj => obj.carNo).indexOf(carNo);
+                if (index > -1) {
+                    list.splice(index, 1);
+                }
+                let carSize = form.carSize;
+                let car = {
+                    id: form.id,
+                    carNo: form.carNo.toUpperCase(),
+                    carType: carType,
+                    carSize: carSize,
+                    netWeight: netWeight
+                }
+                this.car.list.push(car);
+                this.car.visible = false;
+                if (weightCar) {
+                    if (weightCar.carType == carType &&
+                        carSize == weightCar.carSize &&
+                        netWeight == weightCar.netWeight) {
+                        return;
+                    }
+                }
+
+                this.filterItems();
+            },
+            filterItems() {
+                let carList = this.car.list;
+                let filterTypeList = JSON.parse(JSON.stringify(this.filterTypeList));
+                if (carList.length == 0) {
+                    this.itemTypeList = filterTypeList;
+                    return;
+                }
+                let car = this.car.form;
+                if (car == null) {
+                    let checkList = carList.filter(obj => obj.carType.indexOf('空') === -1);
+                    if (checkList.length > 0) {
+                        car = checkList[0];
+                    }
+                }
+                let carSize = car.carSize;
+                let carType = car.carType;
+                if (carType.indexOf('空') !== -1 && carList.length > 1) {
+                    return;
+                }
+                let netWeight = car.netWeight;
+                let tempList = [];
+                for (let i in filterTypeList) {
+                    let type = filterTypeList[i];
+                    let items = type.items;
+                    if (carType) {
+                        items = items.filter(item => item.itemType && item.itemType.indexOf(carType) !== -1);
+                    }
+                    if (carSize && carSize > 1) {
+                        items = items.filter(item => item.minLength <= carSize && item.carLength >= carSize);
+                    }
+                    if (netWeight && netWeight > 1 && carType && carType.indexOf('空') == -1) {
+                        items = items.filter(item => item.minWeight <= netWeight && item.maxWeight >= netWeight);
+                    }
+                    let itemIds = items.map(item => item.id);
+                    if (itemIds.indexOf(type.itemId) == -1) {
+                        this.cleanItem(type);
+                    }
+                    type.items = items;
+                    tempList.push(type);
+                }
+                this.itemTypeList = tempList;
+            },
+            showAddModal() {
+                this.car.visible = true;
+                this.car.form.carNo = '';
+                this.car.form.carSize = '';
+                this.car.form.netWeight = '';
+            },
+            editFn(data) {
+                Object.assign(this.car, {
+                    visible: true,
+                    form: JSON.parse(JSON.stringify(data))
+                })
+            },
+            deleteFn(data) {
+                this.car.list.splice(this.car.list.indexOf(data), 1);
+                this.filterItems();
+            },
+            getGoods() {
+                sa.ajaxNoLoading('/TbGoods/getList', {
+                    pageNo: 1,
+                    pageSize: 10
+                }, function(resp) {
+                    let list = resp.data;
+                    this.goods = list.filter(goods => goods.id == this.m.goodsId).pop();
+                    this.goodsList = list;
+                    this.getTypeByGoodsId();
+                }.bind(this))
+            },
+            goodsChange(v) {
+                let goodsList = this.goodsList;
+                let goods = goodsList.filter(goods => goods.id == v).pop();
+                this.goods = goods;
+                this.m.goodsName = goods.name;
+                this.getTypeByGoodsId();
+            },
+            getTypeByGoodsId() {
+                sa.ajax('/TbItemType/getTypeByGoodsId', {
+                    goodsId: this.m.goodsId
+                }, function(resp) {
+                    let list = resp.data;
+                    let initItems = this.intiItems;
+                    for (let i in initItems) {
+                        let initItem = initItems[i];
+                        for (let j in list) {
+                            let type = list[j];
+                            if (type.id == initItem.itemTypeId) {
+                                type.num = initItem.num;
+                                type.price = initItem.itemPrice;
+                                type.itemId = initItem.itemId;
+                                type.remark = initItem.remark;
+                            }
+                        }
+                    }
+                    this.itemTypeList = list;
+                    this.filterTypeList = JSON.parse(JSON.stringify(this.itemTypeList));
+                    //this.filterItems();
+                }.bind(this))
+            },
+            getItemType() {
+                sa.ajax('/TbItem/getItemType', function(resp) {
+                    let list = resp.data;
+                    if (list.length > 0) {
+                        this.car.form.carType = list[0].name;
+                    }
+                    this.carTypeList = list;
+                }.bind(this))
+            },
+            carTypeChange(v) {
+
+            },
+            getCustomerList() {
+                sa.ajax('/TbCostomer/getList', {
+                    pageNo: 1,
+                    pageSize: 30,
+                    sortType: 20,
+                    judgeStatus: 2
+                }, function(res) {
+                    let list = res.data;
+                    this.customerList = list;
+                }.bind(this));
+            },
+            queryCarAsync(queryStr, cb) {
+                sa.ajaxNoLoading('/TbBusinessCar/searchByNo', {
+                    carNo: queryStr
+                }, function(resp) {
+                    cb(resp.data)
+                }.bind(this))
+            },
+            closeFn() {
+                parent.app.f5();
+                sa.closeCurrIframe();
+            },
+			validBefore(){
+				let goods = this.goods;
+				let needCustomer=goods.needCustomer;
+				let m = this.m;
+				if (goods.needDeclare == 1 && !m.declareNo) {
+					sa.error('请选择申报单');
+					return false;
+				}
+				if (needCustomer == 1 && !m.customerId) {
+					sa.error('请选择客户');
+					return false;
+				}
+				if (goods.needOperateTime == 1 && !m.operateTime) {
+					sa.error('请选择作业时间');
+					return false;
+				}
+				if (!m.owner && goods.needOwner == 1) {
+					sa.error('请填写货主');
+					return false;
+				}
+				if (this.car.list.length == 0) {
+					sa.error('请录入车辆');
+					return false;
+				}
+				let needCarSize = goods.needCarSize;
+				let carList = this.car.list;
+				for (let i in carList) {
+					let car = carList[i];
+					if (needCarSize == 1 && !car.carSize) {
+						sa.error('请补充' + car.carNo + '规格');
+						return;
+					}
+				
+				}
+			},
+            // 提交数据
+            ok: function() {
+                let goods = this.goods;
+                let m = this.m;
+                if (goods.needDeclare == 1 && !m.declareNo) {
+                    sa.error('请选择申报单');
+                    return false;
+                }
+                if (goods.needOperateTime == 1 && !m.operateTime) {
+                    sa.error('请选择作业时间');
+                    return false;
+                }
+                if (!m.owner && goods.needOwner == 1) {
+                    sa.error('请填写货主');
+                    return false;
+                }
+                if (this.car.list.length == 0) {
+                    sa.error('请录入车辆');
+                    return false;
+                }
+                let carList = this.car.list;
+                let needCarSize = goods.needCarSize;
+                for (let i in carList) {
+                    let car = carList[i];
+                    if (needCarSize == 1 && !car.carSize) {
+                        sa.error('请补充' + car.carNo + '规格');
+                        return;
+                    }
+
+                }
+                let typeList = this.itemTypeList;
+                let selectList = [];
+                for (let i in typeList) {
+                    let type = typeList[i];
+                    if (type.need == 1 && !type.itemId) {
+                        sa.error(type.name + '必选');
+                        return false;
+                    }
+                    if (type.itemId) {
+                        let obj = {
+                            typeId: type.id,
+                            typeName: type.name,
+                            id: type.itemId,
+                            num: type.num,
+                            price: type.price,
+                            remark: type.remark
+                        }
+                        selectList.push(obj);
+                    }
+                }
+
+                m.itemJson = JSON.stringify(selectList);
+                m.carJson = JSON.stringify(carList);
+                let chinaCarNo = carList
+                    .filter(car => sa.isCarNo(car.carNo.toUpperCase()))
+                    .map(car => car.carNo.toUpperCase())
+                    .join("、");
+                let yueCarNo = carList
+                    .filter(car => !sa.isCarNo(car.carNo.toUpperCase()))
+                    .map(car => car.carNo.toUpperCase())
+                    .join("、");
+                m.cardNo = yueCarNo;
+                m.chinaCarNo = chinaCarNo;
+                m.cars = null;
+                m.items = null;
+                sa.ajax('/TbBusiness/editOtherBusiness', sa.removeNull(m), function(res) {
+                    sa.alert('修改成功', this.clean);
+                }.bind(this));
+            },
+            // 添加/修改 完成后的动作
+            clean: function() {
+                parent.app.f5(); // 刷新父页面列表
+                sa.closeCurrIframe(); // 关闭本页
+            },
+            getCurrentCustomer() {
+                sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+                    let id = resp.data;
+                    this.currentCustomerId = id;
+                }.bind(this));
+            },
+            getOtherBusinessById() {
+                sa.ajax('/TbBusiness/getOtherBusinessById?id=' + this.m.id, function(resp) {
+                    let data = resp.data;
+                    this.car.list = data.cars;
+                    this.intiItems = data.items;
+                    this.m = resp.data;
+                    this.getGoods();
+                }.bind(this))
+            },
+        },
+        mounted: function() {
+            this.getCurrentCustomer();
+            this.getOtherBusinessById();
+            this.getCustomerList();
+            this.getItemType();
+        }
+    })
+</script>
+</body>
+</html>

+ 8 - 82
sp-admin/sa-view/tb-business/tb-supplement-add.html

@@ -58,8 +58,6 @@
 							<el-card class="box-card">
 								<div slot="header" class="clearfix">
 									<span>基本资料</span>
-									<el-button style="float: right; padding: 3px 0;padding: 7px;border-radius: 4px;"
-										type="primary" @click="selectFn">选择异常业务单</el-button>
 								</div>
 								<div>
 									<el-row>
@@ -88,7 +86,8 @@
 										<el-col span=8>
 											<div class="c-item" v-if="goods.needCustomer">
 												<label class="c-label"><span style="color: red;">*</span>客户:</label>
-												<el-select :disabled="goods.needDeclare||m.declareNo"
+												<el-select
+													:disabled="goods.needDeclare||m.declareNo"
 													v-model="m.customerId" placeholder="请选择">
 													<el-option v-for="item in customerList" :key="item.id"
 														:label="item.name" :value="item.id">
@@ -282,44 +281,6 @@
 					<el-button type="primary" @click="confirmSelectDeclare">确 定</el-button>
 				</span>
 			</el-dialog>
-			<el-dialog title="选择异常业务单" :visible.sync="form.visible" width="90%">
-				<div class="delect-search">
-					<sa-item type="text" name="业务单号" placeholder="业务单号" v-model="form.p.no"></sa-item>
-					<sa-item type="text" name="车牌号" placeholder="车牌号" v-model="form.p.carNo"></sa-item>
-					<el-button type="primary" @click="getList">搜索</el-button>
-					<el-button type="info" @click="form.p.carNo='';form.p.no='';getList()">重置</el-button>
-				</div>
-				<el-card class="box-card" style="margin-top: 20px;">
-					<div slot="header">
-						<span>未支付业务列表</span>
-					</div>
-					<el-table :data="form.dataList" ref="errorTable">
-						<el-table-column type="selection">
-						</el-table-column>
-						<el-table-column prop="no" label="业务单号" width="190">
-						</el-table-column>
-						<el-table-column label="车牌号" width="160">
-							<template slot-scope="s">
-								<label>{{s.row.carNoStr}}</label>
-							</template>
-						</el-table-column>
-						<el-table-column prop="goodsName" label="业务项" width=200>
-						</el-table-column>
-						<sa-td name="业务费用(元)" prop="itemPrice" width="120"></sa-td>
-						<sa-td width="160" name="创建时间" prop="createTime"></sa-td>
-						<sa-td name="创建人" prop="createBy" width="100"></sa-td>
-					</el-table>
-					<div class="block">
-						<el-pagination layout="prev, pager, next" @current-change="businessPageChange"
-							:page-size="form.p.pageSize" :total="form.dataCount" :current-page="form.p.pageNo">
-						</el-pagination>
-					</div>
-				</el-card>
-				<span slot="footer" class="dialog-footer">
-					<el-button @click="form.visible = false">取 消</el-button>
-					<el-button type="primary" @click="selectBusinessFn">确 定</el-button>
-				</span>
-			</el-dialog>
 		</div>
 		<script>
 			var app = new Vue({
@@ -329,19 +290,6 @@
 				},
 				el: '.vue-box',
 				data: {
-					form: {
-						visible: false,
-						dataList: [],
-						dataCount: 0,
-						p: {
-							no: '',
-							carNo: '',
-							supplement: 0,
-							pageSize: 10,
-							pageNo: 1,
-							error: 1
-						}
-					},
 					m: {
 						id: '', // 主键 
 						customerId: '', // 客户id 
@@ -389,7 +337,7 @@
 						needOperateTime: 1,
 						chinaCarPay: 1,
 						vietnamCarPay: 1,
-						mulCar: 0,
+						mulCar:0,
 					},
 					carTypeList: []
 				},
@@ -413,28 +361,6 @@
 					}
 				},
 				methods: {
-					selectFn() {
-						this.form.visible = true;
-						this.getList()
-					},
-					businessPageChange() {
-
-					},
-					getList() {
-						sa.ajaxNoLoading('/TbBusiness/getOtherBusiness', sa.removeNull(this.form.p), function(res) {
-							this.form.dataList = res.data; // 数据
-							this.form.dataCount = res.dataCount; // 数据总数 
-							sa.f5TableHeight(); // 刷新表格高度 
-						}.bind(this));
-					},
-					selectBusinessFn() {
-						// 获取选中元素的id列表
-						let selection = this.$refs['errorTable'].selection;
-						if (selection.length == 0) {
-							return sa.msg('请至少选择一条数据')
-						}
-						let ids = sa.getArrayField(selection, 'id');
-					},
 					resetDclare() {
 						this.declare.p.pageNo = 1;
 						this.declare.p.pageSize = 8;
@@ -698,9 +624,9 @@
 						parent.app.f5();
 						sa.closeCurrIframe();
 					},
-					validBefore() {
+					validBefore(){
 						let goods = this.goods;
-						let needCustomer = goods.needCustomer;
+						let needCustomer=goods.needCustomer;
 						let m = this.m;
 						if (goods.needDeclare == 1 && !m.declareNo) {
 							sa.error('请选择申报单');
@@ -730,13 +656,13 @@
 								sa.error('请补充' + car.carNo + '规格');
 								return;
 							}
-
+						
 						}
 					},
 					// 提交数据 
 					ok: function() {
 						let goods = this.goods;
-						let needCustomer = goods.needCustomer;
+						let needCustomer=goods.needCustomer;
 						let m = this.m;
 						if (goods.needDeclare == 1 && !m.declareNo) {
 							sa.error('请选择申报单');
@@ -793,7 +719,7 @@
 							}
 						}
 						if (needCustomer != 1) {
-							m.customerId = '';
+							m.customerId='';
 						}
 						m.itemJson = JSON.stringify(selectList);
 						m.carJson = JSON.stringify(carList);

+ 89 - 20
sp-admin/sa-view/tb-business/tb-supplement-list.html

@@ -55,11 +55,13 @@
 					</el-button>
 					<el-button v-if="sa.isAuth('tb-flex-business-add')" size="mini" type="primary" @click="add()">
 						新增</el-button>
+						<el-button v-if="sa.isAuth('tb-flex-business-add')" size="mini"
+							type="primary" @click="selectFn">选择异常业务单</el-button>
 					<br />
 				</el-form>
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList" style="margin-top: 20px;">
-					<el-table-column type="index" width="50"></el-table-column>
+					<el-table-column type="index" label="序号" width="50"></el-table-column>
 					<sa-td name="业务单号" prop="no" width="160"></sa-td>
 					<sa-td name="客户名称" prop="customerName" width="190"></sa-td>
 					<sa-td name="货主" prop="owner" width="160"></sa-td>
@@ -69,25 +71,26 @@
 							<label>{{s.row.carNoStr}}</label>
 						</template>
 					</el-table-column>
-					<sa-td name="作业时间" prop="operateTime" width="160"></sa-td>
+					<sa-td name="作业时间" prop="operateTime" width="140"></sa-td>
 					<sa-td name="确认" prop="adminConfirmInput" type="enum" :jv="{1: '已确认', 0: '未确认'}"></sa-td>
 					<sa-td name="已支付(元)" prop="payMoney" width="140"></sa-td>
 					<sa-td name="业务费用(元)" prop="itemPrice" width="120"></sa-td>
+					<sa-td name="OA流程" prop="sendOa" type="enum" :jv="{1: '已发起', 0: '未发起'}"></sa-td>
+					<sa-td name="发起时间" prop="sendTime" width="140"></sa-td>
+					<sa-td name="发起人" prop="sendBy"></sa-td>
+					<sa-td name="补录人" prop="supplementBy"></sa-td>
+					<sa-td name="OA审核" prop="oaResult"></sa-td>
 					<sa-td width="160" name="创建时间" prop="createTime"></sa-td>
 					</sa-td>
 					<el-table-column label="操作" width="415px" fixed="right">
 						<template slot-scope="s">
-							<el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-flex-business-confirm')
-								&&currentCustomerId=='1'&&s.row.adminConfirmInput==0" @click="confirmFn(s.row)">账单确认</el-button>
-							<el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-business-confirm')
-									&&currentCustomerId=='1'&&s.row.adminConfirmInput==1" @click="checkConfirmFn(s.row)">查看账单</el-button>
 							<el-button class="c-btn" type="success" @click="get(s.row)">查看</el-button>
 							<el-button class="c-btn" type="primary"
-								v-if="currentCustomerId=='1'||(s.row.adminConfirmInput==0&&sa.isAuth('tb-flex-business-edit'))"
+								v-if="(currentCustomerId=='1'||sa.isAuth('tb-supplement-edit'))&&(s.row.sendOa==0||s.row.oaResult==='审批驳回')"
 								@click="update(s.row)">
 								修改</el-button>
 							<el-button class="c-btn" type="danger"
-								v-if="sa.isAuth('tb-flex-business-del')&&s.row.adminConfirmInput==0&&s.row.payMoney==0"
+								v-if="(currentCustomerId=='1'||sa.isAuth('tb-supplement-del'))&&s.row.sendOa==0"
 								@click="del(s.row)">删除
 							</el-button>
 						</template>
@@ -96,6 +99,53 @@
 				<!-- ------------- 分页 ------------- -->
 				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
 				</sa-item>
+				<el-dialog title="选择异常业务单" :visible.sync="form.visible" width="90%">
+					<div class="delect-search">
+						<sa-item type="text" name="业务单号" placeholder="业务单号" v-model="form.p.no"></sa-item>
+						<sa-item type="text" name="车牌号" placeholder="车牌号" v-model="form.p.carNo"></sa-item>
+						<el-button type="primary" @click="getErrorList">搜索</el-button>
+						<el-button type="info" @click="form.p.carNo='';form.p.no='';getErrorList()">重置</el-button>
+					</div>
+					<el-card class="box-card" style="margin-top: 20px;">
+						<div slot="header">
+							<span>未支付业务列表</span>
+						</div>
+						<el-table :data="form.dataList" ref="errorTable" style="height: 450px;">
+							<el-table-column type="index" label="序号"></el-table-column>
+							<sa-td name="业务单号" prop="no" width="160"></sa-td>
+							<sa-td name="客户名称" prop="customerName" width="190"></sa-td>
+							<sa-td name="货主" prop="owner" width="160"></sa-td>
+							<sa-td name="业务项" prop="goodsName" width="160"></sa-td>
+							<el-table-column label="车牌号" width="160">
+								<template slot-scope="s">
+									<label>{{s.row.carNoStr}}</label>
+								</template>
+							</el-table-column>
+							<sa-td name="作业时间" prop="operateTime" width="160"></sa-td>
+							<sa-td name="确认" prop="adminConfirmInput" type="enum" :jv="{1: '已确认', 0: '未确认'}"></sa-td>
+							<sa-td name="已支付(元)" prop="payMoney" width="140"></sa-td>
+							<sa-td name="业务费用(元)" prop="itemPrice" width="120"></sa-td>
+							<sa-td name="支付时间" prop="payTime" width="140"></sa-td>
+							<sa-td width="160" name="创建时间" prop="createTime"></sa-td>
+							</sa-td>
+							<sa-td name="创建人" prop="createBy" width="100"></sa-td>
+							<el-table-column label="操作" width="100px" fixed="right">
+								<template slot-scope="s">
+								<el-button class="c-btn" type="success" @click="doSelect(s.row)">选择</el-button>
+								</template>
+							</el-table-column>
+						</el-table>
+						<div class="block">
+							<el-pagination layout="prev, pager, next" @current-change="businessPageChange"
+								:page-size="form.p.pageSize" :total="form.dataCount" :current-page="form.p.pageNo">
+							</el-pagination>
+						</div>
+					</el-card>
+					<span slot="footer" class="dialog-footer">
+						<el-button @click="form.visible = false">取 消</el-button>
+						<el-button type="primary" @click="form.visible = false">确 定</el-button>
+					</span>
+				</el-dialog>
 			</div>
 		</div>
 		<script>
@@ -107,6 +157,19 @@
 				},
 				el: '.vue-box',
 				data: {
+					form: {
+						visible: false,
+						dataList: [],
+						dataCount: 0,
+						p: {
+							no: '',
+							carNo: '',
+							supplement: 0,
+							pageSize: 10,
+							pageNo: 1,
+							error: 1
+						}
+					},
 					value: '',
 					currentCustomerId: '1',
 					confirm: {
@@ -137,23 +200,29 @@
 					goodsList: [],
 				},
 				methods: {
+					selectFn() {
+						this.form.visible = true;
+						this.getErrorList()
+					},
+					businessPageChange(pageNo) {
+						this.form.p.pageNo = pageNo;
+						this.getErrorList();
+					},
+					getErrorList() {
+						sa.ajaxNoLoading('/TbBusiness/getOtherBusiness', sa.removeNull(this.form.p), function(res) {
+							this.form.dataList = res.data; // 数据
+							this.form.dataCount = res.dataCount; // 数据总数 
+						}.bind(this));
+					},
+					doSelect(data) {
+						this.form.visible=false;
+						sa.showIframe('完善补录单', 'tb-car-supplement-select.html?id=' + data.id, '1080px', '90%');
+					},
 					getGoodsList() {
 						sa.ajax('/TbGoods/getList', function(resp) {
 							this.goodsList = resp.data;
 						}.bind(this));
 					},
-					businessFn(data) {
-						sa.ajaxNoLoading('/TbBusinessCar/getOtherBusinessCarByBusinessId', {
-							businessId: data.id
-						}, function(resp) {
-							let list = resp.data;
-							let str = list.map(car => car.carNo).join('、');
-							let businessCarIds = list.map(car => car.id).join(',');
-							sa.showIframe('绑定车辆', 'tb-business-car-business.html?id=' + data.id +
-								'&businessCarId=' + data.businessCarId + '&carNo=' + str +
-								'&businessCarIds=' + businessCarIds, '90%', "90%");
-						}.bind(this))
-					},
 					getCurrendCustomer() {
 						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
 							this.currentCustomerId = resp.data;

+ 1 - 1
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -257,7 +257,7 @@ public class WxService {
                     tbBusiness.setPayTime(payTime).setPayType(3).setConfirmInput(1).setConfirmInputTime(payTime)
                             .setPayMoney(tbBusiness.getItemPrice())
                             .setPayNo(transactionId);
-                    tbBusiness.setPayStatus(3);
+                    tbBusiness.setPayStatus(TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode());
                     tbBusinessService.updateById(tbBusiness);
                     TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
                     List<TbBusinessCar> carList = tbBusinessCarService.findOtherBusinessCar(businessId);

+ 4 - 0
sp-server/src/main/java/com/pj/current/config/OAConfig.java

@@ -9,6 +9,10 @@ import org.springframework.stereotype.Component;
 @Component
 public class OAConfig {
     /**
+     * 请求地址
+     */
+    private String url;
+    /**
      * 来源编号
      */
     private String systemCode;

+ 0 - 1
sp-server/src/main/java/com/pj/current/satoken/StpUserUtil.java

@@ -54,7 +54,6 @@ public class StpUserUtil {
     }
 
     public static String getCustomerId(){
-        SpAdmin admin=getAdmin();
         return getAdmin().getCustomerId();
     }
 

+ 3 - 3
sp-server/src/main/java/com/pj/project/oa/bo/ResultBO.java → sp-server/src/main/java/com/pj/project/oa/bo/OAResultBO.java

@@ -7,15 +7,15 @@ import java.io.Serializable;
 
 @Data
 @Accessors(chain = true)
-public class ResultBO implements Serializable {
+public class OAResultBO implements Serializable {
     //200表示调用成功,500表示调用失败
     private int code;
     private Boolean success;
     private String message;
     private DataBO data;
+
     @Data
-    @Accessors(chain = true)
-    private static class  DataBO {
+    public static class  DataBO {
         //主文档的数据库主键值
         private String fdId;
     }

+ 9 - 6
sp-server/src/main/java/com/pj/project/oa/bo/ParamsBO.java

@@ -4,6 +4,8 @@ import lombok.Data;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 
 @Data
@@ -99,11 +101,11 @@ public class ParamsBO implements Serializable {
             /**
              * 业务费用
              */
-            private String operatingOutlay;
+            private BigDecimal operatingOutlay;
             /**
              * 支付时间
              */
-            private String paymentTime;
+            private Date paymentTime;
             /**
              * 货主
              */
@@ -115,7 +117,7 @@ public class ParamsBO implements Serializable {
             /**
              * 录入时间
              */
-            private String recordingTime;
+            private Date recordingTime;
             /**
              * 录入人
              */
@@ -128,6 +130,8 @@ public class ParamsBO implements Serializable {
              * 车辆信息
              */
             private VehicleInfoBO vehicleInfo;
+            //总计
+            private BigDecimal amount;
             /**
              * 业务项
              */
@@ -154,12 +158,11 @@ public class ParamsBO implements Serializable {
                 private List<String>entryTime;
                 //离场时间
                 private List<String>departureTime;
-                //总计
-                private String amount;
+
             }
 
             @Data
-            @Accessors
+            @Accessors(chain = true)
             public static class SpecificBusinessItemsBO{
                 //收费项
                 private List<String> chargingItem;

+ 16 - 0
sp-server/src/main/java/com/pj/project/tb_business/ErrorBusinessBO.java

@@ -0,0 +1,16 @@
+package com.pj.project.tb_business;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+@Data
+@Accessors(chain = true)
+public class ErrorBusinessBO extends OtherBusinessBO implements Serializable {
+    //补录原因
+    private String supplementReason;
+
+    //补录人
+    private String supplementBy;
+}

+ 13 - 2
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -244,11 +244,22 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
 
 
     private Integer payStep=2;
+    //是否补录单
     private Integer supplement=0;
+    //补录时间
     private Date supplementTime;
+    //补录人
     private String supplementBy;
-    //oa审核状态
-    private Integer oaResult;
+    //补录原因
+    private String supplementReason;
+    //是否已发送OA
+    private Integer sendOa=0;
+    //发送时间
+    private Date sendTime;
+    //流程发起人
+    private String sendBy;
+    //oa审核状态 “审批通过”和“审批驳回”
+    private String  oaResult;
     //oa审核意见
     private String oaContent;
     //oa主键

+ 13 - 7
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java

@@ -333,22 +333,28 @@ public class TbBusinessController {
         if (ids.isEmpty()){
             return AjaxJson.getError("请选择业务单");
         }
-
+        String reason=soMap.getString("reason");
+        if (StrUtil.isEmpty(reason)){
+            return AjaxJson.getError("请输入原因");
+        }
+        String currentCustomerId = StpUserUtil.getCustomerId();
+        tbBusinessService.selectErrorBusiness(ids,currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId()),StpUserUtil.getAdmin().getNickname(),reason);
         return AjaxJson.getSuccess();
     }
 
     /**
      * 添加异常单
-     * @param otherBusinessBO
+     * @param errorBusinessBO
      * @return
      */
     @RequestMapping(value = "addErrorBusiness")
     @SaCheckPermission(value = TbBusiness.PERMISSION_FLAX_BUSINESS_ADD)
-    public AjaxJson addErrorBusiness(OtherBusinessBO otherBusinessBO) {
-        List<TbItem> items = JSONUtil.toList(otherBusinessBO.getItemJson(), TbItem.class);
-        List<TbBusinessCar> cars = JSONUtil.toList(otherBusinessBO.getCarJson(), TbBusinessCar.class);
-        otherBusinessBO.setItems(items).setCars(cars);
-        tbBusinessService.addOtherBusiness(otherBusinessBO);
+    public AjaxJson addErrorBusiness(ErrorBusinessBO errorBusinessBO) {
+        List<TbItem> items = JSONUtil.toList(errorBusinessBO.getItemJson(), TbItem.class);
+        List<TbBusinessCar> cars = JSONUtil.toList(errorBusinessBO.getCarJson(), TbBusinessCar.class);
+        errorBusinessBO.setItems(items).setCars(cars);
+        errorBusinessBO.setSupplementBy(StpUserUtil.getAdmin().getNickname());
+        tbBusinessService.addErrorBusiness(errorBusinessBO);
         return AjaxJson.getSuccess();
     }
     // ------------------------- 前端接口 -------------------------

+ 261 - 10
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -12,19 +12,21 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.log.StaticLog;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.gson.JsonObject;
 import com.pj.api.wx.bo.MsgDataBO;
 import com.pj.api.wx.service.WxService;
 import com.pj.constants.UserTypeEnum;
-import com.pj.current.config.CarConfig;
-import com.pj.current.config.MyConfig;
-import com.pj.current.config.PartConfig;
-import com.pj.current.config.WxConfig;
+import com.pj.current.config.*;
 import com.pj.current.satoken.StpUserUtil;
+import com.pj.project.oa.bo.OAResultBO;
+import com.pj.project.oa.bo.ParamsBO;
 import com.pj.project.relation_business_car.RelationBusinessCar;
 import com.pj.project.relation_business_car.RelationBusinessCarService;
 import com.pj.project.relation_type_item.RelationTypeItemService;
@@ -62,6 +64,8 @@ import com.pj.project4sp.admin.SpAdmin;
 import com.pj.project4sp.admin.SpAdminService;
 import com.pj.project4sp.global.BusinessException;
 import com.pj.utils.so.SoMap;
+import com.sun.org.apache.regexp.internal.RE;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
@@ -78,6 +82,7 @@ import javax.annotation.Resource;
  */
 @Service
 @Transactional(rollbackFor = Exception.class)
+@Slf4j
 public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness> implements IService<TbBusiness> {
 
     /**
@@ -139,6 +144,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
     @Resource
     private RelationBusinessCarService relationBusinessCarService;
+    @Resource
+    private OAConfig oaConfig;
 
 
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
@@ -561,11 +568,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 if (sortGroup.getCompletePay().equals(1) && sortGroup.getStatus().equals(1)) {
                     List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sortGroup.getId());
                     for (TbBusinessSort sort : sorts) {
-                       long count= items.stream().filter(tbBusinessItem -> StrUtil.equals(sort.getTypeId(),tbBusinessItem.getItemTypeId()))
+                        long count = items.stream().filter(tbBusinessItem -> StrUtil.equals(sort.getTypeId(), tbBusinessItem.getItemTypeId()))
                                 .count();
-                       if (count==0){
-                           result.put("showPay", false);
-                       }
+                        if (count == 0) {
+                            result.put("showPay", false);
+                        }
                     }
                 }
             }
@@ -671,7 +678,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     }
 
 
-    public void addOtherBusiness(OtherBusinessBO otherBusinessBO) {
+    public TbBusiness addOtherBusiness(OtherBusinessBO otherBusinessBO) {
         List<TbItem> tbItems = otherBusinessBO.getItems();
         if (tbItems.isEmpty()) {
             throw new BusinessException("请选择明细");
@@ -772,7 +779,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         }
         itemList.forEach(tbBusinessItem -> tbBusinessItem.setBusinessId(tbBusiness.getId()));
         tbBusinessItemService.saveBatch(itemList);
-
+        return tbBusiness;
     }
 
 
@@ -996,4 +1003,248 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         ew.eq("date_format(pay_time,'%Y-%m-%d')", day).orderByDesc("id");
         return this.list(ew);
     }
+
+    /**
+     * 选择异常单发送
+     *
+     * @param ids     业务ID
+     * @param isAdmin 是否管理员
+     */
+    public void selectErrorBusiness(List<Long> ids, boolean isAdmin, String operator, String reason) {
+        List<TbBusiness> businessList = listByIds(ids);
+        businessList.forEach(tbBusiness -> {
+            tbBusiness.setSupplement(1).setSupplementBy(operator).setSupplementTime(new Date()).setSupplementReason(reason);
+            if (isAdmin) {
+                String businessId = tbBusiness.getId();
+                List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
+                List<TbBusinessCar> tbBusinessCars = tbBusinessCarService.findOtherBusinessCar(businessId);
+                ParamsBO paramsBO = buildParams(tbBusiness, items, tbBusinessCars, operator, reason);
+                String json = JSONUtil.toJsonStr(paramsBO);
+                log.info("构建流程表单数据:{}", json);
+                String resp = HttpUtil.createPost(oaConfig.getUrl())
+                        .timeout(2000).setReadTimeout(3000).body(json)
+                        .execute().body();
+                log.info("请求返回:{}", resp);
+                OAResultBO oaResultBO = JSONUtil.toBean(resp, OAResultBO.class);
+                if (oaResultBO.getSuccess() && oaResultBO.getCode() == 200) {
+                    tbBusiness.setSendOa(1).setSendTime(new Date()).setSendBy(operator)
+                            .setOaFdId(oaResultBO.getData().getFdId());
+                }
+            }
+        });
+        this.updateBatchById(businessList);
+    }
+
+    /**
+     * 构建表单数据
+     *
+     * @param tbBusiness
+     * @param items
+     * @param tbBusinessCars
+     * @param operator
+     * @param reason
+     * @return
+     */
+    private ParamsBO buildParams(TbBusiness tbBusiness, List<TbBusinessItem> items, List<TbBusinessCar> tbBusinessCars, String operator, String reason) {
+        ParamsBO paramsBO = new ParamsBO();
+        paramsBO.setRequestId(System.currentTimeMillis() + "")
+                .setBusinessSystemCode(oaConfig.getSystemCode());
+        ParamsBO.DataBO dataBO = new ParamsBO.DataBO();
+        String project = tbBusiness.getGoodsName();
+        JSONObject docCreator = new JSONObject();
+        docCreator.set("PersonNo", oaConfig.getPersonNo());
+        dataBO.setOperationalProject(project)
+                .setOperationalPerson(operator).setOperationalReason(reason)
+                .setDocSubject(project + "补单流程").setFdTemplateId(oaConfig.getTemplateId()).setDocCreator(JSONUtil.toJsonStr(docCreator));
+        //基础信息
+        ParamsBO.DataBO.FormValuesBO formValuesBO = buildFormValues(tbBusiness);
+        //车辆信息
+        ParamsBO.DataBO.FormValuesBO.VehicleInfoBO vehicleInfoBO = buildCarParams(tbBusinessCars);
+        formValuesBO.setVehicleInfo(vehicleInfoBO);
+        ParamsBO.DataBO.FormValuesBO.SpecificBusinessItemsBO specificBusinessItemsBO = buildItemPrams(items);
+        formValuesBO.setSpecificBusinessItems(specificBusinessItemsBO);
+        dataBO.setFormValues(formValuesBO);
+        return paramsBO;
+    }
+
+    /**
+     * 构建业务项
+     *
+     * @param items
+     * @return
+     */
+    private ParamsBO.DataBO.FormValuesBO.SpecificBusinessItemsBO buildItemPrams(List<TbBusinessItem> items) {
+        ParamsBO.DataBO.FormValuesBO.SpecificBusinessItemsBO specificBusinessItemsBO = new ParamsBO.DataBO.FormValuesBO.SpecificBusinessItemsBO();
+        List<String> itemTypeNameList = new ArrayList<>();
+        List<String> itemNameList = new ArrayList<>();
+        List<String> itemPriceList = new ArrayList<>();
+        List<String> unitList = new ArrayList<>();
+        List<String> numList = new ArrayList<>();
+        List<String> payStatusList = new ArrayList<>();
+        List<String> payTimeList = new ArrayList<>();
+        List<String> remarkList = new ArrayList<>();
+        items.forEach(item -> {
+            itemTypeNameList.add(item.getItemTypeName());
+            itemNameList.add(item.getItemName());
+            itemPriceList.add(item.getItemPrice().toString());
+            unitList.add(item.getUnit());
+            numList.add(item.getNum());
+            payStatusList.add(item.getPayStatus() == 1 ? "已支付" : "未支付");
+            payTimeList.add(DateUtil.format(item.getPayTime(), "yyyy-MM-dd HH:mm:ss"));
+            remarkList.add(StrUtil.isEmpty(item.getRemark()) ? "-" : item.getRemark());
+        });
+        specificBusinessItemsBO.setChargingItem(itemTypeNameList)
+                .setChargeDetail(itemNameList).setUnitPrice(itemPriceList).setChargingStandard(unitList)
+                .setQuantity(numList).setPayoutStatus(payStatusList).setPayTime(payTimeList).setNote(remarkList);
+        return specificBusinessItemsBO;
+    }
+
+    /**
+     * 构建基础信息
+     *
+     * @param tbBusiness
+     * @return
+     */
+    private ParamsBO.DataBO.FormValuesBO buildFormValues(TbBusiness tbBusiness) {
+        ParamsBO.DataBO.FormValuesBO formValuesBO = new ParamsBO.DataBO.FormValuesBO();
+        String project = tbBusiness.getGoodsName();
+        formValuesBO.setOperationalProject(project).setWorkingTime(tbBusiness.getOperateTime())
+                .setOperatingOutlay(tbBusiness.getItemPrice()).setAmount(tbBusiness.getItemPrice())
+                .setPaymentTime(tbBusiness.getPayTime()).setCargoOwner(tbBusiness.getOwner()).setOperationNo(tbBusiness.getNo())
+                .setRecordingTime(tbBusiness.getCreateTime()).setRecorder(tbBusiness.getCreateBy())
+                .setIsPay(TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode() == tbBusiness.getPayStatus() ? "已支付" : "未支付");
+        return formValuesBO;
+    }
+
+    /**
+     * 构建车辆表单
+     *
+     * @param tbBusinessCars
+     * @return
+     */
+    private ParamsBO.DataBO.FormValuesBO.VehicleInfoBO buildCarParams(List<TbBusinessCar> tbBusinessCars) {
+        ParamsBO.DataBO.FormValuesBO.VehicleInfoBO vehicleInfoBO = new ParamsBO.DataBO.FormValuesBO.VehicleInfoBO();
+        List<String> carNoList = new ArrayList<>();
+        List<String> typeList = new ArrayList<>();
+        List<String> loadList = new ArrayList<>();
+        List<String> unitsList = new ArrayList<>();
+        List<String> payStatusList = new ArrayList<>();
+        List<String> carStatusList = new ArrayList<>();
+        List<String> feeList = new ArrayList<>();
+        List<String> inList = new ArrayList<>();
+        List<String> outList = new ArrayList<>();
+        tbBusinessCars.forEach(tbBusinessCar -> {
+            carNoList.add(tbBusinessCar.getCarNo());
+            typeList.add(tbBusinessCar.getCarType());
+            loadList.add(tbBusinessCar.getNetWeight());
+            Double carSize = tbBusinessCar.getCarSize();
+            unitsList.add(carSize == null ? "-" : carSize.toString());
+            payStatusList.add(tbBusinessCar.getPayType());
+            carStatusList.add(tbBusinessCar.getIsLock() == 1 ? "正常" : "锁定");
+            feeList.add(tbBusinessCar.getMoney() == null ? "-" : tbBusinessCar.getMoney().toString());
+            inList.add(tbBusinessCar.getRealInTime() == null ? "-" : DateUtil.format(tbBusinessCar.getRealInTime(), "yyyy-MM-dd HH:mm:ss"));
+            outList.add(tbBusinessCar.getRealOutTime() == null ? "-" : DateUtil.format(tbBusinessCar.getRealOutTime(), "yyyy-MM-dd HH:mm:ss"));
+        });
+        vehicleInfoBO.setLicenseNo(carNoList).setType(typeList).setLoad(loadList).setSpecifications(unitsList)
+                .setPaymentStatus(payStatusList).setVehicleState(carStatusList).setParkingFee(feeList)
+                .setEntryTime(inList).setDepartureTime(outList);
+        return vehicleInfoBO;
+    }
+
+    //添加异常单
+    public void addErrorBusiness(ErrorBusinessBO errorBusinessBO) {
+        List<TbItem> tbItems = errorBusinessBO.getItems();
+        if (tbItems.isEmpty()) {
+            throw new BusinessException("请选择明细");
+        }
+        List<TbBusinessCar> cars = errorBusinessBO.getCars();
+        if (cars.isEmpty()) {
+            throw new BusinessException("作业车辆不能为空");
+        }
+        Date now = new Date();
+        TbGoods tbGoods = tbGoodsService.getById(errorBusinessBO.getGoodsId());
+        TbBusiness tbBusiness = new TbBusiness();
+        String customerId = errorBusinessBO.getCustomerId();
+        tbBusiness.setCreateBy(StpUserUtil.getAdmin().getName());
+        tbBusiness.setPayStep(tbGoods.getPayStep());
+        TbCostomer tbCostomer = tbCostomerService.getById(customerId);
+        if (tbCostomer != null) {
+            tbBusiness.setCustomerId(customerId).setCustomerName(tbCostomer.getName());
+        }
+        BigDecimal price = new BigDecimal("0");
+        List<TbBusinessItem> itemList = new ArrayList<>();
+        String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4);
+        int index = 1;
+        for (TbItem tbItem : tbItems) {
+            TbItem db = tbItemService.getById(tbItem.getId());
+            TbBusinessItem item = new TbBusinessItem();
+            int num = tbItem.getNum();
+            String typeId = tbItem.getTypeId();
+            TbItemType tbItemType = tbItemTypeService.getById(typeId);
+            BigDecimal itemTotalPrice = tbItem.getPrice().multiply(new BigDecimal(num));
+            item.setNo(no + "0" + index).setPayTypeName(db.getPayTypeName()).setPayType(db.getPayType())
+                    .setBusinessType(db.getBusinessType()).setTaxRate(NumberUtil.div(db.getTaxRate().doubleValue(), 100D, 2));
+            item.setItemCode(db.getItemCode()).setNum(num + "").setItemId(db.getId())
+                    .setItemName(db.getItemName()).setItemPrice(db.getPrice()).setRemark(tbItem.getRemark())
+                    .setItemTypeId(typeId).setItemTypeName(tbItemType.getName())
+                    .setUnit(db.getUnit()).setTotal(itemTotalPrice).setCreateTime(now);
+            price = price.add(itemTotalPrice);
+            itemList.add(item);
+            index++;
+        }
+        String declareNo = errorBusinessBO.getDeclareNo();
+        tbBusiness.setCardSize(errorBusinessBO.getCarSize()).setNetWeight(errorBusinessBO.getNetWeight())
+                .setOperator(errorBusinessBO.getOperator()).setOperateTime(errorBusinessBO.getOperateTime())
+                .setNo(no).setGoodsName(tbGoods.getName()).setGoodsId(errorBusinessBO.getGoodsId())
+                .setSupplementReason(errorBusinessBO.getSupplementReason()).setSupplementTime(new Date())
+                .setSupplementBy(errorBusinessBO.getSupplementBy())
+                .setPayStep(tbGoods.getPayStep()).setDeclareNo(declareNo).setCardNo(errorBusinessBO.getCardNo());
+        tbBusiness.setCreateTime(now).setCreateByCustomerId(StpUserUtil.getCustomerId())
+                .setItemPrice(price).setTotalMoney(price).setOwner(errorBusinessBO.getOwner());
+        tbBusiness.setChinaCarNo(errorBusinessBO.getChinaCarNo());
+        this.save(tbBusiness);
+        Integer chinaCarPay = tbGoods.getChinaCarPay();
+        Integer vietnamCarPay = tbGoods.getVietnamCarPay();
+        String carBuseinssNo = DateUtil.format(now, "yyyyMMddHHmm");
+        for (TbBusinessCar car : cars) {
+            String carNo = car.getCarNo().trim().toUpperCase();
+            String carType = car.getCarType();
+            if (StrUtil.isEmpty(carType)) {
+                throw new BusinessException(carNo + "类型不能为空");
+            }
+            //新增放行记录
+            TbBusinessCar db = new TbBusinessCar();
+            db.setCreateTime(now).setPay(0).setNo(carBuseinssNo + RandomUtil.randomNumbers(4));
+            db.setPayType(TbBusinessCar.PayTypeEnum.NO_PAY_TYPE.getType());
+            if ((TbItem.ItemTypeEnum.EMPTY_TYPE.getType().equals(carType) && chinaCarPay == 0)
+                    || (TbItem.ItemTypeEnum.WEIGHT_TYPE.getType().equals(carType) && vietnamCarPay == 0)) {
+                db.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
+            }
+            TbCar tbCar = tbCarService.findByCardNo(carNo);
+            if (tbCar != null) {
+                db.setCarCompany(tbCar.getCustomerName());
+                if (!TbCar.CarTypeEnum.BUSINESS_CAR.getType().equals(tbCar.getCarType())) {
+                    db.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
+                }
+            }
+            db.setCarNo(carNo).setIsLock(0);
+            db.setCarSize(car.getCarSize())
+                    .setTimeUpdate(now).setCarType(car.getCarType())
+                    .setNetWeight(car.getNetWeight())
+                    .setCustomerId(customerId)
+                    .setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
+            tbBusinessCarService.save(db);
+            RelationBusinessCar relationBusinessCar = new RelationBusinessCar();
+            relationBusinessCar.setBusinessId(tbBusiness.getId()).setBusinessCarId(db.getId());
+            relationBusinessCarService.save(relationBusinessCar);
+        }
+        if (StrUtil.isNotEmpty(declareNo)) {
+            TbDeclare declare = tbDeclareService.findByDeclareNo(declareNo);
+            declare.setBusinessId(tbBusiness.getId());
+            tbDeclareService.updateById(declare);
+        }
+        itemList.forEach(tbBusinessItem -> tbBusinessItem.setBusinessId(tbBusiness.getId()));
+        tbBusinessItemService.saveBatch(itemList);
+
+    }
 }

+ 1 - 0
sp-server/src/main/resources/application-dev.yml

@@ -100,6 +100,7 @@ pushfee-config:
     #默认时间间隔为一小时
     time-span: 3600000
 oa:
+    url:
     system-code: 0101 #来源编码
     template-id: 169b437e7e1cd1bd7b6367c4563b24ef #模板id
     person-no: 00013 #流程发起人