综合办公系统
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

device.vue 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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 label="预算id" prop="budgetId">
  5. <el-input
  6. v-model="queryParams.budgetId"
  7. placeholder="请输入预算id"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="设备id" prop="deviceId">
  13. <el-input
  14. v-model="queryParams.deviceId"
  15. placeholder="请输入设备id"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="天数" prop="days">
  21. <el-input
  22. v-model="queryParams.days"
  23. placeholder="请输入天数"
  24. clearable
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item label="折旧成本" prop="depreciation">
  29. <el-input
  30. v-model="queryParams.depreciation"
  31. placeholder="请输入折旧成本"
  32. clearable
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  38. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  39. </el-form-item>
  40. </el-form>
  41. <el-row :gutter="10" class="mb8">
  42. <el-col :span="1.5">
  43. <el-button
  44. type="primary"
  45. plain
  46. icon="el-icon-plus"
  47. size="mini"
  48. @click="handleAdd"
  49. v-hasPermi="['oa:budgetDevice:add']"
  50. >新增</el-button>
  51. </el-col>
  52. <el-col :span="1.5">
  53. <el-button
  54. type="success"
  55. plain
  56. icon="el-icon-edit"
  57. size="mini"
  58. :disabled="single"
  59. @click="handleUpdate"
  60. v-hasPermi="['oa:budgetDevice:edit']"
  61. >修改</el-button>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-button
  65. type="danger"
  66. plain
  67. icon="el-icon-delete"
  68. size="mini"
  69. :disabled="multiple"
  70. @click="handleDelete"
  71. v-hasPermi="['oa:budgetDevice:remove']"
  72. >删除</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="warning"
  77. plain
  78. icon="el-icon-download"
  79. size="mini"
  80. @click="handleExport"
  81. v-hasPermi="['oa:budgetDevice:export']"
  82. >导出</el-button>
  83. </el-col>
  84. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  85. </el-row>
  86. <el-table v-loading="loading" :data="budgetDeviceList" @selection-change="handleSelectionChange">
  87. <el-table-column type="selection" width="55" align="center" />
  88. <el-table-column label="设备预算id" align="center" prop="budgetDeviceId" />
  89. <el-table-column label="预算id" align="center" prop="budgetId" />
  90. <el-table-column label="设备id" align="center" prop="deviceId" />
  91. <el-table-column label="天数" align="center" prop="days" />
  92. <el-table-column label="折旧成本" align="center" prop="depreciation" />
  93. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  94. <template slot-scope="scope">
  95. <el-button
  96. size="mini"
  97. type="text"
  98. icon="el-icon-edit"
  99. @click="handleUpdate(scope.row)"
  100. v-hasPermi="['oa:budgetDevice:edit']"
  101. >修改</el-button>
  102. <el-button
  103. size="mini"
  104. type="text"
  105. icon="el-icon-delete"
  106. @click="handleDelete(scope.row)"
  107. v-hasPermi="['oa:budgetDevice:remove']"
  108. >删除</el-button>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <pagination
  113. v-show="total>0"
  114. :total="total"
  115. :page.sync="queryParams.pageNum"
  116. :limit.sync="queryParams.pageSize"
  117. @pagination="getList"
  118. />
  119. <!-- 添加或修改cmc设备预算对话框 -->
  120. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  121. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  122. <el-form-item label="预算id" prop="budgetId">
  123. <el-input v-model="form.budgetId" placeholder="请输入预算id" />
  124. </el-form-item>
  125. <el-form-item label="设备id" prop="deviceId">
  126. <el-input v-model="form.deviceId" placeholder="请输入设备id" />
  127. </el-form-item>
  128. <el-form-item label="天数" prop="days">
  129. <el-input v-model="form.days" placeholder="请输入天数" />
  130. </el-form-item>
  131. <el-form-item label="折旧成本" prop="depreciation">
  132. <el-input v-model="form.depreciation" placeholder="请输入折旧成本" />
  133. </el-form-item>
  134. </el-form>
  135. <div slot="footer" class="dialog-footer">
  136. <el-button type="primary" @click="submitForm">确 定</el-button>
  137. <el-button @click="cancel">取 消</el-button>
  138. </div>
  139. </el-dialog>
  140. </div>
  141. </template>
  142. <script>
  143. import { listBudgetDevice, getBudgetDevice, delBudgetDevice, addBudgetDevice, updateBudgetDevice } from "@/api/oa/budget/budgetDevice";
  144. export default {
  145. name: "BudgetDevice",
  146. data() {
  147. return {
  148. // 遮罩层
  149. loading: true,
  150. // 选中数组
  151. ids: [],
  152. // 非单个禁用
  153. single: true,
  154. // 非多个禁用
  155. multiple: true,
  156. // 显示搜索条件
  157. showSearch: true,
  158. // 总条数
  159. total: 0,
  160. // cmc设备预算表格数据
  161. budgetDeviceList: [],
  162. // 弹出层标题
  163. title: "",
  164. // 是否显示弹出层
  165. open: false,
  166. // 查询参数
  167. queryParams: {
  168. pageNum: 1,
  169. pageSize: 10,
  170. budgetId: null,
  171. deviceId: null,
  172. days: null,
  173. depreciation: null
  174. },
  175. // 表单参数
  176. form: {},
  177. // 表单校验
  178. rules: {
  179. }
  180. };
  181. },
  182. created() {
  183. this.getList();
  184. },
  185. methods: {
  186. /** 查询cmc设备预算列表 */
  187. getList() {
  188. this.loading = true;
  189. listBudgetDevice(this.queryParams).then(response => {
  190. this.budgetDeviceList = response.rows;
  191. this.total = response.total;
  192. this.loading = false;
  193. });
  194. },
  195. // 取消按钮
  196. cancel() {
  197. this.open = false;
  198. this.reset();
  199. },
  200. // 表单重置
  201. reset() {
  202. this.form = {
  203. budgetDeviceId: null,
  204. budgetId: null,
  205. deviceId: null,
  206. days: null,
  207. depreciation: null
  208. };
  209. this.resetForm("form");
  210. },
  211. /** 搜索按钮操作 */
  212. handleQuery() {
  213. this.queryParams.pageNum = 1;
  214. this.getList();
  215. },
  216. /** 重置按钮操作 */
  217. resetQuery() {
  218. this.resetForm("queryForm");
  219. this.handleQuery();
  220. },
  221. // 多选框选中数据
  222. handleSelectionChange(selection) {
  223. this.ids = selection.map(item => item.budgetDeviceId)
  224. this.single = selection.length!==1
  225. this.multiple = !selection.length
  226. },
  227. /** 新增按钮操作 */
  228. handleAdd() {
  229. this.reset();
  230. this.open = true;
  231. this.title = "添加cmc设备预算";
  232. },
  233. /** 修改按钮操作 */
  234. handleUpdate(row) {
  235. this.reset();
  236. const budgetDeviceId = row.budgetDeviceId || this.ids
  237. getBudgetDevice(budgetDeviceId).then(response => {
  238. this.form = response.data;
  239. this.open = true;
  240. this.title = "修改cmc设备预算";
  241. });
  242. },
  243. /** 提交按钮 */
  244. submitForm() {
  245. this.$refs["form"].validate(valid => {
  246. if (valid) {
  247. if (this.form.budgetDeviceId != null) {
  248. updateBudgetDevice(this.form).then(response => {
  249. this.$modal.msgSuccess("修改成功");
  250. this.open = false;
  251. this.getList();
  252. });
  253. } else {
  254. addBudgetDevice(this.form).then(response => {
  255. this.$modal.msgSuccess("新增成功");
  256. this.open = false;
  257. this.getList();
  258. });
  259. }
  260. }
  261. });
  262. },
  263. /** 删除按钮操作 */
  264. handleDelete(row) {
  265. const budgetDeviceIds = row.budgetDeviceId || this.ids;
  266. this.$modal.confirm('是否确认删除cmc设备预算编号为"' + budgetDeviceIds + '"的数据项?').then(function() {
  267. return delBudgetDevice(budgetDeviceIds);
  268. }).then(() => {
  269. this.getList();
  270. this.$modal.msgSuccess("删除成功");
  271. }).catch(() => {});
  272. },
  273. /** 导出按钮操作 */
  274. handleExport() {
  275. this.download('oa/budgetDevice/export', {
  276. ...this.queryParams
  277. }, `budgetDevice_${new Date().getTime()}.xlsx`)
  278. }
  279. }
  280. };
  281. </script>