马宇豪
2025-02-10 02bd5982028af6e791dd0857f535a41aaf74679e
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<template>
  <div class="app-container">
    <el-button
      type="primary"
      plain
      style="margin-right: 10px"
      icon="el-icon-plus"
      @click="handleView('add',{})"
    >新增
    </el-button>
      <el-radio-group v-model="queryParams.categoryType" @change="changeTimeStatus">
        <el-radio-button>全部</el-radio-button>
        <el-radio-button :label="1">理论</el-radio-button>
        <el-radio-button :label="2">实操</el-radio-button>
      </el-radio-group>
<!--      <el-select v-model="queryParams.districtCode" style="margin-left: 10px" placeholder="行政区划">-->
<!--        <el-option-->
<!--          v-for="item in areaList"-->
<!--          :key="item.id"-->
<!--          :label="item.name"-->
<!--          :value="item.code">-->
<!--        </el-option>-->
<!--      </el-select>-->
      <el-button
        size="small"
        type="primary"
        style="margin-bottom: 10px;margin-left: 20px"
        @click="handleQuery()"
      >查询
      </el-button>
      <el-button
        size="small"
        type="primary"
        style="margin-bottom: 10px"
        @click="resetQuery()"
      >重置
      </el-button>
    <el-table
      :data="cateGoryList"
      style="width: 100%;margin-bottom: 20px;"
      row-key="id"
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
      <el-table-column label="地州" align="center" prop="districtName" width="260"/>
      <el-table-column label="类别" align="center" prop="categoryType">
        <template #default="scope">
          {{scope.row.categoryType == 1?'理论':scope.row.categoryType == 2?'实操':''}}
        </template>
      </el-table-column>
      <el-table-column label="科目名称" align="center" prop="subjectName" :show-overflow-tooltip="true"/>
      <el-table-column label="关联资格类型" align="center" prop="operateTypeName" :show-overflow-tooltip="true"/>
      <el-table-column label="金额(元)" align="center" prop="amount"/>
      <el-table-column label="业务代码" align="center" prop="businessCode"/>
      <el-table-column label="单位编码" align="center" prop="companyCode"/>
      <el-table-column label="开票人" align="center" prop="drawer"/>
      <el-table-column label="复核人" align="center" prop="reviewer"/>
      <el-table-column label="开票单位社会信用代码" align="center" prop="invoicingCompanyCode"/>
      <el-table-column label="描述" align="center" prop="describe"/>
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button
            v-if="scope.row.subjectName"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleView('edit',scope.row)"
          >编辑
          </el-button>
          <el-button
            v-if="scope.row.subjectName"
            size="mini"
            type="text"
            style="color: #f56c6c"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:experts:remove']"
          >删除
          </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"-->
<!--    />-->
    <detail-dialog ref="detailDialogRef" @getList="getList"></detail-dialog>
  </div>
</template>
 
<script>
import detailDialog from './components/detailDialog.vue'
import {delNotCoalPayCategory, getNotCoalPayCategory} from '@/api/specialOperationsPay/notCoalPay'
import Cookies from 'js-cookie'
import {getAreaList} from "@/api/coalMine/placeManage/train";
import {delTeacher} from "@/api/coalMine/teacher";
import store from "@/store";
 
export default {
  name: "coalWorkType",
  dicts: [],
  components: {detailDialog},
  data() {
    return {
      loading: false,
      single: true,
      multiple: true,
      showSearch: true,
      addForm: false,
      total: 0,
      expertTypes: [],
      areaList: [],
      cateGoryList: [],
      queryParams: {
        categoryType: null,
        districtCode: ''
      },
      districtCode: ''
    };
  },
  created() {
    const userInfo = store.getters && store.getters.userInfo
    this.districtCode = userInfo.district.districtCode
    if(userInfo.district.districtCode !== '65'){
      this.queryParams.districtCode = this.districtCode
    }else{
      this.queryParams.districtCode = ''
    }
    this.getList()
    this.getArea()
  },
  methods: {
    getList() {
      this.loading = true;
      getNotCoalPayCategory(this.queryParams).then((res) => {
        if (res.code == 200) {
          let totalList = []
          if(Array.isArray(res.rows) && res.rows.length>0){
            for(let item of res.rows){
              if(!totalList.find(i=>i.districtName == item.districtName)){
                totalList.push({
                  districtName: item.districtName,
                  id: '100' + item.id,
                  children: [item]
                })
              }else{
                for(let i of totalList){
                  if(i.districtName == item.districtName){
                    i.children.push(item)
                  }
                }
              }
            }
            totalList.map(i=>{
              if(i.children.length == 1){
                for(let key in i.children[0]){
                  i[key] = i.children[0][key]
                }
                delete i.children
              }
              if(i.children){
                for(let j of i.children){
                  j.districtName = ''
                }
              }
              return i
            })
          }
          this.cateGoryList = JSON.parse(JSON.stringify(totalList))
          this.total = res.total
          this.loading = false;
        }
      })
    },
    async getArea() {
      const res = await getAreaList();
      if (res.code == 200) {
        this.areaList = res.data.filter(i=>i.code !== '65')
        console.log(this.areaList,'list')
      }
    },
    changeTimeStatus(val) {
      this.getList()
    },
 
    handleChange() {
 
    },
    handleQuery() {
      this.getList()
    },
    resetQuery() {
      this.queryParams = {
        categoryType: null,
        districtCode: ''
      }
      this.getList()
    },
    handleView(type,data) {
      this.$refs.detailDialogRef.openDialog(type,data,this.areaList,this.districtCode);
    },
    handleDelete(row){
      this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        const res = await delNotCoalPayCategory(row.id)
        if(res.code == 200){
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
          await this.getList()
        }else{
          this.$message({
            type: 'warning',
            message: res.msg
          });
        }
      }).catch(() => {
 
      });
    }
  }
};
</script>
 
<style scoped>
.app-container /deep/ .el-table .tr-red {
  color: red !important;
}
</style>