tb-business-edit.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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: 100px;
  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. </style>
  40. </head>
  41. <body>
  42. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  43. <!-- ------- 内容部分 ------- -->
  44. <div class="s-body">
  45. <div class="c-panel">
  46. <div class="c-title" v-if="id == 0">数据添加</div>
  47. <div class="c-title" v-else>数据修改</div>
  48. <el-form v-if="m" label-position="left">
  49. <el-row>
  50. <el-col span=10>
  51. <el-card class="box-card">
  52. <div slot="header" class="clearfix">
  53. <span>基本资料</span>
  54. </div>
  55. <div>
  56. <div class="c-item" v-show="currentCustomerId==1">
  57. <label class="c-label"><span style="color: red;">*</span>选择客户:</label>
  58. <el-select v-model="m.customerId" placeholder="请选择" filterable>
  59. <el-option v-for="item in customerList" :key="item.id"
  60. :label="item.name" :value="item.id">
  61. </el-option>
  62. </el-select>
  63. </div>
  64. <div class="c-item">
  65. <label class="c-label"><span style="color: red;">*</span>运输货品:</label>
  66. <el-select v-model="m.goodsName" placeholder="请选择" @change="goodsChange">
  67. <el-option v-for="item in goodsList" :key="item.id" :label="item.name"
  68. :value="item.name">
  69. </el-option>
  70. </el-select>
  71. </div>
  72. <sa-item type="num" name="载重(吨)" placeholder="请输入车辆载重" v-model="m.netWeight" br>
  73. </sa-item>
  74. <sa-item type="text" name="境外车牌号" placeholder="请输入境外车牌号" v-model="m.cardNo" br>
  75. </sa-item>
  76. </sa-item>
  77. <div class="c-item">
  78. <label class="c-label"><span style="color: red;">*</span>境外车规格:</label>
  79. <el-autocomplete v-model="m.cardSize" placeholder="请输入车规格"
  80. @select="handleSelectCarSize" value-key='unit'
  81. :fetch-suggestions="queryCaSizerAsync">
  82. </el-autocomplete>
  83. </div>
  84. <div class="c-item">
  85. <label class="c-label">中国车:</label>
  86. <el-input v-model="china.list.map(obj=>obj.carNo).join('、')"
  87. placeholder="添加中国车" readonly>
  88. <div slot="suffix" style="cursor: pointer;color: blue;" @click="addCar">
  89. <i class="el-icon-folder-add"></i>
  90. </div>
  91. </el-input>
  92. </el-autocomplete>
  93. </div>
  94. </div>
  95. </el-card>
  96. </el-col>
  97. <el-col span=14>
  98. <el-card class="box-card">
  99. <div slot="header" class="clearfix">
  100. <span>业务项</span>
  101. </div>
  102. <div>
  103. <el-form-item v-for="(type,index) in filterTypeList" style="display: flex;"
  104. v-if="filterTypeList.length>0">
  105. <label slot="label"><label v-if="needTypeId.indexOf(type.id)!==-1"
  106. style="color: red;">*</label>{{type.name}}</label>
  107. <el-select v-model="type.itemId" style="width: 120px;" @change="itemChange"
  108. placeholder="请选择">
  109. <el-option v-for="item in type.items" v-if="m.netWeight >= item.minWeight && m.netWeight < item.maxWeight
  110. &&m.cardSize<=item.carLength&&m.cardSize>=item.minLength" :key="item.id" :label="item.itemName"
  111. :value="item.id">
  112. </el-option>
  113. </el-select>
  114. <el-input-number style="margin-left: 60px;" class="item-num"
  115. v-model="type.num" :min="1" :max="10" size="mini"
  116. :disabled="type.inc==0"></el-input-number>
  117. <div class="xj" v-if="type.itemId">
  118. {{type.items.filter(obj=>obj.id==type.itemId)[0].price*type.num}}元
  119. <label @click="cleanItem(type)"
  120. style="margin-left: 5px;cursor: pointer">(<i
  121. class="el-icon-delete"></i>)</label>
  122. </div>
  123. <el-button v-if="type.code=='p09'&&type.itemId"
  124. @click="addPeopleFn(type.itemId,type.num,true)">操作</el-button>
  125. </el-form-item>
  126. <div v-if="filterTypeList.length==0" style="height: 400px;padding: 30px;">
  127. 请先选择运输货品
  128. </div>
  129. <div class="hj" v-if="totalPrice>0">
  130. 合计费用:{{totalPrice}}<label>元</label>
  131. </div>
  132. </div>
  133. </el-card>
  134. </el-col>
  135. </el-row>
  136. </el-form>
  137. </div>
  138. </div>
  139. <!-- ------- 底部按钮 ------- -->
  140. <div class="s-foot">
  141. <el-button type="primary" @click="ok()">确定</el-button>
  142. <el-button @click="closeFn()">取消</el-button>
  143. </div>
  144. <el-dialog title="人员核酸检测" :visible.sync="modal.visible" width="80%">
  145. <el-card class="box-card">
  146. <div slot="header">
  147. <span>列表</span>
  148. <el-button style="float: right;" icon="el-icon-plus" type="primary" @click="showAddModal"
  149. v-if="modal.list.length<modal.num">添加
  150. </el-button>
  151. </div>
  152. <el-table :data="modal.list">
  153. <el-table-column prop="name" label="姓名">
  154. </el-table-column>
  155. <el-table-column prop="phone" label="联系号码">
  156. </el-table-column>
  157. <!-- <sa-td type="img-list" name="核酸报告" prop="ticket"></sa-td> -->
  158. <el-table-column label="操作">
  159. <template slot-scope="s">
  160. <!-- <el-button class="c-btn" type="primary" @click="uploadFn(s.row)">上传</el-button> -->
  161. <el-button class="c-btn" type="info" @click="editFn(s.row)">修改</el-button>
  162. <el-button class="c-btn" type="danger" @click="deleteFn(s.row)">删除</el-button>
  163. </template>
  164. </el-table-column>
  165. </el-table>
  166. </el-card>
  167. <span slot="footer" class="dialog-footer">
  168. <el-button @click="cancelAdd">取 消</el-button>
  169. <el-button type="primary" @click="modal.visible=false">确 定</el-button>
  170. </span>
  171. </el-dialog>
  172. <el-dialog title="人员核酸检测" :visible.sync="addModal.visible" width="400">
  173. <span>
  174. <el-form label-position="left">
  175. <sa-item type="text" name="姓名" placeholder="姓名" v-model="addModal.form.name" br></sa-item>
  176. <sa-item type="text" name="联系号码" placeholder="联系号码" v-model="addModal.form.phone" br></sa-item>
  177. </el-form>
  178. </span>
  179. <span slot="footer" class="dialog-footer">
  180. <el-button @click="addModal.visible = false">取 消</el-button>
  181. <el-button type="primary" @click="confirmAdd">确 定</el-button>
  182. </span>
  183. </el-dialog>
  184. <el-dialog title="中国车" :visible.sync="china.visible" width="80%">
  185. <el-card class="box-card">
  186. <div slot="header">
  187. <span>列表</span>
  188. <el-button style="float: right;" icon="el-icon-plus" type="primary" @click="addChinaCarFn">添加
  189. </el-button>
  190. </div>
  191. <el-table :data="china.list">
  192. <el-table-column prop="carNo" label="车牌号">
  193. </el-table-column>
  194. <el-table-column prop="driverName" label="联系人">
  195. </el-table-column>
  196. <el-table-column prop="driverPhone" label="联系号码">
  197. </el-table-column>
  198. <el-table-column prop="carSize" label="车辆规格">
  199. </el-table-column>
  200. <el-table-column label="操作">
  201. <template slot-scope="s">
  202. <el-button class="c-btn" type="info" @click="editChinaCarFn(s.row)">修改</el-button>
  203. <el-button class="c-btn" type="danger" @click="deleteChinaCarFn(s.row)">删除</el-button>
  204. </template>
  205. </el-table-column>
  206. </el-table>
  207. </el-card>
  208. <span slot="footer" class="dialog-footer">
  209. <el-button @click="china.visible=false">关 闭</el-button>
  210. <el-button type="primary" @click="china.visible=false">确 定</el-button>
  211. </span>
  212. </el-dialog>
  213. <el-dialog title="添加中国车" :visible.sync="car.visible" width="300">
  214. <span>
  215. <el-form label-position="left">
  216. <div class="c-item">
  217. <label class="c-label"><span style="color: red;">*</span>车牌号:</label>
  218. <el-input v-model="car.form.carNo" placeholder="车牌号">
  219. </el-input>
  220. </div>
  221. <div class="c-item">
  222. <label class="c-label"><span style="color: red;">*</span>车辆规格:</label>
  223. <el-input-number class="china-car-size" v-model="car.form.carSize" controls-position="right"
  224. :min="1" :max="50"></el-input-number>
  225. </div>
  226. <div class="c-item">
  227. <label class="c-label">联系人:</label>
  228. <el-input v-model="car.form.driverName" placeholder="联系人">
  229. </el-input>
  230. </div>
  231. <div class="c-item">
  232. <label class="c-label">联系号码:</label>
  233. <el-input v-model="car.form.driverPhone" placeholder="联系号码">
  234. </el-input>
  235. </div>
  236. </el-form>
  237. </span>
  238. <span slot="footer" class="dialog-footer">
  239. <el-button @click="car.visible = false">取 消</el-button>
  240. <el-button type="primary" @click="confirmAddCar">确 定</el-button>
  241. </span>
  242. </el-dialog>
  243. </div>
  244. <script>
  245. var app = new Vue({
  246. components: {
  247. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  248. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')
  249. },
  250. el: '.vue-box',
  251. data: {
  252. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  253. m: {
  254. id: '', // 主键
  255. customerId: '', // 客户id
  256. customerName: '', // 客户名称
  257. no: '', // 编号
  258. cardNo: '', // 车牌号
  259. countryName: '越南车',
  260. cardSize: '', // 车规格
  261. netWeight: '', // 载重(kg)
  262. goodsName: '', // 商品
  263. chinaCarNo: '',
  264. expectInDay: '',
  265. driverName: '', // 司机名称
  266. driverPhone: '', // 司机联系号码
  267. driverIdCard: '', // 司机身份证
  268. payTicket: '', // 支付凭证
  269. }, // 实体对象
  270. checkItem: '',
  271. customerList: [],
  272. cardList: [],
  273. driverList: [],
  274. currentCustomerId: 1,
  275. itemTypeList: [],
  276. filterTypeList: [],
  277. goodsList: [],
  278. countryList: [{
  279. name: '越南车'
  280. }, {
  281. name: '中国车'
  282. }],
  283. tableData: [],
  284. modal: {
  285. visible: false,
  286. itemId: 4,
  287. num: 1,
  288. list: []
  289. },
  290. addModal: {
  291. visible: false,
  292. form: {
  293. name: '',
  294. phone: '',
  295. itemId: 4,
  296. ticket: ''
  297. }
  298. },
  299. unitList: [],
  300. needTypeId: [],
  301. china: {
  302. visible: false,
  303. list: []
  304. },
  305. car: {
  306. visible: false,
  307. form: {
  308. carNo: '',
  309. driverName: '',
  310. driverPhone: '',
  311. carSize: ''
  312. }
  313. }
  314. },
  315. computed: {
  316. totalPrice() {
  317. let itemList = this.itemTypeList.filter(obj => obj.itemId);
  318. let price = 0;
  319. for (let i in itemList) {
  320. let type = itemList[i];
  321. let num = type.num;
  322. let items = type.items;
  323. for (let j in items) {
  324. let item = items[j];
  325. if (item.id == type.itemId) {
  326. price += num * item.price;
  327. break;
  328. }
  329. }
  330. }
  331. return price;
  332. }
  333. },
  334. methods: {
  335. findInAndNoBusinessCar(){
  336. sa.ajax('/TbBusinessCar/findInAndNoBusinessCar',function(resp){
  337. this.carList=resp.data;
  338. }.bind(this))
  339. },
  340. handleSelectCar(data){
  341. this.m.cardNo=data.carNo;
  342. this.m.cardSize=data.carSize;
  343. },
  344. queryCarAsync(queryStr,cb){
  345. let list = this.carList;
  346. let filterList = list.filter(obj => obj.carNo.indexOf(queryStr) !== -1);
  347. cb(filterList)
  348. },
  349. handleSelectChinaCar(data){
  350. this.car.form.carNo=data.carNo;
  351. this.car.form.cardSize=data.carSize;
  352. },
  353. queryChinaCarAsync(queryStr,cb){
  354. let list = this.carList;
  355. let filterList = list.filter(obj => obj.carNo.indexOf(queryStr) !== -1&&obj.carNo!==this.m.cardNo);
  356. cb(filterList)
  357. },
  358. cleanItem(type) {
  359. type.itemId = '';
  360. let typeName = type.name;
  361. if (typeName == '干杂货人工装卸' || typeName == '特殊车辆') {
  362. this.checkItem = '';
  363. }
  364. },
  365. itemChange(itemId) {
  366. let items = this.itemTypeList.flatMap(obj => obj.items);
  367. let item = items.filter(obj => obj.id == itemId)[0];
  368. let typeName = item.typeName;
  369. let checkItem = this.checkItem;
  370. if ((typeName == '干杂货人工装卸' && checkItem == '特殊车辆') ||
  371. (typeName == '特殊车辆' && checkItem == '干杂货人工装卸')) {
  372. this.itemTypeList.filter(obj => obj.id == item.typeId)[0].itemId = ''
  373. sa.error('不能同时选择干杂货人工装卸和特殊车辆')
  374. return false;
  375. }
  376. if (typeName == '干杂货人工装卸' || typeName == '特殊车辆') {
  377. this.checkItem = typeName;
  378. }
  379. },
  380. addCar() {
  381. this.china.visible = true;
  382. },
  383. addChinaCarFn() {
  384. Object.assign(this.car, {
  385. visible: true,
  386. form: {
  387. carNo: '',
  388. driverName: '',
  389. driverPhone: '',
  390. carSize: ''
  391. }
  392. })
  393. },
  394. confirmAddCar() {
  395. let carNo = this.car.form.carNo;
  396. if (!carNo) {
  397. sa.error('请填入车牌号')
  398. return false;
  399. }
  400. if (!this.car.form.carSize) {
  401. sa.error('请填入车辆规格')
  402. return false;
  403. }
  404. let phone = this.car.form.phone;
  405. if (phone && !sa.isPhone(phone)) {
  406. sa.error('联系号码不正确')
  407. return false;
  408. }
  409. let list = this.china.list;
  410. let index = list.map(obj => obj.carNo).indexOf(carNo);
  411. if (index > -1) {
  412. list.splice(index, 1);
  413. }
  414. this.china.list.push(this.car.form);
  415. this.car.visible = false;
  416. },
  417. editChinaCarFn(data) {
  418. Object.assign(this.car, {
  419. visible: true,
  420. form: data
  421. })
  422. },
  423. deleteChinaCarFn(data) {
  424. this.china.list.splice(this.china.list.indexOf(data), 1)
  425. },
  426. goodsChange(value) {
  427. let goods = this.goodsList.filter(obj => obj.name === value).pop();
  428. let noNeedIds = goods.noNeedIds.split(',');
  429. this.needTypeId = goods.needIds.split(',');
  430. this.filterTypeList = this.itemTypeList.filter(type => noNeedIds.indexOf(type.id) === -1);
  431. },
  432. getUnitList() {
  433. sa.ajax('/TbUnit/getList', {
  434. pageNo: 1,
  435. pageSize: 50
  436. }, function(resp) {
  437. this.unitList = resp.data;
  438. }.bind(this))
  439. },
  440. addPeopleFn(itemId, num, show) {
  441. sa.ajax('/TbBusinessPeople/getList', {
  442. businessId: this.id
  443. }, function(resp) {
  444. let list = resp.data;
  445. let index = 0;
  446. let r = [];
  447. for (let i in list) {
  448. r.push({
  449. name: list[i].name,
  450. phone: list[i].phone,
  451. index: index,
  452. id: list[i].id
  453. })
  454. index++;
  455. }
  456. this.modal.list = r;
  457. }.bind(this));
  458. this.modal.itemId = itemId;
  459. this.modal.num = num;
  460. this.modal.visible = show;
  461. },
  462. showAddModal() {
  463. Object.assign(this.addModal, {
  464. visible: true,
  465. form: {
  466. index: -1,
  467. name: '',
  468. phone: '',
  469. itemId: this.modal.itemId,
  470. ticket: ''
  471. }
  472. })
  473. },
  474. cancelAdd() {
  475. this.modal.list = [];
  476. this.modal.visible = false;
  477. },
  478. confirmAdd() {
  479. if (!this.addModal.form.name) {
  480. sa.error('请输入检测人姓名')
  481. return false;
  482. }
  483. let phone = this.addModal.form.phone;
  484. if (phone && !sa.isPhone(phone)) {
  485. sa.error('检测人联系号码不正确')
  486. return false;
  487. }
  488. let dbIndex = this.addModal.form.index;
  489. if (dbIndex >= 0) {
  490. this.modal.list[dbIndex].name = this.addModal.form.name;
  491. this.modal.list[dbIndex].phone = this.addModal.form.phone;
  492. } else {
  493. this.addModal.form.index = this.modal.list.length;
  494. this.modal.list.push(this.addModal.form);
  495. }
  496. this.addModal.visible = false;
  497. },
  498. editFn(data) {
  499. Object.assign(this.addModal, {
  500. visible: true,
  501. form: data
  502. })
  503. },
  504. deleteFn(data) {
  505. this.modal.list.splice(data.index, 1);
  506. if (data.id) {
  507. sa.ajax('/TbBusinessPeople/deleteById', {
  508. id: data.id
  509. }, function(resp) {
  510. }.bind(this))
  511. }
  512. },
  513. getGoods() {
  514. sa.ajax('/TbGoods/getList', {
  515. pageNo: 1,
  516. pageSize: 10
  517. }, function(resp) {
  518. this.goodsList = resp.data;
  519. }.bind(this))
  520. },
  521. getItemTypeList() {
  522. sa.ajax('/TbItemType/getList', function(resp) {
  523. let typeList = resp.data;
  524. // 初始化数据
  525. sa.ajax('/TbBusiness/getById?id=' + this.id, function(res) {
  526. let m = res.data;
  527. let items = m.items;
  528. this.china.list = m.cars.filter(obj=>obj.carNo!==m.cardNo);
  529. let hsItem = items.filter(obj => obj.itemTypeName.indexOf('人') !== -1 &&
  530. obj.itemTypeName.indexOf('核酸') !== -1);
  531. if (hsItem.length > 0) {
  532. this.addPeopleFn(hsItem[0].itemTypeId, false)
  533. }
  534. for (let i in items) {
  535. let item = items[i];
  536. if (item.itemTypeName == '特殊车辆' || item.itemTypeName == '干杂货人工装卸') {
  537. this.checkItem = item.itemTypeName
  538. }
  539. for (let j in typeList) {
  540. let type = typeList[j];
  541. if (item.itemTypeId == type.id) {
  542. type.itemId = item.itemId;
  543. type.num = item.num;
  544. }
  545. }
  546. }
  547. this.m = m;
  548. this.itemTypeList = typeList;
  549. this.goodsChange(m.goodsName);
  550. }.bind(this))
  551. }.bind(this))
  552. },
  553. queryCaSizerAsync(queryStr, cb) {
  554. let list = this.unitList;
  555. let filterList = list.filter(obj => obj.unit.indexOf(queryStr) !== -1);
  556. cb(filterList)
  557. },
  558. handleSelectCarSize(item) {
  559. this.m.cardSize = item.unit;
  560. },
  561. getCustomerList() {
  562. sa.ajax('/TbCostomer/getList', {
  563. pageNo: 1,
  564. pageSize: 100,
  565. judgeStatus: 2
  566. }, function(resp) {
  567. this.customerList = resp.data;
  568. if (resp.data.length > 0) {
  569. this.m.customerId = resp.data[0].id;
  570. }
  571. }.bind(this));
  572. },
  573. getCustomer() {
  574. sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
  575. let id = resp.data;
  576. if (id == 1) {
  577. this.getCustomerList();
  578. } else {
  579. this.m.customerId = id;
  580. }
  581. this.currentCustomerId = id;
  582. }.bind(this));
  583. },
  584. closeFn() {
  585. parent.app.f5();
  586. sa.closeCurrIframe();
  587. },
  588. // 提交数据
  589. ok: function() {
  590. // 表单校验
  591. let m = this.m;
  592. if (this.currentCustomerId == 1) {
  593. sa.checkNull(m.customerId, '请选择 [客户名称]');
  594. }
  595. sa.checkNull(m.goodsName, '请选择运输货物');
  596. sa.checkNull(m.cardNo, '请输入 [车牌号]');
  597. if (!m.cardSize||!sa.isNum(m.cardSize)) {
  598. sa.error('车辆规格只能输入数字')
  599. return;
  600. }
  601. if (!sa.isNum(m.netWeight)) {
  602. sa.error('载重只能输入数字')
  603. return;
  604. }
  605. let checkList = this.itemTypeList;
  606. let chechItem = this.checkItem;
  607. for (let j in this.needTypeId) {
  608. let id = this.needTypeId[j];
  609. for (let i in checkList) {
  610. let type = checkList[i];
  611. let typeName = type.name;
  612. if (id == type.id && !type.itemId && typeName !== '特殊车辆' && typeName !== '干杂货人工装卸') {
  613. sa.error('选择[' + this.m.goodsName + ']时,[' + typeName + ']必选')
  614. return;
  615. }
  616. if (!chechItem && this.m.goodsName == '干杂货') {
  617. sa.error('请选择特殊车辆或干杂货人工装卸之一')
  618. return;
  619. }
  620. }
  621. }
  622. let typeList = this.itemTypeList.filter(obj => obj.itemId);
  623. let list = [];
  624. if (typeList.length == 0) {
  625. sa.error('至少选择一项业务');
  626. return false;
  627. }
  628. for (let i in typeList) {
  629. let type = typeList[i];
  630. list.push({
  631. itemId: type.itemId,
  632. num: type.num
  633. })
  634. }
  635. if (typeList.filter(obj => obj.name.indexOf('人') !== -1 && obj.name.indexOf('核酸') !== -1)
  636. .length > 0 &&
  637. this.modal.list
  638. .length == 0) {
  639. sa.error('请添加核酸检测人员');
  640. return false;
  641. }
  642. m.itemJson = JSON.stringify(list);
  643. m.peopleJson = JSON.stringify(this.modal.list);
  644. m.carJson = JSON.stringify(this.china.list);
  645. m.items = [];
  646. m.cars = [];
  647. if (this.id <= 0) { // 添加
  648. sa.ajax('/TbBusiness/add', m, function(res) {
  649. sa.alert('增加成功', this.clean);
  650. }.bind(this));
  651. } else { // 修改
  652. sa.ajax('/TbBusiness/update', m, function(res) {
  653. sa.alert('修改成功', this.clean);
  654. }.bind(this));
  655. }
  656. },
  657. // 添加/修改 完成后的动作
  658. clean: function() {
  659. parent.app.f5(); // 刷新父页面列表
  660. this.modal.list = [];
  661. if (this.id == 0) {
  662. this.m = this.createModel();
  663. } else {
  664. sa.closeCurrIframe(); // 关闭本页
  665. }
  666. }
  667. },
  668. mounted: function() {
  669. this.getCustomer();
  670. this.getItemTypeList();
  671. this.getGoods();
  672. this.getUnitList();
  673. },
  674. beforeDestroy() {
  675. parent.app.f5();
  676. }
  677. })
  678. </script>
  679. </body>
  680. </html>