submit_add.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div>
  3. <el-drawer
  4. title="创建用户"
  5. :visible.sync="drawer"
  6. size="90%"
  7. direction="rtl"
  8. append-to-body
  9. :wrapper-closable="false"
  10. >
  11. <div class="drawer__panel">
  12. <el-row :gutter="16">
  13. <el-col :span="13">
  14. <div class="container normal-panel normal-margin">
  15. <p class="normal-title normal-margin">提报设置</p>
  16. <el-row :gutter="16">
  17. <el-form ref="form" :model="form" :rules="rules" label-width="80px" label-position="left" size="small">
  18. <el-col :span="24">
  19. <el-form-item label="标题" prop="title">
  20. <el-input v-model="form.title" placeholder="标题"></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="8">
  24. <el-form-item label="提报类型" prop="onceonly">
  25. <el-select v-model="form.onceonly" placeholder="选择提报类型">
  26. <el-option label="一事一报" :value="1"></el-option>
  27. <el-option label="一事多报" :value="0"></el-option>
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="8">
  32. <el-form-item label="生效日期" prop="begdate">
  33. <el-date-picker style="width:100%" v-model="form.begdate" value-format="yyyy-MM-dd" type="date"
  34. placeholder="生效日期">
  35. </el-date-picker>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="8">
  39. <el-form-item label="截止日期" prop="enddate">
  40. <el-date-picker style="width:100%" v-model="form.enddate" value-format="yyyy-MM-dd" type="date"
  41. placeholder="截止日期">
  42. </el-date-picker>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="24">
  46. <el-form-item label="提报要求" prop="notes">
  47. <el-input v-model="form.notes" placeholder="提报要求"></el-input>
  48. </el-form-item>
  49. </el-col>
  50. <el-col :span="24">
  51. <el-form-item label="提报形式" prop="type">
  52. <el-checkbox-group v-model="form.type" @change="onCheckboxChange">
  53. <el-checkbox label="附件提报" name="isattrequired"></el-checkbox>
  54. <el-checkbox label="文字提报" name="istextrequired"></el-checkbox>
  55. </el-checkbox-group>
  56. <!-- &lt;!&ndash; <el-checkbox :true-label="1" :false-label="0" v-model="form.isattrequired">附件提报</el-checkbox>
  57. <el-checkbox :true-label="1" :false-label="0" v-model="form.istextrequired">文字提报</el-checkbox> &ndash;&gt;-->
  58. </el-form-item>
  59. </el-col>
  60. </el-form>
  61. </el-row>
  62. </div>
  63. <div class="container normal-panel normal-margin">
  64. <attachmentList :attinfos="form.attinfos" @onSuccess="querySubmitMain" :onlyread="store.state.pageOnlyRead">
  65. <upload slot="upload" :folderid="folderid"
  66. :bindData="{ ownertable: 'sat_submiteditmodel', ownerid: form.sat_submiteditmodelid, usetype: 'default' }"
  67. @onSuccess="onSubmit()"></upload>
  68. </attachmentList>
  69. </div>
  70. </el-col>
  71. <el-col :span="11">
  72. <scopeOfauth :defaultData="defaultData" appidname="sat_submiteditmodelid" obiectName="sat_submiteditmodel" :dataid="$route.query.id"
  73. @onChecked="onChecked"></scopeOfauth>
  74. </el-col>
  75. </el-row>
  76. </div>
  77. <div class="fixed__btn__panel">
  78. <el-button size="small" @click="onclose" class="normal-btn-width">取 消</el-button>
  79. <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
  80. </div>
  81. </el-drawer>
  82. <!-- <div class="container normal-panel normal-margin">
  83. <el-button type="warning" size="small" icon="el-icon-s-claim" @click="onSubmit((res)=>tool.showMessage(res))">保 存
  84. </el-button>
  85. </div>
  86. <div style="overflow-x:hidden">
  87. <el-row :gutter="16">
  88. <el-col :span="13">
  89. <div class="container normal-panel normal-margin">
  90. <p class="normal-title normal-margin">提报设置</p>
  91. <el-row :gutter="16">
  92. <el-form ref="form" :model="form" :rules="rules" label-width="80px" label-position="left" size="small">
  93. <el-col :span="24">
  94. <el-form-item label="标题" prop="title">
  95. <el-input v-model="form.title" placeholder="标题"></el-input>
  96. </el-form-item>
  97. </el-col>
  98. <el-col :span="8">
  99. <el-form-item label="提报类型" prop="onceonly">
  100. <el-select v-model="form.onceonly" placeholder="选择提报类型">
  101. <el-option label="一事一报" :value="1"></el-option>
  102. <el-option label="一事多报" :value="0"></el-option>
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="8">
  107. <el-form-item label="生效日期" prop="begdate">
  108. <el-date-picker style="width:100%" v-model="form.begdate" value-format="yyyy-MM-dd" type="date"
  109. placeholder="生效日期">
  110. </el-date-picker>
  111. </el-form-item>
  112. </el-col>
  113. <el-col :span="8">
  114. <el-form-item label="截止日期" prop="enddate">
  115. <el-date-picker style="width:100%" v-model="form.enddate" value-format="yyyy-MM-dd" type="date"
  116. placeholder="截止日期">
  117. </el-date-picker>
  118. </el-form-item>
  119. </el-col>
  120. <el-col :span="24">
  121. <el-form-item label="提报要求" prop="notes">
  122. <el-input v-model="form.notes" placeholder="提报要求"></el-input>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="24">
  126. <el-form-item label="提报形式" prop="type">
  127. <el-checkbox-group v-model="form.type" @change="onCheckboxChange">
  128. <el-checkbox label="附件提报" name="isattrequired"></el-checkbox>
  129. <el-checkbox label="文字提报" name="istextrequired"></el-checkbox>
  130. </el-checkbox-group>
  131. &lt;!&ndash; <el-checkbox :true-label="1" :false-label="0" v-model="form.isattrequired">附件提报</el-checkbox>
  132. <el-checkbox :true-label="1" :false-label="0" v-model="form.istextrequired">文字提报</el-checkbox> &ndash;&gt;
  133. </el-form-item>
  134. </el-col>
  135. </el-form>
  136. </el-row>
  137. </div>
  138. <div class="container normal-panel normal-margin">
  139. <attachmentList :attinfos="form.attinfos" @onSuccess="querySubmitMain" :onlyread="store.state.pageOnlyRead">
  140. <upload slot="upload" :folderid="folderid"
  141. :bindData="{ ownertable: 'sat_submiteditmodel', ownerid: form.sat_submiteditmodelid, usetype: 'default' }"
  142. @onSuccess="onSubmit()"></upload>
  143. </attachmentList>
  144. </div>
  145. </el-col>
  146. <el-col :span="11">
  147. <scopeOfauth :defaultData="defaultData" appidname="sat_submiteditmodelid" obiectName="sat_submiteditmodel" :dataid="$route.query.id"
  148. @onChecked="onChecked"></scopeOfauth>
  149. </el-col>
  150. </el-row>
  151. </div>-->
  152. </div>
  153. </template>
  154. <script>
  155. import attachmentList from '@/components/attachment_list/index.vue'
  156. import upload from '@/components/upload/hw_obs_upload.vue'
  157. import scopeOfauth from '@/components/scopeOfAuthority/index.vue'
  158. import store from '@/store'
  159. export default {
  160. components: {
  161. attachmentList,
  162. upload,
  163. scopeOfauth
  164. },
  165. data() {
  166. return {
  167. drawer:false,
  168. store,
  169. folderid: JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
  170. defaultData: {},
  171. rules: {
  172. title: [
  173. { required: true, message: '请输入课程名称', trigger: 'blur' },
  174. ],
  175. begdate: [
  176. { required: true, message: '请选择生效日期', trigger: 'change' }
  177. ],
  178. enddate: [
  179. { required: true, message: '请选择截止日期', trigger: 'change' }
  180. ],
  181. onceonly: [
  182. { required: true, message: '请选择版块', trigger: 'change' }
  183. ],
  184. notes: [
  185. { required: true, message: '请输入提报要求', trigger: 'blur' },
  186. ],
  187. type: [
  188. { type: 'array', required: true, message: '请至少选择一个提报形式', trigger: 'change' }
  189. ],
  190. },
  191. form: {
  192. "title": "",
  193. "notes": "",
  194. "istextrequired": 1,
  195. "isattrequired": 1,
  196. "onceonly": 1,
  197. "sat_submiteditmodelid": "0",
  198. "begdate": "",
  199. "enddate": "",
  200. "type": []
  201. }
  202. }
  203. },
  204. methods: {
  205. async querySubmitMain() {
  206. const res = await this.$api.requested({
  207. /*"classname": "webmanage.saletool.submitedit.submitedit",
  208. "method": "select_submitdetailed",*/
  209. "id":"20221102093602",
  210. "content": {
  211. "sat_submiteditmodelid": this.$route.query.id
  212. }
  213. })
  214. res.data.notes == '初始化数据' + JSON.parse(sessionStorage.getItem('active_account')).userid ? res.data.notes = '' : '';
  215. this.form = Object.assign({}, this.form, res.data)
  216. if (this.form.isattrequired === 1) { this.form.type.push('附件提报') }
  217. if (this.form.istextrequired === 1) { this.form.type.push('文字提报') }
  218. this.form.status !== '新建' ? store.state.pageOnlyRead = true : store.state.pageOnlyRead = false
  219. },
  220. onSubmit(callback) {
  221. this.$refs['form'].validate(async (valid) => {
  222. if (!valid) return false;
  223. const res = await this.$api.requested({
  224. /*"classname": "webmanage.saletool.submitedit.submitedit",
  225. "method": "insertorupdate",*/
  226. "id":20221102093702,
  227. "content": this.form
  228. })
  229. this.insertCoursewareauth()
  230. callback?callback(res):''
  231. this.drawer = false
  232. this.$router.go(-1)
  233. })
  234. },
  235. // 监听提报形式
  236. onCheckboxChange(val) {
  237. this.form.isattrequired = val.indexOf('附件提报') === -1 ? 0 : 1
  238. this.form.istextrequired = val.indexOf('文字提报') === -1 ? 0 : 1
  239. },
  240. // 获取保存授权范围数据
  241. onChecked(param) {
  242. this.authData = param
  243. console.log("授权数据")
  244. console.log(this.authData)
  245. },
  246. // 新增授权范围
  247. async insertCoursewareauth() {
  248. const res = await this.$api.requested({
  249. /*"classname": "webmanage.saletool.submitedit.submiteditauth",
  250. "method": "insertOrUpdate",*/
  251. "id":"20221102094402",
  252. "content": this.authData
  253. })
  254. res.code === 0 ? this.$notify({
  255. title: '失败',
  256. message: res.data,
  257. type: 'error'
  258. }) : this.querySubmitMain()
  259. },
  260. // 查询授权信息
  261. async query_auth() {
  262. console.log("查询授权信息")
  263. const res = await this.$api.requested({
  264. /*"classname": "webmanage.saletool.submitedit.submiteditauth",
  265. "method": "selectAuth",*/
  266. "id":'20221102094602',
  267. "content": {
  268. "sat_submiteditmodelid": this.$route.query.id
  269. }
  270. })
  271. this.defaultData = res.data
  272. },
  273. async onclose(){
  274. this.drawer = false
  275. const res = this.$api.requested({
  276. "id": 20221102094102,
  277. "content": {
  278. "sat_submiteditmodelids":[this.$route.query.id]
  279. }
  280. })
  281. this.$router.go(-1)
  282. }
  283. },
  284. mounted() {
  285. /*this.drawer = true*/
  286. console.log("输出")
  287. console.log(this.$route.query.id)
  288. if (this.$route.query.id !== ''){
  289. this.drawer = true
  290. /* this.querySubmitMain()
  291. this.query_auth()*/
  292. /*this.query_auth()*/
  293. }
  294. },
  295. created() {
  296. console.log("输出")
  297. console.log(this.$route.query.id)
  298. /*this.drawer = true*/
  299. /*this.querySubmitMain()
  300. this.query_auth()*/
  301. },
  302. }
  303. </script>
  304. <style>
  305. </style>