|
@@ -15,11 +15,11 @@
|
|
|
<span class="item_index">{{index + 1}}</span>
|
|
|
<div class="card_item_code">{{item.inner_code}}</div>
|
|
|
</div>
|
|
|
- <div class="card_red">删除</div>
|
|
|
+ <div class="card_red" @click="delSteelCylinder(item,1)">删除</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else><el-empty :image="require('../../assets/image/empty.png')" description="暂无燃气瓶"></el-empty></div>
|
|
|
- <div class="card_pagination center_in">
|
|
|
+ <div class="card_pagination center_in" v-if="bottleData.length > 0">
|
|
|
<pagination :total="Pagination.Total" :pagerCountnum="5" layout="prev, pager, next, jumper"
|
|
|
:currentPage="Pagination.PageIndex" @changeSize="changeSize" @changeCurrent="changeCurrent">
|
|
|
</pagination>
|
|
@@ -40,11 +40,11 @@
|
|
|
<span class="item_index">{{index + 1}}</span>
|
|
|
<div class="card_item_code">{{item.inner_code}}</div>
|
|
|
</div>
|
|
|
- <div class="card_red">删除</div>
|
|
|
+ <div class="card_red" @click="delSteelCylinder(item,2)">删除</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else><el-empty :image="require('../../assets/image/empty.png')" description="暂无燃气瓶"></el-empty></div>
|
|
|
- <div class="card_pagination center_in">
|
|
|
+ <div class="card_pagination center_in" v-if="bottleData1.length > 0">
|
|
|
<pagination :total="Pagination1.Total" :pagerCountnum="5" layout="prev, pager, next, jumper"
|
|
|
:currentPage="Pagination1.PageIndex" @changeSize="changeSize1" @changeCurrent="changeCurrent1">
|
|
|
</pagination>
|
|
@@ -65,11 +65,11 @@
|
|
|
<span class="item_index">{{index + 1}}</span>
|
|
|
<div class="card_item_code">{{item.inner_code}}</div>
|
|
|
</div>
|
|
|
- <div class="card_red">删除</div>
|
|
|
+ <div class="card_red" @click="delSteelCylinder(item,3)">删除</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else><el-empty :image="require('../../assets/image/empty.png')" description="暂无燃气瓶"></el-empty></div>
|
|
|
- <div class="card_pagination center_in">
|
|
|
+ <div class="card_pagination center_in" v-if="bottleData2.length > 0">
|
|
|
<pagination :total="Pagination2.Total" :pagerCountnum="5" layout="prev, pager, next, jumper"
|
|
|
:currentPage="Pagination2.PageIndex" @changeSize="changeSize2" @changeCurrent="changeCurrent2">
|
|
|
</pagination>
|
|
@@ -77,9 +77,39 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 添加钢瓶 -->
|
|
|
- <el-dialog title="添加" :visible.sync="staffDialogVisible" width="600px" :close-on-click-modal="false"
|
|
|
+ <el-dialog :title="addTitle" :visible.sync="staffDialogVisible" width="600px" :close-on-click-modal="false"
|
|
|
@close="closeDialog">
|
|
|
- <forms ref="childRules" :formNewList="formRuleList" :ruleForm="ruleForm" labelWidth="100px"></forms>
|
|
|
+ <el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item label="单位内编码" prop="code" :rules="formRuleList[0].rules">
|
|
|
+ <el-input v-model="ruleForm.code" placeholder="请输入单位内编码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <el-button type="primary" @click="addCode">添加</el-button>
|
|
|
+ <div style="display: flex;margin-left: 10px;">
|
|
|
+ <el-upload :auto-upload="false" :file-list="fileList" :on-change="handleChange"
|
|
|
+ :on-remove="handleRemove" accept=".xlsx, .xls" :show-file-list="false" action class="upload-box">
|
|
|
+ <el-button type="success" plain>批量上传</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <div class="card_Code_list">
|
|
|
+ <div class="space_between_in card_item_codeil" v-for="(item,index) in numData" :key="index">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <span class="fontsize_17 title_num_code center_in">{{index + 1}}</span>
|
|
|
+ <div class="fontsize_17" style="margin-left: 10px;">{{item}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="title_red fontsize_17" style="cursor: pointer;" @click="delCode(item)">删除</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button plain @click="staffDialogVisible = false">取 消</el-button>
|
|
|
<el-button type="primary" :loading="confirmLoading" @click="handleAdd">确 定</el-button>
|
|
@@ -96,6 +126,10 @@
|
|
|
} from '@/api/condition'
|
|
|
import pagination from '@/components/pagination'
|
|
|
import forms from '@/components/forms'
|
|
|
+ import * as XLSX from 'xlsx/xlsx.mjs'
|
|
|
+ import {
|
|
|
+ number
|
|
|
+ } from 'echarts'
|
|
|
export default {
|
|
|
components: {
|
|
|
pagination,
|
|
@@ -126,13 +160,27 @@
|
|
|
},
|
|
|
bottleData2: [],
|
|
|
staffDialogVisible: false,
|
|
|
- formRuleList: [],
|
|
|
+ formRuleList: [{
|
|
|
+ field: 'code',
|
|
|
+ label: '单位内编码',
|
|
|
+ placeholder: '单位内编码',
|
|
|
+ type: 'input',
|
|
|
+ colWidth: 24,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入单位内编码',
|
|
|
+ trigger: 'blur'
|
|
|
+ }]
|
|
|
+ }, ],
|
|
|
ruleForm: {
|
|
|
- name: '',
|
|
|
- price: '',
|
|
|
- remark: '',
|
|
|
+ code: '',
|
|
|
},
|
|
|
confirmLoading: false,
|
|
|
+ lastUid: null,
|
|
|
+ fileList: [],
|
|
|
+ numData: [],
|
|
|
+ addTitle: '添加',
|
|
|
+ codeType: 1,
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -173,11 +221,149 @@
|
|
|
},
|
|
|
// 添加钢瓶
|
|
|
AddCylinder(type) {
|
|
|
- console.log(type, 222)
|
|
|
+ if (type == 1) {
|
|
|
+ this.addTitle = '重瓶添加'
|
|
|
+ } else if (type == 2) {
|
|
|
+ this.addTitle = '空瓶添加'
|
|
|
+ } else if (type == 3) {
|
|
|
+ this.addTitle = '不合格瓶添加'
|
|
|
+ }
|
|
|
+ this.codeType = type
|
|
|
this.staffDialogVisible = true
|
|
|
},
|
|
|
handleAdd() {
|
|
|
-
|
|
|
+ if (this.numData.length > 0) {
|
|
|
+ this.getAddCode()
|
|
|
+ } else {
|
|
|
+ this.$refs['ruleForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.numData.push(this.ruleForm.code)
|
|
|
+ this.numData = Array.from(new Set(this.numData));
|
|
|
+ this.getAddCode()
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 添加钢瓶
|
|
|
+ getAddCode() {
|
|
|
+ addCylinderStatus({
|
|
|
+ status: this.codeType,
|
|
|
+ innerCodeList: this.numData,
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.staffDialogVisible = false
|
|
|
+ if (this.codeType == 1) {
|
|
|
+ this.getList(1)
|
|
|
+ } else if (this.codeType == 2) {
|
|
|
+ this.getList1(2)
|
|
|
+ } else if (this.codeType == 3) {
|
|
|
+ this.getList2(3)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 上传钢瓶文件
|
|
|
+ async handleChange(ev, fileList) {
|
|
|
+ if (fileList.length > 0) {
|
|
|
+ this.fileList = [fileList[fileList.length - 1]]
|
|
|
+ } else {
|
|
|
+ this.fileList = fileList[0]
|
|
|
+ }
|
|
|
+ let file = ev.raw
|
|
|
+ if (this.lastUid == file.uid) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.lastUid = file.uid
|
|
|
+ if (file) {
|
|
|
+ // console.log(file)
|
|
|
+ if (
|
|
|
+ file.name.indexOf('.xls') != -1 ||
|
|
|
+ file.name.indexOf('.xlsx') != -1
|
|
|
+ ) {
|
|
|
+ let data = await this.readFile(file)
|
|
|
+ let workbook = XLSX.read(data, {
|
|
|
+ type: 'binary',
|
|
|
+ cellDates: true
|
|
|
+ })
|
|
|
+ let worksheet = workbook.Sheets[workbook.SheetNames[0]]
|
|
|
+ let secondsheet = workbook.Sheets[workbook.SheetNames[1]]
|
|
|
+ let resultExcel = XLSX.utils.sheet_to_json(worksheet)
|
|
|
+ let tableHead = Object.keys(resultExcel[0]);
|
|
|
+ let numarr = String(tableHead)
|
|
|
+ this.numData.push(numarr)
|
|
|
+ resultExcel.forEach(item => {
|
|
|
+ const arr = String(item[tableHead])
|
|
|
+ this.numData.push(arr)
|
|
|
+ })
|
|
|
+ this.numData = Array.from(new Set(this.numData));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ readFile(file) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let reader = new FileReader()
|
|
|
+ reader.readAsBinaryString(file)
|
|
|
+ reader.onload = ev => {
|
|
|
+ resolve(ev.target.result)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ this.fileList = []
|
|
|
+ this.resultExcel = []
|
|
|
+ },
|
|
|
+ // 添加编号
|
|
|
+ addCode() {
|
|
|
+ if (this.ruleForm.code) {
|
|
|
+ this.numData.push(this.ruleForm.code)
|
|
|
+ this.numData = Array.from(new Set(this.numData));
|
|
|
+ this.ruleForm.code = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除编号数组
|
|
|
+ delCode(num) {
|
|
|
+ var index = this.numData.indexOf(num);
|
|
|
+ if (index !== -1) {
|
|
|
+ this.numData.splice(index, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除钢瓶
|
|
|
+ delSteelCylinder(value, type) {
|
|
|
+ this.$confirm('此操作将永久删除该钢瓶, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ delCylinderStatus({
|
|
|
+ id: value.id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ if (type == 1) {
|
|
|
+ this.getList(1)
|
|
|
+ } else if (type == 2) {
|
|
|
+ this.getList1(2)
|
|
|
+ } else if (type == 3) {
|
|
|
+ this.getList2(3)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ // this.$message({
|
|
|
+ // type: 'info',
|
|
|
+ // message: '已取消删除'
|
|
|
+ // });
|
|
|
+ });
|
|
|
},
|
|
|
// 重瓶区域
|
|
|
changeSize(val) {
|
|
@@ -208,13 +394,15 @@
|
|
|
},
|
|
|
// 弹窗关闭
|
|
|
closeDialog() {
|
|
|
+ this.ruleForm.code = ''
|
|
|
+ this.numData = []
|
|
|
this.staffDialogVisible = false
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss">
|
|
|
+<style lang="scss" scoped>
|
|
|
.card_cylinder_condition {
|
|
|
display: flex;
|
|
|
width: 100%;
|
|
@@ -282,12 +470,51 @@
|
|
|
font-size: 18px;
|
|
|
}
|
|
|
|
|
|
+ .card_item_codeil {
|
|
|
+ padding-right: 8px;
|
|
|
+ margin: 10px 0px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card_Code_list {
|
|
|
+ max-height: 500px;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+
|
|
|
.card_red {
|
|
|
cursor: pointer;
|
|
|
color: #F56C6C;
|
|
|
font-size: 18px;
|
|
|
}
|
|
|
|
|
|
+ .title_num_code {
|
|
|
+ width: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .fontsize_17 {
|
|
|
+ font-size: 17px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 自定义滚动条整体样式 */
|
|
|
+ ::-webkit-scrollbar {
|
|
|
+ width: 5px;
|
|
|
+ /* 设置滚动条的宽度 */
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 自定义滚动条滑块样式 */
|
|
|
+ ::-webkit-scrollbar-thumb {
|
|
|
+ background-color: #66b1ff;
|
|
|
+ /* 设置滑块的颜色 */
|
|
|
+ border-radius: 5px;
|
|
|
+ /* 设置滑块的圆角 */
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 自定义滚动条轨道样式 */
|
|
|
+ ::-webkit-scrollbar-track {
|
|
|
+ background-color: rgba(102, 177, 255, 0.5) !important;
|
|
|
+ border-radius: 5px;
|
|
|
+ /* 设置轨道的颜色 */
|
|
|
+ }
|
|
|
+
|
|
|
.title_green {
|
|
|
color: #67C23A;
|
|
|
}
|