mould.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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. v-if="superviseFlag !== '1'"
  60. :rules="{
  61. required: true,
  62. message: '截止时间不能为空',
  63. trigger: 'change',
  64. }"
  65. >
  66. <el-date-picker
  67. v-model="issue_form.endTime"
  68. type="datetime"
  69. format="yyyy-MM-dd HH:mm:ss"
  70. >
  71. </el-date-picker>
  72. </el-form-item>
  73. </el-form>
  74. </simple-dialog>
  75. <simple-dialog
  76. fullscreen
  77. title="新增模板"
  78. :visible="add_visible"
  79. width="1200px"
  80. @confirm="handleVisible('add')"
  81. @cancel="handleVisible('add')"
  82. >
  83. <el-form inline :model="form" label-width="100px"> </el-form>
  84. <simple-sheet v-if="add_visible" @save="handleSave('add')" type="edit" />
  85. <template v-slot:footer><div></div></template>
  86. </simple-dialog>
  87. <simple-dialog
  88. fullscreen
  89. title="编辑模板"
  90. :visible="edit_visible"
  91. width="1200px"
  92. @confirm="handleVisible('edit')"
  93. @cancel="handleVisible('edit')"
  94. >
  95. <el-form inline :model="form" label-width="100px"> </el-form>
  96. <simple-sheet
  97. v-if="edit_visible"
  98. :id="template_id"
  99. @save="handleSave('edit')"
  100. :status="status"
  101. type="edit"
  102. />
  103. <template v-slot:footer><div></div></template>
  104. </simple-dialog>
  105. <simple-dialog
  106. title="查看模板"
  107. fullscreen
  108. @cancel="handleVisible('template')"
  109. @confirm="handleVisible('template')"
  110. :visible="template_visible"
  111. >
  112. <simple-sheet v-if="template_visible" :id="template_id" />
  113. <template v-slot:footer><div></div></template>
  114. </simple-dialog>
  115. </div>
  116. </template>
  117. <script>
  118. import simpleForm from "./components/form.vue";
  119. import simpleSheet from "./components/sheet.vue";
  120. import simpleTable from "./components/table.vue";
  121. import simpleDialog from "./components/dialog.vue";
  122. import simplePagination from "./components/pagination.vue";
  123. export default {
  124. components: {
  125. simpleTable,
  126. simpleDialog,
  127. simpleForm,
  128. simpleSheet,
  129. simplePagination,
  130. },
  131. data() {
  132. return {
  133. page: 1,
  134. rows: 10,
  135. total: 0,
  136. form: {},
  137. status: "",
  138. add_visible: false,
  139. edit_visible: false,
  140. // template
  141. template_visible: false,
  142. template_id: null,
  143. // issue
  144. issue_visible: false,
  145. issue_form: {
  146. reason: "",
  147. precautions: "",
  148. endTime: "",
  149. },
  150. superviseFlag: "",
  151. issue_id: null,
  152. // table
  153. table_loading: false,
  154. table_search: {},
  155. table_form: [
  156. {
  157. label: "模板名称",
  158. props: "templateName",
  159. type: "input",
  160. },
  161. {
  162. label: "模板类型",
  163. props: "templateType",
  164. type: "input",
  165. },
  166. ],
  167. table_list: [],
  168. table_handle: [
  169. {
  170. label: "新增模板",
  171. props: "add",
  172. },
  173. ],
  174. table_handle_row: [
  175. {
  176. label: "下发",
  177. props: "issue",
  178. visible: {
  179. status: ["0"],
  180. flag: "or",
  181. superviseFlag: ["0"],
  182. },
  183. },
  184. {
  185. label: "编辑",
  186. props: "redit",
  187. visible: {
  188. superviseFlag: ["1"],
  189. flag: "or",
  190. status: ["2", "3"],
  191. },
  192. },
  193. {
  194. label: "查看",
  195. props: "detail",
  196. },
  197. {
  198. label: "删除",
  199. props: "delete",
  200. visible: {
  201. status: ["0", "3"],
  202. },
  203. popconfirm: true,
  204. },
  205. ],
  206. table_config: [
  207. {
  208. label: "序号",
  209. type: "number",
  210. },
  211. {
  212. label: "模板名称",
  213. props: "templateName",
  214. },
  215. {
  216. label: "模板类型",
  217. props: "templateType",
  218. },
  219. {
  220. label: "配置时间",
  221. props: "updateTime",
  222. },
  223. {
  224. label: "配置人员",
  225. props: "createId",
  226. },
  227. {
  228. label: "模板状态",
  229. props: "status",
  230. type: "dictionary",
  231. dictionary: {
  232. 0: "已创建",
  233. 2: "起草中",
  234. 3: "已下发",
  235. },
  236. },
  237. {
  238. label: "是否为督办",
  239. props: "superviseFlag",
  240. type: "dictionary",
  241. dictionary: {
  242. null: "否",
  243. 0: "否",
  244. 1: "是",
  245. },
  246. },
  247. ],
  248. };
  249. },
  250. methods: {
  251. async handleInit() {
  252. this.table_loading = true;
  253. this.$http({
  254. url: "/market/CMKFileTemplate/CMKFileTemplateList",
  255. method: "post",
  256. headers: {
  257. "Content-Type": "application/json",
  258. },
  259. data: {
  260. page: this.page,
  261. pageSize: this.rows,
  262. ...this.table_search,
  263. },
  264. }).then(({ data: { count, data } }) => {
  265. this.total = count;
  266. this.table_list = data;
  267. this.table_loading = false;
  268. });
  269. },
  270. handleSearch(data) {
  271. console.log(data, "data");
  272. this.table_search = data;
  273. this.handleReset();
  274. this.handleInit();
  275. },
  276. handleAdd() {},
  277. handleChange(page) {
  278. this.page = page;
  279. this.handleInit();
  280. },
  281. handleVisible(props, params) {
  282. switch (props) {
  283. case "add":
  284. this.add_visible = !this.add_visible;
  285. break;
  286. case "edit":
  287. this.edit_visible = !this.edit_visible;
  288. this.template_id = params ? params.id : null;
  289. this.status = params ? params.status : "";
  290. break;
  291. case "template":
  292. this.template_visible = !this.template_visible;
  293. // this.template_id = params?.id;
  294. this.template_id = params ? params.id : null;
  295. break;
  296. case "issue":
  297. this.superviseFlag = params ? params.superviseFlag : "";
  298. this.issue_visible = !this.issue_visible;
  299. this.issue_id = params ? params.id : null;
  300. if (this.issue_visible) {
  301. this.issue_form.reason = params.reason ? params.reason : "";
  302. this.issue_form.precautions = params.precautions
  303. ? params.precautions
  304. : "";
  305. this.issue_form.endTime = params.endTime ? params.endTime : "";
  306. }
  307. break;
  308. }
  309. },
  310. handleReset() {
  311. this.page = 1;
  312. },
  313. handleDelete({ id }) {
  314. this.$http({
  315. url: "/market/CMKFileTemplate/delCMKFileTemplateById",
  316. method: "post",
  317. headers: {
  318. "Content-Type": "application/json",
  319. },
  320. data: {
  321. templateId: id,
  322. },
  323. }).then(() => {
  324. this.$message.success("删除成功");
  325. this.handleInit();
  326. });
  327. },
  328. handleIssue() {
  329. this.$refs["issue_ref"].validate((valid) => {
  330. if (valid) {
  331. let url = "";
  332. let reqdata = {};
  333. if (this.superviseFlag === "1") {
  334. // 调用督办的下发
  335. console.log("这里调用督办的下发");
  336. url = "/market/CMKFileTemplate/issuedCMKFileTemplateBySuperviseId";
  337. reqdata = {
  338. ...this.issue_form,
  339. templateId: this.issue_id,
  340. };
  341. } else {
  342. // 调用普通的下发
  343. url = "/market/CMKFileTemplate/issuedCMKFileTemplateById";
  344. reqdata = {
  345. ...this.issue_form,
  346. endTime: this.$formatDate(
  347. this.issue_form.endTime,
  348. "YYYY-MM-DD HH:mm:ss"
  349. ),
  350. templateId: this.issue_id,
  351. };
  352. if (this.issue_form.endTime) {
  353. if (this.issue_form.endTime.getTime() < new Date().getTime()) {
  354. this.$message.error("截止时间不能小于当前时间");
  355. return false;
  356. }
  357. }
  358. }
  359. this.$http({
  360. url: url,
  361. method: "post",
  362. headers: {
  363. "Content-Type": "application/json",
  364. },
  365. data: reqdata,
  366. }).then(() => {
  367. this.handleVisible("issue");
  368. this.$message.success("下发成功");
  369. this.handleInit();
  370. });
  371. }
  372. });
  373. },
  374. handleSave(type) {
  375. switch (type) {
  376. case "add":
  377. this.handleVisible("add");
  378. break;
  379. case "edit":
  380. this.handleVisible("edit");
  381. break;
  382. }
  383. this.handleInit();
  384. },
  385. },
  386. mounted() {
  387. this.handleInit();
  388. },
  389. };
  390. </script>
  391. <style></style>