7fa058eac9a6cf6a000736d43dfffd2ba6db5910.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <!-- -->
  2. <template>
  3. <div style="width:100%;">
  4. <el-row style="text-align:center;">
  5. <el-col :span="1">
  6. <el-button type="text" icon="el-icon-back" @click="goBack">后退.</el-button>
  7. </el-col>
  8. <el-col :span="22">
  9. </el-col>
  10. <el-col :span="1">
  11. </el-col>
  12. </el-row>
  13. <el-row :gutter="10" style="padding:0 15px;">
  14. <el-col :span="12">
  15. <el-card class="box-card">
  16. <div slot="header" class="clearfix">
  17. <span>问卷</span>
  18. <el-button style="float: right; padding: 3px 0" type="text" @click="showAddQuesDialog">添加问卷试题</el-button>
  19. </div>
  20. <div class="text item">
  21. <el-table
  22. :data="tableData"
  23. :height="tableHight"
  24. stripe
  25. border
  26. style="width: 100%">
  27. <el-table-column
  28. prop="label"
  29. label="填报项名称"
  30. show-overflow-tooltip
  31. width="180">
  32. </el-table-column>
  33. <el-table-column
  34. prop="isrequired"
  35. label="是否必填"
  36. :formatter="notNullFormatter"
  37. show-overflow-tooltip
  38. >
  39. </el-table-column>
  40. <el-table-column
  41. prop="type"
  42. label="填报项类型"
  43. show-overflow-tooltip>
  44. </el-table-column>
  45. <!-- <el-table-column
  46. prop="note"
  47. label="备注"
  48. show-overflow-tooltip>
  49. </el-table-column> -->
  50. <el-table-column
  51. width="150"
  52. label="操作">
  53. <template slot-scope="scope">
  54. <el-button
  55. style="color:#409eff"
  56. size="mini"
  57. type="text"
  58. icon="el-icon-edit"
  59. @click.stop="editData(scope.$index, scope.row)">编辑</el-button>
  60. <el-button
  61. style="color:#e6a23c"
  62. size="mini"
  63. type="text"
  64. icon="el-icon-delete"
  65. @click.stop="handleDelete(scope.$index, scope.row)">删除</el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <el-pagination
  70. style="text-align:center;"
  71. @size-change="handleSizeChange"
  72. @current-change="handleCurrentChange"
  73. :current-page.sync="pageNum"
  74. :page-sizes="[10, 20, 30, 40, 50, 100]"
  75. :page-size="pageSize"
  76. layout="total, sizes, prev, pager, next, jumper"
  77. :total="total">
  78. </el-pagination>
  79. </div>
  80. </el-card>
  81. </el-col>
  82. <el-col :span="12">
  83. <el-card class="box-card">
  84. <div slot="header" class="clearfix">
  85. <span>问卷预览</span>
  86. <!-- <el-button style="float: right; padding: 3px 0" type="text" @click="showFormEvent">预览</el-button> -->
  87. </div>
  88. <div class="text item" :style="{'height':tableHight + 29 + 'px'}">
  89. <simpleDataForm
  90. v-if="showForm"
  91. :tableViewConfig="config"
  92. :labelWidth='`300px`'
  93. >
  94. </simpleDataForm>
  95. </div>
  96. </el-card>
  97. </el-col>
  98. </el-row>
  99. <addQuestion
  100. v-if="addQues"
  101. :meetingInfoRow="meetingInfoRow"
  102. :editFormData="editFormDataQus"
  103. @cancelHandler="cancelHandlerQus"
  104. @addSuccessStatus="addSuccessStatusEventQues"
  105. ></addQuestion>
  106. </div>
  107. </template>
  108. <script>
  109. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  110. //例如:import 《组件名称》 from '《组件路径》';
  111. import simpleDataForm from '@widget/simpleDataForm.vue'
  112. import addQuestion from './addQuestion'
  113. import { quillEditor } from 'vue-quill-editor'
  114. import { addMeetingBase,getQusLists,deleteQues } from "../../api/meetingAPI.js";
  115. import tinymce from 'tinymce/tinymce'
  116. import 'tinymce/themes/silver/theme'
  117. import Editor from '@tinymce/tinymce-vue'
  118. import 'tinymce/plugins/image'
  119. import 'tinymce/plugins/link'
  120. import 'tinymce/plugins/code'
  121. import 'tinymce/plugins/table'
  122. import 'tinymce/plugins/lists'
  123. import 'tinymce/plugins/contextmenu'
  124. import 'tinymce/plugins/wordcount'
  125. import 'tinymce/plugins/colorpicker'
  126. import 'tinymce/plugins/textcolor'
  127. import 'quill/dist/quill.core.css'
  128. import 'quill/dist/quill.snow.css'
  129. import 'quill/dist/quill.bubble.css'
  130. export default {
  131. //import引入的组件需要注入到对象中才能使用
  132. components: {
  133. quillEditor,
  134. addQuestion,
  135. simpleDataForm
  136. },
  137. props:['meetingInfoRow'],
  138. data() {
  139. //这里存放数据
  140. return {
  141. fields:[],
  142. config:{
  143. "type": "list",
  144. "title": "问卷",
  145. "columnCount": 1,
  146. // "fields": [
  147. // // {
  148. // // "prop": "1",
  149. // // "label": "培训人员",
  150. // // "type": "text",
  151. // // "isrequired": true,
  152. // // "refObjValue": null,
  153. // // },
  154. // // {
  155. // // "prop": "22",
  156. // // "label": "您对于本次会议的日程安排",
  157. // // "type": "select",
  158. // // "isrequired": false,
  159. // // "refObjValue": "isNot",
  160. // // },
  161. // // {
  162. // // "prop": "11",
  163. // // "label": "对本次会议提出意见",
  164. // // "type": "textarea",
  165. // // "isrequired": false,
  166. // // "refObjValue": null,
  167. // // },
  168. // // {
  169. // // "prop": "123",
  170. // // "label": "测试",
  171. // // "type": "select",
  172. // // "isrequired": false,
  173. // // "refObjValue": null,
  174. // // }
  175. // ],
  176. },
  177. editFormDataQus:{},
  178. addQues:false,
  179. showForm:false,
  180. pageNum:1,
  181. pageSize:10,
  182. total:0,
  183. tableData:[],
  184. tableDataForm:[],
  185. };
  186. },
  187. //监听属性 类似于data概念
  188. computed: {
  189. tableHight(){
  190. if(window.innerWidth <= 1366){
  191. return window.innerHeight - 360;
  192. }else{
  193. return window.innerHeight - 260;
  194. }
  195. }
  196. },
  197. //监控data中的数据变化
  198. watch: {
  199. showForm(n,o){
  200. this.showForm = n;
  201. }
  202. },
  203. //方法集合
  204. methods: {
  205. editData(index,row){
  206. this.editFormDataQus = row;
  207. this.addQues = true;
  208. },
  209. notNullFormatter:function(row, column){
  210. return row.isrequired == "1" ? '是':'否'
  211. },
  212. handleSizeChange(val) {
  213. console.log(`每页 ${val} 条`);
  214. },
  215. handleCurrentChange(val) {
  216. console.log(`当前页: ${val}`);
  217. },
  218. goBack(){
  219. this.$emit('geBack',true)
  220. },
  221. cancelHandlerQus(){
  222. this.addQues = false;
  223. this.getQusTableData();
  224. },
  225. showAddQuesDialog(){
  226. this.showForm = false;
  227. this.editFormDataQus = {};
  228. this.addQues = true;
  229. },
  230. //添加人员后冒上来的事件
  231. addSuccessStatusEventQues(item){
  232. if(item.success = true){
  233. this.cancelHandlerQus();
  234. this.$message.success('操作成功!');
  235. }else{
  236. this.$message.error(res.message);
  237. }
  238. },
  239. getQusTableData(){
  240. var _self = this;
  241. let obj = {
  242. "pageNum":_self.pageNumSgin,
  243. "pageSize":_self.pageSizeSgin,
  244. "meetId":_self.meetingInfoRow.id,
  245. }
  246. getQusLists(obj).then(response => {
  247. _self.tableData = response.data.list;
  248. _self.tableDataForm = response.data.list;
  249. _self.total = response.data.total;
  250. _self.tableDataForm.forEach((ele,index) => {
  251. // delete ele.id;
  252. delete ele.meetId;
  253. delete ele.position;
  254. delete ele.note;
  255. ele['prop'] = index;
  256. if(ele.type == 'select'){
  257. ele['refObjValue'] = 'isNot';
  258. }else{
  259. ele['refObjValue'] = null;
  260. }
  261. });
  262. // _self.tableData.map((value,index,arry)=>{
  263. // if(value.type == 'select'){
  264. // _self.fields.push({
  265. // 'prop':index,
  266. // 'label': value.label,
  267. // 'type': value.type,
  268. // 'isrequired': value.isrequired,
  269. // 'refObjValue':'isNot',
  270. // })
  271. // }else{
  272. // _self.fields.push({
  273. // 'prop':index,
  274. // 'label': value.label,
  275. // 'type': value.type,
  276. // 'isrequired': value.isrequired,
  277. // 'refObjValue':null,
  278. // })
  279. // }
  280. // })
  281. _self.config['fields'] = _self.tableDataForm;
  282. _self.showForm = true;
  283. // _self.showForm = true;
  284. console.log(_self.config);
  285. });
  286. },
  287. showFormEvent(){
  288. this.showForm = true;
  289. },
  290. handleDelete(index,row) {
  291. var _self = this;
  292. _self.showForm = false;
  293. this.$confirm('此操作将删除该填报项, 是否继续?', '提示', {
  294. confirmButtonText: '确定',
  295. cancelButtonText: '取消',
  296. type: 'warning'
  297. }).then(() => {
  298. deleteQues(row.id).then(response => {
  299. if(response.success == true){
  300. _self.$message.success('删除成功!');
  301. _self.getQusTableData();
  302. }else{
  303. _self.$message.error(item.message);
  304. }
  305. });
  306. }).catch(() => {
  307. this.$message({
  308. type: 'info',
  309. message: '已取消删除'
  310. });
  311. });
  312. },
  313. },
  314. //生命周期 - 创建完成(可以访问当前this实例)
  315. created() {
  316. },
  317. //生命周期 - 挂载完成(可以访问DOM元素)
  318. mounted() {
  319. this.getQusTableData();
  320. },
  321. beforeCreate() {}, //生命周期 - 创建之前
  322. beforeMount() {}, //生命周期 - 挂载之前
  323. beforeUpdate() {}, //生命周期 - 更新之前
  324. updated() {}, //生命周期 - 更新之后
  325. beforeDestroy() {}, //生命周期 - 销毁之前
  326. destroyed() {}, //生命周期 - 销毁完成
  327. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  328. }
  329. </script>
  330. <style scoped>
  331. </style>