|
@@ -1,8 +1,381 @@
|
|
|
<template>
|
|
|
+ <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="80"
|
|
|
+ :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
|
|
|
+ :operation="operation" :exportList="exportList">
|
|
|
+ <el-dialog title="" width="1200px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
|
|
|
+ :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
|
|
|
+ <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
|
|
|
+ <zj-form-module :title="formDialogTitles[formDialogType]" label-width="110px" :showPackUp="false"
|
|
|
+ :form-data="formData" :form-items="formItems" :disabled="formDialogType==2">
|
|
|
+ </zj-form-module>
|
|
|
+ </zj-form-container>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="mini" @click="formCancel">取 消</el-button>
|
|
|
+ <el-button size="mini" v-if="formDialogType !== 2" type="primary" @click="formConfirm()">提交</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </template-page>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import TemplatePage from '@/components/template/template-page-1.vue'
|
|
|
+import import_mixin from '@/components/template/import_mixin.js'
|
|
|
+import ImageUpload from '@/components/file-upload'
|
|
|
+import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
|
|
|
+import { listPageV2,pageExport, getDetail, add, edit, del, getExamine } from "@/api/workOrder/rewardsPunishmentsOrder";
|
|
|
+import { getWebsit } from "@/api/customerManagement";
|
|
|
+import { getWorker } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
|
|
|
+export default {
|
|
|
+ components: { TemplatePage, ImageUpload },
|
|
|
+ mixins: [import_mixin],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 事件组合
|
|
|
+ optionsEvensGroup: [
|
|
|
+ [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ name: '新建',
|
|
|
+ click: this.addData
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ // 表格属性
|
|
|
+ tableAttributes: {
|
|
|
+ // 启用勾选列
|
|
|
+ selectColumn: false
|
|
|
+ },
|
|
|
+ // 表格事件
|
|
|
+ tableEvents: {
|
|
|
+ 'selection-change': this.selectionChange
|
|
|
+ },
|
|
|
+ // 勾选选中行
|
|
|
+ recordSelected: [],
|
|
|
+ /** 表单变量 */
|
|
|
+ formDialogType: 0,
|
|
|
+ formDialogTitles: ["新增","编辑", "详情"],
|
|
|
+ formDialog: false,
|
|
|
+ type: JSON.parse(localStorage.getItem('greemall_user')).type, //type=1商户, type=0网点
|
|
|
+ formData: {
|
|
|
+ companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
|
|
|
+ websit: {},
|
|
|
+ websitName: '',
|
|
|
+ websitId: '',
|
|
|
+ worker: {},
|
|
|
+ workerId: '',
|
|
|
+ workerName: '',
|
|
|
+ mobile: '',
|
|
|
+ idcard: '',
|
|
|
+ examineProjectName: '',
|
|
|
+ examineProjectId: '',
|
|
|
+ examineProjectType: '',
|
|
|
+ examineProjectAmount: '',
|
|
|
+ examineProject: {},
|
|
|
+ orderBaseId: '',
|
|
|
+ fileUrl: [],
|
|
|
+ remark: ''
|
|
|
+ },
|
|
|
+ websitList: [],
|
|
|
+ workerList: [],
|
|
|
+ examineList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ // 更多参数
|
|
|
+ moreParameters() {
|
|
|
+ return []
|
|
|
+ },
|
|
|
+ formItems() {
|
|
|
+ return [{
|
|
|
+ md: 12,
|
|
|
+ isShow: true,
|
|
|
+ name: 'el-input',
|
|
|
+ attributes: { placeholder: '请输入', disabled: true },
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '所属商户',
|
|
|
+ prop: 'companyName',
|
|
|
+ rules: [...required]
|
|
|
+ },
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: this.type==1,
|
|
|
+ name: 'slot-component',
|
|
|
+ attributes: { placeholder: '请输入网点名称',},
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '网点名称',
|
|
|
+ prop: 'websitId',
|
|
|
+ rules: [...required]
|
|
|
+ },
|
|
|
+ render: (h, { props, onInput }) => {
|
|
|
+ var { value } = props
|
|
|
+ return (
|
|
|
+ <el-select v-model={this.formData.websit} disabled={this.formDialogType!=0} value-key="websitId" onChange={(e)=>{
|
|
|
+ this.formData.websitId = e.websitId
|
|
|
+ this.formData.websitName = e.name
|
|
|
+ this.getWorker()
|
|
|
+ }} placeholder="请选择" style="width: 100%;">
|
|
|
+ {
|
|
|
+ this.websitList.map((item, index) => {
|
|
|
+ return <el-option key={item.websitId} label={item.name} value={item}></el-option>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </el-select>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: this.type==0,
|
|
|
+ name: 'el-input',
|
|
|
+ attributes: { placeholder: '请输入网点名称', disabled: true },
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '网点名称',
|
|
|
+ prop: 'websitName',
|
|
|
+ rules: [...required]
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: true,
|
|
|
+ name: 'slot-component',
|
|
|
+ attributes: { placeholder: '请选择工程师',},
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '选择工程师',
|
|
|
+ prop: 'workerId',
|
|
|
+ rules: [...required]
|
|
|
+ },
|
|
|
+ render: (h, { props, onInput }) => {
|
|
|
+ var { value } = props
|
|
|
+ return (
|
|
|
+ <el-select v-model={this.formData.worker} disabled={this.formDialogType!=0} value-key="nickName" onChange={(e)=>{
|
|
|
+ this.formData.workerId = e.userId
|
|
|
+ this.formData.workerName = e.nickName
|
|
|
+ this.formData.idcard = e.idCard
|
|
|
+ this.formData.mobile = e.mobile
|
|
|
+ }} placeholder="请选择" style="width: 100%;">
|
|
|
+ {
|
|
|
+ this.workerList.map((item, index) => {
|
|
|
+ return <el-option key={item.userId} label={item.nickName} value={item}></el-option>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </el-select>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: true,
|
|
|
+ name: 'el-input',
|
|
|
+ attributes: { placeholder: '请输入', },
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '身份证',
|
|
|
+ prop: 'idcard',
|
|
|
+ rules: this.formData.idcard?[
|
|
|
+ { pattern:/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '身份证号格式不正确', trigger: 'blur' }
|
|
|
+ ]:[]
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: true,
|
|
|
+ name: 'el-input',
|
|
|
+ attributes: { placeholder: '请输入', },
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '联系电话',
|
|
|
+ prop: 'mobile',
|
|
|
+ rules: this.formData.mobile?[
|
|
|
+ { pattern:/^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/, message: '电话号码格式不正确', trigger: 'blur' }
|
|
|
+ ]:[]
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: true,
|
|
|
+ name: 'slot-component',
|
|
|
+ attributes: { placeholder: '请选择考核项目',},
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '选择考核项目',
|
|
|
+ prop: 'examineProjectName',
|
|
|
+ rules: [...required]
|
|
|
+ },
|
|
|
+ render: (h, { props, onInput }) => {
|
|
|
+ var { value } = props
|
|
|
+ return (
|
|
|
+ <el-select v-model={this.formData.examineProject} disabled={this.formDialogType!=0} value-key="name" onChange={(e)=>{
|
|
|
+ this.formData.examineProjectId = e.id
|
|
|
+ this.formData.examineProjectName = e.name
|
|
|
+ this.formData.examineProjectType = e.type
|
|
|
+ this.formData.examineProjectAmount = e.amount
|
|
|
+ }} placeholder="请选择" style="width: 100%;">
|
|
|
+ {
|
|
|
+ this.examineList.map((item, index) => {
|
|
|
+ return <el-option key={item.id} label={item.name} value={item}></el-option>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </el-select>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: true,
|
|
|
+ name: 'slot-component',
|
|
|
+ attributes: { },
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '考核类型',
|
|
|
+ prop: 'examineProjectType',
|
|
|
+ rules: [...required]
|
|
|
+ },
|
|
|
+ render: (h, { props, onInput }) => {
|
|
|
+ var { value } = props
|
|
|
+ return (
|
|
|
+ <el-radio-group v-model={this.formData.examineProjectType}>
|
|
|
+ <el-radio disabled={true} label="REWARD">奖励</el-radio>
|
|
|
+ <el-radio disabled={true} label="PUNISH">惩罚</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: true,
|
|
|
+ name: 'el-input',
|
|
|
+ attributes: { placeholder: '请输入', type: 'number', disabled: true },
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '考核金额',
|
|
|
+ prop: 'examineProjectAmount',
|
|
|
+ rules: [...required]
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 12,
|
|
|
+ isShow: true,
|
|
|
+ name: 'el-input',
|
|
|
+ attributes: { placeholder: '请输入', type: 'number'},
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '关联工单号',
|
|
|
+ prop: 'orderBaseId',
|
|
|
+ rules: []
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 24,
|
|
|
+ isShow: true,
|
|
|
+ name: 'slot-component',
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '附件',
|
|
|
+ prop: 'fileUrl',
|
|
|
+ rules: []
|
|
|
+ },
|
|
|
+ render: (h, { props, onInput }) => {
|
|
|
+ var { value } = props
|
|
|
+ return (
|
|
|
+ <ImageUpload fileList={this.formData.fileUrl} limit={1} isEdit={this.formDialogType !== 2} />
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ md: 24,
|
|
|
+ isShow: true,
|
|
|
+ name: 'el-input',
|
|
|
+ attributes: { placeholder: '请输入备注内容',type: "textarea", rows: 5 },
|
|
|
+ formItemAttributes: {
|
|
|
+ label: '备注',
|
|
|
+ prop: 'remark',
|
|
|
+ rules: []
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created(){
|
|
|
+ this.getExamine()
|
|
|
+ this.getWebsit()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 列表请求函数
|
|
|
+ getList: listPageV2,
|
|
|
+ // 列表导出函数
|
|
|
+ exportList: pageExport,
|
|
|
+ // 表格列解析渲染数据更改
|
|
|
+ columnParsing(item, defaultData) {
|
|
|
+ if (item.jname === 'fileUrl') {
|
|
|
+ defaultData.render = (h, { row, index, column }) => {
|
|
|
+ return (
|
|
|
+ <div style="padding:0 6px;cursor: pointer;">
|
|
|
+ {row.fileUrl ? row.fileUrl.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return defaultData
|
|
|
+ },
|
|
|
+ // 监听勾选变化
|
|
|
+ selectionChange(data) {
|
|
|
+ this.recordSelected = data
|
|
|
+ },
|
|
|
+ // 表格操作列
|
|
|
+ operation(h, { row, index, column }) {
|
|
|
+ return (
|
|
|
+ <div class='operation-btns'>
|
|
|
+ <el-button type="text" onClick={() => {
|
|
|
+ getDetail({ id: row.id }).then(res => {
|
|
|
+ Object.assign(this.formData, res.data,{
|
|
|
+ fileUrl:res.data?.fileUrl ? res.data?.fileUrl?.split(",").map(item=>({url:item})) : [],
|
|
|
+ worker: {workerId: row.workerId,nickName: row.workerName},
|
|
|
+ websit: {websitId: row.websitId,websitName: row.websitName},
|
|
|
+ examineProject: {name: row.examineProjectName}
|
|
|
+ })
|
|
|
+ this.getWorker()
|
|
|
+ this.formDialogType = 2
|
|
|
+ this.openForm()
|
|
|
+ })
|
|
|
+ }}>详情</el-button>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ getExamine(){
|
|
|
+ getExamine({pageNum: 1,pageSize: -1,params: []}).then(res => {
|
|
|
+ this.examineList = res.data.records
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getWebsit(){
|
|
|
+ if(this.type == 0){
|
|
|
+ this.formData.websitId = JSON.parse(localStorage.getItem('greemall_user')).adminWebsitId
|
|
|
+ this.formData.websitName = JSON.parse(localStorage.getItem('greemall_user')).nickName
|
|
|
+ }else{
|
|
|
+ getWebsit({type: 'C'}).then(res => {
|
|
|
+ this.websitList = res.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getWorker(){
|
|
|
+ getWorker({pageNum: 1,pageSize: -1,params: [{param: 'b.websit_id',compare: '=',value: this.formData.websitId}]}).then(res => {
|
|
|
+ this.workerList = res.data.records
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addData() {
|
|
|
+ this.formDialogType = 0
|
|
|
+ this.openForm()
|
|
|
+ },
|
|
|
+ openForm() {
|
|
|
+ this.formDialog = true;
|
|
|
+ },
|
|
|
+ formCancel() {
|
|
|
+ this.$refs.formRef.$refs.inlineForm.clearValidate()
|
|
|
+ this.$data.formData = this.$options.data().formData
|
|
|
+ this.formDialog = false
|
|
|
+ },
|
|
|
+ formConfirm() {
|
|
|
+ this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
|
|
|
+ if (valid) {
|
|
|
+ ([add, edit][this.formDialogType])({
|
|
|
+ ...this.formData,
|
|
|
+ fileUrl:this.formData.fileUrl.map(item=>item.url).join(",")
|
|
|
+ }).then(res => {
|
|
|
+ this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
|
|
|
+ this.formCancel()
|
|
|
+ this.$refs.pageRef.refreshList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
-</style>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .tab{
|
|
|
+ padding: 20px 20px 0 20px;
|
|
|
+ }
|
|
|
+</style>
|