jinlin
2024-01-10 cdf29a8f6fb9990f82ccc1d3f47bfba48cfaf4fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<template>
  <zt-dialog ref="dialog" column="2" title="选择配置项" :hasConfirm="true" @confirm="formSubmit" :append-to-body="true">
    <el-card shadow="never" class="aui-card--fill">
      <div class="mod-project-project}">
        <zt-table-wraper :dataForm="dataForm" ref="tableObj" v-slot="{ table }" query-url="/configItemChange/ConfigItemChange/getItemList"
        @dataLoaded="dataLoaded"
        >
          <el-table
                    :data="table.dataList"
                    height="100px"
                    @selection-change="changeRow"
                    v-adaptive="{bottomOffset:150}"
                    border>
            <el-table-column align="center" type="selection" width="40"/>
            <el-table-column prop="no" align="center" width="60" label="序号">
              <template slot-scope="scope">
                <span v-html="indexFormat(scope.$index)"></span>
              </template>
            </el-table-column>
            <el-table-column prop="itemName" width="200" label="配置项名称">
            </el-table-column>
            <el-table-column prop="itemIdentify" align="center" min-width="290" label="配置项标识">
            </el-table-column>
            <el-table-column prop="version" align="center" width="120" label="版本">
            </el-table-column>
            <el-table-column prop="retrospectVersion" label="上溯版" width="120" align="center">
            </el-table-column>
            <el-table-column prop="secretClass" label="密级" width="100" align="center">
              <template v-slot="{ row }">
                <zt-dict  :disabled="true" v-model="row.secretClass" placeholder="密级" dict="secret_class"
                          clearable></zt-dict>
              </template>
            </el-table-column>
            <el-table-column  label="操作" width="120" align="center">
              <template v-slot="{ row }">
                <zt-table-button size="small" v-show="isPreview(row)" type="primary"
                                 @click="preview(row)">预览
                </zt-table-button>
                <zt-table-button size="small" v-show="isDownload(row)" type="primary"
                                 @click="download(row)">下载
                </zt-table-button>
              </template>
            </el-table-column>
          </el-table>
        </zt-table-wraper>
      </div>
    </el-card>
    <Preview ref="view" :pageMarkerfun="ConfigItemList"></Preview>
  </zt-dialog>
</template>
 
<script>
  import Preview from "@/views/pages/view.vue";
export default {
  name: 'configItem-list',
  data() {
    return {
      ConfigItemList: 'ConfigItemList',
      dataForm: {
        ids:null,
        projectId:'',
        pageCode:'',
        configChangeList:[],
        remarkList:[],
        configOutboundList:[]
      }
    }
  },
  components: {
    Preview
  },
  methods: {
    init(projectId,param) {
      console.log(projectId,param,'init projectId,ids,pageCode')
      this.dataForm.projectId = projectId
      this.dataForm.ids = param.ids
      this.dataForm.pageCode =param.pageCode
      console.log(param.pageCode,'init pageCode')
      this.$nextTick(()=>{
        this.$refs.tableObj.query()
      })
    },
    indexFormat(index) {
      return index += 1
    },
    dataLoaded(data){
      console.log(data,'data dataLoaded')
    },
    changeRow(selection){
      this.dataForm.configChangeList = selection
      this.dataForm.remarkList = selection
      this.dataForm.configOutboundList = selection
      console.log(this.dataForm.configChangeList,'this.dataForm.checkList 选中的列表数据')
    },
    isPreview(row) {
      if (row.files!=null) {
        if (row.files.groups[0].fields[0].files[0]) {
          let fileName = row.files.groups[0].fields[0].files[0].name
          let suffixName = ''
          if (fileName != null) {
            let arr = fileName.split('.')
            suffixName = arr[arr.length - 1].toLowerCase()
          }
          if (suffixName == 'pdf' || suffixName == 'doc' || suffixName == 'docx' || suffixName == 'jpg' || suffixName == 'jpeg' || suffixName == 'png' || suffixName == 'xls' || suffixName == 'xlsx') {
            return true
          } else {
            return false
          }
        } else {
          return false
        }
      }
    },
    isDownload(row) {
      if (row.files!=null) {
        if (row.files.groups[0].fields[0].files[0]) {
          return true
        } else {
          return false
        }
      }
    },
    preview(row) {
      this.$refs.view.openAccessoryFormatByForm(row)
    },
    download(row) {
      if (row.files!=null) {
        if (row.files.groups[0].fields[0].files[0]) {
          let url = row.files.groups[0].fields[0].files[0].url;
          window.location.href = `${url}`
        }
      }
    },
    async formSubmit(){
      console.log(this.dataForm,'this.dataForm')
      this.$emit('getChangeItemList',this.dataForm)
      await this.$tip.success()
      this.$refs.dialog.close()
      this.$emit('refreshDataList')
    }
  },
}
</script>
<style>
.form-input-width-1 .el-form-item > .el-form-item__content .el-input {
  width: 150px;
}
</style>