mould.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div>
  3. <div class="simple-container">
  4. <simple-form
  5. :form="table_form"
  6. :handle="table_handle"
  7. @search="handleSearch"
  8. @add="handleVisible('add')"
  9. ></simple-form>
  10. <simple-table
  11. :list="table_list"
  12. :config="table_config"
  13. :loading="table_loading"
  14. :handle-row="table_handle_row"
  15. @issue="(params) => handleVisible('issue', params)"
  16. @detail="(params) => handleVisible('template', params)"
  17. @delete="handleDelete"
  18. ></simple-table>
  19. <simple-pagination
  20. :page="page"
  21. :total="total"
  22. @change="handleChange"
  23. ></simple-pagination>
  24. </div>
  25. <simple-dialog
  26. title="下发"
  27. width="500px"
  28. @cancel="handleVisible('issue')"
  29. @confirm="handleIssue"
  30. :visible="issue_visible"
  31. >
  32. <el-form label-width="100px" :model="issue_form">
  33. <el-form-item label="填报事由">
  34. <el-input v-model="issue_form.reason"></el-input>
  35. </el-form-item>
  36. <el-form-item label="填报注意事项">
  37. <el-input v-model="issue_form.precautions"></el-input>
  38. </el-form-item>
  39. <el-form-item label="截止时间">
  40. <el-date-picker v-model="issue_form.endTime" type="date">
  41. </el-date-picker>
  42. </el-form-item>
  43. </el-form>
  44. </simple-dialog>
  45. <simple-dialog
  46. fullscreen
  47. title="新增模板"
  48. :visible="add_visible"
  49. width="1200px"
  50. @confirm="handleVisible('add')"
  51. @cancel="handleVisible('add')"
  52. >
  53. <el-form inline :model="form" label-width="100px"> </el-form>
  54. <simple-sheet v-if="add_visible" type="edit" />
  55. <template v-slot:footer><div></div></template>
  56. </simple-dialog>
  57. <simple-dialog
  58. title="查看模板"
  59. fullscreen
  60. @cancel="handleVisible('template')"
  61. @confirm="handleVisible('template')"
  62. :visible="template_visible"
  63. >
  64. <simple-sheet v-if="template_visible" :id="template_id" />
  65. <template v-slot:footer><div></div></template>
  66. </simple-dialog>
  67. </div>
  68. </template>
  69. <script>
  70. import simpleForm from "./components/form.vue";
  71. import simpleSheet from "./components/sheet.vue";
  72. import simpleTable from "./components/table.vue";
  73. import simpleDialog from "./components/dialog.vue";
  74. import simplePagination from "./components/pagination.vue";
  75. export default {
  76. components: {
  77. simpleTable,
  78. simpleDialog,
  79. simpleForm,
  80. simpleSheet,
  81. simplePagination,
  82. },
  83. data() {
  84. return {
  85. page: 1,
  86. rows: 10,
  87. total: 0,
  88. form: {},
  89. add_visible: false,
  90. // template
  91. template_visible: false,
  92. template_id: null,
  93. // issue
  94. issue_visible: false,
  95. issue_form: {},
  96. issue_id: null,
  97. // table
  98. table_loading: false,
  99. table_search: {},
  100. table_form: [
  101. {
  102. label: "模板名称",
  103. props: "templateName",
  104. type: "input",
  105. },
  106. ],
  107. table_list: [],
  108. table_handle: [
  109. {
  110. label: "新增模板",
  111. props: "add",
  112. },
  113. ],
  114. table_handle_row: [
  115. {
  116. label: "下发",
  117. props: "issue",
  118. },
  119. {
  120. label: "查看",
  121. props: "detail",
  122. },
  123. {
  124. label: "删除",
  125. props: "delete",
  126. popconfirm: true,
  127. },
  128. ],
  129. table_config: [
  130. {
  131. label: "模板名称",
  132. props: "templateName",
  133. },
  134. {
  135. label: "配置时间",
  136. props: "updateTime",
  137. },
  138. {
  139. label: "配置人员",
  140. props: "createId",
  141. },
  142. {
  143. label: "模板状态",
  144. props: "status",
  145. type: "dictionary",
  146. dictionary: {
  147. 0: "在用",
  148. 1: "停用",
  149. },
  150. },
  151. ],
  152. };
  153. },
  154. methods: {
  155. async handleInit() {
  156. this.table_loading = true;
  157. this.$http({
  158. url: "/market/CMKFileTemplate/CMKFileTemplateList",
  159. method: "post",
  160. headers: {
  161. "Content-Type": "application/json",
  162. },
  163. data: {
  164. page: this.page,
  165. pageSize: this.rows,
  166. templateName: this.table_search.templateName,
  167. },
  168. }).then(({ data: { count, data } }) => {
  169. this.total = count;
  170. this.table_list = data;
  171. this.table_loading = false;
  172. });
  173. },
  174. handleSearch({ templateName }) {
  175. this.table_search = { templateName };
  176. this.handleReset();
  177. this.handleInit();
  178. },
  179. handleAdd() {},
  180. handleChange(page) {
  181. this.page = page;
  182. this.handleInit();
  183. },
  184. handleVisible(props, params) {
  185. switch (props) {
  186. case "add":
  187. this.add_visible = !this.add_visible;
  188. break;
  189. case "template":
  190. this.template_visible = !this.template_visible;
  191. this.template_id = params?.id;
  192. break;
  193. case "issue":
  194. this.issue_visible = !this.issue_visible;
  195. this.issue_id = params?.id;
  196. break;
  197. }
  198. },
  199. handleReset() {
  200. this.page = 1;
  201. },
  202. handleDelete({ id }) {
  203. this.$http({
  204. url: "/market/CMKFileTemplate/delCMKFileTemplateById",
  205. method: "post",
  206. headers: {
  207. "Content-Type": "application/json",
  208. },
  209. data: {
  210. templateId: id,
  211. },
  212. }).then(() => {
  213. this.$message.success("删除成功");
  214. this.handleInit();
  215. });
  216. },
  217. handleIssue() {
  218. this.$http({
  219. url: "/market/CMKFileTemplate/issuedCMKFileTemplateById",
  220. method: "post",
  221. headers: {
  222. "Content-Type": "application/json",
  223. },
  224. data: {
  225. ...this.issue_form,
  226. endTime: this.$formatDate(
  227. this.issue_form.endTime,
  228. "YYYY-MM-DD"
  229. ),
  230. templateId: this.issue_id,
  231. },
  232. }).then(() => {
  233. this.handleVisible("issue");
  234. this.$message.success("下发成功");
  235. this.handleInit();
  236. });
  237. },
  238. },
  239. mounted() {
  240. this.handleInit();
  241. },
  242. };
  243. </script>
  244. <style></style>