detailsPage.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div>
  3. <div class="borderless">
  4. <div class="customer-head">
  5. <div class="customer-back">
  6. <el-button
  7. type="danger"
  8. style="border: none;background: none;color: red"
  9. icon="el-icon-arrow-left"
  10. @click="backToList"
  11. >返回列表
  12. </el-button>
  13. </div>
  14. <el-button
  15. class="el-button--small-yh add-customer-btn"
  16. type="primary"
  17. size="small"
  18. @click="editCustomer"
  19. >保存数据
  20. </el-button>
  21. </div>
  22. <containerTitle
  23. title="基础资料"
  24. style="margin-top: 60px"
  25. ></containerTitle>
  26. <basic-container>
  27. <avue-form
  28. ref="form"
  29. class="trading-form"
  30. v-model="form"
  31. :option="option"
  32. />
  33. </basic-container>
  34. <containerTitle title="事业编考试的记录"></containerTitle>
  35. <basic-container>
  36. <avue-crud
  37. ref="crud"
  38. :option="option2"
  39. :data="dataList"
  40. :table-loading="loading"
  41. @saveColumn="saveColumn"
  42. :cell-style="cellStyle"
  43. >
  44. <template slot="menuLeft">
  45. <el-button
  46. type="primary"
  47. @click="dataList.push({ $cellEdit: true })"
  48. size="small"
  49. :disabled="detailData.status == 1"
  50. >新增
  51. </el-button>
  52. </template>
  53. <template slot="menu" slot-scope="{ row, index }">
  54. <el-button
  55. size="small"
  56. type="text"
  57. @click="rowCell(row, index)"
  58. :disabled="detailData.status == 1"
  59. >编辑</el-button
  60. >
  61. <el-button
  62. size="small"
  63. type="text"
  64. @click="rowDel(row, index)"
  65. :disabled="detailData.status == 1"
  66. >删除</el-button
  67. >
  68. </template>
  69. </avue-crud>
  70. </basic-container>
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import { detail, submit, delItem } from "@/api/basicData/facultyManagement";
  76. export default {
  77. name: "index",
  78. data() {
  79. return {
  80. form: {},
  81. dataList: [],
  82. option: {
  83. menuBtn: false,
  84. labelWidth: 100,
  85. column: [
  86. {
  87. label: "姓名",
  88. prop: "cname",
  89. rules: [
  90. {
  91. required: true,
  92. message: "",
  93. trigger: "blur"
  94. }
  95. ],
  96. span: 6
  97. },
  98. {
  99. label: "身份证",
  100. prop: "idNumber",
  101. rules: [
  102. {
  103. required: true,
  104. message: "",
  105. trigger: "blur"
  106. }
  107. ],
  108. span: 6
  109. },
  110. {
  111. label: "性别",
  112. prop: "gender",
  113. type: "select",
  114. dicUrl: "/api/blade-system/dict-biz/dictionary?code=sex",
  115. props: {
  116. label: "dictValue",
  117. value: "dictValue"
  118. },
  119. span: 6
  120. },
  121. {
  122. label: "联系电话",
  123. prop: "phone",
  124. span: 6
  125. },
  126. {
  127. label: "学历",
  128. prop: "code",
  129. type: "select",
  130. dicUrl: "/api/blade-system/dict-biz/dictionary?code=marital_status",
  131. props: {
  132. label: "dictValue",
  133. value: "dictValue"
  134. },
  135. span: 6
  136. },
  137. {
  138. label: "入职时间",
  139. prop: "joiningDate",
  140. type: "date",
  141. valueFormat: "yyyy-MM-dd",
  142. span: 6
  143. },
  144. {
  145. label: "转正时间",
  146. prop: "birthdate",
  147. type: "date",
  148. valueFormat: "yyyy-MM-dd",
  149. span: 6
  150. },
  151. {
  152. label: "校龄开始日期",
  153. prop: "schoolAgeSalaryDate",
  154. type: "date",
  155. valueFormat: "yyyy-MM-dd",
  156. span: 6
  157. },
  158. {
  159. label: "校龄",
  160. prop: "schoolAge",
  161. type: "number",
  162. controls: false,
  163. precision:0,
  164. minRows: 0,
  165. span: 6
  166. },
  167. {
  168. label: "所在部门",
  169. prop: "inSection",
  170. type: "select",
  171. dicUrl: "/api/blade-system/dict-biz/dictionary?code=in_section",
  172. props: {
  173. label: "dictValue",
  174. value: "dictValue"
  175. },
  176. rules: [
  177. {
  178. required: true,
  179. message: "",
  180. trigger: "blur"
  181. }
  182. ],
  183. span: 6
  184. },
  185. {
  186. label: "是否班主任",
  187. prop: "doubleTeachers",
  188. type: "radio",
  189. dataType: "string",
  190. dicUrl: "/api/blade-system/dict-biz/dictionary?code=TF_status",
  191. props: {
  192. label: "dictValue",
  193. value: "dictValue"
  194. },
  195. span: 6
  196. },
  197. {
  198. label: "职务",
  199. prop: "compileCategory",
  200. type: "select",
  201. dicUrl:
  202. "/api/blade-system/dict-biz/dictionary?code=compile_category",
  203. props: {
  204. label: "dictValue",
  205. value: "dictValue"
  206. },
  207. span: 6
  208. },
  209. {
  210. label: "备注",
  211. prop: "remarks",
  212. type: "textarea",
  213. span: 24,
  214. minRows: 2
  215. }
  216. ]
  217. },
  218. option2: {
  219. align: "center",
  220. addBtn: false,
  221. refreshBtn: false,
  222. editBtn: false,
  223. delBtn: false,
  224. border: true,
  225. menuWidth: 120,
  226. column: [
  227. {
  228. label: "考试日期",
  229. prop: "birthdate",
  230. type: "date",
  231. valueFormat: "yyyy-MM-dd",
  232. cell: true
  233. },
  234. {
  235. label: "备注",
  236. prop: "remarks",
  237. cell: true
  238. }
  239. ]
  240. }
  241. };
  242. },
  243. props: {
  244. detailData: {
  245. type: Object
  246. }
  247. },
  248. created() {
  249. if (this.detailData.id) {
  250. this.getDetail(this.detailData.id);
  251. }
  252. if (this.detailData.status == 1) {
  253. this.option.disabled = true;
  254. }
  255. },
  256. methods: {
  257. cellStyle() {
  258. return "padding:0;height:40px;";
  259. },
  260. getDetail(id) {
  261. detail(id)
  262. .then(res => {
  263. this.form = res.data.data;
  264. this.dataList = res.data.data.causeList;
  265. })
  266. .finally(() => {
  267. // this.loading = false;
  268. // this.showBut = true;
  269. // this.pageLoading = false;
  270. });
  271. },
  272. rowCell(row, index) {
  273. if (row.$cellEdit == true) {
  274. this.$set(row, "$cellEdit", false);
  275. } else {
  276. this.$set(row, "$cellEdit", true);
  277. }
  278. },
  279. rowDel(row, index) {
  280. this.$confirm("确定删除数据?", {
  281. confirmButtonText: "确定",
  282. cancelButtonText: "取消",
  283. type: "warning"
  284. }).then(() => {
  285. if (row.id) {
  286. delItem(row.id).then(res => {
  287. this.$message({
  288. type: "success",
  289. message: "删除成功!"
  290. });
  291. this.dataList.splice(index, 1);
  292. });
  293. } else {
  294. this.$message({
  295. type: "success",
  296. message: "删除成功!"
  297. });
  298. this.dataList.splice(index, 1);
  299. }
  300. });
  301. },
  302. //修改提交触发
  303. editCustomer() {
  304. this.$refs["form"].validate((valid, done) => {
  305. done();
  306. if (valid) {
  307. submit({ ...this.form, causeList: this.dataList })
  308. .then(res => {
  309. this.$message.success("保存成功");
  310. this.form = res.data.data;
  311. this.dataList = res.data.data.causeList;
  312. })
  313. .finally(() => {});
  314. } else {
  315. return false;
  316. }
  317. });
  318. },
  319. //返回列表
  320. backToList() {
  321. this.$emit("goBack");
  322. }
  323. }
  324. };
  325. </script>
  326. <style lang="scss" scoped>
  327. .trading-form ::v-deep .el-form-item {
  328. margin-bottom: 8px !important;
  329. }
  330. ::v-deep .el-form-item__error {
  331. display: none !important;
  332. }
  333. .img-form ::v-deep .el-form-item {
  334. height: 150px;
  335. line-height: 150px;
  336. margin-bottom: 8px !important;
  337. }
  338. .img-form ::v-deep .avue-upload__icon {
  339. font-size: 20px;
  340. width: 150px;
  341. height: 150px;
  342. line-height: 150px;
  343. }
  344. </style>