risk.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="app-container">
  3. <div class="title-container">
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
  5. </div>
  6. <y-page-list-layout :page-list="pageData" :page-para="listQuery" :get-page-list="getList">
  7. <template slot="left">
  8. <el-button class-name="filter-item" type="danger" size="mini" round style="float: left"
  9. @click="createReport">创建报告</el-button>
  10. <el-input v-model="listQuery.title" placeholder="报告号" clearable
  11. style="margin-left: 20px; width: 220px;float: left;">
  12. </el-input>
  13. <el-input v-model="listQuery.creator" placeholder="创建人" clearable
  14. style="margin-left: 20px; width: 220px;float: left;">
  15. </el-input>
  16. <el-input v-model="listQuery.checker" placeholder="审核人" clearable
  17. style="margin-left: 20px; width: 220px;float: left;">
  18. </el-input>
  19. <el-select v-model="listQuery.status" filterable style="margin-left: 20px; width: 120px;float: left;"
  20. placeholder="请选择" clearable>
  21. <el-option
  22. v-for="(item,index) in statuses"
  23. :key="index"
  24. :label="item"
  25. :value="item"
  26. />
  27. </el-select>
  28. <el-button class="filter-item" style="margin-left: 10px;float: left;" type="primary" @click="searchList"
  29. round>搜索
  30. </el-button>
  31. <el-button class="filter-item" style="float: left;" round type="warning" @click="resetSearch()">重置
  32. </el-button>
  33. </template>
  34. <parentTable v-loading="listLoading" :data="pageData.records" slot="table" style="width: 100%;">
  35. <el-table-column label="报告号" align="center">
  36. <template slot-scope="{row}">
  37. <span>{{ row.title }}</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="报告类型" align="center">
  41. <template slot-scope="{row}">
  42. <span>{{ row.reportType==='LAND_RISK_FTL'?'社会风险稳定性评价报告':'' }}</span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="报告状态" align="center">
  46. <template slot-scope="{row}">
  47. <span>{{row.status }}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="创建人" align="center" width="180">
  51. <template slot-scope="{row}">
  52. <span>{{ row.creator }}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="审核人" align="center" width="180">
  56. <template slot-scope="{row}">
  57. <span>{{ row.checker!=null?row.checker:'-' }}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="报告文档" align="center">
  61. <template slot-scope="{row}">
  62. <el-button v-if="row.url" type="success" plain round
  63. @click="downloadContract(row.url,row.title)">下载</el-button>
  64. <el-button v-else plain round disabled>下载</el-button>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="创建时间" align="center">
  68. <template slot-scope="{row}">
  69. <span>{{ row.created }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="操作" align="center" width="250">
  73. <template slot-scope="{row}">
  74. <PermissionButton menu-code="_views_report_main_edit" class-name="filter-item" name=""
  75. type="primary" round size="mini" @click="edit(row.id)" :page-jump="true" :page-query="{ id: row.id,title:row.title }" />
  76. <!-- <PermissionButton menu-code="_views_report_editor" class-name="filter-item" name=""
  77. type="warning" round size="mini" @click="documentEditor(row)" /> -->
  78. <PermissionButton menu-code="_views_report_main_remove" class-name="filter-item" name=""
  79. type="danger" round size="mini" @click="deleteInfo(row.id)" />
  80. </template>
  81. </el-table-column>
  82. </parentTable>
  83. </y-page-list-layout>
  84. <!-- <el-dialog :visible.sync="dialogVisible" center @closed="closeDialog" width="25%" >
  85. <div style="height: auto;">
  86. <el-select style="width: 400px;" v-model="reportType" placeholder="请选择你要创建的报告类型">
  87. <el-option v-for="(r, id) in reportTypes" :key="r.id" :label="r.headline" :value="r.id" />
  88. </el-select>
  89. </div>
  90. <span slot="footer" class="dialog-footer">
  91. <el-button @click="dialogVisible = false">取 消</el-button>
  92. <el-button type="primary" @click="createReport" :disabled="reportType==null">创 建</el-button>
  93. </span>
  94. </el-dialog> -->
  95. </div>
  96. </template>
  97. <script>
  98. import YPageListLayout from '@/components/YPageListLayout'
  99. import Breadcrumb from '@/components/Breadcrumb'
  100. import PermissionButton from '@/components/PermissionButton/PermissionButton'
  101. export default {
  102. name: 'risk',
  103. components: {
  104. Breadcrumb,
  105. YPageListLayout,
  106. PermissionButton,
  107. },
  108. data() {
  109. return {
  110. dialogVisible: false,
  111. pageData: { records: [] },
  112. total: 20,
  113. listLoading: true,
  114. listQuery: {
  115. page: 1,
  116. size: 10,
  117. descs: 'id',
  118. reportType:'LAND_RISK_FTL'
  119. },
  120. reportTypes: [],
  121. reportType: null,
  122. statuses:["编辑中","审核中","审核通过","审核拒绝","已完成","已归档",],
  123. newReport:{
  124. "reportType": 'LAND_RISK_FTL',
  125. "prefix":"RISK"
  126. }
  127. }
  128. },
  129. created() {
  130. this.getList();
  131. this.getReportTypes();
  132. },
  133. methods: {
  134. resetSearch() {
  135. this.$router.push({ query: {} });
  136. this.listQuery = {
  137. current: 1,
  138. size: 10,
  139. descs: 'id',
  140. reportType:'LAND_RISK_FTL'
  141. }
  142. this.getList()
  143. },
  144. searchList() {
  145. // 重置分页
  146. this.listQuery.page = 1
  147. this.listQuery.size = 20
  148. this.getList()
  149. },
  150. getList() {
  151. const that = this
  152. this.listLoading = true
  153. this.$api.reportMain.list(Object.assign({}, that.listQuery)).then((res) => {
  154. that.pageData = res.data;
  155. setTimeout(() => {
  156. that.listLoading = false
  157. }, 200)
  158. })
  159. .catch(() => {
  160. that.listLoading = false
  161. })
  162. },
  163. deleteInfo(id) {
  164. const that = this
  165. that.$confirm('请确认是否删除该数据?', '提示', {
  166. confirmButtonText: '确定',
  167. cancelButtonText: '取消',
  168. type: 'warning',
  169. center: true
  170. }).then(() => {
  171. that.$api.reportMain.delete(id).then(data => {
  172. that.loading = false
  173. if (data.code === 200) {
  174. that.getList()
  175. } else {
  176. this.$message({
  177. type: 'error',
  178. message: data.msg
  179. })
  180. }
  181. })
  182. }).catch(() => {
  183. })
  184. },
  185. createReport() {
  186. let that = this;
  187. that.$confirm('请确认报告类型是否正确?', '提示', {
  188. confirmButtonText: '确定',
  189. cancelButtonText: '取消',
  190. type: 'warning',
  191. center: true
  192. }).then(() => {
  193. that.$api.reportMain.add(this.newReport).then(data => {
  194. that.loading = false
  195. if (data.code === 200) {
  196. that.getList();
  197. that.dialogVisible = false;
  198. that.$notify({
  199. title: '成功',
  200. message: '创建报告成功',
  201. type: 'success',
  202. duration: 2000
  203. })
  204. } else {
  205. that.$message({
  206. type: 'error',
  207. message: data.msg
  208. })
  209. }
  210. })
  211. }).catch(() => {
  212. })
  213. },
  214. getReportTypes() {
  215. this.$api.reportHeadline.getReportType().then(res => {
  216. if (res.code === 200) {
  217. this.reportTypes = res.data;
  218. }
  219. })
  220. },
  221. closeDialog() {
  222. this.reportType = null;
  223. },
  224. downloadContract(url,title) {
  225. var a = document.createElement('a');
  226. var event = new MouseEvent('click');
  227. a.download = title+".docx";
  228. console.log(a.download)
  229. a.href = url;//路径前拼上前缀,完整路径
  230. a.dispatchEvent(event);
  231. },
  232. documentEditor(row) {
  233. let routeUrl = this.$router.resolve({
  234. path: "/document/window",
  235. query: {key:row.reportKey,url:row.url,title:row.title}
  236. });
  237. window.open(routeUrl.href, '_blank');
  238. },
  239. },
  240. }
  241. </script>
  242. <style lang="scss" scoped>
  243. .right {
  244. flex: 1;
  245. .title {
  246. font-size: 16px;
  247. font-weight: 500;
  248. color: rgba(51, 51, 51, 1);
  249. line-height: 35px;
  250. margin-bottom: 8px;
  251. }
  252. .menu-2-box {
  253. display: flex;
  254. flex-wrap: wrap;
  255. width: 100%;
  256. }
  257. .menu-2-item {
  258. display: flex;
  259. align-items: center;
  260. color: #656565;
  261. font-size: 12px;
  262. width: 230px;
  263. height: 101px;
  264. background: rgb(255, 185, 129);
  265. border-radius: 3px;
  266. padding-left: 20px;
  267. margin-right: 10px;
  268. margin-bottom: 10px;
  269. cursor: pointer;
  270. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  271. .text {
  272. margin-left: 16px;
  273. }
  274. }
  275. }
  276. </style>