index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <el-card class="tjm_card_style_custom">
  3. <div class="tjm_card_title">查询表格</div>
  4. <div class="tjm_card_select">
  5. <el-form class="tjm_card_select_left" :model="params" inline label-width="80px" label-position="left">
  6. <el-form-item label="案例编号">
  7. <el-input v-model="params.businessNo" clearable placeholder="请输入案例编号"></el-input>
  8. </el-form-item>
  9. <el-form-item label="项目名称">
  10. <el-input v-model="params.name" clearable placeholder="请输入项目名称"></el-input>
  11. </el-form-item>
  12. <el-form-item label="项目等级">
  13. <el-select v-model="params.zcLevel" clearable placeholder="请选择项目等级">
  14. <el-option v-for="item in levelDic" :key="item" :label="item" :value="item"></el-option>
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="项目类别">
  18. <el-select v-model="params.zcType" clearable placeholder="请选择项目类别">
  19. <el-option v-for="item in typeDic" :key="item" :label="item" :value="item"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="状态">
  23. <el-select v-model="params.status" clearable placeholder="请选择状态">
  24. <el-option v-for="(label, key) in statusDic" :key="key" :label="label" :value="key"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="填报日期">
  28. <el-date-picker v-model="createTime" type="daterange" value-format="YYYY-MM-DD" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button type="primary" icon="search" @click="reloadTable">搜索</el-button>
  32. <el-button icon="refresh-right" @click="reset">重置</el-button>
  33. </el-form-item>
  34. </el-form>
  35. </div>
  36. <el-divider></el-divider>
  37. <div class="tjm_card_tools">
  38. <div class="tjm_card_tools_left">
  39. <el-button type="primary" icon="plus" @click="table_add">新增</el-button>
  40. </div>
  41. <div class="tjm_card_tools_right">
  42. <el-button icon="download" @click="table_export">导出</el-button>
  43. </div>
  44. </div>
  45. <div class="tjm_card_table">
  46. <el-table v-loading="loading" row-key="id" header-cell-class-name="tjm_card_table_header" height="400" :data="tableData" border @row-click="(row, column) => !column.fixed && table_detail(row)">
  47. <el-table-column type="index" label="序号" width="55"></el-table-column>
  48. <template v-for="(item, index) in columns" :key="index">
  49. <el-table-column :label="item.label" :prop="item.props" :min-width="item.width || 180" show-overflow-tooltip>
  50. <template #default="scope">{{ columnFormat(scope.row, item.props) }}</template>
  51. </el-table-column>
  52. </template>
  53. <el-table-column label="操作" fixed="right" width="280">
  54. <template #default="scope">
  55. <template v-if="scope.row.status == 'active' || scope.row.status == 'inactive'">
  56. <template v-if="scope.row.status == 'active'">
  57. <el-button type="primary" link icon="edit" @click.stop="table_edit(scope.row)">修改</el-button>
  58. <el-button type="primary" link icon="upload" @click.stop="table_edit(scope.row)">上报</el-button>
  59. </template>
  60. <template v-if="scope.row.status == 'inactive'">
  61. <el-button type="primary" link icon="tickets" @click.stop="table_edit(scope.row)">重新上报</el-button>
  62. <el-button v-if="scope.row.processTaskId && scope.row.processInstanceId" type="primary" link @click.stop="table_process(scope.row)">
  63. <template #icon><tjm-icon-uis-process /></template>
  64. 审批流程
  65. </el-button>
  66. </template>
  67. <el-button type="primary" link icon="delete" @click.stop="table_del(scope.row)">删除</el-button>
  68. </template>
  69. <template v-if="scope.row.status == 'approve' || scope.row.status == 'done'">
  70. <el-button type="primary" link icon="tickets" @click.stop="table_detail(scope.row)">详情</el-button>
  71. <el-button v-if="scope.row.processTaskId && scope.row.processInstanceId" type="primary" link @click.stop="table_process(scope.row)">
  72. <template #icon><tjm-icon-uis-process /></template>
  73. 审批流程
  74. </el-button>
  75. </template>
  76. <el-button v-if="scope.row.status == 'approve' && scope.row.isWithdraw == 1" type="primary" link icon="refresh-right" @click.stop="table_withdraw(scope.row)">撤回</el-button>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. </div>
  81. <div class="tjm_card_pagination">
  82. <yh-pagination v-model:pageNo="params.page" v-model:pageSize="params.size" :total="total" @paginationChange="reloadTable"></yh-pagination>
  83. </div>
  84. </el-card>
  85. <case-share-detail v-if="dialog.detail" ref="caseShareDetail" @success="reloadTable" @closed="dialog.detail = false"></case-share-detail>
  86. <policy-process-dialog v-if="dialog.process" ref="processDialog" @success="reloadTable" @closed="dialog.process = false"></policy-process-dialog>
  87. <yh-workflow v-if="dialog.workflow" ref="yhWorkflow" @closed="dialog.workflow = false"></yh-workflow>
  88. </template>
  89. <script>
  90. import API from "@/api/policy/case";
  91. import { useUserStore } from "@/store/user";
  92. import { exportExcel } from "@/utils/exportExcel";
  93. import { levelDic, typeDic } from "@/views/policyShare/main";
  94. import { columns, statusDic } from "./main";
  95. import yhPagination from "@/components/Pagination/index.vue";
  96. import yhWorkflow from "@/components/Workflow/index.vue";
  97. import caseShareDetail from "./dialog.vue";
  98. import policyProcessDialog from "@/views/myBusiness/case.vue";
  99. export default {
  100. components: {
  101. yhPagination,
  102. yhWorkflow,
  103. caseShareDetail,
  104. policyProcessDialog
  105. },
  106. data() {
  107. return {
  108. columns, levelDic, typeDic, statusDic,
  109. loading: false,
  110. createTime: [],
  111. params: {
  112. page: 1,
  113. size: 10,
  114. createId: useUserStore().userInfo.id,
  115. userDeptId: useUserStore().userInfo.deptId
  116. },
  117. total: 0,
  118. tableData: [],
  119. dialog: {
  120. detail: false,
  121. process: false,
  122. workflow: false
  123. }
  124. }
  125. },
  126. mounted() {
  127. this.reloadTable();
  128. },
  129. methods: {
  130. columnFormat(row, props) {
  131. if (props.includes(".")) return row[props.split(".")[0]][props.split(".")[1]];
  132. if (props == "createTime") return row[props].split(" ")[0];
  133. if (props == "status") return statusDic[row[props]] || "";
  134. return row[props];
  135. },
  136. reloadTable(mode = "add") {
  137. if (mode == "add") this.params.page = 1;
  138. this.params.beginCreateTime = this.createTime && this.createTime.length && this.createTime[0] + " 00:00:00" || null;
  139. this.params.endCreateTime = this.createTime && this.createTime.length && this.createTime[1] + " 23:59:59" || null;
  140. this.loading = true;
  141. API.get(this.params).then(res => {
  142. this.loading = false;
  143. if (res.code === 200) {
  144. this.tableData = res.data.records;
  145. this.total = res.data.total;
  146. } else ElMessage.error(res.msg);
  147. }).catch(() => this.loading = false);
  148. },
  149. reset() {
  150. this.createTime = [];
  151. this.params = {
  152. page: 1,
  153. size: 10,
  154. createId: useUserStore().userInfo.id,
  155. userDeptId: useUserStore().userInfo.deptId
  156. }
  157. this.reloadTable();
  158. },
  159. table_export() {
  160. const header = this.columns.map(c => c.label);
  161. const data = this.tableData.map(v => this.columns.map(c => c.props).map(j => this.columnFormat(v, j)));
  162. exportExcel(header, data, [], `${this.$route.name}.xlsx`);
  163. },
  164. table_add() {
  165. this.dialog.detail = true;
  166. nextTick(() => this.$refs.caseShareDetail.open());
  167. },
  168. table_edit(row) {
  169. if (row.status == "inactive") {
  170. this.dialog.process = true;
  171. nextTick(() => this.$refs.processDialog.open("resubmit").setData(row.id));
  172. }
  173. if (row.status == "active") {
  174. this.dialog.detail = true;
  175. nextTick(() => this.$refs.caseShareDetail.open("edit").setData(row.id));
  176. }
  177. },
  178. table_detail(row) {
  179. this.dialog.detail = true;
  180. nextTick(() => this.$refs.caseShareDetail.open("detail").setData(row.id));
  181. },
  182. table_del(row) {
  183. ElMessageBox.confirm("是否确认删除?", "删除警告", {
  184. type: "warning",
  185. confirmButtonText: "确定",
  186. cancelButtonText: "取消"
  187. }).then(() => {
  188. API.del({ ids: row.id }).then(res => {
  189. if (res.code == 200) {
  190. ElMessage.success("操作成功");
  191. this.reloadTable();
  192. } else ElMessage.error(res.msg);
  193. });
  194. }).catch(() => ElMessage.success("已取消"));
  195. },
  196. table_withdraw(row) {
  197. ElMessageBox.confirm("是否确认撤回?", "提示", {
  198. type: "warning",
  199. confirmButtonText: "确定",
  200. cancelButtonText: "取消"
  201. }).then(() => {
  202. API.withdraw(row).then(res => {
  203. if (res.code === 200) {
  204. ElMessage.success("操作成功");
  205. this.reloadTable();
  206. } else ElMessage.error(res.msg);
  207. });
  208. }).catch(() => ElMessage.success("已取消"));
  209. },
  210. table_process(row) {
  211. this.dialog.workflow = true;
  212. nextTick(() => this.$refs.yhWorkflow.getDetail(row));
  213. }
  214. }
  215. }
  216. </script>