mould.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. @redit="(params) => handleVisible('edit', params)"
  18. @delete="handleDelete"
  19. ></simple-table>
  20. <simple-pagination
  21. :page="page"
  22. :total="total"
  23. @change="handleChange"
  24. ></simple-pagination>
  25. </div>
  26. <simple-dialog
  27. title="下发"
  28. width="500px"
  29. @cancel="handleVisible('issue')"
  30. @confirm="handleIssue"
  31. :visible="issue_visible"
  32. >
  33. <el-form label-width="120px" :model="issue_form" ref="issue_ref">
  34. <el-form-item
  35. label="填报事由"
  36. prop="reason"
  37. :rules="{
  38. required: true,
  39. message: '填报事由不能为空',
  40. trigger: 'blur',
  41. }"
  42. >
  43. <el-input v-model="issue_form.reason"></el-input>
  44. </el-form-item>
  45. <el-form-item
  46. label="填报注意事项"
  47. prop="precautions"
  48. :rules="{
  49. required: true,
  50. message: '填报注意事项不能为空',
  51. trigger: 'blur',
  52. }"
  53. >
  54. <el-input v-model="issue_form.precautions"></el-input>
  55. </el-form-item>
  56. <el-form-item
  57. label="截止时间"
  58. prop="endTime"
  59. :rules="{
  60. required: true,
  61. message: '截止时间不能为空',
  62. trigger: 'change',
  63. }"
  64. >
  65. <el-date-picker
  66. v-model="issue_form.endTime"
  67. type="datetime"
  68. format="yyyy-MM-dd HH:00:00"
  69. >
  70. </el-date-picker>
  71. </el-form-item>
  72. </el-form>
  73. </simple-dialog>
  74. <simple-dialog
  75. fullscreen
  76. title="新增模板"
  77. :visible="add_visible"
  78. width="1200px"
  79. @confirm="handleVisible('add')"
  80. @cancel="handleVisible('add')"
  81. >
  82. <el-form inline :model="form" label-width="100px"> </el-form>
  83. <simple-sheet v-if="add_visible" @save="handleSave('add')" type="edit" />
  84. <template v-slot:footer><div></div></template>
  85. </simple-dialog>
  86. <simple-dialog
  87. fullscreen
  88. title="编辑模板"
  89. :visible="edit_visible"
  90. width="1200px"
  91. @confirm="handleVisible('edit')"
  92. @cancel="handleVisible('edit')"
  93. >
  94. <el-form inline :model="form" label-width="100px"> </el-form>
  95. <simple-sheet
  96. v-if="edit_visible"
  97. :id="template_id"
  98. @save="handleSave('edit')"
  99. :status="status"
  100. type="edit"
  101. />
  102. <template v-slot:footer><div></div></template>
  103. </simple-dialog>
  104. <simple-dialog
  105. title="查看模板"
  106. fullscreen
  107. @cancel="handleVisible('template')"
  108. @confirm="handleVisible('template')"
  109. :visible="template_visible"
  110. >
  111. <simple-sheet v-if="template_visible" :id="template_id" />
  112. <template v-slot:footer><div></div></template>
  113. </simple-dialog>
  114. </div>
  115. </template>
  116. <script>
  117. import simpleForm from "./components/form.vue";
  118. import simpleSheet from "./components/sheet.vue";
  119. import simpleTable from "./components/table.vue";
  120. import simpleDialog from "./components/dialog.vue";
  121. import simplePagination from "./components/pagination.vue";
  122. export default {
  123. components: {
  124. simpleTable,
  125. simpleDialog,
  126. simpleForm,
  127. simpleSheet,
  128. simplePagination,
  129. },
  130. data() {
  131. return {
  132. page: 1,
  133. rows: 10,
  134. total: 0,
  135. form: {},
  136. status: "",
  137. add_visible: false,
  138. edit_visible: false,
  139. // template
  140. template_visible: false,
  141. template_id: null,
  142. // issue
  143. issue_visible: false,
  144. issue_form: {
  145. reason: "",
  146. precautions: "",
  147. endTime: "",
  148. },
  149. issue_id: null,
  150. // table
  151. table_loading: false,
  152. table_search: {},
  153. table_form: [
  154. {
  155. label: "模板名称",
  156. props: "templateName",
  157. type: "input",
  158. },
  159. ],
  160. table_list: [],
  161. table_handle: [
  162. {
  163. label: "新增模板",
  164. props: "add",
  165. },
  166. ],
  167. table_handle_row: [
  168. {
  169. label: "下发",
  170. props: "issue",
  171. visible: {
  172. status: ["0"],
  173. },
  174. },
  175. {
  176. label: "编辑",
  177. props: "redit",
  178. visible: {
  179. status: ["2"],
  180. },
  181. },
  182. {
  183. label: "查看",
  184. props: "detail",
  185. },
  186. {
  187. label: "删除",
  188. props: "delete",
  189. visible: {
  190. status: ["0", "2"],
  191. },
  192. popconfirm: true,
  193. },
  194. ],
  195. table_config: [
  196. {
  197. label: "序号",
  198. type: "number",
  199. },
  200. {
  201. label: "模板名称",
  202. props: "templateName",
  203. },
  204. {
  205. label: "配置时间",
  206. props: "updateTime",
  207. },
  208. {
  209. label: "配置人员",
  210. props: "createId",
  211. },
  212. {
  213. label: "模板状态",
  214. props: "status",
  215. type: "dictionary",
  216. dictionary: {
  217. 0: "已创建",
  218. 2: "起草中",
  219. 3: "已下发",
  220. },
  221. },
  222. ],
  223. };
  224. },
  225. methods: {
  226. async handleInit() {
  227. this.table_loading = true;
  228. this.$http({
  229. url: "/market/CMKFileTemplate/CMKFileTemplateList",
  230. method: "post",
  231. headers: {
  232. "Content-Type": "application/json",
  233. },
  234. data: {
  235. page: this.page,
  236. pageSize: this.rows,
  237. templateName: this.table_search.templateName,
  238. },
  239. }).then(({ data: { count, data } }) => {
  240. this.total = count;
  241. this.table_list = data;
  242. this.table_loading = false;
  243. });
  244. },
  245. handleSearch({ templateName }) {
  246. this.table_search = { templateName };
  247. this.handleReset();
  248. this.handleInit();
  249. },
  250. handleAdd() {},
  251. handleChange(page) {
  252. this.page = page;
  253. this.handleInit();
  254. },
  255. handleVisible(props, params) {
  256. switch (props) {
  257. case "add":
  258. this.add_visible = !this.add_visible;
  259. break;
  260. case "edit":
  261. this.edit_visible = !this.edit_visible;
  262. this.template_id = params ? params.id : null;
  263. this.status = params ? params.status : "";
  264. break;
  265. case "template":
  266. this.template_visible = !this.template_visible;
  267. // this.template_id = params?.id;
  268. this.template_id = params ? params.id : null;
  269. break;
  270. case "issue":
  271. this.issue_visible = !this.issue_visible;
  272. this.issue_id = params ? params.id : null;
  273. if (this.issue_visible) {
  274. this.issue_form.reason = params.reason ? params.reason : "";
  275. this.issue_form.precautions = params.precautions
  276. ? params.precautions
  277. : "";
  278. this.issue_form.endTime = params.endTime ? params.endTime : "";
  279. }
  280. break;
  281. }
  282. },
  283. handleReset() {
  284. this.page = 1;
  285. },
  286. handleDelete({ id }) {
  287. this.$http({
  288. url: "/market/CMKFileTemplate/delCMKFileTemplateById",
  289. method: "post",
  290. headers: {
  291. "Content-Type": "application/json",
  292. },
  293. data: {
  294. templateId: id,
  295. },
  296. }).then(() => {
  297. this.$message.success("删除成功");
  298. this.handleInit();
  299. });
  300. },
  301. handleIssue() {
  302. this.$refs["issue_ref"].validate((valid) => {
  303. if (valid) {
  304. this.$http({
  305. url: "/market/CMKFileTemplate/issuedCMKFileTemplateById",
  306. method: "post",
  307. headers: {
  308. "Content-Type": "application/json",
  309. },
  310. data: {
  311. ...this.issue_form,
  312. endTime: this.$formatDate(
  313. this.issue_form.endTime,
  314. "YYYY-MM-DD HH:00:00"
  315. ),
  316. templateId: this.issue_id,
  317. },
  318. }).then(() => {
  319. this.handleVisible("issue");
  320. this.$message.success("下发成功");
  321. this.handleInit();
  322. });
  323. }
  324. });
  325. },
  326. handleSave(type) {
  327. switch (type) {
  328. case "add":
  329. this.handleVisible("add");
  330. break;
  331. case "edit":
  332. this.handleVisible("edit");
  333. break;
  334. }
  335. this.handleInit();
  336. },
  337. },
  338. mounted() {
  339. this.handleInit();
  340. },
  341. };
  342. </script>
  343. <style></style>