综合办公系统
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

scrap.vue 8.6KB

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