ProcessDefinitionIdentityLink.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <!-- <el-dialog
  3. :title="title"
  4. fullscreen
  5. :visible.sync="dialogProcessDefinitionIdentityLinkInChild"
  6. width="75%"
  7. > -->
  8. <ele-modal
  9. width="800px"
  10. :maxable="true"
  11. :visible="dialogProcessDefinitionIdentityLinkInChild"
  12. :close-on-click-modal="true"
  13. :title="title"
  14. @update:visible="updateVisible"
  15. >
  16. <!-- <el-button-group style="padding-bottom: 10px">
  17. <el-button
  18. icon="el-icon-plus"
  19. type="primary"
  20. @click="btnCreate"
  21. class="filter-item"
  22. >新增
  23. </el-button>
  24. </el-button-group> -->
  25. <el-table
  26. :data="records"
  27. @selection-change="selectionChange"
  28. border
  29. fit
  30. highlight-current-row
  31. style="width: 100%"
  32. :cell-style="{ padding: '3px' }"
  33. >
  34. <el-table-column type="selection" align="center"> </el-table-column>
  35. <el-table-column label="授权ID" prop="identityId" align="center">
  36. <template slot-scope="scope"
  37. ><span>{{ scope.row.identityId }}</span></template
  38. >
  39. </el-table-column>
  40. <el-table-column label="授权类型" prop="identityType" align="center">
  41. <template slot-scope="scope">
  42. <span
  43. v-html="formatDictText(dicts.identityType, scope.row.identityType)"
  44. ></span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="授权名称" prop="identityName" align="center">
  48. <template slot-scope="scope"
  49. ><span>{{ scope.row.identityName }}</span></template
  50. >
  51. </el-table-column>
  52. <el-table-column label="操作" align="center">
  53. <template slot-scope="{ row }">
  54. <el-dropdown>
  55. <span class="el-dropdown-link"
  56. >操作<i class="el-icon-arrow-down el-icon--right"></i
  57. ></span>
  58. <el-dropdown-menu slot="dropdown">
  59. <el-dropdown-item icon="el-icon-view" @click.native="btnView(row)"
  60. >查看
  61. </el-dropdown-item>
  62. <el-dropdown-item
  63. v-permission="'flowable:processDefinitionIdentityLink:delete'"
  64. icon="el-icon-delete"
  65. divided
  66. @click.native="btnDelete(row)"
  67. >删除
  68. </el-dropdown-item>
  69. </el-dropdown-menu>
  70. </el-dropdown>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <el-dialog
  75. title="流程授权"
  76. :visible.sync="dialogFormVisible"
  77. :append-to-body="true"
  78. >
  79. <el-form
  80. ref="dataForm"
  81. :rules="rules"
  82. :model="temp"
  83. :disabled="dialogStatus === 'view'"
  84. label-position="right"
  85. label-width="110px"
  86. >
  87. <el-form-item label="授权类型" prop="identityType">
  88. <!--<el-input v-model="temp.identityType"/>-->
  89. <el-select v-model="temp.identityType" placeholder="授权类型">
  90. <el-option
  91. v-for="(item, index) in dicts.identityType"
  92. :key="index"
  93. :label="item.content"
  94. :value="item.value"
  95. ></el-option>
  96. </el-select>
  97. </el-form-item>
  98. <el-form-item label="授权id" prop="identityId">
  99. <el-input
  100. v-model="temp.identityId"
  101. :placeholder="placeholderIdentityId"
  102. />
  103. </el-form-item>
  104. </el-form>
  105. <div slot="footer" class="dialog-footer">
  106. <el-button icon="el-icon-close" @click="dialogFormVisible = false"
  107. >取消</el-button
  108. >
  109. <el-button
  110. v-if="dialogStatus !== 'view'"
  111. icon="el-icon-check"
  112. type="primary"
  113. @click="createData()"
  114. >确定
  115. </el-button>
  116. </div>
  117. </el-dialog>
  118. </ele-modal>
  119. </template>
  120. <script>
  121. import { deleteAction, getAction, postAction } from '@/api/flowable/manage';
  122. import { Message } from 'element-ui';
  123. export default {
  124. name: 'ProcessDefinitionIdentityLink',
  125. props: {
  126. visible: {
  127. type: Boolean,
  128. default: function () {
  129. return false;
  130. }
  131. },
  132. // dicts: {
  133. // type: Object,
  134. // default: function () {
  135. // return {}
  136. // }
  137. // },
  138. processDefinitionId: {
  139. type: String,
  140. default: function () {
  141. return '';
  142. }
  143. },
  144. processDefinitionName: {
  145. type: String,
  146. default: function () {
  147. return '';
  148. }
  149. }
  150. },
  151. computed: {
  152. dialogProcessDefinitionIdentityLinkInChild: {
  153. get() {
  154. return this.visible;
  155. },
  156. set(val) {
  157. this.$emit('update:visible', val);
  158. }
  159. },
  160. title: {
  161. get() {
  162. return '流程授权【' + this.processDefinitionName + '】';
  163. }
  164. },
  165. placeholderIdentityId: {
  166. get() {
  167. if (this.temp.identityType == '1') {
  168. return '请输入用户id';
  169. } else if (this.temp.identityType == '2') {
  170. return '请输入岗位id';
  171. } else {
  172. return '请先选择授权类型';
  173. }
  174. }
  175. }
  176. },
  177. created() {
  178. // this.getDicts('identityType').then(({data}) => {
  179. // this.dicts = data
  180. // })
  181. this.list();
  182. },
  183. data() {
  184. return {
  185. records: [],
  186. selectedRecords: [],
  187. dicts: [],
  188. listQuery: {
  189. processDefinitionId: this.processDefinitionId,
  190. identityType: '',
  191. identityId: ''
  192. },
  193. dialogFormVisible: false,
  194. dialogStatus: '',
  195. temp: {
  196. processDefinitionId: this.processDefinitionId,
  197. identityType: '',
  198. identityId: ''
  199. },
  200. rules: {
  201. identityType: [
  202. { required: true, message: '该项不能为空', trigger: 'change' }
  203. ],
  204. identityId: [
  205. { required: true, message: '该项不能为空', trigger: 'change' }
  206. ]
  207. }
  208. };
  209. },
  210. methods: {
  211. updateVisible(value) {
  212. this.$emit('update:visible', value);
  213. },
  214. list() {
  215. getAction(
  216. '/flowable/processDefinitionIdentityLink/list',
  217. this.listQuery
  218. ).then((res) => {
  219. const { data } = res;
  220. this.records = data;
  221. });
  222. },
  223. resetTemp() {
  224. this.temp = {
  225. processDefinitionId: this.processDefinitionId,
  226. identityType: '',
  227. identityId: ''
  228. };
  229. },
  230. btnView(row) {
  231. this.temp = Object.assign({}, row);
  232. this.dialogStatus = 'view';
  233. this.dialogFormVisible = true;
  234. this.$nextTick(() => {
  235. this.$refs['dataForm'].clearValidate();
  236. });
  237. },
  238. btnCreate() {
  239. this.resetTemp();
  240. this.dialogStatus = 'create';
  241. this.dialogFormVisible = true;
  242. this.$nextTick(() => {
  243. this.$refs['dataForm'].clearValidate();
  244. });
  245. },
  246. createData() {
  247. this.$refs['dataForm'].validate((valid) => {
  248. if (valid) {
  249. postAction(
  250. '/flowable/processDefinitionIdentityLink/save',
  251. this.temp
  252. ).then(({ msg }) => {
  253. this.dialogFormVisible = false;
  254. Message.success(msg);
  255. this.list();
  256. });
  257. }
  258. });
  259. },
  260. btnDelete(row) {
  261. deleteAction('/flowable/processDefinitionIdentityLink/delete', {
  262. processDefinitionId: this.processDefinitionId,
  263. identityType: row.identityType,
  264. identityId: row.identityId
  265. }).then(({ msg }) => {
  266. Message.success(msg);
  267. this.list();
  268. });
  269. },
  270. selectionChange(selectedRecords) {
  271. this.selectedRecords = selectedRecords;
  272. }
  273. }
  274. };
  275. </script>