index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="flex-count">
  3. <div class="flex-count-header">
  4. <span>在线文档-文件管理</span>
  5. <el-button type="primary" class="header-button" @click="clickSave"
  6. >新建</el-button
  7. >
  8. </div>
  9. <Table @clickDemand="clickDemand" :list="lable" ref="TableList"> </Table>
  10. <!-- <div v-for="(item, index) in optionsExcel" :key="index">
  11. <div @click="clickSee(item)">{{ item.option.title }}</div>
  12. </div>
  13. <el-button @click="newExcle">新建</el-button>
  14. <div
  15. id="luckysheet"
  16. v-show="excelStatus"
  17. style="
  18. margin: 0px;
  19. padding: 0px;
  20. position: absolute;
  21. width: 100%;
  22. height: 100%;
  23. left: 0px;
  24. top: 0px;
  25. "
  26. ></div> -->
  27. </div>
  28. </template>
  29. <script>
  30. import axios from "axios";
  31. import luckyexcel from "luckyexcel";
  32. import Table from "../../../components/el-form.vue";
  33. export default {
  34. components: {
  35. Table,
  36. },
  37. data() {
  38. return {
  39. excelStatus: false,
  40. optionsExcel: [],
  41. ids: "",
  42. lable: {
  43. name: "first",
  44. height: "650",
  45. titledata: [
  46. {
  47. label: "名称",
  48. prop: "needName",
  49. width: 300,
  50. color: "#0682CD",
  51. },
  52. {
  53. label: "创建时间",
  54. prop: "needType",
  55. width: 200,
  56. },
  57. {
  58. label: "创建科室",
  59. prop: "applyDept",
  60. width: 200,
  61. },
  62. {
  63. label: "创建人",
  64. prop: "applyDepartment",
  65. width: 200,
  66. },
  67. {
  68. label: "权限状态",
  69. prop: "proposer",
  70. width: 200,
  71. },
  72. ], //表格头
  73. data: [], //内容数据
  74. loading: true,
  75. pageData: {
  76. total: 100, // 总条数
  77. pageSize: 10, // 每页数量
  78. pageNum: 1, // 页码
  79. },
  80. isSelection: true, // 表格有多选时设置
  81. isOperation: false, // 表格有操作列时设置
  82. isIndex: false, // 列表序号
  83. operation: {
  84. // 表格有操作列时设置
  85. label: "操作", // 列名
  86. width: "50", // 根据实际情况给宽度
  87. data: [
  88. {
  89. label: "操作", // 操作名称
  90. type: "", //按钮类型
  91. handleRow: (e, r, o) => {
  92. // this.disabled = true;
  93. // this.dialogTitle = "查看";
  94. // if (r.taskName === "起草") {
  95. // this.disabled = false;
  96. // } else {
  97. // this.disabled = true;
  98. // }
  99. // this.fromList = r;
  100. // this.clickForm(r);
  101. // this.getFromQuery(r);
  102. // this.dialogStatus = true;
  103. // setTimeout(() => {
  104. // this.getBtnStatus(r);
  105. // }, 500);
  106. // this.formWorkId = r.id;
  107. // this.formId = r.taskId;
  108. // this.taskName = r.taskName;
  109. // this.getQuery()
  110. }, // 自定义事件
  111. },
  112. ],
  113. },
  114. },
  115. };
  116. },
  117. created() {
  118. this.getAllExcel();
  119. },
  120. mounted() {},
  121. methods: {
  122. clickSave() {
  123. this.$http({
  124. url: "/market/cOnlineExcel/addExcel",
  125. method: "post",
  126. headers: {
  127. "Content-Type": "application/json",
  128. },
  129. data: {
  130. folderId: '',
  131. },
  132. }).then((res) => {
  133. // if (res.data.result === 1) {
  134. // _this.$message({
  135. // message: res.data.desc,
  136. // type: "error",
  137. // });
  138. // } else {
  139. // _this.$message({
  140. // message: "成功",
  141. // type: "success",
  142. // });
  143. // var id = res.data.desc;
  144. // _this.addNewStatus = false;
  145. // //放入id,切换到excel模式
  146. // document.getElementById("excelId").setAttribute("value", id);
  147. // _this.showExcel = true;
  148. // }
  149. });
  150. },
  151. clickSee(e) {
  152. this.$http({
  153. url: "/api/sheet/workbook/" + e.id,
  154. method: "post",
  155. headers: {
  156. "Content-Type": "application/json",
  157. },
  158. data: {},
  159. }).then((res) => {
  160. this.ids = e.id;
  161. // this.optionsExcel = res.data;
  162. let options = {
  163. container: "luckysheet",
  164. title: "123123",
  165. allowUpdate: true,
  166. lang: "zh",
  167. loadUrl:
  168. window.location.protocol +
  169. "//43.138.50.94:7777" +
  170. "/sheet/worksheet/" +
  171. this.ids,
  172. loadSheetUrl:
  173. window.location.protocol +
  174. "//43.138.50.94:7777" +
  175. "/sheet/loadsheet/" +
  176. this.ids,
  177. updateUrl:
  178. "ws://" +
  179. "//43.138.50.94:7777" +
  180. "/ws/" +
  181. JSON.parse(window.sessionStorage.userInfo).loginName +
  182. "/" +
  183. this.ids,
  184. };
  185. window.luckysheet.create(options);
  186. this.excelStatus = true;
  187. });
  188. },
  189. //获取所有
  190. getAllExcel() {
  191. let data = {};
  192. axios
  193. .post("http://43.138.50.94:7777/sheet/allSheet", data)
  194. .then((res) => {
  195. console.log(res);
  196. this.optionsExcel = res.data;
  197. });
  198. },
  199. newExcle() {
  200. let data = {};
  201. axios.post("http://43.138.50.94:7777/sheet/create", data).then((res) => {
  202. console.log(res);
  203. let list = {
  204. name: res.data.name,
  205. id: res.data.id,
  206. };
  207. this.optionsExcel.push(list);
  208. });
  209. },
  210. },
  211. };
  212. </script>
  213. <style lang="scss" scoped>
  214. .flex-count {
  215. background-color: #fff;
  216. .flex-count-header {
  217. display: flex;
  218. flex-direction: column;
  219. span {
  220. font-size: 22px;
  221. margin: 20px 0 0 30px;
  222. }
  223. .header-button {
  224. width: 10%;
  225. margin: 20px 0 20px 30px;
  226. }
  227. }
  228. }
  229. </style>