You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

669 lines
21 KiB

3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
  1. <template>
  2. <div class="box">
  3. <div style="position: relative">
  4. <div class="middlebox">
  5. <div class="contenttitle">
  6. 基础字典 /
  7. <span class="contenttitleBold">结果状态</span>
  8. </div>
  9. </div>
  10. <div style="display: block; margin-top: 7px; margin-right: 110px">
  11. <div style="background-color: #fff; padding: 15px; border-radius: 8px">
  12. <el-table
  13. :data="tableData"
  14. row-key="id"
  15. class="el-table__body-wrapper tbody"
  16. @row-click="rowclick"
  17. highlight-current-row
  18. :height="window.pageHeight < 600 ? 480 : window.pageHeight - 130"
  19. ref="tableData"
  20. >
  21. <el-table-column prop="id" label="编号"> </el-table-column>
  22. <el-table-column prop="displayName" label="名称" width="180">
  23. </el-table-column>
  24. <el-table-column prop="reportPrompt" label="报告单提示" width="180">
  25. </el-table-column>
  26. <el-table-column
  27. prop="dataInputPrompt"
  28. label="数据录入提示"
  29. width="180"
  30. >
  31. </el-table-column>
  32. <el-table-column prop="reportBackgroundColor" label="报告单背景色">
  33. <template slot-scope="scope">
  34. <div
  35. class="colorblock"
  36. :style="
  37. 'background-color:' +
  38. colorFormat(scope.row.reportBackgroundColor) +
  39. ';'
  40. "
  41. ></div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="reportFontColor" label="报告单字体色">
  45. <template slot-scope="scope">
  46. <div
  47. class="colorblock"
  48. :style="
  49. 'background-color:' +
  50. colorFormat(scope.row.reportFontColor) +
  51. ';'
  52. "
  53. ></div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column
  57. prop="dataInputBackgroundColor"
  58. label="数据录入背景色"
  59. >
  60. <template slot-scope="scope">
  61. <div
  62. class="colorblock"
  63. :style="
  64. 'background-color:' +
  65. colorFormat(scope.row.dataInputBackgroundColor) +
  66. ';'
  67. "
  68. ></div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column
  72. prop="dataInputFontColor"
  73. label="数据录入字体色"
  74. align="center"
  75. >
  76. <template slot-scope="scope">
  77. <div
  78. class="colorblock"
  79. :style="
  80. 'background-color:' +
  81. colorFormat(scope.row.dataInputFontColor) +
  82. ';'
  83. "
  84. ></div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="操作" width="" align="center">
  88. <template>
  89. <el-tag
  90. class="move"
  91. style="cursor: move;background-color: rgb(245, 245, 245);border:none"
  92. draggable="true"
  93. >
  94. <i
  95. class="el-icon-d-caret"
  96. style="width: 1rem; height: 1rem;color: rgb(113, 113, 113)"
  97. ></i>
  98. </el-tag>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. </div>
  103. </div>
  104. <div
  105. style="
  106. margin-left: 10px;
  107. margin-top: 3%;
  108. position: absolute;
  109. top: 0;
  110. right: 0;
  111. "
  112. >
  113. <el-button type="" @click="editpopup" class="commonbutton"
  114. >编辑</el-button
  115. >
  116. <div style="margin-top: 10px">
  117. <el-button type="" @click="topping" class="commonbutton">置顶</el-button>
  118. </div>
  119. <div style="margin-top: 10px">
  120. <el-button type="" @click="toppings" class="commonbutton">置底</el-button>
  121. </div>
  122. <div style="margin-top: 10px">
  123. <el-button type="" :disabled="isshow" @click="assertion" class="commonbutton"
  124. >排序</el-button
  125. >
  126. </div>
  127. <div style="margin-top: 10px">
  128. <el-button type="" :disabled="isshow" @click="cancellation" class="commonbutton"
  129. >取消</el-button
  130. >
  131. </div>
  132. </div>
  133. <!-- 分页 -->
  134. <!-- <div class="cancelorconfirm">
  135. <el-button type="primary" :disabled="isshow" @click="assertion"
  136. >确定排序</el-button
  137. >
  138. <el-button type="primary" :disabled="isshow" @click="cancellation"
  139. >取消排序</el-button
  140. >
  141. </div> -->
  142. <!-- 新增或者编辑弹框 -->
  143. <el-dialog
  144. :title="title == 1 ? '新增' : '修改'"
  145. :visible.sync="dialogVisible"
  146. width="55%"
  147. :before-close="handleClose"
  148. :close-on-click-modal="false"
  149. >
  150. <el-form :model="form" :rules="rules" ref="ruleForm" label-width="80px">
  151. <el-row>
  152. <!-- <el-col :span="12">
  153. <el-form-item f
  154. label="id"
  155. label-width="120px"
  156. prop="resultStatusId"
  157. >
  158. <el-input v-model="form.resultStatusId"></el-input>
  159. </el-form-item>
  160. </el-col> -->
  161. <!-- <el-col :span="12">
  162. <el-form-item label="名称" label-width="120px" prop="displayName">
  163. <el-input v-model="form.displayName"></el-input>
  164. </el-form-item>
  165. </el-col> -->
  166. <el-col :span="12">
  167. <el-form-item
  168. label="数据录入提示"
  169. label-width="120px"
  170. >
  171. <el-input v-model="form.dataInputPrompt" @input="($event) => changeUpdate($event, 'dataInputPrompt')"></el-input>
  172. </el-form-item>
  173. </el-col>
  174. <el-col :span="12">
  175. <el-form-item
  176. label="报告单提示"
  177. label-width="120px"
  178. >
  179. <el-input v-model="form.reportPrompt" @input="($event) => changeUpdate($event, 'reportPrompt')"></el-input>
  180. </el-form-item>
  181. </el-col>
  182. <el-col :span="12">
  183. <el-form-item
  184. label="报告单背景色"
  185. label-width="120px"
  186. prop="reportBackgroundColor"
  187. >
  188. <el-color-picker
  189. @change="reportBackgroundColorchange"
  190. v-model="reportBackgroundColor16"
  191. ></el-color-picker>
  192. <!-- <el-input></el-input> -->
  193. <!-- <input type="text" v-model="form.reportBackgroundColor"> -->
  194. <el-input
  195. v-model="form.reportBackgroundColor"
  196. @input="reportBackgroundColorchange1"
  197. disabled
  198. style="
  199. width: 85%;
  200. position: absolute;
  201. top: 0px;
  202. margin-left: 10px;
  203. "
  204. ></el-input>
  205. </el-form-item>
  206. </el-col>
  207. <el-col :span="12">
  208. <el-form-item
  209. label="报告单字体色"
  210. label-width="120px"
  211. prop="reportFontColor"
  212. >
  213. <!-- <el-input v-model="form.reportFontColor"></el-input> -->
  214. <el-color-picker
  215. v-model="reportFontColor16"
  216. @change="reportFontColorchange"
  217. ></el-color-picker>
  218. <el-input
  219. v-model="form.reportFontColor"
  220. @input="reportFontColor1"
  221. disabled
  222. style="
  223. width: 85%;
  224. position: absolute;
  225. top: 0px;h
  226. margin-left: 10px;
  227. "
  228. ></el-input>
  229. </el-form-item>
  230. </el-col>
  231. <el-col :span="12">
  232. <el-form-item label="数据录入背景" label-width="100px">
  233. <el-color-picker
  234. v-model="dataInputBackgroundColor16"
  235. @change="dataInputBackgroundColorchange"
  236. ></el-color-picker>
  237. <el-input
  238. @input="inputdataInputBackgroundColor"
  239. v-model="form.dataInputBackgroundColor"
  240. disabled
  241. style="
  242. width: 85%;
  243. position: absolute;
  244. top: 0px;
  245. margin-left: 10px;
  246. "
  247. ></el-input>
  248. </el-form-item>
  249. </el-col>
  250. <el-col :span="12">
  251. <el-form-item
  252. label="数据录入字体"
  253. label-width="120px"
  254. prop="dataInputFontColor"
  255. >
  256. <el-color-picker
  257. v-model="dataInputFontColor16"
  258. @change="dataInputFontColorchange"
  259. ></el-color-picker>
  260. <el-input
  261. v-model.number="form.dataInputFontColor"
  262. @input="dataInputFontColor1"
  263. disabled
  264. style="
  265. width: 85%;
  266. margin-left: 10px;
  267. position: absolute;
  268. top: 0px;
  269. "
  270. ></el-input>
  271. </el-form-item>
  272. </el-col>
  273. </el-row>
  274. </el-form>
  275. <span slot="footer" class="dialog-footer">
  276. <el-button @click="dialogVisible = false" class="difference"
  277. > </el-button
  278. >
  279. <el-button
  280. type="primary"
  281. @click="confirmsubmission"
  282. class="commonbutton"
  283. > </el-button
  284. >
  285. </span>
  286. </el-dialog>
  287. </div>
  288. </div>
  289. </template>
  290. <script>
  291. import Sortable from "sortablejs";
  292. import { tcdate, deepCopy } from "../../utlis/proFunc";
  293. import { mapState } from "vuex";
  294. import {
  295. resultlist,
  296. statusaddition,
  297. statusmodification,
  298. deletedstate,
  299. stateBottomTop,
  300. sortstatus,
  301. } from "../../request/systemapi";
  302. export default {
  303. data() {
  304. return {
  305. isshow: true,
  306. form: {
  307. dataInputPrompt: "",
  308. reportPrompt: "",
  309. reportBackgroundColor: 1089274,
  310. // reportBackgroundColor16: "#409EFF",
  311. reportFontColor: 1089274,
  312. // reportFontColor16: "#409EFF",
  313. dataInputBackgroundColor: 1089274,
  314. // dataInputBackgroundColor16: "#409EFF",
  315. dataInputFontColor: 1089274,
  316. // dataInputFontColor16: "#409EFF",
  317. },
  318. reportBackgroundColor16: "",
  319. reportFontColor16: "#409EFF",
  320. dataInputBackgroundColor16: "#409EFF",
  321. dataInputFontColor16: "#409EFF",
  322. dialogVisible: false,
  323. title: 1,
  324. tableData: [],
  325. initTableData: [],
  326. pages: {
  327. // currentPage: 0,
  328. SkipCount: 0,
  329. MaxResultCount: 100,
  330. Sorting: "displayOrder desc",
  331. // totalCount: 0,
  332. },
  333. curRow: {},
  334. //表单校验
  335. rules: {
  336. resultStatusId: [
  337. { required: true, message: "请输入id", trigger: "blur" },
  338. ],
  339. displayName: [
  340. { required: true, message: "请输入名称", trigger: "blur" },
  341. ],
  342. dataInputPrompt: [
  343. { required: true, message: "请输入数据录入", trigger: "blur" },
  344. ],
  345. reportPrompt: [
  346. { required: true, message: "请输入报关单", trigger: "blur" },
  347. ],
  348. reportBackgroundColor: [
  349. { required: true, message: "请输入报告单背景色", trigger: "blur" },
  350. ],
  351. reportFontColor: [
  352. { required: true, message: "请输入报告单字体色", trigger: "blur" },
  353. ],
  354. dataInputBackgroundColor: [
  355. { required: true, message: "请输入数据录入背景色", trigger: "blur" },
  356. ],
  357. dataInputFontColor: [
  358. { required: true, message: "请输入数据录入字体色", trigger: "blur" },
  359. ],
  360. },
  361. };
  362. },
  363. created() {
  364. this.getlist();
  365. },
  366. mounted() {
  367. this.rowDrop();
  368. },
  369. computed: {
  370. ...mapState(["window"]),
  371. },
  372. methods: {
  373. changeUpdate(e, k) {
  374. this.$delete(this.form, k);
  375. console.log(this.form)
  376. this.$set(this.form, k, e);
  377. },
  378. handleClose(done) {
  379. this.$confirm("确认关闭?")
  380. .then((_) => {
  381. done();
  382. })
  383. .catch((_) => {});
  384. },
  385. //数据录入字体
  386. dataInputFontColorchange(v) {
  387. this.form.dataInputFontColor = eval(v.replace("#", "0x"));
  388. },
  389. //数据录入背景Input
  390. inputdataInputBackgroundColor(v) {
  391. this.form.dataInputBackgroundColor = Number(v);
  392. let temp=null
  393. temp = "000000" + this.form.dataInputBackgroundColor.toString(16);
  394. this.dataInputBackgroundColor16 =
  395. "#" + temp.substring(temp.length - 6, temp.length);
  396. },
  397. //数据录入背景
  398. dataInputBackgroundColorchange(v) {
  399. this.form.dataInputBackgroundColor = eval(v.replace("#", "0x"));
  400. },
  401. //颜色选择器报告单字体色
  402. reportFontColorchange(v) {
  403. this.form.reportFontColor = eval(v.replace("#", "0x"));
  404. },
  405. //报告单背景色
  406. reportBackgroundColorchange(v) {
  407. this.form.reportBackgroundColor = eval(v.replace("#", "0x"));
  408. },
  409. //数据录入字体
  410. dataInputFontColor1(v) {
  411. this.form.dataInputFontColor = Number(v);
  412. let temp=null
  413. temp = "000000" + this.form.dataInputFontColor.toString(16);
  414. this.dataInputFontColor16 =
  415. "#" + temp.substring(temp.length - 6, temp.length);
  416. },
  417. //报告单字体色
  418. reportFontColor1(v) {
  419. this.form.reportFontColor = Number(v);
  420. let temp = null;
  421. temp = "000000" + this.form.reportFontColor.toString(16);
  422. this.reportFontColor16 =
  423. "#" + temp.substring(temp.length - 6, temp.length);
  424. },
  425. //报告单背景色
  426. reportBackgroundColorchange1(v) {
  427. this.form.reportBackgroundColor = Number(v);
  428. let temp = null;
  429. temp = "000000" + this.form.reportBackgroundColor.toString(16);
  430. this.reportBackgroundColor16 =
  431. "#" + temp.substring(temp.length - 6, temp.length);
  432. },
  433. colorFormat(e) {
  434. let temp = "000000" + Number(e).toString(16);
  435. return "#" + temp.substring(temp.length - 6, temp.length);
  436. },
  437. rowclick(row) {
  438. this.curRow = { ...row };
  439. },
  440. haxadecimal() {
  441. let str = this.form.dataInputFontColor;
  442. this.form.dataInputFontColor = str
  443. .replace(/[^0-9a-fA-F]/g, "")
  444. .replace(/\s/g, "");
  445. },
  446. //取消排序
  447. cancellation() {
  448. this.$message.info("取消操作");
  449. this.isshow = true;
  450. this.getlist();
  451. },
  452. //确定拖拽
  453. assertion() {
  454. const result = [];
  455. this.tableData.forEach((item, index) => {
  456. // index 从0开始的, displayOrder从大到小排
  457. // const currentDisplayOrder = this.tableData.length -1
  458. // const currentDisplayOrder = this.initTableData[index].displayOrder;
  459. // if (item.displayOrder != currentDisplayOrder) {
  460. // 如果它的displayOrder和它当前所在的位置不同代表挪动过位置
  461. result.push({ id: item.id, displayOrder: index+1 });
  462. // result.push({
  463. // id: item.resultStatusId,
  464. // displayOrder: currentDisplayOrder,
  465. // });
  466. // }
  467. });
  468. sortstatus({ itemList: result }).then((res) => {
  469. if (res.code != -1) {
  470. this.isshow = true;
  471. this.getlist();
  472. this.$message.success("操作成功");
  473. }
  474. });
  475. },
  476. //初始化
  477. rowDrop() {
  478. this.$nextTick(() => {
  479. const tbody = document.querySelector(".el-table__body-wrapper tbody");
  480. const _this = this;
  481. Sortable.create(tbody, {
  482. handle: ".move",
  483. animation: 300,
  484. // 指定父元素下可被拖拽的子元素
  485. // draggable: ".module-manager .el-table__row",
  486. onChoose({oldIndex}){
  487. _this.$refs['tableData'].setCurrentRow(_this.tableData[oldIndex]);
  488. _this.rowclick(_this.tableData[oldIndex])
  489. },
  490. onEnd({ newIndex, oldIndex }) {
  491. // console.log(arr);
  492. _this.isshow = false;
  493. const currRow = _this.tableData.splice(oldIndex, 1)[0];
  494. _this.tableData.splice(newIndex, 0, currRow);
  495. _this.tableData.map((item, index) => {
  496. if (index == newIndex && index == oldIndex) {
  497. // console.log(item, "新数据");
  498. } else if (index == oldIndex) {
  499. } else if (index == newIndex) {
  500. }
  501. });
  502. },
  503. });
  504. });
  505. },
  506. //置顶置底
  507. topping() {
  508. this.form = { ...this.curRow };
  509. if (this.form.id == undefined) {
  510. this.$message.warning("请选择操作的数据");
  511. } else {
  512. stateBottomTop(this.form.id, 1).then((res) => {
  513. if(res.code!=-1){
  514. this.getlist();
  515. this.$message.success('操作成功')
  516. }
  517. });
  518. }
  519. },
  520. toppings() {
  521. this.form = { ...this.curRow };
  522. if (this.form.id == undefined) {
  523. this.$message.warning("请选择操作的数据");
  524. } else {
  525. stateBottomTop(this.form.id, 2).then((res) => {
  526. if(res.code!=-1){
  527. this.getlist();
  528. this.$message.success('操作成功')
  529. }
  530. });
  531. }
  532. },
  533. //置顶置底
  534. // topping(row, t) {
  535. // stateBottomTop(row.resultStatusId, t).then((res) => {
  536. // if (res.code != -1) {
  537. // this.getlist();
  538. // this.$message.success("操作成功");
  539. // }
  540. // });
  541. // },
  542. //删除
  543. delsrts(row) {
  544. deletedstate(row.resultStatusId).then((res) => {
  545. if (res.code != -1) {
  546. this.getlist();
  547. this.$message.success("删除成功");
  548. }
  549. });
  550. },
  551. //编辑弹框
  552. editpopup() {
  553. if (this.curRow.id == undefined) {
  554. this.$message.warning("请选择操作的数据");
  555. } else {
  556. this.dialogVisible = true;
  557. this.form = { ...this.curRow };
  558. if (this.$refs.ruleForm !== undefined) {
  559. this.$refs.ruleForm.resetFields();
  560. }
  561. this.title = 2;
  562. this.reportBackgroundColorchange1(this.form.reportBackgroundColor);
  563. this.reportFontColor1(this.form.reportFontColor);
  564. this.dataInputFontColor1(this.form.dataInputFontColor);
  565. this.inputdataInputBackgroundColor(this.form.dataInputBackgroundColor);
  566. }
  567. },
  568. //q确定
  569. confirmsubmission() {
  570. this.$refs.ruleForm.validate((v) => {
  571. if (v) {
  572. if (this.title == 1) {
  573. statusaddition(this.form).then((res) => {
  574. if (res.code != -1) {
  575. this.getlist();
  576. this.dialogVisible = false;
  577. this.form = {};
  578. this.$message.success("新增成功");
  579. }
  580. });
  581. } else if (this.title == 2) {
  582. let obj = {
  583. // displayName: this.form.displayName,
  584. dataInputPrompt: this.form.dataInputPrompt,
  585. reportPrompt: this.form.reportPrompt,
  586. reportBackgroundColor: this.form.reportBackgroundColor,
  587. reportFontColor: this.form.reportFontColor,
  588. dataInputBackgroundColor: this.form.dataInputBackgroundColor,
  589. dataInputFontColor: this.form.dataInputFontColor,
  590. };
  591. statusmodification(this.form.id, this.form).then((res) => {
  592. if (res.code != -1) {
  593. this.getlist();
  594. this.dialogVisible = false;
  595. this.form = { ...res.data };
  596. this.rowclick(res.data);
  597. this.$message.success("修改成功");
  598. }
  599. });
  600. }
  601. }
  602. });
  603. },
  604. //新增弹框
  605. add() {
  606. this.title = 1;
  607. this.dialogVisible = true;
  608. },
  609. //获取数据列表
  610. getlist() {
  611. resultlist(this.pages).then((res) => {
  612. if (res.code != -1) {
  613. this.tableData = [...res.data.items];
  614. this.initTableData = [...res.data.items];
  615. this.totalCount = res.data.totalCount;
  616. }
  617. });
  618. },
  619. },
  620. };
  621. </script>
  622. <style scoped>
  623. @import "../../assets/css/global_button.css";
  624. @import "../../assets/css/global_dialog.css";
  625. @import "../../assets/css/global_table.css";
  626. @import "../../assets/css/global_form.css";
  627. @import "../../assets/css/global_input.css";
  628. @import "../../assets/css/global.css";
  629. .box {
  630. display: flex;
  631. flex-direction: column;
  632. }
  633. :deep .el-form-item {
  634. margin-bottom: 14px;
  635. }
  636. /* el-dialog的头部样式 */
  637. :deep .el-dialog__header {
  638. padding: 11px 20px 11px;
  639. }
  640. /* el-dialog的主体样式 */
  641. :deep .el-dialog__body {
  642. padding: 0px 20px 0px;
  643. }
  644. /* el-divider样式 */
  645. :deep .el-divider--horizontal {
  646. margin: 0px 0 12px;
  647. }
  648. /* el-dialog的底部样式 */
  649. :deep .el-dialog__footer {
  650. padding: 0px 20px 14px;
  651. }
  652. .seachinput {
  653. width: 250px;
  654. margin-right: 110px;
  655. }
  656. :deep .seachinput .el-select {
  657. width: 100%;
  658. }
  659. .colorblock {
  660. width: 25px;
  661. height: 25px;
  662. }
  663. </style>