index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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="指令名称" prop="orderName">
  5. <el-input v-model="queryParams.orderName" placeholder="请输入指令名称" clearable @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="状态" prop="status">
  8. <el-select v-model="queryParams.status" placeholder="请选择指令状态" clearable>
  9. <el-option v-for="dict in dict.type.order_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item label="创建时间" prop="createTime">
  13. <el-date-picker clearable v-model="queryParams.createTime" type="date" value-format="yyyy-MM-dd"
  14. placeholder="请选择创建时间">
  15. </el-date-picker>
  16. </el-form-item>
  17. <el-form-item label="更新时间" prop="updateTime">
  18. <el-date-picker clearable v-model="queryParams.updateTime" type="date" value-format="yyyy-MM-dd"
  19. placeholder="请选择更新时间">
  20. </el-date-picker>
  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="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  30. v-hasPermi="['manage:orderInfo:add']">新增</el-button>
  31. </el-col>
  32. <el-col :span="1.5">
  33. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  34. v-hasPermi="['manage:orderInfo:export']">导出</el-button>
  35. </el-col>
  36. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  37. </el-row>
  38. <el-table v-loading="loading" :data="orderInfoList" @selection-change="handleSelectionChange">
  39. <el-table-column type="selection" width="55" align="center" />
  40. <el-table-column label="指令名称" align="center" prop="orderName" />
  41. <el-table-column label="指令类型" align="center" prop="orderType" />
  42. <el-table-column label="状态" align="center" prop="status">
  43. <template slot-scope="scope">
  44. <dict-tag :options="dict.type.order_status" :value="scope.row.status" />
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  48. <template slot-scope="scope">
  49. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
  53. <template slot-scope="scope">
  54. <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  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" @click="handle(scope.row)" :disabled="scope.row.status != 0"
  60. v-hasPermi="['manage:orderInfo:edit']">执行指令</el-button>
  61. <el-button size="mini" type="text" @click="handle(scope.row)" v-if="scope.row.status == 99"
  62. v-hasPermi="['manage:orderInfo:edit']">异常详情</el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  67. @pagination="getList" />
  68. <!-- 添加或修改系统指令信息对话框 -->
  69. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
  70. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  71. <el-form-item label="指令名称" prop="orderName">
  72. <el-input v-model="form.orderName" placeholder="请输入指令名称" />
  73. </el-form-item>
  74. <el-form-item label="参数内容">
  75. <editor v-model="form.content" :min-height="192" />
  76. </el-form-item>
  77. <el-form-item label="指令状态" prop="status">
  78. <el-select v-model="form.status" placeholder="请选择指令状态">
  79. <el-option v-for="dict in dict.type.order_status" :key="dict.value" :label="dict.label"
  80. :value="dict.value"></el-option>
  81. </el-select>
  82. </el-form-item>
  83. </el-form>
  84. <div slot="footer" class="dialog-footer">
  85. <el-button type="primary" @click="submitForm">确 定</el-button>
  86. <el-button @click="cancel">取 消</el-button>
  87. </div>
  88. </el-dialog>
  89. <!-- 分析弹出框 -->
  90. <el-dialog title="分析页面" :visible.sync="analysisDialog" width="27%" :show-close='false'>
  91. <faultAnalysis :flag="flag" :close='close' />
  92. </el-dialog>
  93. <!-- 到数据下载数据界面 -->
  94. <dataDownDialog :open='openDialog' :cancel='dataDownCancel' :getList='replaceGetList'/>
  95. </div>
  96. </template>
  97. <script>
  98. import {
  99. listOrderInfo,
  100. getOrderInfo,
  101. delOrderInfo,
  102. addOrderInfo,
  103. updateOrderInfo,
  104. } from '@/api/manage/orderInfo'
  105. import faultAnalysis from '@/views/manage/faultAnalysis'
  106. import dataDownDialog from '@/views/manage/dataDown/dataDownDialog'
  107. export default {
  108. name: 'OrderInfo',
  109. dicts: ['order_status'],
  110. components: { faultAnalysis,dataDownDialog },
  111. data() {
  112. return {
  113. // 遮罩层
  114. loading: true,
  115. // 选中数组
  116. ids: [],
  117. // 非单个禁用
  118. single: true,
  119. // 非多个禁用
  120. multiple: true,
  121. // 显示搜索条件
  122. showSearch: true,
  123. // 总条数
  124. total: 0,
  125. // 系统指令信息表格数据
  126. orderInfoList: [],
  127. // 弹出层标题
  128. title: '',
  129. //分析弹出框
  130. analysisDialog: false,
  131. //这里flag代表传过去的模型、架次、步长信息
  132. flag: null,
  133. // 是否显示弹出层
  134. open: false,
  135. // 查询参数
  136. queryParams: {
  137. pageNum: 1,
  138. pageSize: 10,
  139. orderName: null,
  140. orderType: null,
  141. content: null,
  142. status: null,
  143. isDelete: null,
  144. createBy: null,
  145. createTime: null,
  146. updateBy: null,
  147. updateTime: null,
  148. },
  149. // 表单参数
  150. form: {},
  151. // 表单校验
  152. rules: {
  153. isDelete: [
  154. { required: true, message: '数据是否删除不能为空', trigger: 'blur' },
  155. ],
  156. },
  157. //数据下载弹出框的数据
  158. openDialog: false,
  159. }
  160. },
  161. created() {
  162. this.getList()
  163. },
  164. methods: {
  165. /** 查询系统指令信息列表 */
  166. getList() {
  167. this.loading = true
  168. listOrderInfo(this.queryParams).then(response => {
  169. this.orderInfoList = response.rows
  170. this.total = response.total
  171. this.loading = false
  172. })
  173. },
  174. // 取消按钮
  175. cancel() {
  176. this.open = false
  177. this.reset()
  178. },
  179. // 数据下载弹出框的取消按钮
  180. dataDownCancel() {
  181. this.openDialog = false
  182. this.reset()
  183. },
  184. //数据下载弹框完成后
  185. replaceGetList() {
  186. this.dataDownCancel()
  187. },
  188. //分析对话框关闭
  189. close() {
  190. this.analysisDialog = false
  191. },
  192. // 表单重置
  193. reset() {
  194. this.form = {
  195. id: null,
  196. orderName: null,
  197. orderType: null,
  198. content: null,
  199. status: null,
  200. isDelete: null,
  201. createBy: null,
  202. createTime: null,
  203. updateBy: null,
  204. updateTime: null,
  205. }
  206. this.resetForm('form')
  207. },
  208. /** 搜索按钮操作 */
  209. handleQuery() {
  210. this.queryParams.pageNum = 1
  211. this.getList()
  212. },
  213. /** 重置按钮操作 */
  214. resetQuery() {
  215. this.resetForm('queryForm')
  216. this.handleQuery()
  217. },
  218. // 多选框选中数据
  219. handleSelectionChange(selection) {
  220. this.ids = selection.map(item => item.id)
  221. this.single = selection.length !== 1
  222. this.multiple = !selection.length
  223. },
  224. /** 新增按钮操作 */
  225. handleAdd() {
  226. this.reset()
  227. this.open = true
  228. this.title = '添加系统指令信息'
  229. },
  230. /** 执行指令 */
  231. handle(row) {
  232. console.log(row)
  233. //指令类型是下载数据
  234. if (row.orderType == 'XZ') {
  235. this.openDialog = true
  236. } else {
  237. row.content = {
  238. model: '虚警抑制的模型',
  239. sortie: '架次',
  240. step: '2023-01-02 12:00:00 2023-02-02 12:00:00',
  241. }
  242. this.analysisDialog = true
  243. this.flag = row
  244. }
  245. // const id = row.id || this.ids
  246. },
  247. /** 提交按钮 */
  248. submitForm() {
  249. this.$refs['form'].validate(valid => {
  250. if (valid) {
  251. if (this.form.id != null) {
  252. updateOrderInfo(this.form).then(response => {
  253. this.$modal.msgSuccess('修改成功')
  254. this.open = false
  255. this.getList()
  256. })
  257. } else {
  258. addOrderInfo(this.form).then(response => {
  259. this.$modal.msgSuccess('新增成功')
  260. this.open = false
  261. this.getList()
  262. })
  263. }
  264. }
  265. })
  266. },
  267. /** 删除按钮操作 */
  268. handleDelete(row) {
  269. const ids = row.id || this.ids
  270. this.$modal
  271. .confirm('是否确认删除系统指令信息编号为"' + ids + '"的数据项?')
  272. .then(function () {
  273. return delOrderInfo(ids)
  274. })
  275. .then(() => {
  276. this.getList()
  277. this.$modal.msgSuccess('删除成功')
  278. })
  279. .catch(() => {})
  280. },
  281. /** 导出按钮操作 */
  282. handleExport() {
  283. this.download(
  284. 'manage/orderInfo/export',
  285. {
  286. ...this.queryParams,
  287. },
  288. `orderInfo_${new Date().getTime()}.xlsx`
  289. )
  290. },
  291. },
  292. }
  293. </script>