tb-car-disincle-add.html 23 KB

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