index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <script>
  2. import Column from "../add/column";
  3. import useData from "../hooks/data";
  4. import useDicts from "../hooks/dicts";
  5. import useMethods from "../hooks/function";
  6. export default {
  7. name: "SeeDrawer",
  8. dicts: useDicts(Column),
  9. components: {},
  10. data() {
  11. return {
  12. column: 3,
  13. title: "明 细",
  14. ...useData(Column),
  15. };
  16. },
  17. computed: {
  18. hasPowerEdit: function () {
  19. return this.$parent.$parent.hasPowerEdit;
  20. },
  21. hasPowerDelete: function () {
  22. return this.$parent.$parent.hasPowerDelete;
  23. },
  24. hasPowerAlteration: function () {
  25. return this.$parent.$parent.hasPowerAlteration;
  26. },
  27. hasPowerPigeonhole: function () {
  28. return this.$parent.$parent.hasPowerPigeonhole;
  29. },
  30. hasPowerTermination: function () {
  31. return this.$parent.$parent.hasPowerTermination;
  32. },
  33. },
  34. watch: {},
  35. methods: {
  36. //
  37. async open(prop) {
  38. const { open, fetchItem } = useMethods();
  39. await open({ _this: this });
  40. await fetchItem({ _this: this, prop });
  41. },
  42. //
  43. async hide() {
  44. const { hide } = useMethods();
  45. await hide({ _this: this });
  46. },
  47. //
  48. async useEdit(prop) {
  49. const { useEdit } = this.$parent.$parent;
  50. await useEdit(prop);
  51. },
  52. //
  53. async useDelete(prop) {
  54. const { useDelete } = this.$parent.$parent;
  55. await useDelete(prop);
  56. },
  57. //
  58. async useTermination(prop) {
  59. const { useTermination } = this.$parent.$parent;
  60. await useTermination(prop);
  61. },
  62. //
  63. async usePigeonhole(prop) {
  64. const { usePigeonhole } = this.$parent.$parent;
  65. await usePigeonhole(prop);
  66. },
  67. //
  68. async useAlteration(prop) {
  69. const { useAlteration } = this.$parent.$parent;
  70. await useAlteration(prop);
  71. },
  72. },
  73. created() {},
  74. mounted() {},
  75. destroyed() {},
  76. };
  77. </script>
  78. <template>
  79. <el-drawer
  80. :size="width"
  81. :title="title"
  82. :show-close="false"
  83. :visible.sync="visible"
  84. >
  85. <template slot="title">
  86. <span>{{ title }}</span>
  87. <span>
  88. <el-button
  89. :size="size"
  90. circle
  91. icon="el-icon-close"
  92. @click="hide"
  93. ></el-button>
  94. <el-tooltip
  95. v-if="hasPowerDelete([params])"
  96. effect="dark"
  97. content="删 除"
  98. placement="bottom-end"
  99. >
  100. <el-button
  101. :size="size"
  102. circle
  103. icon="el-icon-delete"
  104. @click="useDelete([params])"
  105. ></el-button>
  106. </el-tooltip>
  107. <el-tooltip
  108. v-if="hasPowerEdit([params])"
  109. effect="dark"
  110. content="编 辑"
  111. placement="bottom-end"
  112. >
  113. <el-button
  114. :size="size"
  115. circle
  116. icon="el-icon-edit"
  117. @click="useEdit([params])"
  118. ></el-button>
  119. </el-tooltip>
  120. <el-tooltip
  121. v-if="hasPowerTermination([params])"
  122. effect="dark"
  123. content="终 止"
  124. placement="bottom-end"
  125. >
  126. <el-button
  127. :size="size"
  128. circle
  129. icon="el-icon-light-rain"
  130. @click="useTermination([params])"
  131. ></el-button>
  132. </el-tooltip>
  133. <el-tooltip
  134. v-if="hasPowerPigeonhole([params])"
  135. effect="dark"
  136. content="归 档"
  137. placement="bottom-end"
  138. >
  139. <el-button
  140. :size="size"
  141. circle
  142. icon="el-icon-lightning"
  143. @click="usePigeonhole([params])"
  144. ></el-button>
  145. </el-tooltip>
  146. <el-tooltip
  147. v-if="hasPowerAlteration([params])"
  148. effect="dark"
  149. content="变 更"
  150. placement="bottom-end"
  151. >
  152. <el-button
  153. :size="size"
  154. circle
  155. icon="el-icon-heavy-rain"
  156. @click="useAlteration([params])"
  157. ></el-button>
  158. </el-tooltip>
  159. </span>
  160. </template>
  161. <el-descriptions :size="size" :column="column" border style="margin: 10px">
  162. <el-descriptions-item
  163. v-if="params[column.key]"
  164. v-for="(column, index) in formColumns"
  165. :key="index"
  166. :label="column.title"
  167. :labelStyle="{ width: '150px' }"
  168. :contentStyle="{ width: 'auto' }"
  169. >
  170. <dict-tag
  171. v-if="column.inputType === 'Select'"
  172. :size="size"
  173. :value="params[column.key]"
  174. :options="dict.type[column.referName]"
  175. />
  176. <span v-else-if="column.inputType === 'Upload'">
  177. <dr-file-preview v-model="params[column.key]"></dr-file-preview>
  178. </span>
  179. <span v-else>{{ params[column.key] }}</span>
  180. </el-descriptions-item>
  181. </el-descriptions>
  182. <el-tabs v-model="tabName" :size="size" style="margin: 10px">
  183. <el-tab-pane
  184. v-for="(column, index) in tabColumns"
  185. :key="index"
  186. :name="column.key"
  187. :label="column.title"
  188. lazy
  189. >
  190. <el-table :size="size" :data="params[column.key]">
  191. <el-table-column
  192. v-for="(cColumn, cIndex) in column.tableColumns"
  193. :key="cIndex"
  194. :prop="cColumn.key"
  195. :label="cColumn.title"
  196. :width="cColumn.width"
  197. >
  198. <template slot-scope="scope">
  199. <dict-tag
  200. v-if="cColumn.inputType === 'Select'"
  201. :size="size"
  202. :value="scope.row[cColumn.key]"
  203. :options="dict.type[cColumn.referName]"
  204. />
  205. <span v-else>{{ scope.row[cColumn.key] }}</span>
  206. </template>
  207. </el-table-column>
  208. </el-table>
  209. </el-tab-pane>
  210. </el-tabs>
  211. </el-drawer>
  212. </template>