tb-car-disincle-edit.html 25 KB

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