| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290 |
- <!--费用模板详情-->
- <template>
- <div class="borderless" v-loading="pageLoading">
- <div class="customer-head">
- <div class="customer-back">
- <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList">返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button size="small" type="primary" style="margin-right: 8px" v-if="basicData.disabled"
- :loading="saveLoading" @click="editHandle">编 辑
- </el-button>
- <el-button size="small" type="primary" style="margin-right: 8px" v-else :loading="saveLoading"
- @click="editCustomer">保 存
- </el-button>
- </div>
- </div>
- <div class="customer-main">
- <containerTitle title="基础信息"></containerTitle>
- <basic-container>
- <avue-form :option="basicData" v-model="form" ref="form">
- <tempalte slot="shippingCompanyCname">
- <dic-select v-model="form.shippingCompanyCname" placeholder="港口" key="id" label="cnName"
- url="/blade-los/bcorps/listAll?status=0&corpTypeName=船公司" :filterable="true"
- dataName="cnName" :multiple="true" :collapseTags="true" dataType="string"
- :disabled="basicData.disabled" @selectChange="dicChange('shippingCompanyCname', $event)"
- :multipleStrings="true"></dic-select>
- </tempalte>
- <tempalte slot="branchName">
- <dic-select v-model="form.branchName" placeholder="所属公司" key="id" label="deptName"
- url="/blade-system/dept/top-list" :filterable="true" :multiple="true" :collapseTags="true"
- dataType="string" :disabled="basicData.disabled"
- @selectChange="dicChange('branchName', $event)" :multipleStrings="true"></dic-select>
- </tempalte>
- <tempalte slot="addressCname">
- <dic-select v-model="form.addressCname" placeholder="" key="id" label="cnName" res="records"
- url="/blade-los/bports/list" :filterable="true" :remote="true" dataName="cnName"
- @selectChange="dicChange('addressCname', $event)"
- :disabled="basicData.disabled"></dic-select>
- </tempalte>
- </avue-form>
- </basic-container>
- </div>
- <div class="customer-main margintop">
- <containerTitle title="费用详情"></containerTitle>
- <basic-container>
- <avue-crud :option="option" :data="form.feesTemplateItemsList" id="out-table" ref="crud"
- :header-cell-class-name="headerClassName" :row-style="{ height: '20px', padding: '0px' }"
- :cell-style="{ height: '20px', padding: '0px' }">
- <template slot="indexHeader" slot-scope="{row,index}">
- <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="basicData.disabled" circle
- @click="feestemplatepingCompanyAdd()">
- </el-button>
- </template>
- <template slot="index" slot-scope="{row,index}">
- <span>{{ index + 1 }}</span>
- </template>
- <template slot="corpCnNameForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.corpCnName" label="cnName" res="records"
- url="/blade-los/bcorps/selectList?status=0¤t=1&size=20" :filterable="true"
- :remote="true" dataName="cnName" :disabled="row.corpType"
- @selectChange="rowDicChange('corpCnName', $event, row)"></dic-select>
- <span v-else>{{ row.corpCnName }}</span>
- </template>
- <template slot="corpTypeForm" slot-scope="{row,index}">
- <dic-select v-if="row.$cellEdit" v-model="row.corpType" label="cnName" res="records"
- :disabled="row.corpCnName" url="/blade-los/bcorpstypedefine/list?status=0¤t=1&size=20"
- :filterable="true" :remote="true" dataName="cnName"
- @selectChange="rowDicChange('corpType', $event, row)"></dic-select>
- <span v-else>{{ row.corpType }}</span>
- </template>
- <template slot="feeCnNameForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" key="id" placeholder="费用名称"
- label="cnName" res="records" url="/blade-los/bfees/list?status=0¤t=1&size=20"
- :filterable="true" :remote="true" dataName="cnName"
- @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
- <span v-else>{{ row.feeCnName }}</span>
- </template>
- <template slot="quantityRuleForm" slot-scope="{row,index}">
- <dic-select v-if="row.$cellEdit" v-model="row.quantityRule" key="id" label="dictValue"
- url="/blade-system/dict-biz/dictionary?code=number_rule" :filterable="true"
- @selectChange="rowDicChange('quantityRule', $event, row)"></dic-select>
- <span v-else>{{ row.quantityRule }}</span>
- </template>
- <template slot="unitNoForm" slot-scope="{row,index}">
- <dic-select v-if="row.$cellEdit" v-model="row.unitNo" key="id" label="cnName"
- url="/blade-los/bunits/listAll" :filterable="true" :disabled="row.quantityRule == '按箱型'"
- @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
- <span v-else>{{ row.unitNo }}</span>
- </template>
- <template slot="quantityForm" slot-scope="{row,index}">
- <el-input-number style="width: 100%;" v-if="row.$cellEdit" v-model="row.quantity"
- :disabled="row.quantityRule == '按箱型'" :controls="false" size="small"></el-input-number>
- <span v-else>{{ row.quantity }}</span>
- </template>
- <template slot="priceForm" slot-scope="{row,index}">
- <el-input-number style="width: 100%;" v-if="row.$cellEdit" v-model="row.price"
- :disabled="row.quantityRule == '按箱型'" :controls="false" size="small"></el-input-number>
- <span v-else>{{ row.price }}</span>
- </template>
- <template slot="curCodeForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" :disabled="row.quantityRule == '按箱型'" v-model="row.curCode" placeholder="币别" label="dictValue"
- url="/blade-system/dict-biz/dictionary?code=currency"></dic-select>
- <span v-else>{{ row.curCode }}</span>
- </template>
- <template slot="menu" slot-scope="{ row, index }">
- <!-- <el-button type="text" size="small" :disabled="basicData.disabled"
- @click="feestemplateCompanyEdit(index, row)">详情</el-button> -->
- <el-button v-if="row.quantityRule == '按箱型'" type="text" size="small"
- :disabled="basicData.disabled" @click="feestemplateCompanyEdit(index, row)">集装箱</el-button>
- <el-button size="small" type="text" :disabled="basicData.disabled" @click="rowCell(row, index)">
- {{ row.$cellEdit ? '保存' : '编辑' }}
- </el-button>
- <el-button size="small" type="text" :disabled="basicData.disabled"
- @click="feestemplateCompanyDelete(index, row)">删除</el-button>
- <el-button type="text" size="small" :disabled="basicData.disabled"
- @click="copyItem(index, row)">复制</el-button>
- </template>
- </avue-crud>
- </basic-container>
- </div>
- <!--费用详细添加弹窗-->
- <el-dialog title="费用详情" :visible.sync="feestemplateVisible" width="60%" append-to-body :destroy-on-close="true"
- :modal-append-to-body="false" :close-on-click-modal="false" :before-close="feestemplateClose">
- <div>
- <avue-crud :option="sonOption" :data="feestemplateForm.sonItemsList">
- <template slot="indexHeader" slot-scope="{row,index}">
- <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="basicData.disabled" circle
- @click="addRow()">
- </el-button>
- </template>
- <template slot="index" slot-scope="{row,index}">
- <span>{{ index + 1 }}</span>
- </template>
- <template slot="typeForm" slot-scope="{row,index}">
- <dic-select v-if="row.$cellEdit" v-model="row.type" key="id" label="dictValue"
- url="/blade-system/dict-biz/dictionary?code=corp_type" :filterable="true"></dic-select>
- <span v-else>{{ row.type }}</span>
- </template>
- <template slot="feeCnNameForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" key="id" placeholder="箱型"
- label="cnName" res="records" url="/blade-los/bfees/list?status=0¤t=1&size=20"
- :filterable="true" :remote="true" dataName="cnName"
- @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
- <span v-else>{{ row.feeCnName }}</span>
- </template>
- <template slot="unitNoForm" slot-scope="{row,index}">
- <span>
- <dic-select
- v-if="row.$cellEdit && (feestemplateForm.quantityRule == '按箱型' || feestemplateForm.quantityRule == '按TEU')"
- v-model="row.unitNo" key="id" label="cnName" res="records"
- url="/blade-los/bcntrtypes/list?status=0¤t=1&size=20" :filterable="true"
- :remote="true" dataName="cnName"
- @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
- <dic-select
- v-if="row.$cellEdit && !(feestemplateForm.quantityRule == '按箱型' || feestemplateForm.quantityRule == '按TEU')"
- v-model="row.unitNo" key="id" label="cnName" res="records"
- url="/blade-los/bunits/list?status=0¤t=1&size=20" :filterable="true"
- :remote="true" dataName="cnName"
- @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
- <span v-if="!row.$cellEdit">{{ row.unitNo }}</span>
- </span>
- </template>
- <template slot="menu" slot-scope="{ row, index }">
- <el-button size="small" type="text" :disabled="basicData.disabled" @click="rowEdit(row, index)">
- {{ row.$cellEdit ? '保存' : '编辑' }}
- </el-button>
- <el-button type="text" size="small" :disabled="basicData.disabled"
- @click="rowDel(index, row)">删除</el-button>
- </template>
- </avue-crud>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="feestemplateVisible = false;">取 消</el-button>
- <el-button type="primary" @click="feestemplatecompanyConfirm">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import { losbfeestemplateDetail, losbfeestemplateSubmit, copytemplateDetail, itemRemove, remove, getListAll } from "@/api/iosBasicData/losbfeestemplate";
- import { bfeesList } from "@/api/iosBasicData/bfees";
- import { getBcorpsList } from "@/api/iosBasicData/bcorps";
- import { getRateList } from "@/api/iosBasicData/rateManagement";
- import { getBunitsList } from "@/api/iosBasicData/bunits";
- import SearchQuery from '@/components/iosbasic-data/searchquery.vue'
- import bcorps from "@/views/iosBasicData/bcorps/index.vue";
- import bfeesdefine from "@/views/iosBasicData/bfeesdefine/index.vue";
- import bbusinesstype from "@/views/iosBasicData/bbusinesstype/index.vue";
- import bunits from "@/views/iosBasicData/bunits/index.vue";
- import { getWorkDicts } from "@/api/system/dictbiz";
- import { bcntrtypesList } from "@/api/iosBasicData/bcntrtypes";
- import dicSelect from "@/components/dicSelect/main";
- export default {
- components: { SearchQuery, bcorps, bfeesdefine, bbusinesstype, bunits, dicSelect },
- props: {
- detailData: {
- type: Object
- }
- },
- data() {
- return {
- deptId: JSON.parse(localStorage.getItem('sysitemData')).deptId,
- unitNoListAll: [],
- sonOption: {
- calcHeight: 30,
- // tip: false,
- border: true,
- // addBtn: false,
- // viewBtn: false,
- editBtn: false,
- delBtn: false,
- // refreshBtn: false,
- // selection: true,
- header: false,
- align: 'center',
- menu: true,
- menuWidth: 100,
- column: [
- {
- label: "index",
- prop: "index",
- width: "55",
- headerslot: true,
- },
- {
- label: '计量单位',
- prop: 'unitNo',
- overHidden: true,
- cell: true,
- slot: true,
- formslot: true,
- },
- {
- label: '单价',
- prop: 'salesPrice',
- cell: true,
- type: 'number',
- controls: false,
- overHidden: true,
- },
- //{
- // label: '成本价',
- // prop: 'costPrice',
- // cell: true,
- // type: 'number',
- // controls: false,
- // overHidden: true,
- //},
- {
- label: '币种',
- prop: 'curCode',
- overHidden: true,
- cell: true,
- type: 'select',
- dicData: [{
- label: 'CNY',
- value: 'CNY'
- }, {
- label: 'USD',
- value: 'USD'
- }],
- },
- ]
- },
- pageLoading: false,
- saveLoading: false,
- // 费用详细弹窗
- feestemplateVisible: false,
- // 费用详细弹窗绑定的数据
- feestemplateForm: {
- sonItemsList: []
- },
- feestemplateIndex: null,
- // 客户请求数据
- corpData: [],
- // 费用请求数据
- feeData: [],
- // 数量规则字典数据
- quantityRuleData: [],
- //客户类型
- corpTypeData: [],
- // 币别请求数据
- curCodeData: [],
- // 计算属性数据
- unitNoData: [],
- // 获取到的数据
- form: {
- isShared: '1',
- status: 0,
- feesTemplateItemsList: []
- },
- // 基础资料数据
- basicData: {
- menuBtn: false,
- span: 8,
- disabled: false,
- labelWidth: 100,
- column: [
- {
- label: "模版编号",
- prop: "code",
- disabled: false,
- rules: [{
- required: true,
- message: "请输入模版编号",
- trigger: "blur"
- }]
- },
- {
- label: "模版中文名称",
- prop: "cnName",
- disabled: false,
- rules: [{
- required: true,
- message: "请输入模版中文名称",
- trigger: "blur"
- }]
- },
- {
- label: "模版英文名称",
- prop: "enName",
- disabled: false,
- rules: [{
- required: true,
- message: "请输入模版英文名称",
- trigger: "blur"
- }]
- },
- {
- label: "船公司",
- prop: "shippingCompanyCname",
- disabled: false,
- rules: [{
- required: true,
- message: "请输入模版英文名称",
- trigger: "blur"
- }]
- },
- {
- label: "所属公司",
- prop: "branchName",
- disabled: false,
- rules: [{
- required: true,
- message: "请选择所属公司",
- trigger: "blur"
- }]
- },
- {
- label: "POL",
- prop: "addressCname",
- disabled: false,
- },
- {
- label: "运输条款",
- prop: "transportationTerms",
- disabled: false,
- type: 'select',
- filterable: true,
- remote: true,
- dicUrl: "/api/blade-los/bserviceterms/list?status=0¤t=1&size=20&cnName={{key}}",
- props: {
- label: 'cnName',
- value: 'cnName',
- res: 'data.records'
- },
- },
- {
- label: "收/付",
- prop: "dc",
- disabled: false,
- type: 'select',
- dicData: [{
- label: '收',
- value: 'D'
- }, {
- label: '付',
- value: 'C'
- }],
- rules: [{
- required: true,
- message: "请选择收/付",
- trigger: "blur"
- }]
- },
- {
- label: "状态",
- prop: "status",
- disabled: false,
- type: 'select',
- dicData: [{
- label: '启用',
- value: 0
- }, {
- label: '停用',
- value: 1
- }],
- },
- {
- label: "备注",
- prop: "remarks",
- disabled: false,
- span: 24,
- type: 'textarea',
- minRows: 3,
- },
- ]
- },
- option: {
- // height: 'auto',
- calcHeight: 30,
- menuWidth: 200,
- border: true,
- header: false,
- editBtn: false,
- delBtn: false,
- align: 'center',
- menu: true,
- column: [
- {
- label: "index",
- prop: "index",
- width: "55",
- headerslot: true,
- },
- {
- label: "客户",
- prop: "corpCnName",
- width: "120",
- overHidden: true,
- cell: true,
- slot: true,
- formslot: true,
- },
- {
- label: "客户类型",
- prop: "corpType",
- width: "120",
- overHidden: true,
- cell: true,
- slot: true,
- formslot: true,
- },
- {
- label: "客户英文",
- prop: "corpEnName",
- width: "80",
- overHidden: true,
- },
- {
- label: "费用名称",
- prop: "feeCnName",
- width: "120",
- overHidden: true,
- cell: true,
- slot: true,
- formslot: true,
- rules: [{
- required: true,
- message: "请选择费用名称",
- trigger: "blur"
- }]
- },
- {
- label: "费用编码",
- prop: "feeCode",
- width: "80",
- overHidden: true,
- },
- {
- label: "费用英文",
- prop: "feeEnName",
- width: "80",
- overHidden: true,
- },
- {
- label: "数量规则",
- prop: "quantityRule",
- width: "120",
- overHidden: true,
- cell: true,
- slot: true,
- formslot: true,
- rules: [{
- required: true,
- message: "请选择数量规则",
- trigger: "blur"
- }]
- },
- {
- label: "数量",
- prop: "quantity",
- width: "80",
- cell: true,
- slot: true,
- formslot: true,
- // cell: true,
- // type: 'number',
- // controls: false,
- overHidden: true,
- rules: [{
- required: true,
- message: "请输入数量",
- trigger: "blur"
- }]
- },
- {
- label: "单价",
- prop: "price",
- width: "80",
- cell: true,
- slot: true,
- formslot: true,
- // cell: true,
- // type: 'number',
- // controls: false,
- overHidden: true,
- rules: [{
- required: true,
- message: "请输入单价",
- trigger: "blur"
- }]
- },
- {
- label: "计量单位",
- prop: "unitNo",
- width: "120",
- overHidden: true,
- cell: true,
- slot: true,
- formslot: true,
- rules: [{
- required: true,
- message: "请选择计量单位",
- trigger: "blur"
- }]
- },
- {
- label: "币别",
- prop: "curCode",
- width: "100",
- cell: true,
- slot: true,
- formslot: true,
- // cell: true,
- // type: 'select',
- // dicData: [{
- // label: 'CNY',
- // value: 'CNY'
- // }, {
- // label: 'USD',
- // value: 'USD'
- // }],
- overHidden: true,
- rules: [{
- required: true,
- message: "请选择币别",
- trigger: "blur"
- }]
- },
- {
- label: "备注",
- prop: "remarks",
- width: "120",
- cell: true,
- overHidden: true,
- }
- ]
- },
- // 费用详细数据
- feestemplateData: {
- column: [
- {
- label: "客户类型",
- prop: "corpType",
- },
- {
- label: "客户",
- prop: "corpCnName",
- // rules: [{
- // required: true,
- // message: "",
- // trigger: "blur"
- // }]
- },
- {
- label: "费用",
- prop: "feeCnName",
- rules: [{
- required: true,
- message: "",
- trigger: "blur"
- }]
- },
- {
- label: "费用编码",
- prop: "feeCode",
- disabled: true,
- },
- // {
- // label: "费用中文名称",
- // prop: "feeCnName",
- // disabled:true,
- // },
- {
- label: "费用英文名称",
- prop: "feeEnName",
- disabled: true,
- },
- {
- label: "数量规则",
- prop: "quantityRule",
- rules: [{
- required: true,
- message: "请输入数量规则,用于根据单位自动计算数量",
- trigger: "blur"
- }]
- },
- {
- label: "数量",
- prop: "quantity",
- rules: [{
- required: true,
- // message: "请输入数量",
- trigger: "blur"
- }, {
- pattern: /-?[1-9]\d*/,
- // message:"请输入数字",
- trigger: 'blur'
- }]
- },
- {
- label: "单价",
- prop: "price",
- rules: [{
- required: true,
- // message: "请输入单价",
- trigger: "blur"
- }, {
- // pattern:/[1-9]\d*.\d*|0\.\d*[1-9]\d*/,
- pattern: /-?[1-9]\d*/,
- // message:"请输入数字",
- trigger: 'blur'
- }]
- },
- {
- label: "计量单位",
- prop: "unitNo",
- rules: [{
- required: true,
- // message: "请输入计量单位",
- trigger: "blur"
- }]
- },
- {
- label: "币别",
- prop: "curCode",
- rules: [{
- required: true,
- // message: "请输入币别",
- trigger: "blur"
- }]
- },
- {
- label: "备注",
- prop: "remarks",
- span: 24,
- type: 'textarea',
- minRows: 3,
- },
- ]
- },
- }
- },
- created() {
- if (this.detailData.businessTypeId) {
- this.form = {
- status: 0,
- businessTypeId: this.detailData.businessTypeId,
- businessTypeCnName: this.detailData.businessTypeCnName,
- businessTypeEnName: this.detailData.businessTypeEnName,
- businessTypeCode: this.detailData.businessTypeCode
- }
- if (this.detailData.businessTypeCnName == '成本中心模板(POL)' || this.detailData.businessTypeCnName == '账单模版(POL)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'POL'
- }
- })
- } else if (this.detailData.businessTypeCnName == '账单模板(POD)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'POD'
- }
- })
- } else if (this.detailData.businessTypeCnName == '航线成本(SOC)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'SOC'
- }
- })
- } else if (this.detailData.businessTypeCnName == '成本中心模板(POD)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'POD'
- }
- })
- } else if (this.detailData.businessTypeCnName == '航线成本(COC)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'COC'
- }
- })
- }
- }
- this.getBcorpsListfun()
- this.bfeesListfun()
- this.quantityRuleWorkDictsfun()
- this.getRateListfun()
- this.getBunitsListfun()
- this.getcorpTypeData()
- getListAll().then(res => {
- this.unitNoListAll = res.data.data
- })
- if (this.detailData.id) {
- this.basicData.disabled = true
- this.losbfeestemplateDetailfun(this.detailData.id)
- }
- },
- methods: {
- rowCell(row, index) {
- if (!row.feeCnName || !row.quantityRule || !row.quantity || !row.price || !row.unitNo || !row.curCode) {
- this.$refs.crud.rowCell(row, index)
- return this.$message.error("请完善明细信息");
- }
- if (row.$cellEdit == true) {
- this.$set(row, "$cellEdit", false);
- } else {
- this.$set(row, "$cellEdit", true);
- }
- },
- rowEdit(row) {
- if (row.$cellEdit == true) {
- this.$set(row, "$cellEdit", false);
- } else {
- this.$set(row, "$cellEdit", true);
- }
- },
- rowDicChange(name, row, el) {
- if (name == 'corpCnName') {
- if (row) {
- el.corpId = row.id
- el.corpEnName = row.enName
- } else {
- el.corpId = null
- el.corpEnName = null
- el.corpCnName = null
- }
- }
- if (name == 'feeCnName') {
- if (row) {
- el.feeId = row.id
- el.feeCode = row.code
- el.feeEnName = row.enName
- } else {
- el.feeId = null
- el.feeCode = null
- el.feeCnName = null
- el.feeEnName = null
- }
- }
- if (name == 'unitNo') {
- if (row) {
- el.unitId = row.id
- } else {
- el.unitId = null
- el.unitNo = null
- }
- }
- if (name == 'corpType') {
- if (!row) {
- el.corpType = null
- }
- }
- // if (name == 'quantityRule') {
- // if (row) {
- // console.log(row,)
- // for (let item of this.unitNoListAll) {
- // if (item.cnName == '箱量') {
- // el.unitId = item.id
- // el.unitNo = item.cnName
- // }
- // }
- // } else {
- // el.unitId = null
- // el.unitNo = null
- // }
- // }
- },
- dicChange(name, row) {
- if (name == 'shippingCompanyCname') {
- console.log(row)
- let codes = []
- // let namePrints=[]
- for (let item of row.multipleData) {
- codes.push(item.code)
- }
- if (row) {
- this.form.shippingCompanyId = row.ids
- this.form.shippingCompanyCname = row.names
- this.form.shippingCompanyCode = codes.join(',');
- } else {
- this.form.shippingCompanyId = null
- this.form.shippingCompanyCode = null
- this.form.shippingCompanyCname = null
- }
- }
- if (name == 'addressCname') {
- if (row) {
- this.form.addressId = row.id
- this.form.addressCode = row.code
- } else {
- this.form.podId = null
- this.form.addressCode = null
- this.form.addressCname = null
- }
- }
- if (name == 'branchName') {
- if (row) {
- this.form.branchId = row.ids
- this.form.branchName = row.names
- } else {
- this.form.branchId = null
- this.form.branchName = null
- }
- }
- },
- addRow() {
- this.feestemplateForm.sonItemsList.push({
- pid: this.form.id,
- type: this.feestemplateForm.corpType,
- feeId: this.feestemplateForm.feeId,
- feeCode: this.feestemplateForm.feeCode,
- feeCnName: this.feestemplateForm.feeCnName,
- feeEnName: this.feestemplateForm.feeEnName,
- curCode: this.feestemplateForm.curCode,
- salesPrice: 0,
- costPrice: 0,
- $cellEdit: true
- })
- },
- copyItem(index, row) {
- let item = this.deepClone(row)
- item.id = null;
- // item.pid = null;
- // this.feestemplateForm = item
- // this.feestemplateVisible = true
- this.form.feesTemplateItemsList.push(item)
- },
- getCopyTemplate(id) {
- this.pageLoading = true
- copytemplateDetail(id).then(res => {
- this.form = res.data.data;
- this.pageLoading = false
- this.editHandle()
- })
- },
- // 获取客户数据
- getBcorpsListfun(cnName) {
- getBcorpsList(1, 10, { cnName }).then(res => {
- this.corpData = res.data.data.records
- })
- },
- bfeesListfun(cnName) {
- bfeesList(1, 10, { cnName }).then(res => {
- this.feeData = res.data.data.records
- })
- },
- getcorpTypeData() {
- getWorkDicts('corp_type').then(res => {
- this.corpTypeData = res.data.data
- })
- },
- // 获取数量规则字典数据
- quantityRuleWorkDictsfun() {
- getWorkDicts('number_rule').then(res => {
- this.quantityRuleData = res.data.data
- })
- },
- // 获取币别数据
- getRateListfun(cnName) {
- getRateList({
- current: 1,
- size: 10,
- cnName
- }).then(res => {
- this.curCodeData = res.data.data.records
- })
- },
- // 获取计算属性
- getBunitsListfun(code) {
- if (this.feestemplateForm.quantityRule == 1 || this.feestemplateForm.quantityRule == 4) {
- bcntrtypesList(1, 10, { code, status: 0 }).then(res => {
- this.unitNoData = res.data.data.records
- })
- } else {
- getBunitsList(1, 10, { code, status: 0 }).then(res => {
- this.unitNoData = res.data.data.records
- })
- }
- },
- // 客户选择之后的回调
- corpCorpChange(value) {
- if (value) {
- for (let item of this.corpData) {
- if (item.cnName == value) {
- this.$set(this.feestemplateForm, 'corpId', item.id)
- this.$set(this.feestemplateForm, 'corpEnName', item.enName)
- this.$set(this.feestemplateForm, 'corpCnName', item.cnName)
- }
- }
- } else {
- this.$set(this.feestemplateForm, 'corpId', null)
- this.$set(this.feestemplateForm, 'corpEnName', null)
- this.$set(this.feestemplateForm, 'corpCnName', null)
- }
- },
- // 费用选择之后的回调
- feeCorpChange(value) {
- for (let item of this.feeData) {
- if (item.id == value) {
- this.$set(this.feestemplateForm, 'feeId', item.id)
- this.$set(this.feestemplateForm, 'feeCode', item.code)
- this.$set(this.feestemplateForm, 'feeEnName', item.enName)
- this.$set(this.feestemplateForm, 'feeCnName', item.cnName)
- // 核算要素
- this.$set(this.feestemplateForm, 'elementsId', item.accElementId)
- this.$set(this.feestemplateForm, 'elementsCnName', item.accElementName)
- this.$set(this.feestemplateForm, 'elementsCode', item.elementsCode)
- this.$set(this.feestemplateForm, 'elementsEnName', item.elementsEnName)
- }
- }
- },
- corpTypeChange(value) {
- if (value) {
- this.$set(this.feestemplateForm, 'corpType', value)
- } else {
- this.$set(this.feestemplateForm, 'corpType', null)
- }
- },
- // 数量规则下拉回调
- quantityRuleChange(value) {
- console.log(value)
- if (value == 1 || value == 4) {
- bcntrtypesList(1, 10, { status: 0 }).then(res => {
- this.unitNoData = res.data.data.records
- })
- } else {
- getBunitsList(1, 10, { status: 0 }).then(res => {
- this.unitNoData = res.data.data.records
- })
- }
- this.$set(this.feestemplateForm, 'quantityRule', value)
- this.$set(this.feestemplateForm, 'unitNo', '')
- },
- // 币别选择之后的回调
- curCodeCorpChange(value) {
- this.$set(this.feestemplateForm, 'curCode', value)
- },
- // 计算属性选择之后
- unitNoCorpChange(value) {
- for (let item of this.unitNoData) {
- if (item.code == value) {
- this.$set(this.feestemplateForm, 'unitId', item.id)
- this.$set(this.feestemplateForm, 'unitNo', item.code)
- }
- }
- },
- // 查找弹窗里选择导出
- eldialogConfirm(name) {
- console.log(name)
- if (name == 'corpCnName') {
- if (this.$refs.bcorps[0].isShow) {
- console.log('列表确认')
- this.$set(this.feestemplateForm, 'corpId', this.$refs.bcorps[0].selectionList[0].id)
- this.$set(this.feestemplateForm, 'corpEnName', this.$refs.bcorps[0].selectionList[0].enName)
- this.$set(this.feestemplateForm, 'corpCnName', this.$refs.bcorps[0].selectionList[0].cnName)
- } else {
- console.log('详情确认')
- this.$refs.bcorps[0].$refs.detail.submitForm()
- this.$set(this.feestemplateForm, 'corpCnName', this.$refs.bcorps[0].$refs.detail.formData.cnName)
- this.$set(this.feestemplateForm, 'corpEnName', this.$refs.bcorps[0].$refs.detail.formData.enName)
- this.$set(this.feestemplateForm, 'corpId', this.$refs.bcorps[0].$refs.detail.formData.id)
- }
- this.$refs.SearchCorp[0].corpVisible = false
- } else if (name == 'feeCnName') {
- this.$set(this.feestemplateForm, 'feeId', this.$refs.bfeesdefine[0].selectionList[0].id)
- this.$set(this.feestemplateForm, 'feeCode', this.$refs.bfeesdefine[0].selectionList[0].code)
- this.$set(this.feestemplateForm, 'feeEnName', this.$refs.bfeesdefine[0].selectionList[0].enName)
- this.$set(this.feestemplateForm, 'feeCnName', this.$refs.bfeesdefine[0].selectionList[0].cnName)
- // 核算要素
- this.$set(this.feestemplateForm, 'elementsId', this.$refs.bfeesdefine[0].selectionList[0].accElementId)
- this.$set(this.feestemplateForm, 'elementsCnName', this.$refs.bfeesdefine[0].selectionList[0].accElementName)
- this.$set(this.feestemplateForm, 'elementsCode', this.$refs.bfeesdefine[0].selectionList[0].elementsCode)
- this.$set(this.feestemplateForm, 'elementsEnName', this.$refs.bfeesdefine[0].selectionList[0].elementsEnName)
- this.$refs.SearchFee[0].corpVisible = false
- } else if (name == 'unitNo') {
- this.$set(this.feestemplateForm, 'unitId', this.$refs.bunits[0].selectionList[0].id)
- this.$set(this.feestemplateForm, 'unitNo', this.$refs.bunits[0].selectionList[0].code)
- this.$refs.SearchUnitNo[0].corpVisible = false
- }
- },
- // 下拉多选弹窗数据多选回调
- eldialogMultipleChoice(list, name) {
- console.log(list, name)
- let arr = []
- if (list.length > 1) {
- this.$refs[name][0].$refs.crud.toggleSelection() // 先清空所以选择的数据
- arr = [list[list.length - 1]] // 获取最新点击的数组
- this.$refs[name][0].$refs.crud.toggleSelection(arr, true) // 把刚点击的数组变成选择状态
- } else {
- arr = list
- }
- this.$refs[name][0].selectionList = arr
- },
- // 获取详情数据
- losbfeestemplateDetailfun(id) {
- this.pageLoading = true
- losbfeestemplateDetail(id).then(res => {
- if (res.data.data.businessTypeCnName == '成本中心模板(POL)' || res.data.data.businessTypeCnName == '账单模版(POL)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'POL'
- }
- })
- } else if (res.data.data.businessTypeCnName == '账单模板(POD)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'POD'
- }
- })
- } else if (res.data.data.businessTypeCnName == '航线成本(SOC)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'SOC'
- }
- })
- } else if (res.data.data.businessTypeCnName == '成本中心模板(POD)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'POD'
- }
- })
- } else if (res.data.data.businessTypeCnName == '航线成本(COC)') {
- this.basicData.column.forEach(item => {
- if (item.prop == 'addressCname') {
- item.label = 'COC'
- }
- })
- }
- res.data.data.feesTemplateItemsList.forEach(item => {
- item.corpCnName = item.corpCnName ? item.corpCnName : null
- item.corpType = item.corpType ? item.corpType : null
- })
- this.form = res.data.data;
- }).finally(() => {
- this.pageLoading = false
- })
- },
- // 编辑按钮更改状态
- editHandle() {
- this.basicData.disabled = false;
- },
- // 保存按钮
- editCustomer() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- this.losbfeestemplateSubmitfun()
- } else {
- return false;
- }
- })
- },
- // 保存接口
- losbfeestemplateSubmitfun() {
- this.saveLoading = true
- losbfeestemplateSubmit(this.form).then((res) => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.losbfeestemplateDetailfun(res.data.data.id)
- // this.basicData.disabled = true;
- }).finally(() => {
- this.saveLoading = false;
- })
- },
- // 费用详细添加
- feestemplatepingCompanyAdd() {
- if (!this.form.id) {
- this.$message({
- type: "error",
- message: "请保存数据!"
- });
- return
- }
- this.form.feesTemplateItemsList.push({
- quantity: 1,
- price: 1,
- quantityRule: '按箱型',
- curCode: 'CNY',
- unitNo: '20GP',
- sonItemsList: [],
- $cellEdit: true
- })
- // this.feestemplateForm = {
- // quantity: 1,
- // price: 1,
- // curCode: 'CNY',
- // unitNo: 'KGS',
- // sonItemsList: []
- // }
- // this.feestemplateVisible = true
- },
- // 费用详细编辑
- feestemplateCompanyEdit(index, row) {
- if (!row.feeCnName || !row.quantityRule || !row.quantity || !row.price || !row.unitNo || !row.curCode) {
- this.$refs.crud.rowCell(row, index)
- return this.$message.error("请完善明细信息");
- }
- this.feestemplateForm = JSON.parse(JSON.stringify(row))
- this.feestemplateIndex = index
- this.feestemplateVisible = true
- },
- // 费用详细删除
- feestemplateCompanyDelete(index, row) {
- if (row.id) {
- itemRemove({ ids: row.id }).then(res => {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.form.feesTemplateItemsList.splice(index, 1)
- })
- } else {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.form.feesTemplateItemsList.splice(index, 1)
- }
- },
- // 费用详细删除
- rowDel(index, row) {
- if (row.id) {
- remove({ ids: row.id }).then(res => {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.feestemplateForm.sonItemsList.splice(index, 1)
- })
- } else {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.feestemplateForm.sonItemsList.splice(index, 1)
- }
- },
- // 费用详细确认
- feestemplatecompanyConfirm() {
- // if (!this.feestemplateForm.corpCnName && !this.feestemplateForm.corpType) {
- // c
- // return
- // }
- // this.$refs.feestemplateForm.validate((valid) => {
- // if (valid) {
- // if (this.feestemplateIndex != null) {
- // this.form.feesTemplateItemsList.splice(this.feestemplateIndex, 1, this.feestemplateForm)
- // } else {
- // if (!this.form.feesTemplateItemsList) {
- // this.form.feesTemplateItemsList = []
- // }
- // this.form.feesTemplateItemsList.push(this.feestemplateForm)
- // }
- // this.feestemplateForm = {}
- // this.feestemplateIndex = null
- // this.feestemplateVisible = false
- // }
- // })
- if (this.feestemplateIndex != null) {
- this.form.feesTemplateItemsList.splice(this.feestemplateIndex, 1, this.feestemplateForm)
- }
- this.feestemplateForm = {}
- this.feestemplateIndex = null
- this.feestemplateVisible = false
- },
- // 费用详细关闭
- feestemplateClose(done) {
- done();
- // this.$confirm('确认关闭?')
- // .then(_ => {
- // done();
- // })
- // .catch(_ => {});
- },
- //返回列表
- backToList() {
- this.$emit('goBack')
- },
- // 表头样式
- tableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
- return "padding:4px 0px;fontSize:12px;color:#000;background:#ecf5ff;textAlign:center"
- },
- // 更改表格颜色
- headerClassName(tab) {
- //颜色间隔
- let back = ""
- if (tab.columnIndex >= 0 && tab.column.level === 1) {
- if (tab.columnIndex % 2 === 0) {
- back = "back-one"
- } else if (tab.columnIndex % 2 === 1) {
- back = "back-two"
- }
- }
- return back;
- },
- }
- }
- </script>
- <style scoped>
- ::v-deep#out-table .back-one {
- background: #ecf5ff !important;
- }
- ::v-deep#out-table .back-two {
- background: #ecf5ff !important;
- }
- .borderless {
- height: 100%;
- box-sizing: border-box
- }
- .customer-main {
- //margin-top: 20px;
- //width: calc(100% - 140px);
- margin-bottom: 15px;
- }
- .margintop {
- margin-top: 10px;
- }
- ::v-deep.el-form-item {
- margin-bottom: 0;
- }
- .isShow {
- display: none;
- }
- .nowrapClass {
- width: 100%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- </style>
|