123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <div>
- <trade-card title="明细附件" :show="false">
- <avue-crud ref="crud" :data="data" :option="tableOption" @row-del="rowDel" @saveColumn="saveColumn"
- @resetColumn="resetColumn" :cell-style="cellStyle">
- <template slot="menuLeft">
- <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addRow">新增
- </el-button>
- </template>
- <template slot="url" slot-scope="{ row }">
- <div style="display: flex; justify-content: center">
- <el-upload class="upload-demo" :action="uploadImgUrl" :on-success="
- (res, file) => {
- handleSucces(row, res, file);
- }
- " :headers="headers" :disabled="disabled" :show-file-list="false" :limit="1">
- <el-button size="small" type="text" :disabled="browseStatus">点击上传</el-button>
- </el-upload>
- </div>
- </template>
- <template slot-scope="{ row,index}" slot="menu">
- <el-button type="text" icon="el-icon-delete" size="small" @click.stop="rowView(row, index)">查看
- </el-button>
- <el-button type="text" icon="el-icon-delete" size="small" @click.stop="rowDel(row, index)">删除
- </el-button>
- <el-button type="text" icon="el-icon-delete" size="small" @click.stop="rowDown(row, index)">下载
- </el-button>
- </template>
- </avue-crud>
- </trade-card>
- </div>
- </template>
- <script>
- import tableOption from "./config/mainList.json";
- import { dateFormat } from "@/util/date";
- export default {
- name: "detailsPageEdit",
- data() {
- return {
- treeStyle: "height:" + (window.innerHeight - 315) + "px",
- tableOption: {},
- uploadImgUrl: '',
- };
- },
- props: {
- data: {
- type: Array
- },
- disabled: {
- type: Boolean
- }
- },
- async created() {
- this.tableOption = await this.getColumnData(
- this.getColumnName(161.3),
- tableOption
- );
- },
- methods: {
- cellStyle() {
- return "padding:0;height:40px;";
- },
- addRow() {
- this.data.push({createBy:this.$store.getters.userInfo.user_name,createTime:dateFormat(new Date()), $cellEdit: true });
- },
- handleSucces(scope, res, file) {
- console.log(scope, res, file)
- },
- rowCell(row, index) {
- if (row.$cellEdit == true) {
- this.$set(row, "$cellEdit", false);
- } else {
- this.$set(row, "$cellEdit", true);
- }
- },
- rowDel(row) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(row.$index, 1);
- });
- },
- rowDown(row) {
- if (row.url) {
- window.open(row.url);
- } else {
- this.$message.error("请上传附件");
- }
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(161.3),
- this.tableOption
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- this.tableOption = tableOption;
- const inSave = await this.delColumnData(
- this.getColumnName(161.3),
- tableOption
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("重置成功");
- //关闭窗口
- setTimeout(() => {
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }, 1000);
- }
- }
- },
- watch: {
- }
- };
- </script>
- <style lang="scss" scoped>
- </style>
|