DwSurveyDcsWrapper.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="20" :offset="2">
  5. <div class="dw-dcs-main">
  6. <div class="dw-dcs-main-survey-title">
  7. <el-row type="flex" justify="space-between" align="middle">
  8. <el-col>
  9. <div class="dw-dcs-main-survey-title-content">
  10. <div v-if="survey.surveyNameText != null" v-text="survey.surveyNameText"></div>
  11. <div v-else v-html="survey.surveyName"></div>
  12. </div>
  13. </el-col>
  14. <el-col :span="4">
  15. <el-select :value="survey.surveyState" placeholder="请选择">
  16. <el-option key="0" :value="0" label="设计中" ></el-option>
  17. <el-option key="1" :value="1" label="发布收集" ></el-option>
  18. <el-option key="2" :value="2" label="收集结束" ></el-option>
  19. </el-select>
  20. </el-col>
  21. </el-row>
  22. </div>
  23. <div class="dw-dcs-main-survey-step">
  24. <div class="dw-dcs-main-survey-step-item" style="padding: 13px 16px;">
  25. <el-row type="flex" justify="space-between" align="middle" >
  26. <el-col :span="3">
  27. <router-link class="dw-link dw-link-1" to="/"><i class="el-icon-edit"></i>问卷设计</router-link>
  28. </el-col>
  29. <el-col :span="3" >
  30. <router-link :to="'/dw/survey/c/url/' + survey.id" :class="{ 'dw-link-primary' : isAnswerUrl || isSurveySet || isSiteShare || isSiteComp || isAnswerWx}" class="dw-link dw-link-1" ><i class="el-icon-link"></i>问卷收集</router-link>
  31. </el-col>
  32. <el-col :span="3">
  33. <router-link :to="'/dw/survey/d/chart/' + survey.id" :class="{ 'dw-link-primary' : isSurveyChart || isAnswerData }" class="dw-link dw-link-1" ><i class="el-icon-s-data"></i>问卷数据</router-link>
  34. </el-col>
  35. <el-col :span="15" style="text-align: right;">
  36. <el-button type="primary" size="small" @click="buttonClickA(`/static/diaowen/design.html?surveyId=${survey.id}`)" >问卷设计</el-button>
  37. <el-button size="small" @click="handlePush(`/dw/survey/c/url/${survey.id}`)" >答卷地址</el-button>
  38. </el-col>
  39. </el-row>
  40. </div>
  41. <div class="dw-dcs-main-survey-step-item" style="padding-left: 16px;">
  42. <el-row v-show="isAnswerUrl || isSurveySet || isSiteShare || isSiteComp || isAnswerWx">
  43. <el-col :span="3">
  44. <router-link :to="'/dw/survey/c/url/' + survey.id" :class="{ 'dw-link-primary' : isAnswerUrl}" class="dw-link" ><i class="el-icon-link"></i>答卷地址</router-link>
  45. </el-col>
  46. <el-col :span="3">
  47. <router-link :to="'/dw/survey/c/attr/' + survey.id" :class="{ 'dw-link-primary' : isSurveySet}" class="dw-link" ><i class="el-icon-setting"></i>答卷设置</router-link>
  48. </el-col>
  49. <el-col :span="3">
  50. <router-link :to="'/dw/survey/c/comp/' + survey.id" :class="{ 'dw-link-primary' : isSiteComp}" class="dw-link" ><i class="el-icon-discount"></i>网站组件</router-link>
  51. </el-col>
  52. <el-col :span="3">
  53. <router-link :to="'/dw/survey/c/weixin/' + survey.id" :class="{ 'dw-link-primary' : isAnswerWx}" class="dw-link" ><i class="el-icon-chat-dot-round"></i>微信收集</router-link>
  54. </el-col>
  55. </el-row>
  56. <el-row v-show="isSurveyChart || isAnswerData">
  57. <el-col :span="3">
  58. <router-link :to="'/dw/survey/d/chart/' + survey.id" :class="{ 'dw-link-primary' : isSurveyChart}" class="dw-link" ><i class="el-icon-discount"></i>默认统计</router-link>
  59. </el-col>
  60. <el-col :span="3">
  61. <router-link :to="'/dw/survey/d/data/' + survey.id" :class="{ 'dw-link-primary' : isAnswerData}" class="dw-link" ><i class="el-icon-receiving"></i>原始数据</router-link>
  62. </el-col>
  63. <el-col :span="3"></el-col>
  64. <el-col :span="3"></el-col>
  65. </el-row>
  66. </div>
  67. <div class="dw-dcs-main-survey-step-item dw-dcs-main-survey-step-item-status" >
  68. <el-row type="flex" justify="space-between" align="middle">
  69. <el-col :span="4">
  70. <div>状态:
  71. <el-tag v-if="survey.surveyState === 0" size="mini" >设计中</el-tag>
  72. <el-tag v-else-if="survey.surveyState === 1" type="success" size="mini" >收集中</el-tag>
  73. <el-tag v-else-if="survey.surveyState === 2" type="info" size="mini" >收集结束</el-tag>
  74. <el-tag v-else disable-transitions style="margin-left: 10px" size="mini" >未知</el-tag>
  75. </div>
  76. </el-col>
  77. <el-col :span="4">
  78. <div>收集数:{{ survey.answerNum != null ? survey.answerNum : 0 }} 份</div>
  79. </el-col>
  80. <el-col :span="16" style="text-align: right;">
  81. 创建时间:{{ survey.createDate }}
  82. </el-col>
  83. </el-row>
  84. </div>
  85. <div class="dw-dcs-main-survey-step-main">
  86. <slot :survey="survey" name="dw-dcs-main-slot" ></slot>
  87. </div>
  88. </div>
  89. </div>
  90. </el-col>
  91. </el-row>
  92. </div>
  93. </template>
  94. <script>
  95. import {dwSurveyInfo} from '@/api/dw-survey'
  96. export default {
  97. name: 'DwSurveyDcsWrapper',
  98. props: {
  99. id: {type: String, default: ''},
  100. isAnswerUrl: {type: Boolean, default: false},
  101. isSurveySet: {type: Boolean, default: false},
  102. isSiteShare: {type: Boolean, default: false},
  103. isSiteComp: {type: Boolean, default: false},
  104. isAnswerWx: {type: Boolean, default: false},
  105. isSurveyChart: {type: Boolean, default: false},
  106. isAnswerData: {type: Boolean, default: false},
  107. isSurveyLog: {type: Boolean, default: false},
  108. isAnswerLog: {type: Boolean, default: false}
  109. },
  110. data () {
  111. return {
  112. survey: {
  113. sid: '',
  114. answerUrl: '',
  115. answerUrlQR: '',
  116. siteCompCodeRoot: ''
  117. }
  118. }
  119. },
  120. mounted () {
  121. console.debug(process.env)
  122. this.getSurveyInfo()
  123. },
  124. methods: {
  125. buttonClickA (href) {
  126. window.location.href = href
  127. },
  128. handlePush: function (to) {
  129. this.$router.push(to)
  130. },
  131. getSurveyInfo () {
  132. dwSurveyInfo(this.$route.params.id).then((response) => {
  133. const resultData = response.data.data
  134. this.survey = resultData
  135. this.survey.answerUrl = location.origin + '/#/diaowen/' + this.survey.sid
  136. this.survey.answerUrlQR = process.env.DW_API_URL+'/api/dwsurvey/anon/response/answerTD.do?surveyId=' + this.survey.id
  137. this.survey.siteCompCodeRoot = '<div id="dwsurveyWebAnswerCompCode"><div id="dwsurveyWebSiteFixed" style="position: fixed; right: 0px; left: auto; top: 520px; z-index: 99999;"><a target=\'_blank\' id="dwsurveyWebSiteFixedA" href="' + this.survey.answerUrl + '" style="background-color: rgb(24, 144, 255); width: 15px; display: block; padding: 10px 6px 10px 10px; color: white; cursor: pointer; float: right; vertical-align: middle; text-decoration: none; font-size: 12px; box-sizing: content-box; line-height: 20px;">问卷调查</a></div></div>'
  138. this.survey.surveyDetail.effective = resultData.surveyDetail.effective === 1
  139. this.survey.surveyDetail.effectiveIp = resultData.surveyDetail.effectiveIp === 1
  140. this.survey.surveyDetail.refresh = resultData.surveyDetail.refresh === 1
  141. this.survey.surveyDetail.rule = resultData.surveyDetail.rule === 1
  142. this.survey.surveyDetail.ynEndNum = resultData.surveyDetail.ynEndNum === 1
  143. this.survey.surveyDetail.ynEndTime = resultData.surveyDetail.ynEndTime === 1
  144. })
  145. }
  146. }
  147. }
  148. </script>
  149. <style scoped>
  150. .dw-dcs-main{
  151. background-color: white;
  152. padding: 20px;
  153. }
  154. .dw-dcs-main-survey-title{
  155. border-bottom: 1px solid rgb(241, 242, 245);
  156. padding-bottom: 20px;
  157. padding-left: 10px;
  158. }
  159. .dw-dcs-main-survey-title-content{
  160. font-size: 26px;
  161. font-weight: 300;
  162. }
  163. .dw-dcs-main-survey-step{
  164. padding: 0px;
  165. }
  166. .dw-dcs-main-survey-step-item{
  167. padding: 20px 10px;
  168. border-bottom: 1px solid rgb(241, 242, 245);
  169. }
  170. .dw-link{
  171. text-decoration: none;
  172. color: #606266;
  173. font-size: 14px;
  174. }
  175. .dw-link-1{
  176. font-size: 14px;
  177. }
  178. .dw-link-primary,.dw-link:hover{
  179. color: #409eff;
  180. font-weight: bold;
  181. }
  182. .dw-link i{
  183. margin-right: 6px;
  184. }
  185. .dw-dcs-main-survey-step-main{
  186. padding: 20px 10px;
  187. }
  188. .dw-dcs-main-survey-step-item-status{
  189. background-color: rgb(241, 242, 245);
  190. font-size: 14px;
  191. padding: 10px;
  192. }
  193. </style>