tb-car-disincle-add.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>入境登记-添加/修改</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. <script src="../../static/kj/upload-util.js"></script>
  18. <style type="text/css">
  19. .c-panel .el-form .c-label {
  20. width: 7em !important;
  21. }
  22. .c-panel .el-form .c-panel .el-form {
  23. width: 180px;
  24. }
  25. .item-num .el-input__inner {
  26. width: 130px;
  27. }
  28. .xj {
  29. display: inline;
  30. color: red;
  31. margin-left: 9px;
  32. font-weight: bold;
  33. }
  34. .hj {
  35. color: red;
  36. margin-left: 9px;
  37. font-weight: bold;
  38. }
  39. .china-car-size .el-input__inner {
  40. width: 130px;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <div class="vue-box sbot" style="display: none;" :style="'display: block;'">
  46. <!-- ------- 内容部分 ------- -->
  47. <div class="s-body">
  48. <div class="c-panel">
  49. <div class="c-title">数据添加</div>
  50. <el-form v-if="m" label-position="left">
  51. <el-row>
  52. <el-card class="box-card">
  53. <div slot="header" class="clearfix">
  54. <span>基本资料</span>
  55. </div>
  56. <div>
  57. <el-row>
  58. <el-col span=8>
  59. <div class="c-item">
  60. <label class="c-label"><span style="color: red;">*</span>业务项目:</label>
  61. <el-select v-model="m.goodsId" placeholder="请选择" @change="goodsChange">
  62. <el-option v-for="item in goodsList" :key="item.id"
  63. :label="item.name" :value="item.id">
  64. </el-option>
  65. </el-select>
  66. </div>
  67. <div class="c-item" v-if="goods.needOwner==1">
  68. <label class="c-label">
  69. <span style="color: red;">*</span>
  70. 货物名称:</label>
  71. <el-input v-model="m.businessGoodsName" placeholder="填写货物" clearable>
  72. </el-input>
  73. </div>
  74. </el-col>
  75. <el-col span=8>
  76. <div class="c-item" v-if="goods.needCustomer">
  77. <label class="c-label"><span style="color: red;">*</span>客户:</label>
  78. <el-select
  79. v-model="m.customerId" placeholder="请选择">
  80. <el-option v-for="item in customerList" :key="item.id"
  81. :label="item.name" :value="item.id">
  82. </el-option>
  83. </el-select>
  84. </div>
  85. <div class="c-item" v-if="goods.needOperateTime==1">
  86. <label class="c-label"><span style="color: red;">*</span>数量(件):</label>
  87. <el-input-number class="item-num" v-model="m.businessGoodsNum"
  88. :min="1" :max="99999" size="mini">
  89. </el-input-number>
  90. </div>
  91. </el-col>
  92. <el-col span=8>
  93. <div class="c-item">
  94. <label class="c-label">作业人员:</label>
  95. <el-input v-model="m.operator" placeholder="作业人员" clearable>
  96. </el-input>
  97. </div>
  98. </el-col>
  99. </el-row>
  100. </div>
  101. </el-card>
  102. </el-row>
  103. <el-row>
  104. <el-card class="box-card">
  105. <div slot="header" class="clearfix">
  106. <span>车辆</span>
  107. <el-button style="float: right;" icon="el-icon-plus" type="primary"
  108. @click="showAddModal" v-if="goods.mulCar==1||car.list.length==0">添加
  109. </el-button>
  110. </div>
  111. <el-table :data="car.list">
  112. <el-table-column type="index" width="50" label="序号">
  113. </el-table-column>
  114. <el-table-column prop="carNo" label="车牌号">
  115. </el-table-column>
  116. <el-table-column prop="carSize" label="规格(米)">
  117. </el-table-column>
  118. <el-table-column prop="carType" label="类型">
  119. </el-table-column>
  120. <el-table-column prop="netWeight" label="载重(kg)">
  121. </el-table-column>
  122. <el-table-column label="操作">
  123. <template slot-scope="s">
  124. <el-button class="c-btn" type="info" @click="editFn(s.row)">修改</el-button>
  125. <el-button class="c-btn" type="danger" @click="deleteFn(s.row)">删除
  126. </el-button>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. </el-card>
  131. </el-row>
  132. <el-row>
  133. <el-card class="box-card">
  134. <div slot="header" class="clearfix">
  135. <span>收费项</span>
  136. </div>
  137. <div>
  138. <el-form-item v-for="(type,index) in itemTypeList">
  139. <el-row justify="center">
  140. <el-col span="16">
  141. <label style="color: red;"
  142. v-if="type.need==1">*</label><label>{{type.name}}:</label>
  143. <el-select v-model="type.itemId" style="width: 120px;"
  144. @change="itemChange(type)" placeholder="请选择">
  145. <el-option v-for="item in type.items" :key="item.id"
  146. :label="item.itemName" :value="item.id">
  147. </el-option>
  148. </el-select>
  149. </el-col>
  150. <el-col span="8">
  151. <el-input-number style="margin-left: 60px;" class="item-num"
  152. v-model="type.num" :min="1" :max="10" size="mini"
  153. ></el-input-number>
  154. <div class="xj" v-if="type.itemId">
  155. {{type.price * type.num}}元
  156. <label @click="cleanItem(type)"
  157. style="margin-left: 5px;cursor: pointer">(<i
  158. class="el-icon-delete"></i>)</label>
  159. </div>
  160. </el-col>
  161. </el-row>
  162. <el-divider></el-divider>
  163. </el-form-item>
  164. <div class="hj" v-if="totalPrice>0">
  165. 合计费用:{{totalPrice}}<label>元</label>
  166. </div>
  167. </div>
  168. </el-card>
  169. </el-row>
  170. </el-form>
  171. </div>
  172. </div>
  173. <!-- ------- 底部按钮 ------- -->
  174. <div class="s-foot">
  175. <el-button type="primary" @click="ok()">确定</el-button>
  176. <el-button @click="closeFn()">取消</el-button>
  177. </div>
  178. <el-dialog title="车辆录入" :visible.sync="car.visible" width="400">
  179. <span>
  180. <el-form label-position="left">
  181. <div class="c-item">
  182. <label class="c-label"><span style="color: red;">*</span>车牌号:</label>
  183. <el-autocomplete v-model="car.form.carNo" placeholder="请输入车牌号" value-key='carNo'
  184. :fetch-suggestions="queryCarAsync">
  185. </el-autocomplete>
  186. </div>
  187. <div class="c-item">
  188. <label class="c-label">车辆类型:</label>
  189. <el-select v-model="car.form.carType" placeholder="请选择" @change="carTypeChange">
  190. <el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
  191. </el-option>
  192. </el-select>
  193. </div>
  194. <div class="c-item">
  195. <label class="c-label">
  196. <span style="color: red;" v-if="goods.needCarSize==1">*</span>
  197. 规格(米):</label>
  198. <el-input-number class="item-num" v-model="car.form.carSize" :min="1" :max="50">
  199. </el-input-number>
  200. </div>
  201. <div class="c-item" v-if="car.form.carType.indexOf('空')==-1">
  202. <label class="c-label">
  203. <span style="color: red;" v-if="goods.needCarSize==1">*</span>
  204. 载重(kg):</label>
  205. <el-input-number class="item-num" v-model="car.form.netWeight" :min="1" :max="999999">
  206. </el-input-number>
  207. </div>
  208. </el-form>
  209. </span>
  210. <span slot="footer" class="dialog-footer">
  211. <el-button @click="car.visible = false">取 消</el-button>
  212. <el-button type="primary" @click="confirmAdd">确 定</el-button>
  213. </span>
  214. </el-dialog>
  215. <el-dialog title="申报单" :visible.sync="declare.visible" width="90%">
  216. <div class="delect-search">
  217. 申报人:
  218. <el-input style="width: 140px;" v-model="declare.p.declarePeople" placeholder="申报人">
  219. </el-input>
  220. <el-button type="primary" @click="getDeclareList">搜索</el-button>
  221. <el-button type="info" @click="resetDclare">重置</el-button>
  222. </div>
  223. <el-card class="box-card" style="margin-top: 20px;">
  224. <div slot="header">
  225. <span>列表</span>
  226. </div>
  227. <el-table :data="declare.list" ref="declareTable">
  228. <el-table-column type="selection">
  229. </el-table-column>
  230. <el-table-column prop="declarePeople" label="申报人">
  231. </el-table-column>
  232. <el-table-column prop="customerName" label="申报公司" width=200>
  233. </el-table-column>
  234. <el-table-column prop="sendUnit" label="货主" width=200>
  235. </el-table-column>
  236. <el-table-column prop="createTime" width="140" label="申报时间">
  237. </el-table-column>
  238. <el-table-column prop="declareNo" width="180" label="申报单号">
  239. </el-table-column>
  240. <el-table-column prop="goodsName" label="产品学名">
  241. </el-table-column>
  242. <el-table-column prop="carNo" label="越南车牌">
  243. </el-table-column>
  244. <el-table-column prop="grossWeight" label="毛重(kg)">
  245. </el-table-column>
  246. </el-table>
  247. <div class="block">
  248. <el-pagination layout="prev, pager, next" @current-change="currentPageChange"
  249. :page-size="declare.p.pageSize" :total="declare.p.dataCount"
  250. :current-page="declare.p.pageNo">
  251. </el-pagination>
  252. </div>
  253. </el-card>
  254. <span slot="footer" class="dialog-footer">
  255. <el-button @click="declare.visible = false">取 消</el-button>
  256. <el-button type="primary" @click="confirmSelectDeclare">确 定</el-button>
  257. </span>
  258. </el-dialog>
  259. </div>
  260. <script>
  261. var app = new Vue({
  262. components: {
  263. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  264. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')
  265. },
  266. el: '.vue-box',
  267. data: {
  268. m: {
  269. id: '', // 主键
  270. customerId: '', // 客户id
  271. customerName: '', // 客户名称
  272. operateTime: '',
  273. no: '', // 编号
  274. goodsId: '',
  275. goodsName: '', // 商品
  276. businessGoodsNum:1,
  277. businessGoodsName:''
  278. }, // 实体对象
  279. customerList: [],
  280. carList: [],
  281. currentCustomerId: 1,
  282. itemTypeList: [],
  283. filterTypeList: [],
  284. goodsList: [],
  285. tableData: [],
  286. car: {
  287. visible: false,
  288. list: [],
  289. form: {
  290. carNo: '',
  291. carType: '',
  292. netWeight: '',
  293. carSize: ''
  294. }
  295. },
  296. declare: {
  297. visible: false,
  298. list: [],
  299. p: {
  300. pageNo: 1,
  301. pageSize: 8,
  302. dataCount: 0,
  303. declarePeople: '',
  304. production: '',
  305. declareNo: '1'
  306. }
  307. },
  308. goods: {
  309. id: '',
  310. name: '',
  311. needWeight: 1,
  312. needCarSize: 1,
  313. needDeclare: 1,
  314. needOperateTime: 1,
  315. chinaCarPay: 1,
  316. vietnamCarPay: 1,
  317. mulCar: 0,
  318. },
  319. carTypeList: []
  320. },
  321. computed: {
  322. totalPrice() {
  323. let itemList = this.itemTypeList.filter(obj => obj.itemId);
  324. let price = 0;
  325. for (let i in itemList) {
  326. let type = itemList[i];
  327. let num = type.num;
  328. let items = type.items;
  329. for (let j in items) {
  330. let item = items[j];
  331. if (item.id == type.itemId) {
  332. price += num * item.price;
  333. break;
  334. }
  335. }
  336. }
  337. return price;
  338. }
  339. },
  340. methods: {
  341. resetDclare() {
  342. this.declare.p.pageNo = 1;
  343. this.declare.p.pageSize = 8;
  344. this.declare.p.production = '';
  345. this.declare.p.declarePeople = '';
  346. this.getDeclareList();
  347. },
  348. handlerDeclare() {
  349. this.declare.visible = true;
  350. this.getDeclareList();
  351. },
  352. currentPageChange(page) {
  353. this.declare.p.pageNo = page;
  354. this.getDeclareList();
  355. },
  356. getDeclareList() {
  357. let declareNo = this.m.declareNo;
  358. if (declareNo) {
  359. this.declare.p.declareNo = declareNo;
  360. }
  361. sa.ajax('/TbDeclare/getNotBindList', sa.removeNull(this.declare.p), function(resp) {
  362. let list = resp.data;
  363. this.declare.list = list;
  364. this.declare.p.pageNo = resp.pageNo;
  365. this.declare.p.dataCount = resp.dataCount;
  366. list.forEach(row => {
  367. if (row.declareNo == this.m.declareNo && this.m.declareNo) {
  368. this.$nextTick(() => {
  369. this.$refs['declareTable'].toggleRowSelection(row, true)
  370. })
  371. }
  372. })
  373. }.bind(this))
  374. },
  375. confirmSelectDeclare() {
  376. // 获取选中元素的id列表
  377. let selection = this.$refs['declareTable'].selection;
  378. let declareNo = sa.getArrayField(selection, 'declareNo');
  379. if (selection.length == 0) {
  380. return sa.msg('请至少选择一条数据')
  381. }
  382. if (selection.length > 1) {
  383. return sa.msg('只能选择一条数据')
  384. }
  385. let declare = selection[0];
  386. let oldNo = this.m.declareNo;
  387. if (oldNo && oldNo !== declare.declareNo) {
  388. this.car.list = [];
  389. }
  390. if (oldNo !== declare.declareNo) {
  391. this.m.declareNo = declare.declareNo;
  392. this.m.customerId = declare.customerId;
  393. this.m.customerName = declare.customerName;
  394. this.m.owner = declare.sendUnit;
  395. let carNo = declare.carNo;
  396. let grossWeight = declare.grossWeight;
  397. let carList = this.car.list;
  398. let exit = carList.filter(obj => obj.carNo == carNo).pop();
  399. if (!exit) {
  400. let car = {
  401. carNo: carNo,
  402. netWeight: grossWeight,
  403. carType: '载重'
  404. }
  405. this.car.list.push(car)
  406. }
  407. this.m.cardNo = declare.carNo;
  408. this.m.chinaCarNo = declare.chinaCarNo;
  409. this.m.netWeight = declare.grossWeight;
  410. let chinaCarNo = declare.chinaCarNo;
  411. if (chinaCarNo) {
  412. let list = [];
  413. chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
  414. let exit = carList.filter(obj => obj.carNo == carNo).pop();
  415. if (!exit) {
  416. let car = {
  417. carNo: carNo,
  418. carType: '空车'
  419. }
  420. this.car.list.push(car)
  421. }
  422. })
  423. }
  424. this.filterItems();
  425. }
  426. this.declare.visible = false;
  427. },
  428. cleanItem(type) {
  429. type.itemId = '';
  430. type.itemName = '';
  431. type.price = '';
  432. },
  433. itemChange(type) {
  434. if(this.validBefore()){
  435. let itemId = type.itemId;
  436. let item = type.items.filter(obj => obj.id == itemId).pop();
  437. if (item) {
  438. type.inc = item.inc;
  439. type.price = item.price;
  440. type.needRemark = item.needRemark
  441. }
  442. }
  443. },
  444. confirmAdd() {
  445. let list = this.car.list;
  446. let carNo = this.car.form.carNo;
  447. let netWeight = this.car.form.netWeight;
  448. let goods = this.goods;
  449. let form = this.car.form;
  450. let carType = form.carType;
  451. if (!carNo) {
  452. sa.error('请录入车牌号')
  453. return false;
  454. }
  455. if (!form.carSize && goods.needCarSize == 1) {
  456. sa.error('请填入车辆规格')
  457. return false;
  458. }
  459. if (carType.indexOf('空') !== -1) {
  460. netWeight = 0;
  461. }
  462. let index = list.map(obj => obj.carNo).indexOf(carNo);
  463. if (index > -1) {
  464. list.splice(index, 1);
  465. }
  466. let carSize = form.carSize;
  467. let car = {
  468. id: form.id,
  469. carNo: form.carNo.toUpperCase(),
  470. carType: carType,
  471. carSize: carSize,
  472. netWeight: netWeight
  473. }
  474. this.car.list.push(car);
  475. this.car.visible = false;
  476. this.filterItems();
  477. },
  478. filterItems() {
  479. let carList = this.car.list;
  480. let filterTypeList = JSON.parse(JSON.stringify(this.filterTypeList));
  481. if (carList.length == 0) {
  482. this.itemTypeList = filterTypeList;
  483. return;
  484. }
  485. let car = this.car.form;
  486. if (car == null) {
  487. let checkList = carList.filter(obj => obj.carType.indexOf('空') === -1);
  488. if (checkList.length > 0) {
  489. car = checkList[0];
  490. }
  491. }
  492. let carSize = car.carSize;
  493. let carType = car.carType;
  494. if (carType.indexOf('空') !== -1 && carList.length > 1) {
  495. return;
  496. }
  497. let netWeight = car.netWeight;
  498. let tempList = [];
  499. for (let i in filterTypeList) {
  500. let type = filterTypeList[i];
  501. let items = type.items;
  502. if (carType) {
  503. items = items.filter(item => item.itemType && item.itemType.indexOf(carType) !== -1);
  504. }
  505. if (carSize && carSize > 1) {
  506. items = items.filter(item => item.minLength <= carSize && item.carLength >= carSize);
  507. }
  508. if (netWeight && netWeight > 1 && carType.indexOf('空') == -1) {
  509. items = items.filter(item => item.minWeight <= netWeight && item.maxWeight >= netWeight);
  510. }
  511. let itemIds = items.map(item => item.id);
  512. if (itemIds.indexOf(type.itemId) == -1) {
  513. this.cleanItem(type);
  514. }
  515. type.items = items;
  516. tempList.push(type);
  517. }
  518. this.itemTypeList = tempList;
  519. },
  520. showAddModal() {
  521. this.car.visible = true;
  522. this.car.form.carNo = '';
  523. this.car.form.carSize = '';
  524. this.car.form.netWeight = '';
  525. },
  526. editFn(data) {
  527. Object.assign(this.car, {
  528. visible: true,
  529. form: JSON.parse(JSON.stringify(data))
  530. })
  531. },
  532. deleteFn(data) {
  533. this.car.list.splice(this.car.list.indexOf(data), 1);
  534. this.filterItems();
  535. },
  536. getGoods() {
  537. sa.ajax('/TbGoods/getList', {
  538. pageNo: 1,
  539. pageSize: 10
  540. }, function(resp) {
  541. let list = resp.data;
  542. if (list.length >= 1) {
  543. let initGoods = list[0];
  544. this.goods = initGoods
  545. this.m.goodsId = initGoods.id;
  546. this.m.goodsName = initGoods.name;
  547. this.getTypeByGoodsId();
  548. }
  549. this.goodsList = list;
  550. }.bind(this))
  551. },
  552. goodsChange(v) {
  553. let goodsList = this.goodsList;
  554. let goods = goodsList.filter(goods => goods.id == v).pop();
  555. this.goods = goods;
  556. this.m.goodsName = goods.name;
  557. this.getTypeByGoodsId();
  558. },
  559. getTypeByGoodsId() {
  560. sa.ajax('/TbItemType/getTypeByGoodsId', {
  561. goodsId: this.m.goodsId
  562. }, function(resp) {
  563. let list = resp.data;
  564. this.itemTypeList = list;
  565. this.filterTypeList = JSON.parse(JSON.stringify(this.itemTypeList));
  566. this.filterItems();
  567. }.bind(this))
  568. },
  569. getItemType() {
  570. sa.ajax('/TbItem/getItemType', function(resp) {
  571. let list = resp.data;
  572. if (list.length > 0) {
  573. this.car.form.carType = list[0].name;
  574. }
  575. this.carTypeList = list;
  576. }.bind(this))
  577. },
  578. carTypeChange(v) {
  579. },
  580. getCustomerList() {
  581. sa.ajax('/TbCostomer/getList', {
  582. pageNo: 1,
  583. pageSize: 30,
  584. sortType: 20,
  585. judgeStatus: 2
  586. }, function(res) {
  587. let list = res.data;
  588. this.customerList = list;
  589. }.bind(this));
  590. },
  591. queryCarAsync(queryStr, cb) {
  592. sa.ajaxNoLoading('/TbBusinessCar/searchByNo', {
  593. carNo: queryStr
  594. }, function(resp) {
  595. cb(resp.data)
  596. }.bind(this))
  597. },
  598. closeFn() {
  599. parent.app.f5();
  600. sa.closeCurrIframe();
  601. },
  602. validBefore() {
  603. let goods = this.goods;
  604. let needCustomer = goods.needCustomer;
  605. let m = this.m;
  606. if (needCustomer == 1 && !m.customerId) {
  607. sa.error('请选择客户');
  608. return false;
  609. }
  610. if (goods.needOperateTime == 1 &&(!m.businessGoodsNum||m.businessGoodsNum<=0) ) {
  611. sa.error('请输入件数');
  612. return false;
  613. }
  614. if (!m.businessGoodsName && goods.needOwner == 1) {
  615. sa.error('请填写货物');
  616. return false;
  617. }
  618. if (this.car.list.length == 0) {
  619. sa.error('请录入车辆');
  620. return false;
  621. }
  622. let needCarSize = goods.needCarSize;
  623. let carList = this.car.list;
  624. for (let i in carList) {
  625. let car = carList[i];
  626. if (needCarSize == 1 && !car.carSize) {
  627. sa.error('请补充' + car.carNo + '规格');
  628. return;
  629. }
  630. }
  631. return true;
  632. },
  633. // 提交数据
  634. ok: function() {
  635. let goods = this.goods;
  636. let needCustomer = goods.needCustomer;
  637. let m = this.m;
  638. if (needCustomer == 1 && !m.customerId) {
  639. sa.error('请选择客户');
  640. return false;
  641. }
  642. if (!m.businessGoodsName && goods.needOwner == 1) {
  643. sa.error('请填写货物');
  644. return false;
  645. }
  646. if (goods.needOperateTime == 1 && (!m.businessGoodsNum||m.businessGoodsNum<=0)) {
  647. sa.error('请填写货物件数');
  648. return false;
  649. }
  650. if (this.car.list.length == 0) {
  651. sa.error('请录入车辆');
  652. return false;
  653. }
  654. let needCarSize = goods.needCarSize;
  655. let carList = this.car.list;
  656. for (let i in carList) {
  657. let car = carList[i];
  658. if (needCarSize == 1 && !car.carSize) {
  659. sa.error('请补充' + car.carNo + '规格');
  660. return;
  661. }
  662. }
  663. let typeList = this.itemTypeList;
  664. let selectList = [];
  665. for (let i in typeList) {
  666. let type = typeList[i];
  667. if (type.need == 1 && !type.itemId) {
  668. sa.error('【' + type.name + '】必选');
  669. return false;
  670. }
  671. if (type.needRemark == 1 && !type.remark) {
  672. sa.error('请输入【' + type.name + '】的备注');
  673. return false;
  674. }
  675. if (type.itemId) {
  676. let obj = {
  677. typeId: type.id,
  678. typeName: type.name,
  679. id: type.itemId,
  680. num: type.num,
  681. price: type.price,
  682. remark: type.remark
  683. }
  684. selectList.push(obj);
  685. }
  686. }
  687. if (needCustomer != 1) {
  688. m.customerId = '';
  689. }
  690. m.itemJson = JSON.stringify(selectList);
  691. m.carJson = JSON.stringify(carList);
  692. let chinaCarNo = carList
  693. .filter(car => sa.isCarNo(car.carNo.toUpperCase()))
  694. .map(car => car.carNo.toUpperCase())
  695. .join("、");
  696. let yueCarNo = carList
  697. .filter(car => !sa.isCarNo(car.carNo.toUpperCase()))
  698. .map(car => car.carNo.toUpperCase())
  699. .join("、");
  700. m.cardNo = yueCarNo;
  701. m.chinaCarNo = chinaCarNo;
  702. sa.ajax('/TbBusiness/addOtherBusiness', sa.removeNull(m), function(res) {
  703. sa.alert('增加成功', this.clean);
  704. }.bind(this));
  705. },
  706. // 添加/修改 完成后的动作
  707. clean: function() {
  708. parent.app.f5(); // 刷新父页面列表
  709. sa.closeCurrIframe(); // 关闭本页
  710. },
  711. getCurrentCustomer() {
  712. sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
  713. let id = resp.data;
  714. this.currentCustomerId = id;
  715. }.bind(this));
  716. },
  717. },
  718. mounted: function() {
  719. this.getCurrentCustomer();
  720. this.getGoods();
  721. this.getItemType();
  722. this.getCustomerList();
  723. }
  724. })
  725. </script>
  726. </body>
  727. </html>