mould.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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:00:00"
  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. table_list: [],
  163. table_handle: [
  164. {
  165. label: "新增模板",
  166. props: "add",
  167. },
  168. ],
  169. table_handle_row: [
  170. {
  171. label: "下发",
  172. props: "issue",
  173. visible: {
  174. status: ["0", "3"],
  175. },
  176. },
  177. {
  178. label: "编辑",
  179. props: "redit",
  180. visible: {
  181. status: ["2", "3"],
  182. },
  183. },
  184. {
  185. label: "查看",
  186. props: "detail",
  187. },
  188. {
  189. label: "删除",
  190. props: "delete",
  191. visible: {
  192. status: ["0", "2"],
  193. },
  194. popconfirm: true,
  195. },
  196. ],
  197. table_config: [
  198. {
  199. label: "序号",
  200. type: "number",
  201. },
  202. {
  203. label: "模板名称",
  204. props: "templateName",
  205. },
  206. {
  207. label: "模板类型",
  208. props: "templateType",
  209. },
  210. {
  211. label: "配置时间",
  212. props: "updateTime",
  213. },
  214. {
  215. label: "配置人员",
  216. props: "createId",
  217. },
  218. {
  219. label: "模板状态",
  220. props: "status",
  221. type: "dictionary",
  222. dictionary: {
  223. 0: "已创建",
  224. 2: "起草中",
  225. 3: "已下发",
  226. },
  227. },
  228. {
  229. label: "是否为督办",
  230. props: "superviseFlag",
  231. type: "dictionary",
  232. dictionary: {
  233. null: "否",
  234. 0: "否",
  235. 1: "是",
  236. },
  237. },
  238. ],
  239. };
  240. },
  241. methods: {
  242. async handleInit() {
  243. this.table_loading = true;
  244. this.$http({
  245. url: "/market/CMKFileTemplate/CMKFileTemplateList",
  246. method: "post",
  247. headers: {
  248. "Content-Type": "application/json",
  249. },
  250. data: {
  251. page: this.page,
  252. pageSize: this.rows,
  253. templateName: this.table_search.templateName,
  254. },
  255. }).then(({ data: { count, data } }) => {
  256. this.total = count;
  257. this.table_list = data;
  258. this.table_loading = false;
  259. });
  260. },
  261. handleSearch({ templateName }) {
  262. this.table_search = { templateName };
  263. this.handleReset();
  264. this.handleInit();
  265. },
  266. handleAdd() {},
  267. handleChange(page) {
  268. this.page = page;
  269. this.handleInit();
  270. },
  271. handleVisible(props, params) {
  272. switch (props) {
  273. case "add":
  274. this.add_visible = !this.add_visible;
  275. break;
  276. case "edit":
  277. this.edit_visible = !this.edit_visible;
  278. this.template_id = params ? params.id : null;
  279. this.status = params ? params.status : "";
  280. break;
  281. case "template":
  282. this.template_visible = !this.template_visible;
  283. // this.template_id = params?.id;
  284. this.template_id = params ? params.id : null;
  285. break;
  286. case "issue":
  287. this.superviseFlag = params ? params.superviseFlag : "";
  288. this.issue_visible = !this.issue_visible;
  289. this.issue_id = params ? params.id : null;
  290. if (this.issue_visible) {
  291. this.issue_form.reason = params.reason ? params.reason : "";
  292. this.issue_form.precautions = params.precautions
  293. ? params.precautions
  294. : "";
  295. this.issue_form.endTime = params.endTime ? params.endTime : "";
  296. }
  297. break;
  298. }
  299. },
  300. handleReset() {
  301. this.page = 1;
  302. },
  303. handleDelete({ id }) {
  304. this.$http({
  305. url: "/market/CMKFileTemplate/delCMKFileTemplateById",
  306. method: "post",
  307. headers: {
  308. "Content-Type": "application/json",
  309. },
  310. data: {
  311. templateId: id,
  312. },
  313. }).then(() => {
  314. this.$message.success("删除成功");
  315. this.handleInit();
  316. });
  317. },
  318. handleIssue() {
  319. this.$refs["issue_ref"].validate((valid) => {
  320. if (valid) {
  321. let url = "";
  322. let reqdata = {};
  323. if (this.superviseFlag === "1") {
  324. // 调用督办的下发
  325. console.log("这里调用督办的下发");
  326. url = "/market/CMKFileTemplate/issuedCMKFileTemplateBySuperviseId";
  327. reqdata = {
  328. ...this.issue_form,
  329. templateId: this.issue_id,
  330. };
  331. } else {
  332. // 调用普通的下发
  333. url = "/market/CMKFileTemplate/issuedCMKFileTemplateById";
  334. reqdata = {
  335. ...this.issue_form,
  336. endTime: this.$formatDate(
  337. this.issue_form.endTime,
  338. "YYYY-MM-DD HH:00:00"
  339. ),
  340. templateId: this.issue_id,
  341. };
  342. }
  343. this.$http({
  344. url: url,
  345. method: "post",
  346. headers: {
  347. "Content-Type": "application/json",
  348. },
  349. data: reqdata,
  350. }).then(() => {
  351. this.handleVisible("issue");
  352. this.$message.success("下发成功");
  353. this.handleInit();
  354. });
  355. }
  356. });
  357. },
  358. handleSave(type) {
  359. switch (type) {
  360. case "add":
  361. this.handleVisible("add");
  362. break;
  363. case "edit":
  364. this.handleVisible("edit");
  365. break;
  366. }
  367. this.handleInit();
  368. },
  369. },
  370. mounted() {
  371. this.handleInit();
  372. },
  373. };
  374. </script>
  375. <style></style>