index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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="orderCode">
  5. <el-input v-model="queryParams.orderCode" placeholder="请输入指令编码" clearable @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="指令名称" prop="name">
  8. <el-input v-model="queryParams.name" placeholder="请输入指令名称" clearable @keyup.enter.native="handleQuery" />
  9. </el-form-item>
  10. <el-form-item label="指令描述" prop="description">
  11. <el-input v-model="queryParams.description" placeholder="请输入指令描述" clearable @keyup.enter.native="handleQuery" />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  21. v-hasPermi="['manage:orderConfig:add']">新增</el-button>
  22. </el-col>
  23. <el-col :span="1.5">
  24. <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
  25. v-hasPermi="['manage:orderConfig:edit']">修改</el-button>
  26. </el-col>
  27. <el-col :span="1.5">
  28. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  29. v-hasPermi="['manage:orderConfig:remove']">删除</el-button>
  30. </el-col>
  31. <el-col :span="1.5">
  32. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  33. v-hasPermi="['manage:orderConfig:export']">导出</el-button>
  34. </el-col>
  35. <el-col :span="1.5">
  36. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="analysisDialog=true"
  37. v-hasPermi="['manage:orderConfig:export']">自定义分析</el-button>
  38. </el-col>
  39. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  40. </el-row>
  41. <el-table v-loading="loading" border :data="orderConfigList" @selection-change="handleSelectionChange">
  42. <el-table-column type="selection" width="55" align="center" />
  43. <el-table-column label="指令编码" align="center" prop="orderCode" />
  44. <el-table-column label="指令名称" align="center" prop="name" >
  45. <template slot-scope="scope">
  46. <span class="query-c" @click="queryXml(scope.row)">{{ scope.row.name}}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="指令类型" align="center" prop="type" />
  50. <el-table-column label="架次" align="center" prop="sortie" />
  51. <el-table-column label="步长" align="center" prop="step" />
  52. <el-table-column label="指令描述" align="center" prop="description" />
  53. <!-- <el-table-column label="创建人" align="center" prop="createBy" />
  54. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  55. <template slot-scope="scope">
  56. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  57. </template>
  58. </el-table-column> -->
  59. <el-table-column label="更新人" align="center" prop="updateBy" />
  60. <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
  61. <template slot-scope="scope">
  62. <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  66. <template slot-scope="scope">
  67. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  68. v-hasPermi="['manage:orderConfig:edit']">修改</el-button>
  69. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  70. v-hasPermi="['manage:orderConfig:remove']">删除</el-button>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  75. @pagination="getList" />
  76. <!-- 添加或修改指令配置对话框 -->
  77. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
  78. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  79. <el-form-item label="指令编码" prop="orderCode">
  80. <el-input v-model="form.orderCode" placeholder="请输入指令编码" :disabled="form.id !== null " />
  81. </el-form-item>
  82. <el-form-item label="指令名称" prop="name">
  83. <el-select v-model="form.name" placeholder="请选择指令状态" style="width:100%" @change="change">
  84. <el-option v-for="dict in dict.type.order_type" :key="dict.value" :label="dict.label"
  85. :value="dict"></el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item label="指令类型" prop="type">
  89. <el-input v-model="form.type" :disabled="true" />
  90. </el-form-item>
  91. <el-form-item label="架次" prop="sortie">
  92. <el-input v-model="form.sortie" placeholder="请输入架次" />
  93. </el-form-item>
  94. <el-form-item label="步长" prop="step">
  95. <el-input v-model="form.step" placeholder="请输入步长" />
  96. </el-form-item>
  97. <el-form-item label="指令描述" prop="description">
  98. <el-input v-model="form.description" placeholder="请输入指令描述" />
  99. </el-form-item>
  100. </el-form>
  101. <div slot="footer" class="dialog-footer">
  102. <el-button type="primary" @click="submitForm">确 定</el-button>
  103. <el-button @click="cancel">取 消</el-button>
  104. </div>
  105. </el-dialog>
  106. <!-- 添加或修改指令配置对话框 -->
  107. <el-dialog :title="title" :visible.sync="openXml" :close-on-click-modal="false" width="900px" append-to-body>
  108. <Editor :textContent='xmlText' :dataType='"XML"' v-if="openXml"/>
  109. </el-dialog>
  110. <!-- 自定义分析的对话框 -->
  111. <el-dialog title="分析页面" :visible.sync="analysisDialog" width="27%" :show-close='false'>
  112. <faultAnalysis :flag="flag" :close='close'/>
  113. </el-dialog>
  114. </div>
  115. </template>
  116. <script>
  117. import {
  118. listOrderConfig,
  119. getOrderConfig,
  120. delOrderConfig,
  121. addOrderConfig,
  122. updateOrderConfig,
  123. getOrderConfigXml,
  124. } from '@/api/manage/orderConfig'
  125. import Editor from '@/views/manage/instructionInfo/Editor'
  126. import faultAnalysis from '@/views/manage/faultAnalysis'
  127. export default {
  128. name: 'OrderConfig',
  129. components: {
  130. Editor,
  131. faultAnalysis
  132. },
  133. dicts: ['order_type'],
  134. data() {
  135. return {
  136. // 遮罩层
  137. loading: true,
  138. // 选中数组
  139. ids: [],
  140. // 非单个禁用
  141. single: true,
  142. // 非多个禁用
  143. multiple: true,
  144. // 显示搜索条件
  145. showSearch: true,
  146. // 总条数
  147. total: 0,
  148. // 指令配置表格数据
  149. orderConfigList: [],
  150. // 弹出层标题
  151. title: '',
  152. // 是否显示弹出层
  153. open: false,
  154. // 是否显示弹出层
  155. openXml: false,
  156. // xml结果
  157. xmlText: '',
  158. // 查询参数
  159. queryParams: {
  160. pageNum: 1,
  161. pageSize: 10,
  162. id: null,
  163. orderCode: null,
  164. type: null,
  165. name: null,
  166. description: null,
  167. },
  168. // 表单参数
  169. form: {},
  170. // 表单校验
  171. rules: {
  172. orderCode: [
  173. { required: true, message: '指令编码不能为空', trigger: 'blur' },
  174. ],
  175. name: [
  176. { required: true, message: '指令名称不能为空', trigger: 'change' },
  177. ],
  178. },
  179. //自定义弹出框
  180. analysisDialog:false,
  181. //1是自定义的,0是列表信息进入的
  182. flag:1,
  183. }
  184. },
  185. created() {
  186. this.getList()
  187. },
  188. methods: {
  189. change(val) {
  190. this.form.name = val.label || ''
  191. this.form.type = val.value || ''
  192. },
  193. /** 查询指令配置列表 */
  194. getList() {
  195. this.loading = true
  196. listOrderConfig(this.queryParams).then(response => {
  197. this.orderConfigList = response.rows
  198. this.total = response.total
  199. this.loading = false
  200. })
  201. },
  202. // 取消按钮
  203. cancel() {
  204. this.open = false
  205. this.reset()
  206. },
  207. // 自定义对话框关闭
  208. close(){
  209. this.analysisDialog=false
  210. },
  211. // 表单重置
  212. reset() {
  213. this.form = {
  214. id: null,
  215. orderCode: null,
  216. name: null,
  217. sortie: null,
  218. step: null,
  219. type: null,
  220. description: null,
  221. }
  222. this.resetForm('form')
  223. },
  224. /** 搜索按钮操作 */
  225. handleQuery() {
  226. this.queryParams.pageNum = 1
  227. this.getList()
  228. },
  229. /** 重置按钮操作 */
  230. resetQuery() {
  231. this.resetForm('queryForm')
  232. this.handleQuery()
  233. },
  234. // 多选框选中数据
  235. handleSelectionChange(selection) {
  236. this.ids = selection.map(item => item.id)
  237. this.single = selection.length !== 1
  238. this.multiple = !selection.length
  239. },
  240. /** 新增按钮操作 */
  241. handleAdd() {
  242. this.reset()
  243. this.open = true
  244. this.title = '添加指令配置'
  245. },
  246. /** 修改按钮操作 */
  247. handleUpdate(row) {
  248. this.reset()
  249. const id = row.id || this.ids
  250. getOrderConfig(id).then(response => {
  251. this.form = response.data
  252. this.open = true
  253. this.title = '修改指令配置'
  254. })
  255. },
  256. /** 查询 */
  257. queryXml(row) {
  258. this.reset()
  259. const id = row.id || this.ids
  260. getOrderConfigXml(id).then(response => {
  261. this.xmlText = response.data
  262. // XML
  263. console.log('response', response.data)
  264. this.openXml = true
  265. this.title = 'XML详情'
  266. })
  267. },
  268. /** 提交按钮 */
  269. submitForm() {
  270. this.$refs['form'].validate(valid => {
  271. if (valid) {
  272. if (this.form.id != null) {
  273. updateOrderConfig(this.form).then(response => {
  274. this.$modal.msgSuccess('修改成功')
  275. this.open = false
  276. this.getList()
  277. })
  278. } else {
  279. addOrderConfig(this.form).then(response => {
  280. this.$modal.msgSuccess('新增成功')
  281. this.open = false
  282. this.getList()
  283. })
  284. }
  285. }
  286. })
  287. },
  288. /** 删除按钮操作 */
  289. handleDelete(row) {
  290. const IDs = row.id || this.ids
  291. this.$modal
  292. .confirm('是否确认删除指令配置编号为"' + IDs + '"的数据项?')
  293. .then(function () {
  294. return delOrderConfig(IDs)
  295. })
  296. .then(() => {
  297. this.getList()
  298. this.$modal.msgSuccess('删除成功')
  299. })
  300. .catch(() => {})
  301. },
  302. /** 导出按钮操作 */
  303. handleExport() {
  304. this.download(
  305. 'manage/orderConfig/export',
  306. {
  307. ...this.queryParams,
  308. },
  309. `orderConfig_${new Date().getTime()}.xlsx`
  310. )
  311. },
  312. },
  313. }
  314. </script>
  315. <style scoped>
  316. .query-c {
  317. color: #1890ff;
  318. cursor: pointer;
  319. }
  320. </style>