123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>入境登记-添加/修改</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
- <!-- 所有的 css js 资源 -->
- <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="../../static/kj/vue.min.js"></script>
- <script src="../../static/kj/element-ui/index.js"></script>
- <script src="../../static/kj/httpVueLoader.js"></script>
- <script src="../../static/kj/jquery.min.js"></script>
- <script src="../../static/kj/layer/layer.js"></script>
- <script src="../../static/sa.js"></script>
- <script src="../../static/kj/upload-util.js"></script>
- <style type="text/css">
- .c-panel .el-form .c-label {
- width: 7em !important;
- }
- .c-panel .el-form .c-panel .el-form {
- width: 180px;
- }
- .item-num .el-input__inner {
- width: 100px;
- }
- .xj {
- display: inline;
- color: red;
- margin-left: 9px;
- font-weight: bold;
- }
- .hj {
- color: red;
- margin-left: 9px;
- font-weight: bold;
- }
- </style>
- </head>
- <body>
- <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
- <!-- ------- 内容部分 ------- -->
- <div class="s-body">
- <div class="c-panel">
- <div class="c-title" v-if="id == 0">数据添加</div>
- <div class="c-title" v-else>数据修改</div>
- <el-form v-if="m" label-position="left">
- <el-row>
- <el-col span=10>
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>基本资料</span>
- </div>
- <div>
- <div class="c-item">
- <label class="c-label">申报单号:</label>
- <el-input v-model="m.declareNo" placeholder="选择申报单" readonly>
- <div slot="suffix" style="cursor: pointer;color: blue;"
- @click="handlerDeclare">
- <i class="el-icon-folder-add"></i>
- </div>
- </el-input>
- </div>
- <sa-item name="客户名称" disabled v-model="m.customerName" br>
- </sa-item>
- <div class="c-item">
- <label class="c-label"><span style="color: red;">*</span>运输货品:</label>
- <el-select v-model="m.goodsName" placeholder="请选择" @change="goodsChange">
- <el-option v-for="item in goodsList" :key="item.id" :label="item.name"
- :value="item.name">
- </el-option>
- </el-select>
- </div>
- <sa-item type="num" name="载重(kg)" placeholder="请输入车辆载重" v-model="m.netWeight"
- br>
- </sa-item>
- <div class="c-item">
- <label class="c-label">境外车牌号:</label>
- <el-input v-model="m.cardNo" readonly disabled placeholder="请输入境外车牌号">
- </el-input>
- </div>
- </sa-item>
- <div class="c-item">
- <label class="c-label"><span style="color: red;">*</span>境外车规格:</label>
- <el-autocomplete v-model="m.cardSize" placeholder="请输入车规格"
- @select="handleSelectCarSize" value-key='unit'
- :fetch-suggestions="queryCaSizerAsync">
- </el-autocomplete>
- </div>
- <div class="c-item">
- <label class="c-label">中国车:</label>
- <el-input v-model="china.list.map(obj=>obj.carNo).join('、')"
- placeholder="添加中国车" readonly>
- <div slot="suffix" style="cursor: pointer;color: blue;" @click="addCar">
- <i class="el-icon-folder-add"></i>
- </div>
- </el-input>
- </el-autocomplete>
- </div>
- </div>
- </el-card>
- </el-col>
- <el-col span=14>
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>业务项</span>
- </div>
- <div>
- <el-form-item v-for="(type,index) in filterTypeList" style="display: flex;"
- v-if="filterTypeList.length>0">
- <label slot="label"><label v-if="needTypeId.indexOf(type.id)!==-1"
- style="color: red;">*</label>{{type.name}}</label>
- <el-select v-model="type.itemId" style="width: 120px;" @change="itemChange"
- placeholder="请选择">
- <el-option v-for="item in type.items" v-if="m.netWeight >= item.minWeight && m.netWeight < item.maxWeight
- &&m.cardSize<=item.carLength&&m.cardSize>=item.minLength"
- :key="item.id" :label="item.itemName"
- :value="item.id">
- </el-option>
- </el-select>
- <el-input-number style="margin-left: 60px;" class="item-num"
- v-model="type.num" :min="1" :max="10" size="mini"
- :disabled="type.inc==0"></el-input-number>
- <div class="xj" v-if="type.itemId">
- {{type.items.filter(obj => obj.id == type.itemId)[0].price * type.num}}元
- <label @click="cleanItem(type)"
- style="margin-left: 5px;cursor: pointer">(<i
- class="el-icon-delete"></i>)</label>
- </div>
- <el-button v-if="type.code=='p09'&&type.itemId"
- @click="addPeopleFn(type.itemId,type.num,true)">操作
- </el-button>
- </el-form-item>
- <div v-if="filterTypeList.length==0" style="height: 400px;padding: 30px;">
- 请先选择运输货品
- </div>
- <div class="hj" v-if="totalPrice>0">
- 合计费用:{{totalPrice}}<label>元</label>
- </div>
- </div>
- </el-card>
- </el-col>
- </el-row>
- </el-form>
- </div>
- </div>
- <!-- ------- 底部按钮 ------- -->
- <div class="s-foot">
- <el-button type="primary" @click="ok()" v-if="sa.isAuth('tb-business-edit')">确定</el-button>
- <el-button @click="closeFn()">取消</el-button>
- </div>
- <el-dialog title="人员核酸检测" :visible.sync="modal.visible" width="80%">
- <el-card class="box-card">
- <div slot="header">
- <span>列表</span>
- <el-button style="float: right;" icon="el-icon-plus" type="primary" @click="showAddModal"
- v-if="modal.list.length<modal.num">添加
- </el-button>
- </div>
- <el-table :data="modal.list">
- <el-table-column prop="name" label="姓名">
- </el-table-column>
- <el-table-column prop="phone" label="联系号码">
- </el-table-column>
- <!-- <sa-td type="img-list" name="核酸报告" prop="ticket"></sa-td> -->
- <el-table-column label="操作">
- <template slot-scope="s">
- <!-- <el-button class="c-btn" type="primary" @click="uploadFn(s.row)">上传</el-button> -->
- <el-button class="c-btn" type="info" @click="editFn(s.row)">修改</el-button>
- <el-button class="c-btn" type="danger" @click="deleteFn(s.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- <span slot="footer" class="dialog-footer">
- <el-button @click="cancelAdd">取 消</el-button>
- <el-button type="primary" @click="modal.visible=false">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="人员核酸检测" :visible.sync="addModal.visible" width="400">
- <span>
- <el-form label-position="left">
- <sa-item type="text" name="姓名" placeholder="姓名" v-model="addModal.form.name" br></sa-item>
- <sa-item type="text" name="联系号码" placeholder="联系号码" v-model="addModal.form.phone" br></sa-item>
- </el-form>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="addModal.visible = false">取 消</el-button>
- <el-button type="primary" @click="confirmAdd">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="中国车" :visible.sync="china.visible" width="80%">
- <el-card class="box-card">
- <div slot="header">
- <span>列表</span>
- <el-button style="float: right;" icon="el-icon-plus" type="primary" @click="addChinaCarFn">添加
- </el-button>
- </div>
- <el-table :data="china.list">
- <el-table-column prop="carNo" label="车牌号">
- </el-table-column>
- <el-table-column prop="driverName" label="联系人">
- </el-table-column>
- <el-table-column prop="driverPhone" label="联系号码">
- </el-table-column>
- <el-table-column prop="carSize" label="车辆规格">
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="s">
- <el-button class="c-btn" type="info" @click="editChinaCarFn(s.row)">修改</el-button>
- <el-button class="c-btn" type="danger" @click="deleteChinaCarFn(s.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- <span slot="footer" class="dialog-footer">
- <el-button @click="china.visible=false">关 闭</el-button>
- <el-button type="primary" @click="china.visible=false">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="添加中国车" :visible.sync="car.visible" width="300">
- <span>
- <el-form label-position="left">
- <div class="c-item">
- <label class="c-label"><span style="color: red;">*</span>车牌号:</label>
- <el-input v-model="car.form.carNo" placeholder="车牌号">
- </el-input>
- </div>
- <div class="c-item">
- <label class="c-label"><span style="color: red;">*</span>车辆规格:</label>
- <el-input-number class="china-car-size" v-model="car.form.carSize" controls-position="right"
- :min="1" :max="50"></el-input-number>
- </div>
- <div class="c-item">
- <label class="c-label">联系人:</label>
- <el-input v-model="car.form.driverName" placeholder="联系人">
- </el-input>
- </div>
- <div class="c-item">
- <label class="c-label">联系号码:</label>
- <el-input v-model="car.form.driverPhone" placeholder="联系号码">
- </el-input>
- </div>
- </el-form>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="car.visible = false">取 消</el-button>
- <el-button type="primary" @click="confirmAddCar">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="申报单" :visible.sync="declare.visible" width="90%">
- <div class="delect-search">
- 申报人:
- <el-input style="width: 140px;" v-model="declare.p.declarePeople" placeholder="申报人">
- </el-input>
- <el-button type="primary" @click="getDeclareList">搜索</el-button>
- <el-button type="info" @click="resetDclare">重置</el-button>
- </div>
- <el-card class="box-card" style="margin-top: 20px;">
- <div slot="header">
- <span>列表</span>
- </div>
- <el-table :data="declare.list" ref="declareTable">
- <el-table-column type="selection">
- </el-table-column>
- <el-table-column prop="declarePeople" label="申报人">
- </el-table-column>
- <el-table-column prop="customerName" label="申报公司">
- </el-table-column>
- <el-table-column prop="declarePhone" label="申报电话">
- </el-table-column>
- <el-table-column prop="declareNo" width="180" label="申报单号">
- </el-table-column>
- <el-table-column prop="goodsName" label="产品学名">
- </el-table-column>
- <el-table-column prop="carNo" label="越南车牌">
- </el-table-column>
- <el-table-column prop="grossWeight" label="毛重(吨)">
- </el-table-column>
- <el-table-column prop="createTime" width="140" label="申报时间">
- </el-table-column>
- </el-table>
- <div class="block">
- <el-pagination layout="prev, pager, next" @current-change="getDeclareList"
- :page-size="declare.p.pageSize" :total="declare.p.dataCount"
- :current-page="declare.p.pageNo">
- </el-pagination>
- </div>
- </el-card>
- <span slot="footer" class="dialog-footer">
- <el-button @click="declare.visible = false">取 消</el-button>
- <el-button type="primary" @click="confirmSelectDeclare">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
- "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')
- },
- el: '.vue-box',
- data: {
- id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
- m: {
- id: '', // 主键
- customerId: '', // 客户id
- customerName: '', // 客户名称
- no: '', // 编号
- cardNo: '', // 车牌号
- countryName: '越南车',
- cardSize: '', // 车规格
- netWeight: '', // 载重(kg)
- goodsName: '', // 商品
- chinaCarNo: '',
- expectInDay: '',
- driverName: '', // 司机名称
- driverPhone: '', // 司机联系号码
- driverIdCard: '', // 司机身份证
- payTicket: '', // 支付凭证
- }, // 实体对象
- checkItem: '',
- customerList: [],
- cardList: [],
- driverList: [],
- currentCustomerId: 1,
- itemTypeList: [],
- filterTypeList: [],
- goodsList: [],
- countryList: [{
- name: '越南车'
- }, {
- name: '中国车'
- }],
- tableData: [],
- modal: {
- visible: false,
- itemId: 4,
- num: 1,
- list: []
- },
- addModal: {
- visible: false,
- form: {
- name: '',
- phone: '',
- itemId: 4,
- ticket: ''
- }
- },
- unitList: [],
- needTypeId: [],
- china: {
- visible: false,
- list: []
- },
- car: {
- visible: false,
- form: {
- carNo: '',
- driverName: '',
- driverPhone: '',
- carSize: ''
- }
- },
- declare: {
- visible: false,
- list: [],
- p: {
- pageNo: 1,
- pageSize: 8,
- dataCount: 0,
- declarePeople: '',
- production: '',
- declareNo: ''
- }
- }
- },
- computed: {
- totalPrice() {
- let itemList = this.itemTypeList.filter(obj => obj.itemId);
- let price = 0;
- for (let i in itemList) {
- let type = itemList[i];
- let num = type.num;
- let items = type.items;
- for (let j in items) {
- let item = items[j];
- if (item.id == type.itemId) {
- price += num * item.price;
- break;
- }
- }
- }
- return price;
- }
- },
- methods: {
- resetDclare() {
- this.declare.p.pageNo = 1;
- this.declare.p.pageSize = 8;
- this.declare.p.production = '';
- this.declare.p.declarePeople = '';
- this.getDeclareList();
- },
- handlerDeclare() {
- this.declare.visible = true;
- this.declare.p.declareNo = this.m.declareNo;
- this.getDeclareList();
- },
- confirmSelectDeclare() {
- // 获取选中元素的id列表
- let selection = this.$refs['declareTable'].selection;
- let declareNo = sa.getArrayField(selection, 'declareNo');
- if (selection.length == 0) {
- return sa.msg('请至少选择一条数据')
- }
- if (selection.length > 1) {
- return sa.msg('只能选择一条数据')
- }
- let declare = selection[0];
- if (this.m.declareNo !== declare.declareNo) {
- this.m.declareNo = declare.declareNo;
- this.m.customerId = declare.customerId;
- this.m.customerName = declare.customerName;
- this.m.cardNo = declare.carNo;
- this.m.chinaCarNo = declare.chinaCarNo;
- this.m.netWeight = declare.grossWeight;
- let chinaCarNo = declare.chinaCarNo;
- if (chinaCarNo) {
- let list = [];
- chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
- let obj = {
- carNo: carNo
- }
- list.push(obj);
- this.china.list = list;
- })
- }
- }
- this.declare.visible = false;
- },
- getDeclareList() {
- if (currentCustomerId != '1') {
- this.declare.p.customerId = this.currentCustomerId;
- }
- this.declare.p.declareNo = this.m.declareNo;
- sa.ajax('/TbDeclare/getNotBindList', sa.removeNull(this.declare.p), function (resp) {
- let list = resp.data;
- this.declare.list = list;
- this.declare.p.pageNo = resp.pageNo;
- this.declare.p.dataCount = resp.dataCount;
- list.forEach(row => {
- if (row.declareNo == this.m.declareNo) {
- this.$nextTick(() => {
- this.$refs['declareTable'].toggleRowSelection(row, true)
- })
- }
- })
- }.bind(this))
- },
- findInAndNoBusinessCar() {
- sa.ajax('/TbBusinessCar/findInAndNoBusinessCar', function (resp) {
- this.carList = resp.data;
- }.bind(this))
- },
- handleSelectCar(data) {
- this.m.cardNo = data.carNo;
- this.m.cardSize = data.carSize;
- },
- queryCarAsync(queryStr, cb) {
- let list = this.carList;
- let filterList = list.filter(obj => obj.carNo.indexOf(queryStr) !== -1);
- cb(filterList)
- },
- handleSelectChinaCar(data) {
- this.car.form.carNo = data.carNo;
- this.car.form.cardSize = data.carSize;
- },
- queryChinaCarAsync(queryStr, cb) {
- let list = this.carList;
- let filterList = list.filter(obj => obj.carNo.indexOf(queryStr) !== -1 && obj.carNo !== this.m
- .cardNo);
- cb(filterList)
- },
- cleanItem(type) {
- type.itemId = '';
- let typeName = type.name;
- if (typeName == '干杂货人工装卸' || typeName == '特殊车辆') {
- this.checkItem = '';
- }
- },
- itemChange(itemId) {
- },
- addCar() {
- this.china.visible = true;
- },
- addChinaCarFn() {
- Object.assign(this.car, {
- visible: true,
- form: {
- carNo: '',
- driverName: '',
- driverPhone: '',
- carSize: ''
- }
- })
- },
- confirmAddCar() {
- let carNo = this.car.form.carNo;
- if (!sa.isCarNo(carNo)) {
- sa.error('请填入正确的车牌号')
- return false;
- }
- if (!this.car.form.carSize) {
- sa.error('请填入车辆规格')
- return false;
- }
- let phone = this.car.form.phone;
- if (phone && !sa.isPhone(phone)) {
- sa.error('联系号码不正确')
- return false;
- }
- let list = this.china.list;
- let index = list.map(obj => obj.carNo).indexOf(carNo);
- if (index > -1) {
- list.splice(index, 1);
- }
- this.china.list.push(this.car.form);
- this.car.visible = false;
- },
- editChinaCarFn(data) {
- Object.assign(this.car, {
- visible: true,
- form: data
- })
- },
- deleteChinaCarFn(data) {
- this.china.list.splice(this.china.list.indexOf(data), 1)
- },
- goodsChange(value) {
- let goods = this.goodsList.filter(obj => obj.name === value).pop();
- let noNeedIds = goods.noNeedIds.split(',');
- let list = this.itemTypeList;
- for (let i in list) {
- let item = list[i];
- if (noNeedIds.indexOf(item.id) !== -1) {
- item.itemId = ''
- }
- }
- this.needTypeId = goods.needIds.split(',');
- this.filterTypeList = this.itemTypeList.filter(type => noNeedIds.indexOf(type.id) === -1);
- },
- getUnitList() {
- sa.ajax('/TbUnit/getList', {
- pageNo: 1,
- pageSize: 50
- }, function (resp) {
- this.unitList = resp.data;
- }.bind(this))
- },
- addPeopleFn(itemId, num, show) {
- sa.ajax('/TbBusinessPeople/getList', {
- businessId: this.id
- }, function (resp) {
- let list = resp.data;
- let index = 0;
- let r = [];
- for (let i in list) {
- r.push({
- name: list[i].name,
- phone: list[i].phone,
- index: index,
- id: list[i].id
- })
- index++;
- }
- this.modal.list = r;
- }.bind(this));
- this.modal.itemId = itemId;
- this.modal.num = num;
- this.modal.visible = show;
- },
- showAddModal() {
- Object.assign(this.addModal, {
- visible: true,
- form: {
- index: -1,
- name: '',
- phone: '',
- itemId: this.modal.itemId,
- ticket: ''
- }
- })
- },
- cancelAdd() {
- this.modal.list = [];
- this.modal.visible = false;
- },
- confirmAdd() {
- if (!this.addModal.form.name) {
- sa.error('请输入检测人姓名')
- return false;
- }
- let phone = this.addModal.form.phone;
- if (phone && !sa.isPhone(phone)) {
- sa.error('检测人联系号码不正确')
- return false;
- }
- let dbIndex = this.addModal.form.index;
- if (dbIndex >= 0) {
- this.modal.list[dbIndex].name = this.addModal.form.name;
- this.modal.list[dbIndex].phone = this.addModal.form.phone;
- } else {
- this.addModal.form.index = this.modal.list.length;
- this.modal.list.push(this.addModal.form);
- }
- this.addModal.visible = false;
- },
- editFn(data) {
- Object.assign(this.addModal, {
- visible: true,
- form: data
- })
- },
- deleteFn(data) {
- this.modal.list.splice(data.index, 1);
- if (data.id) {
- sa.ajax('/TbBusinessPeople/deleteById', {
- id: data.id
- }, function (resp) {
- }.bind(this))
- }
- },
- getGoods() {
- sa.ajax('/TbGoods/getList', {
- pageNo: 1,
- pageSize: 10,
- businessType: 2
- }, function (resp) {
- this.goodsList = resp.data;
- }.bind(this))
- },
- getItemTypeList() {
- sa.ajax('/TbItemType/getList', {
- business: 1
- }, function (resp) {
- let typeList = resp.data;
- // 初始化数据
- sa.ajax('/TbBusiness/getById?id=' + this.id, function (res) {
- let m = res.data;
- let items = m.items;
- this.china.list = m.cars.filter(obj => obj.carNo !== m.cardNo);
- let hsItem = items.filter(obj => obj.itemTypeName.indexOf('人') !== -1 &&
- obj.itemTypeName.indexOf('核酸') !== -1);
- if (hsItem.length > 0) {
- this.addPeopleFn(hsItem[0].itemTypeId, false)
- }
- for (let i in items) {
- let item = items[i];
- for (let j in typeList) {
- let type = typeList[j];
- if (item.itemTypeId == type.id) {
- type.itemId = item.itemId;
- type.num = item.num;
- }
- }
- }
- this.m = m;
- this.itemTypeList = typeList;
- this.goodsChange(m.goodsName);
- }.bind(this))
- }.bind(this))
- },
- queryCaSizerAsync(queryStr, cb) {
- let list = this.unitList;
- let filterList = list.filter(obj => obj.unit.indexOf(queryStr) !== -1);
- cb(filterList)
- },
- handleSelectCarSize(item) {
- this.m.cardSize = item.unit;
- },
- getCustomer() {
- sa.ajax('/TbCostomer/getCurrentCustomerId', function (resp) {
- let id = resp.data;
- if (id == 1) {
- } else {
- this.m.customerId = id;
- }
- this.currentCustomerId = id;
- }.bind(this));
- },
- closeFn() {
- parent.app.f5();
- sa.closeCurrIframe();
- },
- // 提交数据
- ok: function () {
- // 表单校验
- let m = this.m;
- sa.checkNull(m.goodsName, '请选择运输货物');
- sa.checkNull(m.cardNo, '请输入 [车牌号]');
- if (!m.cardSize || !sa.isNum(m.cardSize)) {
- sa.error('车辆规格只能输入数字')
- return;
- }
- if (!sa.isNum(m.netWeight)) {
- sa.error('载重只能输入数字')
- return;
- }
- let typeList = this.itemTypeList.filter(obj => obj.itemId);
- let needIds = this.needTypeId;
- for (let i in needIds) {
- if (typeList.map(obj => obj.id).indexOf(needIds[i]) == -1) {
- sa.error('缺少必选业务');
- return false;
- }
- }
- let list = [];
- if (typeList.length == 0) {
- sa.error('至少选择一项业务');
- return false;
- }
- for (let i in typeList) {
- let type = typeList[i];
- list.push({
- itemId: type.itemId,
- num: type.num
- })
- }
- if (typeList.filter(obj => obj.name.indexOf('人') !== -1 && obj.name.indexOf('核酸') !== -1)
- .length > 0 &&
- this.modal.list
- .length == 0) {
- sa.error('请添加核酸检测人员');
- return false;
- }
- m.itemJson = JSON.stringify(list);
- m.peopleJson = JSON.stringify(this.modal.list);
- m.carJson = JSON.stringify(this.china.list);
- m.items = [];
- m.cars = [];
- if (this.id <= 0) { // 添加
- sa.ajax('/TbBusiness/add', m, function (res) {
- sa.alert('增加成功', this.clean);
- }.bind(this));
- } else { // 修改
- sa.ajax('/TbBusiness/update', m, function (res) {
- sa.alert('修改成功', this.clean);
- }.bind(this));
- }
- },
- // 添加/修改 完成后的动作
- clean: function () {
- parent.app.f5(); // 刷新父页面列表
- this.modal.list = [];
- if (this.id == 0) {
- this.m = this.createModel();
- } else {
- sa.closeCurrIframe(); // 关闭本页
- }
- }
- },
- mounted: function () {
- this.getCustomer();
- this.getItemTypeList();
- this.getGoods();
- this.getUnitList();
- },
- beforeDestroy() {
- parent.app.f5();
- }
- })
- </script>
- </body>
- </html>
|