detail.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div id="detail">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="one">
  6. <el-col :span="24" class="top">
  7. <el-button type="primary" size="mini" @click="toFlow">查看意见</el-button>
  8. <el-button type="primary" size="mini" @click="back">返回</el-button>
  9. </el-col>
  10. <el-col :span="24" class="down">
  11. <el-form :model="form" ref="form" label-width="100px">
  12. <el-col :span="24" class="text">
  13. <el-col :span="2" class="left"> 企业名称:</el-col>
  14. <el-col :span="22" class="right">
  15. {{ form.name }}
  16. </el-col>
  17. </el-col>
  18. <el-col :span="24" class="text">
  19. <el-col :span="2" class="left"> 申领时间:</el-col>
  20. <el-col :span="22" class="right">
  21. {{ getDate(form.meta) }}
  22. </el-col>
  23. </el-col>
  24. <el-col :span="24" class="text">
  25. <el-col :span="2" class="left"> 资质资料:</el-col>
  26. <el-col :span="20" class="right">
  27. <el-col :span="4" v-for="(i, index) in form.material" :key="`material-${index}`">
  28. <img v-if="isImg(i.url)" :src="i.url" width="150px" height="150px" @click="toOpen(i.url)" />
  29. <el-link v-else :key="`material-${index}`" type="primary" @click="toOpen(i.url)"> <i class="el-icon-view"></i> {{ i.name }} </el-link>
  30. </el-col>
  31. </el-col>
  32. </el-col>
  33. <el-col :span="24" class="text">
  34. <el-col :span="2" class="left"> 信息资料:</el-col>
  35. <el-col :span="20" class="right">
  36. <el-col :span="4" v-for="(i, index) in form.medium_material" :key="`medium_material-${index}`">
  37. <img v-if="isImg(i.url)" :src="i.url" width="150px" height="150px" @click="toOpen(i.url)" />
  38. <el-link v-else type="primary" @click="toOpen(i.url)"> <i class="el-icon-view"></i> {{ i.name }} </el-link>
  39. </el-col>
  40. </el-col>
  41. </el-col>
  42. <el-col :span="24" class="text" v-if="dataStatus == '1' || dataStatus == '2'">
  43. <el-col :span="2" class="left"> 合同:</el-col>
  44. <el-col :span="20" class="right">
  45. <el-col :span="4" v-for="(i, index) in form.contract" :key="`medium_material-${index}`">
  46. <img v-if="isImg(i.url)" :src="i.url" width="150px" height="150px" @click="toOpen(i.url)" />
  47. <el-link v-else type="primary" @click="toOpen(i.url)"> <i class="el-icon-view"></i> {{ i.name }} </el-link>
  48. </el-col>
  49. </el-col>
  50. </el-col>
  51. <el-col :span="24" class="formBtn">
  52. <el-button type="danger" size="mini" @click="back">取消保存</el-button>
  53. <el-button type="primary" size="mini" v-if="dataStatus === '0'" @click="onSubmit()">提交保存</el-button>
  54. <el-button type="primary" size="mini" v-if="dataStatus === '1'" @click="toStatus('2')">高企申报确认</el-button>
  55. </el-col>
  56. </el-form>
  57. </el-col>
  58. </el-col>
  59. </el-col>
  60. </el-row>
  61. <el-dialog title="意见" :visible.sync="dialog" :destroy-on-close="true">
  62. <flow :id="form._id"></flow>
  63. </el-dialog>
  64. </div>
  65. </template>
  66. <script>
  67. const _ = require('lodash');
  68. const moment = require('moment');
  69. import flow from './flow.vue';
  70. import { mapState, createNamespacedHelpers } from 'vuex';
  71. const { mapActions: ticket } = createNamespacedHelpers('ticket');
  72. export default {
  73. name: 'detail',
  74. props: {},
  75. components: {
  76. flow,
  77. },
  78. data: function () {
  79. return {
  80. form: {},
  81. imgList: ['jpg', 'jpeg', 'png', 'bmp', 'gif'],
  82. // 意见
  83. dialog: false,
  84. };
  85. },
  86. async created() {
  87. await this.search();
  88. },
  89. methods: {
  90. ...ticket(['fetch', 'status']),
  91. // 查询详情
  92. async search() {
  93. if (this.id) {
  94. let res = await this.fetch(this.id);
  95. if (this.$checkRes(res)) {
  96. this.$set(this, `form`, res.data);
  97. }
  98. }
  99. },
  100. // 审核
  101. async onSubmit() {
  102. let data = this.form;
  103. const res = await this.status(data);
  104. if (this.$checkRes(res, '审核成功', res.errmsg || '审核失败')) {
  105. this.back();
  106. }
  107. },
  108. // 高企认证确认
  109. async toStatus(status) {
  110. let data = this.form;
  111. data.status = status;
  112. const res = await this.status(data);
  113. if (this.$checkRes(res, '高企申报成功', res.errmsg || '高企申报失败')) {
  114. this.back();
  115. }
  116. },
  117. // 查看意见
  118. toFlow() {
  119. this.dialog = true;
  120. },
  121. // 返回
  122. back() {
  123. this.$router.push({ path: '/adminCenter/ticket', query: { status: this.dataStatus } });
  124. },
  125. isImg(url) {
  126. const arr = url.split('.');
  127. const suffix = _.last(arr);
  128. return this.imgList.includes(suffix);
  129. },
  130. toOpen(url) {
  131. window.open(url);
  132. },
  133. getDate(date) {
  134. if (date) {
  135. let newDate = moment(date.createdAt).format('YYYY-MM-DD');
  136. if (newDate) return newDate;
  137. }
  138. },
  139. },
  140. computed: {
  141. ...mapState(['user']),
  142. id() {
  143. return this.$route.query.id;
  144. },
  145. dataStatus() {
  146. return this.$route.query.status;
  147. },
  148. },
  149. metaInfo() {
  150. return { title: this.$route.meta.title };
  151. },
  152. watch: {
  153. test: {
  154. deep: true,
  155. immediate: true,
  156. handler(val) {},
  157. },
  158. },
  159. };
  160. </script>
  161. <style lang="less" scoped>
  162. .main {
  163. border-radius: 10px;
  164. box-shadow: 0 0 5px #cccccc;
  165. padding: 20px;
  166. .top {
  167. text-align: right;
  168. margin: 0 0 10px 0;
  169. }
  170. .down {
  171. border: 1px solid #ccc;
  172. border-radius: 10px;
  173. padding: 15px;
  174. .text {
  175. padding: 10px 0;
  176. border-bottom: 1px dashed #333;
  177. .left {
  178. text-align: left;
  179. }
  180. .right {
  181. img {
  182. width: 200px;
  183. height: 200px;
  184. border: 1px solid #ccc;
  185. }
  186. }
  187. }
  188. .formBtn {
  189. padding: 10px 0;
  190. text-align: center;
  191. }
  192. }
  193. }
  194. .main:hover {
  195. box-shadow: 0 0 5px #409eff;
  196. }
  197. </style>