TemplateMaintenance.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div>
  3. <crumbs title="模板维护" style="min-width: 980px">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="模板类型:">
  6. <el-select size="mini" v-model="filter.templateType" placeholder="模板类型" clearable>
  7. <el-option v-for="item in AdscriptionsType" :label="item.name" :value="item.key" :key="item.key" ></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="归属:">
  11. <el-select size="mini" v-model="filter.tagAdscription" placeholder="归属" clearable>
  12. <el-option
  13. v-for="item in Adscriptions"
  14. :label="item.name"
  15. :value="item.val"
  16. :key="item.val"
  17. ></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="属于:">
  21. <el-select size="mini" v-model="filter.ownTo" placeholder="属于" clearable>
  22. <el-option v-if="!!item.name" v-for="item in AdscriptionsOwnTo" :label="item.name" :value="item.conceptId" :key="item.conceptId" ></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button size="mini" @click="filterDatas">确认</el-button>
  27. <el-button size="mini" type="warning" @click="addIndeptTag">添加模板</el-button>
  28. </el-form-item>
  29. </el-form>
  30. </crumbs>
  31. <div class="contents">
  32. <el-table
  33. :data="list"
  34. border
  35. style="width: 100%">
  36. <el-table-column
  37. type="index"
  38. :index = 'indexMethod'
  39. label="编号"
  40. :resizable = "false"
  41. width="60">
  42. </el-table-column>
  43. <el-table-column
  44. :resizable = "false"
  45. prop="gmtModified"
  46. label="操作时间"
  47. width="180">
  48. </el-table-column>
  49. <el-table-column
  50. :resizable = "false"
  51. prop="name"
  52. label="模板名称">
  53. </el-table-column>
  54. <el-table-column
  55. :resizable = "false"
  56. prop="moduleTypeName"
  57. label="模板类型">
  58. </el-table-column>
  59. <el-table-column
  60. :resizable = "false"
  61. prop="relationName"
  62. label="属于">
  63. </el-table-column>
  64. <el-table-column
  65. :resizable = "false"
  66. prop="ascriptionName"
  67. label="归属">
  68. </el-table-column>
  69. <el-table-column
  70. :resizable = "false"
  71. prop="userName"
  72. label="操作人">
  73. </el-table-column>
  74. <el-table-column
  75. :resizable = "false"
  76. prop="operate"
  77. label="操作">
  78. <template slot-scope="scope">
  79. <el-button @click="modifyIndeptTag(scope.row)" type="text" size="small">修改</el-button>
  80. <span style="margin:0 3px;">|</span>
  81. <el-button @click="showDelDialog(scope.row.id,scope.row.type)" class="delete" type="text" size="small">删除</el-button>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. </div>
  86. <div class="pagination">
  87. <el-pagination v-if="total>pageSize"
  88. :current-page.sync="currentPage"
  89. @current-change="currentChange"
  90. background
  91. :page-size="pageSize"
  92. layout="total,prev, pager, next, jumper"
  93. :total="total">
  94. </el-pagination>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import api from '@api/icss.js';
  100. export default {
  101. name: 'TemplateMaintenance',
  102. data: function() {
  103. return {
  104. list: [],
  105. tagTypes: [],
  106. Adscriptions: [],
  107. tmpAdscriptions: [],
  108. AdscriptionsType:[],
  109. AdscriptionsOwnTo:[],
  110. tagTypesList: [],
  111. searched: false,
  112. filter: {
  113. tagType: [], //标签类型
  114. templateType: '', //模板类型
  115. ownTo: '', //属于科室、慢病
  116. tagAdscription: '', //标签归属
  117. tagSysName: '', //标签系统名称
  118. },
  119. currentPage: 1,
  120. pageSize: 10,
  121. total: 0,
  122. deptAndDisInfo:{},
  123. }
  124. },
  125. created() {
  126. this.getDropList().then(() => {
  127. this.getDataList()
  128. })
  129. this.getSubTemplate()
  130. },
  131. computed:{
  132. tmpType(){
  133. return this.filter.templateType
  134. }
  135. },
  136. watch: {
  137. 'filter': {
  138. handler: function () {
  139. this.searched = false;
  140. },
  141. deep: true
  142. },
  143. tmpType(newVal, preVal){
  144. this.filter.tagAdscription = ''
  145. //根据类型不同删选归属
  146. if((newVal+'') && (newVal == 0 || newVal == 1)){
  147. this.Adscriptions = this.tmpAdscriptions.filter((item) => {
  148. if(item.val != 4 && item.val != 5 && item.val != 6){
  149. return item
  150. }
  151. })
  152. }else if(newVal == 2){
  153. this.Adscriptions = this.tmpAdscriptions.filter((item) => {
  154. if(item.val != 1 && item.val != 31 && item.val != 22 && item.val != 322){
  155. return item
  156. }
  157. })
  158. }else{
  159. this.Adscriptions = this.tmpAdscriptions
  160. }
  161. if((newVal+'') != preVal){
  162. if(newVal == 1){
  163. this.AdscriptionsOwnTo = this.deptAndDisInfo.deptDTOS
  164. this.filter.ownTo = ''
  165. }else if(newVal == 2){
  166. this.AdscriptionsOwnTo = this.deptAndDisInfo.disDTOS
  167. this.filter.ownTo = ''
  168. }else{
  169. this.AdscriptionsOwnTo = []
  170. this.filter.ownTo = ''
  171. }
  172. }
  173. }
  174. },
  175. beforeRouteEnter(to, from, next) {
  176. next(vm => {
  177. //const pm = to.param;
  178. Object.assign(vm, to.params);
  179. })
  180. },
  181. methods: {
  182. getSubTemplate() {
  183. api.getAllDeptAndDisInfo({}).then((res) => {
  184. if (res.data.code === '0') {//获取科室和疾病所有信息
  185. let result = res.data.data
  186. this.deptAndDisInfo = result
  187. localStorage.setItem('deptDis',JSON.stringify(result))
  188. }
  189. })
  190. },
  191. getDropList() {
  192. let templateType = localStorage.getItem('icssEnumsData') ? JSON.parse(localStorage.getItem('icssEnumsData')).moduleInfoTypeEnum : []
  193. this.AdscriptionsType = templateType
  194. return api.getDropList().then((res) =>{
  195. if(res.data.code === '0') {
  196. this.tagTypes = res.data.data[6];
  197. this.Adscriptions = res.data.data[4];
  198. this.tmpAdscriptions = res.data.data[4];
  199. localStorage.setItem('typeLis',JSON.stringify(res.data.data[4]))
  200. for (var i = 0; i < this.tagTypes.length; i++) {
  201. this.tagTypesList.push(this.tagTypes[i].val)
  202. }
  203. }
  204. })
  205. },
  206. getDataList() {
  207. const param = this.getFilterItems();
  208. this.searched = true;
  209. api.getModuleInfoList(param).then((res) => {
  210. if(res.data.code == 0){
  211. const list = res.data.data.records
  212. for (var i = 0; i < list.length; i++) {
  213. for (var j = 0; j < this.tagTypes.length; j++) {
  214. if(list[i].tagType === this.tagTypes[j].val) {
  215. list[i].tagTypeCn = this.tagTypes[j].name;
  216. }
  217. }
  218. for (var z = 0; z < this.Adscriptions.length; z++) {
  219. if(list[i].type === this.Adscriptions[z].val) {
  220. list[i].typeCn = this.Adscriptions[z].name
  221. }
  222. }
  223. }
  224. this.list = list;
  225. this.total = res.data.data.total;
  226. }
  227. })
  228. },
  229. filterDatas() {
  230. this.currentPage = 1;
  231. this.getDataList();
  232. },
  233. addIndeptTag() {
  234. const pam = this.searched ? {
  235. currentPage: this.currentPage,
  236. filter: this.filter
  237. } : {currentPage: this.currentPage};
  238. this.$router.push({name: 'TemplateMaintenanceWrap', params: pam})
  239. },
  240. modifyIndeptTag(row) {
  241. // api.detailsTag({ids:row.id}).then((res) => {
  242. // if (res.data.code === '0') {//获取科室和疾病所有信息
  243. // let result = res.data.data
  244. // console.log(result)
  245. // }
  246. // })
  247. Promise.all([
  248. api.getModuleInfoOne({moduleId:row.id}),
  249. api.getModuleDetailInfo({moduleId:row.id,type:row.type})
  250. ]).then((data)=>{
  251. let data0 = data[0].data;
  252. let data1 = data[1].data;
  253. let allData = {},topMsg={},rightMsg={};
  254. if(data0.code == 0){
  255. topMsg = Object.assign({},data0.data);
  256. }
  257. if(data1.code == 0){
  258. rightMsg = Object.assign({},data1);
  259. }
  260. allData = Object.assign({}, topMsg, rightMsg);
  261. const pam = this.searched ? {
  262. currentPage: this.currentPage,
  263. filter: this.filter
  264. } : {currentPage: this.currentPage};
  265. this.$router.push({
  266. name: 'TemplateMaintenanceWrap',
  267. params: Object.assign(pam, {isEdit: true, data: allData})
  268. });
  269. })
  270. },
  271. currentChange(next) {
  272. this.currentPage = next;
  273. this.getDataList();
  274. },
  275. getFilterItems() {
  276. const param = {
  277. current: this.currentPage,
  278. size: this.pageSize,
  279. type: this.filter.tagAdscription,
  280. moduleType:this.filter.templateType,
  281. relationId:this.filter.ownTo
  282. };
  283. return param;
  284. },
  285. indexMethod(index) {
  286. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  287. },
  288. warning(msg,type){
  289. this.$message({
  290. showClose: true,
  291. message:msg,
  292. type:type||'warning'
  293. })
  294. },
  295. showConfirmDialog(msg,resolve){
  296. this.$alert(msg, '提示', {
  297. confirmButtonText: '确定',
  298. type: 'warning'
  299. }).then(() => {
  300. resolve();
  301. }).catch(() => {});
  302. },
  303. showDelDialog(id,type){
  304. this.showConfirmDialog('是否删除该标签?',()=>{
  305. api.delTemplate({ids:id,type:type}).then((res)=>{
  306. if(res.data.code=='0'){
  307. this.getDataList();
  308. this.warning(res.data.msg || '操作成功','success');
  309. }else{
  310. this.warning(res.data.msg);
  311. }
  312. }).catch((error)=>{
  313. this.warning(error);
  314. })
  315. });
  316. }
  317. }
  318. }
  319. </script>
  320. <style lang="less">
  321. .delete{
  322. color: red
  323. }
  324. .delete:hover {
  325. color: red;
  326. }
  327. </style>