tb-business-edit.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  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. cleanItem(type) {
  336. type.itemId = '';
  337. let typeName = type.name;
  338. if (typeName == '干杂货人工装卸' || typeName == '特殊车辆') {
  339. this.checkItem = '';
  340. }
  341. },
  342. itemChange(itemId) {
  343. let items = this.itemTypeList.flatMap(obj => obj.items);
  344. let item = items.filter(obj => obj.id == itemId)[0];
  345. let typeName = item.typeName;
  346. let checkItem = this.checkItem;
  347. if ((typeName == '干杂货人工装卸' && checkItem == '特殊车辆') ||
  348. (typeName == '特殊车辆' && checkItem == '干杂货人工装卸')) {
  349. this.itemTypeList.filter(obj => obj.id == item.typeId)[0].itemId = ''
  350. sa.error('不能同时选择干杂货人工装卸和特殊车辆')
  351. return false;
  352. }
  353. if (typeName == '干杂货人工装卸' || typeName == '特殊车辆') {
  354. this.checkItem = typeName;
  355. }
  356. },
  357. addCar() {
  358. this.china.visible = true;
  359. },
  360. addChinaCarFn() {
  361. Object.assign(this.car, {
  362. visible: true,
  363. form: {
  364. carNo: '',
  365. driverName: '',
  366. driverPhone: '',
  367. carSize: ''
  368. }
  369. })
  370. },
  371. confirmAddCar() {
  372. let carNo = this.car.form.carNo;
  373. if (!carNo) {
  374. sa.error('请填入车牌号')
  375. return false;
  376. }
  377. if (!this.car.form.carSize) {
  378. sa.error('请填入车辆规格')
  379. return false;
  380. }
  381. let phone = this.car.form.phone;
  382. if (phone && !sa.isPhone(phone)) {
  383. sa.error('联系号码不正确')
  384. return false;
  385. }
  386. let list = this.china.list;
  387. let index = list.map(obj => obj.carNo).indexOf(carNo);
  388. if (index > -1) {
  389. list.splice(index, 1);
  390. }
  391. this.china.list.push(this.car.form);
  392. this.car.visible = false;
  393. },
  394. editChinaCarFn(data) {
  395. Object.assign(this.car, {
  396. visible: true,
  397. form: data
  398. })
  399. },
  400. deleteChinaCarFn(data) {
  401. this.china.list.splice(this.china.list.indexOf(data), 1)
  402. },
  403. goodsChange(value) {
  404. let goods = this.goodsList.filter(obj => obj.name === value).pop();
  405. let noNeedIds = goods.noNeedIds.split(',');
  406. this.needTypeId = goods.needIds.split(',');
  407. this.filterTypeList = this.itemTypeList.filter(type => noNeedIds.indexOf(type.id) === -1);
  408. },
  409. getUnitList() {
  410. sa.ajax('/TbUnit/getList', {
  411. pageNo: 1,
  412. pageSize: 50
  413. }, function(resp) {
  414. this.unitList = resp.data;
  415. }.bind(this))
  416. },
  417. addPeopleFn(itemId, num, show) {
  418. sa.ajax('/TbBusinessPeople/getList', {
  419. businessId: this.id
  420. }, function(resp) {
  421. let list = resp.data;
  422. let index = 0;
  423. let r = [];
  424. for (let i in list) {
  425. r.push({
  426. name: list[i].name,
  427. phone: list[i].phone,
  428. index: index,
  429. id: list[i].id
  430. })
  431. index++;
  432. }
  433. this.modal.list = r;
  434. }.bind(this));
  435. this.modal.itemId = itemId;
  436. this.modal.num = num;
  437. this.modal.visible = show;
  438. },
  439. showAddModal() {
  440. Object.assign(this.addModal, {
  441. visible: true,
  442. form: {
  443. index: -1,
  444. name: '',
  445. phone: '',
  446. itemId: this.modal.itemId,
  447. ticket: ''
  448. }
  449. })
  450. },
  451. cancelAdd() {
  452. this.modal.list = [];
  453. this.modal.visible = false;
  454. },
  455. confirmAdd() {
  456. if (!this.addModal.form.name) {
  457. sa.error('请输入检测人姓名')
  458. return false;
  459. }
  460. let phone = this.addModal.form.phone;
  461. if (phone && !sa.isPhone(phone)) {
  462. sa.error('检测人联系号码不正确')
  463. return false;
  464. }
  465. let dbIndex = this.addModal.form.index;
  466. if (dbIndex >= 0) {
  467. this.modal.list[dbIndex].name = this.addModal.form.name;
  468. this.modal.list[dbIndex].phone = this.addModal.form.phone;
  469. } else {
  470. this.addModal.form.index = this.modal.list.length;
  471. this.modal.list.push(this.addModal.form);
  472. }
  473. this.addModal.visible = false;
  474. },
  475. editFn(data) {
  476. Object.assign(this.addModal, {
  477. visible: true,
  478. form: data
  479. })
  480. },
  481. deleteFn(data) {
  482. this.modal.list.splice(data.index, 1);
  483. if (data.id) {
  484. sa.ajax('/TbBusinessPeople/deleteById', {
  485. id: data.id
  486. }, function(resp) {
  487. }.bind(this))
  488. }
  489. },
  490. getGoods() {
  491. sa.ajax('/TbGoods/getList', {
  492. pageNo: 1,
  493. pageSize: 10
  494. }, function(resp) {
  495. this.goodsList = resp.data;
  496. }.bind(this))
  497. },
  498. getItemTypeList() {
  499. sa.ajax('/TbItemType/getList', function(resp) {
  500. let typeList = resp.data;
  501. // 初始化数据
  502. sa.ajax('/TbBusiness/getById?id=' + this.id, function(res) {
  503. let m = res.data;
  504. let items = m.items;
  505. this.china.list = m.cars.filter(obj=>obj.carNo!==m.cardNo);
  506. let hsItem = items.filter(obj => obj.itemTypeName.indexOf('人') !== -1 &&
  507. obj.itemTypeName.indexOf('核酸') !== -1);
  508. if (hsItem.length > 0) {
  509. this.addPeopleFn(hsItem[0].itemTypeId, false)
  510. }
  511. for (let i in items) {
  512. let item = items[i];
  513. if (item.itemTypeName == '特殊车辆' || item.itemTypeName == '干杂货人工装卸') {
  514. this.checkItem = item.itemTypeName
  515. }
  516. for (let j in typeList) {
  517. let type = typeList[j];
  518. if (item.itemTypeId == type.id) {
  519. type.itemId = item.itemId;
  520. type.num = item.num;
  521. }
  522. }
  523. }
  524. this.m = m;
  525. this.itemTypeList = typeList;
  526. this.goodsChange(m.goodsName);
  527. }.bind(this))
  528. }.bind(this))
  529. },
  530. queryCaSizerAsync(queryStr, cb) {
  531. let list = this.unitList;
  532. let filterList = list.filter(obj => obj.unit.indexOf(queryStr) !== -1);
  533. cb(filterList)
  534. },
  535. handleSelectCarSize(item) {
  536. this.m.cardSize = item.unit;
  537. },
  538. getCustomerList() {
  539. sa.ajax('/TbCostomer/getList', {
  540. pageNo: 1,
  541. pageSize: 100,
  542. judgeStatus: 2
  543. }, function(resp) {
  544. this.customerList = resp.data;
  545. if (resp.data.length > 0) {
  546. this.m.customerId = resp.data[0].id;
  547. }
  548. }.bind(this));
  549. },
  550. getCustomer() {
  551. sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
  552. let id = resp.data;
  553. if (id == 1) {
  554. this.getCustomerList();
  555. } else {
  556. this.m.customerId = id;
  557. }
  558. this.currentCustomerId = id;
  559. }.bind(this));
  560. },
  561. closeFn() {
  562. parent.app.f5();
  563. sa.closeCurrIframe();
  564. },
  565. // 提交数据
  566. ok: function() {
  567. // 表单校验
  568. let m = this.m;
  569. if (this.currentCustomerId == 1) {
  570. sa.checkNull(m.customerId, '请选择 [客户名称]');
  571. }
  572. sa.checkNull(m.goodsName, '请选择运输货物');
  573. sa.checkNull(m.cardNo, '请输入 [车牌号]');
  574. if (!sa.isNum(m.cardSize)) {
  575. sa.error('车辆规格只能输入数字')
  576. return;
  577. }
  578. if (!sa.isNum(m.netWeight)) {
  579. sa.error('载重只能输入数字')
  580. return;
  581. }
  582. let checkList = this.itemTypeList;
  583. let chechItem = this.checkItem;
  584. for (let j in this.needTypeId) {
  585. let id = this.needTypeId[j];
  586. for (let i in checkList) {
  587. let type = checkList[i];
  588. let typeName = type.name;
  589. if (id == type.id && !type.itemId && typeName !== '特殊车辆' && typeName !== '干杂货人工装卸') {
  590. sa.error('选择[' + this.m.goodsName + ']时,[' + typeName + ']必选')
  591. return;
  592. }
  593. if (!chechItem && this.m.goodsName == '干杂货') {
  594. sa.error('请选择特殊车辆或干杂货人工装卸之一')
  595. return;
  596. }
  597. }
  598. }
  599. let typeList = this.itemTypeList.filter(obj => obj.itemId);
  600. let list = [];
  601. if (typeList.length == 0) {
  602. sa.error('至少选择一项业务');
  603. return false;
  604. }
  605. for (let i in typeList) {
  606. let type = typeList[i];
  607. list.push({
  608. itemId: type.itemId,
  609. num: type.num
  610. })
  611. }
  612. if (typeList.filter(obj => obj.name.indexOf('人') !== -1 && obj.name.indexOf('核酸') !== -1)
  613. .length > 0 &&
  614. this.modal.list
  615. .length == 0) {
  616. sa.error('请添加核酸检测人员');
  617. return false;
  618. }
  619. m.itemJson = JSON.stringify(list);
  620. m.peopleJson = JSON.stringify(this.modal.list);
  621. m.carJson = JSON.stringify(this.china.list);
  622. m.items = [];
  623. m.cars = [];
  624. if (this.id <= 0) { // 添加
  625. sa.ajax('/TbBusiness/add', m, function(res) {
  626. sa.alert('增加成功', this.clean);
  627. }.bind(this));
  628. } else { // 修改
  629. sa.ajax('/TbBusiness/update', m, function(res) {
  630. sa.alert('修改成功', this.clean);
  631. }.bind(this));
  632. }
  633. },
  634. // 添加/修改 完成后的动作
  635. clean: function() {
  636. parent.app.f5(); // 刷新父页面列表
  637. this.modal.list = [];
  638. if (this.id == 0) {
  639. this.m = this.createModel();
  640. } else {
  641. sa.closeCurrIframe(); // 关闭本页
  642. }
  643. }
  644. },
  645. mounted: function() {
  646. this.getCustomer();
  647. this.getItemTypeList();
  648. this.getGoods();
  649. this.getUnitList();
  650. },
  651. beforeDestroy() {
  652. parent.app.f5();
  653. }
  654. })
  655. </script>
  656. </body>
  657. </html>