123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586 |
- <template>
- <div class="app-container">
- <el-form
- :model="queryParams"
- ref="queryForm"
- size="small"
- :inline="true"
- v-show="showSearch"
- label-width="68px"
- >
- <el-form-item label="行政区">
- <!-- <el-col :span="4"> -->
- <treeselect
- v-model="queryParams.xzqdm"
- :options="deptOptions"
- :normalizer="normalizer"
- placeholder="选择行政区"
- noOptionsText="暂无数据"
- noChildrenText="没有子选项"
- :value="selectedValues"
- @select="treeselecthange"
- />
- <!-- </el-col> -->
- </el-form-item>
- <el-form-item label="活动时间">
- <el-col :span="11">
- <el-date-picker
- type="date"
- placeholder="选择日期"
- v-model="queryParams.filetime"
- style="width: 100%"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- </el-col>
- <el-col class="line" :span="2">-</el-col>
- <el-col :span="11">
- <el-date-picker
- type="date"
- placeholder="选择日期"
- v-model="queryParams.readtime"
- style="width: 100%"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- </el-col>
- </el-form-item>
- <el-form-item label="文件名称">
- <el-input
- v-model="queryParams.name"
- placeholder="请输入文件名称"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="handleQuery"
- v-hasPermi="['supervise:pcsj:list']"
- >搜索</el-button
- >
- <el-button
- icon="el-icon-refresh"
- size="mini"
- @click="resetQuery"
- v-hasPermi="['supervise:pcsj:list']"
- >重置</el-button
- >
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-upload"
- @click="fileUploadHandle"
- size="mini"
- v-hasPermi="['supervise:pcsj:upload']"
- >上传</el-button
- >
- </el-col>
- <!-- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['supervise:pcsj:add']"
- >新增</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- :disabled="single"
- @click="handleUpdate"
- v-hasPermi="['supervise:pcsj:edit']"
- >修改</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['supervise:pcsj:remove']"
- >删除</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- @click="handleExport"
- v-hasPermi="['supervise:pcsj:export']"
- >导出</el-button
- >
- </el-col>
- <right-toolbar
- :showSearch.sync="showSearch"
- @queryTable="getList"
- ></right-toolbar> -->
- </el-row>
- <el-table
- v-loading="loading"
- :data="pcsjList"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="文件名称" align="center" prop="name" />
- <el-table-column label="区县名称" align="center" prop="xzqmc" />
- <el-table-column
- label="图斑个数(个)"
- align="center"
- prop="spotsnumber"
- width="180"
- >
- <!-- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.uploadtime, "{y}-{m}-{d}") }}</span>
- </template> -->
- </el-table-column>
- <el-table-column label="监测面积(亩)" align="center" prop="spotsarea" />
- <el-table-column label="文件大小(MB)" align="center" prop="spotssize">
- <template slot-scope="scope">
- <span>{{
- scope.row.spotssize
- ? (scope.row.spotssize / 1024 / 1024).toFixed(2)
- : ""
- }}</span>
- <!-- <span>{{ scope.row.spotssize }}</span> -->
- </template>
- </el-table-column>
- <el-table-column label="录入时间" align="center" prop="filetime" />
- <el-table-column
- label="操作"
- align="center"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleBrowse(scope.row)"
- :disabled="scope.row.readstatus != 0"
- v-hasPermi="['supervise:pcsj:list']"
- >浏览</el-button
- >
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleDownload(scope.row)"
- v-hasPermi="['supervise:pcsj:list']"
- >下载</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <!-- 添加或修改监管批次数据对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="名称" prop="name">
- <el-input v-model="form.name" placeholder="请输入名称" />
- </el-form-item>
- <el-form-item label="上传用户" prop="uploaduser">
- <el-input v-model="form.uploaduser" placeholder="请输入上传用户" />
- </el-form-item>
- <el-form-item label="上传时间" prop="uploadtime">
- <el-date-picker
- clearable
- v-model="form.uploadtime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="请选择上传时间"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="文件位置" prop="filepath">
- <el-input v-model="form.filepath" placeholder="请输入文件位置" />
- </el-form-item>
- <el-form-item label="shp位置" prop="shppath">
- <el-input v-model="form.shppath" placeholder="请输入shp位置" />
- </el-form-item>
- <el-form-item label="文件服务发布地址" prop="proxypath">
- <el-input
- v-model="form.proxypath"
- type="textarea"
- placeholder="请输入内容"
- />
- </el-form-item>
- <el-form-item label="解压文件地址" prop="unzippath">
- <el-input
- v-model="form.unzippath"
- type="textarea"
- placeholder="请输入内容"
- />
- </el-form-item>
- <el-form-item label="是否入库" prop="storage">
- <el-input v-model="form.storage" placeholder="请输入是否入库" />
- </el-form-item>
- <el-form-item label="行政区划代码" prop="xzqhdm">
- <el-input v-model="form.xzqhdm" placeholder="请输入行政区划代码" />
- </el-form-item>
- <el-form-item label="图斑数量" prop="spotsnumber">
- <el-input v-model="form.spotsnumber" placeholder="请输入图斑数量" />
- </el-form-item>
- <el-form-item label="图斑面积" prop="spotsarea">
- <el-input v-model="form.spotsarea" placeholder="请输入图斑面积" />
- </el-form-item>
- <el-form-item label="图斑大小" prop="spotssize">
- <el-input v-model="form.spotssize" placeholder="请输入图斑大小" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button
- type="primary"
- v-hasPermi="['supervise:pcsj:upload']"
- @click="submitForm"
- >确 定</el-button
- >
- <el-button v-hasPermi="['supervise:pcsj:upload']" @click="cancel"
- >取 消</el-button
- >
- </div>
- </el-dialog>
- <el-dialog
- title="文件上传"
- :visible.sync="fileUploadDiv"
- width="400px"
- append-to-body
- >
- <el-upload
- class="upload-demo"
- drag
- :action="uploadFileUrl"
- :before-upload="handleBeforeUpload"
- :on-error="handleUploadError"
- :on-success="handleUploadSuccess"
- :limit="1"
- accept=".zip"
- :file-list="fileList"
- :show-file-list="true"
- multiple
- >
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
- <div class="el-upload__tip" slot="tip">只能上传zip文件</div>
- </el-upload>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- listPcsj,
- getPcsj,
- delPcsj,
- addPcsj,
- updatePcsj,
- tiffUpload,
- } from "@/api/supervise/pcsj";
- import { listDept } from "@/api/system/dept";
- import Treeselect from "@riophae/vue-treeselect";
- import "@riophae/vue-treeselect/dist/vue-treeselect.css";
- export default {
- name: "Pcsj",
- components: { Treeselect },
- data() {
- return {
- // 遮罩层
- loading: false,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 监管批次数据表格数据
- pcsjList: [
- // {
- // name: "", //文件名称
- // xzqdm: "", //区县名称
- // spotsnumber: "", //图斑个数
- // spotsarea: "", //监测面积(亩)
- // spotssize: "", //文件大小
- // filetime: "", //录入时间
- // },
- ],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- name: "", //文件名称
- xzqdm: undefined, //区县编码
- filetime: "", //录入时间
- readtime: "", //处理时间
- },
- // 表单参数
- form: {
- name: "1",
- uploaduser: "1",
- uploadtime: "1",
- filepath: "1",
- shppath: "1",
- proxypath: "1",
- unzippath: "1",
- filetype: "1",
- storage: "1",
- status: "1",
- xzqhdm: "1",
- spotsnumber: "1",
- spotsarea: "1",
- spotssize: "1",
- },
- // 表单校验
- rules: {},
- fileList: [],
- fileUploadDiv: false, //文件上传弹窗
- loading2: null,
- uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/uploadSpotZip",
- // 部门树选项
- deptOptions: [],
- selectedValues: [],
- };
- },
- created() {
- this.getList();
- this.getDept();
- },
- computed: {
- watchDeptId() {
- return this.queryParams.xzqdm;
- },
- },
- watch: {
- watchDeptId(newVal) {
- // console.log(newVal,'newValnewVal');
- },
- },
- methods: {
- getDept() {
- // 查询参数
- let queryParams = {
- deptId: this.$store.state.user.deptId,
- status: undefined,
- };
- listDept(queryParams).then((res) => {
- this.deptOptions = this.handleTree(res.data, "deptId");
- });
- },
- treeselecthange(value) {
- this.selectedValues = value.district;
- this.queryParams.xzqdm = value.district;
- },
- handleChange() {},
- /** 转换部门数据结构 */
- normalizer(node) {
- if (node.children && !node.children.length) {
- delete node.children;
- }
- return {
- id: node.district,
- label: node.deptName,
- children: node.children,
- };
- },
- fileUploadHandle() {
- console.log(this.uploadFileUrl);
- this.uploadFileUrl = this.uploadFileUrl;
- this.fileList = [];
- this.fileUploadDiv = true;
- },
- handleBeforeUpload(file) {
- this.$modal.loading("正在上传文件,请稍候...");
- return true;
- },
- // 上传失败
- handleUploadError(err) {
- this.$modal.msgError("上传文件失败,请重试");
- this.$modal.closeLoading();
- },
- // 上传成功回调
- handleUploadSuccess(res, file) {
- console.log("handleUploadSuccess");
- this.fileList = [];
- this.fileUploadDiv = false;
- this.$modal.closeLoading();
- this.$modal.msgSuccess(res.message);
- this.getList();
- },
- handleDownload(row) {
- const zipfile = row.proxypath + ".zip";
- window.open(`${zipfile}`);
- },
- /** 查询监管批次数据列表 */
- getList() {
- this.loading = true;
- listPcsj(this.queryParams).then((response) => {
- this.pcsjList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- name: null,
- uploaduser: null,
- uploadtime: null,
- filepath: null,
- shppath: null,
- proxypath: null,
- unzippath: null,
- filetype: null,
- storage: null,
- status: null,
- xzqhdm: null,
- xzqmc: null,
- spotsnumber: null,
- spotsarea: null,
- spotssize: null,
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- // this.resetForm("queryForm");
- // 查询参数
- (this.queryParams = {
- pageNum: 1,
- pageSize: 10,
- name: "", //文件名称
- xzqdm: "", //区县名称
- filetime: "", //录入时间
- readtime: "", //处理时间
- }),
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map((item) => item.id);
- this.single = selection.length !== 1;
- this.multiple = !selection.length;
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加监管批次数据";
- },
- // 浏览按钮
- handleBrowse(row) {
- this.$router.push({ path: "/remote/gdjc", query: { id: row.id } });
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids;
- getPcsj(id).then((response) => {
- this.form = response.data;
- this.open = true;
- this.title = "修改监管批次数据";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- if (this.form.id != null) {
- updatePcsj(this.form).then((response) => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addPcsj(this.form).then((response) => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$modal
- .confirm('是否确认删除监管批次数据编号为"' + ids + '"的数据项?')
- .then(function () {
- return delPcsj(ids);
- })
- .then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- })
- .catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download(
- "supervise/pcsj/export",
- {
- ...this.queryParams,
- },
- `pcsj_${new Date().getTime()}.xlsx`
- );
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item--medium .el-form-item__label {
- font-size: 11px;
- }
- ::v-deep .vue-treeselect {
- display: table-caption !important;
- width: 200px;
- }
- </style>
|