| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980 |
- <template>
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="assemblyForm.preContainersList" :page.sync="page"
- :permission="permissionList" :before-open="beforeOpen" v-model="form"
- :cell-style="{ padding: '0px', textAlign: 'center' }" ref="crud" @row-update="rowUpdate" @row-save="rowSave"
- @row-del="rowDel" @selection-change="selectionChange" @refresh-change="refreshChange"
- @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 487)"
- @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 487)">
- <template slot="menuLeft">
- <el-button type="primary" size="small" :disabled="seeDisabled" @click.stop="addfun">新 增</el-button>
- <el-button type="danger" size="small" plain
- :disabled="seeDisabled || assemblyForm.preContainersList.length == 0"
- @click.stop="handleDelete">一键删除
- </el-button>
- <el-button type="primary" size="small"
- :disabled="seeDisabled || assemblyForm.preContainersList.length == 0"
- @click="batchSavefun">一键保存</el-button>
- <el-button type="info" plain size="small"
- :disabled="seeDisabled || assemblyForm.preContainersList.length == 0" @click="onclickEdit">一键编辑
- </el-button>
- </template>
- <template slot-scope="{row,index}" slot="menu">
- <el-button v-if="row.id && row.containerNumberStatus == '录入'&&assemblyForm.billType!='MM'" size="mini" type="text"
- @click.stop="pick(row)" :disabled="seeDisabled">
- 选择
- </el-button>
- <el-button v-if="row.id && row.containerNumberStatus == '已选择'&&assemblyForm.billType!='MM'" size="mini" type="text"
- @click.stop="rowRevoke(row)" :disabled="seeDisabled">
- 撤销
- </el-button>
- <el-button v-if="row.id && row.containerNumberStatus == '已选择'&&assemblyForm.billType!='MM'" size="mini" type="text"
- @click.stop="rowView(row)" :disabled="seeDisabled">
- 查看放箱号
- </el-button>
- </template>
- <template slot-scope="{row}" slot="cntrTypeCodeForm">
- <search-query :datalist="cntrTypeCodeData" :selectValue="row.cntrTypeCode" :filterable="true"
- :clearable="true" :remote="true" :buttonIf="false"
- :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }" placeholder="请选择尺码箱型"
- @remoteMethod="remoteMethod($event, 'cntrTypeCode')" @corpChange="corpChange($event, row)"
- @corpFocus="remoteMethod($event, 'cntrTypeCode')" @corpClear="corpClear($event, row)">
- </search-query>
- </template>
- <template slot="number" slot-scope="{ row }">
- <el-input v-if="row.$cellEdit" style="width: 100%;" v-model="row.number" size="small" autocomplete="off"
- min="0" @blur="numberBlur(row)" clearable placeholder="请输入件数"></el-input>
- <span v-else>{{ row.number }}</span>
- </template>
- <template slot="grossWeight" slot-scope="{ row }">
- <el-input v-if="row.$cellEdit" style="width: 100%;" v-model="row.grossWeight" size="small"
- autocomplete="off" min="0" @blur="grossWeightBlur(row)" clearable placeholder="请输入毛重"></el-input>
- <span v-else>{{ row.grossWeight }}</span>
- </template>
- <template slot="measurement" slot-scope="{ row }">
- <el-input v-if="row.$cellEdit" style="width: 100%;" v-model="row.measurement" size="small"
- autocomplete="off" min="0" @blur="measurementBlur(row)" clearable placeholder="请输入尺码"></el-input>
- <span v-else>{{ row.measurement }}</span>
- </template>
- </avue-crud>
- <el-dialog title="查看放箱号" :visible.sync="dialogVisible" width="50%" :before-close="handleClose" append-to-body>
- <span>
- <avue-crud ref="crud2" :option="containerOption" :data="containerNumberItemList"
- @resetColumn="resetColumnTwo('crud2', 'containerOption', 'containerOptionBack', 488)"
- @saveColumn="saveColumnTwo('crud2', 'containerOption', 'containerOptionBack', 488)">
- <template slot="occupyNum" slot-scope="{ row }">
- <el-input-number v-if="!row.id" v-model="row.occupyNum" :min="0" :max="row.remainingNum"
- placeholder="请输入占用箱量" size="small" :controls="false" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.occupyNum }}</span>
- </template>
- </avue-crud>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false" size="mini">{{ editStatus ? '取 消' : '关 闭' }}</el-button>
- <el-button v-if="editStatus" type="primary" @click="submit" size="mini">确 定</el-button>
- </span>
- </el-dialog>
- </basic-container>
- </template>
- <script>
- import {
- precontainersList,
- precontainersDetail,
- precontainersSubmit,
- precontainersRemove,
- precontainersSubmitList,
- getItemListHY,
- selectedContainerNumber,
- revokeSelectedContainerNumber,
- } from "@/api/iosBasicData/ReceivingOrders/precontainers";
- import { getWorkDicts } from "@/api/system/dictbiz";
- import { mapGetters } from "vuex";
- import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
- import { bcntrtypesList } from "@/api/iosBasicData/bcntrtypes";
- import { containersEqualDistribution } from "@/api/iosBasicData/containers";
- import { requiredMessage } from "@/util/messageReminder";
- import { Header } from "element-ui";
- export default {
- components: { SearchQuery },
- props: {
- pid: {},
- assemblyForm: {
- type: Object,
- default: {}
- },
- seeDisabled: {
- type: Boolean,
- default: false,
- },
- showLock: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- editStatus: false,
- dialogVisible: false,
- // 集装箱尺码箱型
- cntrTypeCodeData: [],
- containerNumberItemList: [],
- form: {},
- query: {},
- loading: false,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {},
- optionBack: {
- maxHeight: '150px',
- // calcHeight: 30,
- calcHeight: 30,
- menuWidth: 120,
- tip: false,
- border: true,
- addBtn: false,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- refreshBtn: false,
- selection: true,
- align: 'center',
- menu: true,
- index: true,
- column: [
- {
- label: "箱型",
- prop: "cntrTypeCode",
- formslot: true,
- cell: true,
- width: '120',
- rules: [{
- required: true,
- message: "请选择箱型",
- trigger: "blur"
- }]
- },
- {
- label: "箱量",
- prop: "quantity",
- type: "number",
- cell: true,
- controls: false,
- precision: 0,
- width: '120',
- rules: [{
- required: true,
- message: "请输入箱量",
- trigger: "blur"
- }]
- },
- {
- label: "件数",
- prop: "number",
- type: "number",
- width: '120',
- // cell:true,
- controls: false,
- precision: 0,
- },
- {
- label: "毛重(KGS)",
- prop: "grossWeight",
- width: '120',
- type: "number",
- // cell:true,
- controls: false,
- },
- {
- label: "净重(KGS)",
- prop: "netWeight",
- width: '120',
- type: "number",
- cell: true,
- controls: false,
- },
- {
- label: "体积(CBM)",
- prop: "measurement",
- width: '120',
- type: "number",
- // cell:true,
- controls: false,
- },
- {
- label: "温度",
- prop: "temperature",
- cell: true,
- controls: false,
- // type:"number",
- width: "120"
- },
- {
- label: "温度单位",
- prop: "temperatureUnit",
- type: 'select',
- cell: true,
- dicData: [{
- label: '摄氏度',
- value: 'C'
- }, {
- label: '华氏度',
- value: 'F'
- }]
- },
- {
- label: "通风度",
- prop: "ventilation",
- cell: true,
- controls: false,
- // type:"number",
- width: "120"
- },
- {
- label: "湿度",
- prop: "humidity",
- cell: true,
- controls: false,
- // type:"number",
- width: "120"
- },
- {
- label: "SOC",
- prop: "isSoc",
- width: '120',
- type: 'select',
- cell: true,
- dicData: [{
- label: '否',
- value: 0
- }, {
- label: '是',
- value: 1
- }]
- },
- {
- label: "单程",
- prop: "isOneway",
- type: 'select',
- cell: true,
- dicData: [{
- label: '否',
- value: 0
- }, {
- label: '是',
- value: 1
- }]
- },
- {
- label: "NOR",
- prop: "nor",
- width: '100',
- type: 'select',
- cell: true,
- dicData: [{
- label: '否',
- value: 0
- }, {
- label: '是',
- value: 1
- }]
- },
- {
- label: "OOG",
- prop: "oog",
- width: '120',
- type: 'select',
- cell: true,
- dicData: [{
- label: '否',
- value: 0
- }, {
- label: '是',
- value: 1
- }]
- },
- {
- label: "左超(CM)",
- prop: "overLeft",
- type: "number",
- cell: true,
- controls: false,
- },
- {
- label: "右超(CM)",
- prop: "overRight",
- type: "number",
- cell: true,
- controls: false,
- },
- {
- label: "前超(CM)",
- prop: "overFront",
- type: "number",
- cell: true,
- controls: false,
- },
- {
- label: "后超(CM)",
- prop: "overBack",
- type: "number",
- cell: true,
- controls: false,
- },
- {
- label: "超高(CM)",
- prop: "overHeight",
- type: "number",
- cell: true,
- controls: false,
- },
- {
- label: "备注",
- prop: "remarks",
- span: 24,
- type: 'textarea',
- slot: true,
- minRows: 3,
- },
- ]
- },
- data: [],
- containerOption: {},
- containerOptionBack: {
- height: '500',
- // calcHeight: 30,
- calcHeight: 30,
- menuWidth: 160,
- tip: false,
- border: true,
- addBtn: false,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- refreshBtn: false,
- align: 'center',
- menu: false,
- index: true,
- column: [
- {
- label: "放箱号",
- prop: "internalContainerNumber",
- width: 100,
- overHidden: true,
- },
- {
- label: "放箱号类型",
- prop: "internalBoxClass",
- width: 100,
- overHidden: true,
- },
- {
- label: "场站",
- prop: "polStationCname",
- width: 100,
- overHidden: true,
- },
- {
- label: "箱型",
- prop: "boxType",
- width: 100,
- overHidden: true,
- },
- {
- label: "可用箱数",
- prop: "remainingNum",
- width: 100,
- overHidden: true,
- },
- {
- label: "占用箱量",
- prop: "occupyNum",
- width: 100,
- overHidden: true,
- },
- {
- label: "优先等级",
- prop: "priorityLevel",
- width: 100,
- overHidden: true,
- },
- {
- label: "箱管备注",
- prop: "boxRemarks",
- width: 100,
- overHidden: true,
- },
- {
- label: "备注",
- prop: "remarks",
- width: 100,
- overHidden: true,
- },
- ]
- },
- };
- },
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.precontainers_add, false),
- viewBtn: this.vaildData(this.permission.precontainers_view, false),
- delBtn: this.vaildData(this.permission.precontainers_delete, false),
- editBtn: this.vaildData(this.permission.precontainers_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(487), this.optionBack);
- this.containerOption = await this.getColumnData(this.getColumnName(488), this.containerOptionBack);
- },
- methods: {
- submit() {
- // let obj = {
- // containerNumberItemList:
- // }
- // for (let item of ) {
- // if (!(item.occupyNum > 0)) {
- // return this.$message.error("占用箱量必须大于0!");
- // }
- // }
- if (this.containerNumberItemList.filter(item => item.occupyNum > 0).length == 0) {
- return this.$message.error("至少有一条占用箱量大于0!");
- }
- selectedContainerNumber(this.containerNumberItemList).then(res => {
- this.$message.success("操作成功!");
- this.dialogVisible = false
- this.$emit('billsDetailfun')
- })
- },
- pick(row) {
- this.containerNumberItemList = []
- if (!this.assemblyForm.polId) {
- return this.$message.error("请选择装货港");
- }
- if (!this.assemblyForm.podId) {
- return this.$message.error("请选择卸货港");
- }
- let obj = {
- boxType: row.cntrTypeCode,
- polId: this.assemblyForm.polId,
- podId: this.assemblyForm.podId,
- cabinType: this.assemblyForm.cabinType,
- airlineId: this.assemblyForm.airlineId,
- etd:this.assemblyForm.etd+' 00:00:00'
- }
- getItemListHY(obj).then(res => {
- if (res.data.data) {
- res.data.data.forEach(item => {
- item.pid = this.assemblyForm.id
- })
- this.editStatus = true
- this.containerNumberItemList = res.data.data
- }
- })
- this.dialogVisible = true
- },
- rowRevoke(row) {
- let obj = {
- boxType: row.cntrTypeCode,
- billId: this.assemblyForm.id
- }
- revokeSelectedContainerNumber(obj).then(res => {
- this.$message.success("操作成功!");
- this.$emit('billsDetailfun')
- })
- },
- rowView(row) {
- this.containerNumberItemList = []
- this.editStatus = false
- this.dialogVisible = true
- this.containerNumberItemList = this.assemblyForm.containerNumberItemList.filter(item => row.cntrTypeCode == item.boxType && item.occupyNum > 0)
- },
- handleClose() {
- this.editStatus = false
- },
- onclickEdit() {
- for (let item of this.assemblyForm.preContainersList) {
- this.$delete(item, '$cellEdit')
- this.$set(item, '$cellEdit', true)
- }
- },
- // 件数失焦事件
- numberBlur(row) {
- let quantityNum = 0
- for (let item of this.assemblyForm.preContainersList) {
- if (item.number) {
- quantityNum += Number(item.number)
- }
- }
- if (quantityNum != 0) {
- this.assemblyForm.quantity = quantityNum
- }
- },
- // 毛重失焦事件
- grossWeightBlur(row) {
- let grossWeightNum = 0
- for (let item of this.assemblyForm.preContainersList) {
- if (item.grossWeight) {
- grossWeightNum += Number(item.grossWeight)
- }
- }
- if (grossWeightNum != 0) {
- this.assemblyForm.grossWeight = grossWeightNum
- }
- },
- // 尺码失焦事件
- measurementBlur(row) {
- let measurementNum = 0
- for (let item of this.assemblyForm.preContainersList) {
- if (item.measurement) {
- measurementNum += Number(item.measurement)
- }
- }
- if (measurementNum != 0) {
- this.assemblyForm.measurement = measurementNum
- }
- },
- // 一键编辑
- oneTouchEditefun() {
- for (let item of this.assemblyForm.preContainersList) {
- this.$refs.crud.rowCell(item, item.$index)
- }
- console.log(this.assemblyForm.preContainersList, 294)
- // $cellEdit
- },
- // 批量保存
- batchSavefun() {
- if (!this.assemblyForm.id) {
- this.$message({
- message: '请先点击右上角保存按钮,保存数据之后才能添加!',
- type: 'warning'
- });
- return
- }
- let numberSum = 0
- let grossWeightSum = 0
- let measurementSum = 0
- for (let item of this.assemblyForm.preContainersList) {
- numberSum += Number(item.number)
- grossWeightSum += Number(item.grossWeight)
- measurementSum += Number(item.measurement)
- if (!item.cntrTypeCode) {
- this.$message.warning('请选择尺码箱型')
- return;
- }
- if (!item.quantity) {
- this.$message.warning('请输入箱量')
- return;
- }
- item.pid = this.assemblyForm.id
- }
- if (numberSum != this.assemblyForm.quantity) return this.$message.error('箱型所有的件数不等于总件数')
- this.$confirm("批量保存后,需要重新配箱,确认继续?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- precontainersSubmitList(this.assemblyForm.preContainersList).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$emit('billsDetailfun')
- })
- })
- },
- // 平均箱量
- equalDistribution(type) {
- if (!this.assemblyForm.id) {
- this.$message({
- message: '请先点击右上角保存按钮,保存数据之后才能添加!',
- type: 'warning'
- });
- return
- }
- if (this.assemblyForm.waitingBoxList.length <= 0) {
- this.$message({
- type: "warning",
- message: "请先添加集装箱数据!"
- });
- return
- }
- if (this.assemblyForm.preContainersList <= 0) {
- this.$message({
- type: "warning",
- message: "请先添加箱型数据!"
- });
- return
- }
- this.$confirm("确定平均分配?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.containersEqualDistributionfun(type)
- })
- },
- // 平均分配接口
- containersEqualDistributionfun(type) {
- containersEqualDistribution({
- pid: this.assemblyForm.id,
- type: type,
- waitingBox: this.assemblyForm.waitingBoxList[0]
- }).then(res => {
- if (res.data.data instanceof Array) {
- this.$message({
- type: "success",
- message: "操作成功!"
- })
- this.$emit('billsDetailfun')
- } else {
- // 没有除开
- this.$message({
- type: 'warning',
- dangerouslyUseHTMLString: true,
- message: '<span style="color:red">注意!!!件数不能平均分 ,请手工配箱,或者修改件数.</span>\n' +
- '<table border="1">\n' +
- ' <thead>\n' +
- ' <tr>\n' +
- ' <th></th>\n' +
- ' <th>件数</th>\n' +
- ' <th>毛重</th>\n' +
- ' <th>尺码</th>\n' +
- ' </tr>\n' +
- ' </thead>\n' +
- ' <tbody>\n' +
- ' <tr>\n' +
- ' <td>总数</td>\n' +
- ' <td>' + res.data.data.total.quantity + '</td>\n' +
- ' <td>' + res.data.data.total.grossWeight + '</td>\n' +
- ' <td>' + res.data.data.total.grossWeight + '</td>\n' +
- ' </tr>\n' +
- ' <tr>\n' +
- ' <td>入箱</td>\n' +
- ' <td>' + res.data.data.average.quantity + '</td>\n' +
- ' <td>' + res.data.data.average.grossWeight + '</td>\n' +
- ' <td>' + res.data.data.average.grossWeight + '</td>\n' +
- ' </tr>\n' +
- ' <tr>\n' +
- ' <td>差额</td>\n' +
- ' <td>' + res.data.data.subtract.quantity + '</td>\n' +
- ' <td>' + res.data.data.subtract.grossWeight + '</td>\n' +
- ' <td>' + res.data.data.subtract.grossWeight + '</td>\n' +
- ' </tr>\n' +
- ' </tbody>\n' +
- '</table>',
- duration: 5000
- });
- }
- })
- },
- corpClear(value, row) {
- this.$set(row, 'cntrTypeCode', null)
- this.$set(row, 'cntrTypeCodeId', null)
- this.$set(row, 'teu', null)
- },
- // 选择框的回调
- corpChange(value, row) {
- for (let item of this.cntrTypeCodeData) {
- if (item.cnName == value) {
- this.$set(row, 'cntrTypeCode', item.cnName)
- this.$set(row, 'cntrTypeCodeId', item.id)
- this.$set(row, 'teu', item.teu)
- }
- }
- },
- // 筛选数据模糊查找
- remoteMethod(value, name) {
- this.bcntrtypesListfun(value)
- },
- // 获取箱型字典数据
- bcntrtypesListfun(cnName) {
- bcntrtypesList(1, 10, { cnName }).then(res => {
- this.cntrTypeCodeData = res.data.data.records
- })
- },
- // 添加按钮确认
- rowSave(row, done, loading) {
- row.pid = this.pid
- // 如果是冻柜,则需要输入相应的通度和温度、温度,如果不是冻柜,不需要输入相应的温度等内容;
- if (this.assemblyForm.cargoType == 'reefer') {
- // 要判断的必填
- const arr = [
- {
- name: "温度",
- value: "temperature",
- },
- {
- name: "温度单位",
- value: "temperatureUnit",
- },
- {
- name: "通风度",
- value: "ventilation",
- },
- {
- name: "湿度",
- value: "humidity",
- },
- ]
- if (!requiredMessage(row, arr)) {
- loading(); // 按钮的禁用关闭
- return;
- }
- }
- precontainersSubmit(row).then(() => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$emit('billsDetailfun')
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
- },
- // 编辑确认按钮
- rowUpdate(row, index) {
- let rulesRow = [
- {
- name: "尺码箱型",
- value: "cntrTypeCode",
- },
- {
- name: "箱量",
- value: "quantity",
- },
- ]
- if (!requiredMessage(row, rulesRow)) {
- return;
- }
- // 如果是冻柜,则需要输入相应的通度和温度、温度,如果不是冻柜,不需要输入相应的温度等内容;
- if (this.assemblyForm.cargoType == 'reefer') {
- // 要判断的必填
- const arr = [
- {
- name: "温度",
- value: "temperature",
- },
- {
- name: "温度单位",
- value: "temperatureUnit",
- },
- {
- name: "通风度",
- value: "ventilation",
- },
- {
- name: "湿度",
- value: "humidity",
- },
- ]
- if (!requiredMessage(row, arr)) {
- return;
- }
- }
- if (!this.pid) {
- this.$message({
- message: '请先保存数据之后才能添加',
- type: 'warning'
- });
- return
- }
- if (row.id) {
- this.$confirm("已经存在配箱信息,如果修改预配箱数据 要清除全部配箱信息?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- precontainersSubmit(row).then(() => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$set(row, '$cellEdit', false)
- this.$emit('billsDetailfun')
- })
- })
- } else {
- row.pid = this.pid
- precontainersSubmit(row).then(() => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$set(row, '$cellEdit', false)
- this.$emit('billsDetailfun')
- }, error => {
- console.log(error);
- });
- }
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- if (!row.id) {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.assemblyForm.preContainersList.splice(row.$index, 1)
- } else {
- precontainersRemove(row.id).then(() => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$emit('billsDetailfun')
- });
- }
- })
- },
- // 新增
- addfun() {
- this.$refs.crud.rowCellAdd({})
- // this.$refs.crud.rowAdd()
- },
- // 编辑
- editfun(row, index) {
- if (row.$cellEdit) {
- // 保存
- this.rowUpdate(row, index)
- // this.$set(row,'$cellEdit',false)
- } else {
- if (!this.assemblyForm.id) {
- this.$set(row, '$cellEdit', true)
- return
- }
- if (Number(this.assemblyForm.quantity) != Number(this.assemblyForm.waitingBoxList[0].quantity)) {
- this.$alert('当前数据已经均分箱量,请撤销之后再修改', '提示', {
- confirmButtonText: '确定',
- });
- } else {
- this.$set(row, '$cellEdit', true)
- }
- }
- // this.$refs.crud.rowEdit(row,index)
- },
- // 多选删除
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.precontainersRemovefun()
- })
- },
- // 删除接口
- precontainersRemovefun() {
- let multiList = this.selectionList
- let arr = this.assemblyForm.preContainersList
- // 获取有id 的数据
- const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
- let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
- // 把选中的删除掉
- multiList.forEach((item) => {
- for (let index in arr) {
- if (JSON.stringify(item) == JSON.stringify(arr[index])) {
- arr.splice(Number(index), 1)
- }
- }
- })
- // 有id 的处理
- if (itemsWithId.length != 0) {
- precontainersRemove(arrIds.join(',')).then(() => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- // this.$emit('billsDetailfun')
- this.$refs.crud.toggleSelection();
- })
- };
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- precontainersDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- refreshChange() {
- console.log('刷新')
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- }
- };
- </script>
- <style scoped lang="scss">
- ::v-deep .el-dialog__body {
- padding: 0px 10px !important;
- }
- </style>
|