综合办公系统
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

index.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item prop="projectId">
  5. <el-select v-model="queryType" style="width: 100px;">
  6. <el-option label="项目编号" value="1"></el-option>
  7. <el-option label="项目名称" value="2"></el-option>
  8. </el-select>
  9. <el-select v-model="queryParams.projectId" clearable filterable remote reserve-keyword placeholder="请输入关键字"
  10. :remote-method="remoteMethod" :loading="loading" style="width: 300px;">
  11. <el-option v-for="project in projectList" :key="project.projectId"
  12. :label="project.projectNumber + '-' + project.projectName" :value="project.projectId">
  13. </el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="编制人" prop="compiler">
  17. <el-select v-model="queryParams.compiler" filterable clearable>
  18. <el-option :key="item.userId" v-for="item of $store.state.user.userList" :label="item.nickName"
  19. :value="item.userId"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  30. v-hasPermi="['oa:budget:export']">导出</el-button>
  31. </el-col>
  32. </el-row>
  33. <el-table v-loading="loading" :data="budgetList" @selection-change="handleSelectionChange">
  34. <el-table-column label="序号" align="center" type="index" />
  35. <el-table-column label="项目编号" align="center" prop="project.projectNumber" />
  36. <el-table-column label="项目名称" align="center" prop="project.projectName" />
  37. <el-table-column label="人员成本" align="center" prop="staffCost" />
  38. <el-table-column label="车辆成本" align="center" prop="carCost" />
  39. <el-table-column label="设备成本" align="center" prop="deviceCost" />
  40. <el-table-column label="预算总额" align="center" prop="totalBudget" />
  41. <el-table-column label="编制人" align="center" prop="compiler">
  42. <template slot-scope="scope">
  43. {{ getUserName(scope.row.compiler) }}
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="审核人" align="center" prop="auditor">
  47. <template slot-scope="scope">
  48. {{ getUserName(scope.row.auditor) }}
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="是否核算" align="center" class-name="small-padding fixed-width">
  52. <template slot-scope="scope">
  53. <el-tag v-if="scope.row.isAdjust" type="success">是</el-tag>
  54. <el-tag v-else type="danger">否</el-tag>
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  58. <template slot-scope="scope">
  59. <el-button size="mini" type="text" icon="el-icon-tickets" @click="handleNewView(scope.row)"
  60. v-hasPermi="['oa:budget:query']">新版预算</el-button>
  61. <el-button size="mini" type="text" icon="el-icon-document-remove" @click="handleView(scope.row)"
  62. v-hasPermi="['oa:budget:query']">旧版预算</el-button>
  63. <el-button size="mini" type="text" icon="el-icon-document-checked" @click="handleAdjust(scope.row)"
  64. v-hasRole="['leader']" v-if="scope.row.isAdjust">查看核算</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  69. @pagination="getList" />
  70. <!-- 添加或修改cmc预算管理对话框 -->
  71. <el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
  72. <form-data :form="form" @close="open = false"></form-data>
  73. </el-dialog>
  74. <el-dialog title="新版预算" :visible.sync="newInfoOpen" width="70%" append-to-body>
  75. <new-budget-info :taskForm="taskForm" :taskName="''"></new-budget-info>
  76. </el-dialog>
  77. <el-dialog title="旧版预算" :visible.sync="infoOpen" width="70%" append-to-body>
  78. <budget-info :taskForm="taskForm" :taskName="''"></budget-info>
  79. </el-dialog>
  80. <el-dialog title="项目核算" :visible.sync="adjustOpen" width="70%" append-to-body>
  81. <budget-adjust :taskForm="taskForm" :taskName="''" :row="clickRow"></budget-adjust>
  82. </el-dialog>
  83. </div>
  84. </template>
  85. <script>
  86. import { listBudget, getBudget, delBudget, addBudget, updateBudget } from "@/api/oa/budget/budget";
  87. import { listCheck, getCheck, delCheck, addCheck, updateCheck } from "@/api/oa/budget/check";
  88. import { listProject } from '@/api/oa/project/project';
  89. import budgetInfo from '@/views/flowable/form/budget/budgetInfo.vue';
  90. import newBudgetInfo from '@/views/flowable/form/budget/adjust/newBudgetInfo.vue';
  91. import budgetAdjust from '@/views/flowable/form/budget/adjust/budgetAdjust.vue';
  92. import FormData from './formData.vue';
  93. export default {
  94. name: "Budget",
  95. components: { budgetInfo, FormData, newBudgetInfo, budgetAdjust },
  96. data() {
  97. return {
  98. // 遮罩层
  99. loading: true,
  100. // 选中数组
  101. ids: [],
  102. // 非单个禁用
  103. single: true,
  104. // 非多个禁用
  105. multiple: true,
  106. // 显示搜索条件
  107. showSearch: true,
  108. // 总条数
  109. total: 0,
  110. // cmc预算管理表格数据
  111. budgetList: [],
  112. // 弹出层标题
  113. title: "",
  114. // 是否显示弹出层
  115. open: false,
  116. infoOpen: false,
  117. // 查询参数
  118. queryParams: {
  119. pageNum: 1,
  120. pageSize: 10,
  121. projectId: null,
  122. staffCost: null,
  123. carCost: null,
  124. deviceCost: null,
  125. fixCost: null,
  126. settleExpense: null,
  127. outExpense: null,
  128. businessExpense: null,
  129. taxExpense: null,
  130. rentExpense: null,
  131. otherExpense: null,
  132. outRemark: null,
  133. businessRemark: null,
  134. taxRemark: null,
  135. rentRemark: null,
  136. otherRemark: null,
  137. directExpense: null,
  138. totalBudget: null,
  139. compiler: null,
  140. auditor: null,
  141. },
  142. // 表单参数
  143. form: {},
  144. // 表单校验
  145. rules: {
  146. },
  147. taskForm: {
  148. formId: ''
  149. },
  150. projectList: [],
  151. queryType: '1',
  152. isOld: false,
  153. clickRow: {},
  154. isAdjust: false,
  155. adjustOpen: false,
  156. newInfoOpen: false,
  157. };
  158. },
  159. created() {
  160. this.getList();
  161. },
  162. methods: {
  163. /** 查询cmc预算管理列表 */
  164. getList() {
  165. this.loading = true;
  166. listBudget(this.queryParams).then(async response => {
  167. this.budgetList = response.rows;
  168. for (let i of this.budgetList) {
  169. let res = await listCheck({ budgetId: i.budgetId });
  170. if (res.rows.length > 0) {
  171. this.$set(i, 'isAdjust', true);
  172. } else {
  173. this.$set(i, 'isAdjust', false);
  174. }
  175. }
  176. this.total = response.total;
  177. this.loading = false;
  178. });
  179. },
  180. remoteMethod(val) {
  181. let params1 = {
  182. pageNum: 1,
  183. pageSize: 20,
  184. projectNumber: val
  185. }
  186. let params2 = {
  187. pageNum: 1,
  188. pageSize: 20,
  189. projectName: val
  190. }
  191. let params = {};
  192. if (this.queryType == '1') {
  193. params = params1
  194. } else {
  195. params = params2
  196. }
  197. listProject(params).then(res => {
  198. this.projectList = res.rows;
  199. })
  200. },
  201. // 取消按钮
  202. cancel() {
  203. this.open = false;
  204. this.reset();
  205. },
  206. // 表单重置
  207. reset() {
  208. this.form = {
  209. budgetId: null,
  210. projectId: null,
  211. staffCost: null,
  212. carCost: null,
  213. deviceCost: null,
  214. fixCost: null,
  215. settleExpense: null,
  216. outExpense: null,
  217. businessExpense: null,
  218. taxExpense: null,
  219. rentExpense: null,
  220. otherExpense: null,
  221. outRemark: null,
  222. businessRemark: null,
  223. taxRemark: null,
  224. rentRemark: null,
  225. otherRemark: null,
  226. directExpense: null,
  227. totalBudget: null,
  228. compiler: null,
  229. auditor: null,
  230. createTime: null
  231. };
  232. this.resetForm("form");
  233. },
  234. /** 搜索按钮操作 */
  235. handleQuery() {
  236. this.queryParams.pageNum = 1;
  237. this.getList();
  238. },
  239. /** 重置按钮操作 */
  240. resetQuery() {
  241. this.resetForm("queryForm");
  242. this.handleQuery();
  243. },
  244. // 多选框选中数据
  245. handleSelectionChange(selection) {
  246. this.ids = selection.map(item => item.budgetId)
  247. this.single = selection.length !== 1
  248. this.multiple = !selection.length
  249. },
  250. /** 新增按钮操作 */
  251. handleAdd() {
  252. this.reset();
  253. this.open = true;
  254. this.title = "添加预算";
  255. },
  256. async handleView(row) {
  257. this.clickRow = row;
  258. this.taskForm.formId = row.projectId;
  259. this.infoOpen = true;
  260. },
  261. handleNewView(row) {
  262. this.taskForm.formId = row.projectId;
  263. this.clickRow = row;
  264. this.newInfoOpen = true;
  265. },
  266. async handleAdjust(row) {
  267. let res = await listCheck({ budgetId: row.budgetId });
  268. if (res.rows.length > 0) {
  269. this.taskForm.formId = res.rows[0].checkId;
  270. }
  271. this.clickRow = row;
  272. this.adjustOpen = true;
  273. },
  274. /** 修改按钮操作 */
  275. handleUpdate(row) {
  276. this.reset();
  277. const budgetId = row.budgetId || this.ids
  278. getBudget(budgetId).then(response => {
  279. this.form = response.data;
  280. this.open = true;
  281. this.title = "修改预算";
  282. });
  283. },
  284. /** 提交按钮 */
  285. submitForm() {
  286. this.$refs["form"].validate(valid => {
  287. if (valid) {
  288. if (this.form.budgetId != null) {
  289. updateBudget(this.form).then(response => {
  290. this.$modal.msgSuccess("修改成功");
  291. this.open = false;
  292. this.getList();
  293. });
  294. } else {
  295. addBudget(this.form).then(response => {
  296. this.$modal.msgSuccess("新增成功");
  297. this.open = false;
  298. this.getList();
  299. });
  300. }
  301. }
  302. });
  303. },
  304. /** 删除按钮操作 */
  305. handleDelete(row) {
  306. const budgetIds = row.budgetId || this.ids;
  307. this.$modal.confirm('是否确认删除cmc预算管理编号为"' + budgetIds + '"的数据项?').then(function () {
  308. return delBudget(budgetIds);
  309. }).then(() => {
  310. this.getList();
  311. this.$modal.msgSuccess("删除成功");
  312. }).catch(() => { });
  313. },
  314. /** 导出按钮操作 */
  315. handleExport() {
  316. this.download('oa/budget/export', {
  317. ...this.queryParams
  318. }, `budget_${new Date().getTime()}.xlsx`)
  319. }
  320. }
  321. };
  322. </script>