Digital Office Automation System
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.

index.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. size="small"
  7. :inline="true"
  8. v-show="showSearch"
  9. label-width="68px"
  10. >
  11. <el-form-item label="预警时间">
  12. <el-date-picker
  13. v-model="daterangeWarnTime"
  14. style="width: 240px"
  15. value-format="yyyy-MM-dd HH:mm:ss"
  16. type="daterange"
  17. range-separator="-"
  18. start-placeholder="开始日期"
  19. end-placeholder="结束日期"
  20. :default-time="['00:00:00', '23:59:59']"
  21. ></el-date-picker>
  22. </el-form-item>
  23. <el-form-item label="商品名字" prop="goodsSkuName">
  24. <el-input
  25. v-model="queryParams.goodsSkuName"
  26. placeholder="请输入商品名字"
  27. clearable
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="商品编号" prop="goodsSkuSn">
  32. <el-input
  33. v-model="queryParams.goodsSkuSn"
  34. placeholder="请输入商品编号"
  35. clearable
  36. @keyup.enter.native="handleQuery"
  37. />
  38. </el-form-item>
  39. <el-form-item label="处理状态" prop="status">
  40. <el-select
  41. v-model="queryParams.status"
  42. placeholder="请选择处理状态"
  43. clearable
  44. >
  45. <el-option
  46. v-for="dict in dict.type.zs_operation_status"
  47. :key="dict.value"
  48. :label="dict.label"
  49. :value="dict.value"
  50. />
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item label="比对状态" prop="status">
  54. <el-select
  55. v-model="queryParams.compareStatus"
  56. placeholder="请选择比对状态"
  57. clearable
  58. >
  59. <el-option
  60. v-for="dict in dict.type.zs_operation_compare_status"
  61. :key="dict.value"
  62. :label="dict.label"
  63. :value="dict.value"
  64. />
  65. </el-select>
  66. </el-form-item>
  67. <el-form-item>
  68. <el-button
  69. type="primary"
  70. icon="el-icon-search"
  71. size="mini"
  72. @click="handleQuery"
  73. >搜索</el-button
  74. >
  75. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  76. >重置</el-button
  77. >
  78. </el-form-item>
  79. </el-form>
  80. <el-row :gutter="10" class="mb8">
  81. <!--<el-col :span="1.5">
  82. <el-button
  83. type="primary"
  84. plain
  85. icon="el-icon-plus"
  86. size="mini"
  87. @click="handleAdd"
  88. v-hasPermi="['system:operationWarnresult:add']"
  89. >新增</el-button>
  90. </el-col>
  91. <el-col :span="1.5">
  92. <el-button
  93. type="success"
  94. plain
  95. icon="el-icon-edit"
  96. size="mini"
  97. :disabled="single"
  98. @click="handleUpdate"
  99. v-hasPermi="['system:operationWarnresult:edit']"
  100. >修改</el-button>
  101. </el-col>-->
  102. <el-col :span="1.5">
  103. <el-button
  104. type="danger"
  105. plain
  106. icon="el-icon-delete"
  107. size="mini"
  108. :disabled="multiple"
  109. @click="handleDelete"
  110. v-hasPermi="['system:operationWarnresult:remove']"
  111. >删除</el-button
  112. >
  113. </el-col>
  114. <el-col :span="1.5">
  115. <el-button
  116. type="warning"
  117. plain
  118. icon="el-icon-download"
  119. size="mini"
  120. @click="handleExport"
  121. v-hasPermi="['system:operationWarnresult:export']"
  122. >导出</el-button
  123. >
  124. </el-col>
  125. <right-toolbar
  126. :showSearch.sync="showSearch"
  127. @queryTable="getList"
  128. ></right-toolbar>
  129. </el-row>
  130. <el-table
  131. v-loading="loading"
  132. :data="operationWarnresultList"
  133. @selection-change="handleSelectionChange"
  134. >
  135. <el-table-column type="selection" width="55" align="center" />
  136. <el-table-column label="主键ID" align="center" prop="id" v-if="false" />
  137. <el-table-column
  138. label="预警时间"
  139. align="center"
  140. prop="warnTime"
  141. width="180"
  142. >
  143. <template slot-scope="scope">
  144. <span>{{
  145. parseTime(scope.row.warnTime, "{y}-{m}-{d} {h}:{i}:{s}")
  146. }}</span>
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="商品" align="center" prop="goodsSkuName">
  150. <template slot-scope="scope">
  151. <div class="goods--info">
  152. <el-link
  153. type="primary"
  154. :underline="false"
  155. :href="scope.row.goodsSkuUrl"
  156. target="_blank"
  157. :title="scope.row.goodsSkuName"
  158. >
  159. {{ scope.row.goodsSkuName }}
  160. </el-link>
  161. <em>{{ scope.row.goodsSkuSn }}</em>
  162. <em>¥{{ scope.row.initPrice }}</em>
  163. </div>
  164. </template>
  165. </el-table-column>
  166. <el-table-column label="预警价格" align="center" prop="initPrice">
  167. <template slot-scope="scope">
  168. <div v-if="scope.row.curPrice" class="price--info">
  169. <span style="color: #303133; font-size: 14px; margin-right: 2px;">¥{{ scope.row.curPrice }}</span>
  170. <i class="icon-arrow-up" style="color: green;" v-if="scope.row.curPrice > scope.row.initPrice"></i>
  171. <i class="icon-arrow-down" style="color: red;" v-else></i>
  172. </div>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="预警方式" align="center" prop="warnTypes">
  176. <template slot-scope="scope">
  177. <dict-tag
  178. :options="dict.type.zs_operation_warn_types"
  179. :value="scope.row.warnTypes"
  180. />
  181. </template>
  182. </el-table-column>
  183. <el-table-column
  184. label="通知内容/结果"
  185. align="center"
  186. prop="warnContent"
  187. />
  188. <el-table-column
  189. label="图片快照"
  190. align="center"
  191. prop="snapshotUrl"
  192. width="100"
  193. >
  194. <template slot-scope="scope">
  195. <image-preview
  196. :src="scope.row.snapshotUrl"
  197. :width="50"
  198. :height="50"
  199. />
  200. </template>
  201. </el-table-column>
  202. <el-table-column width="120" label="平台" align="center" prop="platform">
  203. <template slot-scope="scope">
  204. <dict-tag
  205. :options="dict.type.zs_operation_platform"
  206. :value="scope.row.platform"
  207. />
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="处理状态" align="center" prop="status">
  211. <template slot-scope="scope">
  212. <dict-tag
  213. :options="dict.type.zs_operation_status"
  214. :value="scope.row.status"
  215. />
  216. </template>
  217. </el-table-column>
  218. <el-table-column label="比对状态" align="center" prop="compareStatus">
  219. <template slot-scope="scope">
  220. <dict-tag
  221. :options="dict.type.zs_operation_compare_status"
  222. :value="scope.row.compareStatus"
  223. />
  224. </template>
  225. </el-table-column>
  226. <el-table-column
  227. label="操作"
  228. align="center"
  229. class-name="small-padding fixed-width"
  230. >
  231. <template slot-scope="scope">
  232. <el-button
  233. size="mini"
  234. type="text"
  235. icon="el-icon-edit"
  236. @click="handleUpdate(scope.row)"
  237. v-if="scope.row.compareStatus == 1"
  238. :disabled="scope.row.status === 1"
  239. v-hasPermi="['system:operationWarnresult:edit']"
  240. >处理</el-button
  241. >
  242. <el-button
  243. size="mini"
  244. type="text"
  245. icon="el-icon-delete"
  246. @click="handleDelete(scope.row)"
  247. v-hasPermi="['system:operationWarnresult:remove']"
  248. >删除</el-button
  249. >
  250. </template>
  251. </el-table-column>
  252. </el-table>
  253. <pagination
  254. v-show="total > 0"
  255. :total="total"
  256. :page.sync="queryParams.pageNum"
  257. :limit.sync="queryParams.pageSize"
  258. @pagination="getList"
  259. />
  260. <!-- 添加或修改预警结果对话框 -->
  261. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  262. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  263. </el-form>
  264. <div slot="footer" class="dialog-footer">
  265. <el-button :loading="buttonLoading" type="primary" @click="submitForm"
  266. >确 定</el-button
  267. >
  268. <el-button @click="cancel">取 消</el-button>
  269. </div>
  270. </el-dialog>
  271. </div>
  272. </template>
  273. <script>
  274. import {
  275. listOperationWarnresult,
  276. getOperationWarnresult,
  277. delOperationWarnresult,
  278. addOperationWarnresult,
  279. updateOperationWarnresult,
  280. } from "@/api/system/operationWarnresult";
  281. export default {
  282. name: "OperationWarnresult",
  283. dicts: ["zs_operation_warn_types", "zs_operation_status","zs_operation_compare_status","zs_operation_platform"],
  284. data() {
  285. return {
  286. // 按钮loading
  287. buttonLoading: false,
  288. // 遮罩层
  289. loading: true,
  290. // 选中数组
  291. ids: [],
  292. // 非单个禁用
  293. single: true,
  294. // 非多个禁用
  295. multiple: true,
  296. // 显示搜索条件
  297. showSearch: true,
  298. // 总条数
  299. total: 0,
  300. // 预警结果表格数据
  301. operationWarnresultList: [],
  302. // 弹出层标题
  303. title: "",
  304. // 是否显示弹出层
  305. open: false,
  306. // 图片快照时间范围
  307. daterangeWarnTime: [],
  308. // 查询参数
  309. queryParams: {
  310. pageNum: 1,
  311. pageSize: 10,
  312. warnTime: undefined,
  313. goodsSkuName: undefined,
  314. goodsSkuSn: undefined,
  315. status: undefined,
  316. compareStatus: undefined,
  317. },
  318. // 表单参数
  319. form: {},
  320. // 表单校验
  321. rules: {
  322. snapshotUrl: [
  323. { required: true, message: "图片快照不能为空", trigger: "blur" },
  324. ],
  325. },
  326. };
  327. },
  328. created() {
  329. this.getList();
  330. },
  331. methods: {
  332. /** 查询预警结果列表 */
  333. getList() {
  334. this.loading = true;
  335. this.queryParams.params = {};
  336. if (null != this.daterangeWarnTime && "" != this.daterangeWarnTime) {
  337. this.queryParams.params["beginWarnTime"] = this.daterangeWarnTime[0];
  338. this.queryParams.params["endWarnTime"] = this.daterangeWarnTime[1];
  339. }
  340. listOperationWarnresult(this.queryParams).then((response) => {
  341. this.operationWarnresultList = response.rows;
  342. this.total = response.total;
  343. this.loading = false;
  344. });
  345. },
  346. // 取消按钮
  347. cancel() {
  348. this.open = false;
  349. this.reset();
  350. },
  351. // 表单重置
  352. reset() {
  353. this.form = {
  354. id: undefined,
  355. warnTime: undefined,
  356. goodsSkuName: undefined,
  357. goodsSkuSn: undefined,
  358. initPrice: undefined,
  359. curPrice: undefined,
  360. priceChangeRatio: undefined,
  361. warnTypes: undefined,
  362. warnContent: undefined,
  363. status: undefined,
  364. snapshotUrl: undefined,
  365. };
  366. this.resetForm("form");
  367. },
  368. /** 搜索按钮操作 */
  369. handleQuery() {
  370. this.queryParams.pageNum = 1;
  371. this.getList();
  372. },
  373. /** 重置按钮操作 */
  374. resetQuery() {
  375. this.daterangeWarnTime = [];
  376. this.resetForm("queryForm");
  377. this.handleQuery();
  378. },
  379. // 多选框选中数据
  380. handleSelectionChange(selection) {
  381. this.ids = selection.map((item) => item.id);
  382. this.single = selection.length !== 1;
  383. this.multiple = !selection.length;
  384. },
  385. /** 新增按钮操作 */
  386. handleAdd() {
  387. this.reset();
  388. this.open = true;
  389. this.title = "添加预警结果";
  390. },
  391. /** 修改按钮操作 */
  392. handleUpdate(row) {
  393. //将状态设置为已处理
  394. row.status = 1;
  395. updateOperationWarnresult(row)
  396. .then((response) => {
  397. this.$modal.msgSuccess("处理成功");
  398. this.open = false;
  399. this.getList();
  400. })
  401. .finally(() => {
  402. this.buttonLoading = false;
  403. });
  404. /* this.loading = true;
  405. this.reset();
  406. const id = row.id || this.ids
  407. getOperationWarnresult(id).then(response => {
  408. this.loading = false;
  409. this.form = response.data;
  410. this.open = true;
  411. this.title = "修改预警结果";
  412. }); */
  413. },
  414. /** 提交按钮 */
  415. submitForm() {
  416. this.$refs["form"].validate((valid) => {
  417. if (valid) {
  418. this.buttonLoading = true;
  419. if (this.form.id != null) {
  420. updateOperationWarnresult(this.form)
  421. .then((response) => {
  422. this.$modal.msgSuccess("修改成功");
  423. this.open = false;
  424. this.getList();
  425. })
  426. .finally(() => {
  427. this.buttonLoading = false;
  428. });
  429. } else {
  430. addOperationWarnresult(this.form)
  431. .then((response) => {
  432. this.$modal.msgSuccess("新增成功");
  433. this.open = false;
  434. this.getList();
  435. })
  436. .finally(() => {
  437. this.buttonLoading = false;
  438. });
  439. }
  440. }
  441. });
  442. },
  443. /** 删除按钮操作 */
  444. handleDelete(row) {
  445. const ids = row.id || this.ids;
  446. this.$modal
  447. .confirm('是否确认删除预警结果编号为"' + ids + '"的数据项?')
  448. .then(() => {
  449. this.loading = true;
  450. return delOperationWarnresult(ids);
  451. })
  452. .then(() => {
  453. this.loading = false;
  454. this.getList();
  455. this.$modal.msgSuccess("删除成功");
  456. })
  457. .catch(() => {})
  458. .finally(() => {
  459. this.loading = false;
  460. });
  461. },
  462. /** 导出按钮操作 */
  463. handleExport() {
  464. this.download(
  465. "system/operationWarnresult/export",
  466. {
  467. ...this.queryParams,
  468. },
  469. `operationWarnresult_${new Date().getTime()}.xlsx`
  470. );
  471. },
  472. },
  473. };
  474. </script>
  475. <style lang="scss" scoped>
  476. .goods--info {
  477. display: flex;
  478. flex-direction: column;
  479. justify-content: center;
  480. text-align: left;
  481. .el-link {
  482. font-size: 14px;
  483. display: -webkit-box;
  484. -webkit-line-clamp: 2;
  485. line-clamp: 2;
  486. -webkit-box-orient: vertical;
  487. overflow: hidden;
  488. }
  489. em {
  490. font-size: 12px;
  491. color: #999;
  492. font-style: normal;
  493. }
  494. }
  495. </style>