VarText.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div class="fixedText" :class="{VarTextV2: headerTitleType === 'Head2'}">
  3. <div class="content">
  4. <div class="title" :class="{fontWeight: pageDate && pageDate.status > 20}">
  5. {{ name }}:
  6. </div>
  7. <div class="value">
  8. <el-row v-if="pageDate.status < 20 && !isHistory" type="flex" justify="space-between">
  9. <el-input
  10. v-model="textValue"
  11. type="textarea"
  12. :placeholder="headerTitleType === 'Head2' ? `请针对${headerTitle}进行分析,建议格式:【1、事实描述:XXXXXX;2、根因分析:XXXXXX;3、建议:XXXXXX。】` : '请输入'"
  13. show-word-limit
  14. />
  15. <el-button
  16. style="margin-left: 20px;font-size: 14px;font-weight: 400;"
  17. type="text"
  18. @click="markingIssues"
  19. >
  20. 标记
  21. </el-button>
  22. </el-row>
  23. <span
  24. v-if="pageDate.status > 10 && textValue || isHistory && textValue"
  25. style="display: inline-block;line-height: 1.65;background-color: #f7f7f7; padding: 10px; border-radius: 5px;"
  26. v-html="textValue.replace(/\n/g, '<br />')"
  27. />
  28. </div>
  29. </div>
  30. <span @click.stop>
  31. <markingIssues ref="markingIssues" />
  32. </span>
  33. </div>
  34. </template>
  35. <script>
  36. import { mapState } from 'vuex'
  37. import markingIssues from './markingIssues'
  38. import _ from 'lodash'
  39. export default {
  40. name: 'VarText',
  41. components: {
  42. markingIssues
  43. },
  44. props: {
  45. title: {
  46. type: String,
  47. required: false,
  48. default: () => ''
  49. },
  50. headerTitle: {
  51. type: String,
  52. required: false,
  53. default: () => ''
  54. },
  55. headerTitleType: {
  56. type: String,
  57. required: false,
  58. default: () => ''
  59. },
  60. name: {
  61. type: String,
  62. required: false,
  63. default: () => ''
  64. },
  65. value: {
  66. type: String,
  67. required: false,
  68. default: () => ''
  69. }
  70. },
  71. data() {
  72. this.upData = _.debounce(this.upData, 800)
  73. return {
  74. textValue: ''
  75. }
  76. },
  77. computed: {
  78. ...mapState('monthlyReportEdit', ['pageType', 'pageDate', 'isHistory'])
  79. // pageType() {
  80. // return this.$store.state.monthlyReportEditV2.pageType
  81. // },
  82. // pageDate() {
  83. // return this.$store.state.monthlyReportEditV2.pageDate
  84. // }
  85. },
  86. watch: {
  87. value(val) {
  88. this.textValue = val
  89. },
  90. textValue(val) {
  91. this.upData()
  92. }
  93. },
  94. mounted() {
  95. this.textValue = this.value
  96. },
  97. methods: {
  98. upData() {
  99. this.$emit('input', this.textValue)
  100. },
  101. markingIssues() {
  102. this.$refs.markingIssues.modalShow = true
  103. this.$nextTick(() => {
  104. this.$refs.markingIssues.openModal({
  105. title: '标记为重点问题',
  106. normalAreaName: `${this.value}`,
  107. headerTitle: this.headerTitle
  108. })
  109. })
  110. }
  111. }
  112. }
  113. </script>
  114. <style scoped lang="less">
  115. .fixedText {
  116. //margin-top: 10px;
  117. padding-top: 10px;
  118. .top-title {
  119. width: 100%;
  120. display: flex;
  121. &-content {
  122. flex: 1;
  123. padding: 10px 0;
  124. }
  125. .handle-box {
  126. flex: none;
  127. width: 50px;
  128. text-align: right;
  129. }
  130. }
  131. .content {
  132. width: 100%;
  133. display: flex;
  134. .title {
  135. //padding: 9px 0;
  136. flex: none;
  137. //font-weight: 600;
  138. color: #333;
  139. width: 50px;
  140. }
  141. .value {
  142. flex: 1;
  143. }
  144. }
  145. }
  146. .VarTextV2 {
  147. padding-top: 10px;
  148. margin-top: 5px;
  149. margin-bottom: 15px;
  150. //.content{
  151. // .title{
  152. // font-weight: 400;
  153. // }
  154. //}
  155. }
  156. .fontWeight {
  157. font-weight: 600;
  158. padding-top: 10px;
  159. }
  160. </style>