dialog.edit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <div class="rule-type">
  3. <el-dialog
  4. :title="id ? '编辑履职计划' : '新增履职计划'"
  5. :visible.sync="isShow"
  6. width="1500px"
  7. >
  8. <div class="page-body">
  9. <el-form
  10. :model="formData"
  11. :rules="formDataRules"
  12. size="small"
  13. ref="form"
  14. label-position="right"
  15. label-width="130px"
  16. label-prefix=":"
  17. >
  18. <el-row>
  19. <el-col :span="6">
  20. <el-form-item prop="planName" label="计划名称:">
  21. <el-input
  22. v-model="formData.planName"
  23. :maxlength="50"
  24. name="planName"
  25. placeholder="请输入"
  26. clearable
  27. />
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="6">
  31. <el-form-item prop="planType" label="计划类型:">
  32. <el-select
  33. label="计划类型"
  34. v-model="formData.planType"
  35. placeholder="请选择计划类型"
  36. clearable
  37. >
  38. <el-option
  39. v-for="dict in dict.type.resumption_plan_type"
  40. :key="dict.value"
  41. :label="dict.label"
  42. :value="dict.value"
  43. >
  44. </el-option>
  45. </el-select>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="6">
  49. <el-form-item prop="planCycle" label="履职周期:">
  50. <el-select
  51. prop="planCycle"
  52. label="履职周期"
  53. v-model="formData.planCycle"
  54. placeholder="请选择履职周期"
  55. clearable
  56. >
  57. <el-option
  58. v-for="item in dict.type.resumption_plan_cycle"
  59. :key="item.value"
  60. :label="item.label"
  61. :value="item.value"
  62. >
  63. </el-option>
  64. </el-select>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span="6">
  68. <el-form-item prop="planStatus" label="计划状态:">
  69. <el-select
  70. prop="planStatus"
  71. label="计划状态"
  72. v-model="formData.planStatus"
  73. placeholder="请选择计划状态"
  74. clearable
  75. >
  76. <el-option
  77. v-for="item in dict.type.resumption_plan_status"
  78. :key="item.value"
  79. :label="item.label"
  80. :value="item.value"
  81. >
  82. </el-option>
  83. </el-select>
  84. </el-form-item>
  85. </el-col>
  86. </el-row>
  87. <el-row>
  88. <el-col :span="6">
  89. <el-form-item prop="execOrgType" label="履职机构类型:">
  90. <el-select
  91. label="履职机构类型"
  92. v-model="formData.execOrgType"
  93. placeholder="请选择履职机构类型"
  94. clearable
  95. >
  96. <el-option
  97. v-for="item in dict.type.sys_org_type"
  98. :key="item.value"
  99. :label="item.label"
  100. :value="item.value"
  101. >
  102. </el-option>
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="6">
  107. <el-form-item prop="roleList" label="履职角色:">
  108. <el-select
  109. @visible-change="getRolesByOrg"
  110. label="履职角色"
  111. v-model="formData.resumptionRole"
  112. placeholder="请选择履职角色"
  113. multiple
  114. filterable
  115. @change="handleRolesChange"
  116. >
  117. <el-option
  118. v-for="item in resumptionRoles"
  119. :key="item.index"
  120. :label="item.roleName"
  121. :value="item.id"
  122. >
  123. </el-option>
  124. </el-select>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="6">
  128. <el-form-item prop="planExec" label="履职时间:">
  129. <el-select
  130. label="履职时间"
  131. v-model="formData.planExec"
  132. placeholder="请选择履职时间"
  133. clearable
  134. >
  135. <el-option
  136. v-for="item in dict.type.resumption_plan_exec"
  137. :key="item.value"
  138. :label="item.label"
  139. :value="item.value"
  140. >
  141. </el-option>
  142. </el-select>
  143. </el-form-item>
  144. </el-col>
  145. <el-col :span="6">
  146. <el-form-item prop="count" label="履职次数:">
  147. <el-input-number
  148. style="margin-left: 10px"
  149. v-model="formData.count"
  150. controls-position="right"
  151. @change="handleChange"
  152. :min="1"
  153. :max="10"
  154. ></el-input-number>
  155. </el-form-item>
  156. </el-col>
  157. </el-row>
  158. <el-form-item prop="description" label="备注">
  159. <el-input
  160. v-model="formData.description"
  161. :maxlength="255"
  162. clearable
  163. />
  164. </el-form-item>
  165. </el-form>
  166. <el-button>新增履职内容</el-button>
  167. <el-table :data="tableData" style="width: 100%">
  168. <el-table-column
  169. :prop="propItem.prop"
  170. :label="propItem.label"
  171. v-for="propItem in propList"
  172. :key="propItem.prop"
  173. >
  174. <template v-slot="{ row }">
  175. <span v-if="!propItem.component">{{ row[propItem.prop] }}</span>
  176. <component
  177. v-else
  178. v-bind:is="propItem.component"
  179. size="mini"
  180. type="text"
  181. icon="el-icon-edit"
  182. @click="removeRow(index)"
  183. >删除</component
  184. >
  185. </template>
  186. </el-table-column>
  187. </el-table>
  188. </div>
  189. <div slot="footer" class="dialog-footer">
  190. <el-button @click="onHide">取消</el-button>
  191. <el-button type="primary" @click="onSubmit">确定</el-button>
  192. </div>
  193. </el-dialog>
  194. </div>
  195. </template>
  196. <script>
  197. import { mapGetters } from "vuex";
  198. import * as api from "@/api/resumption/plan";
  199. import { statusOptions } from "./../../commonOption";
  200. import { listRole } from "@/api/system/role";
  201. export default {
  202. dicts: [
  203. "resumption_plan_type",
  204. "resumption_plan_cycle",
  205. "resumption_org_type",
  206. "resumption_plan_status",
  207. "sys_org_type",
  208. "resumption_plan_exec",
  209. ],
  210. data() {
  211. // const params = this.$route.params;
  212. // let o1=options;
  213. // let o=statusOptions;
  214. // debugger
  215. return {
  216. selectedValues: [],
  217. resumptionRoles: [],
  218. planName: null,
  219. planType: null,
  220. planCycle: null,
  221. planStatus: null,
  222. execOrgType: null,
  223. roleNames: null,
  224. planExec: null,
  225. count: 0,
  226. description: null,
  227. propItem: "",
  228. propList: [
  229. {
  230. label: "是否扫描",
  231. prop: "pointScan",
  232. },
  233. {
  234. label: "必须履职",
  235. prop: "required",
  236. },
  237. {
  238. label: "履职内容库",
  239. prop: "pointName",
  240. },
  241. {
  242. label: "履职项",
  243. prop: "itemName",
  244. },
  245. {
  246. label: "履职内容",
  247. prop: "itemDesc",
  248. },
  249. {
  250. label: "履职区域",
  251. prop: "areaName",
  252. },
  253. {
  254. label: "操作",
  255. prop: "lc-component",
  256. component: "el-button",
  257. },
  258. ],
  259. row: "",
  260. tableData: [],
  261. id: null,
  262. isShow: false,
  263. formData: this.reset(),
  264. formDataRules: {
  265. name: [{ required: true, message: "请输入履职内容库名称" }],
  266. type: [{ required: true, message: "请选择履职类型" }],
  267. orgType: [{ required: true, message: "请选择履职机构类型" }],
  268. status: [{ required: true, message: "请选择状态" }],
  269. },
  270. statusOptions: statusOptions,
  271. };
  272. },
  273. props: {
  274. orgTypeOptions: {
  275. type: Array,
  276. },
  277. ruleTypeOptions: {
  278. type: Array,
  279. },
  280. },
  281. watch: {},
  282. computed: {
  283. ...mapGetters(['orgId',"orgName"]),
  284. },
  285. methods: {
  286. reset() {
  287. return {
  288. planName: null,
  289. planType: null,
  290. planCycle: null,
  291. planStatus: null,
  292. execOrgType: null,
  293. roleNames: null,
  294. count: null,
  295. description: null,
  296. tableData: null,
  297. itemList: null,
  298. planExec: null,
  299. count:0,
  300. note:null,
  301. planCreateOrgId:null,
  302. planCreateOrgName:null,
  303. };
  304. },
  305. getRolesByOrg() {
  306. let params = {
  307. orgType: this.formData.execOrgType,
  308. };
  309. listRole(params).then((res) => {
  310. // console.info(res);
  311. this.resumptionRoles = res.rows;
  312. });
  313. },
  314. handleChange(value) {
  315. console.log(value);
  316. this.count = value;
  317. },
  318. async refresh(id, other) {
  319. this.formData = id ? (await api.get(id)).data : this.reset(other);
  320. },
  321. async show(id, other = {}) {
  322. this.id = id;
  323. this.tableData = null;
  324. this.formData.itemList = null;
  325. await this.refresh(id, other);
  326. console.log(id);
  327. if (id !== undefined) {
  328. await api.get(id).then((res) => {
  329. console.log(res);
  330. this.tableData = res.data.itemList;
  331. });
  332. }
  333. this.isShow = true;
  334. },
  335. removeRow(index) {
  336. this.tableData.splice(index, 1);
  337. },
  338. // 事件
  339. onHide() {
  340. this.isShow = false;
  341. },
  342. onSubmit() {
  343. this.$refs.form.validate(async (isValidate) => {
  344. this.formData.note = this.formData.description;
  345. this.formData.planCreateOrgId=this.orgId;
  346. this.formData.planCreateOrgName=this.orgName;
  347. if (!isValidate) return;
  348. this.formData.itemList = this.tableData==null?[]:this.tableData;
  349. this.formData.roleList = this.selectedValues;
  350. await api.update(this.formData);
  351. this.$emit("success");
  352. this.onHide();
  353. });
  354. },
  355. handleRolesChange(val){
  356. this.selectedValues = val.toString().split(',');
  357. },
  358. // 事件
  359. //apimark//
  360. },
  361. mounted() {},
  362. components: {},
  363. };
  364. </script>
  365. <style lang="scss" scoped>
  366. .brand_info {
  367. .el-form {
  368. width: 600px;
  369. padding-top: 40px;
  370. }
  371. }
  372. </style>