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.

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