|
@@ -0,0 +1,279 @@
|
|
|
+<template>
|
|
|
+ <div id="equipmentData">
|
|
|
+ <div v-if="isList">
|
|
|
+ <el-card
|
|
|
+ v-loading="loading"
|
|
|
+ style="position: relative;"
|
|
|
+ >
|
|
|
+ <!-- <span>设备产品数据库</span> -->
|
|
|
+ <el-form class="search_area" label-width="100px">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-form-item label="物料编码">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="params.materialCode"
|
|
|
+ size="mini"
|
|
|
+ clearable
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-form-item label="物料名称">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="params.materialName"
|
|
|
+ size="mini"
|
|
|
+ clearable
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-form-item label="设备类别">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="params.deviceCategory"
|
|
|
+ size="mini"
|
|
|
+ clearable
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <div style="position: absolute;top: 10px;right: 10px;">
|
|
|
+ <el-button type="primary" size="mini" @click="searchList">搜索</el-button>
|
|
|
+ <el-button size="mini" plain @click="resetList">重置</el-button>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <div class="btn_grooup">
|
|
|
+ <el-button type="primary" size="mini" @click="addDivision">新增</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="downLoadMb">下载模板</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="upload.open = true">导入数据</el-button>
|
|
|
+ </div>
|
|
|
+ <el-super-ux-table
|
|
|
+ v-model="tableData"
|
|
|
+ :size="size"
|
|
|
+ :dict="dict"
|
|
|
+ :page="pageInfo"
|
|
|
+ :height=500
|
|
|
+ :columns="TableColumns"
|
|
|
+ pagination
|
|
|
+ convenitentOperation
|
|
|
+ storage-key="equipmentDataSuperTable"
|
|
|
+ @row-dblclick="useSee"
|
|
|
+ @row-select="useSelect"
|
|
|
+ @pagination="useQuery(params, pageInfo)"
|
|
|
+ >
|
|
|
+ <ux-table-column
|
|
|
+ fixed="right"
|
|
|
+ title="操作"
|
|
|
+ align="center"
|
|
|
+ width="100"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button>
|
|
|
+ </template>
|
|
|
+ </ux-table-column>
|
|
|
+ </el-super-ux-table>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="searchList"/>
|
|
|
+
|
|
|
+ <!-- 用户导入对话框 -->
|
|
|
+ <el-dialog title="数据导入" :visible.sync="upload.open" width="400px">
|
|
|
+ <el-upload
|
|
|
+ ref="upload"
|
|
|
+ :limit="1"
|
|
|
+ accept=".xlsx, .xls"
|
|
|
+ :headers="upload.headers"
|
|
|
+ :action="upload.url + '?updateSupport=' + upload.updateSupport"
|
|
|
+ :disabled="upload.isUploading"
|
|
|
+ :on-progress="handleFileUploadProgress"
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
+ :on-error="errorFile"
|
|
|
+ :auto-upload="false"
|
|
|
+ drag
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ 将文件拖到此处,或
|
|
|
+ <em>点击上传</em>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="el-upload__tip" slot="tip">
|
|
|
+ <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
|
|
+ </div> -->
|
|
|
+ <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
|
|
+ </el-upload>
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button size="mini" type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
+ <el-button size="mini" @click="upload.open = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// 导入的token
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
+import { getEquipmentDataList, downLoadMb } from '@/api/purchase/equipmentData.js'
|
|
|
+export default {
|
|
|
+ name: "equipmentData",
|
|
|
+ dicts: [],
|
|
|
+ components: {
|
|
|
+ Add: () => import("./add.vue"),
|
|
|
+ ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 导入参数
|
|
|
+ upload: {
|
|
|
+ // 是否显示弹出层(导入)
|
|
|
+ open: false,
|
|
|
+ // 弹出层标题(导入)
|
|
|
+ title: "数据导入",
|
|
|
+ // 是否禁用上传
|
|
|
+ isUploading: false,
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
+ updateSupport: 1,
|
|
|
+ // 设置上传的请求头部
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
+ // 上传的地址
|
|
|
+ url: process.env.VUE_APP_BASE_API + "/device/origin/importData"
|
|
|
+ },
|
|
|
+ // 页面配置
|
|
|
+ isList: true,
|
|
|
+ // 页面状态
|
|
|
+ page: '',
|
|
|
+ disable: false,
|
|
|
+ rowDetail: {},
|
|
|
+
|
|
|
+ size: "mini",
|
|
|
+ loading: false,
|
|
|
+ params: {
|
|
|
+ materialCode: '',
|
|
|
+ materialName: '',
|
|
|
+ deviceCategory: ''
|
|
|
+ },
|
|
|
+ pageInfo: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ tableData: [],
|
|
|
+ selectData: [],
|
|
|
+ // SearchColumns: SearchColumns,
|
|
|
+ TableColumns: [
|
|
|
+ { item: { key: "materialCode", title: "物料编码", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "materialName", title: "物料名称", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "deviceCategory", title: "设备类别", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "factoryName", title: "厂家名称", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "model", title: "型号", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "price", title: "价格", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "parameters", title: "参数", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "province", title: "省份", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "largeZoneCommander", title: "大区负责人", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "serviceManager", title: "业务经理", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "afterSalesEngineer", title: "售后工程师", width: 150 }, attr: {} },
|
|
|
+ { item: { key: "remark", title: "备注", width: 150 }, attr: {} },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.useQuery(this.params, this.pageInfo)
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ useSee() {},
|
|
|
+ useSelect() {},
|
|
|
+ // 加载列表
|
|
|
+ async useQuery(prop, page) {
|
|
|
+ let params = {...prop, ...page}
|
|
|
+ await getEquipmentDataList(params).then(res => {
|
|
|
+ if( res.code === 200 ) {
|
|
|
+ this.tableData = res.rows
|
|
|
+ this.pageInfo.total = res.total
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 新增
|
|
|
+ addDivision() {
|
|
|
+ this.isList = false
|
|
|
+ this.page = 'add'
|
|
|
+ this.disable = false
|
|
|
+ },
|
|
|
+ // 下载模板
|
|
|
+ async downLoadMb() {
|
|
|
+ this.$modal.loading("正在下载模板,请稍后...");
|
|
|
+ downLoadMb().then(res => {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ const blob = new Blob([res], {
|
|
|
+ type: "application/vnd.ms-excel;charset=UTF-8",
|
|
|
+ });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
|
|
|
+ const downloadElement = document.createElement("a"); //创建a标签
|
|
|
+ const href = window.URL.createObjectURL(blob); // 创建下载的链接
|
|
|
+ // var temp = res.headers["content-disposition"];
|
|
|
+ // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
|
|
|
+ // var name = fileName.split(";")[0]; //切割成文件名
|
|
|
+ downloadElement.href = href; //下载地址
|
|
|
+ downloadElement.download = '设备产品数据库模板'+ this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
|
|
|
+ document.body.appendChild(downloadElement);
|
|
|
+ downloadElement.click(); // 点击下载
|
|
|
+ document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(href); // 释放blob对象
|
|
|
+ this.download.open = false
|
|
|
+ }).catch(err => {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 文件上传中处理
|
|
|
+ handleFileUploadProgress(event, file, fileList) {
|
|
|
+ this.upload.isUploading = true;
|
|
|
+ this.$modal.loading("正在导入数据,请稍后...");
|
|
|
+ },
|
|
|
+ // 文件上传成功处理
|
|
|
+ handleFileSuccess(response, file, fileList) {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ this.upload.open = false;
|
|
|
+ this.upload.isUploading = false;
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
+ this.useQuery(this.params, this.pageInfo)
|
|
|
+ },
|
|
|
+ errorFile(err) {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ this.$modal.notifyError("文件已变动,请重新上传");
|
|
|
+ },
|
|
|
+ // 提交上传文件
|
|
|
+ submitFileForm() {
|
|
|
+ this.$refs.upload.submit();
|
|
|
+ },
|
|
|
+ searchList() {
|
|
|
+ this.useQuery(this.params, this.pageInfo)
|
|
|
+ },
|
|
|
+ resetList() {
|
|
|
+ this.params = {
|
|
|
+ materialCode: '',
|
|
|
+ materialName: '',
|
|
|
+ deviceCategory: '',
|
|
|
+ }
|
|
|
+ this.useQuery(this.params, this.pageInfo)
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+#equipmentData {
|
|
|
+ padding: 12px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ overflow-y: scroll;
|
|
|
+}
|
|
|
+.btn_grooup {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+}
|
|
|
+</style>
|