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.

502 lines
16 KiB

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
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
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
2 years ago
  1. <template>
  2. <div style="display: flex">
  3. <el-card class="elcard" style="border-radius: 15px; width: 95%">
  4. <div class="publiccss">结果状态</div>
  5. <!-- <el-button type="primary" @click="add">新增</el-button> -->
  6. <el-table
  7. :data="tableData"
  8. style="width: 100%; margin-top: 20px"
  9. row-key="id"
  10. class="el-table__body-wrapper tbody"
  11. @row-click="rowclick"
  12. highlight-current-row
  13. >
  14. <el-table-column prop="id" label="编号" width="180"> </el-table-column>
  15. <el-table-column prop="displayName" label="名称" width="180">
  16. </el-table-column>
  17. <el-table-column prop="reportPrompt" label="报告单提示" width="180">
  18. </el-table-column>
  19. <el-table-column
  20. prop="dataInputPrompt"
  21. label="数据录入提示"
  22. width="180"
  23. >
  24. </el-table-column>
  25. <el-table-column prop="reportFontColor" label="报告单字体色">
  26. </el-table-column>
  27. <el-table-column label="操作" width="400">
  28. <!-- <template slot-scope="scope"> -->
  29. <!-- <el-button type="primary" @click="delsrts(scope.row)"
  30. >删除</el-button
  31. > -->
  32. <!-- <el-button type="primary" @click="topping(scope.row, 1)"
  33. >置顶</el-button
  34. >
  35. <el-button type="primary" @click="topping(scope.row, 2)"
  36. >置底</el-button
  37. > -->
  38. <!-- <el-tag
  39. class="move"
  40. style="cursor: move; margin-left: 15px"
  41. draggable="true"
  42. >
  43. <i class="el-icon-d-caret" style="width: 1rem; height: 1rem"></i>
  44. </el-tag> -->
  45. <!-- </template> -->
  46. </el-table-column>
  47. </el-table>
  48. <!-- 分页 -->
  49. <!-- <div class="cancelorconfirm">
  50. <el-button type="primary" :disabled="isshow" @click="assertion"
  51. >确定排序</el-button
  52. >
  53. <el-button type="primary" :disabled="isshow" @click="cancellation"
  54. >取消排序</el-button
  55. >
  56. </div> -->
  57. <!-- 新增或者编辑弹框 -->
  58. <el-dialog
  59. :title="title == 1 ? '新增' : '修改'"
  60. :visible.sync="dialogVisible"
  61. width="55%"
  62. :before-close="handleClose"
  63. :close-on-click-modal="false"
  64. >
  65. <el-form :model="form" :rules="rules" ref="ruleForm" label-width="80px">
  66. <el-row>
  67. <!-- <el-col :span="12">
  68. <el-form-item f
  69. label="id"
  70. label-width="120px"
  71. prop="resultStatusId"
  72. >
  73. <el-input v-model="form.resultStatusId"></el-input>
  74. </el-form-item>
  75. </el-col> -->
  76. <!-- <el-col :span="12">
  77. <el-form-item label="名称" label-width="120px" prop="displayName">
  78. <el-input v-model="form.displayName"></el-input>
  79. </el-form-item>
  80. </el-col> -->
  81. <el-col :span="12">
  82. <el-form-item
  83. label="数据录入提示"
  84. label-width="120px"
  85. prop="dataInputPrompt"
  86. >
  87. <el-input v-model="form.dataInputPrompt"></el-input>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="12">
  91. <el-form-item
  92. label="报告单提示"
  93. label-width="120px"
  94. prop="reportPrompt"
  95. >
  96. <el-input v-model="form.reportPrompt"></el-input>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :span="12">
  100. <el-form-item
  101. label="报告单背景色"
  102. label-width="120px"
  103. prop="reportBackgroundColor"
  104. >
  105. <el-color-picker
  106. @change="reportBackgroundColorchange"
  107. v-model="reportBackgroundColor16"
  108. ></el-color-picker>
  109. <!-- <el-input></el-input> -->
  110. <!-- <input type="text" v-model="form.reportBackgroundColor"> -->
  111. <el-input
  112. v-model.number="form.reportBackgroundColor"
  113. @input="reportBackgroundColorchange1"
  114. style="
  115. width: 85%;
  116. position: absolute;
  117. top: 0px;
  118. margin-left: 10px;
  119. "
  120. ></el-input>
  121. </el-form-item>
  122. </el-col>
  123. <el-col :span="12">
  124. <el-form-item
  125. label="报告单字体色"
  126. label-width="120px"
  127. prop="reportFontColor"
  128. >
  129. <!-- <el-input v-model="form.reportFontColor"></el-input> -->
  130. <el-color-picker
  131. v-model="reportFontColor16"
  132. @change="reportFontColorchange"
  133. ></el-color-picker>
  134. <el-input
  135. v-model="form.reportFontColor"
  136. @input="reportFontColor1"
  137. style="
  138. width: 85%;
  139. position: absolute;
  140. top: 0px;h
  141. margin-left: 10px;
  142. "
  143. ></el-input>
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span="12">
  147. <el-form-item label="数据录入背景" label-width="100px">
  148. <el-color-picker
  149. v-model="dataInputBackgroundColor16"
  150. @change="dataInputBackgroundColorchange"
  151. ></el-color-picker>
  152. <el-input
  153. @input="inputdataInputBackgroundColor"
  154. v-model="form.dataInputBackgroundColor"
  155. style="
  156. width: 85%;
  157. position: absolute;
  158. top: 0px;
  159. margin-left: 10px;
  160. "
  161. ></el-input>
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="12">
  165. <el-form-item
  166. label="数据录入字体"
  167. label-width="120px"
  168. prop="dataInputFontColor"
  169. >
  170. <el-color-picker
  171. v-model="dataInputFontColor16"
  172. @change="dataInputFontColorchange"
  173. ></el-color-picker>
  174. <el-input
  175. v-model.number="form.dataInputFontColor"
  176. @input="dataInputFontColor1"
  177. style="
  178. width: 85%;
  179. margin-left: 10px;
  180. position: absolute;
  181. top: 0px;
  182. "
  183. ></el-input>
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. </el-form>
  188. <span slot="footer" class="dialog-footer">
  189. <el-button @click="dialogVisible = false"> </el-button>
  190. <el-button
  191. type="primary"
  192. @click="confirmsubmission"
  193. class="bulletcommit"
  194. > </el-button
  195. >
  196. </span>
  197. </el-dialog>
  198. </el-card>
  199. <div style="margin-left: 10px">
  200. <el-button
  201. type=""
  202. @click="editpopup"
  203. style="margin-top: 80px"
  204. class="commonbutton"
  205. >编辑</el-button
  206. >
  207. </div>
  208. </div>
  209. </template>
  210. <script>
  211. import Sortable from "sortablejs";
  212. import {
  213. resultlist,
  214. statusaddition,
  215. statusmodification,
  216. deletedstate,
  217. stateBottomTop,
  218. sortstatus,
  219. } from "../../request/systemapi";
  220. export default {
  221. data() {
  222. return {
  223. isshow: true,
  224. form: {
  225. resultStatusId: "",
  226. displayName: "",
  227. dataInputPrompt: "",
  228. reportPrompt: "",
  229. reportBackgroundColor: 1089274,
  230. // reportBackgroundColor16: "#409EFF",
  231. reportFontColor: 1089274,
  232. // reportFontColor16: "#409EFF",
  233. dataInputBackgroundColor: 1089274,
  234. // dataInputBackgroundColor16: "#409EFF",
  235. dataInputFontColor: 1089274,
  236. // dataInputFontColor16: "#409EFF",
  237. },
  238. reportBackgroundColor16: "",
  239. reportFontColor16: "#409EFF",
  240. dataInputBackgroundColor16: "#409EFF",
  241. dataInputFontColor16: "#409EFF",
  242. dialogVisible: false,
  243. title: 1,
  244. tableData: [],
  245. initTableData: [],
  246. pages: {
  247. // currentPage: 0,
  248. SkipCount: 0,
  249. MaxResultCount: 100,
  250. Sorting: "displayOrder desc",
  251. // totalCount: 0,
  252. },
  253. //表单校验
  254. rules: {
  255. resultStatusId: [
  256. { required: true, message: "请输入id", trigger: "blur" },
  257. ],
  258. displayName: [
  259. { required: true, message: "请输入名称", trigger: "blur" },
  260. ],
  261. dataInputPrompt: [
  262. { required: true, message: "请输入数据录入", trigger: "blur" },
  263. ],
  264. reportPrompt: [
  265. { required: true, message: "请输入报关单", trigger: "blur" },
  266. ],
  267. reportBackgroundColor: [
  268. { required: true, message: "请输入报告单背景色", trigger: "blur" },
  269. ],
  270. reportFontColor: [
  271. { required: true, message: "请输入报告单字体色", trigger: "blur" },
  272. ],
  273. dataInputBackgroundColor: [
  274. { required: true, message: "请输入数据录入背景色", trigger: "blur" },
  275. ],
  276. dataInputFontColor: [
  277. { required: true, message: "请输入数据录入字体色", trigger: "blur" },
  278. ],
  279. },
  280. };
  281. },
  282. created() {
  283. this.getlist();
  284. },
  285. mounted() {
  286. this.rowDrop();
  287. },
  288. methods: {
  289. handleClose(done) {
  290. this.$confirm("确认关闭?")
  291. .then((_) => {
  292. done();
  293. })
  294. .catch((_) => {});
  295. },
  296. //数据录入字体
  297. dataInputFontColorchange(v) {
  298. this.form.dataInputFontColor = eval(v.replace("#", "0x"));
  299. },
  300. //数据录入背景Input
  301. inputdataInputBackgroundColor(v) {
  302. this.form.dataInputBackgroundColor = Number(v);
  303. let temp = "000000" + this.form.dataInputBackgroundColor.toString(16);
  304. this.dataInputBackgroundColor16 =
  305. "#" + temp.substring(temp.length - 6, temp.length);
  306. },
  307. //数据录入背景
  308. dataInputBackgroundColorchange(v) {
  309. this.form.dataInputBackgroundColor = eval(v.replace("#", "0x"));
  310. },
  311. //颜色选择器报告单字体色
  312. reportFontColorchange(v) {
  313. this.form.reportFontColor = eval(v.replace("#", "0x"));
  314. console.log(this.form.reportFontColor);
  315. },
  316. //报告单背景色
  317. reportBackgroundColorchange(v) {
  318. this.form.reportBackgroundColor = eval(v.replace("#", "0x"));
  319. console.log(this.form.reportBackgroundColor);
  320. },
  321. //数据录入字体
  322. dataInputFontColor1(v) {
  323. this.form.dataInputFontColor = Number(v);
  324. let temp = "000000" + this.form.dataInputFontColor.toString(16);
  325. this.dataInputFontColor16 =
  326. "#" + temp.substring(temp.length - 6, temp.length);
  327. },
  328. //报告单字体色
  329. reportFontColor1(v) {
  330. this.form.reportFontColor = Number(v);
  331. let temp = "000000" + this.form.reportFontColor.toString(16);
  332. this.reportFontColor16 =
  333. "#" + temp.substring(temp.length - 6, temp.length);
  334. },
  335. //报告单背景色
  336. reportBackgroundColorchange1(v) {
  337. this.form.reportBackgroundColor = Number(v);
  338. let temp = "000000" + this.form.reportBackgroundColor.toString(16);
  339. this.reportBackgroundColor16 =
  340. "#" + temp.substring(temp.length - 6, temp.length);
  341. },
  342. rowclick(row) {
  343. this.form = row;
  344. console.log(this.form);
  345. this.reportBackgroundColor16 = "#" + this.form.reportBackgroundColor; //reportBackgroundColor
  346. console.log("reportBackgroundColor16", this.reportBackgroundColor16);
  347. this.reportBackgroundColorchange1(this.form.reportBackgroundColor);
  348. this.reportFontColor1(this.form.reportFontColor);
  349. this.dataInputFontColor1(this.form.dataInputFontColor);
  350. this.inputdataInputBackgroundColor(this.form.dataInputBackgroundColor);
  351. },
  352. haxadecimal() {
  353. let str = this.form.dataInputFontColor;
  354. this.form.dataInputFontColor = str
  355. .replace(/[^0-9a-fA-F]/g, "")
  356. .replace(/\s/g, "");
  357. },
  358. //取消排序
  359. cancellation() {
  360. this.$message.info("取消操作");
  361. this.isshow = true;
  362. this.getlist();
  363. },
  364. //确定拖拽
  365. assertion() {
  366. const result = [];
  367. this.tableData.forEach((item, index) => {
  368. // index 从0开始的, displayOrder从大到小排
  369. console.log(item.id);
  370. // const currentDisplayOrder = this.tableData.length -1
  371. const currentDisplayOrder = this.initTableData[index].displayOrder;
  372. if (item.displayOrder != currentDisplayOrder) {
  373. // 如果它的displayOrder和它当前所在的位置不同代表挪动过位置
  374. result.push({
  375. id: item.resultStatusId,
  376. displayOrder: currentDisplayOrder,
  377. });
  378. }
  379. });
  380. sortstatus({ itemList: result }).then((res) => {
  381. this.$message.success("操作成功");
  382. this.isshow = true;
  383. this.getlist();
  384. });
  385. },
  386. //初始化
  387. rowDrop() {
  388. this.$nextTick(() => {
  389. const tbody = document.querySelector(".el-table__body-wrapper tbody");
  390. const _this = this;
  391. Sortable.create(tbody, {
  392. handle: ".move",
  393. animation: 300,
  394. // 指定父元素下可被拖拽的子元素
  395. // draggable: ".module-manager .el-table__row",
  396. onEnd({ newIndex, oldIndex }) {
  397. // console.log(arr);
  398. _this.isshow = false;
  399. const currRow = _this.tableData.splice(oldIndex, 1)[0];
  400. _this.tableData.splice(newIndex, 0, currRow);
  401. _this.tableData.map((item, index) => {
  402. if (index == newIndex && index == oldIndex) {
  403. // console.log(item, "新数据");
  404. } else if (index == oldIndex) {
  405. } else if (index == newIndex) {
  406. }
  407. });
  408. console.log(_this.tableData.map((item) => item.displayOrder));
  409. },
  410. });
  411. });
  412. },
  413. //置顶置底
  414. topping(row, t) {
  415. stateBottomTop(row.resultStatusId, t).then((res) => {
  416. this.$message.success("操作成功");
  417. this.getlist();
  418. });
  419. },
  420. //删除
  421. delsrts(row) {
  422. deletedstate(row.resultStatusId).then((res) => {
  423. this.$message.success("删除成功");
  424. this.getlist();
  425. });
  426. },
  427. //编辑弹框
  428. editpopup() {
  429. if (this.form.id == undefined) {
  430. this.$message.warning("请选择操作的数据");
  431. } else {
  432. console.log("22222222222222");
  433. this.dialogVisible = true;
  434. this.title = 2;
  435. }
  436. },
  437. //q确定
  438. confirmsubmission() {
  439. this.$refs.ruleForm.validate((v) => {
  440. if (v) {
  441. if (this.title == 1) {
  442. statusaddition(this.form).then((res) => {
  443. this.$message.success("新增成功");
  444. this.getlist();
  445. this.dialogVisible = false;
  446. this.form = {};
  447. });
  448. } else if (this.title == 2) {
  449. console.log(this.form.reportBackgroundColor);
  450. let obj = {
  451. // displayName: this.form.displayName,
  452. dataInputPrompt: this.form.dataInputPrompt,
  453. reportPrompt: this.form.reportPrompt,
  454. reportBackgroundColor: this.form.reportBackgroundColor,
  455. reportFontColor: this.form.reportFontColor,
  456. dataInputBackgroundColor: this.form.dataInputBackgroundColor,
  457. dataInputFontColor: this.form.dataInputFontColor,
  458. };
  459. statusmodification(this.form.id, obj).then((res) => {
  460. this.$message.success("修改成功");
  461. this.getlist();
  462. this.dialogVisible = false;
  463. });
  464. }
  465. }
  466. });
  467. },
  468. //新增弹框
  469. add() {
  470. this.title = 1;
  471. this.dialogVisible = true;
  472. },
  473. //获取数据列表
  474. getlist() {
  475. resultlist(this.pages).then((res) => {
  476. this.tableData = res.data.items;
  477. this.initTableData = [...res.data.items];
  478. this.totalCount = res.data.totalCount;
  479. console.log(res);
  480. });
  481. },
  482. },
  483. };
  484. </script>
  485. <style scoped>
  486. ::v-deep .el-table__header th {
  487. /* font-size: px; */
  488. background-color: rgb(245, 245, 245); /* 设置表头背景颜色 */
  489. color: rgb(113, 113, 113); /* 设置表头文字颜色 */
  490. }
  491. .cancelorconfirm {
  492. display: flex;
  493. justify-content: flex-end;
  494. padding: 20px;
  495. }
  496. </style>