Nav apraksta

editWorkOrder.vue 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <template>
  2. <view class="wrapper">
  3. <view class="form">
  4. <form @submit="formSubmit" @reset="formReset">
  5. <view class="uni-form-item uni-column">
  6. <view class="title">标题:</view>
  7. <input class="uni-input" name="workOrderTitle" :value="formData.workOrderTitle" placeholder="标题" />
  8. </view>
  9. <view class="uni-form-item uni-column">
  10. <view class="title">来电内容:</view>
  11. <view class="uni-textarea">
  12. <textarea name="callContent" :value="formData.callContent" auto-height />
  13. </view>
  14. </view>
  15. <view class="uni-form-item uni-column">
  16. <view class="title">工单内容:</view>
  17. <view class="uni-textarea">
  18. <textarea name="workOrderContent" :value="formData.workOrderContent" auto-height />
  19. </view>
  20. </view>
  21. <view class="uni-form-item uni-column">
  22. <view class="title">处理方式:</view>
  23. <radio-group name="processingMethod" :value="formData.processingMethod" @change="bindChangeProcessingMethod">
  24. <label> <radio value="1" :checked="!radioChecked.processingMethod" /><text>当即办理</text> </label>
  25. <label> <radio value="0" :checked="radioChecked.processingMethod" /><text>网络转办</text> </label>
  26. </radio-group>
  27. </view>
  28. <view class="uni-form-item uni-column" v-show="isDisplay.result">
  29. <view class="title">办理内容:</view>
  30. <view class="uni-textarea">
  31. <textarea name="result" :value="formData.result" auto-height />
  32. </view>
  33. </view>
  34. <view class="uni-form-item uni-column">
  35. <view class="title">姓名:</view>
  36. <input class="uni-input" name="name" :value="formData.name" placeholder="这是一个输入框" />
  37. </view>
  38. <view class="uni-form-item uni-column">
  39. <view class="title">性别:</view>
  40. <radio-group name="gender" :value="formData.gender">
  41. <label> <radio value="0" :checked="radioChecked.gender" /><text>男</text></label>
  42. <label> <radio value="1" :checked="!radioChecked.gender" /><text>女</text></label>
  43. </radio-group>
  44. </view>
  45. <view class="uni-form-item uni-column">
  46. <view class="uni-title uni-common-pl">来源:</view>
  47. <view class="uni-list">
  48. <view class="uni-list-cell">
  49. <view class="uni-list-cell-db">
  50. <picker @change="bindPickerChangeSource" :range="sourceListData" :range-key="'F_Value'">
  51. <view name="source" class="uni-input">{{ sourceListData[pickerIndex.indexSource].F_Value }}</view>
  52. </picker>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="uni-form-item uni-column">
  58. <view class="title">来电号码:</view>
  59. <input class="uni-input" name="callerNumber" :value="formData.callerNumber" placeholder="这是一个输入框" />
  60. </view>
  61. <view class="uni-form-item uni-column">
  62. <view class="uni-title uni-common-pl">类型:</view>
  63. <view class="uni-list">
  64. <view class="uni-list-cell">
  65. <view class="uni-list-cell-db">
  66. <picker @change="bindPickerChangeType" value="" :range="typeListData" :range-key="'F_Value'">
  67. <view class="uni-input">{{ typeListData[pickerIndex.indexType].F_Value }}</view>
  68. </picker>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="uni-form-item uni-column">
  74. <view class="title">反映类别:</view>
  75. <view>
  76. <bjx-inputs the-style="font-size: 14px; overflow: auto" :value="formData.responseCategory" item-key="names" placeholder="请输入内容" @list="getReflectCategoryData" @select="selectReflectCategory" overflow="hide"> </bjx-inputs>
  77. </view>
  78. </view>
  79. <view class="uni-form-item uni-column">
  80. <view class="title">号码密级:</view>
  81. <radio-group name="numberSecurityLevel" :value="formData.numberSecurityLevel">
  82. <label> <radio value="0" :checked="radioChecked.numberSecurityLevel" /><text>普通</text> </label>
  83. <label> <radio value="1" :checked="!radioChecked.numberSecurityLevel" /><text>保密</text> </label>
  84. </radio-group>
  85. </view>
  86. <view class="uni-form-item uni-column">
  87. <view class="uni-title uni-common-pl">紧急程度:</view>
  88. <view class="uni-list">
  89. <view class="uni-list-cell">
  90. <view class="uni-list-cell-db">
  91. <picker @change="bindPickerChangeEmergencyLevel" :value="pickerIndex.indexEmergencyLevel" :range="emergencyLevelListData" :range-key="'text'">
  92. <view class="uni-input">{{ emergencyLevelListData[pickerIndex.indexEmergencyLevel].text }}</view>
  93. </picker>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="uni-form-item uni-column" v-show="isDisplay.phoneType">
  99. <view class="uni-title uni-common-pl">电话类别:</view>
  100. <view class="uni-list">
  101. <view class="uni-list-cell">
  102. <view class="uni-list-cell-db">
  103. <picker @change="bindPickerChangePhoneType" :value="formData.phoneType" :range="phoneTypeListData" :range-key="'F_Remark'">
  104. <view class="uni-input">{{ phoneTypeListData[pickerIndex.indexPhoneType].F_Remark }}</view>
  105. </picker>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <view class="uni-form-item uni-column" v-show="isDisplay.leaderCharge">
  111. <view class="uni-title uni-common-pl">分管领导:</view>
  112. <view class="uni-list">
  113. <view class="uni-list-cell">
  114. <view class="uni-list-cell-db">
  115. <picker @change="bindPickerChangeLeaderCharge" :value="formData.leaderCharge" :range="leaderChargeListData" :range-key="'text'">
  116. <view class="uni-input">{{ leaderChargeListData[pickerIndex.indexLeaderCharge].text }}</view>
  117. </picker>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="uni-form-item uni-column" v-show="isDisplay.leaderCharge">
  123. <view class="uni-title uni-common-pl">事发区域:</view>
  124. <view class="uni-list">
  125. <view class="uni-list-cell">
  126. <view class="uni-list-cell-db">
  127. <picker @change="bindPickerChangeLeaderCharge" :value="formData.leaderCharge" :range="leaderChargeListData" :range-key="'text'">
  128. <view class="uni-input">{{ leaderChargeListData[pickerIndex.indexLeaderCharge].text }}</view>
  129. </picker>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. <!-- <view class="uni-form-item uni-column" v-show="isDisplay.leaderCharge">
  135. <view class="uni-title uni-common-pl">分管领导:</view>
  136. <view class="uni-list">
  137. <view class="uni-list-cell">
  138. <view class="uni-list-cell-db">
  139. <picker @change="bindPickerChangeLeaderCharge" :value="formData.leaderCharge" :range="leaderChargeListData" :range-key="'text'">
  140. <view class="uni-input">{{ leaderChargeListData[pickerIndex.indexLeaderCharge].text }}</view>
  141. </picker>
  142. </view>
  143. </view>
  144. </view>
  145. </view> -->
  146. <!-- <view class="uni-form-item uni-column" v-show="isDisplay.leaderCharge">
  147. <view class="uni-title uni-common-pl">分管领导:</view>
  148. <view class="uni-list">
  149. <view class="uni-list-cell">
  150. <view class="uni-list-cell-db">
  151. <picker @change="bindPickerChangeLeaderCharge" :value="formData.leaderCharge" :range="leaderChargeListData" :range-key="'text'">
  152. <view class="uni-input">{{ leaderChargeListData[pickerIndex.indexLeaderCharge].text }}</view>
  153. </picker>
  154. </view>
  155. </view>
  156. </view>
  157. </view> -->
  158. <view class="uni-btn-v">
  159. <button form-type="submit" class="mini-btn" type="default" size="mini">保存</button>
  160. </view>
  161. </form>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. import BjxInputs from "@/components/bjx-inputs/bjx-inputs.vue"
  167. export default {
  168. components: {
  169. BjxInputs,
  170. },
  171. data() {
  172. return {
  173. wid: "", // 工单id
  174. title: "picker",
  175. index: 0,
  176. reflectCategoryListData: [], // 反映类别列表数据
  177. // date: currentDate,
  178. formData: {
  179. workOrderTitle: "", // 标题
  180. callContent: "", // 来电内容
  181. workOrderContent: "", // 工单内容
  182. processingMethod: "", // 处理方式
  183. result: "", // 办理内容
  184. name: "", // 姓名
  185. gender: "", // 性别
  186. source: "", // 来源
  187. callerNumber: "", // 来电号码
  188. workOrderType: "", // 工单类型
  189. responseCategory: "", // 反映类别
  190. responseCategoryId: "", // 反映类别id
  191. numberSecurityLevel: "", // 来电号码密级
  192. emergencyLevel: "", // 紧急程度
  193. organizer: "", // 承办单位
  194. processingTimeLimit: "", // 办理时限
  195. emergencyTimeLimit: "", // 积极时限
  196. phoneType: "", // 电话类别
  197. phoneTypeId: "", // 电话类别
  198. leaderCharge: "", // 分管领导
  199. threeWayCall: "", // 三方通话
  200. },
  201. radioChecked: {
  202. processingMethod: true,
  203. gender: true,
  204. numberSecurityLevel: true,
  205. },
  206. isDisplay: {
  207. result: false, // 办理内容
  208. phoneType: false, // 电话类别
  209. leaderCharge: false, // 分管领导
  210. },
  211. pickerIndex: {
  212. indexSource: 0, // 来源index
  213. indexType: 0, // 类型index
  214. indexEmergencyLevel: 0, // 紧急程度index
  215. indexPhoneType: 0, // 电话类别index
  216. indexLeaderCharge: 0, // 分管领导index
  217. },
  218. // 来源数据
  219. sourceListData: [
  220. {
  221. F_Value: "请选择",
  222. }
  223. ],
  224. // 工单类型数据
  225. typeListData: [
  226. {
  227. F_Value: "请选择",
  228. }
  229. ],
  230. // 紧急程度
  231. emergencyLevelListData: [
  232. {
  233. value: "1",
  234. text: "普通",
  235. },
  236. {
  237. value: "2",
  238. text: "紧急",
  239. },
  240. ],
  241. // 电话类别
  242. phoneTypeListData: [
  243. {
  244. F_Value: "请选择",
  245. }
  246. ],
  247. // 分管领导
  248. leaderChargeListData: [
  249. {
  250. value: "0",
  251. text: "省长",
  252. },
  253. {
  254. value: "1",
  255. text: "市长",
  256. }
  257. ]
  258. }
  259. },
  260. onLoad(option) {
  261. console.log("option", option);
  262. this.wid = option.wid
  263. // 获取来源数据 dictionaryId=1
  264. this.getDictionaryData(1)
  265. // 获取来源数据 dictionaryId=2
  266. this.getDictionaryData(2)
  267. // 获取电话类别 dictionaryId=2498
  268. this.getDictionaryData(2498)
  269. // 获取反映类别
  270. this.getReflectCategoryList()
  271. // 获取详情 type=0
  272. this.getDetail(0)
  273. },
  274. methods: {
  275. formSubmit: function (e) {
  276. this.formData.workOrderTitle = e.detail.value.workOrderTitle;
  277. this.formData.processingMethod = e.detail.value.processingMethod;
  278. this.formData.name = e.detail.value.name;
  279. this.formData.gender = e.detail.value.gender;
  280. this.formData.callerNumber = e.detail.value.callerNumber;
  281. this.formData.numberSecurityLevel = e.detail.value.numberSecurityLevel;
  282. this.formData.callContent = e.detail.value.callContent;
  283. this.formData.workOrderContent = e.detail.value.workOrderContent;
  284. this.formData.result = e.detail.value.result;
  285. console.log("form发生了submit事件,携带数据为:" + JSON.stringify(e.detail.value))
  286. this.saveData();
  287. },
  288. // 保存
  289. saveData() {
  290. const params = {
  291. workorderid: this.wid,
  292. cusname: this.formData.name, // 姓名
  293. cussex: this.formData.gender, // 性别
  294. cusphone: this.formData.callerNumber, // 电话
  295. title: this.formData.workOrderTitle, // 标题
  296. content: this.formData.callContent, // 来电内容
  297. workcontent: this.formData.workOrderContent, // 工单内容
  298. // files: $("#file").val(), //(多个用英文逗号,隔开)
  299. files: "",
  300. // sourcearea: $("#sourcearea").val(), //=事发地域id
  301. sourcearea: "",
  302. // sourceaddress: $("#sourceaddress").val(), //=事发详细地址
  303. sourceaddress: "",
  304. source: this.formData.source, // 来源
  305. splituser: this.formData.leaderCharge, // 分管领导
  306. phonetype: this.formData.phoneType, // 电话类别
  307. isresult: this.formData.processingMethod, //=(0转办1直办)
  308. // business: this.formData.threeWayCall, // 三方通话
  309. business: "0",
  310. result: this.formData.result, // 办理内容
  311. keys: this.formData.responseCategoryId, // 反映类别
  312. type: this.formData.workOrderType, // 类型
  313. isprotect: this.formData.numberSecurityLevel, //=(0普通1保密)
  314. level: this.formData.emergencyLevel, //=(1普通2紧急)
  315. // visittype: $("#visittype").val(), // 回访方式
  316. issubmit: 0, //=(0保存1保存并提交)
  317. token: uni.getStorageSync("token"),
  318. }
  319. this.$http
  320. .post("/WorkOrder/EditWorkOrder", params)
  321. .then((response) => {
  322. if (response.state.toLowerCase() === "success") {
  323. }
  324. })
  325. .catch((e) => {
  326. console.log(e)
  327. })
  328. },
  329. //获取详情
  330. getDetail(type) {
  331. let params = {
  332. type: type,
  333. workorderid: this.wid,
  334. token: uni.getStorageSync("token"),
  335. }
  336. this.$http.get("/WorkOrder/GetWorkOrderNew", params).then((response) => {
  337. if (response.state.toLowerCase() === "success") {
  338. let data = response.data.data[0];
  339. this.formData.name = data.F_CusName; // 姓名
  340. this.formData.gender = data.F_CusSex; // 性别
  341. this.formData.callerNumber = data.F_CusPhone; // 电话
  342. this.formData.workOrderTitle = data.F_ComTitle; // 标题
  343. this.formData.callContent = data.F_Content; // 来电内容
  344. this.formData.workOrderContent = data.F_Content; // 工单内容
  345. // files: $("#file").val(), //(多个用英文逗号,隔开)
  346. // sourcearea: $("#sourcearea").val(), //=事发地域id
  347. // sourceaddress: $("#sourceaddress").val(), //=事发详细地址
  348. // this.formData.threeWayCall = data.F_Business, // 三方通话
  349. this.formData.result = data.F_Result; // 办理内容
  350. this.formData.responseCategoryId = data.F_Key; // 反映类别
  351. // 处理方式(0转办1直办)
  352. if (String(data.F_IsResult) === "0") {
  353. this.radioChecked.processingMethod = true;
  354. } else if (Sting(data.F_IsResult) === "1") {
  355. this.radioChecked.processingMethod = false;
  356. }
  357. // 性别(0男1女)
  358. if (String(data.F_CusSex) === "0") {
  359. this.radioChecked.gender = true;
  360. } else if (String(data.F_CusSex) === "1") {
  361. this.radioChecked.gender = false;
  362. }
  363. // 号码密级(0普通1保密)
  364. if (String(data.F_IsProtect) === "0") {
  365. this.radioChecked.numberSecurityLevel = true;
  366. } else if (String(data.F_IsProtect) === "1") {
  367. this.radioChecked.numberSecurityLevel = false;
  368. }
  369. // 来源
  370. this.sourceListData.forEach((e,i) => {
  371. if (String(e.F_ValueId) === String(data.F_InfoSource)) {
  372. this.pickerIndex.indexSource = i;
  373. this.formData.source = data.F_InfoSource;
  374. }
  375. });
  376. // 咨询
  377. this.typeListData.forEach((e,i) => {
  378. if (String(e.F_ValueId) === String(data.F_InfoType)) {
  379. this.pickerIndex.indexType = i;
  380. this.formData.workOrderType = data.F_InfoType;
  381. }
  382. });
  383. // 紧急程度
  384. this.emergencyLevelListData.forEach((e,i) => {
  385. if (String(e.value) === String(data.F_Level)) {
  386. this.pickerIndex.indexEmergencyLevel = i;
  387. this.formData.emergencyLevel = data.F_Level;
  388. }
  389. });
  390. // 分管领导
  391. this.phoneTypeListData.forEach((e,i) => {
  392. if (String(e.text) === String(data.F_PhoneType)) {
  393. this.pickerIndex.indexPhoneType = i;
  394. this.formData.phoneType = data.F_PhoneType;
  395. }
  396. });
  397. // 分管领导
  398. this.leaderChargeListData.forEach((e,i) => {
  399. if (String(e.text) === String(data.F_SplitUser)) {
  400. this.pickerIndex.indexLeaderCharge = i;
  401. this.formData.leaderCharge = data.F_SplitUser;
  402. }
  403. });
  404. // visittype: $("#visittype").val(), // 回访方式
  405. }
  406. }).catch((e) => {
  407. console.log(e);
  408. })
  409. },
  410. // 获取数据字典
  411. getDictionaryData(dictionaryId) {
  412. const params = {
  413. id: dictionaryId,
  414. token: uni.getStorageSync("token"),
  415. }
  416. this.$http
  417. .get("/Dictionary/GetDicValueListById", params)
  418. .then((response) => {
  419. if (response.state.toLowerCase() === "success") {
  420. let data = response.data;
  421. if (String(dictionaryId) === "1") {
  422. // 来源数据
  423. this.sourceListData = data;
  424. } else if (String(dictionaryId) === "2") {
  425. // 类型数据
  426. this.typeListData = data;
  427. } else if (String(dictionaryId) === "2498") {
  428. // 电话类别
  429. this.phoneTypeListData = data;
  430. }
  431. }
  432. })
  433. .catch((e) => {
  434. console.log(e)
  435. })
  436. },
  437. getReflectCategoryList() {
  438. let params = {
  439. token: uni.getStorageSync("token"),
  440. }
  441. this.$http
  442. .get("Dictionary/GetKeyListNew", params)
  443. .then((response) => {
  444. if (response.state.toLowerCase() === "success") {
  445. let data = response.data
  446. this.reflectCategoryListData = data
  447. }
  448. })
  449. .catch((e) => {
  450. console.log(e)
  451. })
  452. },
  453. // 远程加载数据 返回一个对象,{value: 输入框值, callback: 回调函数}
  454. getReflectCategoryData(e) {
  455. console.log("e", e)
  456. this.formData.responseCategory = e.value
  457. if (!e.value) {
  458. e.callback(this.reflectCategoryListData)
  459. } else {
  460. let data = []
  461. this.reflectCategoryListData.forEach((item) => {
  462. if (item.names.indexOf(e.value) > -1) {
  463. data.push(item)
  464. }
  465. })
  466. e.callback(data)
  467. }
  468. },
  469. selectReflectCategory(value) {
  470. this.formData.responseCategory = value.name
  471. this.formData.responseCategoryId = value.id
  472. },
  473. bindPickerChange: function (e) {
  474. console.log("picker发送选择改变,携带值为", e.target.value)
  475. this.index = e.target.value
  476. },
  477. bindPickerChangeSource: function (e) {
  478. this.pickerIndex.indexSource = e.target.value;
  479. this.formData.source = this.sourceListData[e.target.value].F_ValueId;
  480. if (String(this.formData.source) === "4") {
  481. this.isDisplay.leaderCharge = true
  482. this.isDisplay.phoneType = false
  483. } else if (String(this.formData.source) === "1") {
  484. this.isDisplay.phoneType = true
  485. this.isDisplay.leaderCharge = false
  486. } else {
  487. this.isDisplay.phoneType = false
  488. this.isDisplay.leaderCharge = false
  489. }
  490. },
  491. bindPickerChangeType: function (e) {
  492. this.pickerIndex.indexType = e.target.value;
  493. this.formData.workOrderType = this.typeListData[e.target.value].F_ValueId
  494. },
  495. bindPickerChangeEmergencyLevel: function (e) {
  496. this.pickerIndex.indexEmergencyLevel = e.target.value;
  497. this.formData.emergencyLevel = this.emergencyLevelListData[e.target.value].value
  498. },
  499. bindPickerChangePhoneType: function (e) {
  500. this.pickerIndex.indexPhoneType = e.target.value;
  501. this.formData.phoneType = this.phoneTypeListData[e.target.value].F_ValueId
  502. },
  503. bindPickerChangeLeaderCharge: function (e) {
  504. this.pickerIndex.indexLeaderCharge = e.target.value;
  505. this.formData.leaderCharge = this.leaderChargeListData[e.target.value].text
  506. },
  507. bindChangeProcessingMethod: function (e) {
  508. if (String(e.detail.value) === "0") {
  509. this.isDisplay.result = false;
  510. } else if (String(e.detail.value) === "1") {
  511. this.isDisplay.result = true;
  512. }
  513. }
  514. },
  515. }
  516. </script>
  517. <style lang="scss">
  518. .wrapper {
  519. padding: 10px 15px;
  520. .form {
  521. .uni-form-item {
  522. // display: flex;
  523. margin: 10px 0 0 0;
  524. padding: 0 0 5px 0;
  525. font-size: 14px;
  526. border-bottom: 1px solid #bfbfbf;
  527. .title {
  528. font-size: 14px;
  529. }
  530. .uni-input {
  531. font-size: 14px;
  532. }
  533. radio-group label radio {
  534. transform: scale(0.7);
  535. }
  536. radio-group uni-text {
  537. font-size: 14px;
  538. }
  539. .uni-input-input {
  540. font-size: 14px !important;
  541. }
  542. .bjx-inputs {
  543. // .uni-input-wrapper {
  544. // font-size: 14px !important;
  545. // }
  546. // .uni-input {
  547. // font-size: 14px !important;
  548. // }
  549. .uni-input-placeholder {
  550. font-size: 14px;
  551. }
  552. }
  553. }
  554. .uni-btn-v {
  555. margin: 15px 0 0 0;
  556. text-align: center;
  557. button{
  558. background: #1e90ff;
  559. color: #eee
  560. }
  561. }
  562. }
  563. }
  564. </style>