CombinQuestion.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div>
  3. <crumbs title="组合填写单维护">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="归属:">
  6. <el-select size="mini" v-model="filter.tagAdscription" @change="getValue" placeholder="归属" clearable>
  7. <el-option v-if="item.val!=6&&item.val!=7&&item.val!=8&&item.val!=9&&item.val!=10&&item.val!=21&&item.val!=22" v-for="item in Adscriptions" :label="item.name" :value="item.val" :key="item.id" ></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="类型:">
  11. <el-select size="mini" v-model="filter.tagType[0]" placeholder="类型" clearable>
  12. <el-option v-for="item in tagTypes" :label="item.name" :value="item.val" :key="item.id"></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="填写单系统名称:">
  16. <el-input size="mini" v-model="filter.tagSysName" placeholder="填写单系统名称" clearable></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button size="mini" @click="filterDatas">确认</el-button>
  20. <el-button size="mini" type="warning" @click="addIndeptTag">添加组合填写单</el-button>
  21. </el-form-item>
  22. </el-form>
  23. </crumbs>
  24. <div class="contents">
  25. <el-table
  26. :data="list"
  27. border
  28. style="width: 100%">
  29. <el-table-column
  30. :resizable = "false"
  31. type="index"
  32. :index = 'indexMethod'
  33. label="编号"
  34. width="60">
  35. </el-table-column>
  36. <el-table-column
  37. :resizable = "false"
  38. prop="gmtModified"
  39. label="操作时间"
  40. width="180">
  41. </el-table-column>
  42. <el-table-column
  43. :resizable = "false"
  44. prop="tagName"
  45. label="填写单系统名称">
  46. </el-table-column>
  47. <el-table-column
  48. :resizable = "false"
  49. prop="typeCn"
  50. label="归属"
  51. width="80">
  52. </el-table-column>
  53. <el-table-column
  54. :resizable = "false"
  55. prop="tagTypeCn"
  56. label="类型">
  57. </el-table-column>
  58. <el-table-column
  59. :resizable = "false"
  60. prop="modifier"
  61. label="操作人"
  62. width="120">
  63. </el-table-column>
  64. <el-table-column
  65. :resizable = "false"
  66. prop="operate"
  67. label="操作"
  68. width="120">
  69. <template slot-scope="scope">
  70. <el-button @click="modifyIndeptTag(scope.row)" type="text" size="small">修改</el-button>
  71. <span style="margin:0 3px;">|</span>
  72. <el-button @click="showDelDialog(scope.row)" class="delete" type="text" size="small">删除</el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <el-pagination v-if="total>pageSize"
  77. :current-page.sync="currentPage"
  78. @current-change="currentChange"
  79. background
  80. :page-size="pageSize"
  81. layout="total,prev, pager, next, jumper"
  82. :total="total">
  83. </el-pagination>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import api from '@api/preTreat.js';
  89. export default {
  90. name: 'combinQuestion',
  91. data: function() {
  92. return {
  93. list: [],
  94. tagTypes: [],
  95. Adscriptions: [],
  96. tagTypesList:[],
  97. filter: {
  98. tagType: [], //标签类型
  99. tagAdscription: '', //标签归属
  100. tagSysName: '', //标签系统名称
  101. },
  102. currentPage: 1,
  103. pageSize: 10,
  104. total: 0,
  105. }
  106. },
  107. created() {
  108. this.getDropList();
  109. },
  110. methods: {
  111. getValue(val) {
  112. console.log('changeVal', val, this.filter.tagAdscription)
  113. },
  114. getDropList() {
  115. api.getPreTypeList().then((res) =>{
  116. this.getDataList();
  117. if(res.data.code === '0') {
  118. this.Adscriptions = res.data.data[1];
  119. this.tagTypes = res.data.data[3];
  120. this.tagTypes = this.tagTypes.filter(item => item.val != 0) //去掉名称为默认值的填写单类型
  121. }
  122. })
  123. },
  124. getDataList() {
  125. const param = this.getFilterItems();
  126. api.getQuestionList(param).then((res) => {
  127. const list = [...res.data.data.records];
  128. for (var i = 0; i < list.length; i++) {
  129. for (var j = 0; j < this.tagTypes.length; j++) {
  130. if(list[i].controlType == this.tagTypes[j].val) {
  131. list[i].tagTypeCn = this.tagTypes[j].name;
  132. }
  133. }
  134. //后台数据typeCn转换为筛选中对应的字段名称
  135. for (var z = 0; z < this.Adscriptions.length; z++) {
  136. if(list[i].type == this.Adscriptions[z].val) {
  137. list[i].typeCn = this.Adscriptions[z].name;
  138. }
  139. }
  140. }
  141. this.list = list;
  142. this.total = res.data.data.total;
  143. })
  144. },
  145. filterDatas() {
  146. this.currentPage = 1;
  147. this.getDataList();
  148. },
  149. addIndeptTag() {
  150. this.$router.push({path:'LT-YWZSJWH-TJZHTXD'});
  151. },
  152. modifyIndeptTag(row) {
  153. api.questionDetail({id:row.id}).then((res)=>{
  154. const {code,data,msg} = res.data;
  155. if(code=='0'){
  156. this.$router.push({name:'AddCombinQuestion',params:{isEdit:true,data:data}});
  157. }else{
  158. this.$message({
  159. message: msg,
  160. type: 'warning'
  161. });
  162. }
  163. });
  164. },
  165. currentChange(next) {
  166. this.currentPage = next;
  167. this.getDataList();
  168. },
  169. getFilterItems() {
  170. const param = {
  171. tagTypeList: this.filter.tagType[0] ? this.filter.tagType: [4,6],
  172. current: this.currentPage,
  173. size: this.pageSize,
  174. type: this.filter.tagAdscription,
  175. tagName: this.filter.tagSysName,
  176. };
  177. return param;
  178. },
  179. indexMethod(index) {
  180. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  181. },
  182. getTagType(val) {
  183. return val
  184. },
  185. warning(msg,type){
  186. this.$message({
  187. showClose: true,
  188. message:msg,
  189. type:type||'warning'
  190. })
  191. },
  192. showConfirmDialog(msg,resolve){
  193. this.$alert(msg, '提示', {
  194. confirmButtonText: '确定',
  195. type: 'warning'
  196. }).then(() => {
  197. resolve();
  198. }).catch(() => {});
  199. },
  200. showDelDialog(row){
  201. const param = {
  202. "ids": row.id,
  203. "type": row.type
  204. };
  205. this.showConfirmDialog('是否删除该填写单?',()=>{
  206. api.questionDel(param).then((res)=>{
  207. if(res.data.code=='0'){
  208. this.getDataList();
  209. this.warning(res.data.msg || '操作成功','success');
  210. }else{
  211. this.warning(res.data.msg);
  212. }
  213. }).catch((error)=>{
  214. this.warning(error);
  215. })
  216. });
  217. }
  218. }
  219. }
  220. </script>
  221. <style lang="less">
  222. @import "../../less/admin.less";
  223. .delete{
  224. color: red
  225. }
  226. .delete:hover {
  227. color: red;
  228. }
  229. .el-select .el-input .el-icon-arrow-up{
  230. display: inline-block!important;
  231. }
  232. .el-select .el-input .el-icon-circle-close{
  233. float:left;
  234. }
  235. </style>